Page Speed Optimization Libraries  1.13.35.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
css_combine_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_CSS_COMBINE_FILTER_H_
20 #define NET_INSTAWEB_REWRITER_PUBLIC_CSS_COMBINE_FILTER_H_
21 
28 
29 namespace net_instaweb {
30 
31 class HtmlElement;
32 class HtmlIEDirectiveNode;
33 class RewriteContext;
34 class RewriteDriver;
35 class Statistics;
36 class UrlSegmentEncoder;
37 class Variable;
38 
40  public:
44  static const char kCssCombineOpportunities[];
46  static const char kCssFileCountReduction[];
47 
48  explicit CssCombineFilter(RewriteDriver* rewrite_driver);
49  virtual ~CssCombineFilter();
50 
51  static void InitStats(Statistics* statistics);
52 
53  virtual void StartDocumentImpl();
54  virtual void EndDocument();
55  virtual void StartElementImpl(HtmlElement* element);
56  virtual void EndElementImpl(HtmlElement* element) {}
57  virtual void Flush();
58  virtual void DetermineEnabled(GoogleString* disabled_reason);
59  virtual void IEDirective(HtmlIEDirectiveNode* directive);
60  virtual const char* Name() const { return "CssCombine"; }
61  virtual const UrlSegmentEncoder* encoder() const {
62  return &multipart_encoder_;
63  }
64 
66  virtual const char* id() const { return RewriteOptions::kCssCombinerId; }
67 
68  private:
69  class Context;
70  class CssCombiner;
71 
72  CssCombiner* combiner();
73  void NextCombination(StringPiece debug_help);
74  Context* MakeContext();
75 
76  scoped_ptr<Context> context_;
77  UrlMultipartEncoder multipart_encoder_;
78  bool end_document_found_;
79  int css_links_;
80 
81  Variable* css_combine_opportunities_;
82 
83 
84 };
85 
86 }
87 
88 #endif
virtual void DetermineEnabled(GoogleString *disabled_reason)
Base class for implementations of monitoring statistics.
Definition: statistics.h:342
virtual void IEDirective(HtmlIEDirectiveNode *directive)
virtual RewriteContext * MakeRewriteContext()
Definition: html_element.h:42
static const char kCssCombineOpportunities[]
Definition: css_combine_filter.h:44
virtual const UrlSegmentEncoder * encoder() const
Definition: css_combine_filter.h:61
static const char kCssFileCountReduction[]
CSS file reduction (Optimally this equals kCssCombineOpportunities).
Definition: css_combine_filter.h:46
std::string GoogleString
PAGESPEED_KERNEL_BASE_STRING_H_.
Definition: string.h:24
Definition: rewrite_filter.h:35
Definition: rewrite_driver.h:100
Definition: rewrite_context.h:155
Definition: css_combine_filter.h:39
Definition: url_segment_encoder.h:33
Leaf node representing an HTML IE directive.
Definition: html_node.h:213
virtual const char * Name() const
The name of this filter – used for logging and debugging.
Definition: css_combine_filter.h:60