Page Speed Optimization Libraries  1.7.30.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Member Functions | Static Public Member Functions | Protected Member Functions
net_instaweb::RewriteFilter Class Reference
Inheritance diagram for net_instaweb::RewriteFilter:
net_instaweb::CommonFilter net_instaweb::CacheExtender net_instaweb::CollectFlushEarlyContentFilter net_instaweb::CombiningFilter net_instaweb::CssCombineFilter net_instaweb::CssFilter net_instaweb::CssSummarizerBase net_instaweb::FakeFilter net_instaweb::ImageCombineFilter net_instaweb::ImageRewriteFilter net_instaweb::JavascriptFilter net_instaweb::JsCombineFilter net_instaweb::LocalStorageCacheFilter net_instaweb::NestedFilter net_instaweb::SimpleTextFilter

List of all members.

Public Member Functions

 RewriteFilter (RewriteDriver *driver)
virtual const char * id () const =0
virtual void DetermineEnabled ()
virtual const UrlSegmentEncoder * encoder () const
virtual bool ComputeOnTheFly () const
virtual RewriteContextMakeRewriteContext ()
virtual RewriteContextMakeNestedRewriteContext (RewriteContext *parent, const ResourceSlotPtr &slot)
virtual void EncodeUserAgentIntoResourceContext (ResourceContext *context) const
virtual const
RewriteOptions::Filter
RelatedFilters (int *num_filters) const
virtual const StringPieceVector * RelatedOptions () const

Static Public Member Functions

static StringPiece GetCharsetForScript (const Resource *script, const StringPiece attribute_charset, const StringPiece enclosing_charset)
static GoogleString GetCharsetForStylesheet (const Resource *stylesheet, const StringPiece attribute_charset, const StringPiece enclosing_charset)

Protected Member Functions

virtual const char * LoggingId ()
 This class logs using id().

Member Function Documentation

virtual bool net_instaweb::RewriteFilter::ComputeOnTheFly ( ) const [virtual]

If this method returns true, the data output of this filter will not be cached, and will instead be recomputed on the fly every time it is needed. (However, the transformed URL and similar metadata in CachedResult will be kept in cache).

The default implementation returns false.

Reimplemented in net_instaweb::CombiningFilter, net_instaweb::SimpleTextFilter, net_instaweb::FakeFilter, and net_instaweb::CacheExtender.

Override DetermineEnabled so that filters that use the DOM cohort of the property cache can enable writing of it in the RewriterDriver. Filters inheriting from RewriteDriver that use the DOM cohort should override UsePropertyCacheDomCohort to return true.

Reimplemented in net_instaweb::CriticalSelectorFilter, net_instaweb::JsCombineFilter, net_instaweb::CriticalCssBeaconFilter, and net_instaweb::CssCombineFilter.

virtual const UrlSegmentEncoder* net_instaweb::RewriteFilter::encoder ( ) const [virtual]

All RewriteFilters define how they encode URLs and other associated information needed for a rewrite into a URL. The default implementation handles a single URL with no extra data. The filter owns the encoder.

Reimplemented in net_instaweb::CombiningFilter, net_instaweb::ImageRewriteFilter, net_instaweb::CssFilter, net_instaweb::ImageCombineFilter, net_instaweb::JsCombineFilter, and net_instaweb::CssCombineFilter.

virtual void net_instaweb::RewriteFilter::EncodeUserAgentIntoResourceContext ( ResourceContext *  context) const [inline, virtual]

Encodes user agent information needed by the filter into ResourceContext. See additional header document for RewriteContext::EncodeUserAgentIntoResourceContext.

Reimplemented in net_instaweb::CssFilter, net_instaweb::ImageRewriteFilter, and net_instaweb::FakeFilter.

static StringPiece net_instaweb::RewriteFilter::GetCharsetForScript ( const Resource script,
const StringPiece  attribute_charset,
const StringPiece  enclosing_charset 
) [static]

Determine the charset of a script. Logic taken from: http://www.whatwg.org/specs/web-apps/current-work/multipage/ scripting-1.html#establish-script-block-source 1. If the script has a Content-Type with a charset, use that, else 2. If the script has a charset attribute, use that, else 3. If the script has a BOM, use that, else 4. Use the charset of the enclosing page. If none of these are specified we return StringPiece(NULL). Note that Chrome and Opera do not actually implement this spec - it seems that for them a BOM overrules a charset attribute (swap rules 2 and 3). Note that the return value might point into one of the given arguments so you must ensure that it isn't used past the life of any of the arguments.

static GoogleString net_instaweb::RewriteFilter::GetCharsetForStylesheet ( const Resource stylesheet,
const StringPiece  attribute_charset,
const StringPiece  enclosing_charset 
) [static]

Determine the charset of a stylesheet. Logic taken from: http://www.opentag.com/xfaq_enc.htm#enc_howspecifyforcss with the BOM rule below added somewhat arbitrarily. In essence, we take the -last- charset we see, if you pretend that headers come last. 1. If the stylesheet has a Content-Type with a charset, use that, else 2. If the stylesheet has an initial , use that, else 3. If the stylesheet has a BOM, use that, else 4. If the style element has a charset attribute, use that, else 5. Use the charset of the enclosing page. If none of these are specified we return StringPiece(NULL). Note that I do not know which browsers implement this, but I know they aren't consistent, so some definitely don't.

virtual RewriteContext* net_instaweb::RewriteFilter::MakeNestedRewriteContext ( RewriteContext parent,
const ResourceSlotPtr &  slot 
) [virtual]

Generates a nested RewriteContext appropriate for this filter. Default implementation returns NULL. This is used to implement ajax rewriting.

Reimplemented in net_instaweb::ImageRewriteFilter, net_instaweb::CssFilter, net_instaweb::SimpleTextFilter, net_instaweb::FakeFilter, and net_instaweb::JavascriptFilter.

virtual const RewriteOptions::Filter* net_instaweb::RewriteFilter::RelatedFilters ( int *  num_filters) const [virtual]

Determines which filters are related to this RewriteFilter. Note, for example, that the ImageRewriteFilter class implements lots of different RewriteOptions::Filters.

This is used for embedding the relevant enabled filter IDs. See the doc for RewriteOptions::add_options_to_urls_. We want to support that without bloating URLs excessively adding unrelated filter settings.

The vector is returned in numerically increasing order so binary_search is possible.

num_filters is set to the size of this array.

Ownership of the filter-vector is not transferred to the caller; it is expected to return a pointer to a static vector.

Reimplemented in net_instaweb::ImageRewriteFilter, and net_instaweb::CssFilter.

virtual const StringPieceVector* net_instaweb::RewriteFilter::RelatedOptions ( ) const [inline, virtual]

Return the names of options related to this RewriteFilter in case-insensitive alphabetical order. NULL means there are none. Ownership of the vector is not transferred to the caller.

Reimplemented in net_instaweb::ImageRewriteFilter, and net_instaweb::CssFilter.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines