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

Side by Side Diff: chrome/browser/devtools/devtools_network_realm.h

Issue 342473004: DevTools: make network conditions emulation scoped (browser) (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 unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_DEVTOOLS_DEVTOOLS_NETWORK_REALM_H_
6 #define CHROME_BROWSER_DEVTOOLS_DEVTOOLS_NETWORK_REALM_H_
7
8 #include <string>
9 #include <vector>
10
11 #include "base/macros.h"
12 #include "base/memory/ref_counted.h"
13 #include "base/timer/timer.h"
14
15 class DevToolsNetworkConditions;
16 class DevToolsNetworkTransaction;
17
18 namespace base {
19 class TimeDelta;
20 class TimeTicks;
21 }
22
23 // DevToolsNetworkRealm emulates network conditions for transactions with
24 // specific client id.
25 class DevToolsNetworkRealm {
26
27 public:
28 DevToolsNetworkRealm();
29 virtual ~DevToolsNetworkRealm();
30
31 void RemoveTransaction(DevToolsNetworkTransaction* transaction);
32
33 // Applies network emulation configuration.
34 void UpdateConditions(
35 const scoped_refptr<DevToolsNetworkConditions> conditions);
36
37 void ThrottleTransaction(DevToolsNetworkTransaction* transaction);
38
39 const DevToolsNetworkConditions* conditions() const {
40 return conditions_.get();
41 }
42
43 private:
44 scoped_refptr<DevToolsNetworkConditions> conditions_;
45
46 void UpdateThrottles();
47 void ArmTimer();
48 void OnTimer();
49
50 std::vector<DevToolsNetworkTransaction*> throttled_transactions_;
51 base::OneShotTimer<DevToolsNetworkRealm> timer_;
52 base::TimeTicks offset_;
53 base::TimeDelta tick_length_;
54 uint64_t last_tick_;
55
56 DISALLOW_COPY_AND_ASSIGN(DevToolsNetworkRealm);
57 };
58
59 #endif // CHROME_BROWSER_DEVTOOLS_DEVTOOLS_NETWORK_REALM_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698