18 #ifndef NET_INSTAWEB_REWRITER_PUBLIC_FLUSH_EARLY_CONTENT_WRITER_FILTER_H_
19 #define NET_INSTAWEB_REWRITER_PUBLIC_FLUSH_EARLY_CONTENT_WRITER_FILTER_H_
23 #include "net/instaweb/htmlparse/public/html_writer_filter.h"
26 #include "net/instaweb/http/public/semantic_type.h"
27 #include "net/instaweb/http/public/user_agent_matcher.h"
29 #include "net/instaweb/util/public/null_writer.h"
34 namespace net_instaweb {
37 class HtmlCharactersNode;
51 static const char kDisableLinkTag[];
52 static const char kPrefetchImageTagHtml[];
53 static const char kPrefetchStartTimeScript[];
54 static const char kNumResourcesFlushedEarly[];
55 static const char kPrefetchScriptTagHtml[];
56 static const char kPrefetchLinkTagHtml[];
57 static const char kFlushEarlyStyleTemplate[];
61 virtual void StartDocument();
62 virtual void EndDocument();
64 virtual void StartElement(HtmlElement* element);
65 virtual void EndElement(HtmlElement* element);
67 virtual void Characters(HtmlCharactersNode* characters_node);
74 void WriteToOriginalWriter(
const GoogleString& in);
77 bool IsFlushable(
const GoogleUrl& gurl,
78 const FlushEarlyResourceInfo::ResourceType& resource_type);
81 void FlushResourceAsImage(StringPiece url);
86 int64 time_to_download,
87 bool is_pagespeed_resource,
88 semantic_type::Category category);
90 void FlushDeferJavascriptEarly();
91 void UpdateStats(int64 time_to_download,
bool is_pagespeed_resource);
92 GoogleString ComputeFlushEarlyCriticalCss(
const GoogleString& style_id);
95 FlushEarlyResourceInfo::ResourceType GetResourceType(
96 const GoogleUrl& gurl,
bool is_pagespeed_resource);
99 TimedVariable* num_resources_flushed_early_;
102 bool insert_close_script_;
103 int num_resources_flushed_;
104 NullWriter null_writer_;
105 Writer* original_writer_;
106 HtmlElement* current_element_;
107 UserAgentMatcher::PrefetchMechanism prefetch_mechanism_;
108 scoped_ptr<StringSet> private_cacheable_resources_;
109 scoped_ptr<StringSet> public_cacheable_resources_;
110 int64 time_consumed_ms_;
111 int64 max_available_time_ms_;
112 typedef std::list<ResourceInfo*> ResourceInfoList;
113 ResourceInfoList js_resources_info_;
114 bool defer_javascript_enabled_;
115 bool split_html_enabled_;
116 bool is_flushing_critical_style_element_;
117 GoogleString css_output_content_;
118 GoogleString flush_early_content_;
119 bool flush_more_resources_early_if_time_permits_;
120 bool stylesheets_flushed_;
Definition: rewrite_driver.h:98
Definition: flush_early_content_writer_filter.h:49