Tracks a collection of property-cache lookups occuring in parallel. More...
#include "proxy_fetch.h"
Public Member Functions | |
ProxyFetchPropertyCallbackCollector (ResourceManager *manager) | |
void | AddCallback (ProxyFetchPropertyCallback *callback) |
void | ConnectProxyFetch (ProxyFetch *proxy_fetch) |
void | Detach () |
PropertyPage * | GetPropertyPage (ProxyFetchPropertyCallback::CacheType cache_type) |
PropertyPage * | GetPropertyPageWithoutOwnership (ProxyFetchPropertyCallback::CacheType cache_type) |
void | AddPostLookupTask (Function *func) |
virtual void | Done (ProxyFetchPropertyCallback *callback, bool success) |
Called by a ProxyFetchPropertyCallback when the former is complete. |
Tracks a collection of property-cache lookups occuring in parallel.
void net_instaweb::ProxyFetchPropertyCallbackCollector::AddCallback | ( | ProxyFetchPropertyCallback * | callback | ) |
Add a callback to be handled by this collector. Transfers ownership of the callback to the collector.
void net_instaweb::ProxyFetchPropertyCallbackCollector::AddPostLookupTask | ( | Function * | func | ) |
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().
void net_instaweb::ProxyFetchPropertyCallbackCollector::ConnectProxyFetch | ( | ProxyFetch * | proxy_fetch | ) |
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 | ( | ) |
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.
PropertyPage* net_instaweb::ProxyFetchPropertyCallbackCollector::GetPropertyPage | ( | ProxyFetchPropertyCallback::CacheType | cache_type | ) |
Returns the collected PropertyPage with the corresponding cache_type. Ownership of the object is transferred to the caller.
PropertyPage* net_instaweb::ProxyFetchPropertyCallbackCollector::GetPropertyPageWithoutOwnership | ( | ProxyFetchPropertyCallback::CacheType | cache_type | ) |
Returns the collected PropertyPage with the corresponding cache_type. Ownership of the object is retained by collector.