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

Side by Side Diff: net/socket/transport_client_socket_pool.cc

Issue 1892323002: Change scoped_ptr to std::unique_ptr in //net/socket. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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/socket/transport_client_socket_pool.h" 5 #include "net/socket/transport_client_socket_pool.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 interval_between_connects_ = CONNECT_INTERVAL_LE_10MS; 294 interval_between_connects_ = CONNECT_INTERVAL_LE_10MS;
295 else if (interval <= 20) 295 else if (interval <= 20)
296 interval_between_connects_ = CONNECT_INTERVAL_LE_20MS; 296 interval_between_connects_ = CONNECT_INTERVAL_LE_20MS;
297 else 297 else
298 interval_between_connects_ = CONNECT_INTERVAL_GT_20MS; 298 interval_between_connects_ = CONNECT_INTERVAL_GT_20MS;
299 } 299 }
300 300
301 helper_.set_next_state( 301 helper_.set_next_state(
302 TransportConnectJobHelper::STATE_TRANSPORT_CONNECT_COMPLETE); 302 TransportConnectJobHelper::STATE_TRANSPORT_CONNECT_COMPLETE);
303 // Create a |SocketPerformanceWatcher|, and pass the ownership. 303 // Create a |SocketPerformanceWatcher|, and pass the ownership.
304 scoped_ptr<SocketPerformanceWatcher> socket_performance_watcher; 304 std::unique_ptr<SocketPerformanceWatcher> socket_performance_watcher;
305 if (socket_performance_watcher_factory_) { 305 if (socket_performance_watcher_factory_) {
306 socket_performance_watcher = 306 socket_performance_watcher =
307 socket_performance_watcher_factory_->CreateSocketPerformanceWatcher( 307 socket_performance_watcher_factory_->CreateSocketPerformanceWatcher(
308 SocketPerformanceWatcherFactory::PROTOCOL_TCP); 308 SocketPerformanceWatcherFactory::PROTOCOL_TCP);
309 } 309 }
310 transport_socket_ = 310 transport_socket_ =
311 helper_.client_socket_factory()->CreateTransportClientSocket( 311 helper_.client_socket_factory()->CreateTransportClientSocket(
312 helper_.addresses(), std::move(socket_performance_watcher), 312 helper_.addresses(), std::move(socket_performance_watcher),
313 net_log().net_log(), net_log().source()); 313 net_log().net_log(), net_log().source());
314 314
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
419 if (helper_.next_state() != 419 if (helper_.next_state() !=
420 TransportConnectJobHelper::STATE_TRANSPORT_CONNECT_COMPLETE) { 420 TransportConnectJobHelper::STATE_TRANSPORT_CONNECT_COMPLETE) {
421 NOTREACHED(); 421 NOTREACHED();
422 return; 422 return;
423 } 423 }
424 424
425 DCHECK(!fallback_transport_socket_.get()); 425 DCHECK(!fallback_transport_socket_.get());
426 DCHECK(!fallback_addresses_.get()); 426 DCHECK(!fallback_addresses_.get());
427 427
428 // Create a |SocketPerformanceWatcher|, and pass the ownership. 428 // Create a |SocketPerformanceWatcher|, and pass the ownership.
429 scoped_ptr<SocketPerformanceWatcher> socket_performance_watcher; 429 std::unique_ptr<SocketPerformanceWatcher> socket_performance_watcher;
430 if (socket_performance_watcher_factory_) { 430 if (socket_performance_watcher_factory_) {
431 socket_performance_watcher = 431 socket_performance_watcher =
432 socket_performance_watcher_factory_->CreateSocketPerformanceWatcher( 432 socket_performance_watcher_factory_->CreateSocketPerformanceWatcher(
433 SocketPerformanceWatcherFactory::PROTOCOL_TCP); 433 SocketPerformanceWatcherFactory::PROTOCOL_TCP);
434 } 434 }
435 435
436 fallback_addresses_.reset(new AddressList(helper_.addresses())); 436 fallback_addresses_.reset(new AddressList(helper_.addresses()));
437 MakeAddressListStartWithIPv4(fallback_addresses_.get()); 437 MakeAddressListStartWithIPv4(fallback_addresses_.get());
438 fallback_transport_socket_ = 438 fallback_transport_socket_ =
439 helper_.client_socket_factory()->CreateTransportClientSocket( 439 helper_.client_socket_factory()->CreateTransportClientSocket(
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
498 498
499 void TransportConnectJob::CopyConnectionAttemptsFromSockets() { 499 void TransportConnectJob::CopyConnectionAttemptsFromSockets() {
500 if (transport_socket_) 500 if (transport_socket_)
501 transport_socket_->GetConnectionAttempts(&connection_attempts_); 501 transport_socket_->GetConnectionAttempts(&connection_attempts_);
502 if (fallback_transport_socket_) { 502 if (fallback_transport_socket_) {
503 fallback_transport_socket_->GetConnectionAttempts( 503 fallback_transport_socket_->GetConnectionAttempts(
504 &fallback_connection_attempts_); 504 &fallback_connection_attempts_);
505 } 505 }
506 } 506 }
507 507
508 scoped_ptr<ConnectJob> 508 std::unique_ptr<ConnectJob>
509 TransportClientSocketPool::TransportConnectJobFactory::NewConnectJob( 509 TransportClientSocketPool::TransportConnectJobFactory::NewConnectJob(
510 const std::string& group_name, 510 const std::string& group_name,
511 const PoolBase::Request& request, 511 const PoolBase::Request& request,
512 ConnectJob::Delegate* delegate) const { 512 ConnectJob::Delegate* delegate) const {
513 return scoped_ptr<ConnectJob>(new TransportConnectJob( 513 return std::unique_ptr<ConnectJob>(new TransportConnectJob(
514 group_name, request.priority(), request.respect_limits(), 514 group_name, request.priority(), request.respect_limits(),
515 request.params(), ConnectionTimeout(), client_socket_factory_, 515 request.params(), ConnectionTimeout(), client_socket_factory_,
516 socket_performance_watcher_factory_, host_resolver_, delegate, net_log_)); 516 socket_performance_watcher_factory_, host_resolver_, delegate, net_log_));
517 } 517 }
518 518
519 base::TimeDelta 519 base::TimeDelta
520 TransportClientSocketPool::TransportConnectJobFactory::ConnectionTimeout() 520 TransportClientSocketPool::TransportConnectJobFactory::ConnectionTimeout()
521 const { 521 const {
522 return base::TimeDelta::FromSeconds(kTransportConnectJobTimeoutInSeconds); 522 return base::TimeDelta::FromSeconds(kTransportConnectJobTimeoutInSeconds);
523 } 523 }
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
591 } 591 }
592 592
593 void TransportClientSocketPool::CancelRequest( 593 void TransportClientSocketPool::CancelRequest(
594 const std::string& group_name, 594 const std::string& group_name,
595 ClientSocketHandle* handle) { 595 ClientSocketHandle* handle) {
596 base_.CancelRequest(group_name, handle); 596 base_.CancelRequest(group_name, handle);
597 } 597 }
598 598
599 void TransportClientSocketPool::ReleaseSocket( 599 void TransportClientSocketPool::ReleaseSocket(
600 const std::string& group_name, 600 const std::string& group_name,
601 scoped_ptr<StreamSocket> socket, 601 std::unique_ptr<StreamSocket> socket,
602 int id) { 602 int id) {
603 base_.ReleaseSocket(group_name, std::move(socket), id); 603 base_.ReleaseSocket(group_name, std::move(socket), id);
604 } 604 }
605 605
606 void TransportClientSocketPool::FlushWithError(int error) { 606 void TransportClientSocketPool::FlushWithError(int error) {
607 base_.FlushWithError(error); 607 base_.FlushWithError(error);
608 } 608 }
609 609
610 void TransportClientSocketPool::CloseIdleSockets() { 610 void TransportClientSocketPool::CloseIdleSockets() {
611 base_.CloseIdleSockets(); 611 base_.CloseIdleSockets();
612 } 612 }
613 613
614 int TransportClientSocketPool::IdleSocketCount() const { 614 int TransportClientSocketPool::IdleSocketCount() const {
615 return base_.idle_socket_count(); 615 return base_.idle_socket_count();
616 } 616 }
617 617
618 int TransportClientSocketPool::IdleSocketCountInGroup( 618 int TransportClientSocketPool::IdleSocketCountInGroup(
619 const std::string& group_name) const { 619 const std::string& group_name) const {
620 return base_.IdleSocketCountInGroup(group_name); 620 return base_.IdleSocketCountInGroup(group_name);
621 } 621 }
622 622
623 LoadState TransportClientSocketPool::GetLoadState( 623 LoadState TransportClientSocketPool::GetLoadState(
624 const std::string& group_name, const ClientSocketHandle* handle) const { 624 const std::string& group_name, const ClientSocketHandle* handle) const {
625 return base_.GetLoadState(group_name, handle); 625 return base_.GetLoadState(group_name, handle);
626 } 626 }
627 627
628 scoped_ptr<base::DictionaryValue> TransportClientSocketPool::GetInfoAsValue( 628 std::unique_ptr<base::DictionaryValue>
629 const std::string& name, 629 TransportClientSocketPool::GetInfoAsValue(const std::string& name,
630 const std::string& type, 630 const std::string& type,
631 bool include_nested_pools) const { 631 bool include_nested_pools) const {
632 return base_.GetInfoAsValue(name, type); 632 return base_.GetInfoAsValue(name, type);
633 } 633 }
634 634
635 base::TimeDelta TransportClientSocketPool::ConnectionTimeout() const { 635 base::TimeDelta TransportClientSocketPool::ConnectionTimeout() const {
636 return base_.ConnectionTimeout(); 636 return base_.ConnectionTimeout();
637 } 637 }
638 638
639 bool TransportClientSocketPool::IsStalled() const { 639 bool TransportClientSocketPool::IsStalled() const {
640 return base_.IsStalled(); 640 return base_.IsStalled();
641 } 641 }
642 642
643 void TransportClientSocketPool::AddHigherLayeredPool( 643 void TransportClientSocketPool::AddHigherLayeredPool(
644 HigherLayeredPool* higher_pool) { 644 HigherLayeredPool* higher_pool) {
645 base_.AddHigherLayeredPool(higher_pool); 645 base_.AddHigherLayeredPool(higher_pool);
646 } 646 }
647 647
648 void TransportClientSocketPool::RemoveHigherLayeredPool( 648 void TransportClientSocketPool::RemoveHigherLayeredPool(
649 HigherLayeredPool* higher_pool) { 649 HigherLayeredPool* higher_pool) {
650 base_.RemoveHigherLayeredPool(higher_pool); 650 base_.RemoveHigherLayeredPool(higher_pool);
651 } 651 }
652 652
653 } // namespace net 653 } // namespace net
OLDNEW
« no previous file with comments | « net/socket/transport_client_socket_pool.h ('k') | net/socket/transport_client_socket_pool_test_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698