Page Speed Optimization Libraries
1.4.26.1
|
#include "beacon_critical_images_finder.h"
Public Member Functions | |
BeaconCriticalImagesFinder (Statistics *stats) | |
virtual bool | IsMeaningful (const RewriteDriver *driver) const |
virtual int | PercentSeenForCritical () const |
virtual int | NumSetsToKeep () const |
virtual bool | IsHtmlCriticalImage (const GoogleString &image_url, RewriteDriver *driver) |
virtual void | ComputeCriticalImages (StringPiece url, RewriteDriver *driver) |
Compute the critical images for the given url. | |
virtual const char * | GetCriticalImagesCohort () const |
Support critical (above the fold) image detection through a javascript beacon on the client.
virtual const char* net_instaweb::BeaconCriticalImagesFinder::GetCriticalImagesCohort | ( | ) | const [inline, virtual] |
Identifies which cohort in the PropertyCache the critical image information is located in.
Implements net_instaweb::CriticalImagesFinder.
virtual bool net_instaweb::BeaconCriticalImagesFinder::IsHtmlCriticalImage | ( | const GoogleString & | image_url, |
RewriteDriver * | driver | ||
) | [virtual] |
Checks whether the requested image is present in the critical set or not. The critical image beacon sends back hashes of the URls to save space, so this computes the same hash on image_url and checks if it is stored in the critical image set.
Reimplemented from net_instaweb::CriticalImagesFinder.
virtual bool net_instaweb::BeaconCriticalImagesFinder::IsMeaningful | ( | const RewriteDriver * | driver | ) | const [inline, virtual] |
Checks whether IsHtmlCriticalImage will return meaningful results about critical images. Users of IsHtmlCriticalImage should check this function and supply a default behavior if IsMeaningful returns false.
Implements net_instaweb::CriticalImagesFinder.
virtual int net_instaweb::BeaconCriticalImagesFinder::NumSetsToKeep | ( | ) | const [inline, virtual] |
The number of past critical image sets to keep. By default, we only keep the most recent one. The beacon critical image finder should override this to store a larger number of sets.
Reimplemented from net_instaweb::CriticalImagesFinder.
virtual int net_instaweb::BeaconCriticalImagesFinder::PercentSeenForCritical | ( | ) | const [inline, virtual] |
In order to handle varying critical image sets returned by the beacon, we store a history of the last N critical images, and only declare an image critical if it appears critical in the last M out of N sets reported. This function returns what percentage of the sets need to include the image for it be considered critical.
Reimplemented from net_instaweb::CriticalImagesFinder.