diff options
author | willchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-28 22:25:59 +0000 |
---|---|---|
committer | willchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-28 22:25:59 +0000 |
commit | 7b496b3cc7299672eaeff93fba4a444576c60214 (patch) | |
tree | cf178fa966eff186b2918b40fc1ddb9d038287ac /net/http | |
parent | 5d97aa4302484c9fd7b78395f30dd4b063731861 (diff) | |
download | chromium_src-7b496b3cc7299672eaeff93fba4a444576c60214.zip chromium_src-7b496b3cc7299672eaeff93fba4a444576c60214.tar.gz chromium_src-7b496b3cc7299672eaeff93fba4a444576c60214.tar.bz2 |
Update NetLog in preparation for late binding of HttpStream jobs to requests.
BUG=54371,42669
TEST=Open up about:net-internals#Events and make sure HTTP_STREAM_JOBs appear and are tied together to URL_REQUESTs.
Review URL: http://codereview.chromium.org/6592027
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@76287 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/http')
-rw-r--r-- | net/http/http_stream_factory_impl.cc | 5 | ||||
-rw-r--r-- | net/http/http_stream_factory_impl_job.cc | 12 | ||||
-rw-r--r-- | net/http/http_stream_factory_impl_job.h | 2 | ||||
-rw-r--r-- | net/http/http_stream_factory_impl_request.cc | 15 | ||||
-rw-r--r-- | net/http/http_stream_factory_impl_request.h | 11 |
5 files changed, 37 insertions, 8 deletions
diff --git a/net/http/http_stream_factory_impl.cc b/net/http/http_stream_factory_impl.cc index e4e94b1..74942a3 100644 --- a/net/http/http_stream_factory_impl.cc +++ b/net/http/http_stream_factory_impl.cc @@ -34,7 +34,7 @@ HttpStreamRequest* HttpStreamFactoryImpl::RequestStream( HttpStreamRequest::Delegate* delegate, const BoundNetLog& net_log) { Job* job = new Job(this, session_); - Request* request = new Request(request_info.url, this, delegate); + Request* request = new Request(request_info.url, this, delegate, net_log); request_map_[job] = request; request->BindJob(job); job->Start(request, request_info, ssl_config, net_log); @@ -73,7 +73,8 @@ void HttpStreamFactoryImpl::OnSpdySessionReady( Request* request = request_map_[job]; request->Complete(job->was_alternate_protocol_available(), job->was_npn_negotiated(), - job->using_spdy()); + job->using_spdy(), + job->net_log().source()); bool use_relative_url = direct || request->url().SchemeIs("https"); request->OnStreamReady( job->ssl_config(), diff --git a/net/http/http_stream_factory_impl_job.cc b/net/http/http_stream_factory_impl_job.cc index 6884a79..8ae5f82 100644 --- a/net/http/http_stream_factory_impl_job.cc +++ b/net/http/http_stream_factory_impl_job.cc @@ -9,6 +9,7 @@ #include "base/string_number_conversions.h" #include "base/string_util.h" #include "base/stringprintf.h" +#include "base/values.h" #include "net/base/connection_type_histograms.h" #include "net/base/net_log.h" #include "net/base/net_util.h" @@ -76,6 +77,8 @@ HttpStreamFactoryImpl::Job::Job(HttpStreamFactoryImpl* stream_factory, } HttpStreamFactoryImpl::Job::~Job() { + net_log_.EndEvent(NetLog::TYPE_HTTP_STREAM_JOB, NULL); + // When we're in a partially constructed state, waiting for the user to // provide certificate handling information or authentication, we can't reuse // this stream at all. @@ -164,7 +167,8 @@ void HttpStreamFactoryImpl::Job::OnStreamReadyCallback() { DCHECK(stream_.get()); request_->Complete(was_alternate_protocol_available(), was_npn_negotiated(), - using_spdy()); + using_spdy(), + net_log_.source()); request_->OnStreamReady(ssl_config_, proxy_info_, stream_.release()); // |this| may be deleted after this call. } @@ -375,7 +379,11 @@ int HttpStreamFactoryImpl::Job::StartInternal( CHECK_EQ(STATE_NONE, next_state_); request_info_ = request_info; ssl_config_ = ssl_config; - net_log_ = net_log; + net_log_ = BoundNetLog::Make(net_log.net_log(), + NetLog::SOURCE_HTTP_STREAM_JOB); + net_log_.BeginEvent(NetLog::TYPE_HTTP_STREAM_JOB, + make_scoped_refptr(new NetLogStringParameter( + "url", request_info.url.GetOrigin().spec()))); next_state_ = STATE_RESOLVE_PROXY; int rv = RunLoop(OK); DCHECK_EQ(ERR_IO_PENDING, rv); diff --git a/net/http/http_stream_factory_impl_job.h b/net/http/http_stream_factory_impl_job.h index 59b0b09..5a8f029 100644 --- a/net/http/http_stream_factory_impl_job.h +++ b/net/http/http_stream_factory_impl_job.h @@ -9,6 +9,7 @@ #include "base/scoped_ptr.h" #include "base/task.h" #include "net/base/completion_callback.h" +#include "net/base/net_log.h" #include "net/base/ssl_config_service.h" #include "net/http/http_alternate_protocols.h" #include "net/http/http_auth.h" @@ -59,6 +60,7 @@ class HttpStreamFactoryImpl::Job { bool was_alternate_protocol_available() const; bool was_npn_negotiated() const; bool using_spdy() const; + const BoundNetLog& net_log() const { return net_log_; } const SSLConfig& ssl_config() const; const ProxyInfo& proxy_info() const; diff --git a/net/http/http_stream_factory_impl_request.cc b/net/http/http_stream_factory_impl_request.cc index 7826659..b6e6b9f 100644 --- a/net/http/http_stream_factory_impl_request.cc +++ b/net/http/http_stream_factory_impl_request.cc @@ -12,10 +12,12 @@ namespace net { HttpStreamFactoryImpl::Request::Request(const GURL& url, HttpStreamFactoryImpl* factory, - HttpStreamRequest::Delegate* delegate) + HttpStreamRequest::Delegate* delegate, + const BoundNetLog& net_log) : url_(url), factory_(factory), delegate_(delegate), + net_log_(net_log), job_(NULL), completed_(false), was_alternate_protocol_available_(false), @@ -23,9 +25,13 @@ HttpStreamFactoryImpl::Request::Request(const GURL& url, using_spdy_(false) { DCHECK(factory_); DCHECK(delegate_); + + net_log_.BeginEvent(NetLog::TYPE_HTTP_STREAM_REQUEST, NULL); } HttpStreamFactoryImpl::Request::~Request() { + net_log_.EndEvent(NetLog::TYPE_HTTP_STREAM_REQUEST, NULL); + factory_->request_map_.erase(job_); // TODO(willchan): Remove this when we decouple requests and jobs. @@ -53,12 +59,17 @@ void HttpStreamFactoryImpl::Request::BindJob(HttpStreamFactoryImpl::Job* job) { void HttpStreamFactoryImpl::Request::Complete( bool was_alternate_protocol_available, bool was_npn_negotiated, - bool using_spdy) { + bool using_spdy, + const NetLog::Source& job_source) { DCHECK(!completed_); completed_ = true; was_alternate_protocol_available_ = was_alternate_protocol_available; was_npn_negotiated_ = was_npn_negotiated; using_spdy_ = using_spdy; + net_log_.AddEvent( + NetLog::TYPE_HTTP_STREAM_REQUEST_BOUND_TO_JOB, + make_scoped_refptr(new NetLogSourceParameter( + "source_dependency", job_source))); } void HttpStreamFactoryImpl::Request::OnStreamReady( diff --git a/net/http/http_stream_factory_impl_request.h b/net/http/http_stream_factory_impl_request.h index 468ebd3..e7eadbe 100644 --- a/net/http/http_stream_factory_impl_request.h +++ b/net/http/http_stream_factory_impl_request.h @@ -7,6 +7,7 @@ #include "base/scoped_ptr.h" #include "googleurl/src/gurl.h" +#include "net/base/net_log.h" #include "net/http/http_stream_factory_impl.h" namespace net { @@ -15,7 +16,8 @@ class HttpStreamFactoryImpl::Request : public HttpStreamRequest { public: Request(const GURL& url, HttpStreamFactoryImpl* factory, - HttpStreamRequest::Delegate* delegate); + HttpStreamRequest::Delegate* delegate, + const BoundNetLog& net_log); virtual ~Request(); // Returns the Job that the Request started up. @@ -34,9 +36,12 @@ class HttpStreamFactoryImpl::Request : public HttpStreamRequest { void BindJob(HttpStreamFactoryImpl::Job* job); // Marks completion of the request. Must be called before OnStreamReady(). + // |source| is the NetLog::Source generated by the Job that fulfilled this + // request. void Complete(bool was_alternate_protocol_available, bool was_npn_negotiated, - bool using_spdy); + bool using_spdy, + const NetLog::Source& source); // If this Request has a spdy_session_key, remove this session from the // SpdySessionRequestMap. @@ -77,6 +82,7 @@ class HttpStreamFactoryImpl::Request : public HttpStreamRequest { const GURL url_; HttpStreamFactoryImpl* const factory_; HttpStreamRequest::Delegate* const delegate_; + const BoundNetLog net_log_; // The |job_| that this request is tied to. HttpStreamFactoryImpl::Job* job_; @@ -91,4 +97,5 @@ class HttpStreamFactoryImpl::Request : public HttpStreamRequest { }; } // namespace net + #endif // NET_HTTP_HTTP_STREAM_FACTORY_IMPL_H_ |