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

Side by Side 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: Created 4 years, 8 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 NET_HTTP_HTTP_NETWORK_TRANSACTION_H_ 5 #ifndef NET_HTTP_HTTP_NETWORK_TRANSACTION_H_
6 #define NET_HTTP_HTTP_NETWORK_TRANSACTION_H_ 6 #define NET_HTTP_HTTP_NETWORK_TRANSACTION_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <string> 10 #include <string>
11 11
12 #include "base/gtest_prod_util.h" 12 #include "base/gtest_prod_util.h"
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "base/memory/ref_counted.h" 14 #include "base/memory/ref_counted.h"
15 #include "base/memory/scoped_ptr.h" 15 #include "base/memory/scoped_ptr.h"
16 #include "base/time/time.h" 16 #include "base/time/time.h"
17 #include "crypto/ec_private_key.h" 17 #include "crypto/ec_private_key.h"
18 #include "net/base/net_error_details.h" 18 #include "net/base/net_error_details.h"
19 #include "net/base/network_stream_throttler.h"
19 #include "net/base/request_priority.h" 20 #include "net/base/request_priority.h"
20 #include "net/http/http_auth.h" 21 #include "net/http/http_auth.h"
21 #include "net/http/http_request_headers.h" 22 #include "net/http/http_request_headers.h"
22 #include "net/http/http_response_info.h" 23 #include "net/http/http_response_info.h"
23 #include "net/http/http_stream_factory.h" 24 #include "net/http/http_stream_factory.h"
24 #include "net/http/http_transaction.h" 25 #include "net/http/http_transaction.h"
25 #include "net/log/net_log.h" 26 #include "net/log/net_log.h"
26 #include "net/proxy/proxy_service.h" 27 #include "net/proxy/proxy_service.h"
27 #include "net/socket/connection_attempts.h" 28 #include "net/socket/connection_attempts.h"
28 #include "net/ssl/channel_id_service.h" 29 #include "net/ssl/channel_id_service.h"
(...skipping 14 matching lines...) Expand all
43 class HttpStream; 44 class HttpStream;
44 class HttpStreamRequest; 45 class HttpStreamRequest;
45 class IOBuffer; 46 class IOBuffer;
46 class ProxyInfo; 47 class ProxyInfo;
47 class SpdySession; 48 class SpdySession;
48 class SSLPrivateKey; 49 class SSLPrivateKey;
49 struct HttpRequestInfo; 50 struct HttpRequestInfo;
50 51
51 class NET_EXPORT_PRIVATE HttpNetworkTransaction 52 class NET_EXPORT_PRIVATE HttpNetworkTransaction
52 : public HttpTransaction, 53 : public HttpTransaction,
53 public HttpStreamRequest::Delegate { 54 public HttpStreamRequest::Delegate,
55 public NetworkStreamThrottler::Delegate {
54 public: 56 public:
55 HttpNetworkTransaction(RequestPriority priority, 57 HttpNetworkTransaction(RequestPriority priority,
56 HttpNetworkSession* session); 58 HttpNetworkSession* session);
57 59
58 ~HttpNetworkTransaction() override; 60 ~HttpNetworkTransaction() override;
59 61
60 // HttpTransaction methods: 62 // HttpTransaction methods:
61 int Start(const HttpRequestInfo* request_info, 63 int Start(const HttpRequestInfo* request_info,
62 const CompletionCallback& callback, 64 const CompletionCallback& callback,
63 const BoundNetLog& net_log) override; 65 const BoundNetLog& net_log) override;
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 void OnNeedsClientAuth(const SSLConfig& used_ssl_config, 119 void OnNeedsClientAuth(const SSLConfig& used_ssl_config,
118 SSLCertRequestInfo* cert_info) override; 120 SSLCertRequestInfo* cert_info) override;
119 void OnHttpsProxyTunnelResponse(const HttpResponseInfo& response_info, 121 void OnHttpsProxyTunnelResponse(const HttpResponseInfo& response_info,
120 const SSLConfig& used_ssl_config, 122 const SSLConfig& used_ssl_config,
121 const ProxyInfo& used_proxy_info, 123 const ProxyInfo& used_proxy_info,
122 HttpStream* stream) override; 124 HttpStream* stream) override;
123 125
124 void OnQuicBroken() override; 126 void OnQuicBroken() override;
125 void GetConnectionAttempts(ConnectionAttempts* out) const override; 127 void GetConnectionAttempts(ConnectionAttempts* out) const override;
126 128
129 // NetworkStreamThrottler::Delegate methods:
130 void OnThrottleStateChanged() override;
131
127 private: 132 private:
128 friend class HttpNetworkTransactionSSLTest; 133 friend class HttpNetworkTransactionSSLTest;
129 134
130 FRIEND_TEST_ALL_PREFIXES(HttpNetworkTransactionTest, 135 FRIEND_TEST_ALL_PREFIXES(HttpNetworkTransactionTest,
131 ResetStateForRestart); 136 ResetStateForRestart);
132 FRIEND_TEST_ALL_PREFIXES(HttpNetworkTransactionTest, EnableNPN); 137 FRIEND_TEST_ALL_PREFIXES(HttpNetworkTransactionTest, EnableNPN);
133 FRIEND_TEST_ALL_PREFIXES(HttpNetworkTransactionTest, DisableNPN); 138 FRIEND_TEST_ALL_PREFIXES(HttpNetworkTransactionTest, DisableNPN);
134 FRIEND_TEST_ALL_PREFIXES(SpdyNetworkTransactionTest, 139 FRIEND_TEST_ALL_PREFIXES(SpdyNetworkTransactionTest,
135 WindowUpdateReceived); 140 WindowUpdateReceived);
136 FRIEND_TEST_ALL_PREFIXES(SpdyNetworkTransactionTest, 141 FRIEND_TEST_ALL_PREFIXES(SpdyNetworkTransactionTest,
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 WebSocketHandshakeStreamBase::CreateHelper* 392 WebSocketHandshakeStreamBase::CreateHelper*
388 websocket_handshake_stream_base_create_helper_; 393 websocket_handshake_stream_base_create_helper_;
389 394
390 BeforeNetworkStartCallback before_network_start_callback_; 395 BeforeNetworkStartCallback before_network_start_callback_;
391 BeforeProxyHeadersSentCallback before_proxy_headers_sent_callback_; 396 BeforeProxyHeadersSentCallback before_proxy_headers_sent_callback_;
392 397
393 ConnectionAttempts connection_attempts_; 398 ConnectionAttempts connection_attempts_;
394 IPEndPoint remote_endpoint_; 399 IPEndPoint remote_endpoint_;
395 // Network error details for this transaction. 400 // Network error details for this transaction.
396 NetErrorDetails net_error_details_; 401 NetErrorDetails net_error_details_;
402
403 // Communciate lifetime of transaction to the throttler, and
404 // throttled state to the transaction.
405 scoped_ptr<NetworkStreamThrottler::Throttle> throttle_;
406
397 DISALLOW_COPY_AND_ASSIGN(HttpNetworkTransaction); 407 DISALLOW_COPY_AND_ASSIGN(HttpNetworkTransaction);
398 }; 408 };
399 409
400 } // namespace net 410 } // namespace net
401 411
402 #endif // NET_HTTP_HTTP_NETWORK_TRANSACTION_H_ 412 #endif // NET_HTTP_HTTP_NETWORK_TRANSACTION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698