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 | List of all members
net_instaweb::UrlAsyncFetcherStats Class Reference
Inheritance diagram for net_instaweb::UrlAsyncFetcherStats:
net_instaweb::UrlAsyncFetcher

Public Member Functions

 UrlAsyncFetcherStats (StringPiece prefix, UrlAsyncFetcher *base_fetcher, Timer *timer, Statistics *statistics)
 
virtual bool SupportsHttps () const
 
virtual void Fetch (const GoogleString &url, MessageHandler *message_handler, AsyncFetch *fetch)
 
virtual int64 timeout_ms ()
 
virtual void ShutDown ()
 
- Public Member Functions inherited from net_instaweb::UrlAsyncFetcher
void set_fetch_with_gzip (bool x)
 
bool fetch_with_gzip () const
 
AsyncFetchEnableInflation (AsyncFetch *fetch) const
 

Static Public Member Functions

static void InitStats (StringPiece prefix, Statistics *statistics)
 

Additional Inherited Members

- Static Public Attributes inherited from net_instaweb::UrlAsyncFetcher
static const int64 kUnspecifiedTimeout
 
- Protected Member Functions inherited from net_instaweb::UrlAsyncFetcher
 UrlAsyncFetcher ()
 

Constructor & Destructor Documentation

net_instaweb::UrlAsyncFetcherStats::UrlAsyncFetcherStats ( StringPiece  prefix,
UrlAsyncFetcher base_fetcher,
Timer timer,
Statistics statistics 
)

Creates a fetcher that delegates to base_fetcher, while collecting statistics. The variables will be prefixed with 'prefix'; which must have been passed to ::InitStats during statistics initialization process.

Note that base_fetcher should not have fetch_with_gzip() as it would break usage metering; if you want that functionality you should turn it off on base_fetcher and turn it on UrlAsyncFetcherStats.

Does not own base_fetcher (so you can have multiple UrlAsyncFetcherStats objects around a single UrlAsyncFetcher object).

Member Function Documentation

virtual void net_instaweb::UrlAsyncFetcherStats::Fetch ( const GoogleString url,
MessageHandler message_handler,
AsyncFetch fetch 
)
virtual

Asynchronously fetch a URL, set the response headers and stream the contents to fetch and call fetch->Done() when the fetch finishes.

There is an unchecked contract that response_headers are set before the response_writer or callback are used. Caution, several implementations do not satisfy this contract (but should).

Todo:

TODO(sligocki): GoogleString -> GoogleUrl or at least StringPiece.

TODO(sligocki): Include the URL in the fetch, like the request headers.

Implements net_instaweb::UrlAsyncFetcher.

static void net_instaweb::UrlAsyncFetcherStats::InitStats ( StringPiece  prefix,
Statistics statistics 
)
static

This must be called once for every unique prefix used with UrlAsyncFetcherStats.

virtual void net_instaweb::UrlAsyncFetcherStats::ShutDown ( )
virtual

Stops all active fetches and prevents further fetches from starting, calling back to ->Done(false).

Base-class implementation is empty for forward compatibility.

Reimplemented from net_instaweb::UrlAsyncFetcher.

virtual bool net_instaweb::UrlAsyncFetcherStats::SupportsHttps ( ) const
virtual

Reimplementation of UrlAsyncFetcher methods. See base class for API specifications.

Reimplemented from net_instaweb::UrlAsyncFetcher.

virtual int64 net_instaweb::UrlAsyncFetcherStats::timeout_ms ( )
virtual

Returns a maximum time that we will allow fetches to take, or kUnspecifiedTimeout (the default) if we don't promise to timeout fetches.

Reimplemented from net_instaweb::UrlAsyncFetcher.


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