19 #ifndef NET_INSTAWEB_REWRITER_PUBLIC_IN_PLACE_REWRITE_CONTEXT_H_
20 #define NET_INSTAWEB_REWRITER_PUBLIC_IN_PLACE_REWRITE_CONTEXT_H_
34 #include "net/instaweb/util/public/proto_util.h"
39 namespace net_instaweb {
42 class CacheUrlAsyncFetcher;
46 class ResourceContext;
47 class ResponseHeaders;
58 static const char kIproSlotLocation[];
61 virtual HtmlElement*
element()
const {
return NULL; }
83 static const char kInPlaceUncacheableRewrites[];
90 const OutputResourcePtr& output);
92 virtual const char*
id()
const {
return RewriteOptions::kInPlaceRewriteId; }
97 MessageHandler* message_handler,
98 GoogleUrlStarVector* url_vector);
102 static void InitStats(Statistics* statistics);
104 bool proxy_mode()
const {
return proxy_mode_; }
105 void set_proxy_mode(
bool x) { proxy_mode_ = x; }
110 const ResourceContext* resource_context)
const;
120 virtual void Harvest();
121 void StartFetchReconstructionParent();
123 virtual void FixFetchFallbackHeaders(
const CachedResult& cached_result,
124 ResponseHeaders* headers);
126 virtual void FetchTryFallback(
const GoogleString& url,
127 const StringPiece& hash);
129 virtual void FetchCallbackDone(
bool success);
134 void UpdateDateAndExpiry(
const protobuf::RepeatedPtrField<InputInfo>& inputs,
135 int64* date_ms, int64* expiry_ms);
138 bool InPlaceOptimizeForBrowserEnabled()
const;
141 void AddVaryIfRequired(
const CachedResult& cached_result,
142 ResponseHeaders* headers)
const;
149 GoogleString rewritten_hash_;
152 ResourcePtr input_resource_;
153 OutputResourcePtr output_resource_;
155 scoped_ptr<CacheUrlAsyncFetcher> cache_fetcher_;
177 const ResourcePtr& resource,
179 MessageHandler* handler);
186 virtual bool HandleWrite(
const StringPiece& content, MessageHandler* handler);
195 bool CanInPlaceRewrite();
200 bool ShouldStream()
const;
203 MessageHandler* handler_;
204 ResourcePtr resource_;
209 bool can_in_place_rewrite_;
215 scoped_ptr<ResponseHeaders> saved_headers_;
216 Variable* in_place_oversized_opt_stream_;
217 Variable* in_place_uncacheable_rewrites_;
virtual int64 GetRewriteDeadlineAlarmMs() const
virtual void HandleDone(bool success)
Implements SharedAsyncFetch::HandleDone().
Definition: http_value.h:36
virtual bool HandleFlush(MessageHandler *handler)
Implements SharedAsyncFetch::HandleFlush().
virtual bool DecodeFetchUrls(const OutputResourcePtr &output_resource, MessageHandler *message_handler, GoogleUrlStarVector *url_vector)
Implements RewriteContext::DecodeFetchUrls().
virtual GoogleString UserAgentCacheKey(const ResourceContext *resource_context) const
static const char kInPlaceOversizedOptStream[]
Definition: in_place_rewrite_context.h:82
virtual GoogleString LocationString()
Implements ResourceSlot::LocationString().
Definition: resource_slot.h:53
virtual bool CreationLockBeforeStartFetch()
Definition: in_place_rewrite_context.h:115
Definition: in_place_rewrite_context.h:173
virtual OutputResourceKind kind() const
Implements RewriteContext::kind().
Definition: in_place_rewrite_context.h:94
virtual const char * id() const
Implements RewriteContext::id().
Definition: in_place_rewrite_context.h:92
Definition: async_fetch.h:267
Definition: async_fetch.h:53
Definition: rewrite_filter.h:37
virtual void StartFetchReconstruction()
Implements RewriteContext::StartFetchReconstruction().
Definition: rewrite_driver.h:98
derived from some input resource URL or URLs.
Definition: output_resource_kind.h:27
Context that is used for an in-place rewrite.
Definition: in_place_rewrite_context.h:77
virtual void HandleHeadersComplete()
Implements SharedAsyncFetch::HandleHeadersComplete().
virtual bool HandleWrite(const StringPiece &content, MessageHandler *handler)
Implements SharedAsyncFetch::HandleWrite().
Definition: single_rewrite_context.h:36
virtual HtmlElement * element() const
Return HTML element associated with slot, or NULL if none (CSS, IPRO)
Definition: in_place_rewrite_context.h:61
Definition: in_place_rewrite_context.h:56
virtual void EncodeUserAgentIntoResourceContext(ResourceContext *context)
virtual void Render()
Implements ResourceSlot::Render().
Definition: http_value_writer.h:33
OutputResourceKind
Definition: output_resource_kind.h:26
virtual void RewriteSingle(const ResourcePtr &input, const OutputResourcePtr &output)
Implements SingleRewriteContext::RewriteSingle().