| Index: chrome/browser/devtools/devtools_network_controller.h
|
| diff --git a/chrome/browser/devtools/devtools_network_controller.h b/chrome/browser/devtools/devtools_network_controller.h
|
| index f057412e5a23be36d92438d7e3b9c46115cb5ec1..4b6f0c175245906a56fa23d19aeb42054c60eab8 100644
|
| --- a/chrome/browser/devtools/devtools_network_controller.h
|
| +++ b/chrome/browser/devtools/devtools_network_controller.h
|
| @@ -13,12 +13,18 @@
|
| #include "base/memory/scoped_ptr.h"
|
| #include "base/memory/weak_ptr.h"
|
| #include "base/threading/thread_checker.h"
|
| +#include "base/timer/timer.h"
|
|
|
| class DevToolsNetworkConditions;
|
| class DevToolsNetworkTransaction;
|
| class GURL;
|
| class Profile;
|
|
|
| +namespace base {
|
| +class TimeDelta;
|
| +class TimeTicks;
|
| +}
|
| +
|
| namespace content {
|
| class ResourceContext;
|
| }
|
| @@ -43,12 +49,12 @@ class DevToolsNetworkController {
|
| void RemoveTransaction(DevToolsNetworkTransaction* transaction);
|
|
|
| // Applies network emulation configuration.
|
| - // |client_id| should be DevToolsAgentHost GUID.
|
| void SetNetworkState(
|
| - const std::string& client_id,
|
| const scoped_refptr<DevToolsNetworkConditions> conditions);
|
|
|
| bool ShouldFail(const net::HttpRequestInfo* request);
|
| + bool ShouldThrottle(const net::HttpRequestInfo* request);
|
| + void ThrottleTransaction(DevToolsNetworkTransaction* transaction);
|
|
|
| protected:
|
| friend class test::DevToolsNetworkControllerHelper;
|
| @@ -59,19 +65,24 @@ class DevToolsNetworkController {
|
|
|
| typedef scoped_refptr<DevToolsNetworkConditions> Conditions;
|
|
|
| - void SetNetworkStateOnIO(
|
| - const std::string& client_id,
|
| - const Conditions conditions);
|
| + void SetNetworkStateOnIO(const Conditions conditions);
|
|
|
| typedef std::set<DevToolsNetworkTransaction*> Transactions;
|
| Transactions transactions_;
|
|
|
| - // Active client id.
|
| - std::string active_client_id_;
|
| -
|
| - // Active network conditions.
|
| Conditions conditions_;
|
|
|
| + void UpdateThrottles();
|
| + void ArmTimer();
|
| + void OnTimer();
|
| +
|
| + typedef std::vector<DevToolsNetworkTransaction*> Throttles;
|
| + Throttles throttles_;
|
| + base::OneShotTimer<DevToolsNetworkController> timer_;
|
| + base::TimeTicks offset_;
|
| + base::TimeDelta tick_length_;
|
| + uint64_t last_tick_;
|
| +
|
| base::WeakPtrFactory<DevToolsNetworkController> weak_ptr_factory_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(DevToolsNetworkController);
|
|
|