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

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: One more divide-by-zero check 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 void FireThrottledCallback();
51
50 // HttpTransaction methods: 52 // HttpTransaction methods:
51 virtual int Start( 53 virtual int Start(
52 const net::HttpRequestInfo* request, 54 const net::HttpRequestInfo* request,
53 const net::CompletionCallback& callback, 55 const net::CompletionCallback& callback,
54 const net::BoundNetLog& net_log) OVERRIDE; 56 const net::BoundNetLog& net_log) OVERRIDE;
55 virtual int RestartIgnoringLastError( 57 virtual int RestartIgnoringLastError(
56 const net::CompletionCallback& callback) OVERRIDE; 58 const net::CompletionCallback& callback) OVERRIDE;
57 virtual int RestartWithCertificate( 59 virtual int RestartWithCertificate(
58 net::X509Certificate* client_cert, 60 net::X509Certificate* client_cert,
59 const net::CompletionCallback& callback) OVERRIDE; 61 const net::CompletionCallback& callback) OVERRIDE;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 scoped_ptr<net::HttpTransaction> network_transaction_; 97 scoped_ptr<net::HttpTransaction> network_transaction_;
96 98
97 const net::HttpRequestInfo* request_; 99 const net::HttpRequestInfo* request_;
98 100
99 // True if Start was already invoked. 101 // True if Start was already invoked.
100 bool started_; 102 bool started_;
101 103
102 // True if Fail was already invoked. 104 // True if Fail was already invoked.
103 bool failed_; 105 bool failed_;
104 106
107 enum CallbackType {
108 NONE,
109 READ,
110 RESTART_IGNORING_LAST_ERROR,
111 RESTART_WITH_AUTH,
112 RESTART_WITH_CERTIFICATE,
113 START
114 };
115
116 int SetupCallback(
117 net::CompletionCallback callback,
118 int result,
119 CallbackType callback_type);
120
121 void Throttle(int result);
122
123 int throttled_result_;
124 CallbackType callback_type_;
105 net::CompletionCallback proxy_callback_; 125 net::CompletionCallback proxy_callback_;
106 net::CompletionCallback callback_; 126 net::CompletionCallback callback_;
107 127
108 DISALLOW_COPY_AND_ASSIGN(DevToolsNetworkTransaction); 128 DISALLOW_COPY_AND_ASSIGN(DevToolsNetworkTransaction);
109 }; 129 };
110 130
111 #endif // CHROME_BROWSER_DEVTOOLS_DEVTOOLS_NETWORK_TRANSACTION_H_ 131 #endif // CHROME_BROWSER_DEVTOOLS_DEVTOOLS_NETWORK_TRANSACTION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698