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

Side by Side Diff: net/http/http_stream_factory_impl_job.cc

Issue 2895443002: Return Job as unique_ptr from factory methods. (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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/http/http_stream_factory_impl_job.h" 5 #include "net/http/http_stream_factory_impl_job.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/bind_helpers.h" 11 #include "base/bind_helpers.h"
12 #include "base/feature_list.h" 12 #include "base/feature_list.h"
13 #include "base/location.h" 13 #include "base/location.h"
14 #include "base/logging.h" 14 #include "base/logging.h"
15 #include "base/memory/ptr_util.h"
15 #include "base/metrics/histogram_macros.h" 16 #include "base/metrics/histogram_macros.h"
16 #include "base/metrics/sparse_histogram.h" 17 #include "base/metrics/sparse_histogram.h"
17 #include "base/profiler/scoped_tracker.h" 18 #include "base/profiler/scoped_tracker.h"
18 #include "base/single_thread_task_runner.h" 19 #include "base/single_thread_task_runner.h"
19 #include "base/stl_util.h" 20 #include "base/stl_util.h"
20 #include "base/strings/string_number_conversions.h" 21 #include "base/strings/string_number_conversions.h"
21 #include "base/strings/string_util.h" 22 #include "base/strings/string_util.h"
22 #include "base/threading/thread_task_runner_handle.h" 23 #include "base/threading/thread_task_runner_handle.h"
23 #include "base/trace_event/trace_event.h" 24 #include "base/trace_event/trace_event.h"
24 #include "base/values.h" 25 #include "base/values.h"
(...skipping 1416 matching lines...) Expand 10 before | Expand all | Expand 10 after
1441 connection_->socket()->GetConnectionAttempts(&socket_attempts); 1442 connection_->socket()->GetConnectionAttempts(&socket_attempts);
1442 } 1443 }
1443 1444
1444 delegate_->AddConnectionAttemptsToRequest(this, socket_attempts); 1445 delegate_->AddConnectionAttemptsToRequest(this, socket_attempts);
1445 } 1446 }
1446 1447
1447 HttpStreamFactoryImpl::JobFactory::JobFactory() {} 1448 HttpStreamFactoryImpl::JobFactory::JobFactory() {}
1448 1449
1449 HttpStreamFactoryImpl::JobFactory::~JobFactory() {} 1450 HttpStreamFactoryImpl::JobFactory::~JobFactory() {}
1450 1451
1451 HttpStreamFactoryImpl::Job* HttpStreamFactoryImpl::JobFactory::CreateMainJob( 1452 std::unique_ptr<HttpStreamFactoryImpl::Job>
1453 HttpStreamFactoryImpl::JobFactory::CreateMainJob(
1452 HttpStreamFactoryImpl::Job::Delegate* delegate, 1454 HttpStreamFactoryImpl::Job::Delegate* delegate,
1453 HttpStreamFactoryImpl::JobType job_type, 1455 HttpStreamFactoryImpl::JobType job_type,
1454 HttpNetworkSession* session, 1456 HttpNetworkSession* session,
1455 const HttpRequestInfo& request_info, 1457 const HttpRequestInfo& request_info,
1456 RequestPriority priority, 1458 RequestPriority priority,
1457 const ProxyInfo& proxy_info, 1459 const ProxyInfo& proxy_info,
1458 const SSLConfig& server_ssl_config, 1460 const SSLConfig& server_ssl_config,
1459 const SSLConfig& proxy_ssl_config, 1461 const SSLConfig& proxy_ssl_config,
1460 HostPortPair destination, 1462 HostPortPair destination,
1461 GURL origin_url, 1463 GURL origin_url,
1462 bool enable_ip_based_pooling, 1464 bool enable_ip_based_pooling,
1463 NetLog* net_log) { 1465 NetLog* net_log) {
1464 return new HttpStreamFactoryImpl::Job( 1466 return base::MakeUnique<HttpStreamFactoryImpl::Job>(
1465 delegate, job_type, session, request_info, priority, proxy_info, 1467 delegate, job_type, session, request_info, priority, proxy_info,
1466 server_ssl_config, proxy_ssl_config, destination, origin_url, 1468 server_ssl_config, proxy_ssl_config, destination, origin_url,
1467 enable_ip_based_pooling, net_log); 1469 enable_ip_based_pooling, net_log);
1468 } 1470 }
1469 1471
1470 HttpStreamFactoryImpl::Job* HttpStreamFactoryImpl::JobFactory::CreateAltSvcJob( 1472 std::unique_ptr<HttpStreamFactoryImpl::Job>
1473 HttpStreamFactoryImpl::JobFactory::CreateAltSvcJob(
1471 HttpStreamFactoryImpl::Job::Delegate* delegate, 1474 HttpStreamFactoryImpl::Job::Delegate* delegate,
1472 HttpStreamFactoryImpl::JobType job_type, 1475 HttpStreamFactoryImpl::JobType job_type,
1473 HttpNetworkSession* session, 1476 HttpNetworkSession* session,
1474 const HttpRequestInfo& request_info, 1477 const HttpRequestInfo& request_info,
1475 RequestPriority priority, 1478 RequestPriority priority,
1476 const ProxyInfo& proxy_info, 1479 const ProxyInfo& proxy_info,
1477 const SSLConfig& server_ssl_config, 1480 const SSLConfig& server_ssl_config,
1478 const SSLConfig& proxy_ssl_config, 1481 const SSLConfig& proxy_ssl_config,
1479 HostPortPair destination, 1482 HostPortPair destination,
1480 GURL origin_url, 1483 GURL origin_url,
1481 AlternativeService alternative_service, 1484 AlternativeService alternative_service,
1482 bool enable_ip_based_pooling, 1485 bool enable_ip_based_pooling,
1483 NetLog* net_log) { 1486 NetLog* net_log) {
1484 return new HttpStreamFactoryImpl::Job( 1487 return base::MakeUnique<HttpStreamFactoryImpl::Job>(
1485 delegate, job_type, session, request_info, priority, proxy_info, 1488 delegate, job_type, session, request_info, priority, proxy_info,
1486 server_ssl_config, proxy_ssl_config, destination, origin_url, 1489 server_ssl_config, proxy_ssl_config, destination, origin_url,
1487 alternative_service, ProxyServer(), enable_ip_based_pooling, net_log); 1490 alternative_service, ProxyServer(), enable_ip_based_pooling, net_log);
1488 } 1491 }
1489 1492
1490 HttpStreamFactoryImpl::Job* 1493 std::unique_ptr<HttpStreamFactoryImpl::Job>
1491 HttpStreamFactoryImpl::JobFactory::CreateAltProxyJob( 1494 HttpStreamFactoryImpl::JobFactory::CreateAltProxyJob(
1492 HttpStreamFactoryImpl::Job::Delegate* delegate, 1495 HttpStreamFactoryImpl::Job::Delegate* delegate,
1493 HttpStreamFactoryImpl::JobType job_type, 1496 HttpStreamFactoryImpl::JobType job_type,
1494 HttpNetworkSession* session, 1497 HttpNetworkSession* session,
1495 const HttpRequestInfo& request_info, 1498 const HttpRequestInfo& request_info,
1496 RequestPriority priority, 1499 RequestPriority priority,
1497 const ProxyInfo& proxy_info, 1500 const ProxyInfo& proxy_info,
1498 const SSLConfig& server_ssl_config, 1501 const SSLConfig& server_ssl_config,
1499 const SSLConfig& proxy_ssl_config, 1502 const SSLConfig& proxy_ssl_config,
1500 HostPortPair destination, 1503 HostPortPair destination,
1501 GURL origin_url, 1504 GURL origin_url,
1502 const ProxyServer& alternative_proxy_server, 1505 const ProxyServer& alternative_proxy_server,
1503 bool enable_ip_based_pooling, 1506 bool enable_ip_based_pooling,
1504 NetLog* net_log) { 1507 NetLog* net_log) {
1505 return new HttpStreamFactoryImpl::Job( 1508 return base::MakeUnique<HttpStreamFactoryImpl::Job>(
1506 delegate, job_type, session, request_info, priority, proxy_info, 1509 delegate, job_type, session, request_info, priority, proxy_info,
1507 server_ssl_config, proxy_ssl_config, destination, origin_url, 1510 server_ssl_config, proxy_ssl_config, destination, origin_url,
1508 AlternativeService(), alternative_proxy_server, enable_ip_based_pooling, 1511 AlternativeService(), alternative_proxy_server, enable_ip_based_pooling,
1509 net_log); 1512 net_log);
1510 } 1513 }
1511 1514
1512 } // namespace net 1515 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_stream_factory_impl_job.h ('k') | net/http/http_stream_factory_impl_job_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698