19 #ifndef NET_INSTAWEB_HTTP_PUBLIC_RATE_CONTROLLER_H_
20 #define NET_INSTAWEB_HTTP_PUBLIC_RATE_CONTROLLER_H_
29 #include "pagespeed/kernel/base/thread_annotations.h"
31 namespace net_instaweb {
40 class UrlAsyncFetcher;
56 static const char kQueuedFetchCount[];
57 static const char kDroppedFetchCount[];
58 static const char kCurrentGlobalFetchQueueSize[];
61 int per_host_outgoing_request_threshold,
62 int per_host_queued_request_threshold,
70 bool is_shut_down()
const {
return shutdown_.value(); }
74 void Fetch(UrlAsyncFetcher* fetcher,
76 MessageHandler* message_handler,
80 static void InitStats(Statistics* statistics);
85 friend class CustomFetch;
87 typedef RefCountedPtr<HostFetchInfo> HostFetchInfoPtr;
89 typedef std::map<GoogleString, HostFetchInfoPtr*> HostFetchInfoMap;
92 void DeleteFetchInfoIfPossible(
const HostFetchInfoPtr& fetch_info);
95 const int max_global_queue_size_;
97 const int per_host_outgoing_request_threshold_;
99 const int per_host_queued_request_threshold_;
100 ThreadSystem* thread_system_;
103 HostFetchInfoMap fetch_info_map_ GUARDED_BY(mutex_);
104 scoped_ptr<AbstractMutex> mutex_;
106 TimedVariable* queued_fetch_count_;
107 TimedVariable* dropped_fetch_count_;
110 UpDownCounter* current_global_fetch_queue_size_;
112 AtomicBool shutdown_;
void ShutDown()
Makes any further fetches quick-fail.
Definition: rate_controller.h:69
Definition: rate_controller.h:54
Base class for implementations of monitoring statistics.
Definition: statistics.h:342
std::string GoogleString
PAGESPEED_KERNEL_BASE_STRING_H_.
Definition: string.h:24
static void InitStats(Statistics *statistics)
Initializes statistics variables associated with this class.
Definition: thread_system.h:40
void Fetch(UrlAsyncFetcher *fetcher, const GoogleString &url, MessageHandler *message_handler, AsyncFetch *fetch)