Page Speed Optimization Libraries  1.13.35.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Static Public Member Functions | Static Public Attributes | Friends | List of all members
net_instaweb::InPlaceRewriteContext Class Reference

Context that is used for an in-place rewrite. More...

#include "in_place_rewrite_context.h"

Inheritance diagram for net_instaweb::InPlaceRewriteContext:
net_instaweb::SingleRewriteContext net_instaweb::RewriteContext

Public Member Functions

 InPlaceRewriteContext (RewriteDriver *driver, const StringPiece &url)
 
virtual void RewriteSingle (const ResourcePtr &input, const OutputResourcePtr &output)
 Implements SingleRewriteContext::RewriteSingle().
 
virtual const char * id () const
 Implements RewriteContext::id().
 
virtual OutputResourceKind kind () const
 Implements RewriteContext::kind().
 
virtual bool DecodeFetchUrls (const OutputResourcePtr &output_resource, MessageHandler *message_handler, GoogleUrlStarVector *url_vector)
 Implements RewriteContext::DecodeFetchUrls().
 
virtual void StartFetchReconstruction ()
 Implements RewriteContext::StartFetchReconstruction().
 
bool proxy_mode () const
 
void set_proxy_mode (bool x)
 
virtual int64 GetRewriteDeadlineAlarmMs () const
 
virtual GoogleString UserAgentCacheKey (const ResourceContext *resource_context) const
 
virtual void EncodeUserAgentIntoResourceContext (ResourceContext *context)
 
virtual bool CreationLockBeforeStartFetch () const
 
bool ScheduleNestedContextViaCentalController () const override
 
- Public Member Functions inherited from net_instaweb::SingleRewriteContext
 SingleRewriteContext (RewriteDriver *driver, RewriteContext *parent, ResourceContext *resource_context)
 
- Public Member Functions inherited from net_instaweb::RewriteContext
 RewriteContext (RewriteDriver *driver, RewriteContext *parent, ResourceContext *resource_context)
 
int num_slots () const
 
ResourceSlotPtr slot (int index) const
 
int num_outputs () const
 
OutputResourcePtr output (int i) const
 
int num_output_partitions () const
 
const CachedResult * output_partition (int i) const
 
CachedResult * mutable_output_partition (int i)
 
bool chained () const
 
void AddSlot (const ResourceSlotPtr &slot)
 
void RemoveLastSlot ()
 
void AddNestedContext (RewriteContext *context)
 
void CallFetchInputs ()
 
void CallLockFailed ()
 
void CallStartFetchImpl ()
 
void Initiate ()
 
bool Fetch (const OutputResourcePtr &output_resource, AsyncFetch *fetch, MessageHandler *message_handler)
 
bool slow () const
 
bool is_metadata_cache_miss () const
 This particular rewrite was a metadata cache miss.
 
bool has_parent () const
 Returns true if this is a nested rewriter.
 
bool IsNestedIn (StringPiece id) const
 
void CheckNotFrozen ()
 
RewriteContextparent ()
 Allows a nested rewriter to walk up its parent hierarchy.
 
const RewriteContextparent () const
 
int num_nested () const
 Accessors for the nested rewrites.
 
RewriteContextnested (int i) const
 
RewriteDriverDriver () const
 
void set_force_rewrite (bool x)
 If called with true, forces a rewrite and re-generates the output.
 
bool rewrite_uncacheable () const
 
void set_rewrite_uncacheable (bool rewrite_uncacheable)
 
const ResourceContext * resource_context () const
 
GoogleString ToString () const
 Returns debug information about this RewriteContext.
 
GoogleString ToStringWithPrefix (StringPiece prefix) const
 

Static Public Member Functions

static void InitStats (Statistics *statistics)
 
- Static Public Member Functions inherited from net_instaweb::RewriteContext
static void InitStats (Statistics *stats)
 Initializes statistics.
 

Static Public Attributes

static const char kInPlaceOversizedOptStream []
 
static const char kInPlaceUncacheableRewrites []
 
- Static Public Attributes inherited from net_instaweb::RewriteContext
static const char kNumRewritesAbandonedForLockContention []
 
static const char kNumDeadlineAlarmInvocations []
 
static const char kHashMismatchMessage []
 

Friends

class RecordingFetch
 

Additional Inherited Members

- Public Types inherited from net_instaweb::RewriteContext
typedef std::vector< InputInfo * > InputInfoStarVector
 
- Protected Types inherited from net_instaweb::RewriteContext
typedef std::vector< GoogleUrl * > GoogleUrlStarVector
 
- Protected Member Functions inherited from net_instaweb::SingleRewriteContext
virtual bool Partition (OutputPartitions *partitions, OutputResourceVector *outputs)
 SingleRewriteContext takes care of these methods from RewriteContext:
 
virtual void Rewrite (int partition_index, CachedResult *partition, const OutputResourcePtr &output)
 
void AddLinkRelCanonical (const ResourcePtr &input, ResponseHeaders *output)
 Adds a link: rel=canonical header pointing to the input URL as canonical.
 
void AddLinkRelCanonicalForFallbackHeaders (ResponseHeaders *output)
 Helper for using above in FixFetchFallbackHeaders()
 
- Protected Member Functions inherited from net_instaweb::RewriteContext
ServerContextFindServerContext () const
 
const RewriteOptionsOptions () const
 
OutputPartitions * partitions ()
 
void AddRecheckDependency ()
 
virtual bool OptimizationOnly () const
 
virtual void PartitionAsync (OutputPartitions *partitions, OutputResourceVector *outputs)
 
void PartitionDone (RewriteResult result)
 
void CrossThreadPartitionDone (RewriteResult result)
 
void RewriteDone (RewriteResult result, int partition_index)
 
virtual bool SendFallbackResponse (StringPiece output_url_base, StringPiece contents, AsyncFetch *async_fetch, MessageHandler *handler)
 
void StartNestedTasks ()
 
bool AreOutputsAllowedByCsp (CspDirective role) const
 Helper that checks that all output resources are OK with CSP as given role.
 
virtual void Render ()
 
virtual void WillNotRender ()
 
virtual void Cancel ()
 
virtual const UrlSegmentEncoderencoder () const
 
virtual GoogleString CacheKeySuffix () const
 
void AttachDependentRequestTrace (const StringPiece &label)
 
RequestTracedependent_request_trace ()
 
void TracePrintf (const char *fmt,...)
 
void DetachFetch ()
 
void Freshen ()
 Freshens resources proactively to avoid expiration in the near future.
 
bool notify_driver_on_fetch_done () const
 
void set_notify_driver_on_fetch_done (bool value)
 
AsyncFetchasync_fetch ()
 Note that the following must only be called in the fetch flow.
 
bool FetchContextDetached ()
 Is fetch_ detached? Only call this in the fetch flow.
 
MessageHandlerfetch_message_handler ()
 The message handler for the fetch.
 
bool stale_rewrite () const
 Indicates whether we are serving a stale rewrite.
 
virtual bool FailOnHashMismatch () const
 
virtual bool ScheduleViaCentralController ()
 
void ObtainLockForCreation (ServerContext *server_context, Function *callback)
 
void ReleaseCreationLock (bool succeeded)
 
- Static Protected Member Functions inherited from net_instaweb::RewriteContext
static bool LookupMetadataForOutputResourceImpl (OutputResourcePtr output_resource, const GoogleUrl &gurl, RewriteContext *rewrite_context, RewriteDriver *driver, GoogleString *error_out, CacheLookupResultCallback *callback)
 

Detailed Description

Context that is used for an in-place rewrite.

Member Function Documentation

virtual bool net_instaweb::InPlaceRewriteContext::CreationLockBeforeStartFetch ( ) const
inlinevirtual

We don't lock for IPRO because IPRO would rather stream back the original resource than wait for the optimization.

Reimplemented from net_instaweb::RewriteContext.

virtual void net_instaweb::InPlaceRewriteContext::EncodeUserAgentIntoResourceContext ( ResourceContext *  context)
virtual

Encodes User Agent into the ResourceContext. A subclass ResourceContext should normally call RewriteFilter::EncodeUserAgentIntoResourceContext if it has access to a RewriteFilter.

Reimplemented from net_instaweb::RewriteContext.

virtual int64 net_instaweb::InPlaceRewriteContext::GetRewriteDeadlineAlarmMs ( ) const
virtual

Returns an interval in milliseconds to wait when configuring the deadline alarm in FetchContext::SetupDeadlineAlarm(). Subclasses may configure the deadline based on rewrite type, e.g., IPRO vs. HTML-path.

Reimplemented from net_instaweb::RewriteContext.

bool net_instaweb::InPlaceRewriteContext::ScheduleNestedContextViaCentalController ( ) const
inlineoverridevirtual

The context nested inside this context can be scheduled via the CentralController. See comment in RewriteContext::ObtainLockForCreation.

Reimplemented from net_instaweb::RewriteContext.

virtual GoogleString net_instaweb::InPlaceRewriteContext::UserAgentCacheKey ( const ResourceContext *  context) const
virtual

Indicates user agent capabilities that must be stored in the cache key.

Note that the context may be NULL as it may not be set before this. Since it isn't going to be modified in the method, ResourceContext is passed as a const pointer.

Todo:
TODO(morlovich): This seems to overlap with CacheKeySuffix.

Reimplemented from net_instaweb::RewriteContext.

Member Data Documentation

const char net_instaweb::InPlaceRewriteContext::kInPlaceOversizedOptStream[]
static

Stats variable name to keep track of how often in-place falls back to stream (due to a large resource) when Options->in_place_wait_for_optimized is true.


The documentation for this class was generated from the following file: