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

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: Incorporated latest round of comments." . Created 4 years, 7 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: net/http/http_network_transaction.h
diff --git a/net/http/http_network_transaction.h b/net/http/http_network_transaction.h
index f95cd36d8219d5ab7f77dccb466d1657e8ce31b8..d8638aa276f4d45a50941a2febe7a1fec9aa4682 100644
--- a/net/http/http_network_transaction.h
+++ b/net/http/http_network_transaction.h
@@ -16,6 +16,7 @@
#include "base/time/time.h"
#include "crypto/ec_private_key.h"
#include "net/base/net_error_details.h"
+#include "net/base/network_stream_throttler.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 NetworkStreamThrottler::Delegate {
public:
HttpNetworkTransaction(RequestPriority priority,
HttpNetworkSession* session);
@@ -124,6 +126,9 @@ class NET_EXPORT_PRIVATE HttpNetworkTransaction
void OnQuicBroken() override;
void GetConnectionAttempts(ConnectionAttempts* out) const override;
+ // NetworkStreamThrottler::Delegate methods:
+ void OnThrottleStateChanged() override;
+
private:
friend class HttpNetworkTransactionSSLTest;
@@ -145,6 +150,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,
@@ -191,6 +198,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);
@@ -394,6 +403,11 @@ class NET_EXPORT_PRIVATE HttpNetworkTransaction
IPEndPoint remote_endpoint_;
// Network error details for this transaction.
NetErrorDetails net_error_details_;
+
+ // Communciate lifetime of transaction to the throttler, and
+ // throttled state to the transaction.
+ std::unique_ptr<NetworkStreamThrottler::Throttle> throttle_;
+
DISALLOW_COPY_AND_ASSIGN(HttpNetworkTransaction);
};

Powered by Google App Engine
This is Rietveld 408576698