Make castv2 performance test work.
[chromium-blink-merge.git] / chrome / browser / devtools / devtools_network_controller.h
blob0e35a45995a72afff0a7d602d74c5749d918ac5e
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_DEVTOOLS_DEVTOOLS_NETWORK_CONTROLLER_H_
6 #define CHROME_BROWSER_DEVTOOLS_DEVTOOLS_NETWORK_CONTROLLER_H_
8 #include <string>
10 #include "base/containers/scoped_ptr_hash_map.h"
11 #include "base/macros.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "base/memory/weak_ptr.h"
14 #include "base/threading/thread_checker.h"
16 class DevToolsNetworkConditions;
17 class DevToolsNetworkInterceptor;
18 class DevToolsNetworkTransaction;
20 namespace test {
21 class DevToolsNetworkControllerHelper;
24 // DevToolsNetworkController tracks DevToolsNetworkTransactions.
25 class DevToolsNetworkController {
27 public:
28 DevToolsNetworkController();
29 virtual ~DevToolsNetworkController();
31 // Applies network emulation configuration.
32 void SetNetworkState(
33 const std::string& client_id,
34 scoped_ptr<DevToolsNetworkConditions> conditions);
36 base::WeakPtr<DevToolsNetworkInterceptor> GetInterceptor(
37 DevToolsNetworkTransaction* transaction);
39 protected:
40 friend class test::DevToolsNetworkControllerHelper;
42 private:
43 // Controller must be constructed on IO thread.
44 base::ThreadChecker thread_checker_;
46 void SetNetworkStateOnIO(
47 const std::string& client_id,
48 scoped_ptr<DevToolsNetworkConditions> conditions);
50 typedef scoped_ptr<DevToolsNetworkInterceptor> Interceptor;
51 Interceptor default_interceptor_;
52 Interceptor appcache_interceptor_;
53 typedef base::ScopedPtrHashMap<std::string, DevToolsNetworkInterceptor>
54 Interceptors;
55 Interceptors interceptors_;
57 base::WeakPtrFactory<DevToolsNetworkController> weak_ptr_factory_;
59 DISALLOW_COPY_AND_ASSIGN(DevToolsNetworkController);
62 #endif // CHROME_BROWSER_DEVTOOLS_DEVTOOLS_NETWORK_CONTROLLER_H_