Page Speed Optimization Libraries
1.2.24.1
|
00001 // Copyright 2011 Google Inc. 00016 00017 #ifndef NET_INSTAWEB_APACHE_APACHE_SERVER_CONTEXT_H_ 00018 #define NET_INSTAWEB_APACHE_APACHE_SERVER_CONTEXT_H_ 00019 00020 #include "net/instaweb/apache/apache_config.h" 00021 #include "net/instaweb/rewriter/public/server_context.h" 00022 #include "net/instaweb/util/public/basictypes.h" 00023 #include "net/instaweb/util/public/scoped_ptr.h" 00024 #include "net/instaweb/util/public/string.h" 00025 #include "net/instaweb/util/public/string_util.h" 00026 00027 struct server_rec; 00028 00029 namespace net_instaweb { 00030 00031 class AbstractMutex; 00032 class ApacheRewriteDriverFactory; 00033 class Histogram; 00034 class RewriteDriverPool; 00035 class RewriteStats; 00036 class SharedMemStatistics; 00037 class Statistics; 00038 class UrlAsyncFetcherStats; 00039 class Variable; 00040 00047 class ApacheServerContext : public ServerContext { 00048 public: 00049 ApacheServerContext(ApacheRewriteDriverFactory* factory, 00050 server_rec* server, 00051 const StringPiece& version); 00052 virtual ~ApacheServerContext(); 00053 00054 GoogleString hostname_identifier() { return hostname_identifier_; } 00055 ApacheRewriteDriverFactory* apache_factory() { return apache_factory_; } 00056 ApacheConfig* config(); 00057 bool InitFileCachePath(); 00058 00066 ApacheConfig* SpdyConfigOverlay(); 00067 ApacheConfig* NonSpdyConfigOverlay(); 00068 00071 bool has_spdy_config_overlay() const { 00072 return spdy_config_overlay_.get() != NULL; 00073 } 00074 00075 bool has_non_spdy_config_overlay() const { 00076 return non_spdy_config_overlay_.get() != NULL; 00077 } 00078 00080 void set_spdy_config_overlay(ApacheConfig* x) { 00081 spdy_config_overlay_.reset(x); 00082 } 00083 00084 void set_non_spdy_config_overlay(ApacheConfig* x) { 00085 non_spdy_config_overlay_.reset(x); 00086 } 00087 00090 ApacheConfig* SpdyConfig() { return spdy_specific_config_.get(); } 00091 00095 RewriteDriverPool* spdy_driver_pool() { return spdy_driver_pool_; } 00096 00100 void CollapseConfigOverlaysAndComputeSignatures(); 00101 00105 void CreateLocalStatistics(Statistics* global_statistics); 00106 00108 void ChildInit(); 00109 00110 bool initialized() const { return initialized_; } 00111 00114 bool PoolDestroyed(); 00115 00129 void PollFilesystemForCacheFlush(); 00130 00133 void AddHtmlRewriteTimeUs(int64 rewrite_time_us); 00134 00135 static void InitStats(Statistics* statistics); 00136 00137 const server_rec* server() const { return server_rec_; } 00138 00139 private: 00140 bool UpdateCacheFlushTimestampMs(int64 timestamp_ms); 00141 00142 ApacheRewriteDriverFactory* apache_factory_; 00143 server_rec* server_rec_; 00144 GoogleString version_; 00145 00149 GoogleString hostname_identifier_; 00150 00151 bool initialized_; 00152 00154 scoped_ptr<Statistics> split_statistics_; 00155 00157 SharedMemStatistics* local_statistics_; 00158 00160 scoped_ptr<RewriteStats> local_rewrite_stats_; 00161 scoped_ptr<UrlAsyncFetcherStats> stats_fetcher_; 00162 00165 scoped_ptr<ApacheConfig> spdy_config_overlay_; 00166 scoped_ptr<ApacheConfig> non_spdy_config_overlay_; 00167 00169 scoped_ptr<ApacheConfig> spdy_specific_config_; 00170 00173 RewriteDriverPool* spdy_driver_pool_; 00174 00175 Histogram* html_rewrite_time_us_histogram_; 00176 00180 scoped_ptr<AbstractMutex> cache_flush_mutex_; 00181 int64 last_cache_flush_check_sec_; 00182 00183 Variable* cache_flush_count_; 00184 Variable* cache_flush_timestamp_ms_; 00185 00186 DISALLOW_COPY_AND_ASSIGN(ApacheServerContext); 00187 }; 00188 00189 } 00190 00191 #endif ///< NET_INSTAWEB_APACHE_APACHE_SERVER_CONTEXT_H_