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

Unified Diff: net/quic/quic_stream_factory.cc

Issue 1692253004: QUIC - chromium server push support. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Initial for-review version Created 4 years, 10 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/quic/quic_stream_factory.cc
diff --git a/net/quic/quic_stream_factory.cc b/net/quic/quic_stream_factory.cc
index 61af6c27e2248687a9380c61ebbd3f98671ffcad..5b2f52e40905b24aabc1d0f6e2323bf908ecce06 100644
--- a/net/quic/quic_stream_factory.cc
+++ b/net/quic/quic_stream_factory.cc
@@ -38,6 +38,7 @@
#include "net/quic/quic_chromium_connection_helper.h"
#include "net/quic/quic_chromium_packet_reader.h"
#include "net/quic/quic_chromium_packet_writer.h"
+#include "net/quic/quic_client_promised_info.h"
#include "net/quic/quic_clock.h"
#include "net/quic/quic_connection.h"
#include "net/quic/quic_crypto_client_stream_factory.h"
@@ -508,6 +509,7 @@ int QuicStreamRequest::Request(const HostPortPair& host_port_pair,
int cert_verify_flags,
base::StringPiece origin_host,
base::StringPiece method,
+ const string& url,
const BoundNetLog& net_log,
const CompletionCallback& callback) {
DCHECK(!stream_);
@@ -516,7 +518,7 @@ int QuicStreamRequest::Request(const HostPortPair& host_port_pair,
origin_host_ = origin_host.as_string();
privacy_mode_ = privacy_mode;
int rv = factory_->Create(host_port_pair, privacy_mode, cert_verify_flags,
- origin_host, method, net_log, this);
+ origin_host, method, url, net_log, this);
if (rv == ERR_IO_PENDING) {
host_port_pair_ = host_port_pair;
net_log_ = net_log;
@@ -642,6 +644,7 @@ QuicStreamFactory::QuicStreamFactory(
port_seed_(random_generator_->RandUint64()),
check_persisted_supports_quic_(true),
has_initialized_data_(false),
+ num_push_streams_created_(0),
task_runner_(nullptr),
weak_factory_(this) {
if (disable_quic_on_timeout_with_open_streams)
@@ -762,8 +765,26 @@ int QuicStreamFactory::Create(const HostPortPair& host_port_pair,
int cert_verify_flags,
base::StringPiece origin_host,
base::StringPiece method,
+ const std::string& url,
const BoundNetLog& net_log,
QuicStreamRequest* request) {
+ // Enforce session affinity for promised streams.
+ QuicClientPromisedInfo* promised = push_promise_index_.GetPromised(url);
+ if (promised) {
+ QuicChromiumClientSession* session =
+ static_cast<QuicChromiumClientSession*>(promised->session());
+ DCHECK(session);
+ if (session->server_id().privacy_mode() == privacy_mode) {
+ request->set_stream(CreateFromSession(session));
+ ++num_push_streams_created_;
+ return OK;
+ }
+ // This should happen extremely rarely (if ever), but if somehow a
+ // request comes in with a mismatched privacy mode, consider the
+ // promise borked.
+ promised->Cancel();
Ryan Hamilton 2016/02/24 00:34:00 This suggests that privacy_mode should be part of
Buck 2016/02/26 23:54:17 It could but I think it would lead to some extra m
Ryan Hamilton 2016/02/29 17:49:40 I thought that privacy_mode was a field of HttpReq
Buck 2016/02/29 19:03:01 Yep, I was mistaken about privacy_mode availabilty
+ }
+
QuicServerId server_id(host_port_pair, privacy_mode);
// TODO(rtenneti): crbug.com/498823 - delete active_sessions_.empty() checks.
if (!active_sessions_.empty()) {

Powered by Google App Engine
This is Rietveld 408576698