Page Speed Optimization Libraries  1.8.31.3
net/instaweb/rewriter/public/beacon_critical_line_info_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 
00021 
00022 #ifndef NET_INSTAWEB_REWRITER_PUBLIC_BEACON_CRITICAL_LINE_INFO_FINDER_H_
00023 #define NET_INSTAWEB_REWRITER_PUBLIC_BEACON_CRITICAL_LINE_INFO_FINDER_H_
00024 
00025 #include "net/instaweb/rewriter/public/critical_line_info_finder.h"
00026 
00027 #include "net/instaweb/rewriter/public/critical_finder_support_util.h"
00028 #include "net/instaweb/util/public/basictypes.h"
00029 #include "net/instaweb/util/public/property_cache.h"
00030 #include "pagespeed/kernel/base/string_util.h"
00031 
00032 namespace net_instaweb {
00033 
00034 class MessageHandler;
00035 class NonceGenerator;
00036 class RewriteDriver;
00037 class Timer;
00038 
00059 class BeaconCriticalLineInfoFinder : public CriticalLineInfoFinder {
00060  public:
00061   static const char kBeaconCriticalLineInfoPropertyName[];
00062 
00063   BeaconCriticalLineInfoFinder(const PropertyCache::Cohort* cohort,
00064                                NonceGenerator* nonce_generator);
00065   virtual ~BeaconCriticalLineInfoFinder();
00066 
00067   virtual BeaconMetadata PrepareForBeaconInsertion(RewriteDriver* driver);
00068 
00072   static void WriteXPathsToPropertyCacheFromBeacon(
00073       const StringSet& xpaths_set, StringPiece nonce,
00074       const PropertyCache* cache, const PropertyCache::Cohort* cohort,
00075       AbstractPropertyPage* page, MessageHandler* message_handler,
00076       Timer* timer);
00077 
00078  protected:
00080   virtual void UpdateInDriver(RewriteDriver* driver);
00081 
00082  private:
00083   static const int kDefaultSupportInterval = 10;
00084 
00085   virtual int SupportInterval() const { return kDefaultSupportInterval; }
00086 
00087   NonceGenerator* nonce_generator_;
00088   DISALLOW_COPY_AND_ASSIGN(BeaconCriticalLineInfoFinder);
00089 };
00090 
00091 }  
00092 
00093 #endif  ///< NET_INSTAWEB_REWRITER_PUBLIC_BEACON_CRITICAL_LINE_INFO_FINDER_H_
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines