Page Speed Optimization Libraries
1.6.29.3
|
Unit-test framework for wget fetcher. More...
Namespaces | |
namespace | css_util |
Classes | |
class | ApacheConfig |
class | ApacheMessageHandler |
class | ApacheRequestContext |
class | ApacheRewriteDriverFactory |
Creates an Apache RewriteDriver. More... | |
class | ApacheServerContext |
class | ApacheThreadSystem |
class | ApacheWriter |
Writer object that writes to an Apache Request stream. More... | |
class | AprFileSystem |
class | AprTimer |
class | InPlaceResourceRecorder |
class | PropertyCallback |
Tracks a single property-cache lookup. More... | |
class | InstawebContext |
class | ModSpdyFetchController |
class | ModSpdyFetcher |
class | CacheHtmlFlow |
class | FlushEarlyFlow |
class | HtmlDetector |
class | ProxyFetchFactory |
class | ProxyFetchPropertyCallback |
class | ProxyFetchPropertyCallbackCollector |
Tracks a collection of property-cache lookups occuring in parallel. More... | |
class | ProxyFetch |
class | ProxyInterface |
class | ProxyUrlNamer |
class | MockFilter |
class | CreateFilterCallback |
class | BackgroundFetchCheckingAsyncFetch |
class | BackgroundFetchCheckingUrlAsyncFetcher |
class | ProxyInterfaceTestBase |
class | FileRewriter |
class | StaticRewriter |
class | FileDriver |
class | FileStatisticsLog |
Statistics logger that sends its output to a file. More... | |
class | LoggingFilter |
Counts some basic statistics observed as HTML is parsed. More... | |
class | StatisticsLog |
class | AsyncFetch |
class | StringAsyncFetch |
class | AsyncFetchUsingWriter |
class | SharedAsyncFetch |
class | FallbackSharedAsyncFetch |
class | ConditionalSharedAsyncFetch |
class | AsyncFetchWithLock |
class | BotChecker |
class | CacheUrlAsyncFetcher |
class | CountingUrlAsyncFetcher |
class | ExternalUrlFetcher |
class | FetcherTest |
class | Headers |
Read/write API for HTTP headers (shared base class) More... | |
class | HTTPCache |
class | HttpDumpUrlAsyncWriter |
class | HttpDumpUrlFetcher |
class | HttpResponseParser |
class | HTTPValue |
class | HTTPValueWriter |
class | InflatingFetch |
class | AbstractLogRecord |
class | LogRecord |
Simple AbstractLogRecord implementation which owns a LoggingInfo protobuf. More... | |
class | CopyOnWriteLogRecord |
struct | ImageRewriteInfo |
class | MockLogRecord |
A class which helps mock the methods of LogRecord for testing. More... | |
class | ExpectStringAsyncFetch |
class | MockUrlFetcher |
class | RateController |
class | RateControllingUrlAsyncFetcher |
class | ReflectingTestFetcher |
class | RequestContext |
class | RequestHeaders |
Read/write API for HTTP request (RequestHeaders is a misnomer). More... | |
class | ResponseHeaders |
Read/write API for HTTP response headers. More... | |
class | ResponseHeadersParser |
Parses a stream of HTTP header text into a ResponseHeaders instance. More... | |
class | SyncFetcherAdapterCallback |
Class to help run an asynchronous fetch synchronously with a timeout. More... | |
class | UrlAsyncFetcher |
class | UrlAsyncFetcherStats |
class | UserAgentMatcher |
class | UserAgentMatcherTestBase |
class | WaitUrlAsyncFetcher |
class | WgetUrlFetcher |
class | WriteThroughHTTPCache |
Composes two cache interfaces to form a two level http cache. More... | |
class | JsLexer |
Lexical analysis class for Javascript. More... | |
class | ImageTestingPeer |
class | AddHeadFilter |
class | AddInstrumentationFilter |
Injects javascript instrumentation for monitoring page-rendering time. More... | |
class | AssociationTransformer |
class | AssociationSlot |
class | BaseTagFilter |
class | BeaconCriticalImagesFinder |
class | CacheExtender |
class | CacheHtmlFilter |
class | CacheHtmlInfoFinder |
Manages the cache lifetimes of CacheHtmlInfo. More... | |
class | CacheableResourceBase |
class | CollapseWhitespaceFilter |
class | CollectFlushEarlyContentFilter |
class | CommonFilter |
class | ComputeVisibleTextFilter |
class | CriticalCssBeaconFilter |
class | CriticalCssFilter |
class | CriticalCssFinder |
Finds critical CSS rules (i.e. CSS needed for the initial page load). More... | |
class | CriticalImagesBeaconFilter |
class | CriticalImagesCallback |
struct | CriticalImagesInfo |
class | CriticalImagesFinder |
class | CriticalImagesFinderTestBase |
class | CriticalSelectorFilter |
struct | CriticalSelectorInfo |
class | CriticalSelectorFinder |
class | BeaconCriticalSelectorFinder |
class | CssCombineFilter |
class | CssFilter |
class | CssFlattenImportsContext |
Context used by CssFilter under async flow that flattens . More... | |
class | CssHierarchy |
class | CssImageRewriter |
class | CssInlineFilter |
Inline small CSS files. More... | |
class | CssInlineImportToLinkFilter |
class | CssMinify |
class | CssMoveToHeadFilter |
class | CssOutlineFilter |
Filter to take explicit <style> and <script> tags and outline them to files. More... | |
class | CssResourceSlot |
A place storing a rewritable URL inside a CSS AST. More... | |
class | CssResourceSlotFactory |
class | CssRewriteTestBase |
class | CssSummarizerBase |
class | CssTagScanner |
class | RewriteDomainTransformer |
class | CssUrlCounter |
class | CssUrlEncoder |
class | CssUrlExtractor |
class | CustomRewriteTestBase |
class | DataUrlInputResource |
class | DebugFilter |
class | DecodeRewrittenUrlsFilter |
class | DedupInlinedImagesFilter |
class | DeferIframeFilter |
class | DelayImagesFilter |
class | DetectReflowJsDeferFilter |
class | DeterministicJsFilter |
class | DeviceProperties |
class | DomStatsFilter |
Counts some basic statistics observed as HTML is parsed. More... | |
class | DomainLawyer |
class | DomainRewriteFilter |
class | DownstreamCachingDirectives |
class | ElideAttributesFilter |
Remove attributes and attribute values that can be safely elided. More... | |
class | ExperimentMatcher |
class | FakeFilter |
class | FileInputResource |
class | FileLoadMapping |
class | FileLoadMappingRegexp |
class | FileLoadMappingLiteral |
class | FileLoadPolicy |
class | FileLoadRule |
class | FileLoadRuleRegexp |
class | FileLoadRuleLiteral |
class | FlushEarlyContentWriterFilter |
class | FlushEarlyInfoFinder |
class | MeaningfulFlushEarlyInfoFinder |
class | FlushHtmlFilter |
class | ScriptEditor |
Edit a substring in a script element. More... | |
class | GoogleAnalyticsFilter |
class | HandleNoscriptRedirectFilter |
class | HtmlAttributeQuoteRemoval |
class | Image |
class | ImageCombineFilter |
class | ImageRewriteFilter |
class | ImageTestBase |
class | ImageUrlEncoder |
class | InPlaceRewriteResourceSlot |
class | InPlaceRewriteContext |
Context that is used for an in-place rewrite. More... | |
class | RecordingFetch |
class | InlineRewriteContext |
class | InsertDnsPrefetchFilter |
class | InsertGAFilter |
class | JavascriptRewriteConfig |
class | JavascriptCodeBlock |
class | JavascriptFilter |
class | JavascriptLibraryIdentification |
class | JsCombineFilter |
class | JsDeferDisabledFilter |
class | JsDisableFilter |
class | JsInlineFilter |
Inline small Javascript files. More... | |
class | JsOutlineFilter |
Filter to take explicit <style> and <script> tags and outline them to files. More... | |
class | LazyloadImagesFilter |
class | LocalStorageCacheFilter |
class | MetaTagFilter |
class | MockCriticalCssFinder |
class | MockCriticalImagesFinder |
class | ForwardingMockCriticalImagesFinder |
class | MockResourceCallback |
class | OutputResource |
class | PedanticFilter |
class | ProcessContext |
class | RedirectOnSizeLimitFilter |
class | RemoveCommentsFilter |
class | RequestProperties |
class | Resource |
struct | TimedBool |
A boolean with an expiration date. More... | |
class | ResourceCombiner |
class | ResourceFetch |
class | ResourceNamer |
class | ResourceSlot |
class | FetchResourceSlot |
class | HtmlResourceSlot |
class | HtmlResourceSlotComparator |
class | RewriteContext |
class | TrimWhitespaceRewriter |
Simple test filter just trims whitespace from the input resource. More... | |
class | TrimWhitespaceSyncFilter |
class | UpperCaseRewriter |
A similarly structured test-filter: this one just upper-cases its text. More... | |
class | NestedFilter |
class | CombiningFilter |
class | RewriteContextTestBase |
class | RewriteDriver |
class | OptionsAwareHTTPCacheCallback |
class | RewriteDriverFactory |
class | RewriteDriverPool |
class | RewriteFilter |
class | RewriteGflags |
class | RewriteOptions |
class | RewriteOptionsTestBase |
class | RewriteQuery |
class | RewriteStats |
Collects a few specific statistics variables related to Rewriting. More... | |
class | RewriteTestBase |
class | RewrittenContentScanningFilter |
class | ScanFilter |
class | ScriptTagScanner |
class | ServerContext |
class | SimpleTextFilter |
class | SingleRewriteContext |
struct | XpathUnit |
class | SplitHtmlConfig |
class | SplitHtmlFilter |
class | SplitHtmlHelperFilter |
class | StaticAssetManager |
class | StripNonCacheableFilter |
class | StripScriptsFilter |
Remove all scripts from a web page. More... | |
class | SupportNoscriptFilter |
class | SuppressPreheadFilter |
class | TestDistributedFetcher |
class | TestRewriteDriverFactory |
class | TestUrlNamer |
class | UrlInputResource |
class | UrlLeftTrimFilter |
class | UrlNamer |
class | UrlPartnership |
class | UsageDataReporter |
class | AddHeadersFetcher |
class | AprMemCache |
class | LoopbackRouteFetcher |
See file comment. More... | |
struct | SerfStats |
class | SerfUrlAsyncFetcher |
class | SystemCachePath |
class | SystemCaches |
class | SystemRewriteDriverFactory |
A server context with features specific to a psol port on a unix system. More... | |
class | SystemRewriteOptions |
class | SystemServerContext |
A server context with features specific to a PSOL port on a unix system. More... | |
class | CacheTestBase |
class | AsyncCache |
class | CacheBatcher |
class | CacheStats |
class | ChunkingWriter |
class | CompressedCache |
Compressed cache adapter. More... | |
class | CountdownTimer |
class | CountingWriter |
Delegates to another writer, but counts bytes along the way. More... | |
class | DelayCache |
See file comment. More... | |
class | DelegatingCacheCallback |
class | EnumSet |
Represents a set of values -- implemented via a bitset. More... | |
class | FallbackCache |
class | FallbackPropertyPage |
class | FileCache |
Simple C++ implementation of file cache. More... | |
class | FilenameEncoder |
class | GzipInflater |
class | ManuallyRefCounted |
class | MockHasher |
class | MockPropertyPage |
class | MockTimeCache |
See file comment. More... | |
class | NullRWLock |
class | NullStatisticsVariable |
class | NullStatistics |
Simple name/value pair statistics implementation. More... | |
class | Pool |
class | PoolElement |
class | PropertyValue |
Holds the value & stability-metadata for a property. More... | |
class | PropertyCache |
Adds property-semantics to a raw cache API. More... | |
class | AbstractPropertyPage |
Abstract interface for implementing a PropertyPage. More... | |
class | PropertyPage |
class | QueuedAlarm |
class | RequestTrace |
class | SplitVariable |
class | SplitHistogram |
class | SplitTimedVariable |
class | SplitStatistics |
class | SplitWriter |
SplitWriter writes to two sub-writers. More... | |
class | StatisticsWorkBound |
class | ThreadsafeCache |
class | UrlMultipartEncoder |
class | UrlSegmentEncoder |
class | UrlToFilenameEncoder |
Helper class for converting a URL into a filename. More... | |
class | VectorDeque |
class | WorkBound |
class | WriteThroughCache |
Composes two caches to form a write-through cache. More... | |
Typedefs | |
typedef RefCountedPtr < RequestContext > | RequestContextPtr |
typedef std::map< GoogleString, const Panel * > | PanelIdToSpecMap |
typedef std::multimap < GoogleString, std::pair < GoogleString, const int > , StringCompareInsensitive > | AttributesToNonCacheableValuesMap |
typedef std::map< GoogleString, int > | SupportMap |
typedef RefCountedPtr < CssResourceSlot > | CssResourceSlotPtr |
typedef std::map< GoogleString, std::pair< int32, int32 > > | RenderedImageDimensionsMap |
typedef RefCountedPtr< Resource > | ResourcePtr |
typedef std::vector< ResourcePtr > | ResourceVector |
typedef RefCountedPtr < ResourceSlot > | ResourceSlotPtr |
typedef RefCountedPtr < HtmlResourceSlot > | HtmlResourceSlotPtr |
typedef std::vector < ResourceSlotPtr > | ResourceSlotVector |
typedef std::set < HtmlResourceSlotPtr, HtmlResourceSlotComparator > | HtmlResourceSlotSet |
typedef RefCountedPtr < OutputResource > | OutputResourcePtr |
typedef std::vector < OutputResourcePtr > | OutputResourceVector |
typedef std::vector< XpathUnit > | XpathUnits |
typedef std::map< GoogleString, XpathUnits * > | XpathMap |
Map of xpath to XpathUnits. | |
typedef bool(* | WebpProgressHook )(int percent, void *user_data) |
Progress hook for WebP conversions. | |
typedef std::vector < PropertyPage * > | PropertyPageStarVector |
typedef google::protobuf::io::StringOutputStream | StringOutputStream |
typedef google::protobuf::io::ArrayInputStream | ArrayInputStream |
Enumerations | |
enum | OutputResourceKind { kRewrittenResource, kOnTheFlyResource, kOutlinedResource } |
enum | PropertyCacheDecodeResult { kPropertyCacheDecodeNotFound, kPropertyCacheDecodeExpired, kPropertyCacheDecodeParseError, kPropertyCacheDecodeOk } |
enum | PropertyCacheUpdateResult { kPropertyCacheUpdateNotFound, kPropertyCacheUpdateEncodeError, kPropertyCacheUpdateOk } |
enum | RewriteResult { kRewriteFailed, kRewriteOk, kTooBusy } |
enum | Encoding { UNKNOWN, BASE64, PLAIN } |
Functions | |
void | SlurpUrl (ApacheServerContext *server_context, request_rec *r) |
void | AprReportError (MessageHandler *message_handler, const char *filename, int line, const char *message, int error_code) |
void | ApacheRequestToRequestHeaders (const request_rec &request, RequestHeaders *request_headers) |
Converts Apache header structure into RequestHeaders. | |
void | ApacheRequestToResponseHeaders (const request_rec &request, ResponseHeaders *headers, ResponseHeaders *err_headers) |
void | ResponseHeadersToApacheRequest (const ResponseHeaders &response_headers, bool ok_to_disable_downstream_headers, request_rec *request) |
void | AddResponseHeadersToRequest (const ResponseHeaders *headers, const ResponseHeaders *err_headers, bool ok_to_disable_downstream_headers, request_rec *request) |
void | DisableDownstreamHeaderFilters (request_rec *request) |
Remove downstream filters that might corrupt our caching headers. | |
void | PrintHeaders (request_rec *request) |
Debug utility for printing Apache headers to stdout. | |
void | DisableCaching (request_rec *request) |
template<class T > | |
apr_status_t | apache_cleanup (void *object) |
Generic deleter meant to be used with apr_pool_cleanup_register(). | |
bool | is_pagespeed_subrequest (request_rec *request) |
apr_status_t | instaweb_handler (request_rec *request) |
apr_status_t | save_url_hook (request_rec *request) |
apr_status_t | save_url_in_note (request_rec *request, ApacheServerContext *server_context) |
apr_status_t | instaweb_map_to_storage (request_rec *request) |
void | attach_mod_spdy () |
Needs to be called from a ap_hook_optional_fn_retrieve hook. | |
int | mod_spdy_get_spdy_version (conn_rec *conn) |
spdy_slave_connection_factory * | mod_spdy_create_slave_connection_factory (conn_rec *master_connection) |
void | mod_spdy_destroy_slave_connection_factory (spdy_slave_connection_factory *factory) |
spdy_slave_connection * | mod_spdy_create_slave_connection (spdy_slave_connection_factory *factory, ap_filter_rec_t *input_filter, void *input_filter_ctx, ap_filter_rec_t *output_filter, void *output_filter_ctx) |
void | mod_spdy_run_slave_connection (spdy_slave_connection *conn) |
void | mod_spdy_destroy_slave_connection (spdy_slave_connection *conn) |
bool | mod_ssl_is_https (conn_rec *conn) |
Matcher< ImageRewriteInfo > | LogImageRewriteActivityMatcher (Matcher< const char * > id, Matcher< const GoogleString & > url, Matcher< RewriterApplication::Status > status, Matcher< bool > is_image_inlined, Matcher< bool > is_critical_image, Matcher< bool > is_url_rewritten, Matcher< int > size, Matcher< bool > try_low_res_src_insertion, Matcher< bool > low_res_src_inserted, Matcher< ImageType > low_res_image_type, Matcher< int > low_res_data_size) |
StringSet | GetCriticalKeysFromProto (const CriticalKeys &critical_keys) |
void | WriteCriticalKeysToPropertyCache (const StringSet &new_keys, StringPiece nonce, int support_interval, bool should_replace_prior_result, StringPiece property_name, const PropertyCache *cache, const PropertyCache::Cohort *cohort, AbstractPropertyPage *page, MessageHandler *message_handler, Timer *timer) |
GoogleString | PrepareForBeaconInsertion (const StringSet &keys, CriticalKeys *proto, int support_interval, bool should_replace_prior_result, StringPiece property_name, const PropertyCache::Cohort *cohort, AbstractPropertyPage *page, NonceGenerator *nonce_generator, Timer *timer) |
Image * | NewImage (const StringPiece &original_contents, const GoogleString &url, const StringPiece &file_prefix, Image::CompressionOptions *options, Timer *timer, MessageHandler *handler) |
Image * | BlankImageWithOptions (int width, int height, ImageType type, const StringPiece &tmp_dir, Timer *timer, MessageHandler *handler, Image::CompressionOptions *options) |
int | CharToInt (char c) |
char to int *without sign extension*. | |
int | JpegIntAtPosition (const StringPiece &buf, size_t pos) |
int | GifIntAtPosition (const StringPiece &buf, size_t pos) |
int | PngIntAtPosition (const StringPiece &buf, size_t pos) |
bool | PngSectionIdIs (const char *hdr, const StringPiece &buf, size_t pos) |
const PropertyValue * | DecodeFromPropertyCacheHelper (const PropertyCache *cache, AbstractPropertyPage *page, const PropertyCache::Cohort *cohort, StringPiece property_name, int64 cache_ttl_ms, PropertyCacheDecodeResult *status) |
template<typename T > | |
T * | DecodeFromPropertyCache (const PropertyCache *cache, AbstractPropertyPage *page, const PropertyCache::Cohort *cohort, StringPiece property_name, int64 cache_ttl_ms, PropertyCacheDecodeResult *status) |
template<typename T > | |
T * | DecodeFromPropertyCache (RewriteDriver *driver, const PropertyCache::Cohort *cohort, StringPiece property_name, int64 cache_ttl_ms, PropertyCacheDecodeResult *status) |
PropertyCacheUpdateResult | UpdateInPropertyCache (const protobuf::MessageLite &value, const PropertyCache::Cohort *cohort, StringPiece property_name, bool write_cohort, AbstractPropertyPage *page) |
PropertyCacheUpdateResult | UpdateInPropertyCache (const protobuf::MessageLite &value, RewriteDriver *driver, const PropertyCache::Cohort *cohort, StringPiece property_name, bool write_cohort) |
bool | OptimizeWebp (const GoogleString &original_jpeg, int configured_quality, WebpProgressHook progress_hook, void *progress_hook_data, GoogleString *compressed_webp) |
bool | ReduceWebpImageQuality (const GoogleString &original_webp, int quality, GoogleString *compressed_webp) |
apr_pool_t * | AprCreateThreadCompatiblePool (apr_pool_t *parent_pool) |
void | ConsoleHandler (SystemRewriteOptions *options, Writer *writer, MessageHandler *handler) |
bool | StripUtf8Bom (StringPiece *contents) |
const StringPiece | GetCharsetForBom (const StringPiece contents) |
void | DataUrl (const ContentType &content_type, const Encoding encoding, const StringPiece &content, GoogleString *result) |
bool | IsDataUrl (const StringPiece url) |
Determine if the given URL is a data: URL. Cheaper than ParseDataUrl. | |
bool | IsDataImageUrl (const StringPiece url) |
Determine if the given URL is a data:image URL (aka an inlined image). | |
bool | ParseDataUrl (const StringPiece &url, const ContentType **content_type, Encoding *encoding, StringPiece *encoded_content) |
bool | DecodeDataUrlContent (Encoding encoding, const StringPiece &encoded_content, GoogleString *decoded_content) |
void | EscapeToJsStringLiteral (const StringPiece &original, bool add_quotes, GoogleString *escaped) |
void | ParseGflags (const char *progname, int *argc, char ***argv) |
GoogleString | GetHostname () |
Determine the local hostname. | |
bool | IsLocalhost (StringPiece host_to_test, StringPiece hostname) |
uint64 | RollingHash (const char *buf, size_t start, size_t n) |
Compute the rolling hash of buf[start : start + n - 1]. | |
uint64 | NextRollingHash (const char *buf, size_t start, size_t n, uint64 prev) |
Variables | |
const char | kPagespeedOriginalUrl [] = "mod_pagespeed_original_url" |
const char | kModPagespeedFilterName [] = "MOD_PAGESPEED_OUTPUT_FILTER" |
Filter used for HTML rewriting. | |
const char | kModPagespeedFixHeadersName [] = "MOD_PAGESPEED_FIX_HEADERS_FILTER" |
Filter used to fix headers after mod_headers runs. | |
const char | kModPagespeedInPlaceFilterName [] = "MOD_PAGESPEED_IN_PLACE_FILTER" |
const char | kModPagespeedInPlaceCheckHeadersName [] = "MOD_PAGESPEED_IN_PLACE_CHECK_HEADERS_FILTER" |
Second filter checks headers for cacheability. | |
const char | kPageUrl [] = "page.html" |
const char | kBackgroundFetchHeader [] = "X-Background-Fetch" |
const char | kGaSnippetGetTracker [] = "_modpagespeed_getRewriteTracker(" |
const char | kGaSnippetPrefix [] = " var pageTrackerMethodNames = [\n" |
const char | kGaSnippetSuffix [] = "})();\n" |
const int64 | kMinBeaconIntervalMs = 5 * Timer::kSecondMs |
Default rebeaconing time. | |
const int64 | kBeaconTimeoutIntervalMs = Timer::kMinuteMs |
const char | kValidNonce [] = "*" |
const char | kGAExperimentSnippet [] |
const char | kGAJsSnippet [] |
const char | kGASpeedTracking [] |
const int | kNoQualityGiven = -1 |
const char | kUtf8Charset [] = "utf-8" |
The charsets we understand. Currently only those that have BOMs below. | |
const char | kUtf16BigEndianCharset [] = "utf-16be" |
const char | kUtf16LittleEndianCharset [] = "utf-16le" |
const char | kUtf32BigEndianCharset [] = "utf-32be" |
const char | kUtf32LittleEndianCharset [] = "utf-32le" |
const char | kUtf8Bom [] = "\xEF\xBB\xBF" |
The Byte-Order-Mark (BOM) for the various UTF encodings. | |
const char | kUtf16BigEndianBom [] = "\xFE\xFF" |
const char | kUtf16LittleEndianBom [] = "\xFF\xFE" |
const char | kUtf32BigEndianBom [] = "\x00\x00\xFE\xFF" |
const char | kUtf32LittleEndianBom [] = "\xFF\xFE\x00\x00" |
const uint64 | kRollingHashCharTable [256] |
Per character hash values. Exported for use in NextRollingHash. |
Unit-test framework for wget fetcher.
for DCHECK
Mock PropertyPage for use in unit tests.
A set of utility functions for handling hostnames.
Shared infrastructure for testing cache implementations.
extern "C"
Base class for tests which want a ServerContext.
for scoped_ptr
for StringSet, etc
Some common routines and constants for tests dealing with Images.
for GoogleString
A filter which does not modify the DOM, but counts statistics about it.
Base class for tests which do rewrites within CSS.
namespace Css
for ResourcePtr
DO NOT EDIT. Generated by ./google_analytics_snippet_gen.py.
for StringPiece
HttpAttributes, HttpStatus.
Callbacks used for testing.
TimingInfo.
for size_t
for FILE
for apr_status_t The httpd header must be after the instaweb_context.h. Otherwise, the compiler will complain "strtoul_is_not_a_portable_function_use_strtol_instead".
html_filter that passes data through unmodified, but logs statistics about the data as it goes by. It should be possible to create many instances of this class and insert them at different points in the rewriting flow Goal is to log: NUM_EXPLICIT_CLOSED - <tag> </tag> pairs NUM_IMPLICIT_CLOSED - <tag> for implicitly-closed tag NUM_BRIEF_CLOSED - </tag> NUM_CLOSED - Sum of above three NUM_UNCLOSED - <tag> without matching </tag> NUM_SPURIOUS_CLOSED - </tag> without preceding <tag>; UNCOUNTED RIGHT NOW! NUM_TAGS - Total number of opening tags NUM_CDATA - cdata sections NUM_COMMENTS - comments NUM_DIRECTIVES - directives NUM_DOCUMENTS - started documents NUM_IE_DIRECTIVES - ie directives Reporting: We report this information via a StatisticsLog: filter.ToString(log) Two sets of statistics (eg before and after processing) can be compared using before.Equals(after),
If your .cc file needs to use the types declared in logging_proto.h, you must also include net/instaweb/http/public/logging_proto_impl.h See that header file for an explanation of why this is necessary.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2011 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http:///www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Helper class to make RewriteTestBase tests that use a custom options subclass.
Search for synchronous loads of Google Analytics similar to the following:
<script type="text/javascript"> var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js type='text/javascript'" + "%3E%3C/script%3E")); </script> <script type="text/javascript"> try { var pageTracker = _gat._getTracker("UA-XXXXX-X"); pageTracker._trackPageview(); } catch(err) {} </script>
Replace the document.write with a new snippet that loads ga.js asynchronously. Also, insert a replacement for _getTracker that converts any calls to the synchronous API to the asynchronous API. The _getTracker replacement is a new function that returns a mock tracker object. Anytime a synchronous API method is called, the mock tracker fowards it to a _gaq.push(...) call.
An alternative approach would been to find all the API calls and rewrite them to the asynchronous API. However, to be done properly, it would have had the added complication of using a JavaScript compiler.
Unit-test the RewriteContext class. This is made simplest by setting up some dummy rewriters in our test framework.
for pair
We need to include rewrite_driver.h due to covariant return of html_parse() We need to include mock_timer.h to allow upcast to Timer*.
This class is a simple wrapper around another fetcher that adds headers to requests based on settings in the rewrite options before passing them on to the backend fetcher.
A set of utility functions for handling character sets/encodings and related concepts like byte-order-marks (BOM). Currently the only methods relate to BOMs.
Include this file when defining an object that will reside in a pool. There are a couple of ways of defining such an object, but all of them require us to use the PoolPosition typedef. Most simply, we can extend the PoolElement type defined here---but in practice, we want to avoid multiple inheritance just to store a simple back link, and we're better off providing an accessor at pool construction time instead.
for size_t for memcpy
typedef google::protobuf::io::StringOutputStream net_instaweb::StringOutputStream |
UNKNOWN |
Used only for output of ParseDataUrl. |
PLAIN |
LATIN1, ///<
|
Used to signal whether optimization was successful or not to RewriteContext::RewriteDone.
void net_instaweb::AddResponseHeadersToRequest | ( | const ResponseHeaders * | headers, |
const ResponseHeaders * | err_headers, | ||
bool | ok_to_disable_downstream_headers, | ||
request_rec * | request | ||
) |
Converts ResponseHeaders (headers and err_headers) into Apache request headers (headers_out and err_headers_out respectively). Either headers or err_headers may be NULL but both cannot be. Unlike in ApacheRequestToResponseHeaders it does not make sense for headers to equal err_headers since it will result in duplicate headers being written.
void net_instaweb::ApacheRequestToResponseHeaders | ( | const request_rec & | request, |
ResponseHeaders * | headers, | ||
ResponseHeaders * | err_headers | ||
) |
Converts Apache header structure (request.headers_out) into ResponseHeaders headers. If err_headers is not NULL then request.err_headers_out is copied into it. In the event that headers == err_headers, the headers from request.err_headers_out will be appended to the list of headers, but no merging occurs.
apr_pool_t* net_instaweb::AprCreateThreadCompatiblePool | ( | apr_pool_t * | parent_pool | ) |
Creates a pool that can be used in any thread, even when run in Apache prefork.
1) This method must be called from startup phase only 2) Each pool must be accessed only from a single thread (or otherwise have its access serialized) 3) Different pools returned by this function may be safely used concurrently. 4) It's OK to just use ap_pool_create to create child pools of this one from multiple threads; those will be re-entrant too (but pools created merely as children of Apache's pools will not be reentrant in prefork)
In short, pools returned by this method are not fully threadsafe, but at least they are not thread-hostile, which is what you get with apr_pool_create in Prefork.
Note: the above is all about the release version of the pool code, the checking one has some additional locking!
Image* net_instaweb::BlankImageWithOptions | ( | int | width, |
int | height, | ||
ImageType | type, | ||
const StringPiece & | tmp_dir, | ||
Timer * | timer, | ||
MessageHandler * | handler, | ||
Image::CompressionOptions * | options | ||
) |
Creates a blank image of the given dimensions and type. For now, this is assumed to be an 8-bit 3-channel image.
int net_instaweb::CharToInt | ( | char | c | ) | [inline] |
char to int *without sign extension*.
The following four helper functions were moved here for testability. We ran into problems with sign extension under different compiler versions, and we'd like to catch regressions on that front in the future.
void net_instaweb::ConsoleHandler | ( | SystemRewriteOptions * | options, |
Writer * | writer, | ||
MessageHandler * | handler | ||
) |
Handler which serves PSOL console. Note: ConsoleHandler always succeeds.
void net_instaweb::DataUrl | ( | const ContentType & | content_type, |
const Encoding | encoding, | ||
const StringPiece & | content, | ||
GoogleString * | result | ||
) |
Create a data: url from the given content-type and content. See: http://en.wikipedia.org/wiki/Data_URI_scheme
The ENCODING indicates how to encode the content; for binary data this is UTF8, for ascii / Latin1 it's LATIN1. If you have ascii without high bits or NULs, use LATIN1. If you have alphanumeric data, use PLAIN (which doesn't encode at all).
Note in particular that IE<=7 does not support this, so it makes us UserAgent-dependent. It also pretty much requires outgoing content to be compressed as we tend to base64-encode the content.
T* net_instaweb::DecodeFromPropertyCache | ( | const PropertyCache * | cache, |
AbstractPropertyPage * | page, | ||
const PropertyCache::Cohort * | cohort, | ||
StringPiece | property_name, | ||
int64 | cache_ttl_ms, | ||
PropertyCacheDecodeResult * | status | ||
) |
Decodes a protobuf of type T from the property named 'property_name' in the cohort 'cohort_name' in the given property cache, and makes sure it has not exceeded its TTL of 'cache_ttl_ms' (a value of -1 will disable this check).
status will denote the decoding state; if it's kPropertyCacheDecodeOk then a pointer to a freshly allocated decoded proto is returned; otherwise NULL is returned.
*status set by helper
T* net_instaweb::DecodeFromPropertyCache | ( | RewriteDriver * | driver, |
const PropertyCache::Cohort * | cohort, | ||
StringPiece | property_name, | ||
int64 | cache_ttl_ms, | ||
PropertyCacheDecodeResult * | status | ||
) |
Wrapper version of the above function that gets the property cache and the property page from the given driver.
const PropertyValue* net_instaweb::DecodeFromPropertyCacheHelper | ( | const PropertyCache * | cache, |
AbstractPropertyPage * | page, | ||
const PropertyCache::Cohort * | cohort, | ||
StringPiece | property_name, | ||
int64 | cache_ttl_ms, | ||
PropertyCacheDecodeResult * | status | ||
) |
Returns PropertyValue object for given cohort and property name, setting *status and returning NULL if any errors were found.
void net_instaweb::DisableCaching | ( | request_rec * | request | ) |
Updates caching headers to ensure the resulting response is not cached. Removes any max-age specification, and adds max-age=0, no-cache.
const StringPiece net_instaweb::GetCharsetForBom | ( | const StringPiece | contents | ) |
Return the charset string for the given contents' BOM if any. If the contents start with one of the BOMs defined above then the corresponding charset is returned, otherwise an empty StringPiece.
StringSet net_instaweb::GetCriticalKeysFromProto | ( | const CriticalKeys & | critical_keys | ) |
Generate and return a list of the critical keys from a proto, taking into account legacy keys that may have been added before.
apr_status_t net_instaweb::instaweb_handler | ( | request_rec * | request | ) |
Handle mod_pagespeed-specific requests. Handles both .pagespeed. rewritten resources and /mod_pagespeed_statistics, /mod_pagespeed_beacon, etc.
apr_status_t net_instaweb::instaweb_map_to_storage | ( | request_rec * | request | ) |
By default, apache imposes limitations on URL segments of around 256 characters that appear to correspond to filename limitations. To prevent that, we hook map_to_storage for our own purposes.
bool net_instaweb::is_pagespeed_subrequest | ( | request_rec * | request | ) |
Was this request made by mod_pagespeed itself? If so, we should not try to handle it, just let Apache deal with it like normal.
bool net_instaweb::IsLocalhost | ( | StringPiece | host_to_test, |
StringPiece | hostname | ||
) |
Determine if the given host is localhost or a variant thereof: localhost, 127.0.0.1 (IPv4), ::1 (IPv6), or hostname (the local hostname).
TODO(sligocki): Cover other representations of IPv6 localhost IP?
TODO(matterbury): Handle all 127.0.0.0/8 address since they are 'localhost'.
Matcher<ImageRewriteInfo> net_instaweb::LogImageRewriteActivityMatcher | ( | Matcher< const char * > | id, |
Matcher< const GoogleString & > | url, | ||
Matcher< RewriterApplication::Status > | status, | ||
Matcher< bool > | is_image_inlined, | ||
Matcher< bool > | is_critical_image, | ||
Matcher< bool > | is_url_rewritten, | ||
Matcher< int > | size, | ||
Matcher< bool > | try_low_res_src_insertion, | ||
Matcher< bool > | low_res_src_inserted, | ||
Matcher< ImageType > | low_res_image_type, | ||
Matcher< int > | low_res_data_size | ||
) |
A custom matcher to match more than 10 arguments allowed by MOCK_METHOD* macros.
spdy_slave_connection_factory* net_instaweb::mod_spdy_create_slave_connection_factory | ( | conn_rec * | master_connection | ) |
See mod_spdy's slave_connection_api.h for description of the methods below. These are merely forwarding wrappers with some CHECKS. Note that this method will return NULL if the relevant mod_spdy methods weren't found registered with Apache. Others, however, will CHECK-fail (since there is no sensible way to call them if this method failed); except you can always safely mod_spdy_destroy_slave_connection_factory(NULL).
int net_instaweb::mod_spdy_get_spdy_version | ( | conn_rec * | conn | ) |
If the connection is using SPDY with mod_spdy, returns the protocol version. Otherwise, returns 0.
bool net_instaweb::mod_ssl_is_https | ( | conn_rec * | conn | ) |
Returns true if given connection is using HTTPS. (This is actually a mod_ssl function).
Image* net_instaweb::NewImage | ( | const StringPiece & | original_contents, |
const GoogleString & | url, | ||
const StringPiece & | file_prefix, | ||
Image::CompressionOptions * | options, | ||
Timer * | timer, | ||
MessageHandler * | handler | ||
) |
Image owns none of its inputs. All of the arguments to NewImage(...) (the original_contents in particular) must outlive the Image object itself. The intent is that an Image is created in a scoped fashion from an existing known resource.
The options should be set via Image::SetOptions after construction, before the image is used for anything but determining its natural dimension size.
uint64 net_instaweb::NextRollingHash | ( | const char * | buf, |
size_t | start, | ||
size_t | n, | ||
uint64 | prev | ||
) | [inline] |
Given the rolling hash prev of buf[start - 1 : start + n - 2], efficiently compute the hash of buf[start : start + n - 1]. Note that this indexes buf[start - 1], so we can't just use a StringPiece here. We eschew StringPiece in any case, because of efficiency.
Note that to get efficient operation here for fixed n (eg when we're doing something like Rabin-Karp string matching), we must inline the computation of shift amounts and then hoist them as loop invariants. That is why this function (intended for use in an inner loop) is inlined.
In a reasonable loop, the following two tests should be eliminated based on contextual information, if our compiler is optimizing enough.
< rotate left 1
Corner case: shift by >= 64 bits is not defined in C. gcc had better constant-fold this to a rotate! (It appears to.) We inline in large part to ensure the truthiness of this fact.
rotate left by shift (equiv to rotating left n times).
bool net_instaweb::OptimizeWebp | ( | const GoogleString & | original_jpeg, |
int | configured_quality, | ||
WebpProgressHook | progress_hook, | ||
void * | progress_hook_data, | ||
GoogleString * | compressed_webp | ||
) |
Optimizer in the style of pagespeed/kernel/image/jpeg_optimizer.h that creates a webp-formatted image in compressed_webp from the jpeg image in original_jpeg. Indicates failure by returning false, in which case compressed_webp may be filled with junk.
bool net_instaweb::ParseDataUrl | ( | const StringPiece & | url, |
const ContentType ** | content_type, | ||
Encoding * | encoding, | ||
StringPiece * | encoded_content | ||
) |
Dismantle a data: url into its component pieces, but do not decode the content. Note that encoded_content will be a substring of the input url and shares its lifetime. Invalidates all outputs if url does not parse.
GoogleString net_instaweb::PrepareForBeaconInsertion | ( | const StringSet & | keys, |
CriticalKeys * | proto, | ||
int | support_interval, | ||
bool | should_replace_prior_result, | ||
StringPiece | property_name, | ||
const PropertyCache::Cohort * | cohort, | ||
AbstractPropertyPage * | page, | ||
NonceGenerator * | nonce_generator, | ||
Timer * | timer | ||
) |
Given a set of candidate critical keys, decide whether beaconing should take place (and if so, decay existing key evidence). We should always* beacon if there's new critical key data. Otherwise re-beaconing is based on a time and request interval.
bool net_instaweb::ReduceWebpImageQuality | ( | const GoogleString & | original_webp, |
int | quality, | ||
GoogleString * | compressed_webp | ||
) |
Reduce the quality of the webp image. Indicates failure by returning false. WebP quality varies from 1 to 100. Original image will be returned if input quality is <1.
void net_instaweb::ResponseHeadersToApacheRequest | ( | const ResponseHeaders & | response_headers, |
bool | ok_to_disable_downstream_headers, | ||
request_rec * | request | ||
) |
Converts ResponseHeaders into an Apache request's headers_out table. This function does not alter the major/minor version of the Apache request.
apr_status_t net_instaweb::save_url_hook | ( | request_rec * | request | ) |
Save the original URL as a request "note" before mod_rewrite has a chance to corrupt mod_pagespeed's generated URLs, which would prevent instaweb_handler from being able to decode the resource.
apr_status_t net_instaweb::save_url_in_note | ( | request_rec * | request, |
ApacheServerContext * | server_context | ||
) |
Implementation of the Apache 'translate_name' hook. Used by the actual hook 'save_url_hook' and directly when we already have the server context.
void net_instaweb::SlurpUrl | ( | ApacheServerContext * | server_context, |
request_rec * | r | ||
) |
Loads the URL based on the fetchers and other infrastructure in the factory.
bool net_instaweb::StripUtf8Bom | ( | StringPiece * | contents | ) |
Strips any initial UTF-8 BOM (Byte Order Mark) from the given contents. Returns true if a BOM was stripped, false if not.
In addition to specifying the encoding in the ContentType header, one can also specify it at the beginning of the file using a Byte Order Mark.
Bytes Encoding Form 00 00 FE FF UTF-32, big-endian FF FE 00 00 UTF-32, little-endian FE FF UTF-16, big-endian FF FE UTF-16, little-endian EF BB BF UTF-8 See: http://www.unicode.org/faq/utf_bom.html
PropertyCacheUpdateResult net_instaweb::UpdateInPropertyCache | ( | const protobuf::MessageLite & | value, |
RewriteDriver * | driver, | ||
const PropertyCache::Cohort * | cohort, | ||
StringPiece | property_name, | ||
bool | write_cohort | ||
) | [inline] |
Updates the property 'property_name' in cohort 'cohort_name' of the property cache managed by the rewrite driver with the new value of the proto T. If 'write_cohort' is true, will also additionally write out the cohort to the cache backing.
void net_instaweb::WriteCriticalKeysToPropertyCache | ( | const StringSet & | new_keys, |
StringPiece | nonce, | ||
int | support_interval, | ||
bool | should_replace_prior_result, | ||
StringPiece | property_name, | ||
const PropertyCache * | cache, | ||
const PropertyCache::Cohort * | cohort, | ||
AbstractPropertyPage * | page, | ||
MessageHandler * | message_handler, | ||
Timer * | timer | ||
) |
Update the property cache with a new set of keys. This will update the support value for the new keys, ignoring any keys that are not already present in the property cache (preventing spurious keys from being injected). Note, that it only increases the support value for the new keys, it does not decay values that are not present. PrepareForBeaconInsertion - which decays support - should have been called previously.
const char net_instaweb::kModPagespeedInPlaceFilterName[] = "MOD_PAGESPEED_IN_PLACE_FILTER" |
Filters used for In-Place Resource Optimization. First filter stores un-gzipped contents.
const int net_instaweb::kNoQualityGiven = -1 |
Quality taken when no quality is passed through flags or when no quality is retrieved from JpegUtils::GetImageQualityFromImage.
const uint64 net_instaweb::kRollingHashCharTable[256] |
Per character hash values. Exported for use in NextRollingHash.
Rolling hash for char buffers based on a polynomial lookup table. See http://en.wikipedia.org/wiki/Rolling_hash
const char net_instaweb::kValidNonce[] = "*" |
A nonce value that's valid, used as a placeholder when nonce generation is switched off.