Page Speed Optimization Libraries
1.2.24.1
|
00001 /* 00002 * Copyright 2010 Google Inc. 00003 * 00004 * Licensed under the Apache License, Version 2.0 (the "License"); 00005 * you may not use this file except in compliance with the License. 00006 * You may obtain a copy of the License at 00007 * 00008 * http:///www.apache.org/licenses/LICENSE-2.0 00009 * 00010 * Unless required by applicable law or agreed to in writing, software 00011 * distributed under the License is distributed on an "AS IS" BASIS, 00012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 * See the License for the specific language governing permissions and 00014 * limitations under the License. 00015 */ 00016 00018 00019 #ifndef NET_INSTAWEB_REWRITER_PUBLIC_REWRITE_OPTIONS_H_ 00020 #define NET_INSTAWEB_REWRITER_PUBLIC_REWRITE_OPTIONS_H_ 00021 00022 #include <cstddef> 00023 #include <map> 00024 #include <set> 00025 #include <utility> 00026 #include <vector> 00027 00028 #include "base/logging.h" 00029 #include "net/instaweb/http/public/meta_data.h" 00030 #include "net/instaweb/http/public/semantic_type.h" 00031 #include "net/instaweb/rewriter/public/domain_lawyer.h" 00032 #include "net/instaweb/rewriter/public/file_load_policy.h" 00033 #include "net/instaweb/rewriter/public/javascript_library_identification.h" 00034 #include "net/instaweb/util/public/basictypes.h" 00035 #include "net/instaweb/util/public/fast_wildcard_group.h" 00036 #include "net/instaweb/util/public/gtest_prod.h" 00037 #include "net/instaweb/util/public/scoped_ptr.h" 00038 #include "net/instaweb/util/public/string.h" 00039 #include "net/instaweb/util/public/string_util.h" 00040 #include "net/instaweb/util/public/thread_system.h" 00041 #include "net/instaweb/util/public/wildcard.h" 00042 00043 namespace net_instaweb { 00044 00045 class GoogleUrl; 00046 class Hasher; 00047 class MessageHandler; 00048 00069 class RewriteOptions { 00070 public: 00074 enum Filter { 00075 kAddBaseTag, 00076 kAddHead, 00077 kAddInstrumentation, 00078 kCanonicalizeJavascriptLibraries, 00079 kCollapseWhitespace, 00080 kCollectFlushEarlyContentFilter, 00081 kCombineCss, 00082 kCombineHeads, 00083 kCombineJavascript, 00084 kComputePanelJson, 00085 kComputeVisibleText, 00086 kConvertGifToPng, 00087 kConvertJpegToProgressive, 00088 kConvertJpegToWebp, 00089 kConvertMetaTags, 00090 kConvertPngToJpeg, 00091 kDebug, 00092 kDeferIframe, 00093 kDeferJavascript, 00094 kDelayImages, 00095 kDetectReflowWithDeferJavascript, 00096 kDeterministicJs, 00097 kDisableJavascript, 00098 kDivStructure, 00099 kElideAttributes, 00100 kExperimentSpdy, 00101 kExplicitCloseTags, 00102 kExtendCacheCss, 00103 kExtendCacheImages, 00104 kExtendCachePdfs, 00105 kExtendCacheScripts, 00106 kFallbackRewriteCssUrls, 00107 kFlattenCssImports, 00108 kFlushSubresources, 00109 kHandleNoscriptRedirect, 00110 kHtmlWriterFilter, 00111 kInlineCss, 00112 kInlineImages, 00113 kInlineImportToLink, 00114 kInlineJavascript, 00115 kInsertDnsPrefetch, 00116 kInsertGA, 00117 kInsertImageDimensions, 00118 kJpegSubsampling, 00119 kLazyloadImages, 00120 kLeftTrimUrls, 00121 kLocalStorageCache, 00122 kMakeGoogleAnalyticsAsync, 00123 kMoveCssAboveScripts, 00124 kMoveCssToHead, 00125 kOutlineCss, 00126 kOutlineJavascript, 00127 kPedantic, 00128 kPrioritizeVisibleContent, 00129 kProcessBlinkInBackground, 00130 kRecompressJpeg, 00131 kRecompressPng, 00132 kRecompressWebp, 00133 kRemoveComments, 00134 kRemoveQuotes, 00135 kResizeImages, 00136 kResizeMobileImages, 00137 kRewriteCss, 00138 kRewriteDomains, 00139 kRewriteJavascript, 00140 kRewriteStyleAttributes, 00141 kRewriteStyleAttributesWithUrl, 00142 kServeNonCacheableNonCritical, 00143 kSplitHtml, 00144 kSpriteImages, 00145 kSquashImagesForMobileScreen, 00146 kStripImageColorProfile, 00147 kStripImageMetaData, 00148 kStripNonCacheable, 00149 kStripScripts, 00150 kEndOfFilters 00151 }; 00152 00159 enum OptionEnum { 00160 kAjaxRewritingEnabled, 00161 kAlwaysRewriteCss, 00162 kAnalyticsID, 00163 kAvoidRenamingIntrospectiveJavascript, 00164 kBeaconUrl, 00165 kBlinkDesktopUserAgent, 00166 kBlinkMaxHtmlSizeRewritable, 00167 kBlinkNonCacheablesForAllFamilies, 00168 kCacheInvalidationTimestamp, 00169 kClientDomainRewrite, 00170 kCombineAcrossPaths, 00171 kFinderPropertiesCacheExpirationTimeMs, 00172 kCriticalLineConfig, 00173 kCssFlattenMaxBytes, 00174 kCssImageInlineMaxBytes, 00175 kCssInlineMaxBytes, 00176 kCssOutlineMinBytes, 00177 kCssPreserveURLs, 00178 kDefaultCacheHtml, 00179 kDomainRewriteHyperlinks, 00180 kDomainShardCount, 00181 kEnableAggressiveRewritersForMobile, 00182 kEnableBlinkCriticalLine, 00183 kEnableBlinkDashboard, 00184 kEnabled, 00185 kEnableBlinkHtmlChangeDetection, 00186 kEnableBlinkHtmlChangeDetectionLogging, 00187 kEnableDeferJsExperimental, 00188 kEnableFlushSubresourcesExperimental, 00189 kEnableInlinePreviewImagesExperimental, 00190 kEnableLazyloadInBlink, 00191 kFlushBufferLimitBytes, 00192 kFlushHtml, 00193 kFlushMoreResourcesEarlyIfTimePermits, 00194 kForbidAllDisabledFilters, 00195 kFuriousCookieDurationMs, 00196 kFuriousSlot, 00197 kIdleFlushTimeMs, 00198 kImageInlineMaxBytes, 00199 kImageJpegNumProgressiveScans, 00200 kImageJpegRecompressionQuality, 00201 kImageLimitOptimizedPercent, 00202 kImageLimitResizeAreaPercent, 00203 kImageMaxRewritesAtOnce, 00204 kImagePreserveURLs, 00205 kImageRetainColorProfile, 00206 kImageRetainColorSampling, 00207 kImageRetainExifData, 00208 kImageRecompressionQuality, 00209 kCacheSmallImagesUnrewritten, 00210 kImageResolutionLimitBytes, 00211 kImageWebpRecompressionQuality, 00212 kImplicitCacheTtlMs, 00213 kIncreaseSpeedTracking, 00214 kInPlaceWaitForOptimized, 00215 kJsInlineMaxBytes, 00216 kJsOutlineMinBytes, 00217 kLazyloadImagesBlankUrl, 00218 kJsPreserveURLs, 00219 kLazyloadImagesAfterOnload, 00220 kInlineOnlyCriticalImages, 00221 kLogRewriteTiming, 00222 kLowercaseHtmlNames, 00223 kMaxCacheableResponseContentLength, 00224 kMaxCombinedJsBytes, 00225 kMaxHtmlCacheTimeMs, 00226 kMaxHtmlParseBytes, 00227 kMaxImageBytesForWebpInCss, 00228 kMaxImageSizeLowResolutionBytes, 00229 kMaxInlinedPreviewImagesIndex, 00230 kMaxUrlSegmentSize, 00231 kMaxUrlSize, 00232 kMinImageSizeLowResolutionBytes, 00233 kMinResourceCacheTimeToRewriteMs, 00234 kModifyCachingHeaders, 00235 kOverrideBlinkCacheTimeMs, 00236 kOverrideCachingTtlMs, 00237 kOverrideIeDocumentMode, 00238 kPassthroughBlinkForInvalidResponseCode, 00239 kProgressiveJpegMinBytes, 00240 kPropagateBlinkCacheDeletes, 00241 kRejectBlacklisted, 00242 kRejectBlacklistedStatusCode, 00243 kReportUnloadTime, 00244 kRespectVary, 00245 kRespectXForwardedProto, 00246 kRewriteDeadlineMs, 00247 kRewriteLevel, 00248 kRunningFurious, 00249 kServeStaleIfFetchError, 00250 kSupportNoScriptEnabled, 00251 kUseFixedUserAgentForBlinkCacheMisses, 00252 kUseSmartDiffInBlink, 00253 kXPsaBlockingRewrite, 00254 kXModPagespeedHeaderValue, 00255 00257 kCacheFlushFilename, 00258 kCacheFlushPollIntervalSec, 00259 kCollectRefererStatistics, 00260 kExperimentalFetchFromModSpdy, 00261 kFetcherProxy, 00262 kFetcherTimeOutMs, 00263 kFileCacheCleanInodeLimit, 00264 kFileCacheCleanIntervalMs, 00265 kFileCacheCleanSizeKb, 00266 kFileCachePath, 00267 kHashRefererStatistics, 00268 kLruCacheByteLimit, 00269 kLruCacheKbPerProcess, 00270 kMemcachedServers, 00271 kMemcachedThreads, 00272 kMemcachedTimeoutUs, 00273 kMessageBufferSize, 00274 kRateLimitBackgroundFetches, 00275 kRefererStatisticsOutputLevel, 00276 kSlurpDirectory, 00277 kSlurpFlushLimit, 00278 kSlurpReadOnly, 00279 kStatisticsEnabled, 00280 kStatisticsLoggingEnabled, 00281 kStatisticsLoggingFile, 00282 kStatisticsLoggingIntervalMs, 00283 kStatisticsLoggingChartsCSS, 00284 kStatisticsLoggingChartsJS, 00285 kTestProxy, 00286 kUseSharedMemLocking, 00287 00289 kEndOfOptions 00290 }; 00291 00292 struct BeaconUrl { 00293 GoogleString http; 00294 GoogleString https; 00295 }; 00296 00297 struct NameValue { 00298 NameValue(const StringPiece& name_in, const StringPiece& value_in) { 00299 name_in.CopyToString(&name); 00300 value_in.CopyToString(&value); 00301 } 00302 GoogleString name; 00303 GoogleString value; 00304 }; 00305 00321 static const int kOptionsVersion = 13; 00322 00323 static const char kAjaxRewriteId[]; 00324 static const char kCssCombinerId[]; 00325 static const char kCssFilterId[]; 00326 static const char kCssImportFlattenerId[]; 00327 static const char kCssInlineId[]; 00328 static const char kCacheExtenderId[]; 00329 static const char kImageCombineId[]; 00330 static const char kImageCompressionId[]; 00331 static const char kJavascriptCombinerId[]; 00332 static const char kJavascriptInlineId[]; 00333 static const char kLocalStorageCacheId[]; 00334 static const char kJavascriptMinId[]; 00335 static const char kCollectFlushEarlyContentFilterId[]; 00336 00337 static const char kPanelCommentPrefix[]; 00338 00341 static const char* FilterName(Filter filter); 00342 00345 static const char* FilterId(Filter filter); 00346 00348 static const Filter kFirstFilter = kAddBaseTag; 00349 00351 typedef std::set<Filter> FilterSet; 00352 00358 static bool AddByNameToFilterSet(const StringPiece& option, FilterSet* set, 00359 MessageHandler* handler); 00360 00363 typedef std::pair<StringPiece, StringPiece> OptionStringPair; 00364 typedef std::set<OptionStringPair> OptionSet; 00365 00368 class PropertyBase { 00369 public: 00370 PropertyBase(const char* id, OptionEnum option_enum) 00371 : id_(id), 00372 option_enum_(option_enum), 00373 do_not_use_for_signature_computation_(false), 00374 index_(-1) { 00375 } 00376 virtual ~PropertyBase(); 00377 00380 virtual void InitializeOption(RewriteOptions* options) const = 0; 00381 00382 void set_do_not_use_for_signature_computation(bool x) { 00383 do_not_use_for_signature_computation_ = x; 00384 } 00385 bool is_used_for_signature_computation() const { 00386 return !do_not_use_for_signature_computation_; 00387 } 00388 00389 void set_index(int index) { index_ = index; } 00390 const char* id() const { return id_; } 00391 OptionEnum option_enum() const { return option_enum_; } 00392 int index() const { return index_; } 00393 00394 private: 00395 const char* id_; 00396 OptionEnum option_enum_; 00397 bool do_not_use_for_signature_computation_; 00398 int index_; 00399 00400 DISALLOW_COPY_AND_ASSIGN(PropertyBase); 00401 }; 00402 00403 typedef std::vector<PropertyBase*> PropertyVector; 00404 00407 class OptionBase { 00408 public: 00409 OptionBase() {} 00410 virtual ~OptionBase(); 00411 virtual bool SetFromString(const GoogleString& value_string) = 0; 00412 virtual void Merge(const OptionBase* src) = 0; 00413 virtual bool was_set() const = 0; 00414 virtual GoogleString Signature(const Hasher* hasher) const = 0; 00415 virtual GoogleString ToString() const = 0; 00416 const char* id() { return property()->id(); } 00417 OptionEnum option_enum() const { return property()->option_enum(); } 00418 bool is_used_for_signature_computation() const { 00419 return property()->is_used_for_signature_computation(); 00420 } 00421 virtual const PropertyBase* property() const = 0; 00422 }; 00423 00425 typedef std::vector<OptionBase*> OptionBaseVector; 00426 00427 enum RewriteLevel { 00432 kPassThrough, 00433 00439 kCoreFilters, 00440 00444 kTestingCoreFilters, 00445 00448 kAllFilters, 00449 }; 00450 00452 enum OptionSettingResult { 00453 kOptionOk, 00454 kOptionNameUnknown, 00455 kOptionValueInvalid 00456 }; 00457 00458 static const int64 kDefaultBlinkMaxHtmlSizeRewritable; 00459 static const int64 kDefaultCssFlattenMaxBytes; 00460 static const int64 kDefaultCssImageInlineMaxBytes; 00461 static const int64 kDefaultCssInlineMaxBytes; 00462 static const int64 kDefaultCssOutlineMinBytes; 00463 static const int64 kDefaultImageInlineMaxBytes; 00464 static const int64 kDefaultJsInlineMaxBytes; 00465 static const int64 kDefaultJsOutlineMinBytes; 00466 static const int64 kDefaultProgressiveJpegMinBytes; 00467 static const int64 kDefaultMaxCacheableResponseContentLength; 00468 static const int64 kDefaultMaxHtmlCacheTimeMs; 00469 static const int64 kDefaultMaxHtmlParseBytes; 00470 static const int64 kDefaultMaxImageBytesForWebpInCss; 00471 static const int64 kDefaultMetadataInputErrorsCacheTtlMs; 00472 static const int64 kDefaultMinResourceCacheTimeToRewriteMs; 00473 static const int64 kDefaultCacheInvalidationTimestamp; 00474 static const int64 kDefaultIdleFlushTimeMs; 00475 static const int64 kDefaultFlushBufferLimitBytes; 00476 static const int64 kDefaultImplicitCacheTtlMs; 00477 static const int64 kDefaultPrioritizeVisibleContentCacheTimeMs; 00478 static const char kDefaultBeaconUrl[]; 00479 static const int64 kDefaultImagesRecompressQuality; 00480 static const int64 kDefaultImageJpegRecompressQuality; 00481 static const int kDefaultImageLimitOptimizedPercent; 00482 static const int kDefaultImageLimitResizeAreaPercent; 00483 static const int64 kDefaultImageResolutionLimitBytes; 00484 static const int kDefaultImageJpegNumProgressiveScans; 00485 static const int64 kDefaultImageWebpRecompressQuality; 00486 static const int kDefaultDomainShardCount; 00487 static const int64 kDefaultBlinkHtmlChangeDetectionTimeMs; 00488 static const int64 kDefaultOverrideBlinkCacheTimeMs; 00489 00492 static const int kDefaultMaxUrlSize; 00493 00494 static const int kDefaultImageMaxRewritesAtOnce; 00495 00500 static const int kDefaultMaxUrlSegmentSize; 00501 00503 static const int kDefaultRewriteDeadlineMs; 00504 00507 static const int kDefaultMaxInlinedPreviewImagesIndex; 00510 static const int64 kDefaultMinImageSizeLowResolutionBytes; 00513 static const int64 kDefaultMaxImageSizeLowResolutionBytes; 00515 static const int64 kDefaultFinderPropertiesCacheExpirationTimeMs; 00516 00519 static const int64 kDefaultFuriousCookieDurationMs; 00520 00523 static const int64 kDefaultMetadataCacheStalenessThresholdMs; 00524 00526 static const int64 kDefaultMaxCombinedJsBytes; 00527 00528 static const int kDefaultFuriousTrafficPercent; 00530 static const int kDefaultFuriousSlot; 00531 00532 static const char kClassName[]; 00533 00534 static const char kDefaultBlinkDesktopUserAgentValue[]; 00535 00536 static const char kDefaultBlockingRewriteKey[]; 00537 00538 static const char kRejectedRequestUrlKeyName[]; 00539 00540 static const int kDefaultPropertyCacheHttpStatusStabilityThreshold; 00541 00550 class FuriousSpec { 00551 public: 00556 FuriousSpec(const StringPiece& spec, RewriteOptions* options, 00557 MessageHandler* handler); 00558 00562 explicit FuriousSpec(int id); 00563 00564 virtual ~FuriousSpec(); 00565 00567 virtual FuriousSpec* Clone(); 00568 00569 bool is_valid() const { return id_ >= 0; } 00570 00572 int id() const { return id_; } 00573 int percent() const { return percent_; } 00574 GoogleString ga_id() const { return ga_id_; } 00575 int slot() const { return ga_variable_slot_; } 00576 RewriteLevel rewrite_level() const { return rewrite_level_; } 00577 FilterSet enabled_filters() const { return enabled_filters_; } 00578 FilterSet disabled_filters() const { return disabled_filters_; } 00579 OptionSet filter_options() const { return filter_options_; } 00580 int64 css_inline_max_bytes() const { return css_inline_max_bytes_; } 00581 int64 js_inline_max_bytes() const { return js_inline_max_bytes_; } 00582 int64 image_inline_max_bytes() const { return image_inline_max_bytes_; } 00583 bool use_default() const { return use_default_; } 00584 00585 protected: 00589 void Merge(const FuriousSpec& spec); 00590 00591 private: 00592 FRIEND_TEST(RewriteOptionsTest, FuriousMergeTest); 00593 00596 void Initialize(const StringPiece& spec, MessageHandler* handler); 00597 00598 int id_; 00599 GoogleString ga_id_; 00600 int ga_variable_slot_; 00601 int percent_; 00602 RewriteLevel rewrite_level_; 00603 FilterSet enabled_filters_; 00604 FilterSet disabled_filters_; 00605 OptionSet filter_options_; 00606 int64 css_inline_max_bytes_; 00607 int64 js_inline_max_bytes_; 00608 int64 image_inline_max_bytes_; 00611 bool use_default_; 00612 DISALLOW_COPY_AND_ASSIGN(FuriousSpec); 00613 }; 00614 00616 struct ElementAttributeCategory { 00617 GoogleString element; 00618 GoogleString attribute; 00619 semantic_type::Category category; 00620 }; 00621 00628 class Properties { 00629 public: 00638 static bool Initialize(Properties** properties); 00639 00648 static bool Terminate(Properties** properties_handle); 00649 00651 int size() const { return property_vector_.size(); } 00652 00653 const PropertyBase* property(int index) const { 00654 return property_vector_[index]; 00655 } 00656 PropertyBase* property(int index) { return property_vector_[index]; } 00657 00663 void Merge(Properties* properties); 00664 00665 void push_back(PropertyBase* p) { property_vector_.push_back(p); } 00666 00667 private: 00670 Properties(); 00671 ~Properties(); 00672 00676 int initialization_count_; 00677 00682 bool owns_properties_; 00683 PropertyVector property_vector_; 00684 }; 00685 00686 static bool ParseRewriteLevel(const StringPiece& in, RewriteLevel* out); 00687 00691 static bool ParseBeaconUrl(const StringPiece& in, BeaconUrl* out); 00692 00696 bool ImageOptimizationEnabled() const; 00697 00698 RewriteOptions(); 00699 virtual ~RewriteOptions(); 00700 00704 static bool Initialize(); 00705 static bool Terminate(); 00706 00711 void InitializeOptions(const Properties* properties); 00712 00713 bool modified() const { return modified_; } 00714 00720 void SetDefaultRewriteLevel(RewriteLevel level) { 00722 level_.set_default(level); 00723 } 00724 void SetRewriteLevel(RewriteLevel level) { 00725 set_option(level, &level_); 00726 } 00727 00729 void AddCustomFetchHeader(const StringPiece& name, const StringPiece& value); 00730 00731 const NameValue* custom_fetch_header(int i) const { 00732 return custom_fetch_headers_[i]; 00733 } 00734 00735 int num_custom_fetch_headers() const { 00736 return custom_fetch_headers_.size(); 00737 } 00738 00741 FuriousSpec* GetFuriousSpec(int id) const; 00742 00746 bool AvailableFuriousId(int id); 00747 00750 virtual bool AddFuriousSpec(const StringPiece& spec, MessageHandler* handler); 00751 00759 virtual bool SetFuriousState(int id); 00760 00764 void SetFuriousStateStr(const StringPiece& experiment_index); 00765 00766 int furious_id() const { return furious_id_; } 00767 00768 int furious_spec_id(int i) const { 00769 return furious_specs_[i]->id(); 00770 } 00771 00775 GoogleString GetFuriousStateStr() const; 00776 00777 FuriousSpec* furious_spec(int i) const { 00778 return furious_specs_[i]; 00779 } 00780 00781 int num_furious_experiments() const { return furious_specs_.size(); } 00782 00794 void AddUrlValuedAttribute(const StringPiece& element, 00795 const StringPiece& attribute, 00796 semantic_type::Category category); 00797 00800 void UrlValuedAttribute(int index, 00801 StringPiece* element, 00802 StringPiece* attribute, 00803 semantic_type::Category* category) const; 00804 00805 int num_url_valued_attributes() const { 00806 if (url_valued_attributes_ == NULL) { 00807 return 0; 00808 } else { 00809 return url_valued_attributes_->size(); 00810 } 00811 } 00812 00814 bool RegisterLibrary( 00815 uint64 bytes, StringPiece md5_hash, StringPiece canonical_url) { 00816 return javascript_library_identification_.RegisterLibrary( 00817 bytes, md5_hash, canonical_url); 00818 } 00819 00822 const JavascriptLibraryIdentification* javascript_library_identification() 00823 const { 00824 if (Enabled(kCanonicalizeJavascriptLibraries)) { 00825 return &javascript_library_identification_; 00826 } else { 00827 return NULL; 00828 } 00829 } 00830 00831 RewriteLevel level() const { return level_.value(); } 00832 00837 bool AdjustFiltersByCommaSeparatedList(const StringPiece& filters, 00838 MessageHandler* handler); 00839 00843 bool EnableFiltersByCommaSeparatedList(const StringPiece& filters, 00844 MessageHandler* handler); 00845 00849 bool DisableFiltersByCommaSeparatedList(const StringPiece& filters, 00850 MessageHandler* handler); 00851 00855 bool ForbidFiltersByCommaSeparatedList(const StringPiece& filters, 00856 MessageHandler* handler); 00857 00865 void DisableAllFiltersNotExplicitlyEnabled(); 00866 00870 void EnableFilter(Filter filter); 00873 void ForceEnableFilter(Filter filter); 00874 void DisableFilter(Filter filter); 00875 void ForbidFilter(Filter filter); 00876 void EnableFilters(const FilterSet& filter_set); 00877 void DisableFilters(const FilterSet& filter_set); 00878 void ForbidFilters(const FilterSet& filter_set); 00881 void ClearFilters(); 00882 00885 void EnableExtendCacheFilters(); 00886 00887 bool Enabled(Filter filter) const; 00888 bool Forbidden(StringPiece filter_id) const; 00889 00891 void GetEnabledFiltersRequiringScriptExecution(FilterSet* filter_set) const; 00892 00894 void DisableFiltersRequiringScriptExecution(); 00895 00900 static bool AddCommaSeparatedListToOptionSet( 00901 const StringPiece& options, OptionSet* set, MessageHandler* handler); 00902 00905 OptionSettingResult SetOptionFromName( 00906 const StringPiece& name, const GoogleString& value, GoogleString* msg); 00907 00910 bool SetOptionsFromName(const OptionSet& option_set); 00911 00914 bool SetOptionFromNameAndLog(const StringPiece& name, 00915 const GoogleString& value, 00916 MessageHandler* handler); 00917 00920 int64 css_outline_min_bytes() const { return css_outline_min_bytes_.value(); } 00921 void set_css_outline_min_bytes(int64 x) { 00922 set_option(x, &css_outline_min_bytes_); 00923 } 00924 00925 GoogleString ga_id() const { return ga_id_.value(); } 00926 void set_ga_id(GoogleString id) { 00927 set_option(id, &ga_id_); 00928 } 00929 00930 bool increase_speed_tracking() const { 00931 return increase_speed_tracking_.value(); 00932 } 00933 void set_increase_speed_tracking(bool x) { 00934 set_option(x, &increase_speed_tracking_); 00935 } 00936 00937 int64 js_outline_min_bytes() const { return js_outline_min_bytes_.value(); } 00938 void set_js_outline_min_bytes(int64 x) { 00939 set_option(x, &js_outline_min_bytes_); 00940 } 00941 00942 int64 progressive_jpeg_min_bytes() const { 00943 return progressive_jpeg_min_bytes_.value(); 00944 } 00945 void set_progressive_jpeg_min_bytes(int64 x) { 00946 set_option(x, &progressive_jpeg_min_bytes_); 00947 } 00948 00949 int64 css_flatten_max_bytes() const { return css_flatten_max_bytes_.value(); } 00950 void set_css_flatten_max_bytes(int64 x) { 00951 set_option(x, &css_flatten_max_bytes_); 00952 } 00953 bool cache_small_images_unrewritten() const { 00954 return cache_small_images_unrewritten_.value(); 00955 } 00956 void set_cache_small_images_unrewritten(bool x) { 00957 set_option(x, &cache_small_images_unrewritten_); 00958 } 00959 int64 image_resolution_limit_bytes() const { 00960 return image_resolution_limit_bytes_.value(); 00961 } 00962 void set_image_resolution_limit_bytes(int64 x) { 00963 set_option(x, &image_resolution_limit_bytes_); 00964 } 00965 00967 int64 ImageInlineMaxBytes() const; 00968 void set_image_inline_max_bytes(int64 x); 00970 int64 CssImageInlineMaxBytes() const; 00971 void set_css_image_inline_max_bytes(int64 x) { 00972 set_option(x, &css_image_inline_max_bytes_); 00973 } 00975 int64 MaxImageInlineMaxBytes() const; 00976 int64 css_inline_max_bytes() const { return css_inline_max_bytes_.value(); } 00977 void set_css_inline_max_bytes(int64 x) { 00978 set_option(x, &css_inline_max_bytes_); 00979 } 00980 int64 js_inline_max_bytes() const { return js_inline_max_bytes_.value(); } 00981 void set_js_inline_max_bytes(int64 x) { 00982 set_option(x, &js_inline_max_bytes_); 00983 } 00984 int64 max_html_cache_time_ms() const { 00985 return max_html_cache_time_ms_.value(); 00986 } 00987 void set_max_html_cache_time_ms(int64 x) { 00988 set_option(x, &max_html_cache_time_ms_); 00989 } 00990 int64 max_html_parse_bytes() const { 00991 return max_html_parse_bytes_.value(); 00992 } 00993 void set_max_html_parse_bytes(int64 x) { 00994 set_option(x, &max_html_parse_bytes_); 00995 } 00996 int64 max_image_bytes_for_webp_in_css() const { 00997 return max_image_bytes_for_webp_in_css_.value(); 00998 } 00999 void set_max_image_bytes_for_webp_in_css(int64 x) { 01000 set_option(x, &max_image_bytes_for_webp_in_css_); 01001 } 01002 int64 max_cacheable_response_content_length() const { 01003 return max_cacheable_response_content_length_.value(); 01004 } 01005 void set_max_cacheable_response_content_length(int64 x) { 01006 set_option(x, &max_cacheable_response_content_length_); 01007 } 01008 int64 min_resource_cache_time_to_rewrite_ms() const { 01009 return min_resource_cache_time_to_rewrite_ms_.value(); 01010 } 01011 void set_min_resource_cache_time_to_rewrite_ms(int64 x) { 01012 set_option(x, &min_resource_cache_time_to_rewrite_ms_); 01013 } 01014 bool need_to_store_experiment_data() const { 01015 return need_to_store_experiment_data_; 01016 } 01017 void set_need_to_store_experiment_data(bool x) { 01018 need_to_store_experiment_data_ = x; 01019 } 01020 01021 int64 blocking_fetch_timeout_ms() const { 01022 return blocking_fetch_timeout_ms_.value(); 01023 } 01024 void set_blocking_fetch_timeout_ms(int64 x) { 01025 set_option(x, &blocking_fetch_timeout_ms_); 01026 } 01027 bool override_ie_document_mode() const { 01028 return override_ie_document_mode_.value(); 01029 } 01030 void set_override_ie_document_mode(bool x) { 01031 set_option(x, &override_ie_document_mode_); 01032 } 01033 01037 bool IsUrlCacheValid(StringPiece url, int64 time_ms) const; 01038 01043 void AddUrlCacheInvalidationEntry(StringPiece url_pattern, 01044 int64 timestamp_ms, 01045 bool is_strict); 01046 01049 bool IsUrlCacheInvalidationEntriesSorted() const; 01050 01053 void set_cache_invalidation_timestamp_mutex(ThreadSystem::RWLock* lock) { 01054 cache_invalidation_timestamp_.set_mutex(lock); 01055 } 01056 01058 int64 cache_invalidation_timestamp() const { 01059 ThreadSystem::ScopedReader lock(cache_invalidation_timestamp_.mutex()); 01060 return cache_invalidation_timestamp_.value(); 01061 } 01062 01069 void set_cache_invalidation_timestamp(int64 timestamp_ms) { 01070 cache_invalidation_timestamp_.mutex()->DCheckLocked(); 01071 set_option(timestamp_ms, &cache_invalidation_timestamp_); 01072 } 01073 01080 bool UpdateCacheInvalidationTimestampMs(int64 timestamp_ms, 01081 const Hasher* hasher); 01082 01085 int64 idle_flush_time_ms() const { 01086 return idle_flush_time_ms_.value(); 01087 } 01088 void set_idle_flush_time_ms(int64 x) { 01089 set_option(x, &idle_flush_time_ms_); 01090 } 01091 01093 int64 flush_buffer_limit_bytes() const { 01094 return flush_buffer_limit_bytes_.value(); 01095 } 01096 01097 void set_flush_buffer_limit_bytes(int64 x) { 01098 set_option(x, &flush_buffer_limit_bytes_); 01099 } 01100 01103 int max_url_segment_size() const { return max_url_segment_size_.value(); } 01104 void set_max_url_segment_size(int x) { 01105 set_option(x, &max_url_segment_size_); 01106 } 01107 01108 int image_max_rewrites_at_once() const { 01109 return image_max_rewrites_at_once_.value(); 01110 } 01111 void set_image_max_rewrites_at_once(int x) { 01112 set_option(x, &image_max_rewrites_at_once_); 01113 } 01114 01116 int max_url_size() const { return max_url_size_.value(); } 01117 void set_max_url_size(int x) { 01118 set_option(x, &max_url_size_); 01119 } 01120 01121 int rewrite_deadline_ms() const { return rewrite_deadline_ms_.value(); } 01122 void set_rewrite_deadline_ms(int x) { 01123 set_option(x, &rewrite_deadline_ms_); 01124 } 01125 01126 int domain_shard_count() const { return domain_shard_count_.value(); } 01129 void set_domain_shard_count(int64 x) { 01130 int value = x; 01131 set_option(value, &domain_shard_count_); 01132 } 01133 01134 void set_enabled(bool x) { 01135 set_option(x, &enabled_); 01136 } 01137 bool enabled() const { return enabled_.value(); } 01138 01139 void set_ajax_rewriting_enabled(bool x) { 01140 set_option(x, &ajax_rewriting_enabled_); 01141 } 01142 01143 bool ajax_rewriting_enabled() const { 01144 return ajax_rewriting_enabled_.value(); 01145 } 01146 01147 void set_in_place_wait_for_optimized(bool x) { 01148 set_option(x, &in_place_wait_for_optimized_); 01149 } 01150 01151 bool in_place_wait_for_optimized() const { 01152 return in_place_wait_for_optimized_.value(); 01153 } 01154 01155 void set_combine_across_paths(bool x) { 01156 set_option(x, &combine_across_paths_); 01157 } 01158 bool combine_across_paths() const { return combine_across_paths_.value(); } 01159 01160 void set_log_rewrite_timing(bool x) { 01161 set_option(x, &log_rewrite_timing_); 01162 } 01163 bool log_rewrite_timing() const { return log_rewrite_timing_.value(); } 01164 01165 void set_lowercase_html_names(bool x) { 01166 set_option(x, &lowercase_html_names_); 01167 } 01168 bool lowercase_html_names() const { return lowercase_html_names_.value(); } 01169 01170 void set_always_rewrite_css(bool x) { 01171 set_option(x, &always_rewrite_css_); 01172 } 01173 bool always_rewrite_css() const { return always_rewrite_css_.value(); } 01174 01175 void set_respect_vary(bool x) { 01176 set_option(x, &respect_vary_); 01177 } 01178 bool respect_vary() const { return respect_vary_.value(); } 01179 01180 void set_respect_x_forwarded_proto(bool x) { 01181 set_option(x, &respect_x_forwarded_proto_); 01182 } 01183 bool respect_x_forwarded_proto() const { 01184 return respect_x_forwarded_proto_.value(); 01185 } 01186 01187 void set_flush_html(bool x) { set_option(x, &flush_html_); } 01188 bool flush_html() const { return flush_html_.value(); } 01189 01190 void set_serve_stale_if_fetch_error(bool x) { 01191 set_option(x, &serve_stale_if_fetch_error_); 01192 } 01193 bool serve_stale_if_fetch_error() const { 01194 return serve_stale_if_fetch_error_.value(); 01195 } 01196 01197 void set_enable_blink_critical_line(bool x) { 01198 set_option(x, &enable_blink_critical_line_); 01199 } 01200 bool enable_blink_critical_line() const { 01201 return enable_blink_critical_line_.value(); 01202 } 01203 01204 void set_default_cache_html(bool x) { set_option(x, &default_cache_html_); } 01205 bool default_cache_html() const { return default_cache_html_.value(); } 01206 01207 void set_modify_caching_headers(bool x) { 01208 set_option(x, &modify_caching_headers_); 01209 } 01210 bool modify_caching_headers() const { 01211 return modify_caching_headers_.value(); 01212 } 01213 01214 void set_inline_only_critical_images(bool x) { 01215 set_option(x, &inline_only_critical_images_); 01216 } 01217 bool inline_only_critical_images() const { 01218 return inline_only_critical_images_.value(); 01219 } 01220 01221 void set_lazyload_images_after_onload(bool x) { 01222 set_option(x, &lazyload_images_after_onload_); 01223 } 01224 bool lazyload_images_after_onload() const { 01225 return lazyload_images_after_onload_.value(); 01226 } 01227 01228 void set_lazyload_images_blank_url(const StringPiece& p) { 01229 set_option(GoogleString(p.data(), p.size()), &lazyload_images_blank_url_); 01230 } 01231 const GoogleString& lazyload_images_blank_url() const { 01232 return lazyload_images_blank_url_.value(); 01233 } 01234 01235 void set_max_inlined_preview_images_index(int x) { 01236 set_option(x, &max_inlined_preview_images_index_); 01237 } 01238 int max_inlined_preview_images_index() const { 01239 return max_inlined_preview_images_index_.value(); 01240 } 01241 01242 void set_min_image_size_low_resolution_bytes(int64 x) { 01243 set_option(x, &min_image_size_low_resolution_bytes_); 01244 } 01245 int64 min_image_size_low_resolution_bytes() const { 01246 return min_image_size_low_resolution_bytes_.value(); 01247 } 01248 01249 void set_max_image_size_low_resolution_bytes(int64 x) { 01250 set_option(x, &max_image_size_low_resolution_bytes_); 01251 } 01252 int64 max_image_size_low_resolution_bytes() const { 01253 return max_image_size_low_resolution_bytes_.value(); 01254 } 01255 01256 void set_furious_cookie_duration_ms(int64 x) { 01257 set_option(x, &furious_cookie_duration_ms_); 01258 } 01259 int64 furious_cookie_duration_ms() const { 01260 return furious_cookie_duration_ms_.value(); 01261 } 01262 01263 void set_finder_properties_cache_expiration_time_ms(int64 x) { 01264 set_option(x, &finder_properties_cache_expiration_time_ms_); 01265 } 01266 int64 finder_properties_cache_expiration_time_ms() const { 01267 return finder_properties_cache_expiration_time_ms_.value(); 01268 } 01269 01270 bool css_preserve_urls() const { 01271 return css_preserve_urls_.value(); 01272 } 01273 void set_css_preserve_urls(bool x) { 01274 set_option(x, &css_preserve_urls_); 01275 } 01276 01277 bool image_preserve_urls() const { 01278 return image_preserve_urls_.value(); 01279 } 01280 void set_image_preserve_urls(bool x) { 01281 set_option(x, &image_preserve_urls_); 01282 } 01283 01284 bool js_preserve_urls() const { 01285 return js_preserve_urls_.value(); 01286 } 01287 void set_js_preserve_urls(bool x) { 01288 set_option(x, &js_preserve_urls_); 01289 } 01290 01291 bool image_retain_color_profile() const { 01292 return image_retain_color_profile_.value(); 01293 } 01294 void set_image_retain_color_profile(bool x) { 01295 set_option(x, &image_retain_color_profile_); 01296 } 01297 01298 bool image_retain_color_sampling() const { 01299 return image_retain_color_sampling_.value(); 01300 } 01301 void set_image_retain_color_sampling(bool x) { 01302 set_option(x, &image_retain_color_sampling_); 01303 } 01304 01305 bool image_retain_exif_data() const { 01306 return image_retain_exif_data_.value(); 01307 } 01308 void set_image_retain_exif_data(bool x) { 01309 set_option(x, &image_retain_exif_data_); 01310 } 01311 01312 void set_metadata_cache_staleness_threshold_ms(int64 x) { 01313 set_option(x, &metadata_cache_staleness_threshold_ms_); 01314 } 01315 int64 metadata_cache_staleness_threshold_ms() const { 01316 return metadata_cache_staleness_threshold_ms_.value(); 01317 } 01318 01319 void set_metadata_input_errors_cache_ttl_ms(int64 x) { 01320 set_option(x, &metadata_input_errors_cache_ttl_ms_); 01321 } 01322 int64 metadata_input_errors_cache_ttl_ms() const { 01323 return metadata_input_errors_cache_ttl_ms_.value(); 01324 } 01325 01326 const BeaconUrl& beacon_url() const { return beacon_url_.value(); } 01327 void set_beacon_url(const GoogleString& beacon_url) { 01328 beacon_url_.SetFromString(beacon_url); 01329 } 01330 01332 virtual bool trim_urls_in_css() const { return true; } 01333 01334 int64 image_jpeg_recompress_quality() const { 01335 return image_jpeg_recompress_quality_.value(); 01336 } 01337 void set_image_jpeg_recompress_quality(int64 x) { 01338 set_option(x, &image_jpeg_recompress_quality_); 01339 } 01340 01341 int64 image_recompress_quality() const { 01342 return image_recompress_quality_.value(); 01343 } 01344 void set_image_recompress_quality(int64 x) { 01345 set_option(x, &image_recompress_quality_); 01346 } 01347 01348 int image_limit_optimized_percent() const { 01349 return image_limit_optimized_percent_.value(); 01350 } 01351 void set_image_limit_optimized_percent(int x) { 01352 set_option(x, &image_limit_optimized_percent_); 01353 } 01354 int image_limit_resize_area_percent() const { 01355 return image_limit_resize_area_percent_.value(); 01356 } 01357 void set_image_limit_resize_area_percent(int x) { 01358 set_option(x, &image_limit_resize_area_percent_); 01359 } 01360 01361 int image_jpeg_num_progressive_scans() const { 01362 return image_jpeg_num_progressive_scans_.value(); 01363 } 01364 void set_image_jpeg_num_progressive_scans(int x) { 01365 set_option(x, &image_jpeg_num_progressive_scans_); 01366 } 01367 01368 int64 image_webp_recompress_quality() const { 01369 return image_webp_recompress_quality_.value(); 01370 } 01371 void set_image_webp_recompress_quality(int64 x) { 01372 set_option(x, &image_webp_recompress_quality_); 01373 } 01374 01375 bool domain_rewrite_hyperlinks() const { 01376 return domain_rewrite_hyperlinks_.value(); 01377 } 01378 void set_domain_rewrite_hyperlinks(bool x) { 01379 set_option(x, &domain_rewrite_hyperlinks_); 01380 } 01381 01382 bool client_domain_rewrite() const { 01383 return client_domain_rewrite_.value(); 01384 } 01385 void set_client_domain_rewrite(bool x) { 01386 set_option(x, &client_domain_rewrite_); 01387 } 01388 01389 void set_flush_more_resources_early_if_time_permits(bool x) { 01390 set_option(x, &flush_more_resources_early_if_time_permits_); 01391 } 01392 bool flush_more_resources_early_if_time_permits() const { 01393 return flush_more_resources_early_if_time_permits_.value(); 01394 } 01395 01396 void set_flush_more_resources_in_ie_and_firefox(bool x) { 01397 set_option(x, &flush_more_resources_in_ie_and_firefox_); 01398 } 01399 bool flush_more_resources_in_ie_and_firefox() const { 01400 return flush_more_resources_in_ie_and_firefox_.value(); 01401 } 01402 01403 void set_enable_defer_js_experimental(bool x) { 01404 set_option(x, &enable_defer_js_experimental_); 01405 } 01406 bool enable_defer_js_experimental() const { 01407 return enable_defer_js_experimental_.value(); 01408 } 01409 01410 void set_enable_flush_subresources_experimental(bool x) { 01411 set_option(x, &enable_flush_subresources_experimental_); 01412 } 01413 bool enable_flush_subresources_experimental() const { 01414 return enable_flush_subresources_experimental_.value(); 01415 } 01416 01417 void set_enable_inline_preview_images_experimental(bool x) { 01418 set_option(x, &enable_inline_preview_images_experimental_); 01419 } 01420 bool enable_inline_preview_images_experimental() const { 01421 return enable_inline_preview_images_experimental_.value(); 01422 } 01423 01424 void set_enable_blink_debug_dashboard(bool x) { 01425 set_option(x, &enable_blink_debug_dashboard_); 01426 } 01427 bool enable_blink_debug_dashboard() const { 01428 return enable_blink_debug_dashboard_.value(); 01429 } 01430 01431 void set_enable_blink_html_change_detection(bool x) { 01432 set_option(x, &enable_blink_html_change_detection_); 01433 } 01434 bool enable_blink_html_change_detection() const { 01435 return enable_blink_html_change_detection_.value(); 01436 } 01437 01438 void set_enable_blink_html_change_detection_logging(bool x) { 01439 set_option(x, &enable_blink_html_change_detection_logging_); 01440 } 01441 bool enable_blink_html_change_detection_logging() const { 01442 return enable_blink_html_change_detection_logging_.value(); 01443 } 01444 01445 void set_use_smart_diff_in_blink(bool x) { 01446 set_option(x, &use_smart_diff_in_blink_); 01447 } 01448 bool use_smart_diff_in_blink() const { 01449 return use_smart_diff_in_blink_.value(); 01450 } 01451 01452 void set_propagate_blink_cache_deletes(bool x) { 01453 set_option(x, &propagate_blink_cache_deletes_); 01454 } 01455 bool propagate_blink_cache_deletes() const { 01456 return propagate_blink_cache_deletes_.value(); 01457 } 01458 01459 void set_enable_lazyload_in_blink(bool x) { 01460 set_option(x, &enable_lazyload_in_blink_); 01461 } 01462 bool enable_lazyload_in_blink() const { 01463 return enable_lazyload_in_blink_.value(); 01464 } 01465 01466 void set_blink_html_change_detection_time_ms(int64 x) { 01467 set_option(x, &blink_html_change_detection_time_ms_); 01468 } 01469 int64 blink_html_change_detection_time_ms() const { 01470 return blink_html_change_detection_time_ms_.value(); 01471 } 01472 01473 void set_override_blink_cache_time_ms(int64 x) { 01474 set_option(x, &override_blink_cache_time_ms_); 01475 } 01476 int64 override_blink_cache_time_ms() const { 01477 return override_blink_cache_time_ms_.value(); 01478 } 01479 01480 void set_blink_non_cacheables_for_all_families(const StringPiece& p) { 01481 set_option(GoogleString(p.data(), p.size()), 01482 &blink_non_cacheables_for_all_families_); 01483 } 01484 const GoogleString& blink_non_cacheables_for_all_families() const { 01485 return blink_non_cacheables_for_all_families_.value(); 01486 } 01487 01488 const GoogleString& blocking_rewrite_key() const { 01489 return blocking_rewrite_key_.value(); 01490 } 01491 void set_blocking_rewrite_key(const StringPiece& p) { 01492 set_option(GoogleString(p.data(), p.size()), &blocking_rewrite_key_); 01493 } 01494 01497 bool IsInBlinkCacheableFamily(const GoogleUrl& gurl) const; 01498 01503 int64 GetBlinkCacheTimeFor(const GoogleUrl& gurl) const; 01504 01509 GoogleString GetBlinkNonCacheableElementsFor(const GoogleUrl& gurl) const; 01510 01512 void AddBlinkCacheableFamily(const StringPiece url_pattern, 01513 int64 cache_time_ms, 01514 const StringPiece non_cacheable_elements); 01515 01516 void set_running_furious_experiment(bool x) { 01517 set_option(x, &running_furious_); 01518 } 01519 bool running_furious() const { 01520 return running_furious_.value(); 01521 } 01522 01524 void set_furious_ga_slot(int x) { 01525 set_option(x, &furious_ga_slot_); 01526 } 01527 01528 int furious_ga_slot() const { return furious_ga_slot_.value(); } 01529 01530 void set_report_unload_time(bool x) { 01531 set_option(x, &report_unload_time_); 01532 } 01533 bool report_unload_time() const { 01534 return report_unload_time_.value(); 01535 } 01536 01537 void set_implicit_cache_ttl_ms(int64 x) { 01538 set_option(x, &implicit_cache_ttl_ms_); 01539 } 01540 int64 implicit_cache_ttl_ms() const { 01541 return implicit_cache_ttl_ms_.value(); 01542 } 01543 01544 void set_x_header_value(const StringPiece& p) { 01545 set_option(p.as_string(), &x_header_value_); 01546 } 01547 const GoogleString& x_header_value() const { 01548 return x_header_value_.value(); 01549 } 01550 01551 void set_avoid_renaming_introspective_javascript(bool x) { 01552 set_option(x, &avoid_renaming_introspective_javascript_); 01553 } 01554 bool avoid_renaming_introspective_javascript() const { 01555 return avoid_renaming_introspective_javascript_.value(); 01556 } 01557 01558 void set_use_fixed_user_agent_for_blink_cache_misses(bool x) { 01559 set_option(x, &use_fixed_user_agent_for_blink_cache_misses_); 01560 } 01561 bool use_fixed_user_agent_for_blink_cache_misses() const { 01562 return use_fixed_user_agent_for_blink_cache_misses_.value(); 01563 } 01564 01565 void set_blink_desktop_user_agent(const StringPiece& p) { 01566 set_option(GoogleString(p.data(), p.size()), &blink_desktop_user_agent_); 01567 } 01568 const GoogleString& blink_desktop_user_agent() const { 01569 return blink_desktop_user_agent_.value(); 01570 } 01571 01572 void set_passthrough_blink_for_last_invalid_response_code(bool x) { 01573 set_option(x, &passthrough_blink_for_last_invalid_response_code_); 01574 } 01575 bool passthrough_blink_for_last_invalid_response_code() const { 01576 return passthrough_blink_for_last_invalid_response_code_.value(); 01577 } 01578 01579 int64 blink_max_html_size_rewritable() const { 01580 return blink_max_html_size_rewritable_.value(); 01581 } 01582 void set_blink_max_html_size_rewritable(int64 x) { 01583 set_option(x, &blink_max_html_size_rewritable_); 01584 } 01585 01586 void set_apply_blink_if_no_families(bool x) { 01587 set_option(x, &apply_blink_if_no_families_); 01588 } 01589 bool apply_blink_if_no_families() const { 01590 return apply_blink_if_no_families_.value(); 01591 } 01592 01593 void set_critical_line_config(const StringPiece& p) { 01594 set_option(GoogleString(p.data(), p.size()), &critical_line_config_); 01595 } 01596 const GoogleString& critical_line_config() const { 01597 return critical_line_config_.value(); 01598 } 01599 01600 void set_forbid_all_disabled_filters(bool x) { 01601 set_option(x, &forbid_all_disabled_filters_); 01602 } 01603 bool forbid_all_disabled_filters() const { 01604 return forbid_all_disabled_filters_.value(); 01605 } 01606 01607 bool reject_blacklisted() const { return reject_blacklisted_.value(); } 01608 void set_reject_blacklisted(bool x) { 01609 set_option(x, &reject_blacklisted_); 01610 } 01611 01612 HttpStatus::Code reject_blacklisted_status_code() const { 01613 return static_cast<HttpStatus::Code>( 01614 reject_blacklisted_status_code_.value()); 01615 } 01616 void set_reject_blacklisted_status_code(HttpStatus::Code x) { 01617 set_option(static_cast<int>(x), &reject_blacklisted_status_code_); 01618 } 01619 01620 bool support_noscript_enabled() const { 01621 return support_noscript_enabled_.value(); 01622 } 01623 void set_support_noscript_enabled(bool x) { 01624 set_option(x, &support_noscript_enabled_); 01625 } 01626 01627 void set_max_combined_js_bytes(int64 x) { 01628 set_option(x, &max_combined_js_bytes_); 01629 } 01630 int64 max_combined_js_bytes() const { 01631 return max_combined_js_bytes_.value(); 01632 } 01633 01634 void set_pre_connect_url(const StringPiece& p) { 01635 set_option(GoogleString(p.data(), p.size()), &pre_connect_url_); 01636 } 01637 const GoogleString& pre_connect_url() const { 01638 return pre_connect_url_.value(); 01639 } 01640 void set_property_cache_http_status_stability_threshold(int x) { 01641 set_option(x, &property_cache_http_status_stability_threshold_); 01642 } 01643 int property_cache_http_status_stability_threshold() const { 01644 return property_cache_http_status_stability_threshold_.value(); 01645 } 01646 01647 void set_enable_aggressive_rewriters_for_mobile(bool x) { 01648 set_option(x, &enable_aggressive_rewriters_for_mobile_); 01649 } 01650 bool enable_aggressive_rewriters_for_mobile() const { 01651 return enable_aggressive_rewriters_for_mobile_.value(); 01652 } 01653 01669 virtual void Merge(const RewriteOptions& src); 01670 01673 void Allow(const StringPiece& wildcard_pattern) { 01674 Modify(); 01675 allow_resources_.Allow(wildcard_pattern); 01676 } 01677 01680 void Disallow(const StringPiece& wildcard_pattern) { 01681 Modify(); 01682 allow_resources_.Disallow(wildcard_pattern); 01683 } 01684 01688 virtual void DisallowTroublesomeResources(); 01689 01690 DomainLawyer* domain_lawyer() { return &domain_lawyer_; } 01691 const DomainLawyer* domain_lawyer() const { return &domain_lawyer_; } 01692 01693 FileLoadPolicy* file_load_policy() { return &file_load_policy_; } 01694 const FileLoadPolicy* file_load_policy() const { return &file_load_policy_; } 01695 01698 bool IsAllowed(const StringPiece& url) const { 01699 return allow_resources_.Match(url, true); 01700 } 01701 01703 void RetainComment(const StringPiece& comment) { 01704 Modify(); 01705 retain_comments_.Allow(comment); 01706 } 01707 01711 bool IsRetainedComment(const StringPiece& comment) const { 01712 return retain_comments_.Match(comment, false); 01713 } 01714 01715 void set_override_caching_ttl_ms(int64 x) { 01716 set_option(x, &override_caching_ttl_ms_); 01717 } 01718 int64 override_caching_ttl_ms() const { 01719 return override_caching_ttl_ms_.value(); 01720 } 01721 01724 void AddOverrideCacheTtl(const StringPiece& wildcard) { 01725 Modify(); 01726 override_caching_wildcard_.Allow(wildcard); 01727 } 01728 01730 bool IsCacheTtlOverridden(const StringPiece& url) const { 01731 return override_caching_wildcard_.Match(url, false); 01732 } 01733 01734 void AddRejectedUrlWildcard(const GoogleString& wildcard) { 01735 AddRejectedHeaderWildcard(kRejectedRequestUrlKeyName, wildcard); 01736 } 01737 01738 void AddRejectedHeaderWildcard(const StringPiece& header_name, 01739 const GoogleString& wildcard) { 01740 Modify(); 01741 std::pair<FastWildcardGroupMap::iterator, bool> insert_result = 01742 rejected_request_map_.insert(std::make_pair( 01743 header_name, static_cast<FastWildcardGroup*>(NULL))); 01744 01745 if (insert_result.second) { 01746 insert_result.first->second = new FastWildcardGroup; 01747 } 01748 insert_result.first->second->Allow(wildcard); 01749 } 01750 01751 bool IsRejectedUrl(const GoogleString& url) const { 01752 return IsRejectedRequest(kRejectedRequestUrlKeyName, url); 01753 } 01754 01755 bool IsRejectedRequest(const StringPiece& header_name, 01756 const StringPiece& value) const { 01757 FastWildcardGroupMap::const_iterator it = rejected_request_map_.find( 01758 header_name); 01759 if (it != rejected_request_map_.end()) { 01760 return it->second->Match(value, false); 01761 } 01762 return false; 01763 } 01767 virtual RewriteOptions* Clone() const; 01768 01774 void ComputeSignature(const Hasher* hasher); 01775 01782 void ClearSignatureWithCaution() { 01783 frozen_ = false; 01784 signature_.clear(); 01785 } 01786 01789 void ClearSignatureForTesting() { 01790 ClearSignatureWithCaution(); 01791 } 01792 01794 const GoogleString& signature() const { 01802 ThreadSystem::ScopedReader lock(cache_invalidation_timestamp_.mutex()); 01803 DCHECK(frozen_); 01804 return signature_; 01805 } 01806 01807 virtual GoogleString OptionsToString() const; 01808 01811 virtual GoogleString ToExperimentString() const; 01812 01816 virtual GoogleString ToExperimentDebugString() const; 01817 01819 virtual const char* class_name() const; 01820 01822 virtual bool NeedLowResImages() const { 01823 return Enabled(kDelayImages); 01824 } 01825 01828 static Filter LookupFilterById(const StringPiece& filter_id); 01829 01831 static const char* LookupOptionEnum(OptionEnum option_enum) { 01832 return (option_enum < kEndOfOptions) ? 01833 option_enum_to_name_array_[option_enum] : NULL; 01834 } 01835 01836 static OptionEnum LookupOption(const StringPiece& option_name); 01837 01840 const OptionBaseVector& all_options() const { 01841 return all_options_; 01842 } 01843 01845 struct FilterEnumToIdAndNameEntry { 01846 RewriteOptions::Filter filter_enum; 01847 const char* filter_id; 01848 const char* filter_name; 01849 }; 01850 01851 protected: 01855 template<class ValueType> 01856 class Property : public PropertyBase { 01857 public: 01862 Property(ValueType default_value, 01863 const char* id, 01864 OptionEnum option_enum) 01865 : PropertyBase(id, option_enum), 01866 default_value_(default_value) { 01867 } 01868 01869 void set_default(ValueType value) { default_value_ = value; } 01870 const ValueType& default_value() const { return default_value_; } 01871 01872 private: 01873 ValueType default_value_; 01874 01875 DISALLOW_COPY_AND_ASSIGN(Property); 01876 }; 01877 01892 template<class RewriteOptionsSubclass, class OptionClass> 01893 class PropertyLeaf : public Property<typename OptionClass::ValueType> { 01894 public: 01898 typedef OptionClass RewriteOptionsSubclass::*OptionOffset; 01899 typedef typename OptionClass::ValueType ValueType; 01900 01901 PropertyLeaf(ValueType default_value, 01902 OptionOffset offset, 01903 const char* id, 01904 OptionEnum option_enum) 01905 : Property<ValueType>(default_value, id, option_enum), 01906 offset_(offset) { 01907 } 01908 01909 virtual void InitializeOption(RewriteOptions* options) const { 01910 RewriteOptionsSubclass* options_subclass = 01911 static_cast<RewriteOptionsSubclass*>(options); 01912 OptionClass& option = options_subclass->*offset_; 01913 option.set_property(this); 01914 DCHECK_NE(-1, this->index()) << "Call Property::set_index first."; 01915 options->set_option_at(this->index(), &option); 01916 } 01917 01918 private: 01919 OptionOffset offset_; 01920 01921 DISALLOW_COPY_AND_ASSIGN(PropertyLeaf); 01922 }; 01923 01933 template<class T> class OptionTemplateBase : public OptionBase { 01934 public: 01935 typedef T ValueType; 01936 01937 OptionTemplateBase() : was_set_(false), property_(NULL) {} 01938 01939 virtual bool was_set() const { return was_set_; } 01940 01941 void set(const T& val) { 01942 was_set_ = true; 01943 value_ = val; 01944 } 01945 01946 void set_default(const T& val) { 01947 if (!was_set_) { 01948 value_ = val; 01949 } 01950 } 01951 01952 const T& value() const { return value_; } 01953 01959 virtual void Merge(const OptionBase* src) { 01960 DCHECK(option_enum() == src->option_enum()); 01961 MergeHelper(static_cast<const OptionTemplateBase*>(src)); 01962 } 01963 01964 void MergeHelper(const OptionTemplateBase* src) { 01967 if (src->was_set_ || !was_set_) { 01968 value_ = src->value_; 01969 was_set_ = src->was_set_; 01970 } 01971 } 01972 01974 void set_property(const Property<T>* property) { 01975 property_ = property; 01976 01981 value_ = property->default_value(); 01982 } 01983 virtual const Property<T>* property() const { return property_; } 01984 01993 void set_global_default(const T& val) { 01994 Property<T>* property = const_cast<Property<T>*>(property_); 01995 property->set_default(val); 01996 } 01997 02006 void DoNotUseForSignatureComputation() { 02007 Property<T>* property = const_cast<Property<T>*>(property_); 02008 property->set_do_not_use_for_signature_computation(true); 02009 } 02010 02011 private: 02012 bool was_set_; 02013 T value_; 02014 const Property<T>* property_; 02015 02016 DISALLOW_COPY_AND_ASSIGN(OptionTemplateBase); 02017 }; 02018 02023 template<class T> class Option : public OptionTemplateBase<T> { 02024 public: 02025 Option() {} 02026 02028 virtual bool SetFromString(const GoogleString& value_string) { 02029 T value; 02030 bool success = RewriteOptions::ParseFromString(value_string, &value); 02031 if (success) { 02032 this->set(value); 02033 } 02034 return success; 02035 } 02036 02037 virtual GoogleString Signature(const Hasher* hasher) const { 02038 return RewriteOptions::OptionSignature(this->value(), hasher); 02039 } 02040 02041 virtual GoogleString ToString() const { 02042 return RewriteOptions::ToString(this->value()); 02043 } 02044 02045 private: 02046 DISALLOW_COPY_AND_ASSIGN(Option); 02047 }; 02048 02061 class MutexedOptionInt64MergeWithMax : public Option<int64> { 02062 public: 02063 MutexedOptionInt64MergeWithMax(); 02064 virtual ~MutexedOptionInt64MergeWithMax(); 02065 02070 virtual void Merge(const OptionBase* src_base); 02071 02082 void checked_set(const int64& value) { 02083 mutex_->DCheckLocked(); 02084 Option<int64>::set(value); 02085 } 02086 02100 ThreadSystem::RWLock* mutex() const { return mutex_.get(); } 02101 02107 void set_mutex(ThreadSystem::RWLock* lock) { mutex_.reset(lock); } 02108 02109 private: 02110 scoped_ptr<ThreadSystem::RWLock> mutex_; 02111 }; 02112 02113 protected: 02115 template<class RewriteOptionsSubclass, class OptionClass> 02116 static void AddProperty(typename OptionClass::ValueType default_value, 02117 OptionClass RewriteOptionsSubclass::*offset, 02118 const char* id, 02119 OptionEnum option_enum, 02120 Properties* properties) { 02121 properties->push_back(new PropertyLeaf<RewriteOptionsSubclass, OptionClass>( 02122 default_value, offset, id, option_enum)); 02123 } 02124 02125 02139 static void MergeSubclassProperties(Properties* properties); 02140 02146 void set_option_at(int index, OptionBase* option) { 02147 all_options_[index] = option; 02148 } 02149 02153 template<class T> 02154 void set_option(const T& new_value, OptionTemplateBase<T>* option) { 02155 option->set(new_value); 02156 Modify(); 02157 } 02158 02160 void Modify(); 02161 02162 protected: 02170 void set_default_x_header_value(const StringPiece& x_header_value) { 02171 x_header_value_.set_global_default(x_header_value.as_string()); 02172 } 02173 02176 bool SetupFuriousRewriters(); 02177 02179 virtual void SetRequiredFuriousFilters(); 02180 02184 bool InsertFuriousSpecInVector(FuriousSpec* spec); 02185 02187 Option<BeaconUrl> beacon_url_; 02188 02190 Option<GoogleString> x_header_value_; 02191 02192 private: 02193 static Properties* properties_; 02194 static Properties* all_properties_; 02195 02196 FRIEND_TEST(RewriteOptionsTest, FuriousMergeTest); 02197 typedef std::vector<Filter> FilterVector; 02198 02205 struct PrioritizeVisibleContentFamily { 02206 PrioritizeVisibleContentFamily(StringPiece url_pattern_string, 02207 int64 cache_time_ms_in, 02208 StringPiece non_cacheable_elements_in) 02209 : url_pattern(url_pattern_string), 02210 cache_time_ms(cache_time_ms_in), 02211 non_cacheable_elements(non_cacheable_elements_in.data(), 02212 non_cacheable_elements_in.size()) {} 02213 02214 PrioritizeVisibleContentFamily* Clone() const { 02215 return new PrioritizeVisibleContentFamily( 02216 url_pattern.spec(), cache_time_ms, non_cacheable_elements); 02217 } 02218 02219 GoogleString ComputeSignature() const { 02220 return StrCat(url_pattern.spec(), ";", Integer64ToString(cache_time_ms), 02221 ";", non_cacheable_elements); 02222 } 02223 02224 GoogleString ToString() const { 02225 return StrCat("URL pattern: ", url_pattern.spec(), ", Cache time (ms): ", 02226 Integer64ToString(cache_time_ms), ", Non-cacheable: ", 02227 non_cacheable_elements); 02228 } 02229 02230 Wildcard url_pattern; 02231 int64 cache_time_ms; 02232 GoogleString non_cacheable_elements; 02233 }; 02234 02237 struct UrlCacheInvalidationEntry { 02238 UrlCacheInvalidationEntry(StringPiece url_pattern_in, 02239 int64 timestamp_ms_in, 02240 bool is_strict_in) 02241 : url_pattern(url_pattern_in), 02242 timestamp_ms(timestamp_ms_in), 02243 is_strict(is_strict_in) {} 02244 02245 UrlCacheInvalidationEntry* Clone() const { 02246 return new UrlCacheInvalidationEntry( 02247 url_pattern.spec(), timestamp_ms, is_strict); 02248 } 02249 02250 GoogleString ComputeSignature() const { 02251 if (is_strict) { 02252 return ""; 02253 } 02254 return StrCat(url_pattern.spec(), "@", Integer64ToString(timestamp_ms)); 02255 } 02256 02257 GoogleString ToString() const { 02258 return StrCat( 02259 url_pattern.spec(), ", ", (is_strict ? "STRICT" : "REFERENCE"), " @ ", 02260 Integer64ToString(timestamp_ms)); 02261 } 02262 02263 Wildcard url_pattern; 02264 int64 timestamp_ms; 02265 bool is_strict; 02266 }; 02267 02268 typedef std::vector<UrlCacheInvalidationEntry*> 02269 UrlCacheInvalidationEntryVector; 02270 02286 template<class OptionClass, class RewriteOptionsSubclass> 02287 static void add_option(typename OptionClass::ValueType default_value, 02288 OptionClass RewriteOptionsSubclass::*offset, 02289 const char* id) { 02290 AddProperty(default_value, offset, id, kEndOfOptions, properties_); 02291 } 02292 02295 template<class RewriteOptionsSubclass, class OptionClass> 02296 static void add_option(typename OptionClass::ValueType default_value, 02297 OptionClass RewriteOptionsSubclass::*offset, 02298 const char* id, 02299 OptionEnum option_enum) { 02300 AddProperty(default_value, offset, id, option_enum, properties_); 02301 } 02302 02303 static void AddProperties(); 02304 bool AddCommaSeparatedListToFilterSetState( 02305 const StringPiece& filters, FilterSet* set, MessageHandler* handler); 02306 static bool AddCommaSeparatedListToFilterSet( 02307 const StringPiece& filters, FilterSet* set, MessageHandler* handler); 02308 static Filter LookupFilter(const StringPiece& filter_name); 02311 static void InitOptionEnumToNameArray(); 02313 static void InitFilterIdToEnumArray(); 02316 const PrioritizeVisibleContentFamily* FindPrioritizeVisibleContentFamily( 02317 const StringPiece str) const; 02318 02321 static bool ParseFromString(const GoogleString& value_string, bool* value) { 02324 if (StringCaseEqual(value_string, "true") || 02325 StringCaseEqual(value_string, "on")) { 02326 *value = true; 02327 } else if (StringCaseEqual(value_string, "false") || 02328 StringCaseEqual(value_string, "off")) { 02329 *value = false; 02330 } else { 02333 return false; 02334 } 02335 return true; 02336 } 02337 static bool ParseFromString(const GoogleString& value_string, int* value) { 02338 return StringToInt(value_string, value); 02339 } 02340 static bool ParseFromString(const GoogleString& value_string, int64* value) { 02341 return StringToInt64(value_string, value); 02342 } 02343 static bool ParseFromString(const GoogleString& value_string, 02344 GoogleString* value) { 02345 *value = value_string; 02346 return true; 02347 } 02348 static bool ParseFromString(const GoogleString& value_string, 02349 RewriteLevel* value) { 02350 return ParseRewriteLevel(value_string, value); 02351 } 02352 static bool ParseFromString(const GoogleString& value_string, 02353 BeaconUrl* value) { 02354 return ParseBeaconUrl(value_string, value); 02355 } 02356 02359 static GoogleString OptionSignature(bool x, const Hasher* hasher) { 02360 return x ? "T" : "F"; 02361 } 02362 static GoogleString OptionSignature(int x, const Hasher* hasher) { 02363 return IntegerToString(x); 02364 } 02365 static GoogleString OptionSignature(int64 x, const Hasher* hasher) { 02366 return Integer64ToString(x); 02367 } 02368 static GoogleString OptionSignature(const GoogleString& x, 02369 const Hasher* hasher); 02370 static GoogleString OptionSignature(RewriteLevel x, 02371 const Hasher* hasher); 02372 static GoogleString OptionSignature(const BeaconUrl& beacon_url, 02373 const Hasher* hasher); 02374 02377 static GoogleString ToString(bool x) { 02378 return x ? "True" : "False"; 02379 } 02380 static GoogleString ToString(int x) { 02381 return IntegerToString(x); 02382 } 02383 static GoogleString ToString(int64 x) { 02384 return Integer64ToString(x); 02385 } 02386 static GoogleString ToString(const GoogleString& x) { 02387 return x; 02388 } 02389 static GoogleString ToString(RewriteLevel x); 02390 static GoogleString ToString(const BeaconUrl& beacon_url); 02391 02394 static bool PropertyLessThanByEnum(PropertyBase* p1, PropertyBase* p2) { 02395 return p1->option_enum() < p2->option_enum(); 02396 } 02397 02399 static bool OptionEnumLessThanArg(OptionBase* option, OptionEnum arg) { 02400 return option->option_enum() < arg; 02401 } 02402 02404 static bool CompareUrlCacheInvalidationEntry(UrlCacheInvalidationEntry* e1, 02405 UrlCacheInvalidationEntry* e2) { 02406 return e1->timestamp_ms < e2->timestamp_ms; 02407 } 02408 02410 static bool FilterEnumToIdAndNameEntryLessThanById( 02411 const FilterEnumToIdAndNameEntry* e1, 02412 const FilterEnumToIdAndNameEntry* e2) { 02413 return strcmp(e1->filter_id, e2->filter_id) < 0; 02414 } 02415 02416 bool modified_; 02417 bool frozen_; 02418 FilterSet enabled_filters_; 02419 FilterSet disabled_filters_; 02420 FilterSet forbidden_filters_; 02421 02427 Option<RewriteLevel> level_; 02428 02431 UrlCacheInvalidationEntryVector url_cache_invalidation_entries_; 02432 02433 MutexedOptionInt64MergeWithMax cache_invalidation_timestamp_; 02434 Option<int64> css_flatten_max_bytes_; 02435 Option<bool> cache_small_images_unrewritten_; 02437 Option<int64> image_resolution_limit_bytes_; 02438 Option<int64> css_image_inline_max_bytes_; 02439 Option<int64> css_inline_max_bytes_; 02440 Option<int64> css_outline_min_bytes_; 02441 02443 Option<bool> css_preserve_urls_; 02444 Option<bool> js_preserve_urls_; 02445 Option<bool> image_preserve_urls_; 02446 02447 Option<int64> image_inline_max_bytes_; 02448 Option<int64> js_inline_max_bytes_; 02449 Option<int64> js_outline_min_bytes_; 02450 Option<int64> progressive_jpeg_min_bytes_; 02452 Option<int64> max_html_cache_time_ms_; 02455 Option<int64> max_html_parse_bytes_; 02457 Option<int64> max_image_bytes_for_webp_in_css_; 02459 Option<int64> min_resource_cache_time_to_rewrite_ms_; 02460 Option<int64> idle_flush_time_ms_; 02461 Option<int64> flush_buffer_limit_bytes_; 02462 02466 Option<int64> blocking_fetch_timeout_ms_; 02467 02470 Option<int64> image_recompress_quality_; 02471 02473 Option<int64> image_jpeg_recompress_quality_; 02474 Option<int> image_jpeg_num_progressive_scans_; 02475 Option<bool> image_retain_color_profile_; 02476 Option<bool> image_retain_color_sampling_; 02477 Option<bool> image_retain_exif_data_; 02478 02480 Option<int> image_limit_optimized_percent_; 02481 Option<int> image_limit_resize_area_percent_; 02482 02484 Option<int64> image_webp_recompress_quality_; 02485 02486 Option<int> image_max_rewrites_at_once_; 02487 Option<int> max_url_segment_size_; 02488 Option<int> max_url_size_; 02489 02490 02491 Option<int> rewrite_deadline_ms_; 02493 Option<int> domain_shard_count_; 02494 02495 Option<bool> enabled_; 02496 Option<bool> ajax_rewriting_enabled_; 02497 02498 Option<bool> in_place_wait_for_optimized_; 02499 Option<bool> combine_across_paths_; 02500 Option<bool> log_rewrite_timing_; 02501 Option<bool> lowercase_html_names_; 02502 Option<bool> always_rewrite_css_; 02503 Option<bool> respect_vary_; 02504 Option<bool> respect_x_forwarded_proto_; 02505 Option<bool> flush_html_; 02508 Option<bool> serve_stale_if_fetch_error_; 02510 Option<bool> enable_blink_critical_line_; 02515 Option<bool> default_cache_html_; 02520 Option<bool> modify_caching_headers_; 02524 Option<bool> lazyload_images_after_onload_; 02527 Option<GoogleString> lazyload_images_blank_url_; 02531 Option<bool> inline_only_critical_images_; 02534 Option<bool> client_domain_rewrite_; 02537 Option<bool> domain_rewrite_hyperlinks_; 02538 02542 Option<bool> running_furious_; 02543 02544 Option<int> furious_ga_slot_; 02545 02548 Option<bool> increase_speed_tracking_; 02549 02553 Option<bool> report_unload_time_; 02554 02556 Option<bool> flush_more_resources_early_if_time_permits_; 02557 02559 Option<bool> flush_more_resources_in_ie_and_firefox_; 02560 02562 Option<bool> enable_defer_js_experimental_; 02563 02565 Option<bool> enable_flush_subresources_experimental_; 02566 02568 Option<bool> enable_inline_preview_images_experimental_; 02569 02572 Option<bool> avoid_renaming_introspective_javascript_; 02573 02575 Option<bool> override_ie_document_mode_; 02576 02582 Option<GoogleString> blocking_rewrite_key_; 02583 02586 Option<int> max_inlined_preview_images_index_; 02588 Option<int64> min_image_size_low_resolution_bytes_; 02590 Option<int64> max_image_size_low_resolution_bytes_; 02591 02593 Option<int64> finder_properties_cache_expiration_time_ms_; 02594 02597 Option<int64> furious_cookie_duration_ms_; 02598 02601 Option<int64> metadata_cache_staleness_threshold_ms_; 02602 02604 Option<int64> metadata_input_errors_cache_ttl_ms_; 02605 02609 Option<int64> implicit_cache_ttl_ms_; 02610 02612 Option<int64> max_cacheable_response_content_length_; 02613 02620 std::vector<PrioritizeVisibleContentFamily*> 02621 prioritize_visible_content_families_; 02622 02623 Option<GoogleString> ga_id_; 02624 02627 Option<bool> use_fixed_user_agent_for_blink_cache_misses_; 02630 Option<GoogleString> blink_desktop_user_agent_; 02633 Option<bool> passthrough_blink_for_last_invalid_response_code_; 02635 Option<int64> blink_max_html_size_rewritable_; 02638 Option<int64> blink_html_change_detection_time_ms_; 02642 Option<bool> apply_blink_if_no_families_; 02644 Option<bool> enable_blink_debug_dashboard_; 02646 Option<bool> enable_blink_html_change_detection_; 02648 Option<bool> enable_blink_html_change_detection_logging_; 02650 Option<bool> use_smart_diff_in_blink_; 02652 Option<bool> propagate_blink_cache_deletes_; 02654 Option<bool> enable_lazyload_in_blink_; 02656 Option<int64> override_blink_cache_time_ms_; 02659 Option<GoogleString> blink_non_cacheables_for_all_families_; 02661 Option<GoogleString> critical_line_config_; 02667 Option<bool> forbid_all_disabled_filters_; 02669 Option<bool> enable_aggressive_rewriters_for_mobile_; 02670 02676 Option<bool> reject_blacklisted_; 02677 Option<int> reject_blacklisted_status_code_; 02678 02682 Option<bool> support_noscript_enabled_; 02683 02686 Option<int64> max_combined_js_bytes_; 02687 02689 Option<GoogleString> pre_connect_url_; 02692 Option<int> property_cache_http_status_stability_threshold_; 02693 02698 Option<int64> override_caching_ttl_ms_; 02699 FastWildcardGroup override_caching_wildcard_; 02700 02704 OptionBaseVector all_options_; 02705 size_t initialized_options_; 02706 02708 static const char* option_enum_to_name_array_[kEndOfOptions]; 02709 02711 static const FilterEnumToIdAndNameEntry* filter_id_to_enum_array_[ 02712 kEndOfFilters]; 02713 02720 bool options_uniqueness_checked_; 02721 02723 bool need_to_store_experiment_data_; 02725 int furious_id_; 02726 int furious_percent_; 02727 std::vector<FuriousSpec*> furious_specs_; 02728 02730 std::vector<NameValue*> custom_fetch_headers_; 02731 02734 scoped_ptr<std::vector<ElementAttributeCategory> > url_valued_attributes_; 02735 02736 JavascriptLibraryIdentification javascript_library_identification_; 02737 02738 DomainLawyer domain_lawyer_; 02739 FileLoadPolicy file_load_policy_; 02740 02741 FastWildcardGroup allow_resources_; 02742 FastWildcardGroup retain_comments_; 02743 02746 typedef std::map<StringPiece, FastWildcardGroup*> FastWildcardGroupMap; 02747 FastWildcardGroupMap rejected_request_map_; 02748 02749 GoogleString signature_; 02750 02751 DISALLOW_COPY_AND_ASSIGN(RewriteOptions); 02752 }; 02753 02754 } 02755 02756 #endif ///< NET_INSTAWEB_REWRITER_PUBLIC_REWRITE_OPTIONS_H_