Page Speed Optimization Libraries
1.7.30.4
|
Finds critical CSS rules (i.e. CSS needed for the initial page load). More...
#include "critical_css_finder.h"
Public Member Functions | |
CriticalCssFinder (const PropertyCache::Cohort *cohort, Statistics *stats) | |
virtual CriticalCssResult * | GetCriticalCssFromCache (RewriteDriver *driver) |
virtual void | ComputeCriticalCss (RewriteDriver *driver)=0 |
Compute the critical css for the driver's url. | |
virtual bool | UpdateCache (RewriteDriver *driver, const CriticalCssResult &result) |
Copy |critical_css_map| into property cache. Returns true on success. | |
virtual void | UpdateCriticalCssInfoInDriver (RewriteDriver *driver) |
virtual CriticalCssResult * | GetCriticalCss (RewriteDriver *driver) |
const PropertyCache::Cohort * | cohort () const |
Static Public Member Functions | |
static void | InitStats (Statistics *statistics) |
Static Public Attributes | |
static const char | kCriticalCssValidCount [] |
static const char | kCriticalCssExpiredCount [] |
static const char | kCriticalCssNotFoundCount [] |
static const char | kCriticalCssPropertyName [] |
Finds critical CSS rules (i.e. CSS needed for the initial page load).
virtual CriticalCssResult* net_instaweb::CriticalCssFinder::GetCriticalCss | ( | RewriteDriver * | driver | ) | [virtual] |
Gets the critical CSS rules from the driver if they are present. Otherwise calls UpdateCriticalCssInfoInDriver() to populate the ruleset in the driver and returns the rules. The ownership of the CriticalCssResult is not released and it stays with the driver.
virtual CriticalCssResult* net_instaweb::CriticalCssFinder::GetCriticalCssFromCache | ( | RewriteDriver * | driver | ) | [virtual] |
Get critical css result from property cache. Ownership of the result is passed to the caller.
Reimplemented in net_instaweb::MockCriticalCssFinder.
virtual void net_instaweb::CriticalCssFinder::UpdateCriticalCssInfoInDriver | ( | RewriteDriver * | driver | ) | [virtual] |
Collects the critical CSS rules from the property cache and updates the same in the rewrite driver. The ownership of the ruleset stays with the driver.