Page Speed Optimization Libraries  1.9.32.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
mod_spdy_fetch_controller.h
Go to the documentation of this file.
1 /*
2  * Copyright 2012 Google Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http:///www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
24 
25 #ifndef NET_INSTAWEB_APACHE_MOD_SPDY_FETCH_CONTROLLER_H_
26 #define NET_INSTAWEB_APACHE_MOD_SPDY_FETCH_CONTROLLER_H_
27 
29 #include "pagespeed/kernel/base/atomic_bool.h"
30 #include "pagespeed/kernel/base/basictypes.h"
31 #include "pagespeed/kernel/base/string.h"
32 #include "pagespeed/kernel/thread/queued_worker_pool.h"
33 
34 namespace net_instaweb {
35 
36 class AsyncFetch;
37 class MessageHandler;
38 class ModSpdyFetcher;
39 class Statistics;
40 class Timer;
41 class ThreadSystem;
42 
44  public:
46  ModSpdyFetchController(int num_threads,
47  ThreadSystem* thread_system,
48  Timer* timer,
49  Statistics* statistics);
51 
53  static void InitStats(Statistics* statistics);
54 
57  ModSpdyFetcher* fetcher, const GoogleString& url, Statistics* stats,
58  MessageHandler* message_handler, AsyncFetch* fetch);
59 
62  void ShutDown() { shutdown_.set_value(true); }
63  bool is_shut_down() const { return shutdown_.value(); }
64 
65  Timer* timer() const { return timer_; }
66 
67  private:
68  class FetchDispatcher;
69 
70  Timer* timer_;
71  RateController rate_controller_;
72  QueuedWorkerPool thread_pool_;
73  AtomicBool shutdown_;
74  DISALLOW_COPY_AND_ASSIGN(ModSpdyFetchController);
75 };
76 
77 }
78 
79 #endif
Definition: mod_spdy_fetch_controller.h:43
void ScheduleBlockingFetch(ModSpdyFetcher *fetcher, const GoogleString &url, Statistics *stats, MessageHandler *message_handler, AsyncFetch *fetch)
Arranges for fetcher->BlockingFetch to be called on our thread pool.
ModSpdyFetchController(int num_threads, ThreadSystem *thread_system, Timer *timer, Statistics *statistics)
Note: RateController::InitStats must have been called before using this.
void ShutDown()
Definition: mod_spdy_fetch_controller.h:62
static void InitStats(Statistics *statistics)
This must be called for every statistics object in use before using this.
Definition: async_fetch.h:53
Definition: mod_spdy_fetcher.h:46