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

Unified Diff: net/http/http_stream_factory_impl_job_controller.cc

Issue 2895613002: Return Request as unique_ptr from JobController::Start(). (Closed)
Patch Set: 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_controller.cc
diff --git a/net/http/http_stream_factory_impl_job_controller.cc b/net/http/http_stream_factory_impl_job_controller.cc
index 5277e81db383f0329f4927e5bdc6d65cd02d29ad..ba5896a8794695fd9f575b3623af122e55cfe00c 100644
--- a/net/http/http_stream_factory_impl_job_controller.cc
+++ b/net/http/http_stream_factory_impl_job_controller.cc
@@ -119,7 +119,8 @@ bool HttpStreamFactoryImpl::JobController::for_websockets() {
return factory_->for_websockets_;
}
-HttpStreamFactoryImpl::Request* HttpStreamFactoryImpl::JobController::Start(
+std::unique_ptr<HttpStreamFactoryImpl::Request>
+HttpStreamFactoryImpl::JobController::Start(
HttpStreamRequest::Delegate* delegate,
WebSocketHandshakeStreamBase::CreateHelper*
websocket_handshake_stream_create_helper,
@@ -132,9 +133,12 @@ HttpStreamFactoryImpl::Request* HttpStreamFactoryImpl::JobController::Start(
stream_type_ = stream_type;
priority_ = priority;
- request_ = new Request(request_info_.url, this, delegate,
- websocket_handshake_stream_create_helper,
- source_net_log, stream_type);
+ auto request = base::MakeUnique<Request>(
+ request_info_.url, this, delegate,
+ websocket_handshake_stream_create_helper, source_net_log, stream_type);
+ // Keep a raw pointer but release ownership of Request instance.
+ request_ = request.get();
+
// Associates |net_log_| with |source_net_log|.
source_net_log.AddEvent(NetLogEventType::HTTP_STREAM_JOB_CONTROLLER_BOUND,
net_log_.source().ToEventParametersCallback());
@@ -142,7 +146,7 @@ HttpStreamFactoryImpl::Request* HttpStreamFactoryImpl::JobController::Start(
source_net_log.source().ToEventParametersCallback());
RunLoop(OK);
- return request_;
+ return request;
}
void HttpStreamFactoryImpl::JobController::Preconnect(int num_streams) {

Powered by Google App Engine
This is Rietveld 408576698