Page Speed Optimization Libraries  1.9.32.2
 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 ChildInit ()
 
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 ()
 
ModSpdyFetchControllermod_spdy_fetch_controller ()
 
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 ()
 
AbstractSharedMem * shared_mem_runtime () const
 
SharedMemStatistics * AllocateAndInitSharedMemStatistics (bool local, const StringPiece &name, const SystemRewriteOptions &options)
 Creates and ::Initializes a shared memory statistics object.
 
NonceGenerator * DefaultNonceGenerator ()
 Creates a HashedNonceGenerator initialized with data from /dev/random.
 
bool is_root_process () const
 
virtual void RootInit ()
 
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 Hasher * NewHasher ()
 
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 GoogleString & static_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
 
- 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)
 
void set_base_distributed_async_fetcher (UrlAsyncFetcher *distributed_fetcher)
 Takes ownership of distributed_fetcher.
 
bool set_filename_prefix (StringPiece p)
 
bool slurping_enabled () const
 Determines whether Slurping is enabled.
 
MessageHandler * html_parse_message_handler ()
 
MessageHandler * message_handler ()
 
FileSystem * file_system ()
 
NonceGenerator * nonce_generator ()
 
Hasher * hasher ()
 
UrlNamerurl_namer ()
 
UserAgentMatcher * user_agent_matcher ()
 
StaticAssetManagerstatic_asset_manager ()
 
SHA1Signature * signature ()
 
RewriteOptionsdefault_options ()
 
virtual RewriteOptionsManagerNewRewriteOptionsManager ()
 
Timer * timer ()
 
NamedLockManager * lock_manager ()
 
QueuedWorkerPool * WorkerPool (WorkerPoolCategory pool)
 
Scheduler * scheduler ()
 
UsageDataReporterusage_data_reporter ()
 
const
pagespeed::js::JsTokenizerPatterns * 
js_tokenizer_patterns () const
 
const std::vector< const
UserAgentNormalizer * > & 
user_agent_normalizers ()
 
virtual UrlAsyncFetcherComputeUrlAsyncFetcher ()
 
virtual UrlAsyncFetcherComputeDistributedFetcher ()
 
ServerContextCreateServerContext ()
 
void InitServerContext (ServerContext *server_context)
 
virtual void AddPlatformSpecificRewritePasses (RewriteDriver *driver)
 
virtual void AddPlatformSpecificDecodingPasses (RewriteDriver *driver)
 
virtual void ApplyPlatformSpecificConfiguration (RewriteDriver *driver)
 
ThreadSystem * thread_system ()
 
const StringSet & created_directories () const
 
bool async_rewrites ()
 
RewriteStatsrewrite_stats ()
 
Statistics * statistics ()
 
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 GoogleString & version_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 ()
 
const std::vector< int > * preferred_webp_qualities ()
 Returns the preferred webp image quality vector for client options.
 
const std::vector< int > * preferred_jpeg_qualities ()
 Returns the preferred jpeg image quality vector for client options.
 
bool SetPreferredWebpQualities (const StringPiece &qualities)
 Returns true if the correct number of WebP qualities are parsed and set.
 
bool SetPreferredJpegQualities (const StringPiece &qualities)
 Returns true if the correct number of JPEG qualities are parsed and set.
 

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 InitStats (Statistics *statistics)
 
static void Initialize ()
 Initializes static variables. Initialize/Terminate calls must be paired.
 
static void Terminate ()
 

Protected Member Functions

virtual MessageHandler * DefaultHtmlParseMessageHandler ()
 Provide defaults.
 
virtual MessageHandler * DefaultMessageHandler ()
 
virtual Timer * DefaultTimer ()
 
virtual void SetupCaches (ServerContext *server_context)
 
virtual bool ShouldWriteResourcesToFileSystem ()
 
virtual void ParentOrChildInit ()
 
virtual void SetupMessageHandlers ()
 
virtual void ShutDownMessageHandlers ()
 
virtual void ShutDownFetchers ()
 
virtual void SetCircularBuffer (SharedCircularBuffer *buffer)
 
virtual ServerContextNewDecodingServerContext ()
 
virtual void AutoDetectThreadCounts ()
 
- Protected Member Functions inherited from net_instaweb::SystemRewriteDriverFactory
virtual void InitStaticAssetManager (StaticAssetManager *static_asset_manager)
 Initializes the StaticAssetManager.
 
virtual QueuedWorkerPool * CreateWorkerPool (WorkerPoolCategory pool, StringPiece name)
 
virtual UrlAsyncFetcherAllocateFetcher (SystemRewriteOptions *config)
 
virtual FileSystem * DefaultFileSystem ()
 
virtual NamedLockManager * DefaultLockManager ()
 
bool thread_counts_finalized ()
 
- Protected Member Functions inherited from net_instaweb::RewriteDriverFactory
bool FetchersComputed () const
 
StringPiece filename_prefix ()
 
bool TerminateServerContext (ServerContext *server_context)
 
virtual SHA1Signature * DefaultSignature ()
 
virtual UrlAsyncFetcherDefaultDistributedUrlFetcher ()
 
virtual CriticalCssFinderDefaultCriticalCssFinder ()
 
virtual CriticalImagesFinderDefaultCriticalImagesFinder (ServerContext *server_context)
 
virtual CriticalSelectorFinderDefaultCriticalSelectorFinder (ServerContext *server_context)
 
virtual CacheHtmlInfoFinderDefaultCacheHtmlInfoFinder (PropertyCache *cache, ServerContext *server_context)
 Default implementation returns NULL.
 
virtual FlushEarlyInfoFinderDefaultFlushEarlyInfoFinder ()
 Default implementation returns NULL.
 
virtual CriticalLineInfoFinderDefaultCriticalLineInfoFinder (ServerContext *server_context)
 Default implementation returns a valid CriticalSelectorFinder.
 
virtual UrlNamerDefaultUrlNamer ()
 
virtual UserAgentMatcher * DefaultUserAgentMatcher ()
 
virtual UsageDataReporterDefaultUsageDataReporter ()
 
virtual void AddPlatformSpecificUserAgentNormalizers (std::vector< const UserAgentNormalizer * > *out)
 
virtual int LowPriorityLoadSheddingThreshold () const
 
virtual Scheduler * CreateScheduler ()
 
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.
 

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.

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

Updates num_rewrite_threads_ and num_expensive_rewrite_threads_ with sensible values if they are not explicitly set.

Reimplemented from net_instaweb::SystemRewriteDriverFactory.

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.

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.

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

Can be overridden by subclasses to shutdown any fetchers we don't know about.

Reimplemented from net_instaweb::SystemRewriteDriverFactory.


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