Page Speed Optimization Libraries  1.4.26.1
net/instaweb/rewriter/public/critical_selector_finder.h
Go to the documentation of this file.
00001 /*
00002  * Copyright 2013 Google Inc.
00003  *
00004  * Licensed under the Apache License, Version 2.0 (the "License");
00005  * you may not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  *
00008  *      http:///www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016 
00018 
00019 #ifndef NET_INSTAWEB_REWRITER_PUBLIC_CRITICAL_SELECTOR_FINDER_H_
00020 #define NET_INSTAWEB_REWRITER_PUBLIC_CRITICAL_SELECTOR_FINDER_H_
00021 
00022 #include "net/instaweb/util/public/basictypes.h"
00023 #include "net/instaweb/util/public/string.h"
00024 #include "net/instaweb/util/public/string_util.h"
00025 
00026 namespace net_instaweb {
00027 
00028 class CriticalSelectorSet;
00029 class MessageHandler;
00030 class PropertyCache;
00031 class PropertyPage;
00032 class RewriteDriver;
00033 class Statistics;
00034 class TimedVariable;
00035 
00038 class CriticalSelectorFinder {
00039  public:
00040   static const char kCriticalSelectorsValidCount[];
00041   static const char kCriticalSelectorsExpiredCount[];
00042   static const char kCriticalSelectorsNotFoundCount[];
00043   static const char kCriticalSelectorsPropertyName[];
00044 
00045   CriticalSelectorFinder(StringPiece cohort, Statistics* stats);
00046   virtual ~CriticalSelectorFinder();
00047 
00048   static void InitStats(Statistics* statistics);
00049 
00053   CriticalSelectorSet* DecodeCriticalSelectorsFromPropertyCache(
00054       RewriteDriver* driver);
00055 
00059   void WriteCriticalSelectorsToPropertyCache(
00060       const StringSet& selector_set, RewriteDriver* driver);
00061 
00062   void WriteCriticalSelectorsToPropertyCache(
00063       const StringSet& selector_set, const PropertyCache* cache,
00064       PropertyPage* page, MessageHandler* message_handler);
00065 
00068 
00069  private:
00070   GoogleString cohort_;
00071 
00072   TimedVariable* critical_selectors_valid_count_;
00073   TimedVariable* critical_selectors_expired_count_;
00074   TimedVariable* critical_selectors_not_found_count_;
00075 
00076   DISALLOW_COPY_AND_ASSIGN(CriticalSelectorFinder);
00077 };
00078 
00079 }  
00080 
00081 #endif  ///< NET_INSTAWEB_REWRITER_PUBLIC_CRITICAL_SELECTOR_FINDER_H_
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines