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

#include "resource_fetch.h"

Inheritance diagram for net_instaweb::ResourceFetch:
net_instaweb::SharedAsyncFetch net_instaweb::AsyncFetch net_instaweb::Writer

Public Types

enum  CleanupMode { kAutoCleanupDriver, kDontAutoCleanupDriver }
 For StartWithDriver().
 

Static Public Member Functions

static void Start (const GoogleUrl &url, RewriteOptions *custom_options, ServerContext *server_context, AsyncFetch *async_fetch)
 
static void StartWithDriver (const GoogleUrl &url, CleanupMode cleanup_mode, ServerContext *server_context, RewriteDriver *driver, AsyncFetch *async_fetch)
 
static bool BlockingFetch (const GoogleUrl &url, ServerContext *server_context, RewriteDriver *driver, SyncFetcherAdapterCallback *async_fetch)
 
static RewriteDriverGetDriver (const GoogleUrl &url, RewriteOptions *custom_options, ServerContext *server_context, const RequestContextPtr &request_ctx)
 
- Static Public Member Functions inherited from net_instaweb::AsyncFetch
static bool IsGoogleCacheVia (StringPiece via_value)
 

Protected Member Functions

virtual void HandleHeadersComplete ()
 Protected interface from AsyncFetch.
 
virtual void HandleDone (bool success)
 
- Protected Member Functions inherited from net_instaweb::SharedAsyncFetch
virtual bool HandleWrite (const StringPiece &content, MessageHandler *handler)
 
virtual bool HandleFlush (MessageHandler *handler)
 
virtual bool IsCachedResultValid (const ResponseHeaders &headers)
 
virtual bool IsBackgroundFetch () const
 
void PropagateContentLength ()
 Propagates any set_content_length from this to the base fetch.
 

Additional Inherited Members

- Public Member Functions inherited from net_instaweb::SharedAsyncFetch
 SharedAsyncFetch (AsyncFetch *base_fetch)
 
virtual const RequestContextPtrrequest_context ()
 
- Public Member Functions inherited from net_instaweb::AsyncFetch
 AsyncFetch (const RequestContextPtr &request_ctx)
 
void HeadersComplete ()
 
void Done (bool success)
 
virtual bool Write (const StringPiece &content, MessageHandler *handler)
 
virtual bool Flush (MessageHandler *handler)
 
RequestHeadersrequest_headers ()
 
void set_request_headers (RequestHeaders *headers)
 
void SetRequestHeadersTakingOwnership (RequestHeaders *headers)
 Same as above, but takes ownership.
 
const RequestHeadersrequest_headers () const
 
ResponseHeadersresponse_headers ()
 See doc for request_headers and set_request_headers.
 
void set_response_headers (ResponseHeaders *headers)
 
ResponseHeadersextra_response_headers ()
 
void set_extra_response_headers (ResponseHeaders *headers)
 
virtual void Reset ()
 
bool headers_complete () const
 
bool content_length_known () const
 
int64 content_length () const
 
void set_content_length (int64 x)
 
GoogleString LoggingString ()
 
virtual AbstractLogRecordlog_record ()
 
void FixCacheControlForGoogleCache ()
 
- Public Member Functions inherited from net_instaweb::Writer
virtual bool Dump (Writer *writer, MessageHandler *message_handler)
 
- Static Public Attributes inherited from net_instaweb::AsyncFetch
static const int kContentLengthUnknown = -1
 

Detailed Description

Manages a single fetch of a pagespeed rewritten resource. Fetch is initialized by calling ResourceFetch::Start()

Todo:
TODO(sligocki): Rename to PagespeedResourceFetch or something else ...

Member Function Documentation

static bool net_instaweb::ResourceFetch::BlockingFetch ( const GoogleUrl url,
ServerContext server_context,
RewriteDriver driver,
SyncFetcherAdapterCallback async_fetch 
)
static

Fetch a pagespeed resource in a blocking fashion. Response will be streamed back to async_fetch, but this function will not return until fetch has completed.

You'll probably want to use GetDriver to construct the driver passed in to this method, in order to properly apply experiment info encoded into the URL into settings.

Returns true iff the fetch succeeded and thus response headers and contents were sent to async_fetch.

static RewriteDriver* net_instaweb::ResourceFetch::GetDriver ( const GoogleUrl url,
RewriteOptions custom_options,
ServerContext server_context,
const RequestContextPtr request_ctx 
)
static

Creates a rewrite_driver suitable for passing to BlockingFetch (or StartWithDriver) incorporating any experiment settings. If custom_options it not NULL, takes ownership of it and and can mutate it; otherwise the driver will be made using driver_pool with matching options as the pre-experiment starting point.

Exactly one of custom_options and driver_pool must be non-NULL.

static void net_instaweb::ResourceFetch::Start ( const GoogleUrl url,
RewriteOptions custom_options,
ServerContext server_context,
AsyncFetch async_fetch 
)
static

Start an async fetch for pagespeed resource. Response will be streamed to async_fetch.

If custom_options it not NULL, takes ownership of it and and can mutate it.

static void net_instaweb::ResourceFetch::StartWithDriver ( const GoogleUrl url,
CleanupMode  cleanup_mode,
ServerContext server_context,
RewriteDriver driver,
AsyncFetch async_fetch 
)
static

Same as Start(), but takes the RewriteDriver to use. cleanup_mode determines whether ResourceFetch will call Cleanup() on the driver itself. If it's set to kAutoCleanupDriver, the driver should not be used by the caller after this call. Otherwise, it may be used by the caller, but it's responsible for calling Cleanup() once done with it.


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