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

Unified Diff: net/http/http_stream_factory_impl_job.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: Fix lint. Created 9 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/http/http_stream_factory_impl_job.cc
diff --git a/net/http/http_stream_factory_impl_job.cc b/net/http/http_stream_factory_impl_job.cc
index 6884a7928cf8d33d2632a7fc2c4f7457f360b6fd..adc75ddb823607658ae77bc181ee448a0942dcae 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"
@@ -44,6 +45,21 @@ GURL UpgradeUrlToHttps(const GURL& original_url) {
return original_url.ReplaceComponents(replacements);
}
+// Parameters associated with the creation of a Job.
+class JobCreationParameters : public NetLog::EventParameters {
mmenke 2011/02/28 15:57:28 This class isn't needed - see below.
+ public:
+ JobCreationParameters(const std::string& url) : url_(url) {}
+
+ virtual Value* ToValue() const {
+ DictionaryValue* dict = new DictionaryValue();
+ dict->SetString("url", url_);
+ return dict;
+ }
+
+ private:
+ const std::string url_;
+};
+
} // namespace
HttpStreamFactoryImpl::Job::Job(HttpStreamFactoryImpl* stream_factory,
@@ -76,6 +92,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 +182,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 +394,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 JobCreationParameters(
+ request_info.url.GetOrigin().spec())));
mmenke 2011/02/28 15:57:28 You can just use: new NetLogStringParameter("url",
next_state_ = STATE_RESOLVE_PROXY;
int rv = RunLoop(OK);
DCHECK_EQ(ERR_IO_PENDING, rv);

Powered by Google App Engine
This is Rietveld 408576698