Page Speed Optimization Libraries
1.3.25.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/string.h" 00027 00028 namespace net_instaweb { 00029 00030 class AsyncFetch; 00031 class MessageHandler; 00032 class PropertyPage; 00033 class ProxyFetchPropertyCallbackCollector; 00034 class ProxyFetchFactory; 00035 class ServerContext; 00036 class RewriteOptions; 00037 class RewriteDriver; 00038 class Statistics; 00039 class TimedVariable; 00040 00051 class CacheHtmlFlow { 00052 public: 00055 static const char kBackgroundComputationDone[]; 00056 00057 static void Start(const GoogleString& url, 00058 AsyncFetch* base_fetch, 00059 RewriteDriver* driver, 00060 ProxyFetchFactory* factory, 00061 ProxyFetchPropertyCallbackCollector* property_callback); 00062 00063 virtual ~CacheHtmlFlow(); 00064 00065 static void InitStats(Statistics* statistics); 00066 00067 static const char kNumCacheHtmlHits[]; 00068 static const char kNumCacheHtmlMisses[]; 00069 static const char kNumCacheHtmlMatches[]; 00070 static const char kNumCacheHtmlMismatches[]; 00071 static const char kNumCacheHtmlMismatchesCacheDeletes[]; 00072 static const char kNumCacheHtmlSmartdiffMatches[]; 00073 static const char kNumCacheHtmlSmartdiffMismatches[]; 00074 00075 private: 00076 CacheHtmlFlow(const GoogleString& url, 00077 AsyncFetch* base_fetch, 00078 RewriteDriver* driver, 00079 ProxyFetchFactory* factory, 00080 ProxyFetchPropertyCallbackCollector* property_callback); 00081 00082 void CacheHtmlLookupDone(); 00083 00084 void Cancel(); 00085 00087 void CacheHtmlRewriteDone(); 00088 00091 void CacheHtmlHit(PropertyPage* page); 00092 00095 void CacheHtmlMiss(); 00096 00098 void TriggerProxyFetch(); 00099 00102 void PopulateCacheHtmlInfo(PropertyPage* page); 00103 00104 GoogleString url_; 00105 GoogleUrl google_url_; 00106 AsyncFetch* base_fetch_; 00107 RewriteDriver* rewrite_driver_; 00108 const RewriteOptions* options_; 00109 ProxyFetchFactory* factory_; 00110 ServerContext* server_context_; 00111 ProxyFetchPropertyCallbackCollector* property_cache_callback_; 00112 MessageHandler* handler_; 00113 CacheHtmlInfo cache_html_info_; 00114 00115 TimedVariable* num_cache_html_misses_; 00116 TimedVariable* num_cache_html_hits_; 00117 00118 DISALLOW_COPY_AND_ASSIGN(CacheHtmlFlow); 00119 }; 00120 00121 } 00122 00123 #endif ///< NET_INSTAWEB_AUTOMATIC_PUBLIC_CACHE_HTML_FLOW_H_