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

#include "debug_filter.h"

Inheritance diagram for net_instaweb::DebugFilter:
net_instaweb::EmptyHtmlFilter net_instaweb::HtmlFilter

Public Member Functions

 DebugFilter (RewriteDriver *driver)
virtual void EndDocument ()
virtual void Flush ()
virtual const char * Name () const
 The name of this filter – used for logging and debugging.
void InitParse ()
void StartParse ()
void EndParse ()
void StartRender ()
void EndRender ()
virtual void EndElement (HtmlElement *element)
GoogleString ListActiveFiltersAndOptions () const
- Public Member Functions inherited from net_instaweb::EmptyHtmlFilter
virtual void StartDocument ()
virtual void StartElement (HtmlElement *element)
virtual void Cdata (HtmlCdataNode *cdata)
 Called for CDATA blocks (e.g. <![CDATA[foobar]]>)
virtual void Comment (HtmlCommentNode *comment)
 Called for HTML comments that aren't IE directives (e.g. ).
virtual void IEDirective (HtmlIEDirectiveNode *directive)
virtual void Characters (HtmlCharactersNode *characters)
 Called for raw characters between tags.
virtual void Directive (HtmlDirectiveNode *directive)
 Called for HTML directives (e.g. <!doctype foobar>).
virtual void DetermineEnabled (GoogleString *disabled_reason)
virtual bool CanModifyUrls ()
ScriptUsage GetScriptUsage () const override
- Public Member Functions inherited from net_instaweb::HtmlFilter
virtual void RenderDone ()
bool is_enabled () const
void set_is_enabled (bool is_enabled)

Static Public Member Functions

static GoogleString FormatFlushMessage (int64 time_since_init_parse_us, int64 parse_duration_us, int64 flush_duration_us, int64 idle_duration_us)
static GoogleString FormatEndDocumentMessage (int64 time_since_init_parse_us, int64 total_parse_duration_us, int64 total_flush_duration_us, int64 total_idle_duration_us, int num_flushes, bool is_critical_images_beacon_enabled, const StringSet &critical_image_urls, const StringVector &dynamically_disabled_filter_list)

Additional Inherited Members

- Public Types inherited from net_instaweb::HtmlFilter
enum  ScriptUsage { kWillInjectScripts, kMayInjectScripts, kNeverInjectsScripts }
 Describes a filter's relationship with scripts. More...

Detailed Description

Injects HTML comments for measuring the time it takes to parse HTML, run the Flush/Render sequence, and the idle-time between text blocks. Data is written into the HTML as comments.

Member Function Documentation

virtual void net_instaweb::DebugFilter::EndDocument ( )

Note: EndDocument will be called immediately before the last Flush call. (which also means that in the RewriteDriver use it is called before rendering for the last flush window).

Reimplemented from net_instaweb::EmptyHtmlFilter.

virtual void net_instaweb::DebugFilter::Flush ( )

Notifies the Filter that a flush is occurring. A filter that's generating streamed output should flush at this time. A filter that's mutating elements can mutate any element seen since the most recent flush; once an element is flushed it is already on the wire to its destination and it's too late to mutate. Flush is initiated by an application calling HttpParse::Flush().

Flush() is called after all other handlers during a HttpParse::Flush(), except RenderDone(), which (if in use) happens after Flush().

Reimplemented from net_instaweb::EmptyHtmlFilter.

static GoogleString net_instaweb::DebugFilter::FormatFlushMessage ( int64  time_since_init_parse_us,
int64  parse_duration_us,
int64  flush_duration_us,
int64  idle_duration_us 

Formats Flush/EndOfDocument messages that will be easy to read from View->PageSource in a browser.

They are exposed for testing, so that unit tests are not concerned with the exact formatting of those messages.

void net_instaweb::DebugFilter::InitParse ( )

Special entry-points needed for measuring timing. The timing of StartDocument/EndDocument does not capture the correct timing, and changing them so they do would alter functionality depended upon by numerous filters. So we have special entry-points for this filter called directly by RewriteDriver. This can be generalized in the future if these entry-points prove useful.

GoogleString net_instaweb::DebugFilter::ListActiveFiltersAndOptions ( ) const

Gets the list of active filters from the RewriteDriver for logging to debug message.

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