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

Unified Diff: net/http/http_network_transaction.h

Issue 1901533002: Implementation of network level throttler. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Destroy transaction before session in QuicUploadWriteError. Created 4 years, 2 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
« no previous file with comments | « net/http/http_network_session_peer.cc ('k') | net/http/http_network_transaction.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/http_network_transaction.h
diff --git a/net/http/http_network_transaction.h b/net/http/http_network_transaction.h
index 198f1ce61ffe492414af43e9a4e608c3a788050f..aa49723c23c177834533405196b411582316e764 100644
--- a/net/http/http_network_transaction.h
+++ b/net/http/http_network_transaction.h
@@ -17,6 +17,7 @@
#include "crypto/ec_private_key.h"
#include "net/base/net_error_details.h"
#include "net/base/net_export.h"
+#include "net/base/network_throttle_manager.h"
#include "net/base/request_priority.h"
#include "net/http/http_auth.h"
#include "net/http/http_request_headers.h"
@@ -50,7 +51,8 @@ struct HttpRequestInfo;
class NET_EXPORT_PRIVATE HttpNetworkTransaction
: public HttpTransaction,
- public HttpStreamRequest::Delegate {
+ public HttpStreamRequest::Delegate,
+ public NetworkThrottleManager::ThrottleDelegate {
public:
HttpNetworkTransaction(RequestPriority priority,
HttpNetworkSession* session);
@@ -121,6 +123,9 @@ class NET_EXPORT_PRIVATE HttpNetworkTransaction
void OnQuicBroken() override;
void GetConnectionAttempts(ConnectionAttempts* out) const override;
+ // NetworkThrottleManager::Delegate methods:
+ void OnThrottleStateChanged() override;
+
private:
friend class HttpNetworkTransactionSSLTest;
@@ -142,6 +147,8 @@ class NET_EXPORT_PRIVATE HttpNetworkTransaction
FlowControlNegativeSendWindowSize);
enum State {
+ STATE_THROTTLE,
+ STATE_THROTTLE_COMPLETE,
STATE_NOTIFY_BEFORE_CREATE_STREAM,
STATE_CREATE_STREAM,
STATE_CREATE_STREAM_COMPLETE,
@@ -188,6 +195,8 @@ class NET_EXPORT_PRIVATE HttpNetworkTransaction
// argument receive the result from the previous state. If a method returns
// ERR_IO_PENDING, then the result from OnIOComplete will be passed to the
// next state method as the result arg.
+ int DoThrottle();
+ int DoThrottleComplete();
int DoNotifyBeforeCreateStream();
int DoCreateStream();
int DoCreateStreamComplete(int result);
@@ -383,6 +392,11 @@ class NET_EXPORT_PRIVATE HttpNetworkTransaction
IPEndPoint remote_endpoint_;
// Network error details for this transaction.
NetErrorDetails net_error_details_;
+
+ // Communicate lifetime of transaction to the throttler, and
+ // throttled state to the transaction.
+ std::unique_ptr<NetworkThrottleManager::Throttle> throttle_;
+
DISALLOW_COPY_AND_ASSIGN(HttpNetworkTransaction);
};
« no previous file with comments | « net/http/http_network_session_peer.cc ('k') | net/http/http_network_transaction.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698