Page Speed Optimization Libraries  1.12.34.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | List of all members
net_instaweb::MockCriticalImagesFinder Class Reference

#include "mock_critical_images_finder.h"

Inheritance diagram for net_instaweb::MockCriticalImagesFinder:
net_instaweb::TestCriticalImagesFinder net_instaweb::CriticalImagesFinder

Public Member Functions

 MockCriticalImagesFinder (Statistics *stats)
 
 MockCriticalImagesFinder (const PropertyCache::Cohort *cohort, Statistics *stats)
 
virtual Availability Available (RewriteDriver *driver)
 
virtual void UpdateCriticalImagesSetInDriver (RewriteDriver *driver)
 
virtual RenderedImages * ExtractRenderedImageDimensionsFromCache (RewriteDriver *driver)
 Extracts rendered image dimensions from property cache.
 
virtual void ComputeCriticalImages (RewriteDriver *driver)
 Compute the critical images for the driver's url.
 
int num_compute_calls ()
 
void set_critical_images (StringSet *critical_images)
 
void set_css_critical_images (StringSet *css_critical_images)
 
void set_rendered_images (RenderedImages *rendered_images)
 
virtual bool IsCriticalImageInfoPresent (RewriteDriver *driver)
 
- Public Member Functions inherited from net_instaweb::TestCriticalImagesFinder
 TestCriticalImagesFinder (const PropertyCache::Cohort *cohort, Statistics *stats)
 
void set_available (Availability available)
 
- Public Member Functions inherited from net_instaweb::CriticalImagesFinder
 CriticalImagesFinder (const PropertyCache::Cohort *cohort, Statistics *stats)
 
virtual int PercentSeenForCritical () const
 
virtual int SupportInterval () const
 
bool IsHtmlCriticalImage (StringPiece image_url, RewriteDriver *driver)
 
bool IsCssCriticalImage (StringPiece image_url, RewriteDriver *driver)
 
bool GetRenderedImageDimensions (RewriteDriver *driver, const GoogleUrl &image_src_gurl, std::pair< int32, int32 > *dimensions)
 
const StringSet & GetHtmlCriticalImages (RewriteDriver *driver)
 
const StringSet & GetCssCriticalImages (RewriteDriver *driver)
 
StringSet * mutable_html_critical_images (RewriteDriver *driver)
 
StringSet * mutable_css_critical_images (RewriteDriver *driver)
 
const PropertyCache::Cohortcohort () const
 
bool UpdateCriticalImagesCacheEntryFromDriver (const StringSet *html_critical_images_set, const StringSet *css_critical_images_set, RewriteDriver *driver)
 
void AddHtmlCriticalImage (const GoogleString &url, RewriteDriver *driver)
 Adds the given url to the html critical image set for the driver.
 
RenderedImages * JsonMapToRenderedImagesMap (const GoogleString &str, const RewriteOptions *options)
 
virtual bool ShouldBeacon (RewriteDriver *driver)
 
virtual BeaconMetadata PrepareForBeaconInsertion (RewriteDriver *driver)
 
virtual void UpdateCandidateImagesForBeaconing (const StringSet &images, RewriteDriver *driver, bool beaconing)
 

Additional Inherited Members

- Public Types inherited from net_instaweb::CriticalImagesFinder
enum  Availability { kDisabled, kNoDataYet, kAvailable }
 
- Static Public Member Functions inherited from net_instaweb::CriticalImagesFinder
static void InitStats (Statistics *statistics)
 
static bool PopulateCriticalImagesFromPropertyValue (const PropertyValue *property_value, CriticalImages *critical_images)
 
static bool UpdateCriticalImagesCacheEntry (const StringSet *html_critical_images_set, const StringSet *css_critical_images_set, const RenderedImages *rendered_images_set, int support_interval, const PropertyCache::Cohort *cohort, AbstractPropertyPage *page)
 
- Static Public Attributes inherited from net_instaweb::CriticalImagesFinder
static const char kCriticalImagesValidCount []
 
static const char kCriticalImagesExpiredCount []
 
static const char kCriticalImagesNotFoundCount []
 
static const char kCriticalImagesPropertyName []
 
static const char kRenderedImageDimensionsProperty []
 
- Protected Member Functions inherited from net_instaweb::CriticalImagesFinder
virtual GoogleString GetKeyForUrl (StringPiece url)
 
CriticalImagesInfoExtractCriticalImagesFromCache (RewriteDriver *driver, const PropertyValue *property_value)
 
- Static Protected Member Functions inherited from net_instaweb::CriticalImagesFinder
static bool UpdateAndWriteBackCriticalImagesCacheEntry (const StringSet *html_critical_images_set, const StringSet *css_critical_images_set, const RenderedImages *rendered_images_set, int support_interval, const PropertyCache::Cohort *cohort, AbstractPropertyPage *page, CriticalImages *critical_images)
 

Detailed Description

Mock implementation of CriticalImagesFinder that can store and retrieve critical images. Note that this doesn't use property cache.

Member Function Documentation

virtual Availability net_instaweb::MockCriticalImagesFinder::Available ( RewriteDriver driver)
inlinevirtual

Checks whether IsHtmlCriticalImage will return meaningful results about critical images. Users of IsHtmlCriticalImage should check this function and supply default behaviors when Available != kAvailable.

Reimplemented from net_instaweb::TestCriticalImagesFinder.

virtual bool net_instaweb::MockCriticalImagesFinder::IsCriticalImageInfoPresent ( RewriteDriver driver)
inlinevirtual

Returns true if the critical images are available, false otherwise. This is virtual only to be overridden in tests.

Reimplemented from net_instaweb::CriticalImagesFinder.

virtual void net_instaweb::MockCriticalImagesFinder::UpdateCriticalImagesSetInDriver ( RewriteDriver driver)
virtual

Gets critical images if present in the property cache and updates the critical_images set in RewriteDriver with the obtained set. If you override this method, driver->critical_images_info() must not return NULL after this function has been called.

Reimplemented from net_instaweb::CriticalImagesFinder.


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