Page Speed Optimization Libraries
1.2.24.1
|
#include "rate_controlling_url_async_fetcher.h"
Public Member Functions | |
RateControllingUrlAsyncFetcher (UrlAsyncFetcher *fetcher, int max_global_queue_size, int per_host_outgoing_request_threshold, int per_host_queued_request_threshold, ThreadSystem *thread_system, Statistics *statistics) | |
virtual bool | SupportsHttps () const |
virtual void | Fetch (const GoogleString &url, MessageHandler *message_handler, AsyncFetch *fetch) |
virtual void | ShutDown () |
Fetcher that uses RateController to limit amount of background fetches we direct to a fetcher it wraps per domain. See RateController documentation for more details.
net_instaweb::RateControllingUrlAsyncFetcher::RateControllingUrlAsyncFetcher | ( | UrlAsyncFetcher * | fetcher, |
int | max_global_queue_size, | ||
int | per_host_outgoing_request_threshold, | ||
int | per_host_queued_request_threshold, | ||
ThreadSystem * | thread_system, | ||
Statistics * | statistics | ||
) |
Does not take ownership of 'fetcher'. RateController::InitStats must have been called during stats initialization phase.
virtual void net_instaweb::RateControllingUrlAsyncFetcher::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(sligocki): GoogleString -> GoogleUrl or at least StringPiece.
TODO(sligocki): Include the URL in the fetch, like the request headers.
Implements net_instaweb::UrlAsyncFetcher.
virtual void net_instaweb::RateControllingUrlAsyncFetcher::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::RateControllingUrlAsyncFetcher::SupportsHttps | ( | ) | const [inline, virtual] |
Determine if the fetcher supports fetching using HTTPS. By default we assume a fetcher can.
Reimplemented from net_instaweb::UrlAsyncFetcher.