Page Speed Optimization Libraries  1.12.34.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
net_instaweb::ApacheRewriteDriverFactory Class Reference

Creates an Apache RewriteDriver. More...

#include "apache_rewrite_driver_factory.h"

Inheritance diagram for net_instaweb::ApacheRewriteDriverFactory:
net_instaweb::SystemRewriteDriverFactory net_instaweb::RewriteDriverFactory

Public Member Functions

 ApacheRewriteDriverFactory (const ProcessContext &process_context, server_rec *server, const StringPiece &version)
 
ApacheMessageHandlerapache_message_handler ()
 
virtual void NonStaticInitStats (Statistics *statistics)
 
ApacheServerContextMakeApacheServerContext (server_rec *server)
 
bool inherit_vhost_config () const
 If true, virtual hosts should inherit global configuration.
 
void set_inherit_vhost_config (bool x)
 
bool PoolDestroyed (ApacheServerContext *rm)
 
virtual ApacheConfigNewRewriteOptions ()
 
virtual ApacheConfigNewRewriteOptionsForQuery ()
 
void SetNeedSchedulerThread ()
 
virtual void set_message_buffer_size (int x)
 Needed by mod_instaweb.cc:ParseDirective().
 
virtual bool IsServerThreaded ()
 
virtual int LookupThreadLimit ()
 
- Public Member Functions inherited from net_instaweb::SystemRewriteDriverFactory
 SystemRewriteDriverFactory (const ProcessContext &process_context, SystemThreadSystem *thread_system, AbstractSharedMem *shared_mem_runtime, StringPiece hostname, int port)
 
void Init ()
 
AbstractSharedMemshared_mem_runtime () const
 
SharedMemStatisticsAllocateAndInitSharedMemStatistics (bool local, const StringPiece &name, const SystemRewriteOptions &options)
 Creates and ::Initializes a shared memory statistics object.
 
NonceGeneratorDefaultNonceGenerator ()
 Creates a HashedNonceGenerator initialized with data from /dev/random.
 
bool is_root_process () const
 
virtual void RootInit ()
 
virtual void ChildInit ()
 
void PostConfig (const std::vector< SystemServerContext * > &server_contexts, GoogleString *error_message, int *error_index, Statistics **global_statistics)
 
void SharedCircularBufferInit (bool is_root)
 
virtual
RewriteOptions::OptionSettingResult 
ParseAndSetOption1 (StringPiece option, StringPiece arg, bool process_scope, GoogleString *msg, MessageHandler *handler)
 
virtual
RewriteOptions::OptionSettingResult 
ParseAndSetOption2 (StringPiece option, StringPiece arg1, StringPiece arg2, bool process_scope, GoogleString *msg, MessageHandler *handler)
 
virtual HasherNewHasher ()
 
virtual ServerContextNewServerContext ()
 
virtual bool enable_property_cache () const
 Hook so implementations may disable the property cache.
 
GoogleString hostname_identifier ()
 
virtual void ShutDown ()
 
virtual void StopCacheActivity ()
 
SystemCachescaches ()
 
UrlAsyncFetcherGetFetcher (SystemRewriteOptions *config)
 
void set_track_original_content_length (bool x)
 
bool track_original_content_length () const
 
void list_outstanding_urls_on_error (bool x)
 
virtual int max_queue_size ()
 
virtual int queued_per_host ()
 
virtual int requests_per_host ()
 Normally 4, or #threads if that's more.
 
void set_static_asset_prefix (StringPiece s)
 
const GoogleStringstatic_asset_prefix ()
 
int num_rewrite_threads () const
 
void set_num_rewrite_threads (int x)
 
int num_expensive_rewrite_threads () const
 
void set_num_expensive_rewrite_threads (int x)
 
bool use_per_vhost_statistics () const
 
void set_use_per_vhost_statistics (bool x)
 
bool install_crash_handler () const
 
void set_install_crash_handler (bool x)
 
virtual bool UseBeaconResultsInFilters () const
 
virtual void StartController (const SystemRewriteOptions &options)
 
virtual void NameProcess (const char *name)
 Set the name of this process, for debugging visibility.
 
virtual void PrepareForkedProcess (const char *name)
 
virtual void PrepareControllerProcess ()
 
- Public Member Functions inherited from net_instaweb::RewriteDriverFactory
 RewriteDriverFactory (const ProcessContext &process_context, ThreadSystem *thread_system)
 Takes ownership of thread_system.
 
void InitializeDefaultOptions ()
 
void set_html_parse_message_handler (MessageHandler *message_handler)
 
void set_message_handler (MessageHandler *message_handler)
 
void set_file_system (FileSystem *file_system)
 
void set_hasher (Hasher *hasher)
 
void set_nonce_generator (NonceGenerator *nonce_generator)
 
void set_url_namer (UrlNamer *url_namer)
 
void set_signature (SHA1Signature *signature)
 
void set_timer (Timer *timer)
 
void set_usage_data_reporter (UsageDataReporter *reporter)
 
void set_slurp_directory (const StringPiece &directory)
 
void set_slurp_read_only (bool read_only)
 
void set_slurp_print_urls (bool read_only)
 
void set_force_caching (bool u)
 
void set_base_url_async_fetcher (UrlAsyncFetcher *url_fetcher)
 
bool set_filename_prefix (StringPiece p)
 
bool slurping_enabled () const
 Determines whether Slurping is enabled.
 
MessageHandlerhtml_parse_message_handler ()
 
MessageHandlermessage_handler ()
 
FileSystemfile_system ()
 
NonceGeneratornonce_generator ()
 
Hasherhasher ()
 
UrlNamerurl_namer ()
 
UserAgentMatcheruser_agent_matcher ()
 
StaticAssetManagerstatic_asset_manager ()
 
SHA1Signaturesignature ()
 
RewriteOptionsdefault_options ()
 
virtual RewriteOptionsManagerNewRewriteOptionsManager ()
 
Timertimer ()
 
NamedLockManagerlock_manager ()
 
QueuedWorkerPoolWorkerPool (WorkerPoolCategory pool)
 
Schedulerscheduler ()
 
UsageDataReporterusage_data_reporter ()
 
const
pagespeed::js::JsTokenizerPatterns
js_tokenizer_patterns () const
 
const std::vector< const
UserAgentNormalizer * > & 
user_agent_normalizers ()
 
virtual UrlAsyncFetcherComputeUrlAsyncFetcher ()
 
ServerContextCreateServerContext ()
 
void InitServerContext (ServerContext *server_context)
 
virtual void AddPlatformSpecificRewritePasses (RewriteDriver *driver)
 
virtual void AddPlatformSpecificDecodingPasses (RewriteDriver *driver)
 
virtual void ApplyPlatformSpecificConfiguration (RewriteDriver *driver)
 
ThreadSystemthread_system ()
 
const StringSet & created_directories () const
 
bool async_rewrites ()
 
RewriteStatsrewrite_stats ()
 
virtual bool HasWaveforms () const
 Returns true if the server supports waveforms in its status page.
 
Statisticsstatistics ()
 
void SetStatistics (Statistics *stats)
 Does not take ownership of Statistics.
 
void AddCreatedDirectory (const GoogleString &dir)
 Registers the directory as having been created by us.
 
const GoogleStringversion_string () const
 get/set the version placed into the X-[Mod-]Page(s|-S)peed header.
 
void set_version_string (const StringPiece &version_string)
 
void defer_cleanup (Function *f)
 
template<class T >
void TakeOwnership (T *obj)
 
virtual bool IsDebugClient (const GoogleString &ip) const
 Base method that returns true if the given ip is a debug ip.
 
virtual ExperimentMatcherNewExperimentMatcher ()
 

Static Public Member Functions

static void InitStats (Statistics *statistics)
 
static void Initialize ()
 
static void Terminate ()
 
- Static Public Member Functions inherited from net_instaweb::SystemRewriteDriverFactory
static void InitApr ()
 
- Static Public Member Functions inherited from net_instaweb::RewriteDriverFactory
static void InitializeDefaultOptions (RewriteOptions *options)
 
static void InitStats (Statistics *statistics)
 
static void Initialize ()
 Initializes static variables. Initialize/Terminate calls must be paired.
 
static void Terminate ()
 

Protected Member Functions

virtual MessageHandlerDefaultHtmlParseMessageHandler ()
 Provide defaults.
 
virtual MessageHandlerDefaultMessageHandler ()
 
virtual TimerDefaultTimer ()
 
virtual void SetupCaches (ServerContext *server_context)
 
virtual bool ShouldWriteResourcesToFileSystem ()
 
virtual void ParentOrChildInit ()
 
virtual void SetupMessageHandlers ()
 
virtual void ShutDownMessageHandlers ()
 
virtual void SetCircularBuffer (SharedCircularBuffer *buffer)
 
virtual ServerContextNewDecodingServerContext ()
 
- Protected Member Functions inherited from net_instaweb::SystemRewriteDriverFactory
virtual void InitStaticAssetManager (StaticAssetManager *static_asset_manager)
 Initializes the StaticAssetManager.
 
virtual QueuedWorkerPoolCreateWorkerPool (WorkerPoolCategory pool, StringPiece name)
 
virtual void ShutDownFetchers ()
 
virtual UrlAsyncFetcherAllocateFetcher (SystemRewriteOptions *config)
 
virtual FileSystemDefaultFileSystem ()
 
virtual NamedLockManagerDefaultLockManager ()
 
virtual void AutoDetectThreadCounts ()
 
bool thread_counts_finalized ()
 
std::shared_ptr
< CentralController
GetCentralController (NamedLockManager *lock_manager) override
 Delegate from RewriteDriverFactory to construct CentralController.
 
- Protected Member Functions inherited from net_instaweb::RewriteDriverFactory
bool FetchersComputed () const
 
StringPiece filename_prefix ()
 
bool TerminateServerContext (ServerContext *server_context)
 
virtual SHA1SignatureDefaultSignature ()
 
virtual CriticalImagesFinderDefaultCriticalImagesFinder (ServerContext *server_context)
 
virtual CriticalSelectorFinderDefaultCriticalSelectorFinder (ServerContext *server_context)
 
virtual UrlNamerDefaultUrlNamer ()
 
virtual UserAgentMatcherDefaultUserAgentMatcher ()
 
virtual UsageDataReporterDefaultUsageDataReporter ()
 
virtual void AddPlatformSpecificUserAgentNormalizers (std::vector< const UserAgentNormalizer * > *out)
 
virtual int LowPriorityLoadSheddingThreshold () const
 
virtual SchedulerCreateScheduler ()
 
virtual void FetcherSetupHooks ()
 Called before creating the url fetchers.
 
virtual StringPiece LockFilePrefix ()
 
void InitStubDecodingServerContext (ServerContext *context)
 
void RebuildDecodingDriverForTests (ServerContext *server_context)
 For use in tests.
 
void reset_default_options (RewriteOptions *new_defaults)
 

Additional Inherited Members

- Public Types inherited from net_instaweb::RewriteDriverFactory
enum  WorkerPoolCategory { kHtmlWorkers, kRewriteWorkers, kLowPriorityRewriteWorkers, kNumWorkerPools }
 
- Protected Types inherited from net_instaweb::SystemRewriteDriverFactory
typedef std::set
< SystemServerContext * > 
SystemServerContextSet
 
- Static Protected Member Functions inherited from net_instaweb::SystemRewriteDriverFactory
static void InitStats (Statistics *statistics)
 
- Protected Attributes inherited from net_instaweb::SystemRewriteDriverFactory
SystemServerContextSet uninitialized_server_contexts_
 

Detailed Description

Creates an Apache RewriteDriver.

Member Function Documentation

ApacheMessageHandler* net_instaweb::ApacheRewriteDriverFactory::apache_message_handler ( )
inline

Give access to apache_message_handler_ for the cases we need to use ApacheMessageHandler rather than MessageHandler. e.g. Use ApacheMessageHandler::Dump() This is a better choice than cast from MessageHandler.

static void net_instaweb::ApacheRewriteDriverFactory::InitStats ( Statistics statistics)
static

Initializes all the statistics objects created transitively by ApacheRewriteDriverFactory, including apache-specific and platform-independent statistics.

virtual bool net_instaweb::ApacheRewriteDriverFactory::IsServerThreaded ( )
virtual

Check whether the server is threaded. For example, Nginx uses an event loop and can keep with the default of false, while Apache with a threaded multiprocessing module (MPM) overrides this method to return true.

< Most new servers are non-threaded nowadays.

Reimplemented from net_instaweb::SystemRewriteDriverFactory.

virtual int net_instaweb::ApacheRewriteDriverFactory::LookupThreadLimit ( )
virtual

Threaded implementing servers should return the maximum number of threads that might be used for handling user requests.

Reimplemented from net_instaweb::SystemRewriteDriverFactory.

virtual ServerContext* net_instaweb::ApacheRewriteDriverFactory::NewDecodingServerContext ( )
protectedvirtual

Create a new ServerContext used for decoding only. Unlike NewServerContext, the resulting ServerContext should not be fresh, but should have some of its platform dependencies injected — but just enough for decoding URLs, and not full operation. At the time of writing it needs the timer, url namer, hasher, message handler, and stats; expensive stuff like cache backends is not needed, however.

You may find InitStubDecodingServerContext() useful for doing that, as it will inject all of these from what's available in 'this'.

Implements net_instaweb::RewriteDriverFactory.

virtual ApacheConfig* net_instaweb::ApacheRewriteDriverFactory::NewRewriteOptions ( )
virtual

Creates a new empty RewriteOptions object, with no default settings. Generally configurations go factory's default_options() -> ServerContext::global_options() -> RewriteDriverFactory, but this method just provides a blank set of options.

Reimplemented from net_instaweb::RewriteDriverFactory.

virtual ApacheConfig* net_instaweb::ApacheRewriteDriverFactory::NewRewriteOptionsForQuery ( )
virtual

As above, but set a name on the ApacheConfig noting that it came from a query.

Reimplemented from net_instaweb::RewriteDriverFactory.

virtual void net_instaweb::ApacheRewriteDriverFactory::NonStaticInitStats ( Statistics statistics)
inlinevirtual

Hook for subclasses to init their stats and call SystemRewriteDriverFactory::InitStats().

Implements net_instaweb::SystemRewriteDriverFactory.

virtual void net_instaweb::ApacheRewriteDriverFactory::ParentOrChildInit ( )
protectedvirtual

This helper method contains init procedures invoked by both RootInit() and ChildInit()

Reimplemented from net_instaweb::SystemRewriteDriverFactory.

bool net_instaweb::ApacheRewriteDriverFactory::PoolDestroyed ( ApacheServerContext rm)

Notification of apache tearing down a context (vhost or top-level) corresponding to given ApacheServerContext. Returns true if it was the last context.

void net_instaweb::ApacheRewriteDriverFactory::SetNeedSchedulerThread ( )

Called by any ApacheServerContext whose configuration requires use of a scheduler thread. This will actually start one, so should only be called from child processes.

virtual void net_instaweb::ApacheRewriteDriverFactory::SetupCaches ( ServerContext server_context)
protectedvirtual

Called from InitServerContext, but virtualized separately as it is platform-specific. This method must call on the server context: set_http_cache, set_metadata_cache, set_filesystem_metadata_cache, and MakePropertyCaches.

Reimplemented from net_instaweb::SystemRewriteDriverFactory.

virtual void net_instaweb::ApacheRewriteDriverFactory::SetupMessageHandlers ( )
protectedvirtual
Todo:
TODO(jefftk): create SystemMessageHandler and get rid of these hooks.

Reimplemented from net_instaweb::SystemRewriteDriverFactory.

virtual bool net_instaweb::ApacheRewriteDriverFactory::ShouldWriteResourcesToFileSystem ( )
inlineprotectedvirtual

Disable the Resource Manager's filesystem since we have a write-through http_cache.


The documentation for this class was generated from the following file: