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

Side by Side Diff: net/http/http_stream_factory_impl_request.cc

Issue 6592027: Update NetLog in preparation for late binding of HttpStream jobs to requests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address nits. Created 9 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « net/http/http_stream_factory_impl_request.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #include "net/http/http_stream_factory_impl_request.h" 5 #include "net/http/http_stream_factory_impl_request.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/stl_util-inl.h" 8 #include "base/stl_util-inl.h"
9 #include "net/http/http_stream_factory_impl_job.h" 9 #include "net/http/http_stream_factory_impl_job.h"
10 10
11 namespace net { 11 namespace net {
12 12
13 HttpStreamFactoryImpl::Request::Request(const GURL& url, 13 HttpStreamFactoryImpl::Request::Request(const GURL& url,
14 HttpStreamFactoryImpl* factory, 14 HttpStreamFactoryImpl* factory,
15 HttpStreamRequest::Delegate* delegate) 15 HttpStreamRequest::Delegate* delegate,
16 const BoundNetLog& net_log)
16 : url_(url), 17 : url_(url),
17 factory_(factory), 18 factory_(factory),
18 delegate_(delegate), 19 delegate_(delegate),
20 net_log_(net_log),
19 job_(NULL), 21 job_(NULL),
20 completed_(false), 22 completed_(false),
21 was_alternate_protocol_available_(false), 23 was_alternate_protocol_available_(false),
22 was_npn_negotiated_(false), 24 was_npn_negotiated_(false),
23 using_spdy_(false) { 25 using_spdy_(false) {
24 DCHECK(factory_); 26 DCHECK(factory_);
25 DCHECK(delegate_); 27 DCHECK(delegate_);
28
29 net_log_.BeginEvent(NetLog::TYPE_HTTP_STREAM_REQUEST, NULL);
26 } 30 }
27 31
28 HttpStreamFactoryImpl::Request::~Request() { 32 HttpStreamFactoryImpl::Request::~Request() {
33 net_log_.EndEvent(NetLog::TYPE_HTTP_STREAM_REQUEST, NULL);
34
29 factory_->request_map_.erase(job_); 35 factory_->request_map_.erase(job_);
30 36
31 // TODO(willchan): Remove this when we decouple requests and jobs. 37 // TODO(willchan): Remove this when we decouple requests and jobs.
32 delete job_; 38 delete job_;
33 39
34 RemoveRequestFromSpdySessionRequestMap(); 40 RemoveRequestFromSpdySessionRequestMap();
35 } 41 }
36 42
37 void HttpStreamFactoryImpl::Request::SetSpdySessionKey( 43 void HttpStreamFactoryImpl::Request::SetSpdySessionKey(
38 const HostPortProxyPair& spdy_session_key) { 44 const HostPortProxyPair& spdy_session_key) {
39 DCHECK(!spdy_session_key_.get()); 45 DCHECK(!spdy_session_key_.get());
40 spdy_session_key_.reset(new HostPortProxyPair(spdy_session_key)); 46 spdy_session_key_.reset(new HostPortProxyPair(spdy_session_key));
41 RequestSet& request_set = 47 RequestSet& request_set =
42 factory_->spdy_session_request_map_[spdy_session_key]; 48 factory_->spdy_session_request_map_[spdy_session_key];
43 DCHECK(!ContainsKey(request_set, this)); 49 DCHECK(!ContainsKey(request_set, this));
44 request_set.insert(this); 50 request_set.insert(this);
45 } 51 }
46 52
47 void HttpStreamFactoryImpl::Request::BindJob(HttpStreamFactoryImpl::Job* job) { 53 void HttpStreamFactoryImpl::Request::BindJob(HttpStreamFactoryImpl::Job* job) {
48 DCHECK(job); 54 DCHECK(job);
49 DCHECK(!job_); 55 DCHECK(!job_);
50 job_ = job; 56 job_ = job;
51 } 57 }
52 58
53 void HttpStreamFactoryImpl::Request::Complete( 59 void HttpStreamFactoryImpl::Request::Complete(
54 bool was_alternate_protocol_available, 60 bool was_alternate_protocol_available,
55 bool was_npn_negotiated, 61 bool was_npn_negotiated,
56 bool using_spdy) { 62 bool using_spdy,
63 const NetLog::Source& job_source) {
57 DCHECK(!completed_); 64 DCHECK(!completed_);
58 completed_ = true; 65 completed_ = true;
59 was_alternate_protocol_available_ = was_alternate_protocol_available; 66 was_alternate_protocol_available_ = was_alternate_protocol_available;
60 was_npn_negotiated_ = was_npn_negotiated; 67 was_npn_negotiated_ = was_npn_negotiated;
61 using_spdy_ = using_spdy; 68 using_spdy_ = using_spdy;
69 net_log_.AddEvent(
70 NetLog::TYPE_HTTP_STREAM_REQUEST_BOUND_TO_JOB,
71 make_scoped_refptr(new NetLogSourceParameter(
72 "source_dependency", job_source)));
62 } 73 }
63 74
64 void HttpStreamFactoryImpl::Request::OnStreamReady( 75 void HttpStreamFactoryImpl::Request::OnStreamReady(
65 const SSLConfig& used_ssl_config, 76 const SSLConfig& used_ssl_config,
66 const ProxyInfo& used_proxy_info, 77 const ProxyInfo& used_proxy_info,
67 HttpStream* stream) { 78 HttpStream* stream) {
68 DCHECK(stream); 79 DCHECK(stream);
69 DCHECK(completed_); 80 DCHECK(completed_);
70 delegate_->OnStreamReady(used_ssl_config, used_proxy_info, stream); 81 delegate_->OnStreamReady(used_ssl_config, used_proxy_info, stream);
71 } 82 }
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 spdy_session_request_map[*spdy_session_key_]; 159 spdy_session_request_map[*spdy_session_key_];
149 DCHECK(ContainsKey(request_set, this)); 160 DCHECK(ContainsKey(request_set, this));
150 request_set.erase(this); 161 request_set.erase(this);
151 if (request_set.empty()) 162 if (request_set.empty())
152 spdy_session_request_map.erase(*spdy_session_key_); 163 spdy_session_request_map.erase(*spdy_session_key_);
153 spdy_session_key_.reset(); 164 spdy_session_key_.reset();
154 } 165 }
155 } 166 }
156 167
157 } // namespace net 168 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_stream_factory_impl_request.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698