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

Unified Diff: net/http/http_stream_factory_impl_job.cc

Issue 2904643002: Remove some naked |new| statements in favor of MakeUnique. (Closed)
Patch Set: Revert changes in one test where it caused a crash. Created 3 years, 7 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 c6c5ce24ca0bb51875b526615ffe1d7b9b138d29..e3ca09e7e606d9fe5d23ece130c72a30188d7fed 100644
--- a/net/http/http_stream_factory_impl_job.cc
+++ b/net/http/http_stream_factory_impl_job.cc
@@ -12,6 +12,7 @@
#include "base/feature_list.h"
#include "base/location.h"
#include "base/logging.h"
+#include "base/memory/ptr_util.h"
#include "base/metrics/histogram_macros.h"
#include "base/metrics/sparse_histogram.h"
#include "base/profiler/scoped_tracker.h"
@@ -127,7 +128,7 @@ std::unique_ptr<base::Value> NetLogHttpStreamJobCallback(
const AlternativeService* alternative_service,
RequestPriority priority,
NetLogCaptureMode /* capture_mode */) {
- std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
+ auto dict = base::MakeUnique<base::DictionaryValue>();
if (source.IsValid())
source.AddToEventParameters(dict.get());
dict->SetString("original_url", original_url->GetOrigin().spec());
@@ -142,7 +143,7 @@ std::unique_ptr<base::Value> NetLogHttpStreamJobCallback(
std::unique_ptr<base::Value> NetLogHttpStreamProtoCallback(
NextProto negotiated_protocol,
NetLogCaptureMode /* capture_mode */) {
- std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
+ auto dict = base::MakeUnique<base::DictionaryValue>();
dict->SetString("proto", NextProtoToString(negotiated_protocol));
return std::move(dict);
@@ -1183,8 +1184,8 @@ int HttpStreamFactoryImpl::Job::SetSpdyHttpStreamOrBidirectionalStreamImpl(
if (delegate_->for_websockets())
return ERR_NOT_IMPLEMENTED;
if (stream_type_ == HttpStreamRequest::BIDIRECTIONAL_STREAM) {
- bidirectional_stream_impl_.reset(
- new BidirectionalStreamSpdyImpl(session, net_log_.source()));
+ bidirectional_stream_impl_ = base::MakeUnique<BidirectionalStreamSpdyImpl>(
+ session, net_log_.source());
return OK;
}
@@ -1194,8 +1195,8 @@ int HttpStreamFactoryImpl::Job::SetSpdyHttpStreamOrBidirectionalStreamImpl(
bool use_relative_url =
direct || request_info_.url.SchemeIs(url::kHttpsScheme);
- stream_.reset(
- new SpdyHttpStream(session, use_relative_url, net_log_.source()));
+ stream_ = base::MakeUnique<SpdyHttpStream>(session, use_relative_url,
+ net_log_.source());
return OK;
}
@@ -1235,9 +1236,9 @@ int HttpStreamFactoryImpl::Job::DoCreateStream() {
delegate_->websocket_handshake_stream_create_helper()
->CreateBasicStream(std::move(connection_), using_proxy);
} else {
- stream_.reset(new HttpBasicStream(
+ stream_ = base::MakeUnique<HttpBasicStream>(
std::move(connection_), using_proxy,
- session_->params().http_09_on_non_default_ports_enabled));
+ session_->params().http_09_on_non_default_ports_enabled);
}
return OK;
}

Powered by Google App Engine
This is Rietveld 408576698