Page Speed Optimization Libraries  1.13.35.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Namespaces | Classes | Typedefs | Enumerations | Functions | Variables
net_instaweb Namespace Reference

Unit-test framework for wget fetcher. More...

Namespaces

 css_util
 
 url
 Prepare for flattening of the namespaces in newer Chromiums.
 

Classes

class  MeasurementProxyRewriteOptionsManager
 
class  RewriteOptionsManager
 
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  CacheUrlAsyncFetcher
 
class  CountingUrlAsyncFetcher
 
class  ExternalUrlFetcher
 
class  FetcherTest
 
class  HTTPCache
 
struct  HttpCacheFailurePolicy
 
class  HttpCacheFailure
 
class  HttpDumpUrlAsyncWriter
 
class  HttpDumpUrlFetcher
 
class  HttpResponseParser
 
class  HTTPValue
 
class  HTTPValueWriter
 
class  InflatingFetch
 
class  ExpectStringAsyncFetch
 
class  MockUrlFetcher
 
class  RateController
 
class  RateControllingUrlAsyncFetcher
 
class  ReflectingTestFetcher
 
class  SimulatedDelayFetcher
 
class  SyncFetcherAdapterCallback
 Class to help run an asynchronous fetch synchronously with a timeout. More...
 
class  UserAgentSensitiveTestFetcher
 
class  UrlAsyncFetcher
 
class  UrlAsyncFetcherStats
 
class  WaitUrlAsyncFetcher
 
class  WgetUrlFetcher
 
class  ImageTestingPeer
 
class  AddHeadFilter
 
class  AddIdsFilter
 
class  AddInstrumentationFilter
 Injects javascript instrumentation for monitoring page-rendering time. More...
 
class  AssociationTransformer
 
class  AssociationSlot
 
class  BaseTagFilter
 
class  BeaconCriticalImagesFinder
 
class  CacheExtender
 
class  CacheableResourceBase
 
class  CollectDependenciesFilter
 
class  CommonFilter
 
class  CriticalCssBeaconFilter
 
struct  BeaconMetadata
 
class  CriticalImagesBeaconFilter
 
struct  CriticalImagesInfo
 
class  CriticalImagesFinder
 
class  TestCriticalImagesFinder
 
class  CriticalImagesFinderTestBase
 
class  CriticalSelectorFilter
 
struct  CriticalSelectorInfo
 
class  CriticalSelectorFinder
 
class  BeaconCriticalSelectorFinder
 
class  CspSourceExpression
 
class  CspSourceList
 
class  CspPolicy
 
class  CspContext
 
class  CssAbsolutify
 
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  DependencyTracker
 
class  DependencyOrderCompator
 Compares two Dependency objects based on the order_key field. More...
 
class  DeterministicJsFilter
 
class  DeviceProperties
 
class  DomStatsFilter
 Counts some basic statistics observed as HTML is parsed. More...
 
class  DomainLawyer
 
class  DomainRewriteFilter
 
class  DownstreamCachePurger
 
class  DownstreamCachingDirectives
 
class  ExperimentMatcher
 
class  FakeFilter
 
class  FileInputResource
 
class  FileLoadMapping
 
class  FileLoadMappingLiteral
 
class  FileLoadMappingRegexp
 
class  FileLoadPolicy
 
class  FileLoadRule
 
class  FileLoadRuleRegexp
 
class  FileLoadRuleLiteral
 
class  FixReflowFilter
 
class  FlushHtmlFilter
 
class  ScriptEditor
 Edit a substring in a script element. More...
 
class  GoogleAnalyticsFilter
 
class  GoogleFontCssInlineFilter
 
class  GoogleFontServiceInputResource
 
class  HandleNoscriptRedirectFilter
 
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  InlineAttributeSlot
 
class  InlineAttributeSlotComparator
 
class  InlineOutputResource
 
class  InlineResourceSlot
 
class  InlineResourceSlotComparator
 
class  InlineRewriteContext
 
class  InsertAmpLinkFilter
 Inserts a <link rel="amphtml"> link. More...
 
class  InsertDnsPrefetchFilter
 
class  InsertGAFilter
 
class  JavascriptRewriteConfig
 
class  JavascriptCodeBlock
 
class  JavascriptFilter
 
class  JavascriptSourceMapFilter
 
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  JsReplacer
 
class  LazyloadImagesFilter
 
class  LocalStorageCacheFilter
 
class  MakeShowAdsAsyncFilter
 
class  MeasurementProxyUrlNamer
 
class  MetaTagFilter
 
class  MockCriticalImagesFinder
 
class  MockResourceCallback
 
class  NotifyingFetch
 
class  OutputResource
 
class  PedanticFilter
 
class  ProcessContext
 
class  PushPreloadFilter
 
class  RedirectOnSizeLimitFilter
 
class  RequestProperties
 
class  Resource
 
struct  TimedBool
 A boolean with an expiration date. More...
 
class  ResourceCombiner
 
class  ResourceFetch
 
class  ResourceNamer
 
class  ResourceSlot
 
class  NullResourceSlot
 
class  FetchResourceSlot
 
class  HtmlResourceSlot
 
class  HtmlResourceSlotComparator
 
struct  ResponsiveImageCandidate
 
struct  ResponsiveVirtualImages
 
class  ResponsiveImageFirstFilter
 
class  ResponsiveImageSecondFilter
 
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
 
class  SrcSetSlotCollection
 
class  SrcSetSlotCollectionComparator
 Note: this is non-deterministic between executions. More...
 
class  SrcSetSlot
 
class  StaticAssetManager
 
class  StripScriptsFilter
 Remove all scripts from a web page. More...
 
class  StripSubresourceHintsFilter
 Removes rel=subresource links. More...
 
class  SupportNoscriptFilter
 
class  TestRewriteDriverFactory
 
class  TestUrlNamer
 
class  UrlInputResource
 
class  UrlLeftTrimFilter
 
class  UrlNamer
 
class  UrlPartnership
 
class  UsageDataReporter
 
class  ApacheConfig
 
class  ApacheFetch
 
class  ApacheMessageHandler
 
class  ApacheRequestContext
 
class  ApacheRewriteDriverFactory
 Creates an Apache RewriteDriver. More...
 
class  ApacheServerContext
 
class  ApacheThreadSystem
 
class  ApacheWriter
 
class  AprTimer
 
class  InstawebContext
 
class  InstawebHandler
 
class  SimpleBufferedApacheFetch
 
class  HtmlDetector
 
class  ProxyFetchFactory
 
class  ProxyFetchPropertyCallback
 
class  ProxyFetchPropertyCallbackCollector
 
class  ProxyFetch
 
class  ProxyInterface
 
class  ProxyUrlNamer
 
class  MockFilter
 
class  CreateFilterCallback
 
class  BackgroundFetchCheckingAsyncFetch
 
class  BackgroundFetchCheckingUrlAsyncFetcher
 
class  ProxyInterfaceTestBase
 
class  FileRewriter
 
class  StaticRewriter
 
class  CentralController
 
class  CentralControllerCallback
 
class  CentralControllerRpcClient
 
class  CentralControllerRpcServer
 
class  CompatibleCentralController
 
class  ContextRegistry
 
class  NotifyFunction
 
class  MockReaderWriterT
 
class  MockCentralControllerRpcServiceStub
 
class  ExpensiveOperationContext
 Passed to RunImpl for implementations of ExpensiveOperationCallback. More...
 
class  ExpensiveOperationCallback
 Implementor interface to ExpensiveOperation features in CentralController. More...
 
class  ExpensiveOperationController
 
class  ExpensiveOperationRpcContext
 
class  ExpensiveOperationRpcHandler
 
class  GrpcServerTest
 
class  InProcessCentralController
 
class  NamedLockScheduleRewriteController
 
class  PopularityContestScheduleRewriteController
 
class  PriorityQueue
 
class  QueuedExpensiveOperationController
 
class  RpcHolder
 
class  RequestResultRpcClient
 
class  RequestResultRpcHandler
 
class  RpcHandler
 
class  ScheduleRewriteContext
 Passed to RunImpl for implementations of ScheduleRewriteCallback. More...
 
class  ScheduleRewriteCallback
 Implementor interface to rewrite scheduling features in CentralController. More...
 
class  ScheduleRewriteController
 
class  ScheduleRewriteRpcContext
 
class  ScheduleRewriteRpcHandler
 
class  WorkBoundExpensiveOperationController
 
class  AbstractMutex
 Abstract interface for implementing a mutex. More...
 
class  ScopedMutex
 Helper class for lexically scoped mutexing. More...
 
class  AbstractSharedMemSegment
 
class  AbstractSharedMem
 
class  AnnotatedMessageHandler
 
class  Arena
 
class  SymbolTable
 
class  Atom
 
struct  AtomCompare
 
class  AtomicBool
 
class  AtomicInt32
 
class  CacheInterface
 Abstract interface for a cache. More...
 
class  Callback1
 
class  _MemberCallback_0_1
 
struct  remove_reference
 Specified by TR1 [4.7.2] Reference modifications. More...
 
struct  remove_reference< T & >
 
struct  ConstRef
 
class  _MemberCallback_1_1
 
class  Callback2
 
class  _MemberCallback_0_2
 
class  _MemberCallback_2_1
 
class  CheckingThreadSystem
 
class  ChunkingWriter
 
class  CircularBuffer
 
class  CountdownTimer
 
class  CountingWriter
 Delegates to another writer, but counts bytes along the way. More...
 
class  EnumSet
 Represents a set of values – implemented via a bitset. More...
 
class  FastWildcardGroup
 
class  FileMessageHandler
 
class  BoolOrError
 
class  FileSystem
 
class  FileSystemTest
 
class  CountingProgressNotifier
 
class  FileWriter
 Writer implementation for directing HTML output to a file. More...
 
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  MemberFunction4
 Captures a delayed call to a 4-arg member function as a closure. More...
 
class  GoogleMessageHandler
 
class  Hasher
 
class  InlineSList
 
class  InlineSListElement
 
class  JsonWriter
 Writes bytes to top json of the stack. More...
 
class  ManuallyRefCounted
 
class  MD5Hasher
 
class  MemFileSystem
 
class  MessageHandler
 
class  TestMessageHandler
 
class  MockHasher
 
class  MockMessageHandler
 
class  MockTimer
 
class  NamedLock
 Non-blocking locking class. More...
 
class  NamedLockManager
 
class  NamedLockTester
 
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  NullCondvar
 
class  NullCondvarCapableMutex
 
class  NullThreadSystem
 
class  NullWriter
 
class  Pool
 
class  PoolElement
 
class  PosixTimer
 
class  PrintMessageHandler
 A message handler that spews messages to stdout, with no annotation. More...
 
class  EqualsProtoMatcher
 
class  RefCounted
 
class  RefCountedPtr
 
class  RefCountedObj
 
class  RequestTrace
 
class  scoped_ptr
 
class  scoped_ptr< C[]>
 
class  scoped_array
 
class  SHA1Signature
 Implementation class of Signature, using HMAC-SHA1 for signing. More...
 
class  SharedString
 
class  Signature
 
class  SplitUpDownCounter
 
class  SplitVariable
 
class  SplitHistogram
 
class  SplitTimedVariable
 
class  SplitStatistics
 
class  SplitWriter
 SplitWriter writes to two sub-writers. More...
 
class  Variable
 
class  UpDownCounter
 
class  MutexedScalar
 
class  Histogram
 
class  CountHistogram
 Trivial implementation. But Count() returns a meaningful value. More...
 
class  TimedVariable
 
class  FakeTimedVariable
 TimedVariable implementation that only updates a basic UpDownCounter. More...
 
class  Statistics
 Base class for implementations of monitoring statistics. More...
 
class  StatisticsTemplate
 
class  VarTemplate
 
class  UpDownTemplate
 
class  ScalarStatisticsTemplate
 TimeDVariable. More...
 
class  StdioFileSystem
 
struct  CasePreserve
 A helper for case-sensitive hashing. More...
 
struct  CaseFold
 A helper for case-insensitive hashing, which folds to lowercase. More...
 
struct  CasePreserveStringHash
 Functors for constructing case-insensitive and case-sensitive hash-tables. More...
 
struct  CaseFoldStringHash
 
struct  CaseFoldStringEqual
 
struct  CasePreserveStringPieceHash
 
struct  CaseFoldStringPieceHash
 
struct  CaseFoldStringPieceEqual
 
class  StringMultiMap
 
class  StringMultiMapInsensitive
 
class  StringMultiMapSensitive
 
struct  CharStarCompareInsensitive
 
struct  CharStarCompareSensitive
 
struct  StringCompareSensitive
 
struct  StringCompareInsensitive
 
class  StringWriter
 Writer implementation for directing HTML output to a string. More...
 
class  ThreadSystem
 
class  Timer
 Timer interface, made virtual so it can be mocked for tests. More...
 
class  VectorDeque
 
class  Waveform
 
class  Wildcard
 
class  WildcardGroup
 
class  Writer
 Interface for writing bytes to an output stream. More...
 
class  AsyncCache
 
class  CacheBatcher
 
class  CacheBatcherTestingPeer
 
class  CacheKeyPrepender
 
class  CacheSpammer
 
class  CacheStats
 
class  CacheTestBase
 
class  CompressedCache
 Compressed cache adapter. More...
 
class  DelayCache
 See file comment. More...
 
class  DelegatingCacheCallback
 
class  FallbackCache
 
class  FileCache
 Simple C++ implementation of file cache. More...
 
class  InMemoryCache
 
class  LRUCache
 
class  LRUCacheBase
 
class  MockTimeCache
 See file comment. More...
 
class  PurgeContext
 
class  PurgeSet
 
class  ThreadsafeCache
 
class  WriteThroughCache
 Composes two caches to form a write-through cache. More...
 
class  AmpDocumentFilter
 
class  CanonicalAttributes
 
class  CollapseWhitespaceFilter
 
class  DisableTestFilter
 
class  DocType
 
class  ElideAttributesFilter
 Remove attributes and attribute values that can be safely elided. More...
 
class  EmptyHtmlFilter
 
class  ExplicitCloseTag
 
class  HtmlAttributeQuoteRemoval
 
class  HtmlElement
 
class  HtmlEvent
 
class  HtmlStartDocumentEvent
 
class  HtmlEndDocumentEvent
 
class  HtmlStartElementEvent
 
class  HtmlEndElementEvent
 
class  HtmlLeafNodeEvent
 
class  HtmlIEDirectiveEvent
 
class  HtmlCdataEvent
 
class  HtmlCommentEvent
 
class  HtmlCharactersEvent
 
class  HtmlDirectiveEvent
 
class  HtmlFilter
 
class  HtmlKeywords
 
class  HtmlLexer
 
class  HtmlName
 
class  HtmlNode
 
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
 Shared infrastructure for unit-testing the HTML parser. More...
 
class  HtmlParseTestBase
 
class  HtmlTestingPeer
 
class  HtmlWriterFilter
 Filter that serializes HTML to a Writer stream. More...
 
class  RemoveCommentsFilter
 
class  BotChecker
 
class  CachingHeaders
 
struct  ContentType
 
class  GoogleUrl
 class GoogleUrl More...
 
class  Headers
 Read/write API for HTTP headers (shared base class) More...
 
struct  HttpAttributes
 
struct  HttpOptions
 Any options which need to be accessed in http/ should be in here. More...
 
class  QueryParams
 Parses and rewrites URL query parameters. More...
 
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  UserAgentMatcher
 
class  UserAgentMatcherTestBase
 
class  UserAgentNormalizer
 
class  AndroidUserAgentNormalizer
 
class  IEUserAgentNormalizer
 
class  InProcessSharedMem
 
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  SharedMemCache
 Abstract interface for a cache. More...
 
class  SharedMemCacheDataTestBase
 
class  SharedMemCacheDataTestTemplate
 
class  SharedMemCacheTestBase
 
class  FileCacheTestWrapper
 
class  SharedMemCacheTestTemplate
 
class  SharedMemLockManager
 namespace SharedMemLockData More...
 
class  SharedMemLockManagerTestBase
 
class  SharedMemLockManagerTestTemplate
 
class  SharedMemVariable
 
class  SharedMemHistogram
 
class  SharedMemStatistics
 
class  SharedMemStatisticsTestBase
 
class  SharedMemStatisticsTestTemplate
 
class  SharedMemTestEnv
 
class  SharedMemTestBase
 
class  SharedMemTestTemplate
 
class  BlockingCallback
 Helper that blocks for async cache lookups. Used in tests. More...
 
class  CondvarTestBase
 
class  MockScheduler
 
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  QueuedAlarm
 
class  QueuedWorker
 See file comment. More...
 
class  QueuedWorkerPool
 
class  Scheduler
 
class  SchedulerBlockingFunction
 
class  SchedulerBasedAbstractLock
 
class  SchedulerThread
 
class  Sequence
 
class  SlowWorker
 See file comment. More...
 
class  ThreadSynchronizer
 
class  ThreadSystemTestBase
 
class  ThreadSystemTestTemplate
 
class  Worker
 
class  WorkerTestBase
 
class  DeleteNotifyFunction
 Function that signals on destruction and check fails when run. More...
 
class  BrotliInflater
 
class  CategorizedRefcount
 
class  CopyOnWrite
 
class  FileSystemLockManager
 
class  GzipInflater
 
class  HashedNonceGenerator
 
class  InputFileNonceGenerator
 
class  LockManagerSpammer
 
class  MemLock
 
class  MemLockManager
 
class  MemLockState
 Captures and maintains scheduling order for locks with a common name. More...
 
class  MockNonceGenerator
 A nonce generator that simply yields successive integers starting from 0. More...
 
class  NonceGenerator
 
class  NonceGeneratorTestBase
 
class  Platform
 
class  SimpleRandom
 
class  SimpleStatsVariable
 These variables are thread-safe. More...
 
class  SimpleStats
 Simple name/value pair statistics implementation. More...
 
class  StatisticsLogger
 
class  StatisticsLogfileReader
 Handles reading the logfile created by StatisticsLogger. More...
 
class  ThreadSafeLockManager
 Threadsafe wrapper for a non-threadsafe lock manager: MemLockManager. More...
 
class  UrlMultipartEncoder
 
class  UrlSegmentEncoder
 
class  UrlToFilenameEncoder
 Helper class for converting a URL into a filename. More...
 
class  ShowAdsSnippetParser
 Class that parses showads snippets. More...
 
class  AbstractPropertyStoreGetCallback
 
class  CachePropertyStore
 
class  FallbackPropertyPage
 
class  MockPropertyPage
 
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  PropertyStore
 
class  PropertyStoreGetCallback
 
class  RequestContext
 
class  TwoLevelPropertyStore
 
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  RequestTimingInfo
 
class  AddHeadersFetcher
 
class  AdminSite
 Implements the /pagespeed_admin pages. More...
 
class  AprMemCache
 
class  ControllerManager
 
class  ControllerProcess
 
struct  ExternalServerSpec
 
struct  ExternalClusterSpec
 
class  InPlaceResourceRecorder
 
class  LoopbackRouteFetcher
 See file comment. More...
 
class  RedisCache
 
struct  SerfStats
 
class  SerfUrlAsyncFetcher
 
class  SerfFetch
 
class  SystemCachePath
 
class  SystemCaches
 
class  SystemMessageHandler
 
class  SystemRequestContext
 
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  SystemThreadSystem
 
class  TcpConnectionForTesting
 
class  TcpServerThreadForTesting
 

Typedefs

typedef std::map< GoogleString,
std::pair< int32, int32 > > 
RenderedImageDimensionsMap
 
typedef RefCountedPtr
< CssResourceSlot
CssResourceSlotPtr
 
typedef RefCountedPtr
< InlineAttributeSlot
InlineAttributeSlotPtr
 
typedef std::set
< InlineAttributeSlotPtr,
InlineAttributeSlotComparator
InlineAttributeSlotSet
 
typedef RefCountedPtr
< InlineResourceSlot
InlineResourceSlotPtr
 
typedef std::set
< InlineResourceSlotPtr,
InlineResourceSlotComparator
InlineResourceSlotSet
 
typedef RefCountedPtr< ResourceResourcePtr
 
typedef std::vector< ResourcePtrResourceVector
 
typedef Callback2< const
GoogleUrl &, bool * > 
ResourceUrlClaimant
 
typedef RefCountedPtr
< ResourceSlot
ResourceSlotPtr
 
typedef RefCountedPtr
< HtmlResourceSlot
HtmlResourceSlotPtr
 
typedef std::vector
< ResourceSlotPtr
ResourceSlotVector
 
typedef std::set
< HtmlResourceSlotPtr,
HtmlResourceSlotComparator
HtmlResourceSlotSet
 
typedef std::vector
< ResponsiveImageCandidate
ResponsiveImageCandidateVector
 
typedef std::map< HtmlElement
*, ResponsiveVirtualImages
ResponsiveImageCandidateMap
 
typedef RefCountedPtr
< OutputResource
OutputResourcePtr
 
typedef std::vector
< OutputResourcePtr
OutputResourceVector
 
typedef RefCountedPtr
< SrcSetSlotCollection
SrcSetSlotCollectionPtr
 
typedef std::set
< SrcSetSlotCollectionPtr,
SrcSetSlotCollectionComparator
SrcSetSlotCollectionSet
 
typedef bool(* WebpProgressHook )(int percent, void *user_data)
 Progress hook for WebP conversions.
 
typedef Callback2< StringPiece,
bool * > 
HeaderPredicateFn
 
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< GoogleStringStringSet
 
typedef std::set< GoogleString,
StringCompareInsensitive
StringSetInsensitive
 
typedef std::vector< GoogleStringStringVector
 
typedef std::vector< StringPiece > StringPieceVector
 
typedef std::vector< const
GoogleString * > 
ConstStringStarVector
 
typedef std::vector
< GoogleString * > 
StringStarVector
 
typedef std::vector< const char * > CharStarVector
 
typedef SymbolTable< CaseFoldSymbolTableInsensitive
 
typedef SymbolTable< CasePreserveSymbolTableSensitive
 
typedef std::list< HtmlEvent * > HtmlEventList
 
typedef HtmlEventList::iterator HtmlEventListIterator
 
typedef std::set< const
HtmlEvent * > 
ConstHtmlEventSet
 
typedef std::vector
< PropertyPage * > 
PropertyPageStarVector
 
typedef RefCountedPtr
< RequestContext
RequestContextPtr
 
typedef std::vector
< std::unique_ptr
< TcpConnectionForTesting > > 
ConnectionList
 

Enumerations

enum  FetchResponseStatus {
  kFetchStatusNotSet = 0, kFetchStatusOK = 1, kFetchStatusUncacheable200 = 2, kFetchStatusUncacheableError = 3,
  kFetchStatus4xxError = 4, kFetchStatusOtherError = 5, kFetchStatusDropped = 6, kFetchStatusEmpty = 7
}
 
enum  BeaconStatus { kDoNotBeacon, kBeaconNoNonce, kBeaconWithNonce }
 
enum  CriticalKeysWriteFlags { kNoRequirementsOnPriorResult = 0, kReplacePriorResult = 1, kRequirePriorSupport = 2, kSkipNonceCheck = 4 }
 
enum  CspDirective {
  CspDirective::kChildSrc, kConnectSrc, kDefaultSrc, CspDirective::kFrameSrc,
  kImgSrc, CspDirective::kScriptSrc, kStyleSrc, CspDirective::kBaseUri,
  CspDirective::kNumSourceListDirectives
}
 
enum  InlineResult {
  INLINE_SUCCESS, INLINE_UNSUPPORTED_DEVICE, INLINE_NOT_CRITICAL, INLINE_NO_DATA,
  INLINE_TOO_LARGE, INLINE_CACHE_SMALL_IMAGES_UNREWRITTEN, INLINE_RESPONSIVE, INLINE_SHORTCUT,
  INLINE_INTERNAL_ERROR
}
 See MessageForInlineResult for enum meanings. More...
 
enum  OutputResourceKind { kRewrittenResource, kOnTheFlyResource, kInlineResource, kOutlinedResource }
 
enum  PropertyCacheDecodeResult { kPropertyCacheDecodeNotFound, kPropertyCacheDecodeExpired, kPropertyCacheDecodeParseError, kPropertyCacheDecodeOk }
 
enum  PropertyCacheUpdateResult { kPropertyCacheUpdateNotFound, kPropertyCacheUpdateEncodeError, kPropertyCacheUpdateOk }
 
enum  RenderOp { kDontRender, kRenderOnlyCspWarning, kRender }
 
enum  RewriteResult { kRewriteFailed, kRewriteOk, kTooBusy }
 
enum  MessageType { kInfo, kWarning, kError, kFatal }
 
enum  Encoding { UNKNOWN, BASE64, PLAIN }
 
enum  UrlRelativity { kAbsoluteUrl, kNetPath, kAbsolutePath, kRelativePath }
 namespace url More...
 
enum  SerfCompletionResult { kClientCancel, kSuccess, kFailure }
 

Functions

bool ValidateAndExpireNonce (int64 now_ms, StringPiece nonce, CriticalKeys *critical_keys)
 
void GetCriticalKeysFromProto (int64 support_percentage, const CriticalKeys &critical_keys, StringSet *keys)
 
void UpdateCriticalKeys (bool require_prior_support, const StringSet &new_set, int support_value, CriticalKeys *critical_keys)
 
bool ShouldBeacon (int64 next_beacon_timestamp_ms, const RewriteDriver &driver)
 
void WriteCriticalKeysToPropertyCache (const StringSet &new_keys, StringPiece nonce, int support_interval, CriticalKeysWriteFlags flags, StringPiece property_name, const PropertyCache *cache, const PropertyCache::Cohort *cohort, AbstractPropertyPage *page, MessageHandler *message_handler, Timer *timer)
 
void PrepareForBeaconInsertionHelper (CriticalKeys *proto, NonceGenerator *nonce_generator, RewriteDriver *driver, bool using_candidate_key_detection, BeaconMetadata *result)
 
bool UpdateCandidateKeys (const StringSet &keys, CriticalKeys *proto, bool clear_rebeacon_timestamp)
 
bool IsBeaconDataAvailable (const CriticalKeys &proto)
 
CspDirective LookupCspDirective (StringPiece name)
 Returns kNumSourceListDirectives if unrecognized.
 
ImageNewImage (const StringPiece &original_contents, const GoogleString &url, const StringPiece &file_prefix, Image::CompressionOptions *options, Timer *timer, MessageHandler *handler)
 
ImageBlankImageWithOptions (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. More...
 
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 PropertyValueDecodeFromPropertyCacheHelper (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, MessageHandler *message_handler)
 
bool ReduceWebpImageQuality (const GoogleString &original_webp, int quality, GoogleString *compressed_webp)
 
void ApacheRequestToRequestHeaders (const request_rec &request, RequestHeaders *request_headers, HeaderPredicateFn *predicate)
 
void ApacheRequestToRequestHeaders (const request_rec &request, RequestHeaders *request_headers)
 Fully converts apache request header structure into RequestHeaders.
 
void ApacheRequestToResponseHeaders (const request_rec &request, ResponseHeaders *headers, ResponseHeaders *err_headers)
 
void ResponseHeadersToApacheRequest (const ResponseHeaders &response_headers, request_rec *request)
 
void ErrorHeadersToApacheRequest (const ResponseHeaders &err_response_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.
 
GoogleString HeadersOutToString (request_rec *request)
 Get request->headers_out as a string, intended for tests.
 
GoogleString SubprocessEnvToString (request_rec *request)
 Get request->subprocess_env as a string, intended for tests.
 
void DisableCachingRelatedHeaders (request_rec *request)
 Updates headers related to caching (but not Cache-Control).
 
void DisableCacheControlHeader (request_rec *request)
 
template<class T >
apr_status_t apache_cleanup (void *object)
 Generic deleter meant to be used with apr_pool_cleanup_register().
 
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)
 
template<class T1 , class T2 , class A1 >
_MemberCallback_0_1< T1, A1,
true >::base * 
NewCallback (T1 *obj, void(T2::*member)(A1))
 Creates a callback that automatically gets deleted after being run.
 
template<class T1 , class T2 , class A1 >
_MemberCallback_0_1< T1, A1,
false >::base * 
NewPermanentCallback (T1 *obj, void(T2::*member)(A1))
 Creates a callback that does not get deleted after being run.
 
template<class T1 , class T2 , class P1 , class A1 >
_MemberCallback_1_1< T1, P1,
A1, true >::base * 
NewCallback (T1 *obj, void(T2::*member)(P1, A1), typename ConstRef< P1 >::type p1)
 Creates a callback that automatically gets deleted after being run.
 
template<class T1 , class T2 , class P1 , class A1 >
_MemberCallback_1_1< T1, P1,
A1, false >::base * 
NewPermanentCallback (T1 *obj, void(T2::*member)(P1, A1), typename ConstRef< P1 >::type p1)
 Creates a callback that does not get deleted after being run.
 
template<class T1 , class T2 , class A1 , class A2 >
_MemberCallback_0_2< T1, A1,
A2, true >::base * 
NewCallback (T1 *obj, void(T2::*member)(A1, A2))
 Creates a callback that automatically gets deleted after being run.
 
template<class T1 , class T2 , class A1 , class A2 >
_MemberCallback_0_2< T1, A1,
A2, false >::base * 
NewPermanentCallback (T1 *obj, void(T2::*member)(A1, A2))
 Creates a callback that does not get deleted after being run.
 
template<class T1 , class T2 , class P1 , class A1 , class A2 >
_MemberCallback_2_1< T1, P1,
A1, A2, true >::base * 
NewCallback (T1 *obj, void(T2::*member)(P1, A1, A2), typename ConstRef< P1 >::type p1)
 Creates a callback that automatically gets deleted after being run.
 
template<class T1 , class T2 , class P1 , class A1 , class A2 >
_MemberCallback_2_1< T1, P1,
A1, A2, false >::base * 
NewPermanentCallback (T1 *obj, void(T2::*member)(P1, A1, A2), typename ConstRef< P1 >::type p1)
 Creates a callback that does not get deleted after being run.
 
bool StripUtf8Bom (StringPiece *contents)
 
const StringPiece GetCharsetForBom (const StringPiece contents)
 
GoogleString StackTraceString ()
 
void EscapeToJsStringLiteral (const StringPiece &original, bool add_quotes, GoogleString *escaped)
 
void EscapeToJsonStringLiteral (const StringPiece &original, bool add_quotes, GoogleString *escaped)
 
template<class C >
FunctionMakeFunction (C *object, void(C::*run)())
 Makes a Function* that calls a 0-arg class method.
 
template<class C >
FunctionMakeFunction (C *object, void(C::*run)(), void(C::*cancel)())
 
template<class C , class T >
FunctionMakeFunction (C *object, void(C::*run)(T), T t)
 Makes a Function* that calls a 1-arg class method.
 
template<class C , class T >
FunctionMakeFunction (C *object, void(C::*run)(T), void(C::*cancel)(T), T t)
 
template<class C , class T , class U >
FunctionMakeFunction (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 >
FunctionMakeFunction (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 >
FunctionMakeFunction (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 >
FunctionMakeFunction (C *object, void(C::*run)(T, U, V), void(C::*cancel)(T, U, V), T t, U u, V v)
 
template<class C , class T , class U , class V , class W >
FunctionMakeFunction (C *object, void(C::*run)(T, U, V, W), T t, U u, V v, W w)
 Makes a Function* that calls a 4-arg class method.
 
template<class C , class T , class U , class V , class W >
FunctionMakeFunction (C *object, void(C::*run)(T, U, V, W), void(C::*cancel)(T, U, V, W), T t, U u, V v, W w)
 
GoogleString GTestSrcDir ()
 
GoogleString GTestTempDir ()
 
GoogleString GetHostname ()
 Determine the local hostname.
 
bool IsLocalhost (StringPiece host_to_test, StringPiece hostname)
 
testing::PolymorphicMatcher
< EqualsProtoMatcher
EqualsProto (const GoogleString &x)
 
bool ParseProtoFromStringPiece (StringPiece sp, protobuf::MessageLite *proto)
 namespace protobuf
 
bool ParseTextFormatProtoFromString (const GoogleString &s, protobuf::Message *proto)
 
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)
 
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 UintToString (unsigned 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)
 
bool StringToDouble (const char *in, double *out)
 
bool StringToDouble (GoogleString in, double *out)
 
bool StringToDouble (StringPiece in, double *out)
 
StringPiece PieceAfterEquals (StringPiece piece)
 
GoogleString StrCat (StringPiece a, StringPiece b)
 
GoogleString StrCat (StringPiece a, StringPiece b, StringPiece c)
 
GoogleString StrCat (StringPiece a, StringPiece b, StringPiece c, StringPiece d)
 
GoogleString StrCat (StringPiece a, StringPiece b, StringPiece c, StringPiece d, StringPiece e)
 
GoogleString StrCat (StringPiece a, StringPiece b, StringPiece c, StringPiece d, StringPiece e, StringPiece f)
 
GoogleString StrCat (StringPiece a, StringPiece b, StringPiece c, StringPiece d, StringPiece e, StringPiece f, StringPiece g)
 
GoogleString StrCat (StringPiece a, StringPiece b, StringPiece c, StringPiece d, StringPiece e, StringPiece f, StringPiece g, StringPiece h)
 
GoogleString StrCat (StringPiece a, StringPiece b, StringPiece c, StringPiece d, StringPiece e, StringPiece f, StringPiece g, StringPiece h, StringPiece i)
 namescape internal More...
 
GoogleString StrCat (StringPiece a, StringPiece b, StringPiece c, StringPiece d, StringPiece e, StringPiece f, StringPiece g, StringPiece h, StringPiece i, StringPiece j)
 
GoogleString StrCat (StringPiece a, StringPiece b, StringPiece c, StringPiece d, StringPiece e, StringPiece f, StringPiece g, StringPiece h, StringPiece i, StringPiece j, StringPiece k)
 
GoogleString StrCat (StringPiece a, StringPiece b, StringPiece c, StringPiece d, StringPiece e, StringPiece f, StringPiece g, StringPiece h, StringPiece i, StringPiece j, StringPiece k, StringPiece l)
 
GoogleString StrCat (StringPiece a, StringPiece b, StringPiece c, StringPiece d, StringPiece e, StringPiece f, StringPiece g, StringPiece h, StringPiece i, StringPiece j, StringPiece k, StringPiece l, StringPiece m)
 
GoogleString StrCat (StringPiece a, StringPiece b, StringPiece c, StringPiece d, StringPiece e, StringPiece f, StringPiece g, StringPiece h, StringPiece i, StringPiece j, StringPiece k, StringPiece l, StringPiece m, StringPiece n)
 
GoogleString StrCat (StringPiece a, StringPiece b, StringPiece c, StringPiece d, StringPiece e, StringPiece f, StringPiece g, StringPiece h, StringPiece i, StringPiece j, StringPiece k, StringPiece l, StringPiece m, StringPiece n, StringPiece o)
 
GoogleString StrCat (StringPiece a, StringPiece b, StringPiece c, StringPiece d, StringPiece e, StringPiece f, StringPiece g, StringPiece h, StringPiece i, StringPiece j, StringPiece k, StringPiece l, StringPiece m, StringPiece n, StringPiece o, StringPiece p)
 
GoogleString StrCat (StringPiece a, StringPiece b, StringPiece c, StringPiece d, StringPiece e, StringPiece f, StringPiece g, StringPiece h, StringPiece i, StringPiece j, StringPiece k, StringPiece l, StringPiece m, StringPiece n, StringPiece o, StringPiece p, StringPiece q)
 
GoogleString StrCat (StringPiece a, StringPiece b, StringPiece c, StringPiece d, StringPiece e, StringPiece f, StringPiece g, StringPiece h, StringPiece i, StringPiece j, StringPiece k, StringPiece l, StringPiece m, StringPiece n, StringPiece o, StringPiece p, StringPiece q, StringPiece r)
 
GoogleString StrCat (StringPiece a, StringPiece b, StringPiece c, StringPiece d, StringPiece e, StringPiece f, StringPiece g, StringPiece h, StringPiece i, StringPiece j, StringPiece k, StringPiece l, StringPiece m, StringPiece n, StringPiece o, StringPiece p, StringPiece q, StringPiece r, StringPiece s)
 
GoogleString StrCat (StringPiece a, StringPiece b, StringPiece c, StringPiece d, StringPiece e, StringPiece f, StringPiece g, StringPiece h, StringPiece i, StringPiece j, StringPiece k, StringPiece l, StringPiece m, StringPiece n, StringPiece o, StringPiece p, StringPiece q, StringPiece r, StringPiece s, StringPiece t)
 
GoogleString StrCat (StringPiece a, StringPiece b, StringPiece c, StringPiece d, StringPiece e, StringPiece f, StringPiece g, StringPiece h, StringPiece i, StringPiece j, StringPiece k, StringPiece l, StringPiece m, StringPiece n, StringPiece o, StringPiece p, StringPiece q, StringPiece r, StringPiece s, StringPiece t, StringPiece u)
 
GoogleString StrCat (StringPiece a, StringPiece b, StringPiece c, StringPiece d, StringPiece e, StringPiece f, StringPiece g, StringPiece h, StringPiece i, StringPiece j, StringPiece k, StringPiece l, StringPiece m, StringPiece n, StringPiece o, StringPiece p, StringPiece q, StringPiece r, StringPiece s, StringPiece t, StringPiece u, StringPiece v)
 
GoogleString StrCat (StringPiece a, StringPiece b, StringPiece c, StringPiece d, StringPiece e, StringPiece f, StringPiece g, StringPiece h, StringPiece i, StringPiece j, StringPiece k, StringPiece l, StringPiece m, StringPiece n, StringPiece o, StringPiece p, StringPiece q, StringPiece r, StringPiece s, StringPiece t, StringPiece u, StringPiece v, StringPiece w)
 
GoogleString StrCat (StringPiece a, StringPiece b, StringPiece c, StringPiece d, StringPiece e, StringPiece f, StringPiece g, StringPiece h, StringPiece i, StringPiece j, StringPiece k, StringPiece l, StringPiece m, StringPiece n, StringPiece o, StringPiece p, StringPiece q, StringPiece r, StringPiece s, StringPiece t, StringPiece u, StringPiece v, StringPiece w, StringPiece x)
 
GoogleString StrCat (StringPiece a, StringPiece b, StringPiece c, StringPiece d, StringPiece e, StringPiece f, StringPiece g, StringPiece h, StringPiece i, StringPiece j, StringPiece k, StringPiece l, StringPiece m, StringPiece n, StringPiece o, StringPiece p, StringPiece q, StringPiece r, StringPiece s, StringPiece t, StringPiece u, StringPiece v, StringPiece w, StringPiece x, StringPiece y)
 
GoogleString StrCat (StringPiece a, StringPiece b, StringPiece c, StringPiece d, StringPiece e, StringPiece f, StringPiece g, StringPiece h, StringPiece i, StringPiece j, StringPiece k, StringPiece l, StringPiece m, StringPiece n, StringPiece o, StringPiece p, StringPiece q, StringPiece r, StringPiece s, StringPiece t, StringPiece u, StringPiece v, StringPiece w, StringPiece x, StringPiece y, StringPiece z)
 
void StrAppend (GoogleString *target, StringPiece a)
 
void StrAppend (GoogleString *target, StringPiece a, StringPiece b)
 
void StrAppend (GoogleString *target, StringPiece a, StringPiece b, StringPiece c)
 
void StrAppend (GoogleString *target, StringPiece a, StringPiece b, StringPiece c, StringPiece d)
 
void StrAppend (GoogleString *target, StringPiece a, StringPiece b, StringPiece c, StringPiece d, StringPiece e)
 
void StrAppend (GoogleString *target, StringPiece a, StringPiece b, StringPiece c, StringPiece d, StringPiece e, StringPiece f)
 
void StrAppend (GoogleString *target, StringPiece a, StringPiece b, StringPiece c, StringPiece d, StringPiece e, StringPiece f, StringPiece g)
 
void StrAppend (GoogleString *target, StringPiece a, StringPiece b, StringPiece c, StringPiece d, StringPiece e, StringPiece f, StringPiece g, StringPiece h)
 
void StrAppend (GoogleString *target, StringPiece a, StringPiece b, StringPiece c, StringPiece d, StringPiece e, StringPiece f, StringPiece g, StringPiece h, StringPiece i)
 
void SplitStringPieceToVector (StringPiece sp, StringPiece separators, StringPieceVector *components, bool omit_empty_strings)
 
void SplitStringUsingSubstr (StringPiece full, StringPiece substr, StringPieceVector *result)
 
void BackslashEscape (StringPiece src, StringPiece to_escape, GoogleString *dest)
 
GoogleString CEscape (StringPiece src)
 
bool HasPrefixString (StringPiece str, StringPiece prefix)
 
void UpperString (GoogleString *str)
 
void LowerString (GoogleString *str)
 
bool OnlyWhitespace (const GoogleString &str)
 
int GlobalReplaceSubstring (StringPiece substring, StringPiece replacement, GoogleString *s)
 
stringpiece_ssize_type FindIgnoreCase (StringPiece haystack, StringPiece needle)
 
int GlobalEraseBracketedSubstring (StringPiece left, StringPiece right, GoogleString *string)
 
GoogleString JoinStringStar (const ConstStringStarVector &vector, StringPiece delim)
 
char UpperChar (char c)
 
char LowerChar (char c)
 
char IsHtmlSpace (char c)
 
char * strdup (const char *str)
 
int StringCaseCompare (StringPiece s1, StringPiece s2)
 Case-insensitive string comparison that is locale-independent.
 
bool IsAsciiAlphaNumeric (char ch)
 
bool IsHexDigit (char c)
 Convenience functions.
 
bool IsDecimalDigit (char c)
 
bool TrimWhitespace (StringPiece *str)
 
void TrimQuote (StringPiece *str)
 In-place removal of leading and trailing quote. Removes whitespace as well.
 
void TrimUrlQuotes (StringPiece *str)
 
bool TrimLeadingWhitespace (StringPiece *str)
 Trims leading HTML whitespace. Returns true if any whitespace was trimmed.
 
bool TrimTrailingWhitespace (StringPiece *str)
 Trims trailing HTML whitespace. Returns true if any whitespace was trimmed.
 
void TrimWhitespace (StringPiece in, GoogleString *output)
 
bool AccumulateDecimalValue (char c, uint32 *value)
 
bool AccumulateHexValue (char c, uint32 *value)
 
bool MemCaseEqual (const char *s1, size_t size1, const char *s2, size_t size2)
 Return true iff the two strings are equal, ignoring case.
 
bool StringCaseEqual (StringPiece s1, StringPiece s2)
 
bool StringCaseStartsWith (StringPiece str, StringPiece prefix)
 Return true iff str starts with prefix, ignoring case.
 
bool StringCaseEndsWith (StringPiece str, StringPiece suffix)
 Return true iff str ends with suffix, ignoring case.
 
bool StringEqualConcat (StringPiece str, StringPiece first, StringPiece second)
 
int CountCharacterMismatches (StringPiece s1, StringPiece s2)
 
bool SplitStringPieceToIntegerVector (StringPiece src, StringPiece separators, std::vector< int > *ints)
 
bool EndsInSlash (StringPiece path)
 Does a path end in slash?
 
void EnsureEndsInSlash (GoogleString *dir)
 Make sure directory's path ends in '/'.
 
void ParseShellLikeString (StringPiece input, std::vector< GoogleString > *output)
 
int CountSubstring (StringPiece text, StringPiece substring)
 
GoogleStringStringVectorAdd (StringVector *v)
 Appends new empty string to a StringVector and returns a pointer to it.
 
template<typename I >
void AppendJoinIterator (GoogleString *dest, I start, I end, StringPiece sep)
 Append string-like objects accessed through an iterator. More...
 
template<typename C >
void AppendJoinCollection (GoogleString *dest, const C &collection, StringPiece sep)
 
template<typename C >
GoogleString JoinCollection (const C &collection, StringPiece sep)
 
const char * BoolToString (bool b)
 Converts a boolean to string.
 
bool IsAscii (char c)
 Using isascii with signed chars is unfortunately undefined.
 
bool IsNonControlAscii (char c)
 
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)
 
const ContentTypeNameExtensionToContentType (const StringPiece &name)
 
const ContentTypeMimeTypeToContentType (const StringPiece &mime_type)
 
bool ParseContentType (const StringPiece &content_type_str, GoogleString *mime_type, GoogleString *charset)
 
void MimeTypeListToContentTypeSet (const GoogleString &in, std::set< const ContentType * > *out)
 
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)
 
 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 (SharedMemCacheDataTestTemplate)
 
 TYPED_TEST_P (SharedMemCacheDataTestTemplate, TestFreeList)
 
 TYPED_TEST_P (SharedMemCacheDataTestTemplate, TestLRU)
 
 TYPED_TEST_P (SharedMemCacheDataTestTemplate, TestBlockLists)
 
 REGISTER_TYPED_TEST_CASE_P (SharedMemCacheDataTestTemplate, TestFreeList, TestLRU, TestBlockLists)
 
 TYPED_TEST_CASE_P (SharedMemCacheTestTemplate)
 
 TYPED_TEST_P (SharedMemCacheTestTemplate, TestBasic)
 
 TYPED_TEST_P (SharedMemCacheTestTemplate, TestReinsert)
 
 TYPED_TEST_P (SharedMemCacheTestTemplate, TestReplacement)
 
 TYPED_TEST_P (SharedMemCacheTestTemplate, TestReaderWriter)
 
 TYPED_TEST_P (SharedMemCacheTestTemplate, TestConflict)
 
 TYPED_TEST_P (SharedMemCacheTestTemplate, TestEvict)
 
 TYPED_TEST_P (SharedMemCacheTestTemplate, TestSnapshot)
 
 TYPED_TEST_P (SharedMemCacheTestTemplate, TestRegisterSnapshotFileCache)
 
 TYPED_TEST_P (SharedMemCacheTestTemplate, TestCheckpointAndRestore)
 
 REGISTER_TYPED_TEST_CASE_P (SharedMemCacheTestTemplate, TestBasic, TestReinsert, TestReplacement, TestReaderWriter, TestConflict, TestEvict, TestSnapshot, TestRegisterSnapshotFileCache, TestCheckpointAndRestore)
 
 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 (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)
 
 REGISTER_TYPED_TEST_CASE_P (SharedMemStatisticsTestTemplate, TestCreate, TestSet, TestClear, TestAdd, TestSetReturningPrevious, TestHistogram, TestHistogramRender, TestHistogramNoExtraClear, TestHistogramExtremeBuckets, TestTimedVariableEmulation)
 
 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)
 
 TYPED_TEST_CASE_P (ThreadSystemTestTemplate)
 
 TYPED_TEST_P (ThreadSystemTestTemplate, TestStartJoin)
 
 TYPED_TEST_P (ThreadSystemTestTemplate, TestSync)
 
 REGISTER_TYPED_TEST_CASE_P (ThreadSystemTestTemplate, TestStartJoin, TestSync)
 
void ParseGflags (const char *progname, int *argc, char ***argv)
 
Matcher< ImageRewriteInfoLogImageRewriteActivityMatcher (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)
 
apr_pool_t * AprCreateThreadCompatiblePool (apr_pool_t *parent_pool)
 

Variables

const char kGaSnippetGetTracker [] = "_modpagespeed_getRewriteTracker("
 
const char kGaSnippetPrefix []
 
const char kGaSnippetSuffix []
 
const int64 kBeaconTimeoutIntervalMs = Timer::kMinuteMs
 
const int64 kHighFreqBeaconCount = 3
 
const int64 kLowFreqBeaconMult = 100
 
const int64 kNonceExpirationLimit = 5
 
const char kGAExperimentSnippet []
 Visible only for use in tests.
 
const char kGAJsSnippet []
 
const char kAnalyticsJsSnippet []
 
const char kAnalyticsJsIncreaseSiteSpeedTracking []
 
const char kAnalyticsJsIncreaseSiteSpeedTrackingMinimal []
 
const char kContentExperimentsJsClientUrl []
 
const char kContentExperimentsNonNumericVariantComment []
 
const char kContentExperimentsSetChosenVariationSnippet []
 
const char kContentExperimentsSetExpAndVariantSnippet []
 
const char kGASpeedTracking []
 
const int kNoQualityGiven = -1
 
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 kModPagespeedInPlaceFixHeadersName []
 Second filter fixes headers to avoid caching by shared proxies. More...
 
const char kModPagespeedInPlaceCheckHeadersName []
 
const char kPageUrl [] = "page.html"
 
const char kBackgroundFetchHeader [] = "X-Background-Fetch"
 
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. More...
 
const int kStackBufferSize = 10000
 
const ContentTypekContentTypeHtml
 HTML-like (i.e. rewritable) text:
 
const ContentTypekContentTypeXhtml
 
const ContentTypekContentTypeCeHtml
 
const ContentTypekContentTypeJavascript
 Other text:
 
const ContentTypekContentTypeCss
 
const ContentTypekContentTypeText
 
const ContentTypekContentTypeXml
 
const ContentTypekContentTypeJson
 
const ContentTypekContentTypeSourceMap
 
const ContentTypekContentTypePng
 Images:
 
const ContentTypekContentTypeGif
 
const ContentTypekContentTypeJpeg
 
const ContentTypekContentTypeSwf
 
const ContentTypekContentTypeWebp
 
const ContentTypekContentTypeIco
 
const ContentTypekContentTypePdf
 PDF:
 
const ContentTypekContentTypeBinaryOctetStream
 Binary/octet-stream.
 
const HttpOptions kDefaultHttpOptionsForTests
 
const HttpOptions kDeprecatedDefaultHttpOptions
 
const int kNumIterations
 Number of iterations of nonce generation to check in tests.
 
const int kSmallNumIterations
 

Detailed Description

Unit-test framework for wget fetcher.

Mock PropertyPage for use in unit tests.

Thread-synchronization utility class for reproducing races in unit tests.

Infrastructure for testing html parsing and rewriting.

Shared infrastructure for testing cache implementations.

Helper class for sending concurrent traffic to a cache during unit tests.

for pair

Constant for allocating stack buffers.

for StringPiece

namespace net_instaweb

for vector

namespace Json

for DCHECK

A set of utility functions for handling hostnames.

Use Chromium debug support.

Callback classes to support rewrite scheduling in CentralController.

Priority queue that supports incrementing the priority of a key.

Callback classes to support ExpensiveOperation features in CentralController.

extern "C"

Base class for tests which want a ServerContext.

for NULL

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.

Callbacks used for testing.

for size_t

for FILE

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),

Todo:
TODO(sligocki): Find a way to forward declare FileSystem::InputFile.

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.

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*.

Todo:
TODO(skerner): #include image_spriter.pb.h is needed to allow use of enum ImageFormat. Break this dependency and remove the include.
Todo:
TODO(huibao): Move LibpngImageLibrary to pagespeed/kernel/image/. Refactor LibpngImageLibrary. This class can be split into 3 parts: reader, writer, and canvas creater. The first two parts can be merged with png_optimizer.cc and png_optimizer.h.

The httpd header must be after the apache_rewrite_driver_factory.h. Otherwise, the compiler will complain "strtoul_is_not_a_portable_function_use_strtol_instead".

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".

Implementation of ScheduleRewriteController that uses priority queue to process rewrites in the order of most requested. Gurantees that at most one client will be waiting for a given key. Also limits the number of queued rewrites and the number of rewrites running in parallel.

Every request is tracked in a Rewrite object, the lifetime of which is described by the following state digram:

 begin
   |

+--—v--—+ | | Queue full | STOPPED +--------—> delete <------—+ | | | +--—+--—+ | | | ScheduleRewrite() | Other Rewrite needs | +-—+ | slot in queue and | | | ScheduleRewrite() | this is oldest rewrite +--—v-—+-+ | (increments priority | in AWAITING_RETRY. | <–+ discards old request) | | QUEUED | | | <–+ ScheduleRewrite() +–+----—+ +--—+---—+ | (increments priority)| | | +--------------------—+ AWAITING | Pop Queue | RETRY | (when most requested) | | | +-—^--—+ | +--—+ | | | | ScheduleRewrite() | +--—v—+-+ | (increments priority | | | | rejects new request) | | RUNNING <—+ | | | | +–+-—+—+ | | | | | +---------------------------------—+ | NotifyFailure() | +--------------------------—> delete NotifySuccess()

RequestResultRpcClient manages the client portion of a gRPC connection. It is the client-side counterpart to RequestResultRpcHandler. See class comments below.

RpcHandler for the case there the client uses a streaming RPC to the server to attempt an operation, waits for response and then calls back to let the server know it's done.

The first message on the RPC will result in a call to HandleClientRequest(), which the client should use to notify its controller of a request. When the controller decides if it will allow the rewrite to proceed it invokes the provided callback and we return that decision to the client via NotifyClient(). Once the client completes, it sends back a final message which will result in a final call to HandleClientResult().

If the client disconnects after the call to HandleClientRequest() but before the call to HandleClientResult(), we call HandleOperationFailed() to let the subclass know.

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.

Todo:
TODO(huibao): Rename GoogleMessageHandler and google_message_handler to reflect the fact that they are not google specific.

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.

Chromium has moved scoped_ptr.h from base directory to base/memory. Thankfully, even older version we built against had it available in base/memory, just with the compatibility alias still available.

for size_t for memcpy

NOTE: THIS CODE IS DEAD. IT IS ONLY LINKED BY THE SPEED_TEST PROVING IT'S SLOWER THAN FastWildcardGroup, PLUS ITS OWN UNIT TEST.

This file defines the MultipleFrame API for reading and writing static and animated images.

DO NOT INCLUDE LIBJPEG HEADERS HERE. Doing so causes build errors on Windows.

Note: we should not include setjmp.h here, since libpng 1.2 headers include it themselves, and get unhappy if we do it ourselves.

This file provides two sets of adapters for use by {Scanline, MultipleFrame} clients wishing to use code provided by the {MultipleFrame, Scanline} classes.

Data structure operation helpers for SharedMemCache. See the top of shared_mem_cache.cc for data format descriptions.

This contains things that are common between unit tests for Worker and its subclasses, such as runtime creation and various closures.

Todo:
TODO(gee): Hmm, this sort of sucks. If your .cc file needs to use the types declared in logging_proto.h, you must also include pagespeed/opt/logging/logging_proto_impl.h See that header file for an explanation of why this is necessary.

Typedef Documentation

A set of atoms can be constructed very efficiently. Note that iteration over this set will not be in alphabetical order.

typedef Callback2<StringPiece, bool*> net_instaweb::HeaderPredicateFn

Defines a predicate function used to select which request-headers to copy. The callback sets the bool* arg (.second) to true if it wants to include the header.

The StringPiece is the name of the header.

Sometimes some portions of URL space need to be handled differently by dedicated resource subclasses. ResourceProvider callbacks are used to teach RewriteDriver about these, so it knows not to build regular UrlInputResource objects.

typedef google::protobuf::io::StringOutputStream net_instaweb::StringOutputStream
Todo:
TODO(sligocki): Get rid of these special cases.

Enumeration Type Documentation

Enumerator
kNoRequirementsOnPriorResult 

Nice name for lack of next two flags.

Directives mentioned in the spec that we care (and comments for those where we don't).

Enumerator
kChildSrc 

These take source list:

kFrameSrc 

font-src doesn't actually matter for us since the Google font support only touches the loader CSS, not the font URL itself.

kScriptSrc 

manifest-src media-src object-src

kBaseUri 

worker-src

kNumSourceListDirectives 

form-action frame-ancestors These take other stuff. If we actually parsed them, we would want to distinguish them so we don't stick them into the array of CspSourceList* the other stuff goes into. plugin-types sandbox —

Todo:
TODO(morlovich): Understand implications of this. disown-opener report-uri report-to
Enumerator
UNKNOWN 

Used only for output of ParseDataUrl.

PLAIN 

LATIN1, ///<

Todo:
TODO(jmaessen): implement non-BASE64 encodings. UTF8,

This enumerates different states of the fetched response. This module is mostly concerned with specific failure statuses, but it's convenient to have non-failure ones in the same enum.

See MessageForInlineResult for enum meanings.

Enumerator
INLINE_RESPONSIVE 

Image should not be inlined because it is part of a responsive image.

Enumerator
kRewrittenResource 

Derived from some input resource URL or URLs.

kOnTheFlyResource 

Derived from some input resource URL or URLs in a very inexpensive way — it makes no sense to cache the output contents.

kInlineResource 

Inline output resource derived from inline input resource. Thus neither input nor output have URLs. These output resources will never be fetched from the cache, so we do not store them there. Instead the result is stored in the metadata cache.

kOutlinedResource 

External output resource derived from inline input resource. Thus input has no URL.

Enumerator
kPropertyCacheDecodeNotFound 

includes property cache not being enabled.

Enumerator
kPropertyCacheUpdateNotFound 

can't find existing value to update

Used to signal whether optimization was successful or not to RewriteContext::RewriteDone.

Enumerator
kRewriteFailed 

rewrite is impossible or undesirable

kRewriteOk 

rewrite went fine

kTooBusy 

the system is temporarily too busy to handle this rewrite request; no conclusion can be drawn on whether it's worth trying again or not.

namespace url

Enumerator
kAbsoluteUrl 

http://example.com/foo/bar/file.ext?k=v#f

kNetPath 

//example.com/foo/bar/file.ext?k=v::f

kAbsolutePath 

/foo/bar/file.ext?k=v::f

kRelativePath 

bar/file.ext?k=v::f

Function Documentation

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::ApacheRequestToRequestHeaders ( const request_rec &  request,
RequestHeaders *  request_headers,
HeaderPredicateFn *  predicate 
)

Converts Apache header structure into RequestHeaders, selecting only those for which the predicate sets its bool* argument to true. If the predicate is NULL, then all the headers are transferred.

The predicate should be created with NewPermanentCallback and stored in a scoped_ptr<Callback2>, so that it is deleted after this function completes.

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.

template<typename C >
void net_instaweb::AppendJoinCollection ( GoogleString dest,
const C &  collection,
StringPiece  sep 
)

Append an arbitrary iterable collection of strings such as a StringSet, StringVector, or StringPieceVector, separated by a given separator, with given initial and final strings. Argument order chosen to be consistent with StrAppend.

template<typename I >
void net_instaweb::AppendJoinIterator ( GoogleString dest,
start,
end,
StringPiece  sep 
)

Append string-like objects accessed through an iterator.

Skip a lot of set-up and tear-down in empty case.

< No separator before initial element

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!

WARNING: you must not call apr_pool_clear on the returned pool. The returned pool can be used to create sub-pools that can be accessed in distinct threads, due to a mutex injected into the allocator. However, if you call apr_pool_clear on the returned pool, the allocator's mutex will be freed and the pointer to it will be dangling. Subsequent allocations are likely to crash.

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 4-channel image transparent 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::CountCharacterMismatches ( StringPiece  s1,
StringPiece  s2 
)

Return the number of mismatched chars in two strings. Useful for string comparisons without short-circuiting to prevent timing attacks. See http://codahale.com/a-lesson-in-timing-attacks/

int net_instaweb::CountSubstring ( StringPiece  text,
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.

template<typename T >
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

template<typename T >
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::DisableCacheControlHeader ( 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.

void net_instaweb::ErrorHeadersToApacheRequest ( const ResponseHeaders &  err_response_headers,
request_rec *  request 
)

Converts ResponseHeaders into Apache request err_headers. This function does not alter the status code or the major/minor version of the Apache request.

void net_instaweb::EscapeToJsonStringLiteral ( const StringPiece &  original,
bool  add_quotes,
GoogleString escaped 
)

Appends version of original escaped for JSON string syntax to *escaped, (optionally with quotes, if asked).

Warning: this is dangerous if you have non-ASCII characters, in that it doesn't interpret the input encoding, and will just blindly turn them into escapes. However, it will ensure that the output won't have any dangerous characters that can cause format sniff.

void net_instaweb::EscapeToJsStringLiteral ( const StringPiece &  original,
bool  add_quotes,
GoogleString escaped 
)

Appends version of original escaped for JS string syntax, safe for inclusion into HTML, to *escaped, (optionally with quotes, if asked).

stringpiece_ssize_type net_instaweb::FindIgnoreCase ( StringPiece  haystack,
StringPiece  needle 
)

Returns the index of the start of needle in haystack, or StringPiece::npos if it's not present.

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.

void net_instaweb::GetCriticalKeysFromProto ( int64  support_percentage,
const CriticalKeys &  critical_keys,
StringSet *  keys 
)

Generate a list of the critical keys from a proto, storing it into keys. Takes into account legacy keys that may have been added before. A key is considered critical if its support is at least support_percentage of the maximum possible support value (which ramps up as beacon results arrive). When support_percentage = 0, any support is sufficient; when support_percentage = 100 all beacon results must support criticality.

int net_instaweb::GlobalEraseBracketedSubstring ( StringPiece  left,
StringPiece  right,
GoogleString string 
)

Erase shortest substrings in string bracketed by left and right, working from the left. ("[", "]", "abc[def]g[h]i]j[k") -> "abcgi]j[k" Returns the number of substrings erased.

int net_instaweb::GlobalReplaceSubstring ( StringPiece  substring,
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'.

template<class CharTransform , typename IntType >
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::HasPrefixString ( StringPiece  str,
StringPiece  prefix 
)
Todo:
TODO(jmarantz): Eliminate these definitions of HasPrefixString, UpperString, and LowerString, and re-add dependency on protobufs which also provide definitions for these.
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::IsBeaconDataAvailable ( const CriticalKeys &  proto)
inline

Based on the CriticalKeys data seen so far, describe whether beacon metadata is available. This returns false until data is received.

char net_instaweb::IsHtmlSpace ( char  c)
inline

Check if given character is an HTML (or CSS) space (not the same as isspace, and not locale-dependent!). Note in particular that isspace always includes '' and HTML does not. See: http://www.whatwg.org/specs/web-apps/current-work/multipage/common-microsyntaxes.html#space-character http://www.w3.org/TR/CSS21/grammar.html

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:

TODO(sligocki): Cover other representations of IPv6 localhost IP?

TODO(matterbury): Handle all 127.0.0.0/8 address since they are 'localhost'.

bool net_instaweb::IsNonControlAscii ( char  c)
inline

Tests if c is a standard (non-control) ASCII char 0x20-0x7E. Note: This does not include TAB (0x09), LF (0x0A) or CR (0x0D).

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,
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)

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.

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!

template<class C >
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.

template<class C , class T >
Function* net_instaweb::MakeFunction ( C *  object,
void(C::*)(T)  run,
void(C::*)(T)  cancel,
t 
)

Makes a Function* that calls a 1-arg class method, or a 1-arg cancel method.

template<class C , class T , class U >
Function* net_instaweb::MakeFunction ( C *  object,
void(C::*)(T, U)  run,
void(C::*)(T, U)  cancel,
t,
u 
)

Makes a Function* that calls a 2-arg class method, or a 2-arg cancel method.

template<class C , class T , class U , class V >
Function* net_instaweb::MakeFunction ( C *  object,
void(C::*)(T, U, V)  run,
void(C::*)(T, U, V)  cancel,
t,
u,
v 
)

Makes a Function* that calls a 3-arg class method, or a 3-arg cancel method.

template<class C , class T , class U , class V , class W >
Function* net_instaweb::MakeFunction ( C *  object,
void(C::*)(T, U, V, W)  run,
void(C::*)(T, U, V, W)  cancel,
t,
u,
v,
w 
)

Makes a Function* that calls a 4-arg class method, or a 4-arg cancel method.

void net_instaweb::MimeTypeListToContentTypeSet ( const GoogleString in,
std::set< const ContentType * > *  out 
)

Splits comma-separated string to elements and tries to match each one with a recognized content type. The out set will be cleared first and must be present.

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,
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.

Todo:
TODO(jmarantz): It would seem natural to fold the ImageOptions into the Image object itself.
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,
MessageHandler *  message_handler 
)

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::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 ( 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"] NOTE: actually used for html doctype recognition, so assumes HtmlSpace separation.

StringPiece net_instaweb::PieceAfterEquals ( 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.

void net_instaweb::PrepareForBeaconInsertionHelper ( CriticalKeys *  proto,
NonceGenerator *  nonce_generator,
RewriteDriver *  driver,
bool  using_candidate_key_detection,
BeaconMetadata *  result 
)

Given a set of candidate critical keys, decide whether beaconing should take place. We should always beacon if there's new critical key data. Otherwise re-beaconing is based on a time and request interval, and 2 modes of beaconing frequency are supported. At first, beaconing occurs at a high frequency until we have collected kHighFreqBeaconCount beacons; after that, we transition into low frequency beaconing mode, where beaconing occurs less often. We also track the number of expired nonces since the last valid beacon was received to see if beaconing is set up correctly, and if it looks like it isn't, only do low frequency beaconing. Sets status and nonce appropriately in *result (nonce will be empty if no nonce is required). If candidate keys are not required, keys may be empty (but new candidate detection will not occur). If result->status != kDontBeacon, caller should write proto back to the property cache using UpdateInPropertyCache.

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,
request_rec *  request 
)

Converts the ResponseHeaders to the output headers. This function does not alter the status code or the major/minor version of the Apache request.

bool net_instaweb::SplitStringPieceToIntegerVector ( StringPiece  src,
StringPiece  separators,
std::vector< int > *  ints 
)

Parse a list of integers into a vector. Empty values are ignored. Returns true if all non-empty values are converted into integers.

void net_instaweb::SplitStringPieceToVector ( StringPiece  sp,
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 ( StringPiece  full,
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 ( StringPiece  a,
StringPiece  b,
StringPiece  c,
StringPiece  d,
StringPiece  e,
StringPiece  f,
StringPiece  g,
StringPiece  h,
StringPiece  i 
)
inline

namescape internal

Supports 9 or more arguments

bool net_instaweb::StringEqualConcat ( StringPiece  str,
StringPiece  first,
StringPiece  second 
)

Return true if str is equal to the concatenation of first and second. Note that this respects case.

bool net_instaweb::StringToDouble ( const char *  in,
double *  out 
)

Parses valid floating point number and returns true if string contains only that floating point number (ignoring leading/trailing whitespace). Note: This also parses hex and exponential float notation.

bool net_instaweb::StringToDouble ( GoogleString  in,
double *  out 
)
inline

If there are embedded nulls, always fail.

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::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

Todo:
TODO(nforman): Possibly handle stripping BOMs from non-utf-8 files. We currently handle only utf-8 BOM because we assume the resources we get are not in utf-16 or utf-32 when we read and parse them, anyway.
void net_instaweb::TrimUrlQuotes ( StringPiece *  str)

In-place removal of multiple levels of leading and trailing quotes, include url-escaped quotes, optionally backslashed. Removes whitespace as well.

bool net_instaweb::TrimWhitespace ( StringPiece *  str)

In-place removal of leading and trailing HTML whitespace. Returns true if any whitespace was trimmed.

void net_instaweb::TrimWhitespace ( StringPiece  in,
GoogleString output 
)
inline

Non-destructive TrimWhitespace. WARNING: in should not point inside output!

< Mutable copy

< Modifies temp

bool net_instaweb::UpdateCandidateKeys ( const StringSet &  keys,
CriticalKeys *  proto,
bool  clear_rebeacon_timestamp 
)

Update the candidate key set in proto. If new candidate keys are detected, they are inserted into proto with a support value of 0, and true is returned. Otherwise returns false. If clear_rebeacon_timestamp is set, the rebeacon timestamp field in the proto is cleared to force rebeaconing on the next request.

void net_instaweb::UpdateCriticalKeys ( bool  require_prior_support,
const StringSet &  new_set,
int  support_value,
CriticalKeys *  critical_keys 
)

Add support for new_set to existing support. The new_set should be obtained from a fully-validated beacon result – this means PrepareForBeaconInsertion should have been called if required, and the resulting nonce should have been checked. If require_prior_support then there must be an existing support entry (possibly 0) for new support to be registered.

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.

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!

bool net_instaweb::ValidateAndExpireNonce ( int64  now_ms,
StringPiece  nonce,
CriticalKeys *  critical_keys 
)

Check whether the given nonce is valid, invalidating any expired nonce entries we might encounter. To avoid the need to copy and clear the nonce list, we invalidate the entry used and any expired entries by clearing the nonce value and timestamp. These entries will be reused by AddNonceToCriticalSelectors.

void net_instaweb::WriteCriticalKeysToPropertyCache ( const StringSet &  new_keys,
StringPiece  nonce,
int  support_interval,
CriticalKeysWriteFlags  flags,
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. If require_prior_support is set, any keys that are not already present in the property cache will be ignored (to prevent 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 should have been called previously if !should_replace_prior_result and nonces must be checked.

Variable Documentation

const int64 net_instaweb::kBeaconTimeoutIntervalMs = Timer::kMinuteMs

The amount of time after generating a nonce that we will accept it as valid. This keeps an attacker from accumulating large numbers of valid nonces to send many beacon responses at once.

const HttpOptions net_instaweb::kDeprecatedDefaultHttpOptions
Todo:
TODO(sligocki): We should not be using these default options. Fix callers.
const char net_instaweb::kGaSnippetSuffix[]
Initial value:
=
" ];\n"
" var pageTracker = {\n"
" _initData: function() {},\n"
" };\n"
" for (var i=pageTrackerMethodNames.length; i--;) {\n"
" var n = pageTrackerMethodNames[i];\n"
" pageTracker[n] = deferTrackerFunc(prefix + n);\n"
" }\n"
" return pageTracker;\n"
" };\n"
"\n"
" var ga = document.createElement('script');\n"
" ga.type = 'text/javascript'; ga.async = true;\n"
" ga.src = ('https:' == document.location.protocol ? 'https:///ssl' :\n"
" 'http:///www') + '.google-analytics.com/ga.js';\n"
" var s = document.getElementsByTagName('script')[0];\n"
" s.parentNode.insertBefore(ga, s);\n"
"})();\n"
const int64 net_instaweb::kHighFreqBeaconCount = 3

The number of valid beacons received that will switch from high frequency to low frequency beaconing.

const int64 net_instaweb::kLowFreqBeaconMult = 100

The multiplier to apply to RewriteOptions::beacon_reinstrument_time_sec() to determine the low frequency beaconing interval. For example, the default value rebeaconing value is 5 seconds, so we will rebeacon every 5 seconds in high frequency mode, and every 500 seconds (~8 minutes) in low frequency mode.

const char net_instaweb::kModPagespeedInPlaceCheckHeadersName[]
Initial value:
=
"MOD_PAGESPEED_IN_PLACE_CHECK_HEADERS_FILTER"

Third filter checks headers for cacheability and writes the recorded resource to our cache.

const char net_instaweb::kModPagespeedInPlaceFilterName[] = "MOD_PAGESPEED_IN_PLACE_FILTER"

Filters used for In-Place Resource Optimization. First filter stores un-gzipped contents.

const char net_instaweb::kModPagespeedInPlaceFixHeadersName[]
Initial value:
=
"MOD_PAGESPEED_IN_PLACE_FIX_HEADERS_FILTER"

Second filter fixes headers to avoid caching by shared proxies.

const int64 net_instaweb::kNonceExpirationLimit = 5

The limit on the number of nonces that can expire before we stop trying to do high frequency beaconing. This is a signal that beacons are not configured correctly and so we drop into low frequency beaconing mode.

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.