Page Speed Optimization Libraries  1.4.26.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Member Functions
net_instaweb::ProxyFetchPropertyCallbackCollector Class Reference

Tracks a collection of property-cache lookups occuring in parallel. More...

#include "proxy_fetch.h"

List of all members.

Public Member Functions

 ProxyFetchPropertyCallbackCollector (ServerContext *manager, const StringPiece &url, const RequestContextPtr &req_ctx, const RewriteOptions *options, UserAgentMatcher::DeviceType device_type)
void AddCallback (ProxyFetchPropertyCallback *callback)
void ConnectProxyFetch (ProxyFetch *proxy_fetch)
void Detach (HttpStatus::Code status_code)
PropertyPageGetPropertyPage (ProxyFetchPropertyCallback::CacheType cache_type)
PropertyPageGetPropertyPageWithoutOwnership (ProxyFetchPropertyCallback::CacheType cache_type)
void AddPostLookupTask (Function *func)
bool IsCacheValid (int64 write_timestamp_ms) const
void Done (ProxyFetchPropertyCallback *callback, bool success)
 Called by a ProxyFetchPropertyCallback when the former is complete.
void UpdateStatusCodeInPropertyCache ()
 Updates the status code of response in property cache.
const RequestContextPtrrequest_context ()
UserAgentMatcher::DeviceType device_type ()
 Returns DeviceType from device property page.

Detailed Description

Tracks a collection of property-cache lookups occuring in parallel.


Member Function Documentation

Add a callback to be handled by this collector. Transfers ownership of the callback to the collector.

In our flow, property-page will be available via RewriteDriver only after ProxyFetch is set. But there may be instances where the result may be required even before proxy-fetch is created. Any task that depends on the PropertyCache result will be executed as soon as PropertyCache lookup is done. func is guaranteed to execute after PropertyCache lookup has completed, as long as ProxyFetch is not set before PropertyCache lookup is done. One should use PropertyCache result via RewriteDriver if some other thread can initiate SetProxyFetch().

In our flow, we initiate the property-cache lookup prior to creating a proxy-fetch, so that RewriteOptions lookup can proceed in parallel. If/when we determine that ProxyFetch is associated with HTML content, we connect it to this callback. Note that if the property cache lookups have completed, this will result in a direct call into proxy_fetch->PropertyCacheComplete.

void net_instaweb::ProxyFetchPropertyCallbackCollector::Detach ( HttpStatus::Code  status_code)

If for any reason we decide *not* to initiate a ProxyFetch for a request, then we need to 'detach' this request so that we can delete it once it completes, rather than waiting for a ProxyFetch to be inserted. The status code of the response is passed from ProxyFetch to the Collector. In case the status code is unknown then pass RewriteDriver::kStatusCodeUnknown.

Returns the collected PropertyPage with the corresponding cache_type. Ownership of the object is transferred to the caller.

Returns the collected PropertyPage with the corresponding cache_type. Ownership of the object is retained by collector.

bool net_instaweb::ProxyFetchPropertyCallbackCollector::IsCacheValid ( int64  write_timestamp_ms) const

If options_ is NULL returns true. Else, returns true if (url_, write_timestamp_ms) is valid as per URL cache invalidation entries is options_.


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