Page Speed Optimization Libraries  1.13.35.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
net_instaweb::DataUrlInputResource Class Reference
Inheritance diagram for net_instaweb::DataUrlInputResource:
net_instaweb::Resource net_instaweb::RefCounted< Resource >

Public Member Functions

virtual bool IsValidAndCacheable () const
 
virtual void FillInPartitionInputInfo (HashHint include_content_hash, InputInfo *input)
 Set OutputPartition's input info used for expiration validation.
 
virtual GoogleString url () const
 Gets the absolute URL of the resource.
 
virtual bool UseHttpCache () const
 
- Public Member Functions inherited from net_instaweb::Resource
 Resource (const RewriteDriver *driver, const ContentType *type)
 
ServerContextserver_context () const
 Common methods across all deriviations.
 
bool is_authorized_domain ()
 
void set_is_authorized_domain (bool is_authorized)
 
bool IsSafeToRewrite (bool rewrite_uncacheable, GoogleString *reason) const
 
bool IsSafeToRewrite (bool rewrite_uncacheable) const
 
bool loaded () const
 
bool HttpStatusOk () const
 
void LoadAsync (NotCacheablePolicy not_cacheable_policy, const RequestContextPtr &request_context, AsyncCallback *callback)
 
virtual void RefreshIfImminentlyExpiring ()
 
GoogleString ContentsHash () const
 
void AddInputInfoToPartition (HashHint suggest_include_content_hash, int index, CachedResult *partition)
 
void FillInPartitionInputInfoFromResponseHeaders (const ResponseHeaders &headers, InputInfo *input)
 
int64 CacheExpirationTimeMs () const
 
StringPiece ExtractUncompressedContents () const
 
size_t UncompressedContentsSize () const
 
StringPiece raw_contents () const
 
ResponseHeadersresponse_headers ()
 
const ResponseHeadersresponse_headers () const
 
const ContentTypetype () const
 
virtual void SetType (const ContentType *type)
 
bool IsContentsEmpty () const
 
StringPiece charset () const
 Note: this is empty if the header is not specified.
 
void set_charset (StringPiece c)
 
virtual bool has_url () const
 
virtual GoogleString UrlForDebug () const
 Override if resource does not have a URL.
 
virtual GoogleString cache_key () const
 
void DetermineContentType ()
 
bool Link (HTTPValue *source, MessageHandler *handler)
 
virtual void Freshen (FreshenCallback *callback, MessageHandler *handler)
 
void LinkFallbackValue (HTTPValue *value)
 Links the stale fallback value that can be used in case a fetch fails.
 
void set_is_background_fetch (bool x)
 
bool is_background_fetch () const
 
FetchResponseStatus fetch_response_status ()
 
void set_fetch_response_status (FetchResponseStatus x)
 
- Public Member Functions inherited from net_instaweb::RefCounted< Resource >
void Release ()
 
void AddRef ()
 
bool HasOneRef ()
 

Static Public Member Functions

static ResourcePtr Make (const StringPiece &url, const RewriteDriver *driver)
 We expose a factory; parse failure returns NULL. More...
 

Protected Member Functions

virtual void LoadAndCallback (NotCacheablePolicy not_cacheable_policy, const RequestContextPtr &request_context, AsyncCallback *callback)
 
- Protected Member Functions inherited from net_instaweb::Resource
 REFCOUNT_FRIEND_DECLARATION (Resource)
 
void set_enable_cache_purge (bool x)
 
ResponseHeaders::VaryOption respect_vary () const
 
void set_respect_vary (ResponseHeaders::VaryOption x)
 
void set_proactive_resource_freshening (bool x)
 
void set_disable_rewrite_on_no_transform (bool x)
 

Additional Inherited Members

- Public Types inherited from net_instaweb::Resource
enum  HashHint { kOmitInputHash, kIncludeInputHash }
 
enum  NotCacheablePolicy { kLoadEvenIfNotCacheable, kReportFailureIfNotCacheable }
 
- Protected Attributes inherited from net_instaweb::Resource
ServerContextserver_context_
 
const ContentTypetype_
 
GoogleString charset_
 
HTTPValue value_
 contains contents and meta-data
 
ResponseHeaders response_headers_
 
HTTPValue fallback_value_
 

Member Function Documentation

virtual bool net_instaweb::DataUrlInputResource::IsValidAndCacheable ( ) const
virtual

Checks if the contents are loaded and valid and also if the resource is up-to-date and cacheable by a proxy like us.

Reimplemented from net_instaweb::Resource.

virtual void net_instaweb::DataUrlInputResource::LoadAndCallback ( NotCacheablePolicy  not_cacheable_policy,
const RequestContextPtr request_context,
AsyncCallback callback 
)
protectedvirtual

Load the resource asynchronously, storing ResponseHeaders and contents in object. Calls 'callback' when finished. The ResourcePtr used to construct 'callback' must be the same as the resource used to invoke this method.

Setting not_cacheable_policy to kLoadEvenIfNotCacheable will permit it to consider loading to be successful on Cache-Control:private and Cache-Control:no-cache resources. It should not affect /whether/ the callback gets involved, only whether it gets true or false.

Implements net_instaweb::Resource.

static ResourcePtr net_instaweb::DataUrlInputResource::Make ( const StringPiece &  url,
const RewriteDriver driver 
)
inlinestatic

We expose a factory; parse failure returns NULL.

We create the local copy of the url early, because encoded_contents will in general be a substring of this local copy and must have the same lifetime.

virtual bool net_instaweb::DataUrlInputResource::UseHttpCache ( ) const
inlinevirtual

Returns whether this type of resource should use the HTTP Cache. This method is based on properties of the class, not the resource itself, and helps short-circuit pointless cache lookups for file-based and data URLs.

Implements net_instaweb::Resource.


The documentation for this class was generated from the following file: