Page Speed Optimization Libraries  1.13.35.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
insert_dns_prefetch_filter.h
Go to the documentation of this file.
1 /*
2  * Copyright 2012 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  */
17 
18 #ifndef NET_INSTAWEB_REWRITER_PUBLIC_INSERT_DNS_PREFETCH_FILTER_H_
19 #define NET_INSTAWEB_REWRITER_PUBLIC_INSERT_DNS_PREFETCH_FILTER_H_
20 
25 
26 namespace net_instaweb {
27 
28 class FlushEarlyInfo;
29 class RewriteDriver;
30 
34  public:
35  explicit InsertDnsPrefetchFilter(RewriteDriver* driver);
36  virtual ~InsertDnsPrefetchFilter();
37 
38  virtual void StartDocumentImpl();
39  virtual void EndDocument();
40  virtual void StartElementImpl(HtmlElement* element);
41  virtual void EndElementImpl(HtmlElement* element);
42 
43  virtual const char* Name() const { return "InsertDnsPrefetchFilter"; }
46  virtual void DetermineEnabled(GoogleString* disabled_reason);
47  virtual const char* id() const { return "idp"; }
48 
49  private:
50  void Clear();
51 
54  void MarkAlreadyInHead(HtmlElement::Attribute* urlattr);
55 
59  bool IsDomainListStable(const FlushEarlyInfo& flush_early_info) const;
60  void DebugPrint(const char* msg);
61 
64  bool dns_prefetch_inserted_;
65 
67  bool in_head_;
68 
71  StringSet domains_to_ignore_;
72 
75  StringSet domains_in_body_;
76 
79  StringVector dns_prefetch_domains_;
80 
82  bool user_agent_supports_dns_prefetch_;
83 
84 
85 };
86 
87 }
88 
89 #endif
Definition: common_filter.h:47
virtual const char * Name() const
The name of this filter – used for logging and debugging.
Definition: insert_dns_prefetch_filter.h:43
Definition: html_element.h:42
virtual void DetermineEnabled(GoogleString *disabled_reason)
std::string GoogleString
PAGESPEED_KERNEL_BASE_STRING_H_.
Definition: string.h:24
Definition: insert_dns_prefetch_filter.h:33
Definition: rewrite_driver.h:100