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

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

Issue 10534129: NetLogEventParameter to Callback refactoring 5. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 6 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
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 #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.h" 8 #include "base/stl_util.h"
9 #include "net/http/http_stream_factory_impl_job.h" 9 #include "net/http/http_stream_factory_impl_job.h"
10 #include "net/spdy/spdy_http_stream.h" 10 #include "net/spdy/spdy_http_stream.h"
11 #include "net/spdy/spdy_session.h" 11 #include "net/spdy/spdy_session.h"
12 12
13 namespace net { 13 namespace net {
14 14
15 HttpStreamFactoryImpl::Request::Request(const GURL& url, 15 HttpStreamFactoryImpl::Request::Request(const GURL& url,
16 HttpStreamFactoryImpl* factory, 16 HttpStreamFactoryImpl* factory,
17 HttpStreamRequest::Delegate* delegate, 17 HttpStreamRequest::Delegate* delegate,
18 const BoundNetLog& net_log) 18 const BoundNetLog& net_log)
19 : url_(url), 19 : url_(url),
20 factory_(factory), 20 factory_(factory),
21 delegate_(delegate), 21 delegate_(delegate),
22 net_log_(net_log), 22 net_log_(net_log),
23 completed_(false), 23 completed_(false),
24 was_npn_negotiated_(false), 24 was_npn_negotiated_(false),
25 protocol_negotiated_(kProtoUnknown), 25 protocol_negotiated_(kProtoUnknown),
26 using_spdy_(false) { 26 using_spdy_(false) {
27 DCHECK(factory_); 27 DCHECK(factory_);
28 DCHECK(delegate_); 28 DCHECK(delegate_);
29 29
30 net_log_.BeginEvent(NetLog::TYPE_HTTP_STREAM_REQUEST, NULL); 30 net_log_.BeginEvent(NetLog::TYPE_HTTP_STREAM_REQUEST);
31 } 31 }
32 32
33 HttpStreamFactoryImpl::Request::~Request() { 33 HttpStreamFactoryImpl::Request::~Request() {
34 if (bound_job_.get()) 34 if (bound_job_.get())
35 DCHECK(jobs_.empty()); 35 DCHECK(jobs_.empty());
36 else 36 else
37 DCHECK(!jobs_.empty()); 37 DCHECK(!jobs_.empty());
38 38
39 net_log_.EndEvent(NetLog::TYPE_HTTP_STREAM_REQUEST, NULL); 39 net_log_.EndEvent(NetLog::TYPE_HTTP_STREAM_REQUEST);
40 40
41 for (std::set<Job*>::iterator it = jobs_.begin(); it != jobs_.end(); ++it) 41 for (std::set<Job*>::iterator it = jobs_.begin(); it != jobs_.end(); ++it)
42 factory_->request_map_.erase(*it); 42 factory_->request_map_.erase(*it);
43 43
44 RemoveRequestFromSpdySessionRequestMap(); 44 RemoveRequestFromSpdySessionRequestMap();
45 RemoveRequestFromHttpPipeliningRequestMap(); 45 RemoveRequestFromHttpPipeliningRequestMap();
46 46
47 STLDeleteElements(&jobs_); 47 STLDeleteElements(&jobs_);
48 } 48 }
49 49
(...skipping 30 matching lines...) Expand all
80 NextProto protocol_negotiated, 80 NextProto protocol_negotiated,
81 bool using_spdy, 81 bool using_spdy,
82 const BoundNetLog& job_net_log) { 82 const BoundNetLog& job_net_log) {
83 DCHECK(!completed_); 83 DCHECK(!completed_);
84 completed_ = true; 84 completed_ = true;
85 was_npn_negotiated_ = was_npn_negotiated; 85 was_npn_negotiated_ = was_npn_negotiated;
86 protocol_negotiated_ = protocol_negotiated; 86 protocol_negotiated_ = protocol_negotiated;
87 using_spdy_ = using_spdy; 87 using_spdy_ = using_spdy;
88 net_log_.AddEvent( 88 net_log_.AddEvent(
89 NetLog::TYPE_HTTP_STREAM_REQUEST_BOUND_TO_JOB, 89 NetLog::TYPE_HTTP_STREAM_REQUEST_BOUND_TO_JOB,
90 make_scoped_refptr(new NetLogSourceParameter( 90 job_net_log.source().ToEventParametersCallback());
91 "source_dependency", job_net_log.source())));
92 job_net_log.AddEvent( 91 job_net_log.AddEvent(
93 NetLog::TYPE_HTTP_STREAM_JOB_BOUND_TO_REQUEST, 92 NetLog::TYPE_HTTP_STREAM_JOB_BOUND_TO_REQUEST,
94 make_scoped_refptr(new NetLogSourceParameter( 93 net_log_.source().ToEventParametersCallback());
95 "source_dependency", net_log_.source())));
96 } 94 }
97 95
98 void HttpStreamFactoryImpl::Request::OnStreamReady( 96 void HttpStreamFactoryImpl::Request::OnStreamReady(
99 Job* job, 97 Job* job,
100 const SSLConfig& used_ssl_config, 98 const SSLConfig& used_ssl_config,
101 const ProxyInfo& used_proxy_info, 99 const ProxyInfo& used_proxy_info,
102 HttpStream* stream) { 100 HttpStream* stream) {
103 DCHECK(stream); 101 DCHECK(stream);
104 DCHECK(completed_); 102 DCHECK(completed_);
105 103
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 RemoveRequestFromHttpPipeliningRequestMap(); 335 RemoveRequestFromHttpPipeliningRequestMap();
338 336
339 std::set<Job*> tmp; 337 std::set<Job*> tmp;
340 tmp.swap(jobs_); 338 tmp.swap(jobs_);
341 339
342 for (std::set<Job*>::iterator it = tmp.begin(); it != tmp.end(); ++it) 340 for (std::set<Job*>::iterator it = tmp.begin(); it != tmp.end(); ++it)
343 factory_->OrphanJob(*it, this); 341 factory_->OrphanJob(*it, this);
344 } 342 }
345 343
346 } // namespace net 344 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698