Classes | |
struct | BeaconUrl |
class | FuriousSpec |
class | MutexedOptionInt64MergeWithMax |
class | Option |
class | OptionBase |
class | OptionTemplateBase |
Public Types | |
enum | Filter { kAddBaseTag, kAddHead, kAddInstrumentation, kCollapseWhitespace, kCombineCss, kCombineHeads, kCombineJavascript, kComputePanelJson, kConvertJpegToProgressive, kConvertJpegToWebp, kConvertMetaTags, kConvertPngToJpeg, kDebug, kDeferJavascript, kDelayImages, kDetectReflowWithDeferJavascript, kDeterministicJs, kDisableJavascript, kDivStructure, kElideAttributes, kExplicitCloseTags, kExtendCacheCss, kExtendCacheImages, kExtendCacheScripts, kFlattenCssImports, kHtmlWriterFilter, kInlineCss, kInlineImages, kInlineImportToLink, kInlineJavascript, kInsertGA, kInsertImageDimensions, kLazyloadImages, kLeftTrimUrls, kLocalStorageCache, kMakeGoogleAnalyticsAsync, kMoveCssAboveScripts, kMoveCssToHead, kOutlineCss, kOutlineJavascript, kPrioritizeVisibleContent, kRecompressImages, kRemoveComments, kRemoveQuotes, kResizeImages, kResizeMobileImages, kRewriteCss, kRewriteDomains, kRewriteJavascript, kRewriteStyleAttributes, kRewriteStyleAttributesWithUrl, kServeNonCacheableNonCritical, kSpriteImages, kStripNonCacheable, kStripScripts, kEndOfFilters } |
enum | OptionEnum { kAjaxRewritingEnabled, kAlwaysRewriteCss, kAnalyticsID, kAvoidRenamingIntrospectiveJavascript, kBeaconUrl, kBlinkDesktopUserAgent, kBotdetectEnabled, kCacheInvalidationTimestamp, kCombineAcrossPaths, kCriticalImagesCacheExpirationTimeMs, kCssImageInlineMaxBytes, kCssInlineMaxBytes, kCssOutlineMinBytes, kDefaultCacheHtml, kDomainRewriteHyperlinks, kEnableBlinkCriticalLine, kEnableBlinkForMobileDevices, kEnabled, kEnableDeferJsExperimental, kFlushHtml, kFuriousSlot, kIdleFlushTimeMs, kImageInlineMaxBytes, kImageJpegNumProgressiveScans, kImageJpegRecompressionQuality, kImageLimitOptimizedPercent, kImageLimitResizeAreaPercent, kImageMaxRewritesAtOnce, kImageRetainColorProfile, kImageRetainColorSampling, kImageRetainExifData, kImageWebpRecompressQuality, kImplicitCacheTtlMs, kIncreaseSpeedTracking, kJsInlineMaxBytes, kJsOutlineMinBytes, kLazyloadImagesAfterOnload, kLogRewriteTiming, kLowercaseHtmlNames, kMaxHtmlCacheTimeMs, kMaxImageSizeLowResolutionBytes, kMaxInlinedPreviewImagesIndex, kMaxUrlSegmentSize, kMaxUrlSize, kMinImageSizeLowResolutionBytes, kMinResourceCacheTimeToRewriteMs, kModifyCachingHeaders, kPrioritizeVisibleContentCacheTime, kPrioritizeVisibleContentNonCacheableElements, kProgressiveJpegMinBytes, kReportUnloadTime, kRespectVary, kRewriteLevel, kRunningFurious, kServeBlinkNonCritical, kServeStaleIfFetchError, kUseFixedUserAgentForBlinkCacheMisses, kXModPagespeedHeaderValue, kCollectRefererStatistics, kFetcherProxy, kFetcherTimeOutMs, kFileCacheCleanIntervalMs, kFileCacheCleanSizeKb, kFileCachePath, kFileNamePrefix, kHashRefererStatistics, kLruCacheByteLimit, kLruCacheKbPerProcess, kMessageBufferSize, kRefererStatisticsOutputLevel, kSlurpDirectory, kSlurpFlushLimit, kSlurpReadOnly, kStatisticsEnabled, kTestProxy, kUseSharedMemLocking, kEndOfOptions } |
enum | RewriteLevel { kPassThrough, kCoreFilters, kTestingCoreFilters, kAllFilters } |
enum | OptionSettingResult { kOptionOk, kOptionNameUnknown, kOptionValueInvalid } |
Used for return value of SetOptionFromName. | |
typedef std::set< Filter > | FilterSet |
Convenience name for a set of rewrite filters. | |
Public Member Functions | |
bool | modified () const |
void | SetDefaultRewriteLevel (RewriteLevel level) |
void | SetRewriteLevel (RewriteLevel level) |
FuriousSpec * | GetFuriousSpec (int id) const |
bool | AvailableFuriousId (int id) |
bool | AddFuriousSpec (const StringPiece &spec, MessageHandler *handler) |
bool | AddFuriousSpec (int furious_id) |
bool | AddFuriousSpec (FuriousSpec *spec) |
void | SetFuriousState (int id) |
int | furious_id () const |
int | furious_spec_id (int i) const |
FuriousSpec * | furious_spec (int i) const |
int | num_furious_experiments () const |
RewriteLevel | level () const |
bool | AdjustFiltersByCommaSeparatedList (const StringPiece &filters, MessageHandler *handler) |
bool | EnableFiltersByCommaSeparatedList (const StringPiece &filters, MessageHandler *handler) |
bool | DisableFiltersByCommaSeparatedList (const StringPiece &filters, MessageHandler *handler) |
void | DisableAllFiltersNotExplicitlyEnabled () |
void | EnableFilter (Filter filter) |
void | ForceEnableFilter (Filter filter) |
void | DisableFilter (Filter filter) |
void | EnableFilters (const FilterSet &filter_set) |
void | DisableFilters (const FilterSet &filter_set) |
void | ClearFilters () |
void | CheckFiltersAgainst (const FilterSet &enabled_filters, const FilterSet &disabled_filters) |
void | EnableExtendCacheFilters () |
Enables all three extend_cache filters. | |
bool | Enabled (Filter filter) const |
OptionSettingResult | SetOptionFromName (const StringPiece &name, const GoogleString &value, GoogleString *msg) |
bool | SetOptionFromNameAndLog (const StringPiece &name, const GoogleString &value, MessageHandler *handler) |
int64 | css_outline_min_bytes () const |
void | set_css_outline_min_bytes (int64 x) |
GoogleString | ga_id () const |
void | set_ga_id (GoogleString id) |
bool | increase_speed_tracking () const |
void | set_increase_speed_tracking (bool x) |
int64 | js_outline_min_bytes () const |
void | set_js_outline_min_bytes (int64 x) |
int64 | progressive_jpeg_min_bytes () const |
void | set_progressive_jpeg_min_bytes (int64 x) |
int64 | ImageInlineMaxBytes () const |
Retrieve the image inlining threshold, but return 0 if it's disabled. | |
void | set_image_inline_max_bytes (int64 x) |
int64 | CssImageInlineMaxBytes () const |
Retrieve the css image inlining threshold, but return 0 if it's disabled. | |
void | set_css_image_inline_max_bytes (int64 x) |
int64 | MaxImageInlineMaxBytes () const |
The larger of ImageInlineMaxBytes and CssImageInlineMaxBytes. | |
int64 | css_inline_max_bytes () const |
void | set_css_inline_max_bytes (int64 x) |
int64 | js_inline_max_bytes () const |
void | set_js_inline_max_bytes (int64 x) |
int64 | max_html_cache_time_ms () const |
void | set_max_html_cache_time_ms (int64 x) |
int64 | min_resource_cache_time_to_rewrite_ms () const |
void | set_min_resource_cache_time_to_rewrite_ms (int64 x) |
void | set_cache_invalidation_timestamp_mutex (ThreadSystem::RWLock *lock) |
int64 | cache_invalidation_timestamp () const |
Cache invalidation timestamp is in milliseconds since 1970. | |
void | set_cache_invalidation_timestamp (int64 timestamp_ms) |
bool | UpdateCacheInvalidationTimestampMs (int64 timestamp_ms, const Hasher *hasher) |
int64 | idle_flush_time_ms () const |
void | set_idle_flush_time_ms (int64 x) |
int | max_url_segment_size () const |
void | set_max_url_segment_size (int x) |
int | image_max_rewrites_at_once () const |
void | set_image_max_rewrites_at_once (int x) |
int | max_url_size () const |
The maximum size of the entire URL. If '0', this is left unlimited. | |
void | set_max_url_size (int x) |
void | set_enabled (bool x) |
bool | enabled () const |
void | set_ajax_rewriting_enabled (bool x) |
bool | ajax_rewriting_enabled () const |
void | set_botdetect_enabled (bool x) |
bool | botdetect_enabled () const |
void | set_combine_across_paths (bool x) |
bool | combine_across_paths () const |
void | set_log_rewrite_timing (bool x) |
bool | log_rewrite_timing () const |
void | set_lowercase_html_names (bool x) |
bool | lowercase_html_names () const |
void | set_always_rewrite_css (bool x) |
bool | always_rewrite_css () const |
void | set_respect_vary (bool x) |
bool | respect_vary () const |
void | set_flush_html (bool x) |
bool | flush_html () const |
void | set_serve_stale_if_fetch_error (bool x) |
bool | serve_stale_if_fetch_error () const |
void | set_enable_blink_critical_line (bool x) |
bool | enable_blink_critical_line () const |
void | set_serve_blink_non_critical (bool x) |
bool | serve_blink_non_critical () const |
void | set_default_cache_html (bool x) |
bool | default_cache_html () const |
void | set_modify_caching_headers (bool x) |
bool | modify_caching_headers () const |
void | set_lazyload_images_after_onload (bool x) |
bool | lazyload_images_after_onload () const |
void | set_max_inlined_preview_images_index (int x) |
int | max_inlined_preview_images_index () const |
void | set_min_image_size_low_resolution_bytes (int64 x) |
int64 | min_image_size_low_resolution_bytes () const |
void | set_max_image_size_low_resolution_bytes (int64 x) |
int64 | max_image_size_low_resolution_bytes () const |
void | set_critical_images_cache_expiration_time_ms (int64 x) |
int64 | critical_images_cache_expiration_time_ms () const |
bool | image_retain_color_profile () const |
void | set_image_retain_color_profile (bool x) |
bool | image_retain_color_sampling () const |
void | set_image_retain_color_sampling (bool x) |
bool | image_retain_exif_data () const |
void | set_image_retain_exif_data (bool x) |
void | set_metadata_cache_staleness_threshold_ms (int64 x) |
int64 | metadata_cache_staleness_threshold_ms () const |
const BeaconUrl & | beacon_url () const |
void | set_beacon_url (const GoogleString &beacon_url) |
virtual bool | trim_urls_in_css () const |
Return false in a subclass if you want to disallow all URL trimming in CSS. | |
int | image_jpeg_recompress_quality () const |
void | set_image_jpeg_recompress_quality (int x) |
int | image_limit_optimized_percent () const |
void | set_image_limit_optimized_percent (int x) |
int | image_limit_resize_area_percent () const |
void | set_image_limit_resize_area_percent (int x) |
int | image_jpeg_num_progressive_scans () const |
void | set_image_jpeg_num_progressive_scans (int x) |
int | image_webp_recompress_quality () const |
void | set_image_webp_recompress_quality (int x) |
bool | domain_rewrite_hyperlinks () const |
void | set_domain_rewrite_hyperlinks (bool x) |
void | set_enable_defer_js_experimental (bool x) |
bool | enable_defer_js_experimental () const |
bool | MatchesPrioritizeVisibleContentCacheableFamilies (const StringPiece &str) const |
void | AddToPrioritizeVisibleContentCacheableFamilies (const StringPiece &str) |
const GoogleString & | prioritize_visible_content_non_cacheable_elements () const |
void | set_prioritize_visible_content_non_cacheable_elements (const StringPiece &p) |
int64 | prioritize_visible_content_cache_time_ms () const |
Getter and setter for the prioritize_visible_content cache time. | |
void | set_prioritize_visible_content_cache_time_ms (int64 x) |
void | set_panel_config (PublisherConfig *panel_config) |
Takes ownership of the config. | |
const PublisherConfig * | panel_config () const |
void | set_running_furious_experiment (bool x) |
bool | running_furious () const |
void | set_furious_ga_slot (int x) |
x should be between 1 and 5 inclusive. | |
int | furious_ga_slot () const |
void | set_report_unload_time (bool x) |
bool | report_unload_time () const |
void | set_implicit_cache_ttl_ms (int64 x) |
int64 | implicit_cache_ttl_ms () const |
void | set_x_header_value (const StringPiece &p) |
const GoogleString & | x_header_value () const |
void | set_avoid_renaming_introspective_javascript (bool x) |
bool | avoid_renaming_introspective_javascript () const |
void | set_enable_blink_for_mobile_devices (bool x) |
bool | enable_blink_for_mobile_devices () const |
void | set_use_fixed_user_agent_for_blink_cache_misses (bool x) |
bool | use_fixed_user_agent_for_blink_cache_misses () const |
void | set_blink_desktop_user_agent (const StringPiece &p) |
const GoogleString & | blink_desktop_user_agent () const |
virtual void | Merge (const RewriteOptions &src) |
void | Allow (const StringPiece &wildcard_pattern) |
void | Disallow (const StringPiece &wildcard_pattern) |
virtual void | DisallowTroublesomeResources () |
DomainLawyer * | domain_lawyer () |
const DomainLawyer * | domain_lawyer () const |
FileLoadPolicy * | file_load_policy () |
const FileLoadPolicy * | file_load_policy () const |
bool | IsAllowed (const StringPiece &url) const |
void | RetainComment (const StringPiece &comment) |
Adds a new comment wildcard pattern to be retained. | |
bool | IsRetainedComment (const StringPiece &comment) const |
virtual RewriteOptions * | Clone () const |
void | ComputeSignature (const Hasher *hasher) |
void | ClearSignatureWithCaution () |
void | ClearSignatureForTesting () |
const GoogleString & | signature () const |
Returns the computed signature. | |
virtual GoogleString | ToString () const |
virtual GoogleString | ToExperimentString () const |
virtual GoogleString | ToExperimentDebugString () const |
virtual const char * | class_name () const |
Name of the actual type of this instance as a poor man's RTTI. | |
virtual bool | NeedLowResImages () const |
Returns true if generation low res images is required. | |
Static Public Member Functions | |
static const char * | FilterName (Filter filter) |
static const char * | FilterId (Filter filter) |
static bool | ParseRewriteLevel (const StringPiece &in, RewriteLevel *out) |
static bool | ParseBeaconUrl (const StringPiece &in, BeaconUrl *out) |
static void | Initialize () |
Does one time initialization of static members. | |
static const char * | LookupOptionEnum (RewriteOptions::OptionEnum option_enum) |
Returns the option name corresponding to the option enum. | |
Static Public Attributes | |
static const char | kAjaxRewriteId [] |
static const char | kCssCombinerId [] |
static const char | kCssFilterId [] |
static const char | kCssImportFlattenerId [] |
static const char | kCssInlineId [] |
static const char | kCacheExtenderId [] |
static const char | kImageCombineId [] |
static const char | kImageCompressionId [] |
static const char | kJavascriptCombinerId [] |
static const char | kJavascriptInlineId [] |
static const char | kLocalStorageCacheId [] |
static const char | kJavascriptMinId [] |
static const char | kPanelCommentPrefix [] |
static const Filter | kFirstFilter = kAddBaseTag |
Used for enumerating over all entries in the Filter enum. | |
static const int64 | kDefaultCssInlineMaxBytes |
static const int64 | kDefaultImageInlineMaxBytes |
static const int64 | kDefaultCssImageInlineMaxBytes |
static const int64 | kDefaultJsInlineMaxBytes |
static const int64 | kDefaultCssOutlineMinBytes |
static const int64 | kDefaultJsOutlineMinBytes |
static const int64 | kDefaultProgressiveJpegMinBytes |
static const int64 | kDefaultMaxHtmlCacheTimeMs |
static const int64 | kDefaultMinResourceCacheTimeToRewriteMs |
static const int64 | kDefaultCacheInvalidationTimestamp |
static const int64 | kDefaultIdleFlushTimeMs |
static const int64 | kDefaultImplicitCacheTtlMs |
static const int64 | kDefaultPrioritizeVisibleContentCacheTimeMs |
static const char | kDefaultBeaconUrl [] |
static const int | kDefaultImageJpegRecompressQuality |
static const int | kDefaultImageLimitOptimizedPercent |
static const int | kDefaultImageLimitResizeAreaPercent |
static const int | kDefaultImageJpegNumProgressiveScans |
static const int | kDefaultImageWebpRecompressQuality |
static const int | kDefaultMaxUrlSize |
static const int | kDefaultImageMaxRewritesAtOnce |
static const int | kDefaultMaxUrlSegmentSize |
static const int | kDefaultMaxInlinedPreviewImagesIndex |
static const int64 | kDefaultMinImageSizeLowResolutionBytes |
static const int64 | kDefaultMaxImageSizeLowResolutionBytes |
static const int64 | kDefaultCriticalImagesCacheExpirationMs |
Default cache expiration value for critical images in ajax metadata cache. | |
static const int64 | kDefaultMetadataCacheStalenessThresholdMs |
static const int | kDefaultFuriousTrafficPercent |
static const int | kDefaultFuriousSlot |
Default Custom Variable slot in which to put Furious information. | |
static const char | kClassName [] |
static const char | kDefaultXModPagespeedHeaderValue [] |
static const char | kDefaultBlinkDesktopUserAgentValue [] |
Protected Types | |
typedef std::vector< OptionBase * > | OptionBaseVector |
Convenience name for a set of rewrite options. | |
Protected Member Functions | |
template<class T , class U > | |
void | add_option (U default_value, OptionTemplateBase< T > *option, const char *id, OptionEnum option_enum) |
U must be assignable to T. | |
template<class T , class U > | |
void | add_option (U default_value, OptionTemplateBase< T > *option, const char *id) |
U must be assignable to T. | |
template<class T , class U > | |
void | set_option (const U &new_value, OptionTemplateBase< T > *option) |
U must be assignable to T. | |
void | SortOptions () |
void | Modify () |
Marks the config as modified. | |
const OptionBaseVector & | all_options () const |
Return the list of all options. |
If you add or remove anything from this list, you need to update the version number in rewrite_options.cc and FilterName().
Any new Option added, should have a corresponding enum here and this should be passed in when add_option is called in the constructor.
void net_instaweb::RewriteOptions::add_option | ( | U | default_value, | |
OptionTemplateBase< T > * | option, | |||
const char * | id, | |||
OptionEnum | option_enum | |||
) | [inline, protected] |
U must be assignable to T.
When adding an option, we take the default_value by value, not const-reference. This is because when calling add_option we may want to use a compile-time constant (e.g. Timer::kHourMs) which does not have a linkable address. The option_enum_ field of Option is set from the option_enum argument here. It has to be ensured that correct enum is passed in. If two Option<> objects have same enum, then SetOptionFromName will not work for those. If option_enum is not passed in, then kEndOfOptions will be used (default value in OptionBase constructor) and this means this option cannot be set using SetOptionFromName.
bool net_instaweb::RewriteOptions::AddFuriousSpec | ( | FuriousSpec * | spec | ) |
Add an experiment configuration. Returns true if the experiment was added successfully. Takes owndership of (and may delete) spec.
bool net_instaweb::RewriteOptions::AddFuriousSpec | ( | int | furious_id | ) |
Creates a FuriousSpec with furious_id and adds it to the configuration. Returns true if it was added successfully.
bool net_instaweb::RewriteOptions::AddFuriousSpec | ( | const StringPiece & | spec, | |
MessageHandler * | handler | |||
) |
Creates a FuriousSpec from spec and adds it to the configuration. Returns true if it was added successfully.
void net_instaweb::RewriteOptions::AddToPrioritizeVisibleContentCacheableFamilies | ( | const StringPiece & | str | ) |
Adds str as a URL pattern for which prioritize_visible_content is applicable, i.e., visible content (html above the fold) will be cached.
bool net_instaweb::RewriteOptions::AdjustFiltersByCommaSeparatedList | ( | const StringPiece & | filters, | |
MessageHandler * | handler | |||
) |
Enables filters specified without a prefix or with a prefix of '+' and disables filters specified with a prefix of '-'. Returns false if any of the filter names are invalid, but all the valid ones will be added anyway.
void net_instaweb::RewriteOptions::Allow | ( | const StringPiece & | wildcard_pattern | ) | [inline] |
Registers a wildcard pattern for to be allowed, potentially overriding previous Disallow wildcards.
bool net_instaweb::RewriteOptions::AvailableFuriousId | ( | int | id | ) |
Returns false if id is negative, or if the id is reserved for NoExperiment or NotSet, or if we already have an experiment with that id.
void net_instaweb::RewriteOptions::CheckFiltersAgainst | ( | const FilterSet & | enabled_filters, | |
const FilterSet & | disabled_filters | |||
) |
Check if the state of the filters is same as the arguments. Useful in tests.
void net_instaweb::RewriteOptions::ClearFilters | ( | ) |
Clear all explicitly enabled and disabled filters. Some filters may still be enabled by the rewrite level and HtmlWriterFilter will be enabled.
void net_instaweb::RewriteOptions::ClearSignatureForTesting | ( | ) | [inline] |
Clears a computed signature, unfreezing the options object. This is intended for testing.
void net_instaweb::RewriteOptions::ClearSignatureWithCaution | ( | ) | [inline] |
Clears the computed signature, unfreezing the options object. Warning: Please note that using this method is extremely risky and should be avoided as much as possible. If you are planning to use this, please discuss this with your team-mates and ensure that you clearly understand its implications. Also, please do repeat this warning at every place you use this method.
virtual RewriteOptions* net_instaweb::RewriteOptions::Clone | ( | ) | const [virtual] |
Make an identical copy of these options and return it. This does not* copy the signature, and the returned options are not in a frozen state.
Reimplemented in net_instaweb::ApacheConfig.
void net_instaweb::RewriteOptions::ComputeSignature | ( | const Hasher * | hasher | ) |
Computes a signature for the RewriteOptions object, including all contained classes (DomainLawyer, FileLoadPolicy, WildCardGroups).
Computing a signature "freezes" the class instance. Attempting to modify a RewriteOptions after freezing will DCHECK.
int64 net_instaweb::RewriteOptions::css_outline_min_bytes | ( | ) | const [inline] |
void net_instaweb::RewriteOptions::DisableAllFiltersNotExplicitlyEnabled | ( | ) |
Explicitly disable all filters which are not *currently* explicitly enabled
Note: Do not call EnableFilter(...) for this options object after calling DisableAllFilters..., because the Disable list will not be auto-updated.
Used to deal with query param ?ModPagespeedFilter=foo Which implies that all filters not listed should be disabled.
bool net_instaweb::RewriteOptions::DisableFiltersByCommaSeparatedList | ( | const StringPiece & | filters, | |
MessageHandler * | handler | |||
) |
Adds a set of filters to the disabled set. Returns false if any of the filter names are invalid, but all the valid ones will be added anyway.
void net_instaweb::RewriteOptions::Disallow | ( | const StringPiece & | wildcard_pattern | ) | [inline] |
Registers a wildcard pattern for to be disallowed, potentially overriding previous Allow wildcards.
virtual void net_instaweb::RewriteOptions::DisallowTroublesomeResources | ( | ) | [virtual] |
Blacklist of javascript files that don't like their names changed. This should be called for root options to set defaults.
void net_instaweb::RewriteOptions::EnableFilter | ( | Filter | filter | ) |
Adds the filter to the list of enabled filters. However, if the filter is also present in the list of disabled filters, that takes precedence.
bool net_instaweb::RewriteOptions::EnableFiltersByCommaSeparatedList | ( | const StringPiece & | filters, | |
MessageHandler * | handler | |||
) |
Adds a set of filters to the enabled set. Returns false if any of the filter names are invalid, but all the valid ones will be added anyway.
static const char* net_instaweb::RewriteOptions::FilterId | ( | Filter | filter | ) | [static] |
Returns a two-letter id code for this filter, used for for encoding URLs.
static const char* net_instaweb::RewriteOptions::FilterName | ( | Filter | filter | ) | [static] |
Return the appropriate human-readable filter name for the given filter, e.g. "CombineCss".
void net_instaweb::RewriteOptions::ForceEnableFilter | ( | Filter | filter | ) |
Guarantees that a filter would be enabled even if it is present in the list of disabled filters by removing it from disabled filter list.
FuriousSpec* net_instaweb::RewriteOptions::GetFuriousSpec | ( | int | id | ) | const |
Returns the spec with the id_ that matches id. Returns NULL if no spec matches.
int64 net_instaweb::RewriteOptions::idle_flush_time_ms | ( | ) | const [inline] |
How much inactivity of HTML input will result in PSA introducing a flush. Values <= 0 disable the feature.
bool net_instaweb::RewriteOptions::IsAllowed | ( | const StringPiece & | url | ) | const [inline] |
Determines, based on the sequence of Allow/Disallow calls above, whether a url is allowed.
bool net_instaweb::RewriteOptions::IsRetainedComment | ( | const StringPiece & | comment | ) | const [inline] |
If enabled, the 'remove_comments' filter will remove all HTML comments. As discussed in Issue 237, some comments have semantic value and must be retained.
bool net_instaweb::RewriteOptions::MatchesPrioritizeVisibleContentCacheableFamilies | ( | const StringPiece & | str | ) | const [inline] |
Functions for checking against and adding to prioritize_visible_content cacheable family option (prioritize_visible_content_cacheable_families_ field). Checks if str is an URL for which prioritize_visible_content filter is applicable. Returns true if str matches any of the patterns in prioritize_visible_content_cacheable_families_.
int net_instaweb::RewriteOptions::max_url_segment_size | ( | ) | const [inline] |
The maximum length of a URL segment. for http://a/b/c.d, this is == strlen("c.d")
virtual void net_instaweb::RewriteOptions::Merge | ( | const RewriteOptions & | src | ) | [virtual] |
Merge src into 'this'. Generally, options that are explicitly set in src will override those explicitly set in 'this', although option Merge implementations can be redefined by specific Option class implementations (e.g. OptionInt64MergeWithMax). One semantic subject to interpretation is when a core-filter is disabled in the first set and not in the second. My judgement is that the 'disable' from 'this' should override the core-set membership in the 'src', but not an 'enable' in the 'src'.
You can make an exact duplicate of RewriteOptions object 'src' via (new 'typeof src')->Merge(src), aka Clone().
Merge expects that 'src' and 'this' are the same type. If that's not true, this function will DCHECK.
static bool net_instaweb::RewriteOptions::ParseBeaconUrl | ( | const StringPiece & | in, | |
BeaconUrl * | out | |||
) | [static] |
Parse a beacon url, or a pair of beacon urls (http https) separated by a space. If only an http url is given, the https url is derived from it by simply substituting the protocol.
const GoogleString& net_instaweb::RewriteOptions::prioritize_visible_content_non_cacheable_elements | ( | ) | const [inline] |
Returns the elements that should not be cached by prioritize_visible_content filter.
void net_instaweb::RewriteOptions::set_cache_invalidation_timestamp | ( | int64 | timestamp_ms | ) | [inline] |
Sets the cache invalidation timestamp -- in milliseconds since 1970. This function is meant to be called on a RewriteOptions* immediately after instantiation. It cannot be used to mutate the value of one already in use in a RewriteDriver.
See also UpdateCacheInvalidationTimestampMs.
void net_instaweb::RewriteOptions::set_cache_invalidation_timestamp_mutex | ( | ThreadSystem::RWLock * | lock | ) | [inline] |
Supply optional mutex for setting a global cache invalidation timestamp. Ownership of 'lock' is transfered to this.
void net_instaweb::RewriteOptions::set_option | ( | const U & | new_value, | |
OptionTemplateBase< T > * | option | |||
) | [inline, protected] |
U must be assignable to T.
When setting an option, however, we generally are doing so with a variable rather than a constant so it makes sense to pass it by reference.
void net_instaweb::RewriteOptions::set_prioritize_visible_content_non_cacheable_elements | ( | const StringPiece & | p | ) | [inline] |
Sets the elements that should be cached by prioritize_visible_content filter.
void net_instaweb::RewriteOptions::SetDefaultRewriteLevel | ( | RewriteLevel | level | ) | [inline] |
Do not set the modified bit -- we are only changing the default.
void net_instaweb::RewriteOptions::SetFuriousState | ( | int | id | ) |
Sets which side of the experiment these RewriteOptions are on. Cookie-setting must be done separately. furious::kFuriousNotSet indicates it hasn't been set. furious::kFuriousNoExperiment indicates this request shouldn't be in any experiment. Then sets the rewriters to match the experiment indicated by id.
OptionSettingResult net_instaweb::RewriteOptions::SetOptionFromName | ( | const StringPiece & | name, | |
const GoogleString & | value, | |||
GoogleString * | msg | |||
) |
Set Option 'name' to 'value'. Returns whether it succeeded or the kind of failure (wrong name or value), and writes the diagnostic into 'msg'.
bool net_instaweb::RewriteOptions::SetOptionFromNameAndLog | ( | const StringPiece & | name, | |
const GoogleString & | value, | |||
MessageHandler * | handler | |||
) |
Sets Option 'name' to 'value'. Returns whether it succeeded and logs any warnings to 'handler'.
const GoogleString& net_instaweb::RewriteOptions::signature | ( | ) | const [inline] |
Returns the computed signature.
We take a reader-lock because we may be looking at the global_options signature concurrent with updating it if someone flushes cache. Note that the default mutex implementation is NullRWLock, which isn't actually a mutex. Only (currently) for the Apache global_options() object do we create a real mutex. We don't expect contention here because we take a reader-lock and the only time we Write is if someone flushes the cache.
void net_instaweb::RewriteOptions::SortOptions | ( | ) | [protected] |
To be called after construction and before this object is used. Currently this is called from constructor. If a sub-class calls add_option() with OptionEnum, then it has to call this again to ensure sorted order.
virtual GoogleString net_instaweb::RewriteOptions::ToExperimentDebugString | ( | ) | const [virtual] |
Returns a string with more information about the currently running furious experiment. Primarily used for tagging Google Analytics data. This format is not at all specific to Google Analytics, however.
virtual GoogleString net_instaweb::RewriteOptions::ToExperimentString | ( | ) | const [virtual] |
Returns a string identifying the currently running Furious experiment to be used in tagging Google Analytics data.
bool net_instaweb::RewriteOptions::UpdateCacheInvalidationTimestampMs | ( | int64 | timestamp_ms, | |
const Hasher * | hasher | |||
) |
Updates the cache invalidation timestamp of a mutexed RewriteOptions instance. Currently this only occurs in Apache global_options, and is used for purging cache by touching a file in the cache directory.
This function ignores requests to move the invalidation timestamp backwards. It returns true if the timestamp was actually changed.
const int64 net_instaweb::RewriteOptions::kDefaultMaxImageSizeLowResolutionBytes [static] |
Default maximum image size below which low res image is generated by InlinePreviewImagesFilter.
const int net_instaweb::RewriteOptions::kDefaultMaxInlinedPreviewImagesIndex [static] |
Default number of first N images for which low res image is generated by DelayImagesFilter.
const int net_instaweb::RewriteOptions::kDefaultMaxUrlSegmentSize [static] |
See http://code.google.com/p/modpagespeed/issues/detail?id=9 Apache evidently limits each URL path segment (between /) to about 256 characters. This is not fundamental URL limitation but is Apache specific.
const int net_instaweb::RewriteOptions::kDefaultMaxUrlSize [static] |
IE limits URL size overall to about 2k characters. See http://support.microsoft.com/kb/208427/EN-US
const int64 net_instaweb::RewriteOptions::kDefaultMetadataCacheStalenessThresholdMs [static] |
Default time in milliseconds for which a metadata cache entry may be used after expiry.
const int64 net_instaweb::RewriteOptions::kDefaultMinImageSizeLowResolutionBytes [static] |
Default minimum image size above which low res image is generated by InlinePreviewImagesFilter.