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(double latency, |
20 double maximal_throughput); | 20 double download_throughput, |
| 21 double upload_throughput); |
21 | 22 |
22 bool HasMatchingDomain(const GURL& url) const; | |
23 bool IsOffline() const; | 23 bool IsOffline() const; |
24 bool IsThrottling() const; | 24 bool IsThrottling() const; |
25 | 25 |
26 double maximal_throughput() const { return maximal_throughput_; } | 26 double latency() const { return latency_; } |
| 27 double download_throughput() const { return download_throughput_; } |
| 28 double upload_throughput() const { return upload_throughput_; } |
27 | 29 |
28 private: | 30 private: |
29 friend class base::RefCounted<DevToolsNetworkConditions>; | 31 friend class base::RefCounted<DevToolsNetworkConditions>; |
30 | 32 |
31 virtual ~DevToolsNetworkConditions(); | 33 virtual ~DevToolsNetworkConditions(); |
32 | 34 |
33 // List of domains that will be affected by network conditions. | 35 const double latency_; |
34 typedef std::vector<std::string> Domains; | 36 const double download_throughput_; |
35 const Domains domains_; | 37 const double upload_throughput_; |
36 const double maximal_throughput_; | |
37 | 38 |
38 DISALLOW_COPY_AND_ASSIGN(DevToolsNetworkConditions); | 39 DISALLOW_COPY_AND_ASSIGN(DevToolsNetworkConditions); |
39 }; | 40 }; |
40 | 41 |
41 #endif // CHROME_BROWSER_DEVTOOLS_DEVTOOLS_NETWORK_CONDITIONS_H_ | 42 #endif // CHROME_BROWSER_DEVTOOLS_DEVTOOLS_NETWORK_CONDITIONS_H_ |
OLD | NEW |