Page Speed Optimization Libraries  1.13.35.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
add_instrumentation_filter.h
Go to the documentation of this file.
1 /*
2  * Copyright 2010 Google Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http:///www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
18 
19 #ifndef NET_INSTAWEB_REWRITER_PUBLIC_ADD_INSTRUMENTATION_FILTER_H_
20 #define NET_INSTAWEB_REWRITER_PUBLIC_ADD_INSTRUMENTATION_FILTER_H_
21 
29 
30 namespace net_instaweb {
31 
32 class Statistics;
33 class Variable;
34 
37  public:
38  static const char kLoadTag[];
39  static const char kUnloadTag[];
40  static GoogleString* kUnloadScriptFormatXhtml;
41  static GoogleString* kTailScriptFormatXhtml;
42 
44  static const char kInstrumentationScriptAddedCount[];
45 
46  explicit AddInstrumentationFilter(RewriteDriver* driver);
47  virtual ~AddInstrumentationFilter();
48 
49  static void InitStats(Statistics* statistics);
50 
51  virtual void StartDocumentImpl();
52  virtual void EndDocument();
53  virtual void StartElementImpl(HtmlElement* element);
54  virtual void EndElementImpl(HtmlElement* element);
55  virtual const char* Name() const { return "AddInstrumentation"; }
56 
57  ScriptUsage GetScriptUsage() const override { return kWillInjectScripts; }
58 
59  protected:
60  virtual void DetermineEnabled(GoogleString* disabled_reason);
61 
64 
65  private:
67  GoogleString GetScriptJs(StringPiece event);
68 
71  void AddHeadScript(HtmlElement* element);
72 
73  bool found_head_;
74  bool added_head_script_;
75  bool added_unload_script_;
76 
77 
78 };
79 
80 }
81 
82 #endif
virtual const char * Name() const
The name of this filter – used for logging and debugging.
Definition: add_instrumentation_filter.h:55
Definition: common_filter.h:47
Variable * instrumentation_script_added_count_
The total number of times instrumentation script is added.
Definition: add_instrumentation_filter.h:63
Definition: statistics.h:43
Base class for implementations of monitoring statistics.
Definition: statistics.h:342
Definition: html_element.h:42
ScriptUsage GetScriptUsage() const override
Definition: add_instrumentation_filter.h:57
std::string GoogleString
PAGESPEED_KERNEL_BASE_STRING_H_.
Definition: string.h:24
static const char kInstrumentationScriptAddedCount[]
Counters.
Definition: add_instrumentation_filter.h:44
ScriptUsage
Describes a filter's relationship with scripts.
Definition: html_filter.h:38
Definition: rewrite_driver.h:100
Injects javascript instrumentation for monitoring page-rendering time.
Definition: add_instrumentation_filter.h:36
virtual void DetermineEnabled(GoogleString *disabled_reason)