dvallet | 233f57ab | 2016-12-21 03:17:10 | [diff] [blame] | 1 | // Copyright (c) 2011 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. |
| 4 | |
| 5 | #ifndef CHROME_BROWSER_NET_BENCHMARKING_H_ |
| 6 | #define CHROME_BROWSER_NET_BENCHMARKING_H_ |
| 7 | |
| 8 | #include "base/macros.h" |
| 9 | #include "chrome/browser/profiles/profile.h" |
| 10 | #include "chrome/common/net_benchmarking.mojom.h" |
| 11 | |
| 12 | namespace net { |
| 13 | class URLRequestContextGetter; |
| 14 | } |
| 15 | |
| 16 | class Profile; |
| 17 | |
| 18 | // This class handles Chrome-specific benchmarking IPC messages |
| 19 | // for the renderer process. |
| 20 | class NetBenchmarking : public chrome::mojom::NetBenchmarking { |
| 21 | public: |
| 22 | NetBenchmarking(Profile* profile, |
| 23 | net::URLRequestContextGetter* request_context); |
| 24 | ~NetBenchmarking() override; |
| 25 | |
| 26 | static void Create(Profile* profile, |
| 27 | net::URLRequestContextGetter* request_context, |
| 28 | chrome::mojom::NetBenchmarkingRequest request); |
| 29 | static bool CheckBenchmarkingEnabled(); |
| 30 | |
| 31 | private: |
| 32 | // chrome:mojom:NetBenchmarking. |
| 33 | void CloseCurrentConnections( |
| 34 | const CloseCurrentConnectionsCallback& callback) override; |
| 35 | void ClearCache(const ClearCacheCallback& callback) override; |
| 36 | void ClearHostResolverCache( |
| 37 | const ClearHostResolverCacheCallback& callback) override; |
| 38 | void ClearPredictorCache( |
| 39 | const ClearPredictorCacheCallback& callback) override; |
| 40 | |
| 41 | // The Profile associated with our renderer process. This should only be |
| 42 | // accessed on the UI thread! |
| 43 | // TODO(623967): Store the Predictor* here instead of the Profile. |
| 44 | Profile* profile_; |
| 45 | scoped_refptr<net::URLRequestContextGetter> request_context_; |
| 46 | |
| 47 | DISALLOW_COPY_AND_ASSIGN(NetBenchmarking); |
| 48 | }; |
| 49 | |
| 50 | #endif // CHROME_BROWSER_NET_BENCHMARKING_H_ |