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

Side by Side Diff: chrome/browser/devtools/devtools_network_transaction.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 unified diff | Download patch
OLDNEW
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_TRANSACTION_H_ 5 #ifndef CHROME_BROWSER_DEVTOOLS_DEVTOOLS_NETWORK_TRANSACTION_H_
6 #define CHROME_BROWSER_DEVTOOLS_DEVTOOLS_NETWORK_TRANSACTION_H_ 6 #define CHROME_BROWSER_DEVTOOLS_DEVTOOLS_NETWORK_TRANSACTION_H_
7 7
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "net/base/completion_callback.h" 9 #include "net/base/completion_callback.h"
10 #include "net/base/load_states.h" 10 #include "net/base/load_states.h"
(...skipping 29 matching lines...) Expand all
40 scoped_ptr<net::HttpTransaction> network_transaction); 40 scoped_ptr<net::HttpTransaction> network_transaction);
41 41
42 virtual ~DevToolsNetworkTransaction(); 42 virtual ~DevToolsNetworkTransaction();
43 43
44 const net::HttpRequestInfo* request() const { return request_; } 44 const net::HttpRequestInfo* request() const { return request_; }
45 bool failed() const { return failed_; } 45 bool failed() const { return failed_; }
46 46
47 // Runs callback (if any) with net::ERR_INTERNET_DISCONNECTED result value. 47 // Runs callback (if any) with net::ERR_INTERNET_DISCONNECTED result value.
48 void Fail(); 48 void Fail();
49 49
50 int64_t throttled_byte_count() const { return throttled_byte_count_; }
51 void DecreaseThrottledByteCount(int64_t delta) {
52 throttled_byte_count_ -= delta;
53 }
54
55 void FireThrottledCallback();
56
50 // HttpTransaction methods: 57 // HttpTransaction methods:
51 virtual int Start( 58 virtual int Start(
52 const net::HttpRequestInfo* request, 59 const net::HttpRequestInfo* request,
53 const net::CompletionCallback& callback, 60 const net::CompletionCallback& callback,
54 const net::BoundNetLog& net_log) OVERRIDE; 61 const net::BoundNetLog& net_log) OVERRIDE;
55 virtual int RestartIgnoringLastError( 62 virtual int RestartIgnoringLastError(
56 const net::CompletionCallback& callback) OVERRIDE; 63 const net::CompletionCallback& callback) OVERRIDE;
57 virtual int RestartWithCertificate( 64 virtual int RestartWithCertificate(
58 net::X509Certificate* client_cert, 65 net::X509Certificate* client_cert,
59 const net::CompletionCallback& callback) OVERRIDE; 66 const net::CompletionCallback& callback) OVERRIDE;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 scoped_ptr<net::HttpTransaction> network_transaction_; 102 scoped_ptr<net::HttpTransaction> network_transaction_;
96 103
97 const net::HttpRequestInfo* request_; 104 const net::HttpRequestInfo* request_;
98 105
99 // True if Start was already invoked. 106 // True if Start was already invoked.
100 bool started_; 107 bool started_;
101 108
102 // True if Fail was already invoked. 109 // True if Fail was already invoked.
103 bool failed_; 110 bool failed_;
104 111
112 enum CallbackType {
113 NONE,
114 READ,
115 RESTART_IGNORING_LAST_ERROR,
116 RESTART_WITH_AUTH,
117 RESTART_WITH_CERTIFICATE,
118 START
119 };
120
121 int SetupCallback(
122 net::CompletionCallback callback,
123 int result,
124 CallbackType callback_type);
125
126 void Throttle(int result);
127
128 int throttled_result_;
129 int64_t throttled_byte_count_;
130 CallbackType callback_type_;
105 net::CompletionCallback proxy_callback_; 131 net::CompletionCallback proxy_callback_;
106 net::CompletionCallback callback_; 132 net::CompletionCallback callback_;
107 133
108 DISALLOW_COPY_AND_ASSIGN(DevToolsNetworkTransaction); 134 DISALLOW_COPY_AND_ASSIGN(DevToolsNetworkTransaction);
109 }; 135 };
110 136
111 #endif // CHROME_BROWSER_DEVTOOLS_DEVTOOLS_NETWORK_TRANSACTION_H_ 137 #endif // CHROME_BROWSER_DEVTOOLS_DEVTOOLS_NETWORK_TRANSACTION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698