Page Speed Optimization Libraries
1.5.27.2
|
#include "proxy_fetch.h"
Static Public Attributes | |
static const char | kCollectorDone [] |
static const char | kCollectorPrefix [] |
static const char | kCollectorReady [] |
static const char | kCollectorDelete [] |
static const char | kCollectorDetach [] |
static const char | kCollectorDoneDelete [] |
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 |
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.
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.
Reimplemented from net_instaweb::SharedAsyncFetch.
const char net_instaweb::ProxyFetch::kCollectorDone[] [static] |
These strings identify sync-points for reproducing races between PropertyCache lookup completion and Origin HTML Fetch completion.
const char net_instaweb::ProxyFetch::kHeadersSetupRaceAlarmQueued[] [static] |
These strings identify sync-points for introducing races between PropertyCache lookup completion and HeadersComplete.
const int net_instaweb::ProxyFetch::kTestSignalTimeoutMs = 200 [static] |
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.