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..c9f46f15ab24597f7014fda2c14e5816f5e67ed4 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; |
} |
@@ -31,6 +37,10 @@ namespace test { |
class DevToolsNetworkControllerHelper; |
} |
+namespace { |
+struct Throttle; |
+} |
+ |
// DevToolsNetworkController tracks DevToolsNetworkTransactions. |
class DevToolsNetworkController { |
@@ -49,6 +59,9 @@ class DevToolsNetworkController { |
const scoped_refptr<DevToolsNetworkConditions> conditions); |
bool ShouldFail(const net::HttpRequestInfo* request); |
+ bool ShouldThrottle(const net::HttpRequestInfo* request); |
+ void ThrottleTransaction(DevToolsNetworkTransaction* transaction, |
+ int64_t penalty); |
protected: |
friend class test::DevToolsNetworkControllerHelper; |
@@ -72,6 +85,19 @@ class DevToolsNetworkController { |
// Active network conditions. |
Conditions conditions_; |
+ void UpdateThrottles(); |
+ void FireThrottledCallbacks(); |
+ void CancelThrottles(); |
+ void ArmTimer(); |
+ void OnTimer(); |
+ |
+ typedef std::vector<Throttle> 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); |