Page Speed Optimization Libraries  1.9.32.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
server_context.h
Go to the documentation of this file.
1 /*
2  * Copyright 2010 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_REWRITER_PUBLIC_SERVER_CONTEXT_H_
21 #define NET_INSTAWEB_REWRITER_PUBLIC_SERVER_CONTEXT_H_
22 
23 #include <cstddef>
24 #include <set>
25 #include <utility>
26 #include <vector>
27 
30 #include "net/instaweb/http/public/request_context.h"
33 #include "net/instaweb/util/public/property_cache.h"
34 #include "pagespeed/kernel/base/atomic_bool.h"
35 #include "pagespeed/kernel/base/basictypes.h"
36 #include "pagespeed/kernel/base/md5_hasher.h"
37 #include "pagespeed/kernel/base/ref_counted_ptr.h"
38 #include "pagespeed/kernel/base/scoped_ptr.h"
39 #include "pagespeed/kernel/base/string.h"
40 #include "pagespeed/kernel/base/string_util.h"
41 #include "pagespeed/kernel/thread/queued_worker_pool.h"
42 #include "pagespeed/kernel/util/simple_random.h"
43 
44 namespace pagespeed { namespace js { struct JsTokenizerPatterns; } }
45 
46 namespace net_instaweb {
47 
48 class AbstractMutex;
49 class AsyncFetch;
50 class CacheHtmlInfoFinder;
51 class CacheInterface;
52 class CachePropertyStore;
53 class CriticalCssFinder;
54 class CriticalImagesFinder;
55 class CriticalLineInfoFinder;
56 class CriticalSelectorFinder;
57 class RequestProperties;
58 class ExperimentMatcher;
59 class FileSystem;
60 class FlushEarlyInfoFinder;
61 class Function;
62 class GoogleUrl;
63 class Hasher;
64 class MessageHandler;
65 class NamedLock;
66 class NamedLockManager;
67 class PropertyStore;
68 class RequestHeaders;
69 class ResponseHeaders;
70 class RewriteDriver;
71 class RewriteDriverFactory;
72 class RewriteDriverPool;
73 class RewriteFilter;
74 class RewriteOptions;
75 class RewriteOptionsManager;
76 class RewriteQuery;
77 class RewriteStats;
78 class SHA1Signature;
79 class Scheduler;
80 class StaticAssetManager;
81 class Statistics;
82 class ThreadSynchronizer;
83 class ThreadSystem;
84 class Timer;
85 class UrlAsyncFetcher;
86 class UrlNamer;
87 class UsageDataReporter;
88 class UserAgentMatcher;
89 struct ContentType;
90 
91 typedef RefCountedPtr<OutputResource> OutputResourcePtr;
92 typedef std::vector<OutputResourcePtr> OutputResourceVector;
93 
102  public:
103  typedef std::pair<RewriteOptions*, bool> OptionsBoolPair;
104 
106  static const int64 kGeneratedMaxAgeMs;
109 
113  static const char kResourceEtagValue[];
114  static const char kCacheKeyResourceNamePrefix[];
115 
117  static const char kStatisticsGroup[];
118 
119  explicit ServerContext(RewriteDriverFactory* factory);
120  virtual ~ServerContext();
121 
132  const ContentType* content_type, StringPiece charset,
133  StringPiece cache_control_suffix, ResponseHeaders* header) const;
134 
135  void set_filename_prefix(const StringPiece& file_prefix);
136  void set_statistics(Statistics* x) { statistics_ = x; }
137  void set_rewrite_stats(RewriteStats* x) { rewrite_stats_ = x; }
138  void set_lock_manager(NamedLockManager* x) { lock_manager_ = x; }
139  void set_enable_property_cache(bool enabled);
140  void set_message_handler(MessageHandler* x) { message_handler_ = x; }
141 
142  StringPiece filename_prefix() const { return file_prefix_; }
143  Statistics* statistics() const { return statistics_; }
144  NamedLockManager* lock_manager() const { return lock_manager_; }
145  RewriteDriverFactory* factory() const { return factory_; }
146  ThreadSynchronizer* thread_synchronizer() {
147  return thread_synchronizer_.get();
148  }
149  ExperimentMatcher* experiment_matcher() { return experiment_matcher_.get(); }
150 
159  void ApplyInputCacheControl(const ResourceVector& inputs,
160  ResponseHeaders* headers);
161 
163  bool IsPagespeedResource(const GoogleUrl& url);
164 
167  const RewriteFilter* FindFilterForDecoding(const StringPiece& id) const;
168 
170  bool DecodeUrlGivenOptions(const GoogleUrl& url,
171  const RewriteOptions* options,
172  const UrlNamer* url_namer,
173  StringVector* decoded_urls) const;
174 
175  void ComputeSignature(RewriteOptions* rewrite_options) const;
176 
178  Hasher* hasher() const { return hasher_; }
179  const Hasher* lock_hasher() const { return &lock_hasher_; }
180  const Hasher* contents_hasher() const { return &contents_hasher_; }
181  FileSystem* file_system() { return file_system_; }
182  void set_file_system(FileSystem* fs ) { file_system_ = fs; }
183  UrlNamer* url_namer() const { return url_namer_; }
184  void set_url_namer(UrlNamer* n) { url_namer_ = n; }
185  RewriteOptionsManager* rewrite_options_manager() const {
186  return rewrite_options_manager_.get();
187  }
188  SHA1Signature* signature() const { return signature_; }
190  void SetRewriteOptionsManager(RewriteOptionsManager* rom);
191  StaticAssetManager* static_asset_manager() const {
192  return static_asset_manager_;
193  }
194  void set_static_asset_manager(StaticAssetManager* manager) {
195  static_asset_manager_ = manager;
196  }
197  Scheduler* scheduler() const { return scheduler_; }
198  void set_scheduler(Scheduler* s) { scheduler_ = s; }
199  bool has_default_system_fetcher() const {
200  return default_system_fetcher_ != NULL;
201  }
202  bool has_default_distributed_fetcher() {
203  return default_distributed_fetcher_ != NULL;
204  }
207  UrlAsyncFetcher* DefaultSystemFetcher() { return default_system_fetcher_; }
208 
209  UrlAsyncFetcher* DefaultDistributedFetcher() {
210  return default_distributed_fetcher_;
211  }
212 
216  CacheUrlAsyncFetcher* CreateCustomCacheFetcher(
217  const RewriteOptions* options, const GoogleString& fragment,
218  CacheUrlAsyncFetcher::AsyncOpHooks* hooks, UrlAsyncFetcher* fetcher);
219 
220  Timer* timer() const { return timer_; }
221 
223  void set_timer(Timer* timer) { timer_ = timer; }
224 
225  HTTPCache* http_cache() const { return http_cache_.get(); }
226  void set_http_cache(HTTPCache* x) { http_cache_.reset(x); }
227 
229  void MakePagePropertyCache(PropertyStore* property_store);
230 
231  PropertyCache* page_property_cache() const {
232  return page_property_cache_.get();
233  }
234 
235  const PropertyCache::Cohort* dom_cohort() const { return dom_cohort_; }
236  void set_dom_cohort(const PropertyCache::Cohort* c) { dom_cohort_ = c; }
237 
238  const PropertyCache::Cohort* blink_cohort() const { return blink_cohort_; }
239  void set_blink_cohort(const PropertyCache::Cohort* c) { blink_cohort_ = c; }
240 
241  const PropertyCache::Cohort* beacon_cohort() const { return beacon_cohort_; }
242  void set_beacon_cohort(const PropertyCache::Cohort* c) { beacon_cohort_ = c; }
243 
244  const PropertyCache::Cohort* fix_reflow_cohort() const {
245  return fix_reflow_cohort_;
246  }
247  void set_fix_reflow_cohort(const PropertyCache::Cohort* c) {
248  fix_reflow_cohort_ = c;
249  }
250 
255  CacheInterface* filesystem_metadata_cache() const {
256  return filesystem_metadata_cache_;
257  }
258  void set_filesystem_metadata_cache(CacheInterface* x) {
259  filesystem_metadata_cache_ = x;
260  }
261 
266  CacheInterface* metadata_cache() const { return metadata_cache_; }
267  void set_metadata_cache(CacheInterface* x) { metadata_cache_ = x; }
268 
269  CriticalCssFinder* critical_css_finder() const {
270  return critical_css_finder_.get();
271  }
272  void set_critical_css_finder(CriticalCssFinder* finder);
273 
274  CriticalImagesFinder* critical_images_finder() const {
275  return critical_images_finder_.get();
276  }
277  void set_critical_images_finder(CriticalImagesFinder* finder);
278 
279  CriticalSelectorFinder* critical_selector_finder() const {
280  return critical_selector_finder_.get();
281  }
282  void set_critical_selector_finder(CriticalSelectorFinder* finder);
283 
284  FlushEarlyInfoFinder* flush_early_info_finder() const {
285  return flush_early_info_finder_.get();
286  }
287  void set_flush_early_info_finder(FlushEarlyInfoFinder* finder);
288 
289  UserAgentMatcher* user_agent_matcher() const {
290  return user_agent_matcher_;
291  }
292  void set_user_agent_matcher(UserAgentMatcher* n) { user_agent_matcher_ = n; }
293 
294  CacheHtmlInfoFinder* cache_html_info_finder() const {
295  return cache_html_info_finder_.get();
296  }
297 
298  SimpleRandom* simple_random() {
299  return &simple_random_;
300  }
301 
302  void set_cache_html_info_finder(CacheHtmlInfoFinder* finder);
303 
304  CriticalLineInfoFinder* critical_line_info_finder() const {
305  return critical_line_info_finder_.get();
306  }
307 
309  void set_critical_line_info_finder(CriticalLineInfoFinder* finder);
310 
313  bool store_outputs_in_file_system() { return store_outputs_in_file_system_; }
314  void set_store_outputs_in_file_system(bool store) {
315  store_outputs_in_file_system_ = store;
316  }
317 
318  RewriteStats* rewrite_stats() const { return rewrite_stats_; }
319  MessageHandler* message_handler() const { return message_handler_; }
320 
325  NamedLock* MakeCreationLock(const GoogleString& name);
326 
328  NamedLock* MakeInputLock(const GoogleString& name);
329 
331  bool TryLockForCreation(NamedLock* creation_lock);
332 
336  void LockForCreation(NamedLock* creation_lock,
337  QueuedWorkerPool::Sequence* worker, Function* callback);
338 
340  void set_hasher(Hasher* hasher) { hasher_ = hasher; }
341  void set_signature(SHA1Signature* signature) { signature_ = signature; }
342  void set_default_system_fetcher(UrlAsyncFetcher* fetcher) {
343  default_system_fetcher_ = fetcher;
344  }
345  void set_default_distributed_fetcher(UrlAsyncFetcher* fetcher) {
346  default_distributed_fetcher_ = fetcher;
347  }
348 
355  bool HandleBeacon(StringPiece body,
356  StringPiece user_agent,
357  const RequestContextPtr& request_context);
358 
364  RewriteOptions* global_options();
365 
368  const RewriteOptions* global_options() const;
369 
373  void reset_global_options(RewriteOptions* options);
374 
376  RewriteOptions* NewOptions();
377 
397  bool GetQueryOptions(const RequestContextPtr& request_context,
398  const RewriteOptions* domain_options,
399  GoogleUrl* request_url,
400  RequestHeaders* request_headers,
401  ResponseHeaders* response_headers,
402  RewriteQuery* rewrite_query);
403 
408  static bool ScanSplitHtmlRequest(const RequestContextPtr& ctx,
409  const RewriteOptions* options,
410  GoogleString* url);
411 
416  RewriteOptions* GetCustomOptions(RequestHeaders* request_headers,
417  RewriteOptions* domain_options,
418  RewriteOptions* query_options);
419 
422  GoogleString GetRewriteOptionsSignatureHash(const RewriteOptions* options);
423 
432  RewriteDriver* NewRewriteDriver(const RequestContextPtr& request_ctx);
433 
436  RewriteDriver* NewRewriteDriverFromPool(
437  RewriteDriverPool* pool, const RequestContextPtr& request_ctx);
438 
452  RewriteDriver* NewUnmanagedRewriteDriver(
453  RewriteDriverPool* pool, RewriteOptions* options,
454  const RequestContextPtr& request_ctx);
455 
466  RewriteDriver* NewCustomRewriteDriver(
467  RewriteOptions* custom_options, const RequestContextPtr& request_ctx);
468 
481  void ReleaseRewriteDriver(RewriteDriver* rewrite_driver);
482 
483  ThreadSystem* thread_system() { return thread_system_; }
484  UsageDataReporter* usage_data_reporter() { return usage_data_reporter_; }
485 
489  shutting_down_.set_value(true);
490  }
491 
492  bool shutting_down() const {
493  return shutting_down_.value();
494  }
495 
505  void ShutDownDrivers();
506 
527  void MergeNonCachingResponseHeaders(const ResourcePtr& input,
528  const OutputResourcePtr& output) {
529  MergeNonCachingResponseHeaders(*input->response_headers(),
530  output->response_headers());
531  }
532 
534  void MergeNonCachingResponseHeaders(const ResponseHeaders& input_headers,
535  ResponseHeaders* output_headers);
536 
538  QueuedWorkerPool* html_workers() { return html_workers_; }
539 
541  QueuedWorkerPool* rewrite_workers() { return rewrite_workers_; }
542 
545  QueuedWorkerPool* low_priority_rewrite_workers() {
546  return low_priority_rewrite_workers_;
547  }
548 
553 
556  void InitWorkers();
557 
559  virtual void PostInitHook();
560 
563  static bool IsExcludedAttribute(const char* attribute);
564 
573  return response_headers_finalized_;
574  }
575  void set_response_headers_finalized(bool x) {
576  response_headers_finalized_ = x;
577  }
578 
583  return available_rewrite_drivers_.get();
584  }
585 
587  const GoogleString& hostname() const {
588  return hostname_;
589  }
590  void set_hostname(const GoogleString& x) {
591  hostname_ = x;
592  }
593 
596  void AddOriginalContentLengthHeader(const ResourceVector& inputs,
597  ResponseHeaders* headers);
598 
600  virtual RewriteDriverPool* SelectDriverPool(bool using_spdy);
601 
604  virtual void ApplySessionFetchers(const RequestContextPtr& req,
605  RewriteDriver* driver);
606 
617  virtual bool ProxiesHtml() const = 0;
618 
620  RequestProperties* NewRequestProperties();
621 
624  void DeleteCacheOnDestruction(CacheInterface* cache);
625 
626  void set_cache_property_store(CachePropertyStore* p);
627 
630  void set_decoding_driver(RewriteDriver* rd) { decoding_driver_ = rd; }
631 
633  virtual PropertyStore* CreatePropertyStore(CacheInterface* cache_backend);
634 
638  const PropertyCache::Cohort* AddCohort(
639  const GoogleString& cohort_name,
640  PropertyCache* pcache);
641 
646  const PropertyCache::Cohort* AddCohortWithCache(
647  const GoogleString& cohort_name,
648  CacheInterface* cache,
649  PropertyCache* pcache);
650 
653  const CacheInterface* pcache_cache_backend();
654 
655  const pagespeed::js::JsTokenizerPatterns* js_tokenizer_patterns() const {
656  return js_tokenizer_patterns_;
657  }
658 
659  enum Format {
660  kFormatAsHtml,
661  kFormatAsJson
662  };
663 
666  void ShowCacheHandler(Format format, StringPiece url, StringPiece ua,
667  AsyncFetch* fetch, RewriteOptions* options);
668 
672  static GoogleString ShowCacheForm(StringPiece user_agent);
673 
679  virtual GoogleString FormatOption(StringPiece option_name, StringPiece args);
680 
681  protected:
685  additional_driver_pools_.push_back(pool);
686  }
687 
688  private:
689  friend class ServerContextTest;
690  typedef std::set<RewriteDriver*> RewriteDriverSet;
691 
693  void ReleaseRewriteDriverImpl(RewriteDriver* rewrite_driver);
694 
696  ThreadSystem* thread_system_;
697  RewriteStats* rewrite_stats_;
698  GoogleString file_prefix_;
699  FileSystem* file_system_;
700  UrlNamer* url_namer_;
701  scoped_ptr<RewriteOptionsManager> rewrite_options_manager_;
702  UserAgentMatcher* user_agent_matcher_;
703  Scheduler* scheduler_;
704  UrlAsyncFetcher* default_system_fetcher_;
705  UrlAsyncFetcher* default_distributed_fetcher_;
706  Hasher* hasher_;
707  SHA1Signature* signature_;
708  scoped_ptr<CriticalImagesFinder> critical_images_finder_;
709  scoped_ptr<CriticalCssFinder> critical_css_finder_;
710  scoped_ptr<CriticalSelectorFinder> critical_selector_finder_;
711  scoped_ptr<CacheHtmlInfoFinder> cache_html_info_finder_;
712  scoped_ptr<FlushEarlyInfoFinder> flush_early_info_finder_;
713  scoped_ptr<CriticalLineInfoFinder> critical_line_info_finder_;
714 
718  MD5Hasher lock_hasher_;
719 
722  MD5Hasher contents_hasher_;
723 
724  Statistics* statistics_;
725 
726  Timer* timer_;
727  scoped_ptr<HTTPCache> http_cache_;
728  scoped_ptr<PropertyCache> page_property_cache_;
729  CacheInterface* filesystem_metadata_cache_;
730  CacheInterface* metadata_cache_;
731 
732  bool store_outputs_in_file_system_;
733  bool response_headers_finalized_;
734  bool enable_property_cache_;
735 
736  NamedLockManager* lock_manager_;
737  MessageHandler* message_handler_;
738 
739  const PropertyCache::Cohort* dom_cohort_;
740  const PropertyCache::Cohort* blink_cohort_;
741  const PropertyCache::Cohort* beacon_cohort_;
742  const PropertyCache::Cohort* fix_reflow_cohort_;
743 
749  scoped_ptr<RewriteDriverPool> available_rewrite_drivers_;
750 
752  std::vector<RewriteDriverPool*> additional_driver_pools_;
753 
759  RewriteDriverSet active_rewrite_drivers_;
760 
768  bool trying_to_cleanup_rewrite_drivers_;
769  RewriteDriverSet deferred_release_rewrite_drivers_;
770  bool shutdown_drivers_called_;
771 
774  RewriteDriverFactory* factory_;
775 
776  scoped_ptr<AbstractMutex> rewrite_drivers_mutex_;
777 
780  scoped_ptr<RewriteOptions> base_class_options_;
781 
785  RewriteDriver* decoding_driver_;
786 
787  QueuedWorkerPool* html_workers_;
788  QueuedWorkerPool* rewrite_workers_;
789  QueuedWorkerPool* low_priority_rewrite_workers_;
790 
791  AtomicBool shutting_down_;
792 
794  StaticAssetManager* static_asset_manager_;
795 
798  scoped_ptr<ThreadSynchronizer> thread_synchronizer_;
799 
801  scoped_ptr<ExperimentMatcher> experiment_matcher_;
802 
803  UsageDataReporter* usage_data_reporter_;
804 
806  GoogleString hostname_;
807 
810  SimpleRandom simple_random_;
812  const pagespeed::js::JsTokenizerPatterns* js_tokenizer_patterns_;
813 
814  scoped_ptr<CachePropertyStore> cache_property_store_;
815 
816  DISALLOW_COPY_AND_ASSIGN(ServerContext);
817 };
818 
819 }
820 
821 #endif
Definition: url_namer.h:37
CacheUrlAsyncFetcher * CreateCustomCacheFetcher(const RewriteOptions *options, const GoogleString &fragment, CacheUrlAsyncFetcher::AsyncOpHooks *hooks, UrlAsyncFetcher *fetcher)
const PropertyCache::Cohort * AddCohort(const GoogleString &cohort_name, PropertyCache *pcache)
const CacheInterface * pcache_cache_backend()
void MergeNonCachingResponseHeaders(const ResourcePtr &input, const OutputResourcePtr &output)
Definition: server_context.h:527
void SetDefaultLongCacheHeaders(const ContentType *content_type, StringPiece charset, StringPiece cache_control_suffix, ResponseHeaders *header) const
void LockForCreation(NamedLock *creation_lock, QueuedWorkerPool::Sequence *worker, Function *callback)
bool GetQueryOptions(const RequestContextPtr &request_context, const RewriteOptions *domain_options, GoogleUrl *request_url, RequestHeaders *request_headers, ResponseHeaders *response_headers, RewriteQuery *rewrite_query)
void ShowCacheHandler(Format format, StringPiece url, StringPiece ua, AsyncFetch *fetch, RewriteOptions *options)
Definition: static_asset_manager.h:44
RewriteOptions * GetCustomOptions(RequestHeaders *request_headers, RewriteOptions *domain_options, RewriteOptions *query_options)
void set_critical_line_info_finder(CriticalLineInfoFinder *finder)
Takes ownership of the passed in finder.
virtual void ApplySessionFetchers(const RequestContextPtr &req, RewriteDriver *driver)
virtual bool ProxiesHtml() const =0
bool TryLockForCreation(NamedLock *creation_lock)
Attempt to obtain a named lock without blocking. Return true if we do so.
void set_shutting_down()
Definition: server_context.h:488
static bool ScanSplitHtmlRequest(const RequestContextPtr &ctx, const RewriteOptions *options, GoogleString *url)
RewriteDriver * NewRewriteDriverFromPool(RewriteDriverPool *pool, const RequestContextPtr &request_ctx)
RewriteDriverPool * standard_rewrite_driver_pool()
Definition: server_context.h:582
virtual RewriteDriverPool * SelectDriverPool(bool using_spdy)
Chooses a driver pool based on the request protocol.
void set_decoding_driver(RewriteDriver *rd)
Definition: server_context.h:630
void set_timer(Timer *timer)
Note: doesn't take ownership.
Definition: server_context.h:223
NamedLock * MakeInputLock(const GoogleString &name)
Makes a lock used for fetching and optimizing an input resource.
NamedLock * MakeCreationLock(const GoogleString &name)
const RewriteFilter * FindFilterForDecoding(const StringPiece &id) const
RewriteDriver * NewUnmanagedRewriteDriver(RewriteDriverPool *pool, RewriteOptions *options, const RequestContextPtr &request_ctx)
virtual void PostInitHook()
To set up AdminSite for SystemServerContext.
Definition: rewrite_driver_pool.h:34
QueuedWorkerPool * html_workers()
Pool of worker-threads that can be used to handle html-parsing.
Definition: server_context.h:538
static const char kResourceEtagValue[]
Definition: server_context.h:113
static GoogleString ShowCacheForm(StringPiece user_agent)
virtual GoogleString FormatOption(StringPiece option_name, StringPiece args)
bool DecodeUrlGivenOptions(const GoogleUrl &url, const RewriteOptions *options, const UrlNamer *url_namer, StringVector *decoded_urls) const
See RewriteDriver::DecodeUrl.
static const int64 kCacheTtlForMismatchedContentMs
Short lifetime for generated resources fetched with mismatching hash.
Definition: server_context.h:108
RequestProperties * NewRequestProperties()
Makes a new RequestProperties.
void SetRewriteOptionsManager(RewriteOptionsManager *rom)
Takes ownership of RewriteOptionsManager.
static bool IsExcludedAttribute(const char *attribute)
QueuedWorkerPool * low_priority_rewrite_workers()
Definition: server_context.h:545
GoogleString GetRewriteOptionsSignatureHash(const RewriteOptions *options)
bool store_outputs_in_file_system()
Definition: server_context.h:313
bool response_headers_finalized() const
Definition: server_context.h:572
void reset_global_options(RewriteOptions *options)
void MakePagePropertyCache(PropertyStore *property_store)
Creates PagePropertyCache object with the provided PropertyStore object.
bool IsPagespeedResource(const GoogleUrl &url)
Is this URL a ref to a Pagespeed resource?
RewriteOptions * NewOptions()
Makes a new, empty set of RewriteOptions.
Definition: rewrite_driver.h:98
void ManageRewriteDriverPool(RewriteDriverPool *pool)
Definition: server_context.h:684
Definition: server_context.h:101
void ApplyInputCacheControl(const ResourceVector &inputs, ResponseHeaders *headers)
void DeleteCacheOnDestruction(CacheInterface *cache)
QueuedWorkerPool * rewrite_workers()
Pool of worker-threads that can be used to handle resource rewriting.
Definition: server_context.h:541
CacheInterface * metadata_cache() const
Definition: server_context.h:266
Definition: usage_data_reporter.h:35
const GoogleString & hostname() const
Returns the current server hostname.
Definition: server_context.h:587
static const char kStatisticsGroup[]
Default statistics group name.
Definition: server_context.h:117
void ReleaseRewriteDriver(RewriteDriver *rewrite_driver)
Hasher * hasher() const
Definition: server_context.h:178
bool HandleBeacon(StringPiece body, StringPiece user_agent, const RequestContextPtr &request_context)
CacheInterface * filesystem_metadata_cache() const
Definition: server_context.h:255
UrlAsyncFetcher * DefaultSystemFetcher()
Definition: server_context.h:207
void AddOriginalContentLengthHeader(const ResourceVector &inputs, ResponseHeaders *headers)
Collects a few specific statistics variables related to Rewriting.
Definition: rewrite_stats.h:38
RewriteOptions * global_options()
static const int64 kGeneratedMaxAgeMs
The lifetime for cache-extended generated resources, in milliseconds.
Definition: server_context.h:106
RewriteDriver * NewCustomRewriteDriver(RewriteOptions *custom_options, const RequestContextPtr &request_ctx)
void set_hasher(Hasher *hasher)
Setters should probably only be used in testing.
Definition: server_context.h:340
RewriteDriver * NewRewriteDriver(const RequestContextPtr &request_ctx)
Definition: url_async_fetcher.h:33
virtual PropertyStore * CreatePropertyStore(CacheInterface *cache_backend)
Creates CachePropertyStore object which will be used by PagePropertyCache.
Definition: http_cache.h:46
const PropertyCache::Cohort * AddCohortWithCache(const GoogleString &cohort_name, CacheInterface *cache, PropertyCache *pcache)
Definition: rewrite_driver_factory.h:73