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

Unified Diff: net/http/http_stream_factory_impl_job_controller.cc

Issue 2893713004: Return Request as unique_ptr from JobController::Start(). (Closed)
Patch Set: Fix conflict with https://crrev.com/2887773006. 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 e53ff88f170ddc5d33909b6fa0160a9788fadd52..0ac37d4b8b9ee71940d6c8bcb2b0259a9b195224 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) {
« no previous file with comments | « net/http/http_stream_factory_impl_job_controller.h ('k') | net/http/http_stream_factory_impl_job_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698