19 #ifndef NET_INSTAWEB_REWRITER_PUBLIC_REWRITE_DRIVER_FACTORY_H_
20 #define NET_INSTAWEB_REWRITER_PUBLIC_REWRITE_DRIVER_FACTORY_H_
38 namespace pagespeed {
namespace js {
struct JsTokenizerPatterns; } }
40 namespace net_instaweb {
42 class CriticalImagesFinder;
43 class CriticalSelectorFinder;
45 class ExperimentMatcher;
48 class NamedLockManager;
54 class RewriteOptionsManager;
58 class StaticAssetManager;
60 class UrlAsyncFetcher;
62 class UsageDataReporter;
63 class UserAgentMatcher;
64 class UserAgentNormalizer;
78 kLowPriorityRewriteWorkers,
105 void set_file_system(
FileSystem* file_system);
108 void set_url_namer(
UrlNamer* url_namer);
123 void set_slurp_read_only(
bool read_only);
124 void set_slurp_print_urls(
bool read_only);
139 bool set_filename_prefix(StringPiece p);
155 RewriteOptions* default_options() {
return default_options_.get(); }
156 virtual RewriteOptionsManager* NewRewriteOptionsManager();
163 NamedLockManager* lock_manager();
165 Scheduler* scheduler();
166 UsageDataReporter* usage_data_reporter();
168 return js_tokenizer_patterns_;
170 const std::vector<const UserAgentNormalizer*>& user_agent_normalizers();
199 virtual void SetupCaches(ServerContext* server_context) = 0;
226 ThreadSystem* thread_system() {
return thread_system_.get(); }
231 return created_directories_;
234 bool async_rewrites() {
return true; }
255 static void Terminate();
282 version_string.CopyToString(&version_string_);
306 bool FetchersComputed()
const;
307 virtual void StopCacheActivity();
308 StringPiece filename_prefix();
324 virtual Timer* DefaultTimer();
327 virtual Hasher* NewHasher() = 0;
367 std::vector<const UserAgentNormalizer*>* out);
421 void SetupSlurpDirectories();
439 std::vector<const UserAgentNormalizer*> user_agent_normalizers_;
450 bool slurp_read_only_;
451 bool slurp_print_urls_;
456 typedef std::set<ServerContext*> ServerContextSet;
457 ServerContextSet server_contexts_;
482 StringSet created_directories_;
484 std::vector<QueuedWorkerPool*> worker_pools_;
492 std::vector<Function*> deferred_cleanups_;
506 template<
class T>
class RewriteDriverFactory::Deleter :
public Function {
508 explicit Deleter(T* obj) : obj_(obj) {}
509 virtual void Run() {
delete obj_; }
Definition: url_namer.h:38
virtual RewriteOptions * NewRewriteOptions()
virtual int LowPriorityLoadSheddingThreshold() const
bool slurping_enabled() const
Determines whether Slurping is enabled.
Definition: rewrite_driver_factory.h:142
virtual RewriteOptions * NewRewriteOptionsForQuery()
virtual void InitStaticAssetManager(StaticAssetManager *static_asset_manager)
Initializes the StaticAssetManager.
Definition: rewrite_driver_factory.h:396
virtual void SetupCaches(ServerContext *server_context)=0
Implementation class of Signature, using HMAC-SHA1 for signing.
Definition: sha1_signature.h:32
virtual void AddPlatformSpecificDecodingPasses(RewriteDriver *driver)
Definition: experiment_matcher.h:38
void RebuildDecodingDriverForTests(ServerContext *server_context)
For use in tests.
void InitializeDefaultOptions()
Definition: critical_images_finder.h:65
Definition: static_asset_manager.h:48
Definition: named_lock_manager.h:82
const GoogleString & version_string() const
get/set the version placed into the X-[Mod-]Page(s|-S)peed header.
Definition: rewrite_driver_factory.h:280
const StringSet & created_directories() const
Definition: rewrite_driver_factory.h:230
Base class for implementations of monitoring statistics.
Definition: statistics.h:342
bool TerminateServerContext(ServerContext *server_context)
virtual UrlNamer * DefaultUrlNamer()
void set_force_caching(bool u)
Definition: rewrite_driver_factory.h:128
Definition: user_agent_matcher.h:43
WorkerPoolCategory
Definition: rewrite_driver_factory.h:75
void set_html_parse_message_handler(MessageHandler *message_handler)
virtual ServerContext * NewServerContext()=0
virtual NamedLockManager * DefaultLockManager()
virtual Scheduler * CreateScheduler()
virtual ServerContext * NewDecodingServerContext()=0
void TakeOwnership(T *obj)
Definition: rewrite_driver_factory.h:292
void AddCreatedDirectory(const GoogleString &dir)
Registers the directory as having been created by us.
Make sure to insert new values above this line.
Definition: rewrite_driver_factory.h:80
Definition: critical_selector_finder.h:51
void InitStubDecodingServerContext(ServerContext *context)
virtual ExperimentMatcher * NewExperimentMatcher()
virtual UrlAsyncFetcher * ComputeUrlAsyncFetcher()
virtual void AddPlatformSpecificRewritePasses(RewriteDriver *driver)
virtual void AddPlatformSpecificUserAgentNormalizers(std::vector< const UserAgentNormalizer * > *out)
virtual void FetcherSetupHooks()
Called before creating the url fetchers.
Definition: scoped_ptr.h:30
Definition: function.h:47
void defer_cleanup(Function *f)
Definition: rewrite_driver_factory.h:288
RewriteDriverFactory(const ProcessContext &process_context, ThreadSystem *thread_system)
Takes ownership of thread_system.
std::string GoogleString
PAGESPEED_KERNEL_BASE_STRING_H_.
Definition: string.h:24
Definition: queued_worker_pool.h:50
virtual UrlAsyncFetcher * DefaultAsyncUrlFetcher()=0
Definition: js_tokenizer.h:194
ServerContext * CreateServerContext()
virtual void Run()
Definition: rewrite_driver_factory.h:509
Definition: file_system.h:76
void set_base_url_async_fetcher(UrlAsyncFetcher *url_fetcher)
void InitServerContext(ServerContext *server_context)
Definition: server_context.h:99
static void Initialize()
Initializes static variables. Initialize/Terminate calls must be paired.
Definition: process_context.h:35
virtual QueuedWorkerPool * CreateWorkerPool(WorkerPoolCategory pool, StringPiece name)
Statistics * statistics()
Definition: rewrite_driver_factory.h:247
virtual StringPiece LockFilePrefix()
virtual void ApplyPlatformSpecificConfiguration(RewriteDriver *driver)
Definition: usage_data_reporter.h:35
Definition: thread_system.h:40
void set_slurp_directory(const StringPiece &directory)
Definition: message_handler.h:39
Definition: scheduler.h:47
Definition: nonce_generator.h:28
Helper for users of defer_cleanup; see below.
Definition: rewrite_driver_factory.h:73
void SetStatistics(Statistics *stats)
Does not take ownership of Statistics.
Definition: rewrite_options.h:84
virtual bool IsDebugClient(const GoogleString &ip) const
Base method that returns true if the given ip is a debug ip.
Definition: rewrite_driver_factory.h:297
Timer interface, made virtual so it can be mocked for tests.
Definition: timer.h:27
virtual std::shared_ptr< CentralController > GetCentralController(NamedLockManager *lock_manager)
Simple name/value pair statistics implementation.
Definition: null_statistics.h:44
RewriteStats * rewrite_stats()
Definition: url_async_fetcher.h:33
static void InitStats(Statistics *statistics)
virtual bool UseBeaconResultsInFilters() const =0
Definition: rewrite_driver_factory.h:70
virtual bool HasWaveforms() const
Returns true if the server supports waveforms in its status page.
Definition: rewrite_driver_factory.h:243