Page Speed Optimization Libraries  1.8.31.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Static Public Attributes | Protected Member Functions | Friends
net_instaweb::ProxyFetch Class Reference

#include "proxy_fetch.h"

Inheritance diagram for net_instaweb::ProxyFetch:
net_instaweb::SharedAsyncFetch net_instaweb::AsyncFetch

List of all members.

Static Public Attributes

static const char kCollectorConnectProxyFetchFinish []
static const char kCollectorDetachFinish []
static const char kCollectorDoneFinish []
static const char kCollectorFinish []
static const char kCollectorDetachStart []
static const char kHeadersSetupRaceAlarmQueued []
static const char kHeadersSetupRaceDone []
static const char kHeadersSetupRaceFlush []
static const char kHeadersSetupRacePrefix []
static const char kHeadersSetupRaceWait []
static const int kTestSignalTimeoutMs = 200

Protected Member Functions

virtual void HandleHeadersComplete ()
 protected interface from AsyncFetch.
virtual bool HandleWrite (const StringPiece &content, MessageHandler *handler)
virtual bool HandleFlush (MessageHandler *handler)
virtual void HandleDone (bool success)
virtual bool IsCachedResultValid (const ResponseHeaders &headers)

Friends

class ProxyFetchFactory
class ProxyFetchPropertyCallbackCollector
class MockProxyFetch

Detailed Description

Manages a single fetch of an HTML or resource file from the original server. If it is an HTML file, it is rewritten. Fetch is initialized by calling ProxyFetchFactory::StartNewProxyFetch(). For fetching pagespeed rewritten resources, use ResourceFetch. This is only meant to be used by ProxyInterface.

Takes ownership of custom_options.

The ProxyFetch passes through non-HTML directly to base_writer.

For HTML, the sequence is this: 1. HeadersComplete is called, allowing us to establish we've got HTML. 2. Some number of calls to Write occur. 3. Optional: Flush is called, followed by more Writes. Repeat. 4. Done is called. These virtual methods are called from some arbitrary thread, e.g. a dedicated fetcher thread. We use a QueuedWorkerPool::Sequence to offload them to a worker-thread. This implementation bundles together multiple Writes, and depending on the timing, may move Flushes to follow Writes and collapse multiple Flushes into one.


Member Function Documentation

virtual bool net_instaweb::ProxyFetch::IsCachedResultValid ( const ResponseHeaders &  headers) [protected, virtual]

Is the cache entry corresponding to headers valid? Default is that it is valid. Sub-classes can provide specific implementations, e.g., based on cache invalidation timestamp in domain specific options. Used by CacheUrlAsyncFetcher.

Todo:
TODO(nikhilmadan): Consider making this virtual so that subclass authors are forced to look at this function.

Reimplemented from net_instaweb::SharedAsyncFetch.


Member Data Documentation

These strings identify sync-points for reproducing races between PropertyCache lookup completion and Origin HTML Fetch completion.

These strings identify sync-points for introducing races between PropertyCache lookup completion and HeadersComplete.

Number of milliseconds to wait, in a test, for an event that we are hoping does not occur, specifically an inappropriate call to base_fetch()->HeadersComplete() while we are still mutating response headers in SetupForHtml.

This is used only for testing.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines