OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_DEVTOOLS_DEVTOOLS_NETWORK_CONDITIONS_H_ | 5 #ifndef CHROME_BROWSER_DEVTOOLS_DEVTOOLS_NETWORK_CONDITIONS_H_ |
6 #define CHROME_BROWSER_DEVTOOLS_DEVTOOLS_NETWORK_CONDITIONS_H_ | 6 #define CHROME_BROWSER_DEVTOOLS_DEVTOOLS_NETWORK_CONDITIONS_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
12 | 12 |
13 class GURL; | 13 class GURL; |
14 | 14 |
15 // DevToolsNetworkConditions holds information about desired network conditions. | 15 // DevToolsNetworkConditions holds information about desired network conditions. |
16 class DevToolsNetworkConditions | 16 class DevToolsNetworkConditions |
17 : public base::RefCounted<DevToolsNetworkConditions> { | 17 : public base::RefCounted<DevToolsNetworkConditions> { |
18 public: | 18 public: |
19 DevToolsNetworkConditions(const std::vector<std::string>& domains, | 19 DevToolsNetworkConditions(); |
20 double maximal_throughput); | 20 explicit DevToolsNetworkConditions(bool offline); |
| 21 DevToolsNetworkConditions(bool offline, |
| 22 double latency, |
| 23 double download_throughput, |
| 24 double upload_throughput); |
21 | 25 |
22 bool HasMatchingDomain(const GURL& url) const; | |
23 bool IsOffline() const; | |
24 bool IsThrottling() const; | 26 bool IsThrottling() const; |
25 | 27 |
26 double maximal_throughput() const { return maximal_throughput_; } | 28 bool offline() const { return offline_; } |
| 29 double latency() const { return latency_; } |
| 30 double download_throughput() const { return download_throughput_; } |
| 31 double upload_throughput() const { return upload_throughput_; } |
27 | 32 |
28 private: | 33 private: |
29 friend class base::RefCounted<DevToolsNetworkConditions>; | 34 friend class base::RefCounted<DevToolsNetworkConditions>; |
30 | 35 |
31 virtual ~DevToolsNetworkConditions(); | 36 virtual ~DevToolsNetworkConditions(); |
32 | 37 |
33 // List of domains that will be affected by network conditions. | 38 const bool offline_; |
34 typedef std::vector<std::string> Domains; | 39 const double latency_; |
35 const Domains domains_; | 40 const double download_throughput_; |
36 const double maximal_throughput_; | 41 const double upload_throughput_; |
37 | 42 |
38 DISALLOW_COPY_AND_ASSIGN(DevToolsNetworkConditions); | 43 DISALLOW_COPY_AND_ASSIGN(DevToolsNetworkConditions); |
39 }; | 44 }; |
40 | 45 |
41 #endif // CHROME_BROWSER_DEVTOOLS_DEVTOOLS_NETWORK_CONDITIONS_H_ | 46 #endif // CHROME_BROWSER_DEVTOOLS_DEVTOOLS_NETWORK_CONDITIONS_H_ |
OLD | NEW |