Page Speed Optimization Libraries  1.13.35.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
dom_stats_filter.h
Go to the documentation of this file.
1 /*
2  * Copyright 2013 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 
20 
21 #ifndef NET_INSTAWEB_REWRITER_PUBLIC_DOM_STATS_FILTER_H_
22 #define NET_INSTAWEB_REWRITER_PUBLIC_DOM_STATS_FILTER_H_
23 
27 
28 namespace net_instaweb {
29 
30 class HtmlElement;
31 class RewriteDriver;
32 
34 class DomStatsFilter : public CommonFilter {
35  public:
36  explicit DomStatsFilter(RewriteDriver* driver);
37  virtual ~DomStatsFilter();
38 
40  void Clear();
41 
42  virtual const char* Name() const { return "Dom Statistics"; }
43 
44  int num_img_tags() const { return num_img_tags_; }
45  int num_inlined_img_tags() const { return num_inlined_img_tags_; }
46  int num_external_css() const { return num_external_css_; }
47  int num_scripts() const { return num_scripts_; }
48  int num_critical_images_used() const { return num_critical_images_used_; }
49 
50  private:
51  virtual void StartDocumentImpl();
52  virtual void StartElementImpl(HtmlElement* element) {}
53  virtual void EndElementImpl(HtmlElement* element);
54 
55  int num_img_tags_;
56  int num_inlined_img_tags_;
57  int num_external_css_;
58  int num_scripts_;
59  int num_critical_images_used_;
60  ScriptTagScanner script_tag_scanner_;
61 
62 
63 };
64 
65 }
66 
67 #endif
Definition: common_filter.h:47
void Clear()
Clears all state associated with the filter.
Definition: rewrite_driver.h:100
virtual const char * Name() const
The name of this filter – used for logging and debugging.
Definition: dom_stats_filter.h:42
Counts some basic statistics observed as HTML is parsed.
Definition: dom_stats_filter.h:34