Page Speed Optimization Libraries
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | List of all members
net_instaweb::AssociationSlot Class Reference

#include "association_transformer.h"

Inheritance diagram for net_instaweb::AssociationSlot:
net_instaweb::ResourceSlot net_instaweb::RefCounted< ResourceSlot >

Public Member Functions

 AssociationSlot (ResourcePtr resource, StringStringMap *map, const StringPiece &key)
 Note: map must outlive AssociationSlot.
virtual HtmlElementelement () const
 Return HTML element associated with slot, or NULL if none (CSS, IPRO)
virtual void Render ()
virtual bool DirectSetUrl (const StringPiece &url)
virtual GoogleString LocationString () const
- Public Member Functions inherited from net_instaweb::ResourceSlot
 ResourceSlot (const ResourcePtr &resource)
ResourcePtr resource () const
void SetResource (const ResourcePtr &resource)
void set_preserve_urls (bool x)
bool preserve_urls () const
void set_disable_rendering (bool x)
bool disable_rendering () const
void RequestDeleteElement ()
bool should_delete_element () const
bool was_optimized () const
void set_was_optimized (bool x)
 Marks the slot as having been optimized.
void set_disable_further_processing (bool x)
bool disable_further_processing () const
void set_need_aggregate_input_info (bool x)
bool need_aggregate_input_info () const
void ReportInput (const InputInfo &input)
const std::vector< InputInfo > * inputs () const
 may be nullptr.
virtual void Finished ()
virtual bool CanDirectSetUrl ()
RewriteContextLastContext () const
void AddContext (RewriteContext *context)
 Adds a new context to this slot.
void DetachContext (RewriteContext *context)
- Public Member Functions inherited from net_instaweb::RefCounted< ResourceSlot >
void Release ()
void AddRef ()
bool HasOneRef ()

Additional Inherited Members

- Static Public Member Functions inherited from net_instaweb::ResourceSlot
static GoogleString RelativizeOrPassthrough (const RewriteOptions *options, StringPiece url, UrlRelativity url_relativity, const GoogleUrl &base_url)
- Protected Member Functions inherited from net_instaweb::ResourceSlot

Detailed Description

Extremely simple slot which just sets an association in a std::map when it is Render()ed. It associates the key (input URL) with this slot's resource URL (the output URL). Can be used to set AssociationTransformer::map() so that AssocitationTransformer::Transform() will rewrite the rendered URLs.

Member Function Documentation

virtual bool net_instaweb::AssociationSlot::DirectSetUrl ( const StringPiece &  url)

Update the URL in the slot target without touching the resource. This is intended for when we're inlining things as data: URLs and also for placing the rewritten version of the URL in the slot. The method returns true if it successfully updates the slot target. Resources that are not explicitly authorized will get rejected at this point. Note that if you call this you should also call set_disable_rendering(true), or otherwise the result will be overwritten. Does not alter the URL in any way. Not supported on all slot types — presently only slots representing things within CSS and HTML have this operation (others will DCHECK-fail). Must be called from within a context's Render() method.

We should never try to render unauthorized resource URLs as is.

Reimplemented from net_instaweb::ResourceSlot.

virtual GoogleString net_instaweb::AssociationSlot::LocationString ( ) const

Returns a human-readable description of where this slot occurs, for use in log messages.

TODO(sligocki): Improve quality of this diagnostic. Also improve CssResourceSlot::LocationString() which is identical.

Implements net_instaweb::ResourceSlot.

virtual void net_instaweb::AssociationSlot::Render ( )

All Render() calls are from the same thread, so this doesn't need to be thread-safe.

We should never try to render unauthorized resource URLs as is.

Implements net_instaweb::ResourceSlot.

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