Page Speed Optimization Libraries
1.2.24.1
|
for StringPiece More...
Namespaces | |
namespace | css_util |
Classes | |
class | AddHeadersFetcher |
class | ApacheCache |
class | ApacheConfig |
class | ApacheMessageHandler |
class | ApacheRewriteDriverFactory |
Creates an Apache RewriteDriver. More... | |
class | ApacheServerContext |
class | ApacheThreadSystem |
class | AprFileSystem |
class | AprMemCache |
class | AprTimer |
class | PropertyCallback |
Tracks a single property-cache lookup. More... | |
class | InstawebContext |
class | LoopbackRouteFetcher |
See file comment. More... | |
class | ModSpdyFetchController |
class | ModSpdyFetcher |
struct | SerfStats |
class | SerfUrlAsyncFetcher |
class | BlinkFlowCriticalLine |
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 | ResourceFetch |
class | FileRewriter |
class | StaticRewriter |
class | HtmlEvent |
class | HtmlStartDocumentEvent |
class | HtmlEndDocumentEvent |
class | HtmlStartElementEvent |
class | HtmlEndElementEvent |
class | HtmlLeafNodeEvent |
class | HtmlIEDirectiveEvent |
class | HtmlCdataEvent |
class | HtmlCommentEvent |
class | HtmlCharactersEvent |
class | HtmlDirectiveEvent |
class | HtmlLexer |
class | HtmlTestingPeer |
class | CanonicalAttributes |
class | DocType |
class | EmptyHtmlFilter |
class | ExplicitCloseTag |
class | FileDriver |
class | FileStatisticsLog |
Statistics logger that sends its output to a file. More... | |
class | HtmlElement |
class | HtmlFilter |
class | HtmlKeywords |
class | HtmlName |
class | HtmlNode |
Base class for HtmlElement and HtmlLeafNode. More... | |
class | HtmlLeafNode |
class | HtmlCdataNode |
Leaf node representing a CDATA section. More... | |
class | HtmlCharactersNode |
Leaf node representing raw characters in HTML. More... | |
class | HtmlCommentNode |
Leaf node representing an HTML comment. More... | |
class | HtmlIEDirectiveNode |
Leaf node representing an HTML IE directive. More... | |
class | HtmlDirectiveNode |
Leaf node representing an HTML directive. More... | |
class | HtmlParse |
class | HtmlParseTestBaseNoAlloc |
class | HtmlParseTestBase |
class | HtmlWriterFilter |
class | LoggingFilter |
class | StatisticsLog |
class | AsyncFetch |
class | StringAsyncFetch |
class | AsyncFetchUsingWriter |
class | SharedAsyncFetch |
class | FallbackSharedAsyncFetch |
class | ConditionalSharedAsyncFetch |
class | BotChecker |
class | CacheUrlAsyncFetcher |
struct | ContentType |
class | CountingUrlAsyncFetcher |
class | ExternalUrlFetcher |
class | FakeUrlAsyncFetcher |
class | FetcherTest |
class | Headers |
Read/write API for HTTP headers (shared base class) More... | |
class | HTTPCache |
class | HttpDumpUrlAsyncWriter |
class | HttpDumpUrlFetcher |
class | HttpDumpUrlWriter |
class | HttpResponseParser |
class | HTTPValue |
class | HTTPValueWriter |
class | InflatingFetch |
class | LogRecord |
struct | HttpAttributes |
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 | SyncFetcherAdapter |
class | SyncFetcherAdapterCallback |
Class to help run an asynchronous fetch synchronously with a timeout. More... | |
class | UrlAsyncFetcher |
class | UrlAsyncFetcherStats |
class | UrlFetcher |
class | UrlPollableAsyncFetcher |
class | UserAgentMatcher |
class | WaitUrlAsyncFetcher |
class | WgetUrlFetcher |
class | WriteThroughHTTPCache |
Composes two cache interfaces to form a two level http cache. More... | |
class | JsKeywords |
class | JsLexer |
Lexical analysis class for Javascript. More... | |
class | AddHeadFilter |
class | AddInstrumentationFilter |
Injects javascript instrumentation for monitoring page-rendering time. More... | |
class | AjaxRewriteResourceSlot |
class | AjaxRewriteContext |
Context that is used for an ajax rewrite. More... | |
class | RecordingFetch |
class | AssociationTransformer |
class | AssociationSlot |
class | BaseTagFilter |
class | BeaconCriticalImagesFinder |
class | BlinkBackgroundFilter |
This class does the preprocessing required to apply blink. More... | |
class | BlinkCriticalLineDataFinder |
class | BlinkFilter |
class | CacheExtender |
class | CollapseWhitespaceFilter |
class | CollectFlushEarlyContentFilter |
class | CollectSubresourcesFilter |
class | CommonFilter |
class | ComputeVisibleTextFilter |
class | CriticalImagesCallback |
class | CriticalImagesFinder |
class | CriticalImagesFinderTestBase |
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 | CssTagScanner |
class | RewriteDomainTransformer |
class | CssUrlCounter |
class | CssUrlEncoder |
class | DataUrlInputResource |
class | DebugFilter |
class | DeferIframeFilter |
class | DelayImagesFilter |
class | DetectReflowJsDeferFilter |
class | DeterministicJsFilter |
class | DivStructureFilter |
class | DomainLawyer |
class | DomainRewriteFilter |
class | ElideAttributesFilter |
Remove attributes and attribute values that can be safely elided. More... | |
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 | FuriousMatcher |
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 | 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 | MockResourceCallback |
class | OutputResource |
class | PedanticFilter |
class | ProcessContext |
class | RedirectOnSizeLimitFilter |
class | RemoveCommentsFilter |
class | Resource |
struct | TimedBool |
A boolean with an expiration date. More... | |
class | ResourceCombiner |
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 | SplitHtmlFilter |
class | StaticJavascriptManager |
class | StripNonCacheableFilter |
class | StripScriptsFilter |
Remove all scripts from a web page. More... | |
class | SupportNoscriptFilter |
class | SuppressPreheadFilter |
class | TestRewriteDriverFactory |
class | TestUrlNamer |
class | UrlInputResource |
class | UrlLeftTrimFilter |
class | UrlNamer |
class | UrlPartnership |
class | UsageDataReporter |
class | ResourceManagerTestingPeer |
class | CacheTestBase |
class | AbstractClientState |
class | AbstractMutex |
Abstract interface for implementing a mutex. More... | |
class | ScopedMutex |
Helper class for lexically scoped mutexing. More... | |
class | AbstractSharedMemSegment |
class | AbstractSharedMem |
class | Arena |
class | AsyncCache |
class | Atom |
struct | AtomCompare |
class | AtomicBool |
class | AtomicInt32 |
class | CacheBatcher |
class | CacheCopy |
class | CacheInterface |
Abstract interface for a cache. More... | |
class | CacheStats |
class | CheckingThreadSystem |
class | ChunkingWriter |
class | CircularBuffer |
class | ClientState |
class | CondvarTestBase |
class | CountingWriter |
Delegates to another writer, but counts bytes along the way. More... | |
class | DelayCache |
See file comment. More... | |
class | DelegatingCacheCallback |
class | FallbackCache |
class | FastWildcardGroup |
class | FileCache |
Simple C++ implementation of file cache. More... | |
class | FileMessageHandler |
class | BoolOrError |
class | FileSystem |
class | FileSystemLockManager |
class | FileSystemTest |
class | FileWriter |
Writer implementation for directing HTML output to a file. More... | |
class | FilenameEncoder |
class | Function |
class | MemberFunctionBase |
class | MemberFunction0 |
Captures a delayed call to a 0-arg member function as a closure. More... | |
class | MemberFunction1 |
Captures a delayed call to a 1-arg member function as a closure. More... | |
class | MemberFunction2 |
Captures a delayed call to a 2-arg member function as a closure. More... | |
class | MemberFunction3 |
Captures a delayed call to a 3-arg member function as a closure. More... | |
class | GoogleMessageHandler |
class | GoogleTimer |
class | GoogleUrl |
class GoogleUrl More... | |
class | GzipInflater |
class | HashedRefererStatistics |
class | HashedRefererStatisticsTestBase |
class | HashedRefererStatisticsTestTemplate |
class | Hasher |
class | InlineSListElement |
class | InlineSList |
class | InProcessSharedMem |
class | JsonWriter |
Writes bytes to top json of the stack. More... | |
class | LRUCache |
class | ManuallyRefCounted |
class | MD5Hasher |
class | MemFileSystem |
class | MessageHandler |
class | MockHasher |
class | MockMessageHandler |
class | MockScheduler |
class | MockTimeCache |
See file comment. More... | |
class | MockTimer |
class | NamedLock |
class | NamedLockManager |
class | NullMessageHandler |
Implementation of a message handler that does nothing. More... | |
class | NullMutex |
class | NullRWLock |
class | NullSharedMem |
class | NullStatisticsVariable |
class | NullStatistics |
Simple name/value pair statistics implementation. More... | |
class | NullWriter |
class | Pool |
class | PoolElement |
class | PrintMessageHandler |
A message handler that spews messages to stdout, with no annotation. More... | |
class | PropertyValue |
Holds the value & stability-metadata for a property. More... | |
class | PropertyCache |
Adds property-semantics to a raw cache API. More... | |
class | PropertyPage |
class | PthreadCondvar |
class | PthreadMutex |
Implementation of ThreadSystem::CondvarCapableMutexMutex for Pthread mutexes. More... | |
class | PthreadRWLock |
Implementation of RWLock for Pthread mutexes. More... | |
class | PthreadSharedMem |
class | PthreadThreadSystem |
class | QueryParams |
Parses and rewrites URL query parameters. More... | |
class | QueuedAlarm |
class | QueuedWorker |
See file comment. More... | |
class | QueuedWorkerPool |
class | RefCounted |
class | RefCountedPtr |
class | RefCountedObj |
class | RequestTrace |
class | Scheduler |
class | SchedulerBlockingFunction |
class | SchedulerBasedAbstractLock |
class | SchedulerThread |
class | SharedCircularBuffer |
class | SharedCircularBufferTestBase |
This TestBase is added to pthread_shared_mem_test. More... | |
class | SharedCircularBufferTestTemplate |
struct | Entry |
class | SharedDynamicStringMap |
class | SharedDynamicStringMapTestBase |
class | SharedDynamicStringMapTestTemplate |
class | SharedMemLockManager |
namespace SharedMemLockData More... | |
class | SharedMemLockManagerTestBase |
class | SharedMemLockManagerTestTemplate |
class | SharedMemRefererStatistics |
struct | TestUrl |
class | SharedMemRefererStatisticsTestBase |
class | SharedMemRefererStatisticsTestTemplate |
class | SharedMemVariable |
class | ConsoleStatisticsLogfileReader |
Handles reading the logfile created by SharedMemConsoleStatisticsLogger. More... | |
class | SharedMemConsoleStatisticsLogger |
class | SharedMemHistogram |
class | SharedMemStatistics |
class | SharedMemStatisticsTestBase |
class | SharedMemStatisticsTestTemplate |
class | SharedMemTestEnv |
class | SharedMemTestBase |
class | SharedMemTestTemplate |
class | SharedString |
class | SimpleStatsVariable |
class | SimpleStats |
Simple name/value pair statistics implementation. More... | |
class | SlowWorker |
See file comment. More... | |
class | SplitVariable |
class | SplitConsoleStatisticsLogger |
class | SplitHistogram |
class | SplitTimedVariable |
class | SplitStatistics |
class | SplitWriter |
SplitWriter writes to two sub-writers. More... | |
class | Variable |
class | ConsoleStatisticsLogger |
Class that manages dumping statistics periodically to a file. More... | |
class | Histogram |
class | NullHistogram |
class | TimedVariable |
class | FakeTimedVariable |
TimedVariable implementation that only updates a basic Variable. More... | |
class | Statistics |
Base class for implementations of monitoring statistics. More... | |
class | StatisticsTemplate |
class | ScalarStatisticsTemplate |
class | StatisticsWorkBound |
class | StdioFileSystem |
struct | CasePreserve |
A helper for case-sensitive hashing. More... | |
struct | CaseFold |
A helper for case-insensitive hashing, which folds to lowercase. More... | |
class | StringMultiMap |
class | StringMultiMapInsensitive |
class | StringMultiMapSensitive |
class | EmptyString |
struct | CharStarCompareInsensitive |
struct | CharStarCompareSensitive |
struct | StringCompareSensitive |
struct | StringCompareInsensitive |
class | StringWriter |
Writer implementation for directing HTML output to a string. More... | |
class | SymbolTable |
class | ThreadSynchronizer |
class | ThreadSystem |
class | ThreadsafeCache |
class | Timer |
Timer interface, made virtual so it can be mocked for tests. More... | |
class | UrlMultipartEncoder |
class | UrlSegmentEncoder |
class | UrlToFilenameEncoder |
Helper class for converting a URL into a filename. More... | |
class | Waveform |
class | Wildcard |
class | WildcardGroup |
class | WorkBound |
class | Worker |
class | WriteThroughCache |
Composes two caches to form a write-through cache. More... | |
class | Writer |
Interface for writing bytes to an output stream. More... | |
class | ThreadSystemTestBase |
class | ThreadSystemTestTemplate |
class | WorkerTestBase |
class | DeleteNotifyFunction |
Function that signals on destruction and check fails when run. More... | |
Typedefs | |
typedef std::list< HtmlEvent * > | HtmlEventList |
typedef HtmlEventList::iterator | HtmlEventListIterator |
typedef std::set< const HtmlEvent * > | ConstHtmlEventSet |
typedef RefCountedPtr < RequestContext > | RequestContextPtr |
typedef std::map< GoogleString, const Panel * > | PanelIdToSpecMap |
typedef std::multimap < GoogleString, std::pair < GoogleString, const int > , StringCompareInsensitive > | AttributesToNonCacheableValuesMap |
typedef RefCountedPtr < CssResourceSlot > | CssResourceSlotPtr |
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 std::set< Atom, AtomCompare > | AtomSet |
typedef base::StringPiece | StringPiece |
typedef std::pair< HtmlElement *, Json::Value * > | ElementJsonPair |
Pair of panel json and start Element corresponding to the panel. | |
typedef google::protobuf::io::StringOutputStream | StringOutputStream |
typedef google::protobuf::io::ArrayInputStream | ArrayInputStream |
typedef std::map< GoogleString, GoogleString > | StringStringMap |
typedef std::map< GoogleString, int > | StringIntMap |
typedef std::set< GoogleString > | StringSet |
typedef std::set< GoogleString, StringCompareInsensitive > | StringSetInsensitive |
typedef std::vector< GoogleString > | StringVector |
typedef std::vector< StringPiece > | StringPieceVector |
typedef std::vector< const GoogleString * > | ConstStringStarVector |
typedef std::vector < GoogleString * > | StringStarVector |
typedef std::vector< const char * > | CharStarVector |
typedef SymbolTable< CaseFold > | SymbolTableInsensitive |
typedef SymbolTable< CasePreserve > | SymbolTableSensitive |
Enumerations | |
enum | OutputResourceKind { kRewrittenResource, kOnTheFlyResource, kOutlinedResource } |
enum | RewriteResult { kRewriteFailed, kRewriteOk, kTooBusy } |
enum | Encoding { UNKNOWN, BASE64, PLAIN } |
enum | MessageType { kInfo, kWarning, kError, kFatal } |
Functions | |
void | SlurpUrl (ApacheServerContext *manager, request_rec *r) |
void | AprReportError (MessageHandler *message_handler, const char *filename, int line, const char *message, int error_code) |
apr_pool_t * | AprCreateThreadCompatiblePool (apr_pool_t *parent_pool) |
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) |
Converts ResponseHeaders into an Apache request's headers_out table. | |
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. | |
apr_status_t | instaweb_handler (request_rec *request) |
apr_status_t | save_url_hook (request_rec *request) |
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) |
const ContentType * | NameExtensionToContentType (const StringPiece &name) |
const ContentType * | MimeTypeToContentType (const StringPiece &mime_type) |
bool | ParseContentType (const StringPiece &content_type_str, GoogleString *mime_type, GoogleString *charset) |
Image * | NewImage (const StringPiece &original_contents, const GoogleString &url, const StringPiece &file_prefix, Image::CompressionOptions *options, MessageHandler *handler) |
Image * | BlankImageWithOptions (int width, int height, Image::Type type, const StringPiece &tmp_dir, 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) |
bool | OptimizeWebp (const GoogleString &original_jpeg, int configured_quality, GoogleString *compressed_webp) |
bool | ReduceWebpImageQuality (const GoogleString &original_webp, int quality, GoogleString *compressed_webp) |
void | Web64Encode (const StringPiece &in, GoogleString *out) |
bool | Web64Decode (const StringPiece &in, GoogleString *out) |
void | Mime64Encode (const StringPiece &in, GoogleString *out) |
bool | Mime64Decode (const StringPiece &in, GoogleString *out) |
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 | ParseDataUrl (const StringPiece &url, const ContentType **content_type, Encoding *encoding, StringPiece *encoded_content) |
bool | DecodeDataUrlContent (Encoding encoding, const StringPiece &encoded_content, GoogleString *decoded_content) |
GoogleString | StackTraceString () |
void | EscapeToJsStringLiteral (const StringPiece &original, bool add_quotes, GoogleString *escaped) |
template<class C > | |
Function * | MakeFunction (C *object, void(C::*run)()) |
Makes a Function* that calls a 0-arg class method. | |
template<class C > | |
Function * | MakeFunction (C *object, void(C::*run)(), void(C::*cancel)()) |
template<class C , class T > | |
Function * | MakeFunction (C *object, void(C::*run)(T), T t) |
Makes a Function* that calls a 1-arg class method. | |
template<class C , class T > | |
Function * | MakeFunction (C *object, void(C::*run)(T), void(C::*cancel)(T), T t) |
template<class C , class T , class U > | |
Function * | MakeFunction (C *object, void(C::*run)(T, U), T t, U u) |
Makes a Function* that calls a 2-arg class method. | |
template<class C , class T , class U > | |
Function * | MakeFunction (C *object, void(C::*run)(T, U), void(C::*cancel)(T, U), T t, U u) |
template<class C , class T , class U , class V > | |
Function * | MakeFunction (C *object, void(C::*run)(T, U, V), T t, U u, V v) |
Makes a Function* that calls a 3-arg class method. | |
template<class C , class T , class U , class V > | |
Function * | MakeFunction (C *object, void(C::*run)(T, U, V), void(C::*cancel)(T, U, V), T t, U u, V v) |
void | ParseGflags (const char *progname, int *argc, char ***argv) |
GoogleString | GTestSrcDir () |
GoogleString | GTestTempDir () |
TYPED_TEST_CASE_P (HashedRefererStatisticsTestTemplate) | |
TYPED_TEST_P (HashedRefererStatisticsTestTemplate, TestHashed) | |
REGISTER_TYPED_TEST_CASE_P (HashedRefererStatisticsTestTemplate, TestHashed) | |
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) |
TYPED_TEST_CASE_P (SharedCircularBufferTestTemplate) | |
TYPED_TEST_P (SharedCircularBufferTestTemplate, TestCreate) | |
TYPED_TEST_P (SharedCircularBufferTestTemplate, TestAdd) | |
TYPED_TEST_P (SharedCircularBufferTestTemplate, TestClear) | |
TYPED_TEST_P (SharedCircularBufferTestTemplate, TestCircular) | |
REGISTER_TYPED_TEST_CASE_P (SharedCircularBufferTestTemplate, TestCreate, TestAdd, TestClear, TestCircular) | |
TYPED_TEST_CASE_P (SharedDynamicStringMapTestTemplate) | |
TYPED_TEST_P (SharedDynamicStringMapTestTemplate, TestSimple) | |
TYPED_TEST_P (SharedDynamicStringMapTestTemplate, TestCreate) | |
TYPED_TEST_P (SharedDynamicStringMapTestTemplate, TestAdd) | |
TYPED_TEST_P (SharedDynamicStringMapTestTemplate, TestQuarterFull) | |
TYPED_TEST_P (SharedDynamicStringMapTestTemplate, TestFillSingleThread) | |
TYPED_TEST_P (SharedDynamicStringMapTestTemplate, TestFillMultipleNonOverlappingThreads) | |
TYPED_TEST_P (SharedDynamicStringMapTestTemplate, TestFillMultipleOverlappingThreads) | |
REGISTER_TYPED_TEST_CASE_P (SharedDynamicStringMapTestTemplate, TestSimple, TestCreate, TestAdd, TestQuarterFull, TestFillSingleThread, TestFillMultipleNonOverlappingThreads, TestFillMultipleOverlappingThreads) | |
TYPED_TEST_CASE_P (SharedMemLockManagerTestTemplate) | |
TYPED_TEST_P (SharedMemLockManagerTestTemplate, TestBasic) | |
TYPED_TEST_P (SharedMemLockManagerTestTemplate, TestDestructorUnlock) | |
TYPED_TEST_P (SharedMemLockManagerTestTemplate, TestSteal) | |
REGISTER_TYPED_TEST_CASE_P (SharedMemLockManagerTestTemplate, TestBasic, TestDestructorUnlock, TestSteal) | |
TYPED_TEST_CASE_P (SharedMemRefererStatisticsTestTemplate) | |
TYPED_TEST_P (SharedMemRefererStatisticsTestTemplate, TestGetDivLocationFromUrl) | |
TYPED_TEST_P (SharedMemRefererStatisticsTestTemplate, TestSimple) | |
TYPED_TEST_P (SharedMemRefererStatisticsTestTemplate, TestResource) | |
TYPED_TEST_P (SharedMemRefererStatisticsTestTemplate, TestIgnoreQueryParams) | |
TYPED_TEST_P (SharedMemRefererStatisticsTestTemplate, TestDivLocation) | |
TYPED_TEST_P (SharedMemRefererStatisticsTestTemplate, TestDumpFast) | |
TYPED_TEST_P (SharedMemRefererStatisticsTestTemplate, TestDumpSimple) | |
TYPED_TEST_P (SharedMemRefererStatisticsTestTemplate, TestDumpOrganized) | |
TYPED_TEST_P (SharedMemRefererStatisticsTestTemplate, TestMultiProcess) | |
REGISTER_TYPED_TEST_CASE_P (SharedMemRefererStatisticsTestTemplate, TestGetDivLocationFromUrl, TestSimple, TestResource, TestIgnoreQueryParams, TestDivLocation, TestDumpFast, TestDumpSimple, TestDumpOrganized, TestMultiProcess) | |
TYPED_TEST_CASE_P (SharedMemStatisticsTestTemplate) | |
TYPED_TEST_P (SharedMemStatisticsTestTemplate, TestCreate) | |
TYPED_TEST_P (SharedMemStatisticsTestTemplate, TestSet) | |
TYPED_TEST_P (SharedMemStatisticsTestTemplate, TestClear) | |
TYPED_TEST_P (SharedMemStatisticsTestTemplate, TestAdd) | |
TYPED_TEST_P (SharedMemStatisticsTestTemplate, TestSetReturningPrevious) | |
TYPED_TEST_P (SharedMemStatisticsTestTemplate, TestHistogram) | |
TYPED_TEST_P (SharedMemStatisticsTestTemplate, TestHistogramRender) | |
TYPED_TEST_P (SharedMemStatisticsTestTemplate, TestHistogramExtremeBuckets) | |
TYPED_TEST_P (SharedMemStatisticsTestTemplate, TestHistogramNoExtraClear) | |
TYPED_TEST_P (SharedMemStatisticsTestTemplate, TestTimedVariableEmulation) | |
TYPED_TEST_P (SharedMemStatisticsTestTemplate, TestConsoleStatisticsLogger) | |
REGISTER_TYPED_TEST_CASE_P (SharedMemStatisticsTestTemplate, TestCreate, TestSet, TestClear, TestAdd, TestSetReturningPrevious, TestHistogram, TestHistogramRender, TestHistogramNoExtraClear, TestHistogramExtremeBuckets, TestTimedVariableEmulation, TestConsoleStatisticsLogger) | |
TYPED_TEST_CASE_P (SharedMemTestTemplate) | |
TYPED_TEST_P (SharedMemTestTemplate, TestRewrite) | |
TYPED_TEST_P (SharedMemTestTemplate, TestRewriteReattach) | |
TYPED_TEST_P (SharedMemTestTemplate, TestLarge) | |
TYPED_TEST_P (SharedMemTestTemplate, TestDistinct) | |
TYPED_TEST_P (SharedMemTestTemplate, TestDestroy) | |
TYPED_TEST_P (SharedMemTestTemplate, TestCreateTwice) | |
TYPED_TEST_P (SharedMemTestTemplate, TestTwoKids) | |
TYPED_TEST_P (SharedMemTestTemplate, TestMutex) | |
REGISTER_TYPED_TEST_CASE_P (SharedMemTestTemplate, TestRewrite, TestRewriteReattach, TestLarge, TestDistinct, TestDestroy, TestCreateTwice, TestTwoKids, TestMutex) | |
template<class CharTransform , typename IntType > | |
IntType | HashString (const char *s, size_t len) |
size_t | JoinHash (size_t a, size_t b) |
GoogleString | IntegerToString (int i) |
GoogleString | Integer64ToString (int64 i) |
GoogleString | PointerToString (void *pointer) |
bool | StringToInt (const char *in, int *out) |
bool | StringToInt64 (const char *in, int64 *out) |
bool | StringToInt (const GoogleString &in, int *out) |
bool | StringToInt64 (const GoogleString &in, int64 *out) |
StringPiece | PieceAfterEquals (const StringPiece &piece) |
GoogleString | StrCat (const StringPiece &a, const StringPiece &b, const StringPiece &c=EmptyString::kEmptyString, const StringPiece &d=EmptyString::kEmptyString, const StringPiece &e=EmptyString::kEmptyString, const StringPiece &f=EmptyString::kEmptyString, const StringPiece &g=EmptyString::kEmptyString, const StringPiece &h=EmptyString::kEmptyString) |
void | StrAppend (GoogleString *target, const StringPiece &a, const StringPiece &b=EmptyString::kEmptyString, const StringPiece &c=EmptyString::kEmptyString, const StringPiece &d=EmptyString::kEmptyString, const StringPiece &e=EmptyString::kEmptyString, const StringPiece &f=EmptyString::kEmptyString, const StringPiece &g=EmptyString::kEmptyString, const StringPiece &h=EmptyString::kEmptyString) |
void | SplitStringPieceToVector (const StringPiece &sp, const StringPiece &separators, StringPieceVector *components, bool omit_empty_strings) |
void | SplitStringUsingSubstr (const StringPiece &full, const StringPiece &substr, StringPieceVector *result) |
void | BackslashEscape (const StringPiece &src, const StringPiece &to_escape, GoogleString *dest) |
GoogleString | CEscape (const StringPiece &src) |
bool | HasPrefixString (const StringPiece &str, const StringPiece &prefix) |
void | UpperString (GoogleString *str) |
void | LowerString (GoogleString *str) |
bool | OnlyWhitespace (const GoogleString &str) |
int | GlobalReplaceSubstring (const StringPiece &substring, const StringPiece &replacement, GoogleString *s) |
int | FindIgnoreCase (StringPiece haystack, StringPiece needle) |
GoogleString | JoinStringStar (const ConstStringStarVector &vector, const StringPiece &delim) |
char | UpperChar (char c) |
char | LowerChar (char c) |
char * | strdup (const char *str) |
int | StringCaseCompare (const StringPiece &s1, const StringPiece &s2) |
Case-insensitive string comparison that is locale-independent. | |
bool | IsAsciiAlphaNumeric (char ch) |
void | TrimWhitespace (const StringPiece &in, GoogleString *output) |
void | TrimWhitespace (StringPiece *str) |
void | TrimQuote (StringPiece *str) |
In-place removal of leading and trailing quote. | |
void | TrimLeadingWhitespace (StringPiece *str) |
Trims only whitespace at the beginning of the string. | |
bool | AccumulateDecimalValue (char c, uint32 *value) |
bool | AccumulateHexValue (char c, uint32 *value) |
bool | StringCaseEqual (const StringPiece &s1, const StringPiece &s2) |
Return true iff the two strings are equal, ignoring case. | |
bool | StringCaseStartsWith (const StringPiece &str, const StringPiece &prefix) |
Return true iff str starts with prefix, ignoring case. | |
bool | StringCaseEndsWith (const StringPiece &str, const StringPiece &suffix) |
Return true iff str ends with suffix, ignoring case. | |
bool | StringEqualConcat (const StringPiece &str, const StringPiece &first, const StringPiece &second) |
bool | EndsInSlash (const StringPiece &path) |
Does a path end in slash? | |
void | EnsureEndsInSlash (GoogleString *dir) |
Make sure directory's path ends in '/'. | |
void | ParseShellLikeString (const StringPiece &input, std::vector< GoogleString > *output) |
int | CountSubstring (const StringPiece &text, const StringPiece &substring) |
bool | HasIllicitTokenCharacter (const StringPiece &str) |
GoogleString * | StringVectorAdd (StringVector *v) |
Appends new empty string to a StringVector and returns a pointer to it. | |
bool | ConvertTimeToString (int64 time_ms, GoogleString *time_string) |
Converts time, in milliseconds, to a string. Returns false on failure. | |
bool | ConvertTimeToStringWithUs (int64 time_us, GoogleString *time_string) |
bool | ConvertStringToTime (const StringPiece &time_string, int64 *time_ms) |
TYPED_TEST_CASE_P (ThreadSystemTestTemplate) | |
TYPED_TEST_P (ThreadSystemTestTemplate, TestStartJoin) | |
TYPED_TEST_P (ThreadSystemTestTemplate, TestSync) | |
REGISTER_TYPED_TEST_CASE_P (ThreadSystemTestTemplate, TestStartJoin, TestSync) | |
Variables | |
const char | kPagespeedOriginalUrl [] = "mod_pagespeed_original_url" |
const ContentType & | kContentTypeHtml |
HTML-like (i.e. rewritable) text: | |
const ContentType & | kContentTypeXhtml |
const ContentType & | kContentTypeCeHtml |
const ContentType & | kContentTypeJavascript |
Other text: | |
const ContentType & | kContentTypeCss |
const ContentType & | kContentTypeText |
const ContentType & | kContentTypeXml |
const ContentType & | kContentTypeJson |
const ContentType & | kContentTypePng |
Images: | |
const ContentType & | kContentTypeGif |
const ContentType & | kContentTypeJpeg |
const ContentType & | kContentTypeSwf |
const ContentType & | kContentTypeWebp |
const ContentType & | kContentTypePdf |
Pdf: | |
const char | kGaSnippetGetTracker [] = "_modpagespeed_getRewriteTracker(" |
const char | kGaSnippetPrefix [] = " var pageTrackerMethodNames = [\n" |
const char | kGaSnippetSuffix [] = "})();\n" |
const char | kGAFuriousSnippet [] |
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. | |
const int | kStackBufferSize = 10000 |
for StringPiece
Constant for allocating stack buffers.
Thread-synchronization utility class for reproducing races in unit tests.
for FRIEND_TEST
namespace Json
for DCHECK
A set of utility functions for handling hostnames.
Use Chromium debug support.
Shared infrastructure for testing cache implementations.
Base class for tests which want a ServerContext.
for StringSet, etc
Some common routines and constants for tests dealing with Images.
Base class for tests which do rewrites within CSS.
namespace Css
for ResourcePtr
DO NOT EDIT. Generated by ./google_analytics_snippet_gen.py.
This permits the use of any UrlPollableAsyncFetcher as a synchronous fetcher.
HttpAttributes, HttpStatus.
Callbacks used for testing.
for size_t
for FILE
Unit-test framework for wget fetcher.
Infrastructure for testing html parsing and rewriting.
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.
The httpd header must be after the instaweb_context.h. Otherwise, the compiler will complain "strtoul_is_not_a_portable_function_use_strtol_instead".
This 'string' is not needed for this include. But removing it breaks PageSpeed Insights. See third_party/pagespeed/src/pagespeed/html/external_resource_filter.h Remove this once that one is fixed.
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),
for pair
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.
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.
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*.
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.
This contains things that are common between unit tests for Worker and its subclasses, such as runtime creation and various closures.
typedef std::set<Atom, AtomCompare> net_instaweb::AtomSet |
A set of atoms can be constructed very efficiently. Note that iteration over this set will *not* be in alphabetical order.
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.
bool net_instaweb::AccumulateDecimalValue | ( | char | c, |
uint32 * | value | ||
) |
Accumulates a decimal value from 'c' into *value. Returns false and leaves *value unchanged if c is not a decimal digit.
bool net_instaweb::AccumulateHexValue | ( | char | c, |
uint32 * | value | ||
) |
Accumulates a hex value from 'c' into *value Returns false and leaves *value unchanged if c is not a hex digit.
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, | ||
Image::Type | type, | ||
const StringPiece & | tmp_dir, | ||
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.
bool net_instaweb::ConvertStringToTime | ( | const StringPiece & | time_string, |
int64 * | time_ms | ||
) |
Converts time in string format, to the number of milliseconds since 1970. Returns false on failure.
bool net_instaweb::ConvertTimeToStringWithUs | ( | int64 | time_us, |
GoogleString * | time_string | ||
) |
Converts time, in microseconds, to a string with accuracy at us. Returns false on failure.
int net_instaweb::CountSubstring | ( | const StringPiece & | text, |
const StringPiece & | substring | ||
) |
Counts the number of times that substring appears in text Note: for a substring that can overlap itself, it counts not necessarily disjoint occurrences of the substring. For example: "aaa" appears in "aaaaa" 3 times, not once
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.
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.
int net_instaweb::GlobalReplaceSubstring | ( | const StringPiece & | substring, |
const StringPiece & | replacement, | ||
GoogleString * | s | ||
) |
Replaces all instances of 'substring' in 's' with 'replacement'. Returns the number of instances replaced. Replacements are not subject to re-matching.
NOTE: The string pieces must not overlap 's'.
IntType net_instaweb::HashString | ( | const char * | s, |
size_t | len | ||
) | [inline] |
A hash function for strings that can be used both in a case-sensitive and case-insensitive way
This implemention is based on code in third_party/chromium/src/base/hash_tables.h.
bool net_instaweb::HasIllicitTokenCharacter | ( | const StringPiece & | str | ) |
Returns true if the string contains a character that is not legal in an http header.
bool net_instaweb::HasPrefixString | ( | const StringPiece & | str, |
const StringPiece & | prefix | ||
) |
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::IsAsciiAlphaNumeric | ( | char | ch | ) | [inline] |
Determines whether the character is a US Ascii number or letter. This is preferable to isalnum() for working with computer languages, as opposed to human languages.
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'.
size_t net_instaweb::JoinHash | ( | size_t | a, |
size_t | b | ||
) | [inline] |
Combine two hash values in a reasonable way. Here to avoid excessive mysticism in the remainder of the code.
< Uses different prime multipliers.
GoogleString net_instaweb::JoinStringStar | ( | const ConstStringStarVector & | vector, |
const StringPiece & | delim | ||
) |
Output a string which is the combination of all values in vector, separated by delim. Does not ignore empty strings in vector. So: JoinStringStar({"foo", "", "bar"}, ", ") == "foo, , bar". (Pseudocode)
char net_instaweb::LowerChar | ( | char | c | ) | [inline] |
lower-case a single character and return it. tolower() changes based on locale. We don't want this!
Function* net_instaweb::MakeFunction | ( | C * | object, |
void(C::*)() | run, | ||
void(C::*)() | cancel | ||
) |
Makes a Function* that calls a 0-arg class method, or a 0-arg cancel method.
Function* net_instaweb::MakeFunction | ( | C * | object, |
void(C::*)(T) | run, | ||
void(C::*)(T) | cancel, | ||
T | t | ||
) |
Makes a Function* that calls a 1-arg class method, or a 0-arg cancel method.
Function* net_instaweb::MakeFunction | ( | C * | object, |
void(C::*)(T, U) | run, | ||
void(C::*)(T, U) | cancel, | ||
T | t, | ||
U | u | ||
) |
Makes a Function* that calls a 2-arg class method, or a 0-arg cancel method.
Function* net_instaweb::MakeFunction | ( | C * | object, |
void(C::*)(T, U, V) | run, | ||
void(C::*)(T, U, V) | cancel, | ||
T | t, | ||
U | u, | ||
V | v | ||
) |
Makes a Function* that calls a 3-arg class method, or a 0-arg cancel method.
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).
const ContentType* net_instaweb::NameExtensionToContentType | ( | const StringPiece & | name | ) |
Given a name (file or url), see if it has the canonical extension corresponding to a particular content type.
Image* net_instaweb::NewImage | ( | const StringPiece & | original_contents, |
const GoogleString & | url, | ||
const StringPiece & | file_prefix, | ||
Image::CompressionOptions * | options, | ||
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 webp_preferred flag indicates that webp output should be produced rather than jpg, unless webp creation fails for any reason (in which case jpg is used as a fallback). It has no effect if original_contents are a non-jpg or non-webp image format.
The jpeg_quality flag indicates what quality to use while recompressing jpeg images. Quality value of 75 is used as default for web images by most of the image libraries. Recommended setting for this is 85.
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, | ||
GoogleString * | compressed_webp | ||
) |
Optimizer in the style of pagespeed/image_compression/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::ParseContentType | ( | const StringPiece & | content_type_str, |
GoogleString * | mime_type, | ||
GoogleString * | charset | ||
) |
Extracts mime_type and charset from a string of the form "<mime_type>; charset=<charset>". If mime_type or charset is not specified, they will be populated with the empty string. Returns true if either a mime_type or a charset was extracted.
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.
void net_instaweb::ParseShellLikeString | ( | const StringPiece & | input, |
std::vector< GoogleString > * | output | ||
) |
Given a string such as: a b "c d" e 'f g' Parse it into a vector: ["a", "b", "c d", "e", "f g"]
StringPiece net_instaweb::PieceAfterEquals | ( | const StringPiece & | piece | ) |
Returns the part of the piece after the first '=', trimming any white space found at the beginning or end of the resulting piece. Returns an empty string if '=' was not found.
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.
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.
void net_instaweb::SlurpUrl | ( | ApacheServerContext * | manager, |
request_rec * | r | ||
) |
Loads the URL based on the fetchers and other infrastructure in the factory.
void net_instaweb::SplitStringPieceToVector | ( | const StringPiece & | sp, |
const StringPiece & | separators, | ||
StringPieceVector * | components, | ||
bool | omit_empty_strings | ||
) |
Split sp into pieces that are separated by any character in the given string of separators, and push those pieces in order onto components.
void net_instaweb::SplitStringUsingSubstr | ( | const StringPiece & | full, |
const StringPiece & | substr, | ||
StringPieceVector * | result | ||
) |
Splits string 'full' using substr by searching it incrementally from left. Empty tokens are removed from the final result.
GoogleString net_instaweb::StrCat | ( | const StringPiece & | a, |
const StringPiece & | b, | ||
const StringPiece & | c = EmptyString::kEmptyString , |
||
const StringPiece & | d = EmptyString::kEmptyString , |
||
const StringPiece & | e = EmptyString::kEmptyString , |
||
const StringPiece & | f = EmptyString::kEmptyString , |
||
const StringPiece & | g = EmptyString::kEmptyString , |
||
const StringPiece & | h = EmptyString::kEmptyString |
||
) |
bool net_instaweb::StringEqualConcat | ( | const StringPiece & | str, |
const StringPiece & | first, | ||
const StringPiece & | second | ||
) |
Return true if str is equal to the concatenation of first and second. Note that this respects case.
bool net_instaweb::StringToInt | ( | const char * | in, |
int * | out | ||
) | [inline] |
NOTE: For a string of the form "45x", this sets *out = 45 but returns false. It sets *out = 0 given "Junk45" or "".
bool net_instaweb::StringToInt64 | ( | const char * | in, |
int64 * | out | ||
) | [inline] |
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
char net_instaweb::UpperChar | ( | char | c | ) | [inline] |
See also: ./src/third_party/css_parser/src/strings/ascii_ctype.h We probably don't want our core string header file to have a dependecy on the Google CSS parser, so for now we'll write this here: upper-case a single character and return it. toupper() changes based on locale. We don't want this!
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 int net_instaweb::kStackBufferSize = 10000 |
Size of stack buffer for read-blocks. This can't be too big or it will blow the stack, which may be set small in multi-threaded environments.