Page Speed Optimization Libraries
1.8.31.3
|
#include "critical_selector_finder.h"
Public Member Functions | |
CriticalSelectorFinder (const PropertyCache::Cohort *cohort, NonceGenerator *nonce_generator, Statistics *stats) | |
bool | IsCriticalSelector (RewriteDriver *driver, const GoogleString &selector) |
const StringSet & | GetCriticalSelectors (RewriteDriver *driver) |
virtual void | WriteCriticalSelectorsToPropertyCache (const StringSet &selector_set, StringPiece nonce, RewriteDriver *driver) |
BeaconMetadata | PrepareForBeaconInsertion (const StringSet &selector_set, RewriteDriver *driver) |
virtual int | SupportInterval () const =0 |
Gets the SupportInterval for a new beacon result. | |
Static Public Member Functions | |
static void | InitStats (Statistics *statistics) |
static void | WriteCriticalSelectorsToPropertyCacheStatic (const StringSet &selector_set, StringPiece nonce, int support_interval, bool should_replace_prior_result, const PropertyCache *cache, const PropertyCache::Cohort *cohort, AbstractPropertyPage *page, MessageHandler *message_handler, Timer *timer) |
Static Public Attributes | |
static const char | kCriticalSelectorsValidCount [] |
static const char | kCriticalSelectorsExpiredCount [] |
static const char | kCriticalSelectorsNotFoundCount [] |
static const char | kCriticalSelectorsPropertyName [] |
Protected Member Functions | |
virtual bool | ShouldReplacePriorResult () const |
Returns true if a beacon result should replace all previous results. |
Interface to store/retrieve critical selector information in the property cache. See critical_finder_support_util.h for a description on how critical selectors are stored and updated.
net_instaweb::CriticalSelectorFinder::CriticalSelectorFinder | ( | const PropertyCache::Cohort * | cohort, |
NonceGenerator * | nonce_generator, | ||
Statistics * | stats | ||
) |
All of the passed-in constructor arguments are owned by the caller. If critical selector data is being received from a trusted source (ShouldReplacePriorResult() must return true in this case), nonce_generator may be NULL.
BeaconMetadata net_instaweb::CriticalSelectorFinder::PrepareForBeaconInsertion | ( | const StringSet & | selector_set, |
RewriteDriver * | driver | ||
) |
Given a set of candidate critical selectors, decide whether beaconing should take place. We should *always* beacon if there's new critical selector data. Otherwise re-beaconing is based on a time and request interval. Returns the BeaconMetadata; result.status indicates whether beaconing should occur.
virtual void net_instaweb::CriticalSelectorFinder::WriteCriticalSelectorsToPropertyCache | ( | const StringSet & | selector_set, |
StringPiece | nonce, | ||
RewriteDriver * | driver | ||
) | [virtual] |
Updates the critical selectors in the property cache. Support for the new selector_set is added to the existing record of beacon support. This updates the value in the in-memory property page but does not write the cohort. If results are obtained from a trusted source (ShouldReplacePriorResult() must return true) then nonce may be NULL.
static void net_instaweb::CriticalSelectorFinder::WriteCriticalSelectorsToPropertyCacheStatic | ( | const StringSet & | selector_set, |
StringPiece | nonce, | ||
int | support_interval, | ||
bool | should_replace_prior_result, | ||
const PropertyCache * | cache, | ||
const PropertyCache::Cohort * | cohort, | ||
AbstractPropertyPage * | page, | ||
MessageHandler * | message_handler, | ||
Timer * | timer | ||
) | [static] |
As above, but suitable for use in a beacon context where no RewriteDriver is available.