Page Speed Optimization Libraries  1.6.29.3
net/instaweb/rewriter/public/critical_finder_support_util.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 
00034 
00035 #ifndef NET_INSTAWEB_REWRITER_PUBLIC_CRITICAL_FINDER_SUPPORT_UTIL_H_
00036 #define NET_INSTAWEB_REWRITER_PUBLIC_CRITICAL_FINDER_SUPPORT_UTIL_H_
00037 
00038 #include <map>
00039 
00040 #include "net/instaweb/util/public/basictypes.h"
00041 #include "net/instaweb/util/public/property_cache.h"
00042 #include "net/instaweb/util/public/string.h"
00043 #include "net/instaweb/util/public/string_util.h"
00044 #include "net/instaweb/util/public/timer.h"
00045 
00046 namespace net_instaweb {
00047 
00049 const int64 kMinBeaconIntervalMs = 5 * Timer::kSecondMs;
00050 const int64 kBeaconTimeoutIntervalMs = Timer::kMinuteMs;
00053 const char kValidNonce[] = "*";
00054 
00055 class CriticalKeys;
00056 class MessageHandler;
00057 class NonceGenerator;
00058 
00059 typedef std::map<GoogleString, int> SupportMap;
00060 
00063 StringSet GetCriticalKeysFromProto(const CriticalKeys& critical_keys);
00064 
00071 void WriteCriticalKeysToPropertyCache(
00072     const StringSet& new_keys, StringPiece nonce, int support_interval,
00073     bool should_replace_prior_result, StringPiece property_name,
00074     const PropertyCache* cache, const PropertyCache::Cohort* cohort,
00075     AbstractPropertyPage* page, MessageHandler* message_handler, Timer* timer);
00076 
00081 GoogleString PrepareForBeaconInsertion(
00082     const StringSet& keys, CriticalKeys* proto, int support_interval,
00083     bool should_replace_prior_result, StringPiece property_name,
00084     const PropertyCache::Cohort* cohort, AbstractPropertyPage* page,
00085     NonceGenerator* nonce_generator, Timer* timer);
00086 
00087 }  
00088 
00089 #endif  ///< NET_INSTAWEB_REWRITER_PUBLIC_CRITICAL_FINDER_SUPPORT_UTIL_H_
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines