Page Speed Optimization Libraries  1.9.32.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
cache_html_flow.h
Go to the documentation of this file.
1 /*
2  * Copyright 2013 Google Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http:///www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
19 
20 #ifndef NET_INSTAWEB_AUTOMATIC_PUBLIC_CACHE_HTML_FLOW_H_
21 #define NET_INSTAWEB_AUTOMATIC_PUBLIC_CACHE_HTML_FLOW_H_
22 
23 #include "net/instaweb/rewriter/cache_html_info.pb.h"
24 #include "pagespeed/kernel/base/basictypes.h"
25 #include "pagespeed/kernel/base/scoped_ptr.h"
26 #include "pagespeed/kernel/base/string.h"
27 #include "pagespeed/kernel/http/google_url.h"
28 
29 namespace net_instaweb {
30 
31 class AbstractLogRecord;
32 class AsyncFetch;
33 class FallbackPropertyPage;
34 class MessageHandler;
35 class PropertyPage;
36 class ProxyFetchPropertyCallbackCollector;
37 class ProxyFetchFactory;
38 class ServerContext;
39 class RewriteOptions;
40 class RewriteDriver;
41 class Statistics;
42 class TimedVariable;
43 
55  public:
56  class LogHelper;
57 
60  static const char kBackgroundComputationDone[];
61 
62  static void Start(const GoogleString& url,
63  AsyncFetch* base_fetch,
64  RewriteDriver* driver,
65  ProxyFetchFactory* factory,
66  ProxyFetchPropertyCallbackCollector* property_callback);
67 
68  virtual ~CacheHtmlFlow();
69 
70  static void InitStats(Statistics* statistics);
71 
72  static const char kNumCacheHtmlHits[];
73  static const char kNumCacheHtmlMisses[];
74  static const char kNumCacheHtmlMatches[];
75  static const char kNumCacheHtmlMismatches[];
76  static const char kNumCacheHtmlMismatchesCacheDeletes[];
77  static const char kNumCacheHtmlSmartdiffMatches[];
78  static const char kNumCacheHtmlSmartdiffMismatches[];
79 
80  private:
81  CacheHtmlFlow(const GoogleString& url,
82  AsyncFetch* base_fetch,
83  RewriteDriver* driver,
84  ProxyFetchFactory* factory,
85  ProxyFetchPropertyCallbackCollector* property_callback);
86 
87  void CacheHtmlLookupDone();
88 
89  void Cancel();
90 
92  void CacheHtmlRewriteDone(bool flushed_split_js);
93 
99  void CacheHtmlHit(FallbackPropertyPage* page);
100 
103  void CacheHtmlMiss();
104 
106  void TriggerProxyFetch();
107 
110  void PopulateCacheHtmlInfo(PropertyPage* page);
111 
112  GoogleString url_;
113  GoogleUrl google_url_;
114  AsyncFetch* base_fetch_;
117  scoped_ptr<AbstractLogRecord> cache_html_log_record_;
118  RewriteDriver* rewrite_driver_;
119  const RewriteOptions* options_;
120  ProxyFetchFactory* factory_;
121  ServerContext* server_context_;
122  ProxyFetchPropertyCallbackCollector* property_cache_callback_;
123  MessageHandler* handler_;
124  CacheHtmlInfo cache_html_info_;
125  scoped_ptr<LogHelper> cache_html_log_helper_;
126 
127  TimedVariable* num_cache_html_misses_;
128  TimedVariable* num_cache_html_hits_;
129 
130  DISALLOW_COPY_AND_ASSIGN(CacheHtmlFlow);
131 };
132 
133 }
134 
135 #endif
Definition: cache_html_flow.h:54
static const char kBackgroundComputationDone[]
Definition: cache_html_flow.h:56
Definition: async_fetch.h:53
Definition: rewrite_driver.h:98
Definition: server_context.h:101
Definition: proxy_fetch.h:62
Definition: rewrite_options.h:83