Page Speed Optimization Libraries
1.4.26.1
|
00001 /* 00002 * Copyright 2013 Google Inc. 00003 * 00004 * Licensed under the Apache License, Version 2.0 (the "License"); 00005 * you may not use this file except in compliance with the License. 00006 * You may obtain a copy of the License at 00007 * 00008 * http:///www.apache.org/licenses/LICENSE-2.0 00009 * 00010 * Unless required by applicable law or agreed to in writing, software 00011 * distributed under the License is distributed on an "AS IS" BASIS, 00012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 * See the License for the specific language governing permissions and 00014 * limitations under the License. 00015 */ 00016 00019 00020 #ifndef NET_INSTAWEB_AUTOMATIC_PUBLIC_CACHE_HTML_FLOW_H_ 00021 #define NET_INSTAWEB_AUTOMATIC_PUBLIC_CACHE_HTML_FLOW_H_ 00022 00023 #include "net/instaweb/rewriter/cache_html_info.pb.h" 00024 #include "net/instaweb/util/public/google_url.h" 00025 #include "net/instaweb/util/public/basictypes.h" 00026 #include "net/instaweb/util/public/scoped_ptr.h" 00027 #include "net/instaweb/util/public/string.h" 00028 00029 namespace net_instaweb { 00030 00031 class AsyncFetch; 00032 class LogRecord; 00033 class MessageHandler; 00034 class PropertyPage; 00035 class ProxyFetchPropertyCallbackCollector; 00036 class ProxyFetchFactory; 00037 class ServerContext; 00038 class RewriteOptions; 00039 class RewriteDriver; 00040 class Statistics; 00041 class TimedVariable; 00042 00053 class CacheHtmlFlow { 00054 public: 00055 class LogHelper; 00056 00059 static const char kBackgroundComputationDone[]; 00060 00061 static void Start(const GoogleString& url, 00062 AsyncFetch* base_fetch, 00063 RewriteDriver* driver, 00064 ProxyFetchFactory* factory, 00065 ProxyFetchPropertyCallbackCollector* property_callback); 00066 00067 virtual ~CacheHtmlFlow(); 00068 00069 static void InitStats(Statistics* statistics); 00070 00071 static const char kNumCacheHtmlHits[]; 00072 static const char kNumCacheHtmlMisses[]; 00073 static const char kNumCacheHtmlMatches[]; 00074 static const char kNumCacheHtmlMismatches[]; 00075 static const char kNumCacheHtmlMismatchesCacheDeletes[]; 00076 static const char kNumCacheHtmlSmartdiffMatches[]; 00077 static const char kNumCacheHtmlSmartdiffMismatches[]; 00078 00079 private: 00080 CacheHtmlFlow(const GoogleString& url, 00081 AsyncFetch* base_fetch, 00082 RewriteDriver* driver, 00083 ProxyFetchFactory* factory, 00084 ProxyFetchPropertyCallbackCollector* property_callback); 00085 00086 void CacheHtmlLookupDone(); 00087 00088 void Cancel(); 00089 00091 void CacheHtmlRewriteDone(bool flushed_split_js); 00092 00095 void CacheHtmlHit(PropertyPage* page); 00096 00099 void CacheHtmlMiss(); 00100 00102 void TriggerProxyFetch(); 00103 00106 void PopulateCacheHtmlInfo(PropertyPage* page); 00107 00108 GoogleString url_; 00109 GoogleUrl google_url_; 00110 AsyncFetch* base_fetch_; 00113 scoped_ptr<LogRecord> cache_html_log_record_; 00114 RewriteDriver* rewrite_driver_; 00115 const RewriteOptions* options_; 00116 ProxyFetchFactory* factory_; 00117 ServerContext* server_context_; 00118 ProxyFetchPropertyCallbackCollector* property_cache_callback_; 00119 MessageHandler* handler_; 00120 CacheHtmlInfo cache_html_info_; 00121 scoped_ptr<LogHelper> cache_html_log_helper_; 00122 00123 TimedVariable* num_cache_html_misses_; 00124 TimedVariable* num_cache_html_hits_; 00125 00126 DISALLOW_COPY_AND_ASSIGN(CacheHtmlFlow); 00127 }; 00128 00129 } 00130 00131 #endif ///< NET_INSTAWEB_AUTOMATIC_PUBLIC_CACHE_HTML_FLOW_H_