19 #ifndef NET_INSTAWEB_REWRITER_PUBLIC_LOCAL_STORAGE_CACHE_FILTER_H_
20 #define NET_INSTAWEB_REWRITER_PUBLIC_LOCAL_STORAGE_CACHE_FILTER_H_
24 #include "net/instaweb/rewriter/cached_result.pb.h"
35 namespace net_instaweb {
49 static const char kLscCookieName[];
54 static const char kStoredTotal[];
55 static const char kStoredImages[];
56 static const char kStoredCss[];
57 static const char kCandidatesAdded[];
58 static const char kCandidatesRemoved[];
63 InlineState() : initialized_(
false), enabled_(
false) {}
81 virtual void StartElementImpl(
HtmlElement* element);
84 virtual const char*
Name()
const {
return "LocalStorageCache"; }
85 virtual const char* id()
const {
86 return RewriteOptions::kLocalStorageCacheId;
89 std::set<StringPiece>* mutable_cookie_hashes() {
return &cookie_hashes_; }
109 RewriteDriver* driver,
110 bool skip_cookie_check,
111 HtmlElement* element,
123 const CachedResult& cached,
124 RewriteDriver* driver,
125 HtmlElement* element);
129 RewriteDriver* driver);
136 const StringPiece cookie_name,
137 const StringPiece hash,
138 std::set<StringPiece>* hash_set);
141 const StringPiece& lsc_url,
145 bool script_inserted_;
147 bool script_needs_inserting_;
150 std::set<StringPiece> cookie_hashes_;
153 Variable* num_local_storage_cache_candidates_found_;
155 Variable* num_local_storage_cache_stored_total_;
157 Variable* num_local_storage_cache_stored_images_;
159 Variable* num_local_storage_cache_stored_css_;
161 Variable* num_local_storage_cache_candidates_added_;
163 Variable* num_local_storage_cache_candidates_removed_;
static bool AddLscAttributes(const StringPiece url, const CachedResult &cached, RewriteDriver *driver, HtmlElement *element)
ScriptUsage GetScriptUsage() const override
Definition: local_storage_cache_filter.h:131
static const char kCandidatesFound[]
Statistics' names.
Definition: local_storage_cache_filter.h:53
Definition: statistics.h:43
virtual const char * Name() const
The name of this filter – used for logging and debugging.
Definition: local_storage_cache_filter.h:84
static bool AddStorableResource(const StringPiece &url, RewriteDriver *driver, bool skip_cookie_check, HtmlElement *element, InlineState *state)
Definition: local_storage_cache_filter.h:47
Base class for implementations of monitoring statistics.
Definition: statistics.h:342
virtual void StartDocumentImpl()
Definition: html_element.h:42
static void RemoveLscAttributes(HtmlElement *element, RewriteDriver *driver)
Remove the LSC attributes from the given element.
std::string GoogleString
PAGESPEED_KERNEL_BASE_STRING_H_.
Definition: string.h:24
ScriptUsage
Describes a filter's relationship with scripts.
Definition: html_filter.h:38
Definition: rewrite_filter.h:35
Definition: rewrite_driver.h:100
State information for an inline filter using LSC.
Definition: local_storage_cache_filter.h:61
static const char kLscInitializer[]
public for the test harness only.
Definition: local_storage_cache_filter.h:50
Definition: html_filter.h:43
virtual void EndDocument()
static void InitStats(Statistics *statistics)
May be called multiple times, if there are multiple statistics objects.