Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5501)

Unified Diff: chrome/browser/devtools/devtools_network_controller.h

Issue 324953002: DevToolsNetworkController: support "limit throughput" network condition. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed nits Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..a9edd0fe31d5d10cac0f9bb15c603243018feb8c 100644
--- a/chrome/browser/devtools/devtools_network_controller.h
+++ b/chrome/browser/devtools/devtools_network_controller.h
@@ -7,18 +7,25 @@
#include <set>
#include <string>
+#include <vector>
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#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 +50,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 +66,23 @@ 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();
+
+ std::vector<DevToolsNetworkTransaction*> throttled_transactions_;
+ 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);
« no previous file with comments | « chrome/browser/devtools/chrome_devtools_manager_delegate.cc ('k') | chrome/browser/devtools/devtools_network_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698