Page Speed Optimization Libraries
1.3.25.1
|
Classes | |
class | InlineState |
State information for an inline filter using LSC. More... | |
Public Member Functions | |
LocalStorageCacheFilter (RewriteDriver *rewrite_driver) | |
virtual void | StartDocumentImpl () |
virtual void | EndDocument () |
Note: EndDocument will be called imediately before the last Flush call. | |
virtual void | StartElementImpl (HtmlElement *element) |
virtual void | EndElementImpl (HtmlElement *element) |
virtual const char * | Name () const |
The name of this filter -- used for logging and debugging. | |
virtual const char * | id () const |
std::set< StringPiece > * | mutable_cookie_hashes () |
Static Public Member Functions | |
static bool | AddStorableResource (const StringPiece &url, RewriteDriver *driver, bool skip_cookie_check, HtmlElement *element, InlineState *state) |
static bool | AddLscAttributes (const StringPiece url, const CachedResult &cached, bool has_url, RewriteDriver *driver, HtmlElement *element) |
static void | RemoveLscAttributes (HtmlElement *element) |
Remove the LSC attributes from the given element. | |
Static Public Attributes | |
static const char | kLscCookieName [] |
static const char | kLscInitializer [] |
public for the test harness only. |
static bool net_instaweb::LocalStorageCacheFilter::AddLscAttributes | ( | const StringPiece | url, |
const CachedResult & | cached, | ||
bool | has_url, | ||
RewriteDriver * | driver, | ||
HtmlElement * | element | ||
) | [static] |
Tell the LSC to add its attributes to the given element: pagespeed_lsc_url (if not already added [has_url is false]), pagespeed_lsc_hash, and, if the resource has an expiry time [in cached], pagespeed_lsc_expiry. This is a no-op if LSC is disabled. url is the URL of the resource being rewritten. cached is the result of the resource rewrite. has_url is true if the element already has an url so don't add it again. driver is the request's context. element is the element to update. Returns true if the element was updated.
static bool net_instaweb::LocalStorageCacheFilter::AddStorableResource | ( | const StringPiece & | url, |
RewriteDriver * | driver, | ||
bool | skip_cookie_check, | ||
HtmlElement * | element, | ||
InlineState * | state | ||
) | [static] |
Tell the LSC that the resource with the given url is a candidate for storing in the browser's local storage. If LSC is disabled it's a no-op, otherwise it determines the LSC's version of the url and, if skip_cookie_check is true or the hash of the LSC's url is in the LSC's cookie, adds the LSC's url as an attribute of the given element, which the LSC later uses to tell that the element is suitable for storing in local cache. Returns true if the attribute was added. Saves various computed values in the given state variable for any subsequent call (a filter might need to call this method once with skip_cookie_check false, then again later with it true). url is the URL from the HTML element, src from img, href from style. driver is the request's context. is_enabled is set to true if the local storage cache filter is enabled. skip_cookie_check if true skips the checking of the cookie for the hash and adds the LSC's url attribute if LSC is enabled. element is the element to add the attribute to. state is where to save the computed values.
virtual void net_instaweb::LocalStorageCacheFilter::StartDocumentImpl | ( | ) | [virtual] |
Overload these implementer methods: Intentionally left abstract so that implementers don't forget to change the name from Blah to BlahImpl.
Implements net_instaweb::CommonFilter.