Page Speed Optimization Libraries  1.7.30.3
net/instaweb/http/public/rate_controlling_url_async_fetcher.h
Go to the documentation of this file.
00001 /*
00002  * Copyright 2012 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_HTTP_PUBLIC_RATE_CONTROLLING_URL_ASYNC_FETCHER_H_
00020 #define NET_INSTAWEB_HTTP_PUBLIC_RATE_CONTROLLING_URL_ASYNC_FETCHER_H_
00021 
00022 #include "net/instaweb/http/public/url_async_fetcher.h"
00023 #include "net/instaweb/util/public/basictypes.h"
00024 #include "net/instaweb/util/public/scoped_ptr.h"
00025 #include "net/instaweb/util/public/string.h"
00026 
00027 namespace net_instaweb {
00028 
00029 class AsyncFetch;
00030 class MessageHandler;
00031 class RateController;
00032 class Statistics;
00033 class ThreadSystem;
00034 
00038 class RateControllingUrlAsyncFetcher : public UrlAsyncFetcher {
00039  public:
00043   RateControllingUrlAsyncFetcher(UrlAsyncFetcher* fetcher,
00044                                  int max_global_queue_size,
00045                                  int per_host_outgoing_request_threshold,
00046                                  int per_host_queued_request_threshold,
00047                                  ThreadSystem* thread_system,
00048                                  Statistics* statistics);
00049 
00050   virtual ~RateControllingUrlAsyncFetcher();
00051 
00052   virtual bool SupportsHttps() const {
00053     return base_fetcher_->SupportsHttps();
00054   }
00055 
00056   virtual void Fetch(const GoogleString& url,
00057                      MessageHandler* message_handler,
00058                      AsyncFetch* fetch);
00059 
00060   virtual void ShutDown();
00061 
00062  private:
00063   UrlAsyncFetcher* base_fetcher_;
00064   scoped_ptr<RateController> rate_controller_;
00065 
00066   DISALLOW_COPY_AND_ASSIGN(RateControllingUrlAsyncFetcher);
00067 };
00068 
00069 }  
00070 
00071 #endif  ///< NET_INSTAWEB_HTTP_PUBLIC_RATE_CONTROLLING_URL_ASYNC_FETCHER_H_
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines