diff options
242 files changed, 1625 insertions, 1434 deletions
diff --git a/net/base/address_list.cc b/net/base/address_list.cc index e030878..5b4fe34 100644 --- a/net/base/address_list.cc +++ b/net/base/address_list.cc @@ -4,6 +4,8 @@ #include "net/base/address_list.h" +#include <utility> + #include "base/bind.h" #include "base/logging.h" #include "base/values.h" @@ -25,8 +27,8 @@ scoped_ptr<base::Value> NetLogAddressListCallback( list->Append(new base::StringValue(it->ToString())); } - dict->Set("address_list", list.Pass()); - return dict.Pass(); + dict->Set("address_list", std::move(list)); + return std::move(dict); } } // namespace diff --git a/net/base/backoff_entry_serializer.cc b/net/base/backoff_entry_serializer.cc index 1467553..e736685 100644 --- a/net/base/backoff_entry_serializer.cc +++ b/net/base/backoff_entry_serializer.cc @@ -4,6 +4,8 @@ #include "net/base/backoff_entry_serializer.h" +#include <utility> + #include "base/strings/string_number_conversions.h" #include "base/time/tick_clock.h" #include "base/values.h" @@ -34,7 +36,7 @@ scoped_ptr<base::Value> BackoffEntrySerializer::SerializeToValue( serialized->AppendString( base::Int64ToString(absolute_release_time.ToInternalValue())); - return serialized.Pass(); + return std::move(serialized); } scoped_ptr<BackoffEntry> BackoffEntrySerializer::DeserializeFromValue( diff --git a/net/base/directory_lister.cc b/net/base/directory_lister.cc index efdc53c..6b06ca6 100644 --- a/net/base/directory_lister.cc +++ b/net/base/directory_lister.cc @@ -5,6 +5,7 @@ #include "net/base/directory_lister.h" #include <algorithm> +#include <utility> #include "base/bind.h" #include "base/files/file_enumerator.h" @@ -121,9 +122,9 @@ void DirectoryLister::Core::Start() { if (!base::DirectoryExists(dir_)) { origin_task_runner_->PostTask( - FROM_HERE, - base::Bind(&Core::DoneOnOriginThread, this, - base::Passed(directory_list.Pass()), ERR_FILE_NOT_FOUND)); + FROM_HERE, base::Bind(&Core::DoneOnOriginThread, this, + base::Passed(std::move(directory_list)), + ERR_FILE_NOT_FOUND)); return; } @@ -169,7 +170,7 @@ void DirectoryLister::Core::Start() { origin_task_runner_->PostTask( FROM_HERE, base::Bind(&Core::DoneOnOriginThread, this, - base::Passed(directory_list.Pass()), OK)); + base::Passed(std::move(directory_list)), OK)); } bool DirectoryLister::Core::IsCancelled() const { diff --git a/net/base/file_stream.cc b/net/base/file_stream.cc index 81e14ae..6826e80 100644 --- a/net/base/file_stream.cc +++ b/net/base/file_stream.cc @@ -4,6 +4,8 @@ #include "net/base/file_stream.h" +#include <utility> + #include "base/profiler/scoped_tracker.h" #include "net/base/file_stream_context.h" #include "net/base/net_errors.h" @@ -16,8 +18,7 @@ FileStream::FileStream(const scoped_refptr<base::TaskRunner>& task_runner) FileStream::FileStream(base::File file, const scoped_refptr<base::TaskRunner>& task_runner) - : context_(new Context(file.Pass(), task_runner)) { -} + : context_(new Context(std::move(file), task_runner)) {} FileStream::~FileStream() { context_.release()->Orphan(); diff --git a/net/base/file_stream_context.cc b/net/base/file_stream_context.cc index 6d77d6d..7da28a9 100644 --- a/net/base/file_stream_context.cc +++ b/net/base/file_stream_context.cc @@ -52,9 +52,7 @@ FileStream::Context::OpenResult::OpenResult() { FileStream::Context::OpenResult::OpenResult(base::File file, IOResult error_code) - : file(file.Pass()), - error_code(error_code) { -} + : file(std::move(file)), error_code(error_code) {} FileStream::Context::OpenResult::OpenResult(OpenResult&& other) : file(std::move(other.file)), error_code(other.error_code) {} @@ -174,7 +172,7 @@ FileStream::Context::OpenResult FileStream::Context::OpenFileImpl( return OpenResult(base::File(), IOResult::FromOSError(logging::GetLastSystemErrorCode())); - return OpenResult(file.Pass(), IOResult(OK, 0)); + return OpenResult(std::move(file), IOResult(OK, 0)); } FileStream::Context::IOResult FileStream::Context::CloseFileImpl() { @@ -191,7 +189,7 @@ FileStream::Context::IOResult FileStream::Context::FlushFileImpl() { void FileStream::Context::OnOpenCompleted(const CompletionCallback& callback, OpenResult open_result) { - file_ = open_result.file.Pass(); + file_ = std::move(open_result.file); if (file_.IsValid() && !orphaned_) OnFileOpened(); diff --git a/net/base/file_stream_context_posix.cc b/net/base/file_stream_context_posix.cc index f84b7df..af98c78 100644 --- a/net/base/file_stream_context_posix.cc +++ b/net/base/file_stream_context_posix.cc @@ -5,6 +5,7 @@ #include "net/base/file_stream_context.h" #include <errno.h> +#include <utility> #include "base/bind.h" #include "base/bind_helpers.h" @@ -29,11 +30,10 @@ FileStream::Context::Context(const scoped_refptr<base::TaskRunner>& task_runner) FileStream::Context::Context(base::File file, const scoped_refptr<base::TaskRunner>& task_runner) - : file_(file.Pass()), + : file_(std::move(file)), async_in_progress_(false), orphaned_(false), - task_runner_(task_runner) { -} + task_runner_(task_runner) {} FileStream::Context::~Context() { } diff --git a/net/base/file_stream_unittest.cc b/net/base/file_stream_unittest.cc index 4304668..a67a91c 100644 --- a/net/base/file_stream_unittest.cc +++ b/net/base/file_stream_unittest.cc @@ -4,6 +4,8 @@ #include "net/base/file_stream.h" +#include <utility> + #include "base/bind.h" #include "base/callback.h" #include "base/files/file.h" @@ -117,7 +119,7 @@ TEST_F(FileStreamTest, UseFileHandle) { // Seek to the beginning of the file and read. scoped_ptr<FileStream> read_stream( - new FileStream(file.Pass(), base::ThreadTaskRunnerHandle::Get())); + new FileStream(std::move(file), base::ThreadTaskRunnerHandle::Get())); ASSERT_EQ(ERR_IO_PENDING, read_stream->Seek(0, callback64.callback())); ASSERT_EQ(0, callback64.WaitForResult()); // Read into buffer and compare. @@ -135,7 +137,7 @@ TEST_F(FileStreamTest, UseFileHandle) { file.Initialize(temp_file_path(), flags); scoped_ptr<FileStream> write_stream( - new FileStream(file.Pass(), base::ThreadTaskRunnerHandle::Get())); + new FileStream(std::move(file), base::ThreadTaskRunnerHandle::Get())); ASSERT_EQ(ERR_IO_PENDING, write_stream->Seek(0, callback64.callback())); ASSERT_EQ(0, callback64.WaitForResult()); scoped_refptr<IOBufferWithSize> write_buffer = CreateTestDataBuffer(); @@ -752,7 +754,7 @@ TEST_F(FileStreamTest, WriteError) { ASSERT_TRUE(file.IsValid()); scoped_ptr<FileStream> stream( - new FileStream(file.Pass(), base::ThreadTaskRunnerHandle::Get())); + new FileStream(std::move(file), base::ThreadTaskRunnerHandle::Get())); scoped_refptr<IOBuffer> buf = new IOBuffer(1); buf->data()[0] = 0; @@ -777,7 +779,7 @@ TEST_F(FileStreamTest, ReadError) { ASSERT_TRUE(file.IsValid()); scoped_ptr<FileStream> stream( - new FileStream(file.Pass(), base::ThreadTaskRunnerHandle::Get())); + new FileStream(std::move(file), base::ThreadTaskRunnerHandle::Get())); scoped_refptr<IOBuffer> buf = new IOBuffer(1); TestCompletionCallback callback; diff --git a/net/base/keygen_handler_nss.cc b/net/base/keygen_handler_nss.cc index 661dabc..849f787 100644 --- a/net/base/keygen_handler_nss.cc +++ b/net/base/keygen_handler_nss.cc @@ -4,6 +4,8 @@ #include "net/base/keygen_handler.h" +#include <utility> + #include "base/logging.h" #include "crypto/nss_crypto_module_delegate.h" #include "crypto/nss_util.h" @@ -20,7 +22,7 @@ std::string KeygenHandler::GenKeyAndSignChallenge() { crypto::ScopedPK11Slot slot; if (crypto_module_delegate_) { - slot = crypto_module_delegate_->RequestSlot().Pass(); + slot = crypto_module_delegate_->RequestSlot(); } else { LOG(ERROR) << "Could not get an NSS key slot."; return std::string(); @@ -40,7 +42,7 @@ std::string KeygenHandler::GenKeyAndSignChallenge() { void KeygenHandler::set_crypto_module_delegate( scoped_ptr<crypto::NSSCryptoModuleDelegate> delegate) { - crypto_module_delegate_ = delegate.Pass(); + crypto_module_delegate_ = std::move(delegate); } } // namespace net diff --git a/net/base/keygen_handler_unittest.cc b/net/base/keygen_handler_unittest.cc index 74d9146..c1b5fe4 100644 --- a/net/base/keygen_handler_unittest.cc +++ b/net/base/keygen_handler_unittest.cc @@ -5,14 +5,15 @@ #include "net/base/keygen_handler.h" #include <string> +#include <utility> #include "base/base64.h" #include "base/bind.h" #include "base/location.h" #include "base/logging.h" -#include "base/threading/worker_pool.h" -#include "base/threading/thread_restrictions.h" #include "base/synchronization/waitable_event.h" +#include "base/threading/thread_restrictions.h" +#include "base/threading/worker_pool.h" #include "build/build_config.h" #include "testing/gtest/include/gtest/gtest.h" @@ -30,7 +31,7 @@ namespace { class StubCryptoModuleDelegate : public crypto::NSSCryptoModuleDelegate { public: explicit StubCryptoModuleDelegate(crypto::ScopedPK11Slot slot) - : slot_(slot.Pass()) {} + : slot_(std::move(slot)) {} std::string RequestPassword(const std::string& slot_name, bool retry, @@ -61,7 +62,7 @@ class KeygenHandlerTest : public ::testing::Test { new StubCryptoModuleDelegate(crypto::ScopedPK11Slot( PK11_ReferenceSlot(test_nss_db_.slot()))))); #endif - return handler.Pass(); + return handler; } private: diff --git a/net/base/layered_network_delegate.cc b/net/base/layered_network_delegate.cc index 265fa42..9fe3719 100644 --- a/net/base/layered_network_delegate.cc +++ b/net/base/layered_network_delegate.cc @@ -4,12 +4,13 @@ #include "net/base/layered_network_delegate.h" +#include <utility> + namespace net { LayeredNetworkDelegate::LayeredNetworkDelegate( scoped_ptr<NetworkDelegate> nested_network_delegate) - : nested_network_delegate_(nested_network_delegate.Pass()) { -} + : nested_network_delegate_(std::move(nested_network_delegate)) {} LayeredNetworkDelegate::~LayeredNetworkDelegate() { } diff --git a/net/base/layered_network_delegate_unittest.cc b/net/base/layered_network_delegate_unittest.cc index fb427a4..6ca77a5 100644 --- a/net/base/layered_network_delegate_unittest.cc +++ b/net/base/layered_network_delegate_unittest.cc @@ -5,6 +5,7 @@ #include "net/base/layered_network_delegate.h" #include <map> +#include <utility> #include "base/bind.h" #include "base/files/file_path.h" @@ -174,7 +175,7 @@ class TestLayeredNetworkDelegate : public LayeredNetworkDelegate { public: TestLayeredNetworkDelegate(scoped_ptr<NetworkDelegate> network_delegate, CountersMap* counters) - : LayeredNetworkDelegate(network_delegate.Pass()), + : LayeredNetworkDelegate(std::move(network_delegate)), context_(true), counters_(counters) { context_.Init(); @@ -373,9 +374,9 @@ class LayeredNetworkDelegateTest : public testing::Test { scoped_ptr<TestNetworkDelegateImpl> test_network_delegate( new TestNetworkDelegateImpl(&layered_network_delegate_counters)); test_network_delegate_ = test_network_delegate.get(); - layered_network_delegate_ = - scoped_ptr<TestLayeredNetworkDelegate>(new TestLayeredNetworkDelegate( - test_network_delegate.Pass(), &layered_network_delegate_counters)); + layered_network_delegate_ = scoped_ptr<TestLayeredNetworkDelegate>( + new TestLayeredNetworkDelegate(std::move(test_network_delegate), + &layered_network_delegate_counters)); } CountersMap layered_network_delegate_counters; diff --git a/net/base/mock_file_stream.cc b/net/base/mock_file_stream.cc index c699b46..6649532 100644 --- a/net/base/mock_file_stream.cc +++ b/net/base/mock_file_stream.cc @@ -4,6 +4,8 @@ #include "net/base/mock_file_stream.h" +#include <utility> + #include "base/bind.h" #include "base/location.h" #include "base/single_thread_task_runner.h" @@ -25,12 +27,11 @@ MockFileStream::MockFileStream( MockFileStream::MockFileStream( base::File file, const scoped_refptr<base::TaskRunner>& task_runner) - : FileStream(file.Pass(), task_runner), + : FileStream(std::move(file), task_runner), forced_error_(OK), async_error_(false), throttled_(false), - weak_factory_(this) { -} + weak_factory_(this) {} MockFileStream::~MockFileStream() { } diff --git a/net/base/network_quality_estimator.cc b/net/base/network_quality_estimator.cc index 2344a02..c67b641 100644 --- a/net/base/network_quality_estimator.cc +++ b/net/base/network_quality_estimator.cc @@ -8,6 +8,7 @@ #include <algorithm> #include <cmath> #include <limits> +#include <utility> #include <vector> #include "base/logging.h" @@ -121,7 +122,7 @@ const int32_t NetworkQualityEstimator::kInvalidThroughput = 0; NetworkQualityEstimator::NetworkQualityEstimator( scoped_ptr<ExternalEstimateProvider> external_estimates_provider, const std::map<std::string, std::string>& variation_params) - : NetworkQualityEstimator(external_estimates_provider.Pass(), + : NetworkQualityEstimator(std::move(external_estimates_provider), variation_params, false, false) {} @@ -140,7 +141,7 @@ NetworkQualityEstimator::NetworkQualityEstimator( downstream_throughput_kbps_observations_( GetWeightMultiplierPerSecond(variation_params)), rtt_msec_observations_(GetWeightMultiplierPerSecond(variation_params)), - external_estimate_provider_(external_estimates_provider.Pass()) { + external_estimate_provider_(std::move(external_estimates_provider)) { static_assert(kMinRequestDurationMicroseconds > 0, "Minimum request duration must be > 0"); static_assert(kDefaultHalfLifeSeconds > 0, diff --git a/net/base/network_quality_estimator_unittest.cc b/net/base/network_quality_estimator_unittest.cc index 93cd009..cf1197f 100644 --- a/net/base/network_quality_estimator_unittest.cc +++ b/net/base/network_quality_estimator_unittest.cc @@ -5,9 +5,9 @@ #include "net/base/network_quality_estimator.h" #include <stdint.h> - #include <limits> #include <map> +#include <utility> #include <vector> #include "base/files/file_path.h" @@ -39,7 +39,7 @@ class TestNetworkQualityEstimator : public net::NetworkQualityEstimator { TestNetworkQualityEstimator( const std::map<std::string, std::string>& variation_params, scoped_ptr<net::ExternalEstimateProvider> external_estimate_provider) - : NetworkQualityEstimator(external_estimate_provider.Pass(), + : NetworkQualityEstimator(std::move(external_estimate_provider), variation_params, true, true) { @@ -76,7 +76,7 @@ class TestNetworkQualityEstimator : public net::NetworkQualityEstimator { http_response->set_code(net::HTTP_OK); http_response->set_content("hello"); http_response->set_content_type("text/plain"); - return http_response.Pass(); + return std::move(http_response); } // Returns a GURL hosted at embedded test server. @@ -808,7 +808,7 @@ TEST(NetworkQualityEstimatorTest, InvalidExternalEstimateProvider) { invalid_external_estimate_provider); TestNetworkQualityEstimator estimator(std::map<std::string, std::string>(), - external_estimate_provider.Pass()); + std::move(external_estimate_provider)); base::TimeDelta rtt; int32_t kbps; @@ -906,7 +906,7 @@ TEST(NetworkQualityEstimatorTest, TestExternalEstimateProvider) { test_external_estimate_provider); std::map<std::string, std::string> variation_params; TestNetworkQualityEstimator estimator(variation_params, - external_estimate_provider.Pass()); + std::move(external_estimate_provider)); base::TimeDelta rtt; int32_t kbps; @@ -981,7 +981,7 @@ TEST(NetworkQualityEstimatorTest, TestExternalEstimateProviderMergeEstimates) { std::map<std::string, std::string> variation_params; TestNetworkQualityEstimator estimator(variation_params, - external_estimate_provider.Pass()); + std::move(external_estimate_provider)); base::TimeDelta rtt; // Estimate provided by network quality estimator should match the estimate diff --git a/net/base/sdch_manager.cc b/net/base/sdch_manager.cc index a0c00fb..9bb8e7e 100644 --- a/net/base/sdch_manager.cc +++ b/net/base/sdch_manager.cc @@ -4,6 +4,8 @@ #include "net/base/sdch_manager.h" +#include <utility> + #include "base/base64url.h" #include "base/logging.h" #include "base/metrics/histogram_macros.h" @@ -247,7 +249,7 @@ SdchManager::GetDictionarySet(const GURL& target_url) { UMA_HISTOGRAM_COUNTS("Sdch3.Advertisement_Count", count); - return result.Pass(); + return result; } scoped_ptr<SdchManager::DictionarySet> @@ -260,15 +262,15 @@ SdchManager::GetDictionarySetByHash( *problem_code = SDCH_DICTIONARY_HASH_NOT_FOUND; const auto& it = dictionaries_.find(server_hash); if (it == dictionaries_.end()) - return result.Pass(); + return result; *problem_code = it->second->data.CanUse(target_url); if (*problem_code != SDCH_OK) - return result.Pass(); + return result; result.reset(new DictionarySet); result->AddDictionary(it->first, it->second); - return result.Pass(); + return result; } // static @@ -431,7 +433,7 @@ SdchProblemCode SdchManager::RemoveSdchDictionary( // static scoped_ptr<SdchManager::DictionarySet> SdchManager::CreateEmptyDictionarySetForTesting() { - return scoped_ptr<DictionarySet>(new DictionarySet).Pass(); + return scoped_ptr<DictionarySet>(new DictionarySet); } scoped_ptr<base::Value> SdchManager::SdchInfoToValue() const { @@ -452,11 +454,11 @@ scoped_ptr<base::Value> SdchManager::SdchInfoToValue() const { port_it != entry.second->data.ports().end(); ++port_it) { port_list->AppendInteger(*port_it); } - entry_dict->Set("ports", port_list.Pass()); + entry_dict->Set("ports", std::move(port_list)); entry_dict->SetString("server_hash", entry.first); - entry_list->Append(entry_dict.Pass()); + entry_list->Append(std::move(entry_dict)); } - value->Set("dictionaries", entry_list.Pass()); + value->Set("dictionaries", std::move(entry_list)); entry_list.reset(new base::ListValue()); for (DomainBlacklistInfo::const_iterator it = blacklisted_domains_.begin(); @@ -468,11 +470,11 @@ scoped_ptr<base::Value> SdchManager::SdchInfoToValue() const { if (it->second.count != INT_MAX) entry_dict->SetInteger("tries", it->second.count); entry_dict->SetInteger("reason", it->second.reason); - entry_list->Append(entry_dict.Pass()); + entry_list->Append(std::move(entry_dict)); } - value->Set("blacklisted", entry_list.Pass()); + value->Set("blacklisted", std::move(entry_list)); - return value.Pass(); + return std::move(value); } } // namespace net diff --git a/net/base/sdch_manager_unittest.cc b/net/base/sdch_manager_unittest.cc index 6a21fcb..6ae186f0 100644 --- a/net/base/sdch_manager_unittest.cc +++ b/net/base/sdch_manager_unittest.cc @@ -569,8 +569,8 @@ TEST_F(SdchManagerTest, ExpirationCheckedProperly) { // It should be visible if looked up by hash whether expired or not. SdchProblemCode problem_code; scoped_ptr<SdchManager::DictionarySet> hash_set( - sdch_manager()->GetDictionarySetByHash( - target_gurl, server_hash, &problem_code).Pass()); + sdch_manager()->GetDictionarySetByHash(target_gurl, server_hash, + &problem_code)); ASSERT_TRUE(hash_set); ASSERT_EQ(SDCH_OK, problem_code); diff --git a/net/base/sdch_net_log_params.cc b/net/base/sdch_net_log_params.cc index 81f8476..c802742 100644 --- a/net/base/sdch_net_log_params.cc +++ b/net/base/sdch_net_log_params.cc @@ -4,6 +4,8 @@ #include "net/base/sdch_net_log_params.h" +#include <utility> + #include "base/values.h" #include "net/base/net_errors.h" #include "url/gurl.h" @@ -16,7 +18,7 @@ scoped_ptr<base::Value> NetLogSdchResourceProblemCallback( scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); dict->SetInteger("sdch_problem_code", problem); dict->SetInteger("net_error", ERR_FAILED); - return dict.Pass(); + return std::move(dict); } scoped_ptr<base::Value> NetLogSdchDictionaryFetchProblemCallback( @@ -29,7 +31,7 @@ scoped_ptr<base::Value> NetLogSdchDictionaryFetchProblemCallback( dict->SetString("dictionary_url", url.spec()); if (is_error) dict->SetInteger("net_error", ERR_FAILED); - return dict.Pass(); + return std::move(dict); } } // namespace net diff --git a/net/cert/cert_policy_enforcer.cc b/net/cert/cert_policy_enforcer.cc index 5d3b02a..8e4ba8d 100644 --- a/net/cert/cert_policy_enforcer.cc +++ b/net/cert/cert_policy_enforcer.cc @@ -5,6 +5,7 @@ #include "net/cert/cert_policy_enforcer.h" #include <algorithm> +#include <utility> #include "base/bind.h" #include "base/build_time.h" @@ -223,7 +224,7 @@ scoped_ptr<base::Value> NetLogComplianceCheckResultCallback( details->whitelist_version.GetString()); } } - return dict.Pass(); + return std::move(dict); } // Returns true if all SCTs in |verified_scts| were issued on, or after, the diff --git a/net/cert/cert_verifier.cc b/net/cert/cert_verifier.cc index 3cd4a78..79bd0ef 100644 --- a/net/cert/cert_verifier.cc +++ b/net/cert/cert_verifier.cc @@ -25,8 +25,7 @@ scoped_ptr<CertVerifier> CertVerifier::CreateDefault() { return scoped_ptr<CertVerifier>(); #else return make_scoped_ptr( - new MultiThreadedCertVerifier(CertVerifyProc::CreateDefault())) - .Pass(); + new MultiThreadedCertVerifier(CertVerifyProc::CreateDefault())); #endif } diff --git a/net/cert/ct_log_response_parser_unittest.cc b/net/cert/ct_log_response_parser_unittest.cc index dc6b37e..d9d3748 100644 --- a/net/cert/ct_log_response_parser_unittest.cc +++ b/net/cert/ct_log_response_parser_unittest.cc @@ -23,7 +23,7 @@ namespace ct { namespace { scoped_ptr<base::Value> ParseJson(const std::string& json) { base::JSONReader json_reader; - return json_reader.Read(json).Pass(); + return json_reader.Read(json); } } diff --git a/net/cert/ct_signed_certificate_timestamp_log_param.cc b/net/cert/ct_signed_certificate_timestamp_log_param.cc index 01efa0a..042f59f 100644 --- a/net/cert/ct_signed_certificate_timestamp_log_param.cc +++ b/net/cert/ct_signed_certificate_timestamp_log_param.cc @@ -6,6 +6,7 @@ #include <algorithm> #include <string> +#include <utility> #include "base/base64.h" #include "base/strings/string_number_conversions.h" @@ -139,7 +140,7 @@ scoped_ptr<base::Value> NetLogSignedCertificateTimestampCallback( dict->Set("unknown_logs_scts", SCTListToPrintableValues(ct_result->unknown_logs_scts)); - return dict.Pass(); + return std::move(dict); } scoped_ptr<base::Value> NetLogRawSignedCertificateTimestampCallback( @@ -154,7 +155,7 @@ scoped_ptr<base::Value> NetLogRawSignedCertificateTimestampCallback( SetBinaryData("scts_from_tls_extension", *sct_list_from_tls_extension, dict.get()); - return dict.Pass(); + return std::move(dict); } } // namespace net diff --git a/net/cert/internal/signature_algorithm.cc b/net/cert/internal/signature_algorithm.cc index d36eebe..38158fc 100644 --- a/net/cert/internal/signature_algorithm.cc +++ b/net/cert/internal/signature_algorithm.cc @@ -4,6 +4,8 @@ #include "net/cert/internal/signature_algorithm.h" +#include <utility> + #include "base/numerics/safe_math.h" #include "net/der/input.h" #include "net/der/parse_values.h" @@ -617,7 +619,6 @@ SignatureAlgorithm::SignatureAlgorithm( SignatureAlgorithmId algorithm, DigestAlgorithm digest, scoped_ptr<SignatureAlgorithmParameters> params) - : algorithm_(algorithm), digest_(digest), params_(params.Pass()) { -} + : algorithm_(algorithm), digest_(digest), params_(std::move(params)) {} } // namespace net diff --git a/net/cert/multi_threaded_cert_verifier.cc b/net/cert/multi_threaded_cert_verifier.cc index 608bd73..23f1d87 100644 --- a/net/cert/multi_threaded_cert_verifier.cc +++ b/net/cert/multi_threaded_cert_verifier.cc @@ -5,6 +5,7 @@ #include "net/cert/multi_threaded_cert_verifier.h" #include <algorithm> +#include <utility> #include "base/bind.h" #include "base/bind_helpers.h" @@ -106,9 +107,9 @@ scoped_ptr<base::Value> CertVerifyResultCallback( ++it) { hashes->AppendString(it->ToString()); } - results->Set("public_key_hashes", hashes.Pass()); + results->Set("public_key_hashes", std::move(hashes)); - return results.Pass(); + return std::move(results); } } // namespace @@ -329,7 +330,7 @@ class CertVerifierJob { net_log_.source().ToEventParametersCallback()); requests_.Append(request.get()); - return request.Pass(); + return request; } private: @@ -468,7 +469,7 @@ int MultiThreadedCertVerifier::Verify(X509Certificate* cert, scoped_ptr<CertVerifierRequest> request = job->CreateRequest(callback, verify_result, net_log); - *out_req = request.Pass(); + *out_req = std::move(request); return ERR_IO_PENDING; } diff --git a/net/cert/nss_cert_database.cc b/net/cert/nss_cert_database.cc index 3d37433..53ea7c7 100644 --- a/net/cert/nss_cert_database.cc +++ b/net/cert/nss_cert_database.cc @@ -9,6 +9,7 @@ #include <keyhi.h> #include <pk11pub.h> #include <secmod.h> +#include <utility> #include "base/bind.h" #include "base/callback.h" @@ -81,8 +82,8 @@ NSSCertDatabase::ImportCertFailure::~ImportCertFailure() {} NSSCertDatabase::NSSCertDatabase(crypto::ScopedPK11Slot public_slot, crypto::ScopedPK11Slot private_slot) - : public_slot_(public_slot.Pass()), - private_slot_(private_slot.Pass()), + : public_slot_(std::move(public_slot)), + private_slot_(std::move(private_slot)), observer_list_(new base::ObserverListThreadSafe<Observer>), weak_factory_(this) { CHECK(public_slot_); diff --git a/net/cert/x509_certificate_net_log_param.cc b/net/cert/x509_certificate_net_log_param.cc index 72b1e91..0a1bc8e 100644 --- a/net/cert/x509_certificate_net_log_param.cc +++ b/net/cert/x509_certificate_net_log_param.cc @@ -5,6 +5,7 @@ #include "net/cert/x509_certificate_net_log_param.h" #include <string> +#include <utility> #include <vector> #include "base/values.h" @@ -21,8 +22,8 @@ scoped_ptr<base::Value> NetLogX509CertificateCallback( certificate->GetPEMEncodedChain(&encoded_chain); for (size_t i = 0; i < encoded_chain.size(); ++i) certs->Append(new base::StringValue(encoded_chain[i])); - dict->Set("certificates", certs.Pass()); - return dict.Pass(); + dict->Set("certificates", std::move(certs)); + return std::move(dict); } } // namespace net diff --git a/net/cert_net/cert_net_fetcher_impl.cc b/net/cert_net/cert_net_fetcher_impl.cc index 7fcce5a..e80aa1b 100644 --- a/net/cert_net/cert_net_fetcher_impl.cc +++ b/net/cert_net/cert_net_fetcher_impl.cc @@ -5,6 +5,7 @@ #include "net/cert_net/cert_net_fetcher_impl.h" #include <tuple> +#include <utility> #include "base/callback_helpers.h" #include "base/containers/linked_list.h" @@ -231,10 +232,9 @@ CertNetFetcherImpl::RequestImpl::~RequestImpl() { CertNetFetcherImpl::Job::Job(scoped_ptr<RequestParams> request_params, CertNetFetcherImpl* parent) - : request_params_(request_params.Pass()), + : request_params_(std::move(request_params)), result_net_error_(ERR_IO_PENDING), - parent_(parent) { -} + parent_(parent) {} CertNetFetcherImpl::Job::~Job() { Cancel(); @@ -261,7 +261,7 @@ scoped_ptr<CertNetFetcher::Request> CertNetFetcherImpl::Job::CreateRequest( const FetchCallback& callback) { scoped_ptr<RequestImpl> request(new RequestImpl(this, callback)); requests_.Append(request.get()); - return request.Pass(); + return std::move(request); } void CertNetFetcherImpl::Job::DetachRequest(RequestImpl* request) { @@ -450,7 +450,7 @@ scoped_ptr<CertNetFetcher::Request> CertNetFetcherImpl::FetchCaIssuers( request_params->max_response_bytes = GetMaxResponseBytes(max_response_bytes, kMaxResponseSizeInBytesForAia); - return Fetch(request_params.Pass(), callback); + return Fetch(std::move(request_params), callback); } scoped_ptr<CertNetFetcher::Request> CertNetFetcherImpl::FetchCrl( @@ -466,7 +466,7 @@ scoped_ptr<CertNetFetcher::Request> CertNetFetcherImpl::FetchCrl( request_params->max_response_bytes = GetMaxResponseBytes(max_response_bytes, kMaxResponseSizeInBytesForCrl); - return Fetch(request_params.Pass(), callback); + return Fetch(std::move(request_params), callback); } scoped_ptr<CertNetFetcher::Request> CertNetFetcherImpl::FetchOcsp( @@ -482,7 +482,7 @@ scoped_ptr<CertNetFetcher::Request> CertNetFetcherImpl::FetchOcsp( request_params->max_response_bytes = GetMaxResponseBytes(max_response_bytes, kMaxResponseSizeInBytesForAia); - return Fetch(request_params.Pass(), callback); + return Fetch(std::move(request_params), callback); } bool CertNetFetcherImpl::JobComparator::operator()(const Job* job1, @@ -500,7 +500,7 @@ scoped_ptr<CertNetFetcher::Request> CertNetFetcherImpl::Fetch( Job* job = FindJob(*request_params); if (!job) { - job = new Job(request_params.Pass(), this); + job = new Job(std::move(request_params), this); jobs_.insert(job); job->StartURLRequest(context_); } diff --git a/net/cert_net/cert_net_fetcher_impl_unittest.cc b/net/cert_net/cert_net_fetcher_impl_unittest.cc index 7f5e54a..311e93a 100644 --- a/net/cert_net/cert_net_fetcher_impl_unittest.cc +++ b/net/cert_net/cert_net_fetcher_impl_unittest.cc @@ -5,6 +5,7 @@ #include "net/cert_net/cert_net_fetcher_impl.h" #include <string> +#include <utility> #include "base/compiler_specific.h" #include "base/run_loop.h" @@ -102,7 +103,7 @@ class TestFetchCallback { run_loop.Run(); quit_closure_.Reset(); } - return result_.Pass(); + return std::move(result_); } bool HasResult() const { return result_.get(); } diff --git a/net/cert_net/nss_ocsp.cc b/net/cert_net/nss_ocsp.cc index 1c74d47..6b73cd5 100644 --- a/net/cert_net/nss_ocsp.cc +++ b/net/cert_net/nss_ocsp.cc @@ -6,14 +6,14 @@ #include <certt.h> #include <certdb.h> -#include <ocsp.h> #include <nspr.h> #include <nss.h> +#include <ocsp.h> #include <pthread.h> #include <secerr.h> - #include <algorithm> #include <string> +#include <utility> #include "base/callback.h" #include "base/compiler_specific.h" @@ -410,7 +410,7 @@ class OCSPRequestSession scoped_ptr<UploadElementReader> reader(new UploadBytesElementReader( upload_content_.data(), upload_content_.size())); request_->set_upload( - ElementsUploadDataStream::CreateWithReader(reader.Pass(), 0)); + ElementsUploadDataStream::CreateWithReader(std::move(reader), 0)); } if (!extra_request_headers_.IsEmpty()) request_->SetExtraRequestHeaders(extra_request_headers_); diff --git a/net/cert_net/nss_ocsp_unittest.cc b/net/cert_net/nss_ocsp_unittest.cc index b43b770..e4367cc 100644 --- a/net/cert_net/nss_ocsp_unittest.cc +++ b/net/cert_net/nss_ocsp_unittest.cc @@ -5,6 +5,7 @@ #include "net/cert_net/nss_ocsp.h" #include <string> +#include <utility> #include "base/files/file_path.h" #include "base/files/file_util.h" @@ -91,8 +92,8 @@ class NssHttpTest : public ::testing::Test { new AiaResponseHandler(kAiaHeaders, file_contents)); handler_ = handler.get(); - URLRequestFilter::GetInstance()->AddHostnameInterceptor( - "http", kAiaHost, handler.Pass()); + URLRequestFilter::GetInstance()->AddHostnameInterceptor("http", kAiaHost, + std::move(handler)); SetURLRequestContextForNSSHttpIO(&context_); EnsureNSSHttpIOInit(); diff --git a/net/disk_cache/backend_unittest.cc b/net/disk_cache/backend_unittest.cc index 2d36def..fb7396c 100644 --- a/net/disk_cache/backend_unittest.cc +++ b/net/disk_cache/backend_unittest.cc @@ -64,7 +64,7 @@ scoped_ptr<disk_cache::BackendImpl> CreateExistingEntryCache( return scoped_ptr<disk_cache::BackendImpl>(); entry->Close(); - return cache.Pass(); + return cache; } } // namespace diff --git a/net/disk_cache/blockfile/backend_impl.cc b/net/disk_cache/blockfile/backend_impl.cc index f54128f..980ddc7 100644 --- a/net/disk_cache/blockfile/backend_impl.cc +++ b/net/disk_cache/blockfile/backend_impl.cc @@ -5,6 +5,7 @@ #include "net/disk_cache/blockfile/backend_impl.h" #include <limits> +#include <utility> #include "base/bind.h" #include "base/bind_helpers.h" @@ -402,7 +403,7 @@ int BackendImpl::SyncDoomEntriesBetween(const base::Time initial_time, if (next) next->Release(); next = NULL; - SyncEndEnumeration(iterator.Pass()); + SyncEndEnumeration(std::move(iterator)); } node->Release(); @@ -435,13 +436,14 @@ int BackendImpl::SyncDoomEntriesSince(const base::Time initial_time) { if (initial_time > entry->GetLastUsed()) { entry->Release(); - SyncEndEnumeration(iterator.Pass()); + SyncEndEnumeration(std::move(iterator)); return net::OK; } entry->DoomImpl(); entry->Release(); - SyncEndEnumeration(iterator.Pass()); // The doom invalidated the iterator. + SyncEndEnumeration( + std::move(iterator)); // The doom invalidated the iterator. } } @@ -1281,7 +1283,7 @@ class BackendImpl::IteratorImpl : public Backend::Iterator { ~IteratorImpl() override { if (background_queue_) - background_queue_->EndEnumeration(iterator_.Pass()); + background_queue_->EndEnumeration(std::move(iterator_)); } int OpenNextEntry(Entry** next_entry, @@ -1371,7 +1373,8 @@ bool BackendImpl::InitBackingStore(bool* file_created) { bool ret = true; *file_created = base_file.created(); - scoped_refptr<disk_cache::File> file(new disk_cache::File(base_file.Pass())); + scoped_refptr<disk_cache::File> file( + new disk_cache::File(std::move(base_file))); if (*file_created) ret = CreateBackingStore(file.get()); diff --git a/net/disk_cache/blockfile/file_posix.cc b/net/disk_cache/blockfile/file_posix.cc index 26067fb..5a3ad45 100644 --- a/net/disk_cache/blockfile/file_posix.cc +++ b/net/disk_cache/blockfile/file_posix.cc @@ -5,8 +5,8 @@ #include "net/disk_cache/blockfile/file.h" #include <stdint.h> - #include <limits> +#include <utility> #include "base/bind.h" #include "base/lazy_instance.h" @@ -39,10 +39,7 @@ base::LazyInstance<FileWorkerPool>::Leaky s_worker_pool = namespace disk_cache { File::File(base::File file) - : init_(true), - mixed_(true), - base_file_(file.Pass()) { -} + : init_(true), mixed_(true), base_file_(std::move(file)) {} bool File::Init(const base::FilePath& name) { if (base_file_.IsValid()) diff --git a/net/disk_cache/blockfile/in_flight_backend_io.cc b/net/disk_cache/blockfile/in_flight_backend_io.cc index 6dda26b..307f7d2 100644 --- a/net/disk_cache/blockfile/in_flight_backend_io.cc +++ b/net/disk_cache/blockfile/in_flight_backend_io.cc @@ -4,6 +4,8 @@ #include "net/disk_cache/blockfile/in_flight_backend_io.h" +#include <utility> + #include "base/bind.h" #include "base/bind_helpers.h" #include "base/compiler_specific.h" @@ -128,7 +130,7 @@ void BackendIO::OpenNextEntry(Rankings::Iterator* iterator, void BackendIO::EndEnumeration(scoped_ptr<Rankings::Iterator> iterator) { operation_ = OP_END_ENUMERATION; - scoped_iterator_ = iterator.Pass(); + scoped_iterator_ = std::move(iterator); } void BackendIO::OnExternalCacheHit(const std::string& key) { @@ -261,7 +263,7 @@ void BackendIO::ExecuteBackendOperation() { result_ = backend_->SyncOpenNextEntry(iterator_, entry_ptr_); break; case OP_END_ENUMERATION: - backend_->SyncEndEnumeration(scoped_iterator_.Pass()); + backend_->SyncEndEnumeration(std::move(scoped_iterator_)); result_ = net::OK; break; case OP_ON_EXTERNAL_CACHE_HIT: @@ -414,7 +416,7 @@ void InFlightBackendIO::EndEnumeration( scoped_ptr<Rankings::Iterator> iterator) { scoped_refptr<BackendIO> operation( new BackendIO(this, backend_, net::CompletionCallback())); - operation->EndEnumeration(iterator.Pass()); + operation->EndEnumeration(std::move(iterator)); PostOperation(operation.get()); } diff --git a/net/disk_cache/blockfile/index_table_v3_unittest.cc b/net/disk_cache/blockfile/index_table_v3_unittest.cc index e84b743..e2fca10 100644 --- a/net/disk_cache/blockfile/index_table_v3_unittest.cc +++ b/net/disk_cache/blockfile/index_table_v3_unittest.cc @@ -2,13 +2,15 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "net/disk_cache/blockfile/index_table_v3.h" + #include <stdint.h> +#include <utility> #include "base/logging.h" #include "base/macros.h" #include "net/disk_cache/blockfile/addr.h" #include "net/disk_cache/blockfile/disk_format_v3.h" -#include "net/disk_cache/blockfile/index_table_v3.h" #include "testing/gtest/include/gtest/gtest.h" using disk_cache::EntryCell; @@ -584,7 +586,7 @@ TEST(DiskCacheIndexTable, Doubling) { // Go from 1024 to 256k cells. for (int resizes = 0; resizes <= 8; resizes++) { - scoped_ptr<TestCacheTables> old_cache(cache.Pass()); + scoped_ptr<TestCacheTables> old_cache(std::move(cache)); cache.reset(new TestCacheTables(size)); cache.get()->CopyFrom(*old_cache.get()); @@ -639,7 +641,7 @@ TEST(DiskCacheIndexTable, BucketChains) { } // Double the size. - scoped_ptr<TestCacheTables> old_cache(cache.Pass()); + scoped_ptr<TestCacheTables> old_cache(std::move(cache)); cache.reset(new TestCacheTables(size * 2)); cache.get()->CopyFrom(*old_cache.get()); diff --git a/net/disk_cache/cache_creator.cc b/net/disk_cache/cache_creator.cc index 243acc4..54338c1 100644 --- a/net/disk_cache/cache_creator.cc +++ b/net/disk_cache/cache_creator.cc @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include <utility> + #include "base/files/file_path.h" #include "base/macros.h" #include "base/metrics/field_trial.h" @@ -122,7 +124,7 @@ int CacheCreator::Run() { void CacheCreator::DoCallback(int result) { DCHECK_NE(net::ERR_IO_PENDING, result); if (result == net::OK) { - *backend_ = created_cache_.Pass(); + *backend_ = std::move(created_cache_); } else { LOG(ERROR) << "Unable to create cache"; created_cache_.reset(); diff --git a/net/disk_cache/disk_cache_test_base.cc b/net/disk_cache/disk_cache_test_base.cc index 86abe1d..d3a2125 100644 --- a/net/disk_cache/disk_cache_test_base.cc +++ b/net/disk_cache/disk_cache_test_base.cc @@ -4,6 +4,8 @@ #include "net/disk_cache/disk_cache_test_base.h" +#include <utility> + #include "base/files/file_util.h" #include "base/path_service.h" #include "base/run_loop.h" @@ -54,8 +56,7 @@ void DiskCacheTest::TearDown() { DiskCacheTestWithCache::TestIterator::TestIterator( scoped_ptr<disk_cache::Backend::Iterator> iterator) - : iterator_(iterator.Pass()) { -} + : iterator_(std::move(iterator)) {} DiskCacheTestWithCache::TestIterator::~TestIterator() {} @@ -317,7 +318,7 @@ void DiskCacheTestWithCache::CreateBackend(uint32_t flags, int rv = simple_backend->Init(cb.callback()); ASSERT_EQ(net::OK, cb.GetResult(rv)); simple_cache_impl_ = simple_backend.get(); - cache_ = simple_backend.Pass(); + cache_ = std::move(simple_backend); if (simple_cache_wait_for_index_) { net::TestCompletionCallback wait_for_index_cb; rv = simple_cache_impl_->index()->ExecuteWhenReady( diff --git a/net/disk_cache/entry_unittest.cc b/net/disk_cache/entry_unittest.cc index 7806da8..ea58049 100644 --- a/net/disk_cache/entry_unittest.cc +++ b/net/disk_cache/entry_unittest.cc @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include <utility> + #include "base/bind.h" #include "base/bind_helpers.h" #include "base/files/file.h" @@ -2184,8 +2186,7 @@ TEST_F(DiskCacheEntryTest, MemoryOnlyDoomSparseEntry) { class SparseTestCompletionCallback: public net::TestCompletionCallback { public: explicit SparseTestCompletionCallback(scoped_ptr<disk_cache::Backend> cache) - : cache_(cache.Pass()) { - } + : cache_(std::move(cache)) {} private: void SetResult(int result) override { @@ -2222,7 +2223,7 @@ TEST_F(DiskCacheEntryTest, DoomSparseEntry2) { entry->Close(); disk_cache::Backend* cache = cache_.get(); - SparseTestCompletionCallback cb(cache_.Pass()); + SparseTestCompletionCallback cb(std::move(cache_)); int rv = cache->DoomEntry(key, cb.callback()); EXPECT_EQ(net::ERR_IO_PENDING, rv); EXPECT_EQ(net::OK, cb.WaitForResult()); diff --git a/net/disk_cache/memory/mem_backend_impl.cc b/net/disk_cache/memory/mem_backend_impl.cc index d7a7a16..5b37ca9 100644 --- a/net/disk_cache/memory/mem_backend_impl.cc +++ b/net/disk_cache/memory/mem_backend_impl.cc @@ -4,6 +4,8 @@ #include "net/disk_cache/memory/mem_backend_impl.h" +#include <utility> + #include "base/logging.h" #include "base/sys_info.h" #include "net/base/net_errors.h" @@ -47,7 +49,7 @@ scoped_ptr<Backend> MemBackendImpl::CreateBackend(int max_bytes, scoped_ptr<MemBackendImpl> cache(new MemBackendImpl(net_log)); cache->SetMaxSize(max_bytes); if (cache->Init()) - return cache.Pass(); + return std::move(cache); LOG(ERROR) << "Unable to create cache"; return nullptr; diff --git a/net/disk_cache/memory/mem_entry_impl.cc b/net/disk_cache/memory/mem_entry_impl.cc index 55cdd14..6925518 100644 --- a/net/disk_cache/memory/mem_entry_impl.cc +++ b/net/disk_cache/memory/mem_entry_impl.cc @@ -4,6 +4,8 @@ #include "net/disk_cache/memory/mem_entry_impl.h" +#include <utility> + #include "base/bind.h" #include "base/logging.h" #include "base/strings/stringprintf.h" @@ -52,7 +54,7 @@ scoped_ptr<base::Value> NetLogChildEntryCreationCallback( scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); dict->SetString("key", GenerateChildName(parent->GetKey(), child_id)); dict->SetBoolean("created", true); - return dict.Pass(); + return std::move(dict); } } // namespace diff --git a/net/disk_cache/net_log_parameters.cc b/net/disk_cache/net_log_parameters.cc index 4f95fbb..842ce25 100644 --- a/net/disk_cache/net_log_parameters.cc +++ b/net/disk_cache/net_log_parameters.cc @@ -4,6 +4,8 @@ #include "net/disk_cache/net_log_parameters.h" +#include <utility> + #include "base/bind.h" #include "base/logging.h" #include "base/strings/string_number_conversions.h" @@ -20,7 +22,7 @@ scoped_ptr<base::Value> NetLogEntryCreationCallback( scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); dict->SetString("key", entry->GetKey()); dict->SetBoolean("created", created); - return dict.Pass(); + return std::move(dict); } scoped_ptr<base::Value> NetLogReadWriteDataCallback( @@ -35,7 +37,7 @@ scoped_ptr<base::Value> NetLogReadWriteDataCallback( dict->SetInteger("buf_len", buf_len); if (truncate) dict->SetBoolean("truncate", truncate); - return dict.Pass(); + return std::move(dict); } scoped_ptr<base::Value> NetLogReadWriteCompleteCallback( @@ -48,7 +50,7 @@ scoped_ptr<base::Value> NetLogReadWriteCompleteCallback( } else { dict->SetInteger("bytes_copied", bytes_copied); } - return dict.Pass(); + return std::move(dict); } scoped_ptr<base::Value> NetLogSparseOperationCallback( @@ -60,7 +62,7 @@ scoped_ptr<base::Value> NetLogSparseOperationCallback( // instead circumvents that restriction. dict->SetString("offset", base::Int64ToString(offset)); dict->SetInteger("buf_len", buf_len); - return dict.Pass(); + return std::move(dict); } scoped_ptr<base::Value> NetLogSparseReadWriteCallback( @@ -70,7 +72,7 @@ scoped_ptr<base::Value> NetLogSparseReadWriteCallback( scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); source.AddToEventParameters(dict.get()); dict->SetInteger("child_len", child_len); - return dict.Pass(); + return std::move(dict); } scoped_ptr<base::Value> NetLogGetAvailableRangeResultCallback( @@ -84,7 +86,7 @@ scoped_ptr<base::Value> NetLogGetAvailableRangeResultCallback( } else { dict->SetInteger("net_error", result); } - return dict.Pass(); + return std::move(dict); } } // namespace diff --git a/net/disk_cache/simple/simple_backend_impl.cc b/net/disk_cache/simple/simple_backend_impl.cc index cb907b6..9f410ed 100644 --- a/net/disk_cache/simple/simple_backend_impl.cc +++ b/net/disk_cache/simple/simple_backend_impl.cc @@ -214,7 +214,7 @@ class SimpleBackendImpl::ActiveEntryProxy SimpleBackendImpl* backend) { scoped_ptr<SimpleEntryImpl::ActiveEntryProxy> proxy(new ActiveEntryProxy(entry_hash, backend)); - return proxy.Pass(); + return proxy; } private: @@ -492,7 +492,7 @@ class SimpleBackendImpl::SimpleIterator final : public Iterator { return; } if (!hashes_to_enumerate_) - hashes_to_enumerate_ = backend_->index()->GetAllHashes().Pass(); + hashes_to_enumerate_ = backend_->index()->GetAllHashes(); while (!hashes_to_enumerate_->empty()) { uint64_t entry_hash = hashes_to_enumerate_->back(); diff --git a/net/disk_cache/simple/simple_entry_impl.cc b/net/disk_cache/simple/simple_entry_impl.cc index f0ce25d..efdd65a 100644 --- a/net/disk_cache/simple/simple_entry_impl.cc +++ b/net/disk_cache/simple/simple_entry_impl.cc @@ -7,6 +7,7 @@ #include <algorithm> #include <cstring> #include <limits> +#include <utility> #include <vector> #include "base/bind.h" @@ -1231,7 +1232,7 @@ void SimpleEntryImpl::ReadOperationComplete( CreateNetLogReadWriteCompleteCallback(*result)); } - EntryOperationComplete(completion_callback, *entry_stat, result.Pass()); + EntryOperationComplete(completion_callback, *entry_stat, std::move(result)); } void SimpleEntryImpl::WriteOperationComplete( @@ -1252,7 +1253,7 @@ void SimpleEntryImpl::WriteOperationComplete( crc32s_end_offset_[stream_index] = 0; } - EntryOperationComplete(completion_callback, *entry_stat, result.Pass()); + EntryOperationComplete(completion_callback, *entry_stat, std::move(result)); } void SimpleEntryImpl::ReadSparseOperationComplete( @@ -1265,7 +1266,7 @@ void SimpleEntryImpl::ReadSparseOperationComplete( SimpleEntryStat entry_stat(*last_used, last_modified_, data_size_, sparse_data_size_); - EntryOperationComplete(completion_callback, entry_stat, result.Pass()); + EntryOperationComplete(completion_callback, entry_stat, std::move(result)); } void SimpleEntryImpl::WriteSparseOperationComplete( @@ -1276,7 +1277,7 @@ void SimpleEntryImpl::WriteSparseOperationComplete( DCHECK(synchronous_entry_); DCHECK(result); - EntryOperationComplete(completion_callback, *entry_stat, result.Pass()); + EntryOperationComplete(completion_callback, *entry_stat, std::move(result)); } void SimpleEntryImpl::GetAvailableRangeOperationComplete( @@ -1288,7 +1289,7 @@ void SimpleEntryImpl::GetAvailableRangeOperationComplete( SimpleEntryStat entry_stat(last_used_, last_modified_, data_size_, sparse_data_size_); - EntryOperationComplete(completion_callback, entry_stat, result.Pass()); + EntryOperationComplete(completion_callback, entry_stat, std::move(result)); } void SimpleEntryImpl::DoomOperationComplete( @@ -1336,7 +1337,7 @@ void SimpleEntryImpl::ChecksumOperationComplete( SimpleEntryStat entry_stat(last_used_, last_modified_, data_size_, sparse_data_size_); - EntryOperationComplete(completion_callback, entry_stat, result.Pass()); + EntryOperationComplete(completion_callback, entry_stat, std::move(result)); } void SimpleEntryImpl::CloseOperationComplete() { diff --git a/net/disk_cache/simple/simple_index.cc b/net/disk_cache/simple/simple_index.cc index 0051cd0..7df258a 100644 --- a/net/disk_cache/simple/simple_index.cc +++ b/net/disk_cache/simple/simple_index.cc @@ -153,13 +153,12 @@ SimpleIndex::SimpleIndex( low_watermark_(0), eviction_in_progress_(false), initialized_(false), - index_file_(index_file.Pass()), + index_file_(std::move(index_file)), io_thread_(io_thread), // Creating the callback once so it is reused every time // write_to_disk_timer_.Start() is called. write_to_disk_cb_(base::Bind(&SimpleIndex::WriteToDisk, AsWeakPtr())), - app_on_background_(false) { -} + app_on_background_(false) {} SimpleIndex::~SimpleIndex() { DCHECK(io_thread_checker_.CalledOnValidThread()); @@ -229,7 +228,7 @@ scoped_ptr<SimpleIndex::HashList> SimpleIndex::GetEntriesBetween( if (initial_time <= entry_time && entry_time < extended_end_time) ret_hashes->push_back(it->first); } - return ret_hashes.Pass(); + return ret_hashes; } scoped_ptr<SimpleIndex::HashList> SimpleIndex::GetAllHashes() { diff --git a/net/disk_cache/simple/simple_index_file.cc b/net/disk_cache/simple/simple_index_file.cc index f392883..7e80c02 100644 --- a/net/disk_cache/simple/simple_index_file.cc +++ b/net/disk_cache/simple/simple_index_file.cc @@ -4,6 +4,7 @@ #include "net/disk_cache/simple/simple_index_file.h" +#include <utility> #include <vector> #include "base/files/file.h" @@ -354,7 +355,7 @@ void SimpleIndexFile::SyncLoadFromDisk(const base::FilePath& index_filename, return; base::MemoryMappedFile index_file_map; - if (!index_file_map.Initialize(file.Pass())) { + if (!index_file_map.Initialize(std::move(file))) { simple_util::SimpleCacheDeleteFile(index_filename); return; } @@ -382,7 +383,7 @@ scoped_ptr<base::Pickle> SimpleIndexFile::Serialize( pickle->WriteUInt64(it->first); it->second.Serialize(pickle.get()); } - return pickle.Pass(); + return pickle; } // static diff --git a/net/disk_cache/simple/simple_index_unittest.cc b/net/disk_cache/simple/simple_index_unittest.cc index ee0ddbe..649d48f 100644 --- a/net/disk_cache/simple/simple_index_unittest.cc +++ b/net/disk_cache/simple/simple_index_unittest.cc @@ -2,8 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "net/disk_cache/simple/simple_index.h" + #include <algorithm> #include <functional> +#include <utility> #include "base/files/scoped_temp_dir.h" #include "base/hash.h" @@ -16,7 +19,6 @@ #include "base/threading/platform_thread.h" #include "base/time/time.h" #include "net/base/cache_type.h" -#include "net/disk_cache/simple/simple_index.h" #include "net/disk_cache/simple/simple_index_delegate.h" #include "net/disk_cache/simple/simple_index_file.h" #include "net/disk_cache/simple/simple_test_util.h" @@ -106,7 +108,7 @@ class SimpleIndexTest : public testing::Test, public SimpleIndexDelegate { scoped_ptr<MockSimpleIndexFile> index_file(new MockSimpleIndexFile()); index_file_ = index_file->AsWeakPtr(); index_.reset( - new SimpleIndex(NULL, this, net::DISK_CACHE, index_file.Pass())); + new SimpleIndex(NULL, this, net::DISK_CACHE, std::move(index_file))); index_->Initialize(base::Time()); } @@ -207,7 +209,7 @@ TEST_F(SimpleIndexTest, IndexSizeCorrectOnMerge) { { scoped_ptr<SimpleIndexLoadResult> result(new SimpleIndexLoadResult()); result->did_load = true; - index()->MergeInitializingSet(result.Pass()); + index()->MergeInitializingSet(std::move(result)); } EXPECT_EQ(9U, index()->cache_size_); { @@ -219,7 +221,7 @@ TEST_F(SimpleIndexTest, IndexSizeCorrectOnMerge) { const uint64_t redundant_hash_key = hashes_.at<4>(); result->entries.insert(std::make_pair(redundant_hash_key, EntryMetadata(base::Time::Now(), 4))); - index()->MergeInitializingSet(result.Pass()); + index()->MergeInitializingSet(std::move(result)); } EXPECT_EQ(2U + 3U + 4U + 11U, index()->cache_size_); } diff --git a/net/disk_cache/simple/simple_net_log_parameters.cc b/net/disk_cache/simple/simple_net_log_parameters.cc index 8fe57f5..46c678c 100644 --- a/net/disk_cache/simple/simple_net_log_parameters.cc +++ b/net/disk_cache/simple/simple_net_log_parameters.cc @@ -4,6 +4,8 @@ #include "net/disk_cache/simple/simple_net_log_parameters.h" +#include <utility> + #include "base/bind.h" #include "base/compiler_specific.h" #include "base/format_macros.h" @@ -21,7 +23,7 @@ scoped_ptr<base::Value> NetLogSimpleEntryConstructionCallback( scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); dict->SetString("entry_hash", base::StringPrintf("%#016" PRIx64, entry->entry_hash())); - return dict.Pass(); + return std::move(dict); } scoped_ptr<base::Value> NetLogSimpleEntryCreationCallback( @@ -32,7 +34,7 @@ scoped_ptr<base::Value> NetLogSimpleEntryCreationCallback( dict->SetInteger("net_error", net_error); if (net_error == net::OK) dict->SetString("key", entry->key()); - return dict.Pass(); + return std::move(dict); } } // namespace diff --git a/net/dns/address_sorter_posix.cc b/net/dns/address_sorter_posix.cc index a5647f8..f0a0422 100644 --- a/net/dns/address_sorter_posix.cc +++ b/net/dns/address_sorter_posix.cc @@ -5,6 +5,7 @@ #include "net/dns/address_sorter_posix.h" #include <netinet/in.h> +#include <utility> #if defined(OS_MACOSX) || defined(OS_BSD) #include <sys/socket.h> // Must be included before ifaddrs.h. @@ -305,7 +306,7 @@ void AddressSorterPosix::Sort(const AddressList& list, CommonPrefixLength(info->address, src.address()), info->src->prefix_length); } - sort_list.push_back(info.Pass()); + sort_list.push_back(std::move(info)); } std::stable_sort(sort_list.begin(), sort_list.end(), CompareDestinations); diff --git a/net/dns/dns_client.cc b/net/dns/dns_client.cc index 062894a..a9531523 100644 --- a/net/dns/dns_client.cc +++ b/net/dns/dns_client.cc @@ -4,6 +4,8 @@ #include "net/dns/dns_client.h" +#include <utility> + #include "base/bind.h" #include "base/rand_util.h" #include "net/dns/address_sorter.h" @@ -32,10 +34,8 @@ class DnsClientImpl : public DnsClient { scoped_ptr<DnsSocketPool> socket_pool( config.randomize_ports ? DnsSocketPool::CreateDefault(factory) : DnsSocketPool::CreateNull(factory)); - session_ = new DnsSession(config, - socket_pool.Pass(), - base::Bind(&base::RandInt), - net_log_); + session_ = new DnsSession(config, std::move(socket_pool), + base::Bind(&base::RandInt), net_log_); factory_ = DnsTransactionFactory::CreateFactory(session_.get()); } } diff --git a/net/dns/dns_session.cc b/net/dns/dns_session.cc index b200ea3..5148e0b 100644 --- a/net/dns/dns_session.cc +++ b/net/dns/dns_session.cc @@ -5,8 +5,8 @@ #include "net/dns/dns_session.h" #include <stdint.h> - #include <limits> +#include <utility> #include "base/bind.h" #include "base/lazy_instance.h" @@ -78,10 +78,12 @@ DnsSession::RttBuckets::RttBuckets() : base::BucketRanges(kRTTBucketCount + 1) { DnsSession::SocketLease::SocketLease(scoped_refptr<DnsSession> session, unsigned server_index, scoped_ptr<DatagramClientSocket> socket) - : session_(session), server_index_(server_index), socket_(socket.Pass()) {} + : session_(session), + server_index_(server_index), + socket_(std::move(socket)) {} DnsSession::SocketLease::~SocketLease() { - session_->FreeSocket(server_index_, socket_.Pass()); + session_->FreeSocket(server_index_, std::move(socket_)); } DnsSession::DnsSession(const DnsConfig& config, @@ -89,7 +91,7 @@ DnsSession::DnsSession(const DnsConfig& config, const RandIntCallback& rand_int_callback, NetLog* net_log) : config_(config), - socket_pool_(socket_pool.Pass()), + socket_pool_(std::move(socket_pool)), rand_callback_(base::Bind(rand_int_callback, 0, std::numeric_limits<uint16_t>::max())), @@ -239,7 +241,7 @@ scoped_ptr<DnsSession::SocketLease> DnsSession::AllocateSocket( socket->NetLog().BeginEvent(NetLog::TYPE_SOCKET_IN_USE, source.ToEventParametersCallback()); - SocketLease* lease = new SocketLease(this, server_index, socket.Pass()); + SocketLease* lease = new SocketLease(this, server_index, std::move(socket)); return scoped_ptr<SocketLease>(lease); } @@ -255,7 +257,7 @@ void DnsSession::FreeSocket(unsigned server_index, socket->NetLog().EndEvent(NetLog::TYPE_SOCKET_IN_USE); - socket_pool_->FreeSocket(server_index, socket.Pass()); + socket_pool_->FreeSocket(server_index, std::move(socket)); } base::TimeDelta DnsSession::NextTimeoutFromJacobson(unsigned server_index, diff --git a/net/dns/dns_session_unittest.cc b/net/dns/dns_session_unittest.cc index 9ba920c..b2a09f1 100644 --- a/net/dns/dns_session_unittest.cc +++ b/net/dns/dns_session_unittest.cc @@ -5,6 +5,7 @@ #include "net/dns/dns_session.h" #include <list> +#include <utility> #include "base/bind.h" #include "base/memory/scoped_ptr.h" @@ -190,7 +191,7 @@ TestClientSocketFactory::CreateDatagramClientSocket( data_providers_.push_back(data_provider); scoped_ptr<MockUDPClientSocket> socket( new MockUDPClientSocket(data_provider, net_log)); - return socket.Pass(); + return std::move(socket); } TestClientSocketFactory::~TestClientSocketFactory() { diff --git a/net/dns/dns_socket_pool.cc b/net/dns/dns_socket_pool.cc index e937f9c..e365d57 100644 --- a/net/dns/dns_socket_pool.cc +++ b/net/dns/dns_socket_pool.cc @@ -87,7 +87,7 @@ scoped_ptr<DatagramClientSocket> DnsSocketPool::CreateConnectedSocket( LOG(WARNING) << "Failed to create socket."; } - return socket.Pass(); + return socket; } class NullDnsSocketPool : public DnsSocketPool { diff --git a/net/dns/dns_transaction.cc b/net/dns/dns_transaction.cc index 52d5470..8eebb8c 100644 --- a/net/dns/dns_transaction.cc +++ b/net/dns/dns_transaction.cc @@ -6,6 +6,7 @@ #include <deque> #include <string> +#include <utility> #include <vector> #include "base/big_endian.h" @@ -67,7 +68,7 @@ scoped_ptr<base::Value> NetLogStartCallback( scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); dict->SetString("hostname", *hostname); dict->SetInteger("query_type", qtype); - return dict.Pass(); + return std::move(dict); }; // ---------------------------------------------------------------------------- @@ -109,7 +110,7 @@ class DnsAttempt { dict->SetInteger("rcode", GetResponse()->rcode()); dict->SetInteger("answer_count", GetResponse()->answer_count()); GetSocketNetLog().source().AddToEventParameters(dict.get()); - return dict.Pass(); + return std::move(dict); } void set_result(int result) { @@ -142,8 +143,8 @@ class DnsUDPAttempt : public DnsAttempt { : DnsAttempt(server_index), next_state_(STATE_NONE), received_malformed_response_(false), - socket_lease_(socket_lease.Pass()), - query_(query.Pass()) {} + socket_lease_(std::move(socket_lease)), + query_(std::move(query)) {} // DnsAttempt: int Start(const CompletionCallback& callback) override { @@ -303,8 +304,8 @@ class DnsTCPAttempt : public DnsAttempt { scoped_ptr<DnsQuery> query) : DnsAttempt(server_index), next_state_(STATE_NONE), - socket_(socket.Pass()), - query_(query.Pass()), + socket_(std::move(socket)), + query_(std::move(query)), length_buffer_(new IOBufferWithSize(sizeof(uint16_t))), response_length_(0) {} @@ -724,7 +725,7 @@ class DnsTransactionImpl : public DnsTransaction, bool got_socket = !!lease.get(); DnsUDPAttempt* attempt = - new DnsUDPAttempt(server_index, lease.Pass(), query.Pass()); + new DnsUDPAttempt(server_index, std::move(lease), std::move(query)); attempts_.push_back(make_scoped_ptr(attempt)); ++attempts_count_; @@ -768,8 +769,8 @@ class DnsTransactionImpl : public DnsTransaction, unsigned attempt_number = attempts_.size(); - DnsTCPAttempt* attempt = new DnsTCPAttempt(server_index, socket.Pass(), - query.Pass()); + DnsTCPAttempt* attempt = + new DnsTCPAttempt(server_index, std::move(socket), std::move(query)); attempts_.push_back(make_scoped_ptr(attempt)); ++attempts_count_; diff --git a/net/dns/dns_transaction_unittest.cc b/net/dns/dns_transaction_unittest.cc index 38c070c..7b906ba 100644 --- a/net/dns/dns_transaction_unittest.cc +++ b/net/dns/dns_transaction_unittest.cc @@ -5,8 +5,8 @@ #include "net/dns/dns_transaction.h" #include <stdint.h> - #include <limits> +#include <utility> #include "base/bind.h" #include "base/macros.h" @@ -51,7 +51,7 @@ class DnsSocketData { writes_.push_back(MockWrite(mode, reinterpret_cast<const char*>(length.get()), sizeof(uint16_t), num_reads_and_writes())); - lengths_.push_back(length.Pass()); + lengths_.push_back(std::move(length)); } writes_.push_back(MockWrite(mode, query_->io_buffer()->data(), query_->io_buffer()->size(), @@ -72,18 +72,18 @@ class DnsSocketData { reads_.push_back(MockRead(mode, reinterpret_cast<const char*>(length.get()), sizeof(uint16_t), num_reads_and_writes())); - lengths_.push_back(length.Pass()); + lengths_.push_back(std::move(length)); } reads_.push_back(MockRead(mode, response->io_buffer()->data(), response->io_buffer()->size(), num_reads_and_writes())); - responses_.push_back(response.Pass()); + responses_.push_back(std::move(response)); } // Adds pre-built DnsResponse. void AddResponse(scoped_ptr<DnsResponse> response, IoMode mode) { uint16_t tcp_length = response->io_buffer()->size(); - AddResponseWithLength(response.Pass(), mode, tcp_length); + AddResponseWithLength(std::move(response), mode, tcp_length); } // Adds pre-built response from |data| buffer. @@ -102,7 +102,7 @@ class DnsSocketData { dns_protocol::Header* header = reinterpret_cast<dns_protocol::Header*>(response->io_buffer()->data()); header->flags |= base::HostToNet16(dns_protocol::kFlagResponse | rcode); - AddResponse(response.Pass(), mode); + AddResponse(std::move(response), mode); } // Add error response. @@ -197,7 +197,7 @@ class TestSocketFactory : public MockClientSocketFactory { SocketDataProvider* data_provider = mock_data().GetNext(); scoped_ptr<TestUDPClientSocket> socket( new TestUDPClientSocket(this, data_provider, net_log)); - return socket.Pass(); + return std::move(socket); } void OnConnect(const IPEndPoint& endpoint) { @@ -360,7 +360,7 @@ class DnsTransactionTest : public testing::Test { CHECK(socket_factory_.get()); transaction_ids_.push_back(data->query_id()); socket_factory_->AddSocketDataProvider(data->GetProvider()); - socket_data_.push_back(data.Pass()); + socket_data_.push_back(std::move(data)); } // Add expected query for |dotted_name| and |qtype| with |id| and response @@ -377,7 +377,7 @@ class DnsTransactionTest : public testing::Test { scoped_ptr<DnsSocketData> data( new DnsSocketData(id, dotted_name, qtype, mode, use_tcp)); data->AddResponseData(response_data, response_length, mode); - AddSocketData(data.Pass()); + AddSocketData(std::move(data)); } void AddAsyncQueryAndResponse(uint16_t id, @@ -403,7 +403,7 @@ class DnsTransactionTest : public testing::Test { uint16_t id = base::RandInt(0, std::numeric_limits<uint16_t>::max()); scoped_ptr<DnsSocketData> data( new DnsSocketData(id, dotted_name, qtype, ASYNC, false)); - AddSocketData(data.Pass()); + AddSocketData(std::move(data)); } // Add expected query of |dotted_name| and |qtype| and matching response with @@ -418,7 +418,7 @@ class DnsTransactionTest : public testing::Test { scoped_ptr<DnsSocketData> data( new DnsSocketData(id, dotted_name, qtype, mode, use_tcp)); data->AddRcode(rcode, mode); - AddSocketData(data.Pass()); + AddSocketData(std::move(data)); } void AddAsyncQueryAndRcode(const char* dotted_name, @@ -562,7 +562,7 @@ TEST_F(DnsTransactionTest, MismatchedResponseSync) { arraysize(kT1ResponseDatagram), SYNCHRONOUS); data->AddResponseData(kT0ResponseDatagram, arraysize(kT0ResponseDatagram), SYNCHRONOUS); - AddSocketData(data.Pass()); + AddSocketData(std::move(data)); TransactionHelper helper0(kT0HostName, kT0Qtype, kT0RecordCount); EXPECT_TRUE(helper0.RunUntilDone(transaction_factory_.get())); @@ -581,7 +581,7 @@ TEST_F(DnsTransactionTest, MismatchedResponseAsync) { arraysize(kT1ResponseDatagram), ASYNC); data->AddResponseData(kT0ResponseDatagram, arraysize(kT0ResponseDatagram), ASYNC); - AddSocketData(data.Pass()); + AddSocketData(std::move(data)); AddQueryAndTimeout(kT0HostName, kT0Qtype); TransactionHelper helper0(kT0HostName, kT0Qtype, kT0RecordCount); @@ -913,7 +913,7 @@ TEST_F(DnsTransactionTest, TCPMalformed) { new DnsResponse(reinterpret_cast<const char*>(kT0ResponseDatagram), arraysize(kT0ResponseDatagram), 0)), ASYNC, static_cast<uint16_t>(kT0QuerySize - 1)); - AddSocketData(data.Pass()); + AddSocketData(std::move(data)); TransactionHelper helper0(kT0HostName, kT0Qtype, ERR_DNS_MALFORMED_RESPONSE); EXPECT_TRUE(helper0.Run(transaction_factory_.get())); @@ -944,7 +944,7 @@ TEST_F(DnsTransactionTest, TCPReadReturnsZeroAsync) { ASYNC, static_cast<uint16_t>(arraysize(kT0ResponseDatagram))); // Then return a 0-length read. data->AddReadError(0, ASYNC); - AddSocketData(data.Pass()); + AddSocketData(std::move(data)); TransactionHelper helper0(kT0HostName, kT0Qtype, ERR_CONNECTION_CLOSED); EXPECT_TRUE(helper0.Run(transaction_factory_.get())); @@ -963,7 +963,7 @@ TEST_F(DnsTransactionTest, TCPReadReturnsZeroSynchronous) { SYNCHRONOUS, static_cast<uint16_t>(arraysize(kT0ResponseDatagram))); // Then return a 0-length read. data->AddReadError(0, SYNCHRONOUS); - AddSocketData(data.Pass()); + AddSocketData(std::move(data)); TransactionHelper helper0(kT0HostName, kT0Qtype, ERR_CONNECTION_CLOSED); EXPECT_TRUE(helper0.Run(transaction_factory_.get())); @@ -975,7 +975,7 @@ TEST_F(DnsTransactionTest, TCPConnectionClosedAsync) { scoped_ptr<DnsSocketData> data( new DnsSocketData(0 /* id */, kT0HostName, kT0Qtype, ASYNC, true)); data->AddReadError(ERR_CONNECTION_CLOSED, ASYNC); - AddSocketData(data.Pass()); + AddSocketData(std::move(data)); TransactionHelper helper0(kT0HostName, kT0Qtype, ERR_CONNECTION_CLOSED); EXPECT_TRUE(helper0.Run(transaction_factory_.get())); @@ -987,7 +987,7 @@ TEST_F(DnsTransactionTest, TCPConnectionClosedSynchronous) { scoped_ptr<DnsSocketData> data( new DnsSocketData(0 /* id */, kT0HostName, kT0Qtype, ASYNC, true)); data->AddReadError(ERR_CONNECTION_CLOSED, SYNCHRONOUS); - AddSocketData(data.Pass()); + AddSocketData(std::move(data)); TransactionHelper helper0(kT0HostName, kT0Qtype, ERR_CONNECTION_CLOSED); EXPECT_TRUE(helper0.Run(transaction_factory_.get())); diff --git a/net/dns/host_resolver_impl.cc b/net/dns/host_resolver_impl.cc index a4af057..119bfd2c 100644 --- a/net/dns/host_resolver_impl.cc +++ b/net/dns/host_resolver_impl.cc @@ -4,6 +4,8 @@ #include "net/dns/host_resolver_impl.h" +#include <utility> + #if defined(OS_WIN) #include <Winsock2.h> #elif defined(OS_POSIX) @@ -344,7 +346,7 @@ scoped_ptr<base::Value> NetLogProcTaskFailedCallback( #endif } - return dict.Pass(); + return std::move(dict); } // Creates NetLog parameters when the DnsTask failed. @@ -356,7 +358,7 @@ scoped_ptr<base::Value> NetLogDnsTaskFailedCallback( dict->SetInteger("net_error", net_error); if (dns_error) dict->SetInteger("dns_error", dns_error); - return dict.Pass(); + return std::move(dict); }; // Creates NetLog parameters containing the information in a RequestInfo object, @@ -371,7 +373,7 @@ scoped_ptr<base::Value> NetLogRequestInfoCallback( static_cast<int>(info->address_family())); dict->SetBoolean("allow_cached_response", info->allow_cached_response()); dict->SetBoolean("is_speculative", info->is_speculative()); - return dict.Pass(); + return std::move(dict); } // Creates NetLog parameters for the creation of a HostResolverImpl::Job. @@ -382,7 +384,7 @@ scoped_ptr<base::Value> NetLogJobCreationCallback( scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); source.AddToEventParameters(dict.get()); dict->SetString("host", *host); - return dict.Pass(); + return std::move(dict); } // Creates NetLog parameters for HOST_RESOLVER_IMPL_JOB_ATTACH/DETACH events. @@ -393,7 +395,7 @@ scoped_ptr<base::Value> NetLogJobAttachCallback( scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); source.AddToEventParameters(dict.get()); dict->SetString("priority", RequestPriorityToString(priority)); - return dict.Pass(); + return std::move(dict); } // Creates NetLog parameters for the DNS_CONFIG_CHANGED event. @@ -410,7 +412,7 @@ scoped_ptr<base::Value> NetLogIPv6AvailableCallback( scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); dict->SetBoolean("ipv6_available", ipv6_available); dict->SetBoolean("cached", cached); - return dict.Pass(); + return std::move(dict); } // The logging routines are defined here because some requests are resolved @@ -1337,7 +1339,7 @@ class HostResolverImpl::Job : public PrioritizedDispatcher::Job, proc_task_->set_had_non_speculative_request(); } - requests_.push_back(req.Pass()); + requests_.push_back(std::move(req)); UpdatePriority(); } @@ -1955,7 +1957,7 @@ int HostResolverImpl::Resolve(const RequestInfo& info, if (out_req) *out_req = reinterpret_cast<RequestHandle>(req.get()); - job->AddRequest(req.Pass()); + job->AddRequest(std::move(req)); // Completion happens during Job::CompleteRequests(). return ERR_IO_PENDING; } @@ -2418,7 +2420,7 @@ void HostResolverImpl::OnDnsTaskResolve(int net_error) { void HostResolverImpl::SetDnsClient(scoped_ptr<DnsClient> dns_client) { // DnsClient and config must be updated before aborting DnsTasks, since doing // so may start new jobs. - dns_client_ = dns_client.Pass(); + dns_client_ = std::move(dns_client); if (dns_client_ && !dns_client_->GetConfig() && num_dns_failures_ < kMaximumDnsFailures) { DnsConfig dns_config; diff --git a/net/dns/host_resolver_mojo.cc b/net/dns/host_resolver_mojo.cc index ed9c374..1daf633 100644 --- a/net/dns/host_resolver_mojo.cc +++ b/net/dns/host_resolver_mojo.cc @@ -4,6 +4,8 @@ #include "net/dns/host_resolver_mojo.h" +#include <utility> + #include "mojo/public/cpp/bindings/binding.h" #include "net/base/address_list.h" #include "net/base/net_errors.h" @@ -78,7 +80,7 @@ int HostResolverMojo::Resolve(const RequestInfo& info, *request_handle = new Job(key, addresses, callback, mojo::GetProxy(&handle), host_cache_weak_factory_.GetWeakPtr()); impl_->ResolveDns(interfaces::HostResolverRequestInfo::From(info), - handle.Pass()); + std::move(handle)); return ERR_IO_PENDING; } @@ -125,7 +127,7 @@ HostResolverMojo::Job::Job( : key_(key), addresses_(addresses), callback_(callback), - binding_(this, request.Pass()), + binding_(this, std::move(request)), host_cache_(host_cache) { binding_.set_connection_error_handler(base::Bind( &HostResolverMojo::Job::OnConnectionError, base::Unretained(this))); diff --git a/net/dns/host_resolver_mojo_unittest.cc b/net/dns/host_resolver_mojo_unittest.cc index 8160e99..c5f3ba9 100644 --- a/net/dns/host_resolver_mojo_unittest.cc +++ b/net/dns/host_resolver_mojo_unittest.cc @@ -5,6 +5,7 @@ #include "net/dns/host_resolver_mojo.h" #include <string> +#include <utility> #include "mojo/public/cpp/bindings/binding.h" #include "net/base/address_list.h" @@ -36,7 +37,7 @@ class MockMojoHostResolverRequest { MockMojoHostResolverRequest::MockMojoHostResolverRequest( interfaces::HostResolverRequestClientPtr client, const base::Closure& error_callback) - : client_(client.Pass()), error_callback_(error_callback) { + : client_(std::move(client)), error_callback_(error_callback) { client_.set_connection_error_handler(base::Bind( &MockMojoHostResolverRequest::OnConnectionError, base::Unretained(this))); } @@ -55,26 +56,26 @@ struct HostResolverAction { static scoped_ptr<HostResolverAction> ReturnError(Error error) { scoped_ptr<HostResolverAction> result(new HostResolverAction); result->error = error; - return result.Pass(); + return result; } static scoped_ptr<HostResolverAction> ReturnResult( const AddressList& address_list) { scoped_ptr<HostResolverAction> result(new HostResolverAction); result->addresses = interfaces::AddressList::From(address_list); - return result.Pass(); + return result; } static scoped_ptr<HostResolverAction> DropRequest() { scoped_ptr<HostResolverAction> result(new HostResolverAction); result->action = DROP; - return result.Pass(); + return result; } static scoped_ptr<HostResolverAction> RetainRequest() { scoped_ptr<HostResolverAction> result(new HostResolverAction); result->action = RETAIN; - return result.Pass(); + return result; } Action action = COMPLETE; @@ -115,22 +116,22 @@ MockMojoHostResolver::~MockMojoHostResolver() { } void MockMojoHostResolver::AddAction(scoped_ptr<HostResolverAction> action) { - actions_.push_back(action.Pass()); + actions_.push_back(std::move(action)); } void MockMojoHostResolver::ResolveDns( interfaces::HostResolverRequestInfoPtr request_info, interfaces::HostResolverRequestClientPtr client) { - requests_received_.push_back(request_info.Pass()); + requests_received_.push_back(std::move(request_info)); ASSERT_LE(results_returned_, actions_.size()); switch (actions_[results_returned_]->action) { case HostResolverAction::COMPLETE: client->ReportResult(actions_[results_returned_]->error, - actions_[results_returned_]->addresses.Pass()); + std::move(actions_[results_returned_]->addresses)); break; case HostResolverAction::RETAIN: requests_.push_back(make_scoped_ptr(new MockMojoHostResolverRequest( - client.Pass(), request_connection_error_callback_))); + std::move(client), request_connection_error_callback_))); break; case HostResolverAction::DROP: client.reset(); diff --git a/net/dns/mapped_host_resolver.cc b/net/dns/mapped_host_resolver.cc index fedc05f..1511db4 100644 --- a/net/dns/mapped_host_resolver.cc +++ b/net/dns/mapped_host_resolver.cc @@ -4,6 +4,8 @@ #include "net/dns/mapped_host_resolver.h" +#include <utility> + #include "base/strings/string_util.h" #include "net/base/host_port_pair.h" #include "net/base/net_errors.h" @@ -12,8 +14,7 @@ namespace net { MappedHostResolver::MappedHostResolver(scoped_ptr<HostResolver> impl) - : impl_(impl.Pass()) { -} + : impl_(std::move(impl)) {} MappedHostResolver::~MappedHostResolver() { } diff --git a/net/dns/mapped_host_resolver_unittest.cc b/net/dns/mapped_host_resolver_unittest.cc index 5218e2a..002a988 100644 --- a/net/dns/mapped_host_resolver_unittest.cc +++ b/net/dns/mapped_host_resolver_unittest.cc @@ -4,6 +4,8 @@ #include "net/dns/mapped_host_resolver.h" +#include <utility> + #include "net/base/address_list.h" #include "net/base/net_errors.h" #include "net/base/net_util.h" @@ -32,7 +34,7 @@ TEST(MappedHostResolverTest, Inclusion) { // Create a remapped resolver that uses |resolver_impl|. scoped_ptr<MappedHostResolver> resolver( - new MappedHostResolver(resolver_impl.Pass())); + new MappedHostResolver(std::move(resolver_impl))); int rv; AddressList address_list; @@ -106,7 +108,7 @@ TEST(MappedHostResolverTest, Exclusion) { // Create a remapped resolver that uses |resolver_impl|. scoped_ptr<MappedHostResolver> resolver( - new MappedHostResolver(resolver_impl.Pass())); + new MappedHostResolver(std::move(resolver_impl))); int rv; AddressList address_list; @@ -153,7 +155,7 @@ TEST(MappedHostResolverTest, SetRulesFromString) { // Create a remapped resolver that uses |resolver_impl|. scoped_ptr<MappedHostResolver> resolver( - new MappedHostResolver(resolver_impl.Pass())); + new MappedHostResolver(std::move(resolver_impl))); int rv; AddressList address_list; @@ -210,7 +212,7 @@ TEST(MappedHostResolverTest, MapToError) { resolver_impl->rules()->AddRule("*", "192.168.1.5"); scoped_ptr<MappedHostResolver> resolver( - new MappedHostResolver(resolver_impl.Pass())); + new MappedHostResolver(std::move(resolver_impl))); int rv; AddressList address_list; diff --git a/net/dns/mdns_cache_unittest.cc b/net/dns/mdns_cache_unittest.cc index 8e6bd4a..0659e4f 100644 --- a/net/dns/mdns_cache_unittest.cc +++ b/net/dns/mdns_cache_unittest.cc @@ -2,12 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "net/dns/mdns_cache.h" + #include <algorithm> +#include <utility> #include "base/bind.h" #include "net/dns/dns_response.h" #include "net/dns/dns_test_util.h" -#include "net/dns/mdns_cache.h" #include "net/dns/record_parsed.h" #include "net/dns/record_rdata.h" #include "testing/gmock/include/gmock/gmock.h" @@ -127,9 +129,9 @@ TEST_F(MDnsCacheTest, InsertLookupSingle) { record1 = RecordParsed::CreateFrom(&parser, default_time_); record2 = RecordParsed::CreateFrom(&parser, default_time_); - EXPECT_EQ(MDnsCache::RecordAdded, cache_.UpdateDnsRecord(record1.Pass())); + EXPECT_EQ(MDnsCache::RecordAdded, cache_.UpdateDnsRecord(std::move(record1))); - EXPECT_EQ(MDnsCache::RecordAdded, cache_.UpdateDnsRecord(record2.Pass())); + EXPECT_EQ(MDnsCache::RecordAdded, cache_.UpdateDnsRecord(std::move(record2))); cache_.FindDnsRecords(ARecordRdata::kType, "ghs.l.google.com", &results, default_time_); @@ -164,8 +166,8 @@ TEST_F(MDnsCacheTest, Expiration) { base::TimeDelta ttl2 = base::TimeDelta::FromSeconds(record2->ttl()); record_to_be_deleted = record2.get(); - EXPECT_EQ(MDnsCache::RecordAdded, cache_.UpdateDnsRecord(record1.Pass())); - EXPECT_EQ(MDnsCache::RecordAdded, cache_.UpdateDnsRecord(record2.Pass())); + EXPECT_EQ(MDnsCache::RecordAdded, cache_.UpdateDnsRecord(std::move(record1))); + EXPECT_EQ(MDnsCache::RecordAdded, cache_.UpdateDnsRecord(std::move(record2))); cache_.FindDnsRecords(ARecordRdata::kType, "ghs.l.google.com", &results, default_time_); @@ -209,9 +211,9 @@ TEST_F(MDnsCacheTest, RecordChange) { record1 = RecordParsed::CreateFrom(&parser, default_time_); record2 = RecordParsed::CreateFrom(&parser, default_time_); - EXPECT_EQ(MDnsCache::RecordAdded, cache_.UpdateDnsRecord(record1.Pass())); + EXPECT_EQ(MDnsCache::RecordAdded, cache_.UpdateDnsRecord(std::move(record1))); EXPECT_EQ(MDnsCache::RecordChanged, - cache_.UpdateDnsRecord(record2.Pass())); + cache_.UpdateDnsRecord(std::move(record2))); } // Test that a new record replacing an otherwise identical one already in the @@ -229,8 +231,8 @@ TEST_F(MDnsCacheTest, RecordNoChange) { record2 = RecordParsed::CreateFrom(&parser, default_time_ + base::TimeDelta::FromSeconds(1)); - EXPECT_EQ(MDnsCache::RecordAdded, cache_.UpdateDnsRecord(record1.Pass())); - EXPECT_EQ(MDnsCache::NoChange, cache_.UpdateDnsRecord(record2.Pass())); + EXPECT_EQ(MDnsCache::RecordAdded, cache_.UpdateDnsRecord(std::move(record1))); + EXPECT_EQ(MDnsCache::NoChange, cache_.UpdateDnsRecord(std::move(record2))); } // Test that the next expiration time of the cache is updated properly on record @@ -250,9 +252,9 @@ TEST_F(MDnsCacheTest, RecordPreemptExpirationTime) { base::TimeDelta ttl2 = base::TimeDelta::FromSeconds(record2->ttl()); EXPECT_EQ(base::Time(), cache_.next_expiration()); - EXPECT_EQ(MDnsCache::RecordAdded, cache_.UpdateDnsRecord(record2.Pass())); + EXPECT_EQ(MDnsCache::RecordAdded, cache_.UpdateDnsRecord(std::move(record2))); EXPECT_EQ(default_time_ + ttl2, cache_.next_expiration()); - EXPECT_EQ(MDnsCache::NoChange, cache_.UpdateDnsRecord(record1.Pass())); + EXPECT_EQ(MDnsCache::NoChange, cache_.UpdateDnsRecord(std::move(record1))); EXPECT_EQ(default_time_ + ttl1, cache_.next_expiration()); } @@ -279,13 +281,14 @@ TEST_F(MDnsCacheTest, GoodbyePacket) { base::TimeDelta ttl = base::TimeDelta::FromSeconds(record_hello->ttl()); EXPECT_EQ(base::Time(), cache_.next_expiration()); - EXPECT_EQ(MDnsCache::NoChange, cache_.UpdateDnsRecord(record_goodbye.Pass())); + EXPECT_EQ(MDnsCache::NoChange, + cache_.UpdateDnsRecord(std::move(record_goodbye))); EXPECT_EQ(base::Time(), cache_.next_expiration()); EXPECT_EQ(MDnsCache::RecordAdded, - cache_.UpdateDnsRecord(record_hello.Pass())); + cache_.UpdateDnsRecord(std::move(record_hello))); EXPECT_EQ(default_time_ + ttl, cache_.next_expiration()); EXPECT_EQ(MDnsCache::NoChange, - cache_.UpdateDnsRecord(record_goodbye2.Pass())); + cache_.UpdateDnsRecord(std::move(record_goodbye2))); EXPECT_EQ(default_time_ + base::TimeDelta::FromSeconds(1), cache_.next_expiration()); } @@ -301,8 +304,8 @@ TEST_F(MDnsCacheTest, AnyRRType) { record1 = RecordParsed::CreateFrom(&parser, default_time_); record2 = RecordParsed::CreateFrom(&parser, default_time_); - EXPECT_EQ(MDnsCache::RecordAdded, cache_.UpdateDnsRecord(record1.Pass())); - EXPECT_EQ(MDnsCache::RecordAdded, cache_.UpdateDnsRecord(record2.Pass())); + EXPECT_EQ(MDnsCache::RecordAdded, cache_.UpdateDnsRecord(std::move(record1))); + EXPECT_EQ(MDnsCache::RecordAdded, cache_.UpdateDnsRecord(std::move(record2))); cache_.FindDnsRecords(0, "ghs.l.google.com", &results, default_time_); @@ -326,7 +329,7 @@ TEST_F(MDnsCacheTest, RemoveRecord) { std::vector<const RecordParsed*> results; record1 = RecordParsed::CreateFrom(&parser, default_time_); - EXPECT_EQ(MDnsCache::RecordAdded, cache_.UpdateDnsRecord(record1.Pass())); + EXPECT_EQ(MDnsCache::RecordAdded, cache_.UpdateDnsRecord(std::move(record1))); cache_.FindDnsRecords(dns_protocol::kTypeCNAME, "codereview.chromium.org", &results, default_time_); diff --git a/net/dns/mdns_client.cc b/net/dns/mdns_client.cc index f2b3f03..8b4e037 100644 --- a/net/dns/mdns_client.cc +++ b/net/dns/mdns_client.cc @@ -98,7 +98,7 @@ scoped_ptr<DatagramServerSocket> CreateAndBindMDnsSocket( VLOG(1) << "Bind failed, endpoint=" << multicast_addr.ToStringWithoutPort() << ", error=" << rv; } - return socket.Pass(); + return socket; } } // namespace net diff --git a/net/dns/mdns_client_impl.cc b/net/dns/mdns_client_impl.cc index 9782ddd..cb717fc 100644 --- a/net/dns/mdns_client_impl.cc +++ b/net/dns/mdns_client_impl.cc @@ -6,6 +6,7 @@ #include <algorithm> #include <queue> +#include <utility> #include "base/bind.h" #include "base/location.h" @@ -52,18 +53,17 @@ void MDnsSocketFactoryImpl::CreateSockets( scoped_ptr<DatagramServerSocket> socket( CreateAndBindMDnsSocket(interfaces[i].second, interfaces[i].first)); if (socket) - sockets->push_back(socket.Pass()); + sockets->push_back(std::move(socket)); } } MDnsConnection::SocketHandler::SocketHandler( scoped_ptr<DatagramServerSocket> socket, MDnsConnection* connection) - : socket_(socket.Pass()), + : socket_(std::move(socket)), connection_(connection), response_(dns_protocol::kMaxMulticastSize), - send_in_progress_(false) { -} + send_in_progress_(false) {} MDnsConnection::SocketHandler::~SocketHandler() { } @@ -271,7 +271,7 @@ void MDnsClientImpl::Core::HandlePacket(DnsResponse* response, } MDnsCache::Key update_key = MDnsCache::Key::CreateFor(record.get()); - MDnsCache::UpdateType update = cache_.UpdateDnsRecord(record.Pass()); + MDnsCache::UpdateType update = cache_.UpdateDnsRecord(std::move(record)); // Cleanup time may have changed. ScheduleCleanup(cache_.next_expiration()); @@ -434,8 +434,7 @@ MDnsClientImpl::MDnsClientImpl() MDnsClientImpl::MDnsClientImpl(scoped_ptr<base::Clock> clock, scoped_ptr<base::Timer> timer) - : clock_(clock.Pass()), cleanup_timer_(timer.Pass()) { -} + : clock_(std::move(clock)), cleanup_timer_(std::move(timer)) {} MDnsClientImpl::~MDnsClientImpl() { } diff --git a/net/dns/mock_mdns_socket_factory.cc b/net/dns/mock_mdns_socket_factory.cc index 354992b..ae46d2f 100644 --- a/net/dns/mock_mdns_socket_factory.cc +++ b/net/dns/mock_mdns_socket_factory.cc @@ -2,13 +2,15 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "net/dns/mock_mdns_socket_factory.h" + #include <algorithm> +#include <utility> #include "base/location.h" #include "base/single_thread_task_runner.h" #include "base/thread_task_runner_handle.h" #include "net/base/net_errors.h" -#include "net/dns/mock_mdns_socket_factory.h" using testing::_; using testing::Invoke; @@ -86,7 +88,7 @@ void MockMDnsSocketFactory::CreateSocket( this, &MockMDnsSocketFactory::RecvFromInternal)); - sockets->push_back(new_socket.Pass()); + sockets->push_back(std::move(new_socket)); } void MockMDnsSocketFactory::SimulateReceive(const uint8_t* packet, int size) { diff --git a/net/dns/mojo_host_resolver_impl.cc b/net/dns/mojo_host_resolver_impl.cc index ac2fe8bc..bf49c99f 100644 --- a/net/dns/mojo_host_resolver_impl.cc +++ b/net/dns/mojo_host_resolver_impl.cc @@ -4,6 +4,8 @@ #include "net/dns/mojo_host_resolver_impl.h" +#include <utility> + #include "base/stl_util.h" #include "net/base/address_list.h" #include "net/base/net_errors.h" @@ -59,7 +61,7 @@ void MojoHostResolverImpl::Resolve( DCHECK(thread_checker_.CalledOnValidThread()); Job* job = new Job(this, resolver_, request_info->To<net::HostResolver::RequestInfo>(), - net_log_, client.Pass()); + net_log_, std::move(client)); pending_jobs_.insert(job); job->Start(); } @@ -81,7 +83,7 @@ MojoHostResolverImpl::Job::Job( resolver_(resolver), request_info_(request_info), net_log_(net_log), - client_(client.Pass()), + client_(std::move(client)), handle_(nullptr) { client_.set_connection_error_handler(base::Bind( &MojoHostResolverImpl::Job::OnConnectionError, base::Unretained(this))); diff --git a/net/dns/mojo_host_resolver_impl_unittest.cc b/net/dns/mojo_host_resolver_impl_unittest.cc index 130462c..3bf3275 100644 --- a/net/dns/mojo_host_resolver_impl_unittest.cc +++ b/net/dns/mojo_host_resolver_impl_unittest.cc @@ -5,6 +5,7 @@ #include "net/dns/mojo_host_resolver_impl.h" #include <string> +#include <utility> #include "base/memory/scoped_ptr.h" #include "base/run_loop.h" @@ -27,7 +28,7 @@ class TestRequestClient : public interfaces::HostResolverRequestClient { public: explicit TestRequestClient( mojo::InterfaceRequest<interfaces::HostResolverRequestClient> req) - : done_(false), binding_(this, req.Pass()) { + : done_(false), binding_(this, std::move(req)) { binding_.set_connection_error_handler(base::Bind( &TestRequestClient::OnConnectionError, base::Unretained(this))); } @@ -75,7 +76,7 @@ void TestRequestClient::ReportResult(int32_t error, } ASSERT_FALSE(done_); error_ = error; - results_ = results.Pass(); + results_ = std::move(results); done_ = true; } @@ -144,7 +145,7 @@ class MojoHostResolverImplTest : public testing::Test { request->port = port; request->address_family = interfaces::ADDRESS_FAMILY_IPV4; request->is_my_ip_address = is_my_ip_address; - return request.Pass(); + return request; } // Wait until the mock resolver has received |num| resolve requests. @@ -166,7 +167,7 @@ TEST_F(MojoHostResolverImplTest, Resolve) { interfaces::HostResolverRequestInfoPtr request = CreateRequest("example.com", 80, false); - resolver_service_->Resolve(request.Pass(), client_ptr.Pass()); + resolver_service_->Resolve(std::move(request), std::move(client_ptr)); client.WaitForResult(); EXPECT_EQ(net::OK, client.error_); @@ -183,7 +184,7 @@ TEST_F(MojoHostResolverImplTest, ResolveSynchronous) { interfaces::HostResolverRequestInfoPtr request = CreateRequest("example.com", 80, false); - resolver_service_->Resolve(request.Pass(), client_ptr.Pass()); + resolver_service_->Resolve(std::move(request), std::move(client_ptr)); client.WaitForResult(); EXPECT_EQ(net::OK, client.error_); @@ -202,10 +203,10 @@ TEST_F(MojoHostResolverImplTest, ResolveMultiple) { interfaces::HostResolverRequestInfoPtr request1 = CreateRequest("example.com", 80, false); - resolver_service_->Resolve(request1.Pass(), client1_ptr.Pass()); + resolver_service_->Resolve(std::move(request1), std::move(client1_ptr)); interfaces::HostResolverRequestInfoPtr request2 = CreateRequest("chromium.org", 80, false); - resolver_service_->Resolve(request2.Pass(), client2_ptr.Pass()); + resolver_service_->Resolve(std::move(request2), std::move(client2_ptr)); WaitForRequests(2); mock_host_resolver_.ResolveAllPending(); @@ -232,10 +233,10 @@ TEST_F(MojoHostResolverImplTest, ResolveDuplicate) { interfaces::HostResolverRequestInfoPtr request1 = CreateRequest("example.com", 80, false); - resolver_service_->Resolve(request1.Pass(), client1_ptr.Pass()); + resolver_service_->Resolve(std::move(request1), std::move(client1_ptr)); interfaces::HostResolverRequestInfoPtr request2 = CreateRequest("example.com", 80, false); - resolver_service_->Resolve(request2.Pass(), client2_ptr.Pass()); + resolver_service_->Resolve(std::move(request2), std::move(client2_ptr)); WaitForRequests(2); mock_host_resolver_.ResolveAllPending(); @@ -258,7 +259,7 @@ TEST_F(MojoHostResolverImplTest, ResolveFailure) { interfaces::HostResolverRequestInfoPtr request = CreateRequest("failure.fail", 80, false); - resolver_service_->Resolve(request.Pass(), client_ptr.Pass()); + resolver_service_->Resolve(std::move(request), std::move(client_ptr)); client.WaitForResult(); EXPECT_EQ(net::ERR_NAME_NOT_RESOLVED, client.error_); @@ -274,7 +275,7 @@ TEST_F(MojoHostResolverImplTest, DestroyClient) { interfaces::HostResolverRequestInfoPtr request = CreateRequest("example.com", 80, false); - resolver_service_->Resolve(request.Pass(), client_ptr.Pass()); + resolver_service_->Resolve(std::move(request), std::move(client_ptr)); WaitForRequests(1); client.reset(); diff --git a/net/dns/mojo_host_type_converters.cc b/net/dns/mojo_host_type_converters.cc index 253d8c9..07dfe4d 100644 --- a/net/dns/mojo_host_type_converters.cc +++ b/net/dns/mojo_host_type_converters.cc @@ -4,6 +4,8 @@ #include "net/dns/mojo_host_type_converters.h" +#include <utility> + #include "mojo/public/cpp/bindings/type_converter.h" #include "net/base/address_list.h" #include "net/base/net_util.h" @@ -64,7 +66,7 @@ TypeConverter<net::interfaces::HostResolverRequestInfoPtr, result->port = obj.port(); result->address_family = net::AddressFamilyToMojo(obj.address_family()); result->is_my_ip_address = obj.is_my_ip_address(); - return result.Pass(); + return result; } // static @@ -76,9 +78,9 @@ TypeConverter<net::interfaces::AddressListPtr, net::AddressList>::Convert( net::interfaces::IPEndPointPtr ep(net::interfaces::IPEndPoint::New()); ep->port = endpoint.port(); ep->address = mojo::Array<uint8_t>::From(endpoint.address()); - result->addresses.push_back(ep.Pass()); + result->addresses.push_back(std::move(ep)); } - return result.Pass(); + return result; } // static diff --git a/net/dns/record_parsed.cc b/net/dns/record_parsed.cc index a5fcf19..c5a72ef 100644 --- a/net/dns/record_parsed.cc +++ b/net/dns/record_parsed.cc @@ -4,6 +4,8 @@ #include "net/dns/record_parsed.h" +#include <utility> + #include "base/logging.h" #include "net/dns/dns_response.h" #include "net/dns/record_rdata.h" @@ -20,7 +22,7 @@ RecordParsed::RecordParsed(const std::string& name, type_(type), klass_(klass), ttl_(ttl), - rdata_(rdata.Pass()), + rdata_(std::move(rdata)), time_created_(time_created) {} RecordParsed::~RecordParsed() { @@ -66,12 +68,9 @@ scoped_ptr<const RecordParsed> RecordParsed::CreateFrom( if (!rdata.get()) return scoped_ptr<const RecordParsed>(); - return scoped_ptr<const RecordParsed>(new RecordParsed(record.name, - record.type, - record.klass, - record.ttl, - rdata.Pass(), - time_created)); + return scoped_ptr<const RecordParsed>( + new RecordParsed(record.name, record.type, record.klass, record.ttl, + std::move(rdata), time_created)); } bool RecordParsed::IsEqual(const RecordParsed* other, bool is_mdns) const { diff --git a/net/dns/record_rdata.cc b/net/dns/record_rdata.cc index fbe7c65..2213473 100644 --- a/net/dns/record_rdata.cc +++ b/net/dns/record_rdata.cc @@ -39,7 +39,7 @@ scoped_ptr<SrvRecordRdata> SrvRecordRdata::Create( &rdata->target_)) return scoped_ptr<SrvRecordRdata>(); - return rdata.Pass(); + return rdata; } uint16_t SrvRecordRdata::Type() const { @@ -75,7 +75,7 @@ scoped_ptr<ARecordRdata> ARecordRdata::Create( rdata->address_[i] = data[i]; } - return rdata.Pass(); + return rdata; } uint16_t ARecordRdata::Type() const { @@ -108,7 +108,7 @@ scoped_ptr<AAAARecordRdata> AAAARecordRdata::Create( rdata->address_[i] = data[i]; } - return rdata.Pass(); + return rdata; } uint16_t AAAARecordRdata::Type() const { @@ -136,7 +136,7 @@ scoped_ptr<CnameRecordRdata> CnameRecordRdata::Create( if (!parser.ReadName(data.begin(), &rdata->cname_)) return scoped_ptr<CnameRecordRdata>(); - return rdata.Pass(); + return rdata; } uint16_t CnameRecordRdata::Type() const { @@ -165,7 +165,7 @@ scoped_ptr<PtrRecordRdata> PtrRecordRdata::Create( if (!parser.ReadName(data.begin(), &rdata->ptrdomain_)) return scoped_ptr<PtrRecordRdata>(); - return rdata.Pass(); + return rdata; } uint16_t PtrRecordRdata::Type() const { @@ -202,7 +202,7 @@ scoped_ptr<TxtRecordRdata> TxtRecordRdata::Create( i += length + 1; } - return rdata.Pass(); + return rdata; } uint16_t TxtRecordRdata::Type() const { @@ -260,7 +260,7 @@ scoped_ptr<NsecRecordRdata> NsecRecordRdata::Create( bitmap_data.begin(), bitmap_data.end()); - return rdata.Pass(); + return rdata; } uint16_t NsecRecordRdata::Type() const { diff --git a/net/extras/sqlite/sqlite_channel_id_store.cc b/net/extras/sqlite/sqlite_channel_id_store.cc index 5001494..5b8b351 100644 --- a/net/extras/sqlite/sqlite_channel_id_store.cc +++ b/net/extras/sqlite/sqlite_channel_id_store.cc @@ -5,6 +5,7 @@ #include "net/extras/sqlite/sqlite_channel_id_store.h" #include <set> +#include <utility> #include <vector> #include "base/bind.h" @@ -230,7 +231,7 @@ void SQLiteChannelIDStore::Backend::LoadInBackground( scoped_ptr<DefaultChannelIDStore::ChannelID> channel_id( new DefaultChannelIDStore::ChannelID( smt.ColumnString(0), // host - base::Time::FromInternalValue(smt.ColumnInt64(3)), key.Pass())); + base::Time::FromInternalValue(smt.ColumnInt64(3)), std::move(key))); channel_ids->push_back(std::move(channel_id)); } diff --git a/net/filter/filter_unittest.cc b/net/filter/filter_unittest.cc index c44f23b..d10fadc 100644 --- a/net/filter/filter_unittest.cc +++ b/net/filter/filter_unittest.cc @@ -2,9 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "net/filter/filter.h" + +#include <utility> + #include "base/macros.h" #include "net/base/io_buffer.h" -#include "net/filter/filter.h" #include "net/filter/mock_filter_context.h" #include "testing/gtest/include/gtest/gtest.h" @@ -55,7 +58,7 @@ TEST(FilterTest, SdchEncoding) { MockFilterContext filter_context; // Empty handle indicates to filter that SDCH is active. filter_context.SetSdchResponse( - SdchManager::CreateEmptyDictionarySetForTesting().Pass()); + SdchManager::CreateEmptyDictionarySetForTesting()); std::vector<Filter::FilterType> encoding_types; @@ -93,7 +96,7 @@ TEST(FilterTest, MissingSdchEncoding) { const std::string kTextHtmlMime("text/html"); MockFilterContext filter_context; filter_context.SetSdchResponse( - SdchManager::CreateEmptyDictionarySetForTesting().Pass()); + SdchManager::CreateEmptyDictionarySetForTesting()); std::vector<Filter::FilterType> encoding_types; @@ -154,8 +157,8 @@ TEST(FilterTest, ThreeFilterChain) { filter2->InitBuffer(32 * 1024); filter3->InitBuffer(32 * 1024); - filter2->next_filter_ = filter3.Pass(); - filter1->next_filter_ = filter2.Pass(); + filter2->next_filter_ = std::move(filter3); + filter1->next_filter_ = std::move(filter2); // Initialize the input array with a varying byte sequence. const size_t input_array_size = 64 * 1024; diff --git a/net/filter/mock_filter_context.h b/net/filter/mock_filter_context.h index 6646cfd..50858c4 100644 --- a/net/filter/mock_filter_context.h +++ b/net/filter/mock_filter_context.h @@ -6,8 +6,8 @@ #define NET_FILTER_MOCK_FILTER_CONTEXT_H_ #include <stdint.h> - #include <string> +#include <utility> #include "base/macros.h" #include "base/memory/scoped_ptr.h" @@ -31,7 +31,7 @@ class MockFilterContext : public FilterContext { void SetCached(bool is_cached) { is_cached_content_ = is_cached; } void SetResponseCode(int response_code) { response_code_ = response_code; } void SetSdchResponse(scoped_ptr<SdchManager::DictionarySet> handle) { - dictionaries_handle_ = handle.Pass(); + dictionaries_handle_ = std::move(handle); } URLRequestContext* GetModifiableURLRequestContext() const { return context_.get(); diff --git a/net/filter/sdch_filter.cc b/net/filter/sdch_filter.cc index 31df388..67b4b10 100644 --- a/net/filter/sdch_filter.cc +++ b/net/filter/sdch_filter.cc @@ -6,8 +6,8 @@ #include <ctype.h> #include <limits.h> - #include <algorithm> +#include <utility> #include "base/logging.h" #include "base/metrics/histogram_macros.h" @@ -16,7 +16,6 @@ #include "net/base/sdch_net_log_params.h" #include "net/base/sdch_problem_codes.h" #include "net/url_request/url_request_context.h" - #include "sdch/open-vcdiff/src/google/vcdecoder.h" namespace net { @@ -97,7 +96,7 @@ scoped_ptr<base::Value> NetLogSdchResponseCorruptionDetectionCallback( scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); dict->SetString("cause", ResponseCorruptionDetectionCauseToString(cause)); dict->SetBoolean("cached", cached); - return dict.Pass(); + return std::move(dict); } } // namespace diff --git a/net/filter/sdch_filter_unittest.cc b/net/filter/sdch_filter_unittest.cc index 35c7ecc..cbb85a8 100644 --- a/net/filter/sdch_filter_unittest.cc +++ b/net/filter/sdch_filter_unittest.cc @@ -82,8 +82,7 @@ class SdchFilterTest : public testing::Test { // Sets both the GURL and the SDCH response for a filter context. void SetupFilterContextWithGURL(GURL url) { filter_context_->SetURL(url); - filter_context_->SetSdchResponse( - sdch_manager_->GetDictionarySet(url).Pass()); + filter_context_->SetSdchResponse(sdch_manager_->GetDictionarySet(url)); } std::string NewSdchCompressedData(const std::string& dictionary) { @@ -1214,8 +1213,7 @@ TEST_F(SdchFilterTest, UnexpectedDictionary) { SdchProblemCode problem_code; scoped_ptr<SdchManager::DictionarySet> hash_set( - sdch_manager_->GetDictionarySetByHash( - url, server_hash, &problem_code).Pass()); + sdch_manager_->GetDictionarySetByHash(url, server_hash, &problem_code)); ASSERT_TRUE(hash_set); ASSERT_EQ(SDCH_OK, problem_code); diff --git a/net/ftp/ftp_ctrl_response_buffer.cc b/net/ftp/ftp_ctrl_response_buffer.cc index b3f2d23..064068e 100644 --- a/net/ftp/ftp_ctrl_response_buffer.cc +++ b/net/ftp/ftp_ctrl_response_buffer.cc @@ -4,6 +4,8 @@ #include "net/ftp/ftp_ctrl_response_buffer.h" +#include <utility> + #include "base/bind.h" #include "base/logging.h" #include "base/strings/string_number_conversions.h" @@ -87,8 +89,8 @@ scoped_ptr<base::Value> NetLogFtpCtrlResponseCallback( scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); dict->SetInteger("status_code", response->status_code); - dict->Set("lines", lines.Pass()); - return dict.Pass(); + dict->Set("lines", std::move(lines)); + return std::move(dict); } } // namespace diff --git a/net/http/http_auth_handler_negotiate.h b/net/http/http_auth_handler_negotiate.h index ffe51bb..1d74431 100644 --- a/net/http/http_auth_handler_negotiate.h +++ b/net/http/http_auth_handler_negotiate.h @@ -6,6 +6,7 @@ #define NET_HTTP_HTTP_AUTH_HANDLER_NEGOTIATE_H_ #include <string> +#include <utility> #include "build/build_config.h" #include "net/base/address_list.h" @@ -55,7 +56,7 @@ class NET_EXPORT_PRIVATE HttpAuthHandlerNegotiate : public HttpAuthHandler { // Sets the system library to use, thereby assuming ownership of // |auth_library|. void set_library(scoped_ptr<AuthLibrary> auth_provider) { - auth_library_ = auth_provider.Pass(); + auth_library_ = std::move(auth_provider); } #endif diff --git a/net/http/http_basic_state.cc b/net/http/http_basic_state.cc index 6c1f5a9..b6e04df 100644 --- a/net/http/http_basic_state.cc +++ b/net/http/http_basic_state.cc @@ -4,6 +4,8 @@ #include "net/http/http_basic_state.h" +#include <utility> + #include "base/logging.h" #include "net/base/io_buffer.h" #include "net/http/http_request_info.h" @@ -35,7 +37,7 @@ int HttpBasicState::Initialize(const HttpRequestInfo* request_info, } scoped_ptr<ClientSocketHandle> HttpBasicState::ReleaseConnection() { - return connection_.Pass(); + return std::move(connection_); } scoped_refptr<GrowableIOBuffer> HttpBasicState::read_buf() const { diff --git a/net/http/http_cache.cc b/net/http/http_cache.cc index ae49d56..ae678fd 100644 --- a/net/http/http_cache.cc +++ b/net/http/http_cache.cc @@ -5,6 +5,7 @@ #include "net/http/http_cache.h" #include <algorithm> +#include <utility> #include "base/bind.h" #include "base/bind_helpers.h" @@ -301,19 +302,19 @@ HttpCache::HttpCache(HttpNetworkSession* session, scoped_ptr<BackendFactory> backend_factory, bool set_up_quic_server_info) : HttpCache(make_scoped_ptr(new HttpNetworkLayer(session)), - backend_factory.Pass(), + std::move(backend_factory), set_up_quic_server_info) {} HttpCache::HttpCache(scoped_ptr<HttpTransactionFactory> network_layer, scoped_ptr<BackendFactory> backend_factory, bool set_up_quic_server_info) : net_log_(nullptr), - backend_factory_(backend_factory.Pass()), + backend_factory_(std::move(backend_factory)), building_backend_(false), bypass_lock_for_test_(false), fail_conditionalization_for_test_(false), mode_(NORMAL), - network_layer_(network_layer.Pass()), + network_layer_(std::move(network_layer)), clock_(new base::DefaultClock()), weak_factory_(this) { HttpNetworkSession* session = network_layer_->GetSession(); @@ -480,9 +481,10 @@ HttpNetworkSession* HttpCache::GetSession() { scoped_ptr<HttpTransactionFactory> HttpCache::SetHttpNetworkTransactionFactoryForTesting( scoped_ptr<HttpTransactionFactory> new_network_layer) { - scoped_ptr<HttpTransactionFactory> old_network_layer(network_layer_.Pass()); - network_layer_ = new_network_layer.Pass(); - return old_network_layer.Pass(); + scoped_ptr<HttpTransactionFactory> old_network_layer( + std::move(network_layer_)); + network_layer_ = std::move(new_network_layer); + return old_network_layer; } //----------------------------------------------------------------------------- @@ -1141,7 +1143,7 @@ void HttpCache::OnBackendCreated(int result, PendingOp* pending_op) { // and the last call clears building_backend_. backend_factory_.reset(); // Reclaim memory. if (result == OK) { - disk_cache_ = pending_op->backend.Pass(); + disk_cache_ = std::move(pending_op->backend); if (UseCertCache()) cert_cache_.reset(new DiskBasedCertCache(disk_cache_.get())); } diff --git a/net/http/http_cache_unittest.cc b/net/http/http_cache_unittest.cc index 4d0b81d..44039e4 100644 --- a/net/http/http_cache_unittest.cc +++ b/net/http/http_cache_unittest.cc @@ -5,8 +5,8 @@ #include "net/http/http_cache.h" #include <stdint.h> - #include <algorithm> +#include <utility> #include <vector> #include "base/bind.h" @@ -708,7 +708,7 @@ TEST(HttpCache, SimpleGETNoDiskCache2) { new MockBlockingBackendFactory()); factory->set_fail(true); factory->FinishCreation(); // We'll complete synchronously. - MockHttpCache cache(factory.Pass()); + MockHttpCache cache(std::move(factory)); // Read from the network, and don't use the cache. RunTransactionTest(cache.http_cache(), kSimpleGET_Transaction); @@ -3092,7 +3092,7 @@ TEST(HttpCache, SimplePOST_NoUploadId_NoBackend) { new MockBlockingBackendFactory()); factory->set_fail(true); factory->FinishCreation(); - MockHttpCache cache(factory.Pass()); + MockHttpCache cache(std::move(factory)); std::vector<scoped_ptr<UploadElementReader>> element_readers; element_readers.push_back( @@ -5437,7 +5437,7 @@ TEST(HttpCache, RangeGET_NoDiskCache) { new MockBlockingBackendFactory()); factory->set_fail(true); factory->FinishCreation(); // We'll complete synchronously. - MockHttpCache cache(factory.Pass()); + MockHttpCache cache(std::move(factory)); AddMockTransaction(&kRangeGET_TransactionOK); diff --git a/net/http/http_network_layer_unittest.cc b/net/http/http_network_layer_unittest.cc index 90df327..8589cbf 100644 --- a/net/http/http_network_layer_unittest.cc +++ b/net/http/http_network_layer_unittest.cc @@ -4,6 +4,8 @@ #include "net/http/http_network_layer.h" +#include <utility> + #include "base/strings/stringprintf.h" #include "net/cert/mock_cert_verifier.h" #include "net/dns/mock_host_resolver.h" @@ -34,7 +36,7 @@ class HttpNetworkLayerTest : public PlatformTest { void ConfigureTestDependencies(scoped_ptr<ProxyService> proxy_service) { cert_verifier_.reset(new MockCertVerifier); transport_security_state_.reset(new TransportSecurityState); - proxy_service_ = proxy_service.Pass(); + proxy_service_ = std::move(proxy_service); HttpNetworkSession::Params session_params; session_params.client_socket_factory = &mock_socket_factory_; session_params.host_resolver = &host_resolver_; diff --git a/net/http/http_network_session.cc b/net/http/http_network_session.cc index 3bf68b4..8188f8e 100644 --- a/net/http/http_network_session.cc +++ b/net/http/http_network_session.cc @@ -305,14 +305,14 @@ scoped_ptr<base::Value> HttpNetworkSession::QuicInfoToValue() const { it != params_.quic_connection_options.end(); ++it) { connection_options->AppendString("'" + QuicUtils::TagToString(*it) + "'"); } - dict->Set("connection_options", connection_options.Pass()); + dict->Set("connection_options", std::move(connection_options)); dict->SetString("origin_to_force_quic_on", params_.origin_to_force_quic_on.ToString()); dict->SetDouble("alternative_service_probability_threshold", params_.alternative_service_probability_threshold); dict->SetString("disabled_reason", quic_stream_factory_.QuicDisabledReasonString()); - return dict.Pass(); + return std::move(dict); } void HttpNetworkSession::CloseAllConnections() { diff --git a/net/http/http_network_transaction.cc b/net/http/http_network_transaction.cc index 4a9e622..201e391 100644 --- a/net/http/http_network_transaction.cc +++ b/net/http/http_network_transaction.cc @@ -5,6 +5,7 @@ #include "net/http/http_network_transaction.h" #include <set> +#include <utility> #include <vector> #include "base/bind.h" @@ -118,7 +119,7 @@ scoped_ptr<base::Value> NetLogSSLVersionFallbackCallback( dict->SetInteger("ssl_failure_state", ssl_failure_state); dict->SetInteger("version_before", version_before); dict->SetInteger("version_after", version_after); - return dict.Pass(); + return std::move(dict); } scoped_ptr<base::Value> NetLogSSLCipherFallbackCallback( @@ -128,7 +129,7 @@ scoped_ptr<base::Value> NetLogSSLCipherFallbackCallback( scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); dict->SetString("host_and_port", GetHostAndPort(*url)); dict->SetInteger("net_error", net_error); - return dict.Pass(); + return std::move(dict); } } // namespace diff --git a/net/http/http_network_transaction_unittest.cc b/net/http/http_network_transaction_unittest.cc index 1a1f4d8..ed7470b 100644 --- a/net/http/http_network_transaction_unittest.cc +++ b/net/http/http_network_transaction_unittest.cc @@ -7,9 +7,9 @@ #include <math.h> // ceil #include <stdarg.h> #include <stdint.h> - #include <limits> #include <string> +#include <utility> #include <vector> #include "base/compiler_specific.h" @@ -3519,7 +3519,7 @@ TEST_P(HttpNetworkTransactionTest, mock_handler->set_allows_default_credentials(true); auth_handler_factory->AddMockHandler(mock_handler.release(), HttpAuth::AUTH_PROXY); - session_deps_.http_auth_handler_factory = auth_handler_factory.Pass(); + session_deps_.http_auth_handler_factory = std::move(auth_handler_factory); // Add NetLog just so can verify load timing information gets a NetLog ID. NetLog net_log; @@ -3636,7 +3636,7 @@ TEST_P(HttpNetworkTransactionTest, mock_handler->set_allows_default_credentials(true); auth_handler_factory->AddMockHandler(mock_handler.release(), HttpAuth::AUTH_PROXY); - session_deps_.http_auth_handler_factory = auth_handler_factory.Pass(); + session_deps_.http_auth_handler_factory = std::move(auth_handler_factory); // Add NetLog just so can verify load timing information gets a NetLog ID. NetLog net_log; @@ -3758,7 +3758,7 @@ TEST_P(HttpNetworkTransactionTest, mock_handler->set_allows_default_credentials(true); auth_handler_factory->AddMockHandler(mock_handler.release(), HttpAuth::AUTH_PROXY); - session_deps_.http_auth_handler_factory = auth_handler_factory.Pass(); + session_deps_.http_auth_handler_factory = std::move(auth_handler_factory); // Add NetLog just so can verify load timing information gets a NetLog ID. NetLog net_log; @@ -3862,7 +3862,7 @@ TEST_P(HttpNetworkTransactionTest, mock_handler->set_allows_default_credentials(true); auth_handler_factory->AddMockHandler(mock_handler.release(), HttpAuth::AUTH_PROXY); - session_deps_.http_auth_handler_factory = auth_handler_factory.Pass(); + session_deps_.http_auth_handler_factory = std::move(auth_handler_factory); // Add NetLog just so can verify load timing information gets a NetLog ID. NetLog net_log; @@ -8788,7 +8788,7 @@ TEST_P(HttpNetworkTransactionTest, GroupNameForDirectConnections) { new MockClientSocketPoolManager); mock_pool_manager->SetTransportSocketPool(transport_conn_pool); mock_pool_manager->SetSSLSocketPool(ssl_conn_pool); - peer.SetClientSocketPoolManager(mock_pool_manager.Pass()); + peer.SetClientSocketPoolManager(std::move(mock_pool_manager)); EXPECT_EQ(ERR_IO_PENDING, GroupNameTransactionHelper(tests[i].url, session.get())); @@ -8853,7 +8853,7 @@ TEST_P(HttpNetworkTransactionTest, GroupNameForHTTPProxyConnections) { new MockClientSocketPoolManager); mock_pool_manager->SetSocketPoolForHTTPProxy(proxy_host, http_proxy_pool); mock_pool_manager->SetSocketPoolForSSLWithProxy(proxy_host, ssl_conn_pool); - peer.SetClientSocketPoolManager(mock_pool_manager.Pass()); + peer.SetClientSocketPoolManager(std::move(mock_pool_manager)); EXPECT_EQ(ERR_IO_PENDING, GroupNameTransactionHelper(tests[i].url, session.get())); @@ -8923,7 +8923,7 @@ TEST_P(HttpNetworkTransactionTest, GroupNameForSOCKSConnections) { new MockClientSocketPoolManager); mock_pool_manager->SetSocketPoolForSOCKSProxy(proxy_host, socks_conn_pool); mock_pool_manager->SetSocketPoolForSSLWithProxy(proxy_host, ssl_conn_pool); - peer.SetClientSocketPoolManager(mock_pool_manager.Pass()); + peer.SetClientSocketPoolManager(std::move(mock_pool_manager)); scoped_ptr<HttpTransaction> trans( new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); @@ -11563,7 +11563,7 @@ TEST_P(HttpNetworkTransactionTest, MultiRoundAuth) { scoped_ptr<MockClientSocketPoolManager> mock_pool_manager( new MockClientSocketPoolManager); mock_pool_manager->SetTransportSocketPool(transport_pool); - session_peer.SetClientSocketPoolManager(mock_pool_manager.Pass()); + session_peer.SetClientSocketPoolManager(std::move(mock_pool_manager)); scoped_ptr<HttpTransaction> trans( new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); @@ -14681,7 +14681,7 @@ class FakeWebSocketStreamCreateHelper : WebSocketHandshakeStreamBase* CreateBasicStream( scoped_ptr<ClientSocketHandle> connection, bool using_proxy) override { - return new FakeWebSocketBasicHandshakeStream(connection.Pass(), + return new FakeWebSocketBasicHandshakeStream(std::move(connection), using_proxy); } diff --git a/net/http/http_proxy_client_socket_pool.cc b/net/http/http_proxy_client_socket_pool.cc index 8e0580e..f0f8795 100644 --- a/net/http/http_proxy_client_socket_pool.cc +++ b/net/http/http_proxy_client_socket_pool.cc @@ -5,6 +5,7 @@ #include "net/http/http_proxy_client_socket_pool.h" #include <algorithm> +#include <utility> #include "base/compiler_specific.h" #include "base/time/time.h" @@ -141,7 +142,7 @@ int HttpProxyConnectJob::HandleConnectResult(int result) { if (result == OK || result == ERR_PROXY_AUTH_REQUESTED || result == ERR_HTTPS_PROXY_TUNNEL_RESPONSE) { - SetSocket(client_socket_.Pass()); + SetSocket(std::move(client_socket_)); } return result; } @@ -247,7 +248,7 @@ void HttpProxyClientSocketPool::CancelRequest( void HttpProxyClientSocketPool::ReleaseSocket(const std::string& group_name, scoped_ptr<StreamSocket> socket, int id) { - base_.ReleaseSocket(group_name, socket.Pass(), id); + base_.ReleaseSocket(group_name, std::move(socket), id); } void HttpProxyClientSocketPool::FlushWithError(int error) { @@ -291,7 +292,7 @@ scoped_ptr<base::DictionaryValue> HttpProxyClientSocketPool::GetInfoAsValue( } dict->Set("nested_pools", list); } - return dict.Pass(); + return dict; } base::TimeDelta HttpProxyClientSocketPool::ConnectionTimeout() const { diff --git a/net/http/http_proxy_client_socket_wrapper.cc b/net/http/http_proxy_client_socket_wrapper.cc index fef16e3..1a56a5c 100644 --- a/net/http/http_proxy_client_socket_wrapper.cc +++ b/net/http/http_proxy_client_socket_wrapper.cc @@ -4,6 +4,8 @@ #include "net/http/http_proxy_client_socket_wrapper.h" +#include <utility> + #include "base/bind.h" #include "base/bind_helpers.h" #include "base/callback_helpers.h" @@ -107,7 +109,7 @@ LoadState HttpProxyClientSocketWrapper::GetConnectLoadState() const { scoped_ptr<HttpResponseInfo> HttpProxyClientSocketWrapper::GetAdditionalErrorState() { - return error_response_info_.Pass(); + return std::move(error_response_info_); } const HttpResponseInfo* HttpProxyClientSocketWrapper::GetConnectResponseInfo() @@ -534,7 +536,7 @@ int HttpProxyClientSocketWrapper::DoSpdyProxyCreateStream() { } else { // Create a session direct to the proxy itself spdy_session = spdy_session_pool_->CreateAvailableSessionFromSocket( - key, transport_socket_handle_.Pass(), net_log_, OK, + key, std::move(transport_socket_handle_), net_log_, OK, /*using_ssl_*/ true); DCHECK(spdy_session); } diff --git a/net/http/http_request_headers.cc b/net/http/http_request_headers.cc index c2eee59..8e6d88f 100644 --- a/net/http/http_request_headers.cc +++ b/net/http/http_request_headers.cc @@ -4,6 +4,8 @@ #include "net/http/http_request_headers.h" +#include <utility> + #include "base/logging.h" #include "base/strings/string_split.h" #include "base/strings/string_util.h" @@ -203,7 +205,7 @@ scoped_ptr<base::Value> HttpRequestHeaders::NetLogCallback( it->key.c_str(), log_value.c_str()))); } dict->Set("headers", headers); - return dict.Pass(); + return std::move(dict); } // static diff --git a/net/http/http_response_headers.cc b/net/http/http_response_headers.cc index c0f8039..ba51cfd 100644 --- a/net/http/http_response_headers.cc +++ b/net/http/http_response_headers.cc @@ -10,6 +10,7 @@ #include "net/http/http_response_headers.h" #include <algorithm> +#include <utility> #include "base/format_macros.h" #include "base/logging.h" @@ -1407,7 +1408,7 @@ scoped_ptr<base::Value> HttpResponseHeaders::NetLogCallback( escaped_value.c_str()))); } dict->Set("headers", headers); - return dict.Pass(); + return std::move(dict); } // static diff --git a/net/http/http_server_properties_impl.cc b/net/http/http_server_properties_impl.cc index 5e42585..89754d2 100644 --- a/net/http/http_server_properties_impl.cc +++ b/net/http/http_server_properties_impl.cc @@ -5,6 +5,7 @@ #include "net/http/http_server_properties_impl.h" #include <algorithm> +#include <utility> #include "base/bind.h" #include "base/location.h" @@ -560,10 +561,10 @@ HttpServerPropertiesImpl::GetAlternativeServiceInfoAsValue() scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); dict->SetString("host_port_pair", host_port_pair.ToString()); dict->Set("alternative_service", - scoped_ptr<base::Value>(alternative_service_list.Pass())); - dict_list->Append(dict.Pass()); + scoped_ptr<base::Value>(std::move(alternative_service_list))); + dict_list->Append(std::move(dict)); } - return dict_list.Pass(); + return std::move(dict_list); } const SettingsMap& HttpServerPropertiesImpl::GetSpdySettings( diff --git a/net/http/http_stream_factory_impl_job.cc b/net/http/http_stream_factory_impl_job.cc index f2ce8d8..d5bcc51 100644 --- a/net/http/http_stream_factory_impl_job.cc +++ b/net/http/http_stream_factory_impl_job.cc @@ -6,6 +6,7 @@ #include <algorithm> #include <string> +#include <utility> #include "base/bind.h" #include "base/bind_helpers.h" @@ -72,7 +73,7 @@ scoped_ptr<base::Value> NetLogHttpStreamJobCallback( dict->SetString("url", url->GetOrigin().spec()); dict->SetString("alternative_service", alternative_service->ToString()); dict->SetString("priority", RequestPriorityToString(priority)); - return dict.Pass(); + return std::move(dict); } // Returns parameters associated with the Proto (with NPN negotiation) of a HTTP @@ -86,7 +87,7 @@ scoped_ptr<base::Value> NetLogHttpStreamProtoCallback( dict->SetString("next_proto_status", SSLClientSocket::NextProtoStatusToString(status)); dict->SetString("proto", *proto); - return dict.Pass(); + return std::move(dict); } HttpStreamFactoryImpl::Job::Job(HttpStreamFactoryImpl* stream_factory, @@ -1259,7 +1260,7 @@ int HttpStreamFactoryImpl::Job::DoCreateStream() { DCHECK(request_->websocket_handshake_stream_create_helper()); websocket_stream_.reset( request_->websocket_handshake_stream_create_helper() - ->CreateBasicStream(connection_.Pass(), using_proxy)); + ->CreateBasicStream(std::move(connection_), using_proxy)); } else { stream_.reset(new HttpBasicStream(connection_.release(), using_proxy)); } @@ -1293,8 +1294,8 @@ int HttpStreamFactoryImpl::Job::DoCreateStream() { } result = valid_spdy_session_pool_->CreateAvailableSessionFromSocket( - spdy_session_key, connection_.Pass(), net_log_, spdy_certificate_error_, - using_ssl_, &spdy_session); + spdy_session_key, std::move(connection_), net_log_, + spdy_certificate_error_, using_ssl_, &spdy_session); if (result != OK) { return result; } @@ -1647,7 +1648,7 @@ int HttpStreamFactoryImpl::Job::ValidSpdySessionPool:: bool is_secure, base::WeakPtr<SpdySession>* spdy_session) { *spdy_session = spdy_session_pool_->CreateAvailableSessionFromSocket( - key, connection.Pass(), net_log, certificate_error_code, is_secure); + key, std::move(connection), net_log, certificate_error_code, is_secure); return CheckAlternativeServiceValidityForOrigin(*spdy_session); } diff --git a/net/http/http_stream_factory_impl_unittest.cc b/net/http/http_stream_factory_impl_unittest.cc index 10a5881..2a87dd1 100644 --- a/net/http/http_stream_factory_impl_unittest.cc +++ b/net/http/http_stream_factory_impl_unittest.cc @@ -5,8 +5,8 @@ #include "net/http/http_stream_factory_impl.h" #include <stdint.h> - #include <string> +#include <utility> #include <vector> #include "base/compiler_specific.h" @@ -286,7 +286,7 @@ class WebSocketBasicHandshakeStream : public MockWebSocketHandshakeStream { explicit WebSocketBasicHandshakeStream( scoped_ptr<ClientSocketHandle> connection) : MockWebSocketHandshakeStream(kStreamTypeBasic), - connection_(connection.Pass()) {} + connection_(std::move(connection)) {} ~WebSocketBasicHandshakeStream() override { connection_->socket()->Disconnect(); @@ -306,7 +306,7 @@ class WebSocketStreamCreateHelper WebSocketHandshakeStreamBase* CreateBasicStream( scoped_ptr<ClientSocketHandle> connection, bool using_proxy) override { - return new WebSocketBasicHandshakeStream(connection.Pass()); + return new WebSocketBasicHandshakeStream(std::move(connection)); } WebSocketHandshakeStreamBase* CreateSpdyStream( @@ -486,7 +486,7 @@ TEST_P(HttpStreamFactoryTest, PreconnectDirect) { new MockClientSocketPoolManager); mock_pool_manager->SetTransportSocketPool(transport_conn_pool); mock_pool_manager->SetSSLSocketPool(ssl_conn_pool); - peer.SetClientSocketPoolManager(mock_pool_manager.Pass()); + peer.SetClientSocketPoolManager(std::move(mock_pool_manager)); PreconnectHelper(kTests[i], session.get()); if (kTests[i].ssl) EXPECT_EQ(kTests[i].num_streams, ssl_conn_pool->last_num_streams()); @@ -515,7 +515,7 @@ TEST_P(HttpStreamFactoryTest, PreconnectHttpProxy) { new MockClientSocketPoolManager); mock_pool_manager->SetSocketPoolForHTTPProxy(proxy_host, http_proxy_pool); mock_pool_manager->SetSocketPoolForSSLWithProxy(proxy_host, ssl_conn_pool); - peer.SetClientSocketPoolManager(mock_pool_manager.Pass()); + peer.SetClientSocketPoolManager(std::move(mock_pool_manager)); PreconnectHelper(kTests[i], session.get()); if (kTests[i].ssl) EXPECT_EQ(kTests[i].num_streams, ssl_conn_pool->last_num_streams()); @@ -544,7 +544,7 @@ TEST_P(HttpStreamFactoryTest, PreconnectSocksProxy) { new MockClientSocketPoolManager); mock_pool_manager->SetSocketPoolForSOCKSProxy(proxy_host, socks_proxy_pool); mock_pool_manager->SetSocketPoolForSSLWithProxy(proxy_host, ssl_conn_pool); - peer.SetClientSocketPoolManager(mock_pool_manager.Pass()); + peer.SetClientSocketPoolManager(std::move(mock_pool_manager)); PreconnectHelper(kTests[i], session.get()); if (kTests[i].ssl) EXPECT_EQ(kTests[i].num_streams, ssl_conn_pool->last_num_streams()); @@ -579,7 +579,7 @@ TEST_P(HttpStreamFactoryTest, PreconnectDirectWithExistingSpdySession) { new MockClientSocketPoolManager); mock_pool_manager->SetTransportSocketPool(transport_conn_pool); mock_pool_manager->SetSSLSocketPool(ssl_conn_pool); - peer.SetClientSocketPoolManager(mock_pool_manager.Pass()); + peer.SetClientSocketPoolManager(std::move(mock_pool_manager)); PreconnectHelper(kTests[i], session.get()); // We shouldn't be preconnecting if we have an existing session, which is // the case for https://www.google.com. @@ -608,7 +608,7 @@ TEST_P(HttpStreamFactoryTest, PreconnectUnsafePort) { scoped_ptr<MockClientSocketPoolManager> mock_pool_manager( new MockClientSocketPoolManager); mock_pool_manager->SetTransportSocketPool(transport_conn_pool); - peer.SetClientSocketPoolManager(mock_pool_manager.Pass()); + peer.SetClientSocketPoolManager(std::move(mock_pool_manager)); PreconnectHelperForURL(1, GURL("http://www.google.com:7"), session.get()); EXPECT_EQ(-1, transport_conn_pool->last_num_streams()); @@ -829,7 +829,7 @@ TEST_P(HttpStreamFactoryTest, UsePreConnectIfNoZeroRTT) { new MockClientSocketPoolManager); mock_pool_manager->SetSocketPoolForHTTPProxy(proxy_host, http_proxy_pool); mock_pool_manager->SetSocketPoolForSSLWithProxy(proxy_host, ssl_conn_pool); - peer.SetClientSocketPoolManager(mock_pool_manager.Pass()); + peer.SetClientSocketPoolManager(std::move(mock_pool_manager)); PreconnectHelperForURL(num_streams, url, session.get()); EXPECT_EQ(num_streams, ssl_conn_pool->last_num_streams()); } @@ -874,7 +874,7 @@ TEST_P(HttpStreamFactoryTest, QuicDisablePreConnectIfZeroRtt) { scoped_ptr<MockClientSocketPoolManager> mock_pool_manager( new MockClientSocketPoolManager); mock_pool_manager->SetTransportSocketPool(transport_conn_pool); - peer.SetClientSocketPoolManager(mock_pool_manager.Pass()); + peer.SetClientSocketPoolManager(std::move(mock_pool_manager)); HttpRequestInfo request; request.method = "GET"; diff --git a/net/http/http_stream_parser.cc b/net/http/http_stream_parser.cc index 2372065..e115743 100644 --- a/net/http/http_stream_parser.cc +++ b/net/http/http_stream_parser.cc @@ -4,6 +4,8 @@ #include "net/http/http_stream_parser.h" +#include <utility> + #include "base/bind.h" #include "base/compiler_specific.h" #include "base/logging.h" @@ -87,7 +89,7 @@ scoped_ptr<base::Value> NetLogSendRequestBodyCallback( dict->SetInteger("length", static_cast<int>(length)); dict->SetBoolean("is_chunked", is_chunked); dict->SetBoolean("did_merge", did_merge); - return dict.Pass(); + return std::move(dict); } // Returns true if |error_code| is an error for which we give the server a diff --git a/net/http/http_stream_parser_unittest.cc b/net/http/http_stream_parser_unittest.cc index 2651edc..7936426 100644 --- a/net/http/http_stream_parser_unittest.cc +++ b/net/http/http_stream_parser_unittest.cc @@ -5,9 +5,9 @@ #include "net/http/http_stream_parser.h" #include <stdint.h> - #include <algorithm> #include <string> +#include <utility> #include <vector> #include "base/files/file_path.h" @@ -57,8 +57,8 @@ scoped_ptr<ClientSocketHandle> CreateConnectedSocketHandle( EXPECT_EQ(OK, socket->Connect(callback.callback())); scoped_ptr<ClientSocketHandle> socket_handle(new ClientSocketHandle); - socket_handle->SetSocket(socket.Pass()); - return socket_handle.Pass(); + socket_handle->SetSocket(std::move(socket)); + return socket_handle; } // The empty payload is how the last chunk is encoded. diff --git a/net/http/http_transaction_test_util.cc b/net/http/http_transaction_test_util.cc index 6b54e60..4a97ae6 100644 --- a/net/http/http_transaction_test_util.cc +++ b/net/http/http_transaction_test_util.cc @@ -5,6 +5,7 @@ #include "net/http/http_transaction_test_util.h" #include <algorithm> +#include <utility> #include "base/bind.h" #include "base/location.h" @@ -530,7 +531,7 @@ int MockNetworkLayer::CreateTransaction(RequestPriority priority, scoped_ptr<MockNetworkTransaction> mock_transaction( new MockNetworkTransaction(priority, this)); last_transaction_ = mock_transaction->AsWeakPtr(); - *trans = mock_transaction.Pass(); + *trans = std::move(mock_transaction); return OK; } diff --git a/net/http/mock_http_cache.cc b/net/http/mock_http_cache.cc index e5496b1..533177a 100644 --- a/net/http/mock_http_cache.cc +++ b/net/http/mock_http_cache.cc @@ -5,6 +5,7 @@ #include "net/http/mock_http_cache.h" #include <limits> +#include <utility> #include "base/bind.h" #include "base/location.h" @@ -532,7 +533,7 @@ MockHttpCache::MockHttpCache() MockHttpCache::MockHttpCache( scoped_ptr<HttpCache::BackendFactory> disk_cache_factory) : http_cache_(make_scoped_ptr(new MockNetworkLayer()), - disk_cache_factory.Pass(), + std::move(disk_cache_factory), true) {} disk_cache::Backend* MockHttpCache::backend() { diff --git a/net/http/transport_security_persister.cc b/net/http/transport_security_persister.cc index 78898c3..a07e632 100644 --- a/net/http/transport_security_persister.cc +++ b/net/http/transport_security_persister.cc @@ -4,6 +4,8 @@ #include "net/http/transport_security_persister.h" +#include <utility> + #include "base/base64.h" #include "base/bind.h" #include "base/files/file_path.h" @@ -162,7 +164,7 @@ bool TransportSecurityPersister::SerializeData(std::string* output) { continue; } - toplevel.Set(key, serialized.Pass()); + toplevel.Set(key, std::move(serialized)); } TransportSecurityState::PKPStateIterator pkp_iterator( @@ -181,7 +183,7 @@ bool TransportSecurityPersister::SerializeData(std::string* output) { new base::DictionaryValue); serialized = serialized_scoped.get(); PopulateEntryWithDefaults(serialized); - toplevel.Set(key, serialized_scoped.Pass()); + toplevel.Set(key, std::move(serialized_scoped)); } serialized->SetBoolean(kPkpIncludeSubdomains, pkp_state.include_subdomains); diff --git a/net/http/transport_security_state.cc b/net/http/transport_security_state.cc index 5f2b010..e77c8c5 100644 --- a/net/http/transport_security_state.cc +++ b/net/http/transport_security_state.cc @@ -5,6 +5,7 @@ #include "net/http/transport_security_state.h" #include <algorithm> +#include <utility> #include "base/base64.h" #include "base/build_time.h" @@ -58,7 +59,7 @@ scoped_ptr<base::ListValue> GetPEMEncodedChainAsList( for (const std::string& cert : pem_encoded_chain) result->Append(make_scoped_ptr(new base::StringValue(cert))); - return result.Pass(); + return result; } bool HashReportForCache(const base::DictionaryValue& report, @@ -96,9 +97,10 @@ bool GetHPKPReport(const HostPortPair& host_port_pair, GetPEMEncodedChainAsList(served_certificate_chain); scoped_ptr<base::ListValue> validated_certificate_chain_list = GetPEMEncodedChainAsList(validated_certificate_chain); - report.Set("served-certificate-chain", served_certificate_chain_list.Pass()); + report.Set("served-certificate-chain", + std::move(served_certificate_chain_list)); report.Set("validated-certificate-chain", - validated_certificate_chain_list.Pass()); + std::move(validated_certificate_chain_list)); scoped_ptr<base::ListValue> known_pin_list(new base::ListValue()); for (const auto& hash_value : pkp_state.spki_hashes) { @@ -124,7 +126,7 @@ bool GetHPKPReport(const HostPortPair& host_port_pair, scoped_ptr<base::Value>(new base::StringValue(known_pin))); } - report.Set("known-pins", known_pin_list.Pass()); + report.Set("known-pins", std::move(known_pin_list)); // For the sent reports cache, do not include the effective expiration // date. The expiration date will likely change every time the user diff --git a/net/http/url_security_manager.cc b/net/http/url_security_manager.cc index 075b388..8565fac 100644 --- a/net/http/url_security_manager.cc +++ b/net/http/url_security_manager.cc @@ -4,6 +4,8 @@ #include "net/http/url_security_manager.h" +#include <utility> + #include "net/http/http_auth_filter.h" namespace net { @@ -27,12 +29,12 @@ bool URLSecurityManagerWhitelist::CanDelegate(const GURL& auth_origin) const { void URLSecurityManagerWhitelist::SetDefaultWhitelist( scoped_ptr<HttpAuthFilter> whitelist_default) { - whitelist_default_ = whitelist_default.Pass(); + whitelist_default_ = std::move(whitelist_default); } void URLSecurityManagerWhitelist::SetDelegateWhitelist( scoped_ptr<HttpAuthFilter> whitelist_delegate) { - whitelist_delegate_ = whitelist_delegate.Pass(); + whitelist_delegate_ = std::move(whitelist_delegate); } bool URLSecurityManagerWhitelist::HasDefaultWhitelist() const { diff --git a/net/http/url_security_manager_unittest.cc b/net/http/url_security_manager_unittest.cc index 14406a8..7120f54 100644 --- a/net/http/url_security_manager_unittest.cc +++ b/net/http/url_security_manager_unittest.cc @@ -4,6 +4,8 @@ #include "net/http/url_security_manager.h" +#include <utility> + #include "net/base/net_errors.h" #include "net/http/http_auth_filter.h" #include "testing/gtest/include/gtest/gtest.h" @@ -49,7 +51,7 @@ TEST(URLSecurityManager, UseDefaultCredentials) { // The URL security manager takes ownership of |auth_filter|. scoped_ptr<URLSecurityManager> url_security_manager( URLSecurityManager::Create()); - url_security_manager->SetDefaultWhitelist(auth_filter.Pass()); + url_security_manager->SetDefaultWhitelist(std::move(auth_filter)); ASSERT_TRUE(url_security_manager.get()); for (size_t i = 0; i < arraysize(kTestDataList); ++i) { @@ -69,7 +71,7 @@ TEST(URLSecurityManager, CanDelegate) { // The URL security manager takes ownership of |auth_filter|. scoped_ptr<URLSecurityManager> url_security_manager( URLSecurityManager::Create()); - url_security_manager->SetDelegateWhitelist(auth_filter.Pass()); + url_security_manager->SetDelegateWhitelist(std::move(auth_filter)); ASSERT_TRUE(url_security_manager.get()); for (size_t i = 0; i < arraysize(kTestDataList); ++i) { diff --git a/net/log/net_log.cc b/net/log/net_log.cc index 4fae9e0..90ec6a0 100644 --- a/net/log/net_log.cc +++ b/net/log/net_log.cc @@ -4,6 +4,8 @@ #include "net/log/net_log.h" +#include <utility> + #include "base/bind.h" #include "base/debug/alias.h" #include "base/logging.h" @@ -29,7 +31,7 @@ scoped_ptr<base::Value> BytesTransferredCallback( dict->SetInteger("byte_count", byte_count); if (capture_mode.include_socket_bytes() && byte_count > 0) dict->SetString("hex_encoded_bytes", base::HexEncode(bytes, byte_count)); - return dict.Pass(); + return std::move(dict); } scoped_ptr<base::Value> SourceEventParametersCallback( @@ -39,7 +41,7 @@ scoped_ptr<base::Value> SourceEventParametersCallback( return scoped_ptr<base::Value>(); scoped_ptr<base::DictionaryValue> event_params(new base::DictionaryValue()); source.AddToEventParameters(event_params.get()); - return event_params.Pass(); + return std::move(event_params); } scoped_ptr<base::Value> NetLogBoolCallback( @@ -48,7 +50,7 @@ scoped_ptr<base::Value> NetLogBoolCallback( NetLogCaptureMode /* capture_mode */) { scoped_ptr<base::DictionaryValue> event_params(new base::DictionaryValue()); event_params->SetBoolean(name, value); - return event_params.Pass(); + return std::move(event_params); } scoped_ptr<base::Value> NetLogIntCallback( @@ -57,7 +59,7 @@ scoped_ptr<base::Value> NetLogIntCallback( NetLogCaptureMode /* capture_mode */) { scoped_ptr<base::DictionaryValue> event_params(new base::DictionaryValue()); event_params->SetInteger(name, value); - return event_params.Pass(); + return std::move(event_params); } scoped_ptr<base::Value> NetLogInt64Callback( @@ -66,7 +68,7 @@ scoped_ptr<base::Value> NetLogInt64Callback( NetLogCaptureMode /* capture_mode */) { scoped_ptr<base::DictionaryValue> event_params(new base::DictionaryValue()); event_params->SetString(name, base::Int64ToString(value)); - return event_params.Pass(); + return std::move(event_params); } scoped_ptr<base::Value> NetLogStringCallback( @@ -75,7 +77,7 @@ scoped_ptr<base::Value> NetLogStringCallback( NetLogCaptureMode /* capture_mode */) { scoped_ptr<base::DictionaryValue> event_params(new base::DictionaryValue()); event_params->SetString(name, *value); - return event_params.Pass(); + return std::move(event_params); } scoped_ptr<base::Value> NetLogString16Callback( @@ -84,7 +86,7 @@ scoped_ptr<base::Value> NetLogString16Callback( NetLogCaptureMode /* capture_mode */) { scoped_ptr<base::DictionaryValue> event_params(new base::DictionaryValue()); event_params->SetString(name, *value); - return event_params.Pass(); + return std::move(event_params); } } // namespace @@ -106,7 +108,7 @@ void NetLog::Source::AddToEventParameters( scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); dict->SetInteger("type", static_cast<int>(type)); dict->SetInteger("id", static_cast<int>(id)); - event_params->Set("source_dependency", dict.Pass()); + event_params->Set("source_dependency", std::move(dict)); } NetLog::ParametersCallback NetLog::Source::ToEventParametersCallback() const { @@ -143,7 +145,7 @@ base::Value* NetLog::Entry::ToValue() const { scoped_ptr<base::DictionaryValue> source_dict(new base::DictionaryValue()); source_dict->SetInteger("id", data_->source.id); source_dict->SetInteger("type", static_cast<int>(data_->source.type)); - entry_dict->Set("source", source_dict.Pass()); + entry_dict->Set("source", std::move(source_dict)); // Set the event info. entry_dict->SetInteger("type", static_cast<int>(data_->type)); @@ -154,7 +156,7 @@ base::Value* NetLog::Entry::ToValue() const { scoped_ptr<base::Value> value( data_->parameters_callback->Run(capture_mode_)); if (value) - entry_dict->Set("params", value.Pass()); + entry_dict->Set("params", std::move(value)); } return entry_dict.release(); diff --git a/net/log/net_log_unittest.cc b/net/log/net_log_unittest.cc index e1a55e5..1a16fac 100644 --- a/net/log/net_log_unittest.cc +++ b/net/log/net_log_unittest.cc @@ -4,6 +4,8 @@ #include "net/log/net_log.h" +#include <utility> + #include "base/bind.h" #include "base/macros.h" #include "base/synchronization/waitable_event.h" @@ -44,7 +46,7 @@ scoped_ptr<base::Value> CaptureModeToValue(NetLogCaptureMode capture_mode) { scoped_ptr<base::Value> NetCaptureModeCallback(NetLogCaptureMode capture_mode) { scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); dict->Set("capture_mode", CaptureModeToValue(capture_mode)); - return dict.Pass(); + return std::move(dict); } TEST(NetLogTest, Basic) { diff --git a/net/log/net_log_util.cc b/net/log/net_log_util.cc index 2a82abc..5c8a76c 100644 --- a/net/log/net_log_util.cc +++ b/net/log/net_log_util.cc @@ -6,6 +6,7 @@ #include <algorithm> #include <string> +#include <utility> #include <vector> #include "base/bind.h" @@ -153,7 +154,7 @@ scoped_ptr<base::DictionaryValue> GetNetConstants() { for (size_t i = 0; i < arraysize(kCertStatusFlags); i++) dict->SetInteger(kCertStatusFlags[i].name, kCertStatusFlags[i].constant); - constants_dict->Set("certStatusFlag", dict.Pass()); + constants_dict->Set("certStatusFlag", std::move(dict)); } // Add a dictionary with information about the relationship between load flag @@ -164,7 +165,7 @@ scoped_ptr<base::DictionaryValue> GetNetConstants() { for (size_t i = 0; i < arraysize(kLoadFlags); i++) dict->SetInteger(kLoadFlags[i].name, kLoadFlags[i].constant); - constants_dict->Set("loadFlag", dict.Pass()); + constants_dict->Set("loadFlag", std::move(dict)); } // Add a dictionary with information about the relationship between load state @@ -175,7 +176,7 @@ scoped_ptr<base::DictionaryValue> GetNetConstants() { for (size_t i = 0; i < arraysize(kLoadStateTable); i++) dict->SetInteger(kLoadStateTable[i].name, kLoadStateTable[i].constant); - constants_dict->Set("loadState", dict.Pass()); + constants_dict->Set("loadState", std::move(dict)); } { @@ -184,7 +185,7 @@ scoped_ptr<base::DictionaryValue> GetNetConstants() { dict->SetInteger(string, NET_INFO_##label); #include "net/base/net_info_source_list.h" #undef NET_INFO_SOURCE - constants_dict->Set("netInfoSources", dict.Pass()); + constants_dict->Set("netInfoSources", std::move(dict)); } // Add information on the relationship between net error codes and their @@ -195,7 +196,7 @@ scoped_ptr<base::DictionaryValue> GetNetConstants() { for (size_t i = 0; i < arraysize(kNetErrors); i++) dict->SetInteger(ErrorToShortString(kNetErrors[i]), kNetErrors[i]); - constants_dict->Set("netError", dict.Pass()); + constants_dict->Set("netError", std::move(dict)); } // Add information on the relationship between QUIC error codes and their @@ -209,7 +210,7 @@ scoped_ptr<base::DictionaryValue> GetNetConstants() { static_cast<int>(error)); } - constants_dict->Set("quicError", dict.Pass()); + constants_dict->Set("quicError", std::move(dict)); } // Add information on the relationship between QUIC RST_STREAM error codes @@ -224,7 +225,7 @@ scoped_ptr<base::DictionaryValue> GetNetConstants() { static_cast<int>(error)); } - constants_dict->Set("quicRstStreamError", dict.Pass()); + constants_dict->Set("quicRstStreamError", std::move(dict)); } // Add information on the relationship between SDCH problem codes and their @@ -235,7 +236,7 @@ scoped_ptr<base::DictionaryValue> GetNetConstants() { for (size_t i = 0; i < arraysize(kSdchProblems); i++) dict->SetInteger(kSdchProblems[i].name, kSdchProblems[i].constant); - constants_dict->Set("sdchProblemCode", dict.Pass()); + constants_dict->Set("sdchProblemCode", std::move(dict)); } // Information about the relationship between event phase enums and their @@ -247,7 +248,7 @@ scoped_ptr<base::DictionaryValue> GetNetConstants() { dict->SetInteger("PHASE_END", NetLog::PHASE_END); dict->SetInteger("PHASE_NONE", NetLog::PHASE_NONE); - constants_dict->Set("logEventPhase", dict.Pass()); + constants_dict->Set("logEventPhase", std::move(dict)); } // Information about the relationship between source type enums and @@ -268,7 +269,7 @@ scoped_ptr<base::DictionaryValue> GetNetConstants() { dict->SetInteger("ADDRESS_FAMILY_IPV4", ADDRESS_FAMILY_IPV4); dict->SetInteger("ADDRESS_FAMILY_IPV6", ADDRESS_FAMILY_IPV6); - constants_dict->Set("addressFamily", dict.Pass()); + constants_dict->Set("addressFamily", std::move(dict)); } // Information about how the "time ticks" values we have given it relate to @@ -300,7 +301,7 @@ scoped_ptr<base::DictionaryValue> GetNetConstants() { constants_dict->Set("activeFieldTrialGroups", field_trial_groups); } - return constants_dict.Pass(); + return constants_dict; } NET_EXPORT scoped_ptr<base::DictionaryValue> GetNetInfo( @@ -323,7 +324,7 @@ NET_EXPORT scoped_ptr<base::DictionaryValue> GetNetInfo( dict->Set("effective", proxy_service->config().ToValue()); net_info_dict->Set(NetInfoSourceToString(NET_INFO_PROXY_SETTINGS), - dict.Pass()); + std::move(dict)); } if (info_sources & NET_INFO_BAD_PROXIES) { @@ -342,7 +343,7 @@ NET_EXPORT scoped_ptr<base::DictionaryValue> GetNetInfo( dict->SetString("bad_until", NetLog::TickCountToString(retry_info.bad_until)); - list->Append(dict.Pass()); + list->Append(std::move(dict)); } net_info_dict->Set(NetInfoSourceToString(NET_INFO_BAD_PROXIES), list); @@ -395,7 +396,7 @@ NET_EXPORT scoped_ptr<base::DictionaryValue> GetNetInfo( cache_info_dict->Set("entries", entry_list); dict->Set("cache", cache_info_dict); net_info_dict->Set(NetInfoSourceToString(NET_INFO_HOST_RESOLVER), - dict.Pass()); + std::move(dict)); } } @@ -489,10 +490,11 @@ NET_EXPORT scoped_ptr<base::DictionaryValue> GetNetInfo( } else { info_dict.reset(new base::DictionaryValue()); } - net_info_dict->Set(NetInfoSourceToString(NET_INFO_SDCH), info_dict.Pass()); + net_info_dict->Set(NetInfoSourceToString(NET_INFO_SDCH), + std::move(info_dict)); } - return net_info_dict.Pass(); + return net_info_dict; } NET_EXPORT void CreateNetLogEntriesForActiveObjects( diff --git a/net/log/test_net_log_entry.cc b/net/log/test_net_log_entry.cc index 34e9ffa..e9fd982 100644 --- a/net/log/test_net_log_entry.cc +++ b/net/log/test_net_log_entry.cc @@ -4,6 +4,8 @@ #include "net/log/test_net_log_entry.h" +#include <utility> + #include "base/json/json_writer.h" #include "base/logging.h" #include "base/values.h" @@ -19,7 +21,7 @@ TestNetLogEntry::TestNetLogEntry(NetLog::EventType type, time(time), source(source), phase(phase), - params(params.Pass()) { + params(std::move(params)) { // Only entries without a NetLog should have an invalid source. CHECK(source.IsValid()); } diff --git a/net/log/trace_net_log_observer.cc b/net/log/trace_net_log_observer.cc index 4978e64..6a64e50 100644 --- a/net/log/trace_net_log_observer.cc +++ b/net/log/trace_net_log_observer.cc @@ -5,8 +5,8 @@ #include "net/log/trace_net_log_observer.h" #include <stdio.h> - #include <string> +#include <utility> #include "base/json/json_writer.h" #include "base/logging.h" @@ -24,7 +24,8 @@ const char kNetLogTracingCategory[] = "netlog"; class TracedValue : public base::trace_event::ConvertableToTraceFormat { public: - explicit TracedValue(scoped_ptr<base::Value> value) : value_(value.Pass()) {} + explicit TracedValue(scoped_ptr<base::Value> value) + : value_(std::move(value)) {} private: ~TracedValue() override {} @@ -62,7 +63,7 @@ void TraceNetLogObserver::OnAddEntry(const NetLog::Entry& entry) { entry.source().id, "source_type", NetLog::SourceTypeToString(entry.source().type), "params", scoped_refptr<base::trace_event::ConvertableToTraceFormat>( - new TracedValue(params.Pass()))); + new TracedValue(std::move(params)))); break; case NetLog::PHASE_END: TRACE_EVENT_NESTABLE_ASYNC_END2( @@ -70,7 +71,7 @@ void TraceNetLogObserver::OnAddEntry(const NetLog::Entry& entry) { entry.source().id, "source_type", NetLog::SourceTypeToString(entry.source().type), "params", scoped_refptr<base::trace_event::ConvertableToTraceFormat>( - new TracedValue(params.Pass()))); + new TracedValue(std::move(params)))); break; case NetLog::PHASE_NONE: TRACE_EVENT_NESTABLE_ASYNC_INSTANT2( @@ -78,7 +79,7 @@ void TraceNetLogObserver::OnAddEntry(const NetLog::Entry& entry) { entry.source().id, "source_type", NetLog::SourceTypeToString(entry.source().type), "params", scoped_refptr<base::trace_event::ConvertableToTraceFormat>( - new TracedValue(params.Pass()))); + new TracedValue(std::move(params)))); break; } } diff --git a/net/log/trace_net_log_observer_unittest.cc b/net/log/trace_net_log_observer_unittest.cc index 4adcd0f..a56ab4c 100644 --- a/net/log/trace_net_log_observer_unittest.cc +++ b/net/log/trace_net_log_observer_unittest.cc @@ -128,7 +128,7 @@ class TraceNetLogObserverTest : public testing::Test { continue; filtered_trace_events->Append(dict->DeepCopy()); } - return filtered_trace_events.Pass(); + return filtered_trace_events; } base::ListValue* trace_events() const { return trace_events_.get(); } diff --git a/net/log/write_to_file_net_log_observer.cc b/net/log/write_to_file_net_log_observer.cc index 5c4f951..3bc7814 100644 --- a/net/log/write_to_file_net_log_observer.cc +++ b/net/log/write_to_file_net_log_observer.cc @@ -5,8 +5,8 @@ #include "net/log/write_to_file_net_log_observer.h" #include <stdio.h> - #include <set> +#include <utility> #include "base/json/json_writer.h" #include "base/logging.h" @@ -36,7 +36,7 @@ void WriteToFileNetLogObserver::StartObserving( base::Value* constants, URLRequestContext* url_request_context) { DCHECK(file.get()); - file_ = file.Pass(); + file_ = std::move(file); added_events_ = false; // Write constants to the output file. This allows loading files that have diff --git a/net/log/write_to_file_net_log_observer_unittest.cc b/net/log/write_to_file_net_log_observer_unittest.cc index 6a8280e..ddc8aa9 100644 --- a/net/log/write_to_file_net_log_observer_unittest.cc +++ b/net/log/write_to_file_net_log_observer_unittest.cc @@ -4,6 +4,8 @@ #include "net/log/write_to_file_net_log_observer.h" +#include <utility> + #include "base/files/file_path.h" #include "base/files/file_util.h" #include "base/files/scoped_file.h" @@ -40,7 +42,7 @@ TEST_F(WriteToFileNetLogObserverTest, GeneratesValidJSONForNoEvents) { base::ScopedFILE file(base::OpenFile(log_path_, "w")); ASSERT_TRUE(file); scoped_ptr<WriteToFileNetLogObserver> logger(new WriteToFileNetLogObserver()); - logger->StartObserving(&net_log_, file.Pass(), nullptr, nullptr); + logger->StartObserving(&net_log_, std::move(file), nullptr, nullptr); logger->StopObserving(nullptr); logger.reset(); @@ -65,14 +67,14 @@ TEST_F(WriteToFileNetLogObserverTest, CaptureMode) { base::ScopedFILE file(base::OpenFile(log_path_, "w")); ASSERT_TRUE(file); WriteToFileNetLogObserver logger; - logger.StartObserving(&net_log_, file.Pass(), nullptr, nullptr); + logger.StartObserving(&net_log_, std::move(file), nullptr, nullptr); EXPECT_EQ(NetLogCaptureMode::Default(), logger.capture_mode()); logger.StopObserving(nullptr); file.reset(base::OpenFile(log_path_, "w")); ASSERT_TRUE(file); logger.set_capture_mode(NetLogCaptureMode::IncludeCookiesAndCredentials()); - logger.StartObserving(&net_log_, file.Pass(), nullptr, nullptr); + logger.StartObserving(&net_log_, std::move(file), nullptr, nullptr); EXPECT_EQ(NetLogCaptureMode::IncludeCookiesAndCredentials(), logger.capture_mode()); logger.StopObserving(nullptr); @@ -82,7 +84,7 @@ TEST_F(WriteToFileNetLogObserverTest, GeneratesValidJSONWithOneEvent) { base::ScopedFILE file(base::OpenFile(log_path_, "w")); ASSERT_TRUE(file); scoped_ptr<WriteToFileNetLogObserver> logger(new WriteToFileNetLogObserver()); - logger->StartObserving(&net_log_, file.Pass(), nullptr, nullptr); + logger->StartObserving(&net_log_, std::move(file), nullptr, nullptr); const int kDummyId = 1; NetLog::Source source(NetLog::SOURCE_HTTP2_SESSION, kDummyId); @@ -112,7 +114,7 @@ TEST_F(WriteToFileNetLogObserverTest, GeneratesValidJSONWithMultipleEvents) { base::ScopedFILE file(base::OpenFile(log_path_, "w")); ASSERT_TRUE(file); scoped_ptr<WriteToFileNetLogObserver> logger(new WriteToFileNetLogObserver()); - logger->StartObserving(&net_log_, file.Pass(), nullptr, nullptr); + logger->StartObserving(&net_log_, std::move(file), nullptr, nullptr); const int kDummyId = 1; NetLog::Source source(NetLog::SOURCE_HTTP2_SESSION, kDummyId); @@ -147,7 +149,7 @@ TEST_F(WriteToFileNetLogObserverTest, CustomConstants) { base::ScopedFILE file(base::OpenFile(log_path_, "w")); ASSERT_TRUE(file); scoped_ptr<WriteToFileNetLogObserver> logger(new WriteToFileNetLogObserver()); - logger->StartObserving(&net_log_, file.Pass(), constants.get(), nullptr); + logger->StartObserving(&net_log_, std::move(file), constants.get(), nullptr); logger->StopObserving(nullptr); logger.reset(); @@ -175,7 +177,7 @@ TEST_F(WriteToFileNetLogObserverTest, GeneratesValidJSONWithContext) { base::ScopedFILE file(base::OpenFile(log_path_, "w")); ASSERT_TRUE(file); scoped_ptr<WriteToFileNetLogObserver> logger(new WriteToFileNetLogObserver()); - logger->StartObserving(&net_log_, file.Pass(), nullptr, &context); + logger->StartObserving(&net_log_, std::move(file), nullptr, &context); logger->StopObserving(&context); logger.reset(); @@ -214,7 +216,7 @@ TEST_F(WriteToFileNetLogObserverTest, base::ScopedFILE file(base::OpenFile(log_path_, "w")); ASSERT_TRUE(file); scoped_ptr<WriteToFileNetLogObserver> logger(new WriteToFileNetLogObserver()); - logger->StartObserving(&net_log_, file.Pass(), nullptr, &context); + logger->StartObserving(&net_log_, std::move(file), nullptr, &context); logger->StopObserving(&context); logger.reset(); diff --git a/net/proxy/dhcp_proxy_script_fetcher_factory.cc b/net/proxy/dhcp_proxy_script_fetcher_factory.cc index ab89118..75c0913 100644 --- a/net/proxy/dhcp_proxy_script_fetcher_factory.cc +++ b/net/proxy/dhcp_proxy_script_fetcher_factory.cc @@ -29,7 +29,7 @@ scoped_ptr<DhcpProxyScriptFetcher> DhcpProxyScriptFetcherFactory::Create( ret.reset(new DhcpProxyScriptFetcherWin(context)); #endif DCHECK(ret); - return ret.Pass(); + return ret; } } diff --git a/net/proxy/in_process_mojo_proxy_resolver_factory.cc b/net/proxy/in_process_mojo_proxy_resolver_factory.cc index 3e58b01..5e1574b 100644 --- a/net/proxy/in_process_mojo_proxy_resolver_factory.cc +++ b/net/proxy/in_process_mojo_proxy_resolver_factory.cc @@ -4,6 +4,8 @@ #include "net/proxy/in_process_mojo_proxy_resolver_factory.h" +#include <utility> + #include "base/memory/singleton.h" #include "net/proxy/mojo_proxy_resolver_factory_impl.h" @@ -30,7 +32,7 @@ InProcessMojoProxyResolverFactory::CreateResolver( const mojo::String& pac_script, mojo::InterfaceRequest<interfaces::ProxyResolver> req, interfaces::ProxyResolverFactoryRequestClientPtr client) { - factory_->CreateResolver(pac_script, req.Pass(), client.Pass()); + factory_->CreateResolver(pac_script, std::move(req), std::move(client)); return nullptr; } diff --git a/net/proxy/mock_proxy_resolver.cc b/net/proxy/mock_proxy_resolver.cc index 3bf5314..21cac00 100644 --- a/net/proxy/mock_proxy_resolver.cc +++ b/net/proxy/mock_proxy_resolver.cc @@ -4,6 +4,8 @@ #include "net/proxy/mock_proxy_resolver.h" +#include <utility> + #include "base/logging.h" #include "base/message_loop/message_loop.h" @@ -86,7 +88,7 @@ MockAsyncProxyResolverFactory::Request::~Request() { void MockAsyncProxyResolverFactory::Request::CompleteNow( int rv, scoped_ptr<ProxyResolver> resolver) { - *resolver_ = resolver.Pass(); + *resolver_ = std::move(resolver); // RemovePendingRequest may remove the last external reference to |this|. scoped_refptr<MockAsyncProxyResolverFactory::Request> keep_alive(this); diff --git a/net/proxy/mojo_proxy_resolver_factory_impl.cc b/net/proxy/mojo_proxy_resolver_factory_impl.cc index 3ea3135..49b23ea 100644 --- a/net/proxy/mojo_proxy_resolver_factory_impl.cc +++ b/net/proxy/mojo_proxy_resolver_factory_impl.cc @@ -5,6 +5,7 @@ #include "net/proxy/mojo_proxy_resolver_factory_impl.h" #include <string> +#include <utility> #include "base/macros.h" #include "base/stl_util.h" @@ -38,8 +39,8 @@ class MojoProxyResolverHolder { MojoProxyResolverHolder::MojoProxyResolverHolder( scoped_ptr<ProxyResolverV8Tracing> proxy_resolver_impl, mojo::InterfaceRequest<interfaces::ProxyResolver> request) - : mojo_proxy_resolver_(proxy_resolver_impl.Pass()), - binding_(&mojo_proxy_resolver_, request.Pass()) { + : mojo_proxy_resolver_(std::move(proxy_resolver_impl)), + binding_(&mojo_proxy_resolver_, std::move(request)) { binding_.set_connection_error_handler(base::Bind( &MojoProxyResolverHolder::OnConnectionError, base::Unretained(this))); } @@ -82,9 +83,9 @@ MojoProxyResolverFactoryImpl::Job::Job( mojo::InterfaceRequest<interfaces::ProxyResolver> request, interfaces::ProxyResolverFactoryRequestClientPtr client) : parent_(factory), - proxy_request_(request.Pass()), + proxy_request_(std::move(request)), factory_(proxy_resolver_factory), - client_ptr_(client.Pass()) { + client_ptr_(std::move(client)) { client_ptr_.set_connection_error_handler( base::Bind(&MojoProxyResolverFactoryImpl::Job::OnConnectionError, base::Unretained(this))); @@ -110,8 +111,8 @@ void MojoProxyResolverFactoryImpl::Job::OnProxyResolverCreated(int error) { if (error == OK) { // The MojoProxyResolverHolder will delete itself if |proxy_request_| // encounters a connection error. - new MojoProxyResolverHolder(proxy_resolver_impl_.Pass(), - proxy_request_.Pass()); + new MojoProxyResolverHolder(std::move(proxy_resolver_impl_), + std::move(proxy_request_)); } client_ptr_->ReportResult(error); parent_->RemoveJob(this); @@ -120,15 +121,13 @@ void MojoProxyResolverFactoryImpl::Job::OnProxyResolverCreated(int error) { MojoProxyResolverFactoryImpl::MojoProxyResolverFactoryImpl( scoped_ptr<ProxyResolverV8TracingFactory> proxy_resolver_factory, mojo::InterfaceRequest<interfaces::ProxyResolverFactory> request) - : proxy_resolver_impl_factory_(proxy_resolver_factory.Pass()), - binding_(this, request.Pass()) { -} + : proxy_resolver_impl_factory_(std::move(proxy_resolver_factory)), + binding_(this, std::move(request)) {} MojoProxyResolverFactoryImpl::MojoProxyResolverFactoryImpl( mojo::InterfaceRequest<interfaces::ProxyResolverFactory> request) : MojoProxyResolverFactoryImpl(ProxyResolverV8TracingFactory::Create(), - request.Pass()) { -} + std::move(request)) {} MojoProxyResolverFactoryImpl::~MojoProxyResolverFactoryImpl() { STLDeleteElements(&jobs_); @@ -142,7 +141,8 @@ void MojoProxyResolverFactoryImpl::CreateResolver( // finishes or |request| or |client| encounters a connection error. jobs_.insert(new Job( this, ProxyResolverScriptData::FromUTF8(pac_script.To<std::string>()), - proxy_resolver_impl_factory_.get(), request.Pass(), client.Pass())); + proxy_resolver_impl_factory_.get(), std::move(request), + std::move(client))); } void MojoProxyResolverFactoryImpl::RemoveJob(Job* job) { diff --git a/net/proxy/mojo_proxy_resolver_factory_impl_unittest.cc b/net/proxy/mojo_proxy_resolver_factory_impl_unittest.cc index d8312fa..c7fb51b 100644 --- a/net/proxy/mojo_proxy_resolver_factory_impl_unittest.cc +++ b/net/proxy/mojo_proxy_resolver_factory_impl_unittest.cc @@ -4,6 +4,8 @@ #include "net/proxy/mojo_proxy_resolver_factory_impl.h" +#include <utility> + #include "base/strings/utf_string_conversions.h" #include "mojo/public/cpp/bindings/binding.h" #include "net/base/test_completion_callback.h" @@ -133,7 +135,8 @@ TEST_F(MojoProxyResolverFactoryImplTest, DisconnectProxyResolverClient) { mojo::Binding<ProxyResolverFactoryRequestClient> client_binding( this, mojo::GetProxy(&client_ptr)); factory_->CreateResolver(mojo::String::From(kScriptData), - mojo::GetProxy(&proxy_resolver), client_ptr.Pass()); + mojo::GetProxy(&proxy_resolver), + std::move(client_ptr)); proxy_resolver.set_connection_error_handler( base::Bind(&MojoProxyResolverFactoryImplTest::OnConnectionError, base::Unretained(this))); @@ -160,7 +163,8 @@ TEST_F(MojoProxyResolverFactoryImplTest, Error) { mojo::Binding<ProxyResolverFactoryRequestClient> client_binding( this, mojo::GetProxy(&client_ptr)); factory_->CreateResolver(mojo::String::From(kScriptData), - mojo::GetProxy(&proxy_resolver), client_ptr.Pass()); + mojo::GetProxy(&proxy_resolver), + std::move(client_ptr)); proxy_resolver.set_connection_error_handler( base::Bind(&MojoProxyResolverFactoryImplTest::OnConnectionError, base::Unretained(this))); @@ -181,7 +185,8 @@ TEST_F(MojoProxyResolverFactoryImplTest, mojo::Binding<ProxyResolverFactoryRequestClient> client_binding( this, mojo::GetProxy(&client_ptr)); factory_->CreateResolver(mojo::String::From(kScriptData), - mojo::GetProxy(&proxy_resolver), client_ptr.Pass()); + mojo::GetProxy(&proxy_resolver), + std::move(client_ptr)); proxy_resolver.set_connection_error_handler( base::Bind(&MojoProxyResolverFactoryImplTest::OnConnectionError, base::Unretained(this))); @@ -199,7 +204,8 @@ TEST_F(MojoProxyResolverFactoryImplTest, mojo::Binding<ProxyResolverFactoryRequestClient> client_binding( this, mojo::GetProxy(&client_ptr)); factory_->CreateResolver(mojo::String::From(kScriptData), - mojo::GetProxy(&proxy_resolver), client_ptr.Pass()); + mojo::GetProxy(&proxy_resolver), + std::move(client_ptr)); proxy_resolver.set_connection_error_handler( base::Bind(&MojoProxyResolverFactoryImplTest::OnConnectionError, base::Unretained(this))); diff --git a/net/proxy/mojo_proxy_resolver_impl.cc b/net/proxy/mojo_proxy_resolver_impl.cc index e8c400b..bbac2e72 100644 --- a/net/proxy/mojo_proxy_resolver_impl.cc +++ b/net/proxy/mojo_proxy_resolver_impl.cc @@ -4,6 +4,8 @@ #include "net/proxy/mojo_proxy_resolver_impl.h" +#include <utility> + #include "base/macros.h" #include "base/stl_util.h" #include "mojo/common/url_type_converters.h" @@ -46,8 +48,7 @@ class MojoProxyResolverImpl::Job { MojoProxyResolverImpl::MojoProxyResolverImpl( scoped_ptr<ProxyResolverV8Tracing> resolver) - : resolver_(resolver.Pass()) { -} + : resolver_(std::move(resolver)) {} MojoProxyResolverImpl::~MojoProxyResolverImpl() { STLDeleteElements(&resolve_jobs_); @@ -57,7 +58,7 @@ void MojoProxyResolverImpl::GetProxyForUrl( const mojo::String& url, interfaces::ProxyResolverRequestClientPtr client) { DVLOG(1) << "GetProxyForUrl(" << url << ")"; - Job* job = new Job(client.Pass(), this, url.To<GURL>()); + Job* job = new Job(std::move(client), this, url.To<GURL>()); bool inserted = resolve_jobs_.insert(job).second; DCHECK(inserted); job->Start(); @@ -74,7 +75,7 @@ MojoProxyResolverImpl::Job::Job( MojoProxyResolverImpl* resolver, const GURL& url) : resolver_(resolver), - client_(client.Pass()), + client_(std::move(client)), url_(url), request_handle_(nullptr), done_(false) {} @@ -106,7 +107,7 @@ void MojoProxyResolverImpl::Job::GetProxyDone(int error) { result = mojo::Array<interfaces::ProxyServerPtr>::From( result_.proxy_list().GetAll()); } - client_->ReportResult(error, result.Pass()); + client_->ReportResult(error, std::move(result)); resolver_->DeleteJob(this); } diff --git a/net/proxy/mojo_proxy_resolver_impl_unittest.cc b/net/proxy/mojo_proxy_resolver_impl_unittest.cc index a76c586..b045b27 100644 --- a/net/proxy/mojo_proxy_resolver_impl_unittest.cc +++ b/net/proxy/mojo_proxy_resolver_impl_unittest.cc @@ -5,6 +5,7 @@ #include "net/proxy/mojo_proxy_resolver_impl.h" #include <string> +#include <utility> #include <vector> #include "base/run_loop.h" @@ -60,7 +61,7 @@ class TestRequestClient : public interfaces::ProxyResolverRequestClient { TestRequestClient::TestRequestClient( mojo::InterfaceRequest<interfaces::ProxyResolverRequestClient> request) - : binding_(this, request.Pass()) { + : binding_(this, std::move(request)) { binding_.set_connection_error_handler(base::Bind( &TestRequestClient::OnConnectionError, base::Unretained(this))); } @@ -79,7 +80,7 @@ void TestRequestClient::ReportResult( event_waiter_.NotifyEvent(RESULT_RECEIVED); ASSERT_FALSE(done_); error_ = static_cast<Error>(error); - results_ = results.Pass(); + results_ = std::move(results); done_ = true; } @@ -177,7 +178,7 @@ class MojoProxyResolverImplTest : public testing::Test { scoped_ptr<MockProxyResolverV8Tracing> mock_resolver( new MockProxyResolverV8Tracing); mock_proxy_resolver_ = mock_resolver.get(); - resolver_impl_.reset(new MojoProxyResolverImpl(mock_resolver.Pass())); + resolver_impl_.reset(new MojoProxyResolverImpl(std::move(mock_resolver))); resolver_ = resolver_impl_.get(); } @@ -191,7 +192,7 @@ TEST_F(MojoProxyResolverImplTest, GetProxyForUrl) { interfaces::ProxyResolverRequestClientPtr client_ptr; TestRequestClient client(mojo::GetProxy(&client_ptr)); - resolver_->GetProxyForUrl("http://example.com", client_ptr.Pass()); + resolver_->GetProxyForUrl("http://example.com", std::move(client_ptr)); ASSERT_EQ(1u, mock_proxy_resolver_->pending_requests().size()); const MockProxyResolverV8Tracing::Request& request = mock_proxy_resolver_->pending_requests()[0]; @@ -238,7 +239,7 @@ TEST_F(MojoProxyResolverImplTest, GetProxyForUrlFailure) { interfaces::ProxyResolverRequestClientPtr client_ptr; TestRequestClient client(mojo::GetProxy(&client_ptr)); - resolver_->GetProxyForUrl("http://example.com", client_ptr.Pass()); + resolver_->GetProxyForUrl("http://example.com", std::move(client_ptr)); ASSERT_EQ(1u, mock_proxy_resolver_->pending_requests().size()); const MockProxyResolverV8Tracing::Request& request = mock_proxy_resolver_->pending_requests()[0]; @@ -258,8 +259,8 @@ TEST_F(MojoProxyResolverImplTest, GetProxyForUrlMultiple) { interfaces::ProxyResolverRequestClientPtr client_ptr2; TestRequestClient client2(mojo::GetProxy(&client_ptr2)); - resolver_->GetProxyForUrl("http://example.com", client_ptr1.Pass()); - resolver_->GetProxyForUrl("https://example.com", client_ptr2.Pass()); + resolver_->GetProxyForUrl("http://example.com", std::move(client_ptr1)); + resolver_->GetProxyForUrl("https://example.com", std::move(client_ptr2)); ASSERT_EQ(2u, mock_proxy_resolver_->pending_requests().size()); const MockProxyResolverV8Tracing::Request& request1 = mock_proxy_resolver_->pending_requests()[0]; @@ -298,7 +299,7 @@ TEST_F(MojoProxyResolverImplTest, DestroyClient) { scoped_ptr<TestRequestClient> client( new TestRequestClient(mojo::GetProxy(&client_ptr))); - resolver_->GetProxyForUrl("http://example.com", client_ptr.Pass()); + resolver_->GetProxyForUrl("http://example.com", std::move(client_ptr)); ASSERT_EQ(1u, mock_proxy_resolver_->pending_requests().size()); const MockProxyResolverV8Tracing::Request& request = mock_proxy_resolver_->pending_requests()[0]; @@ -312,7 +313,7 @@ TEST_F(MojoProxyResolverImplTest, DestroyService) { interfaces::ProxyResolverRequestClientPtr client_ptr; TestRequestClient client(mojo::GetProxy(&client_ptr)); - resolver_->GetProxyForUrl("http://example.com", client_ptr.Pass()); + resolver_->GetProxyForUrl("http://example.com", std::move(client_ptr)); ASSERT_EQ(1u, mock_proxy_resolver_->pending_requests().size()); resolver_impl_.reset(); client.event_waiter().WaitForEvent(TestRequestClient::CONNECTION_ERROR); diff --git a/net/proxy/mojo_proxy_resolver_v8_tracing_bindings.h b/net/proxy/mojo_proxy_resolver_v8_tracing_bindings.h index 70ebe3c..e4b84bd 100644 --- a/net/proxy/mojo_proxy_resolver_v8_tracing_bindings.h +++ b/net/proxy/mojo_proxy_resolver_v8_tracing_bindings.h @@ -5,6 +5,8 @@ #ifndef NET_PROXY_MOJO_PROXY_RESOLVER_V8_TRACING_BINDINGS_H_ #define NET_PROXY_MOJO_PROXY_RESOLVER_V8_TRACING_BINDINGS_H_ +#include <utility> + #include "base/threading/thread_checker.h" #include "mojo/common/common_type_converters.h" #include "net/dns/host_resolver_mojo.h" @@ -54,7 +56,7 @@ class MojoProxyResolverV8TracingBindings void ResolveDns(interfaces::HostResolverRequestInfoPtr request_info, interfaces::HostResolverRequestClientPtr client) { DCHECK(thread_checker_.CalledOnValidThread()); - client_->ResolveDns(request_info.Pass(), client.Pass()); + client_->ResolveDns(std::move(request_info), std::move(client)); } base::ThreadChecker thread_checker_; diff --git a/net/proxy/mojo_proxy_type_converters.cc b/net/proxy/mojo_proxy_type_converters.cc index 00aed7a..c927534 100644 --- a/net/proxy/mojo_proxy_type_converters.cc +++ b/net/proxy/mojo_proxy_type_converters.cc @@ -70,7 +70,7 @@ TypeConverter<net::interfaces::ProxyServerPtr, net::ProxyServer>::Convert( server->host = obj.host_port_pair().host(); server->port = obj.host_port_pair().port(); } - return server.Pass(); + return server; } // static diff --git a/net/proxy/multi_threaded_proxy_resolver.cc b/net/proxy/multi_threaded_proxy_resolver.cc index e03eb28..5eae4f7 100644 --- a/net/proxy/multi_threaded_proxy_resolver.cc +++ b/net/proxy/multi_threaded_proxy_resolver.cc @@ -65,7 +65,7 @@ class Executor : public base::RefCountedThreadSafe<Executor> { int thread_number() const { return thread_number_; } void set_resolver(scoped_ptr<ProxyResolver> resolver) { - resolver_ = resolver.Pass(); + resolver_ = std::move(resolver); } void set_coordinator(Coordinator* coordinator) { @@ -262,7 +262,7 @@ class CreateResolverJob : public Job { // The task may have been cancelled after it was started. if (!was_cancelled()) { DCHECK(executor()); - executor()->set_resolver(resolver_.Pass()); + executor()->set_resolver(std::move(resolver_)); } OnJobCompleted(); } @@ -423,7 +423,7 @@ MultiThreadedProxyResolver::MultiThreadedProxyResolver( size_t max_num_threads, const scoped_refptr<ProxyResolverScriptData>& script_data, scoped_refptr<Executor> executor) - : resolver_factory_(resolver_factory.Pass()), + : resolver_factory_(std::move(resolver_factory)), max_num_threads_(max_num_threads), script_data_(script_data) { DCHECK(script_data_); @@ -550,7 +550,7 @@ class MultiThreadedProxyResolverFactory::Job const CompletionCallback& callback) : factory_(factory), resolver_out_(resolver), - resolver_factory_(resolver_factory.Pass()), + resolver_factory_(std::move(resolver_factory)), max_num_threads_(max_num_threads), script_data_(script_data), executor_(new Executor(this, 0)), @@ -620,7 +620,7 @@ int MultiThreadedProxyResolverFactory::CreateProxyResolver( CreateProxyResolverFactory(), max_num_threads_, callback)); jobs_.insert(job.get()); - *request = job.Pass(); + *request = std::move(job); return ERR_IO_PENDING; } diff --git a/net/proxy/multi_threaded_proxy_resolver_unittest.cc b/net/proxy/multi_threaded_proxy_resolver_unittest.cc index 154763a..29e49c3 100644 --- a/net/proxy/multi_threaded_proxy_resolver_unittest.cc +++ b/net/proxy/multi_threaded_proxy_resolver_unittest.cc @@ -4,6 +4,7 @@ #include "net/proxy/multi_threaded_proxy_resolver.h" +#include <utility> #include <vector> #include "base/message_loop/message_loop.h" @@ -179,11 +180,11 @@ class SingleShotMultiThreadedProxyResolverFactory size_t max_num_threads, scoped_ptr<ProxyResolverFactory> factory) : MultiThreadedProxyResolverFactory(max_num_threads, false), - factory_(factory.Pass()) {} + factory_(std::move(factory)) {} scoped_ptr<ProxyResolverFactory> CreateProxyResolverFactory() override { DCHECK(factory_); - return factory_.Pass(); + return std::move(factory_); } private: @@ -197,7 +198,7 @@ class MultiThreadedProxyResolverTest : public testing::Test { new BlockableProxyResolverFactory); factory_ = factory_owner.get(); resolver_factory_.reset(new SingleShotMultiThreadedProxyResolverFactory( - num_threads, factory_owner.Pass())); + num_threads, std::move(factory_owner))); TestCompletionCallback ready_callback; scoped_ptr<ProxyResolverFactory::Request> request; resolver_factory_->CreateProxyResolver( diff --git a/net/proxy/proxy_config.cc b/net/proxy/proxy_config.cc index 2ac6de1..78d6ef3 100644 --- a/net/proxy/proxy_config.cc +++ b/net/proxy/proxy_config.cc @@ -4,9 +4,11 @@ #include "net/proxy/proxy_config.h" +#include <utility> + #include "base/logging.h" -#include "base/strings/string_util.h" #include "base/strings/string_tokenizer.h" +#include "base/strings/string_util.h" #include "base/values.h" #include "net/proxy/proxy_info.h" @@ -258,7 +260,7 @@ scoped_ptr<base::DictionaryValue> ProxyConfig::ToValue() const { AddProxyListToValue("ftp", proxy_rules_.proxies_for_ftp, dict2.get()); AddProxyListToValue("fallback", proxy_rules_.fallback_proxies, dict2.get()); - dict->Set("proxy_per_scheme", dict2.Pass()); + dict->Set("proxy_per_scheme", std::move(dict2)); break; } default: @@ -286,7 +288,7 @@ scoped_ptr<base::DictionaryValue> ProxyConfig::ToValue() const { // Output the source. dict->SetString("source", ProxyConfigSourceToString(source_)); - return dict.Pass(); + return dict; } } // namespace net diff --git a/net/proxy/proxy_list.cc b/net/proxy/proxy_list.cc index 1d24b6d..a7b7aef 100644 --- a/net/proxy/proxy_list.cc +++ b/net/proxy/proxy_list.cc @@ -146,7 +146,7 @@ scoped_ptr<base::ListValue> ProxyList::ToValue() const { scoped_ptr<base::ListValue> list(new base::ListValue()); for (size_t i = 0; i < proxies_.size(); ++i) list->AppendString(proxies_[i].ToURI()); - return list.Pass(); + return list; } bool ProxyList::Fallback(ProxyRetryInfoMap* proxy_retry_info, diff --git a/net/proxy/proxy_resolver_factory_mojo.cc b/net/proxy/proxy_resolver_factory_mojo.cc index d69e76d..4203eea 100644 --- a/net/proxy/proxy_resolver_factory_mojo.cc +++ b/net/proxy/proxy_resolver_factory_mojo.cc @@ -5,6 +5,7 @@ #include "net/proxy/proxy_resolver_factory_mojo.h" #include <set> +#include <utility> #include "base/bind.h" #include "base/logging.h" @@ -37,7 +38,7 @@ scoped_ptr<base::Value> NetLogErrorCallback( scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); dict->SetInteger("line_number", line_number); dict->SetString("message", *message); - return dict.Pass(); + return std::move(dict); } // A mixin that forwards logging to (Bound)NetLog and ProxyResolverErrorObserver @@ -76,7 +77,7 @@ class ClientMixin : public ClientInterface { void ResolveDns(interfaces::HostResolverRequestInfoPtr request_info, interfaces::HostResolverRequestClientPtr client) override { - host_resolver_.Resolve(request_info.Pass(), client.Pass()); + host_resolver_.Resolve(std::move(request_info), std::move(client)); } protected: @@ -202,7 +203,7 @@ ProxyResolverMojo::Job::Job(ProxyResolverMojo* resolver, binding_.set_connection_error_handler(base::Bind( &ProxyResolverMojo::Job::OnConnectionError, base::Unretained(this))); resolver_->mojo_proxy_resolver_ptr_->GetProxyForUrl(mojo::String::From(url_), - client_ptr.Pass()); + std::move(client_ptr)); } ProxyResolverMojo::Job::~Job() { @@ -251,11 +252,11 @@ ProxyResolverMojo::ProxyResolverMojo( scoped_ptr<base::ScopedClosureRunner> on_delete_callback_runner, scoped_ptr<ProxyResolverErrorObserver> error_observer, NetLog* net_log) - : mojo_proxy_resolver_ptr_(resolver_ptr.Pass()), + : mojo_proxy_resolver_ptr_(std::move(resolver_ptr)), host_resolver_(host_resolver), - error_observer_(error_observer.Pass()), + error_observer_(std::move(error_observer)), net_log_(net_log), - on_delete_callback_runner_(on_delete_callback_runner.Pass()) { + on_delete_callback_runner_(std::move(on_delete_callback_runner)) { mojo_proxy_resolver_ptr_.set_connection_error_handler(base::Bind( &ProxyResolverMojo::OnConnectionError, base::Unretained(this))); } @@ -338,12 +339,12 @@ class ProxyResolverFactoryMojo::Job resolver_(resolver), callback_(callback), binding_(this), - error_observer_(error_observer.Pass()) { + error_observer_(std::move(error_observer)) { interfaces::ProxyResolverFactoryRequestClientPtr client_ptr; binding_.Bind(mojo::GetProxy(&client_ptr)); on_delete_callback_runner_ = factory_->mojo_proxy_factory_->CreateResolver( mojo::String::From(pac_script->utf16()), mojo::GetProxy(&resolver_ptr_), - client_ptr.Pass()); + std::move(client_ptr)); resolver_ptr_.set_connection_error_handler( base::Bind(&ProxyResolverFactoryMojo::Job::OnConnectionError, base::Unretained(this))); @@ -359,10 +360,10 @@ class ProxyResolverFactoryMojo::Job resolver_ptr_.set_connection_error_handler(mojo::Closure()); binding_.set_connection_error_handler(mojo::Closure()); if (error == OK) { - resolver_->reset( - new ProxyResolverMojo(resolver_ptr_.Pass(), factory_->host_resolver_, - on_delete_callback_runner_.Pass(), - error_observer_.Pass(), factory_->net_log_)); + resolver_->reset(new ProxyResolverMojo( + std::move(resolver_ptr_), factory_->host_resolver_, + std::move(on_delete_callback_runner_), std::move(error_observer_), + factory_->net_log_)); } on_delete_callback_runner_.reset(); callback_.Run(error); diff --git a/net/proxy/proxy_resolver_factory_mojo_unittest.cc b/net/proxy/proxy_resolver_factory_mojo_unittest.cc index 27d371e..9fa4ef5 100644 --- a/net/proxy/proxy_resolver_factory_mojo_unittest.cc +++ b/net/proxy/proxy_resolver_factory_mojo_unittest.cc @@ -8,6 +8,7 @@ #include <map> #include <queue> #include <string> +#include <utility> #include <vector> #include "base/bind.h" @@ -238,7 +239,7 @@ void MockMojoProxyResolver::AddConnection( mojo::InterfaceRequest<interfaces::ProxyResolver> req) { if (binding_.is_bound()) binding_.Close(); - binding_.Bind(req.Pass()); + binding_.Bind(std::move(req)); } void MockMojoProxyResolver::GetProxyForUrl( @@ -253,7 +254,7 @@ void MockMojoProxyResolver::GetProxyForUrl( client->OnError(12345, url); switch (action.action) { case GetProxyForUrlAction::COMPLETE: { - client->ReportResult(action.error, action.proxy_servers.Pass()); + client->ReportResult(action.error, std::move(action.proxy_servers)); break; } case GetProxyForUrlAction::DROP: { @@ -275,7 +276,7 @@ void MockMojoProxyResolver::GetProxyForUrl( request->port = 12345; interfaces::HostResolverRequestClientPtr dns_client; mojo::GetProxy(&dns_client); - client->ResolveDns(request.Pass(), dns_client.Pass()); + client->ResolveDns(std::move(request), std::move(dns_client)); blocked_clients_.push_back(make_scoped_ptr( new interfaces::ProxyResolverRequestClientPtr(std::move(client)))); break; @@ -362,8 +363,7 @@ class MockMojoProxyResolverFactory : public interfaces::ProxyResolverFactory { MockMojoProxyResolverFactory::MockMojoProxyResolverFactory( MockMojoProxyResolver* resolver, mojo::InterfaceRequest<interfaces::ProxyResolverFactory> req) - : resolver_(resolver), binding_(this, req.Pass()) { -} + : resolver_(resolver), binding_(this, std::move(req)) {} MockMojoProxyResolverFactory::~MockMojoProxyResolverFactory() { EXPECT_TRUE(create_resolver_actions_.empty()) @@ -405,7 +405,7 @@ void MockMojoProxyResolverFactory::CreateResolver( switch (action.action) { case CreateProxyResolverAction::COMPLETE: { if (action.error == OK) - resolver_->AddConnection(request.Pass()); + resolver_->AddConnection(std::move(request)); client->ReportResult(action.error); break; } @@ -438,7 +438,7 @@ void MockMojoProxyResolverFactory::CreateResolver( request->port = 12345; interfaces::HostResolverRequestClientPtr dns_client; mojo::GetProxy(&dns_client); - client->ResolveDns(request.Pass(), std::move(dns_client)); + client->ResolveDns(std::move(request), std::move(dns_client)); blocked_clients_.push_back( make_scoped_ptr(new interfaces::ProxyResolverFactoryRequestClientPtr( std::move(client)))); @@ -526,7 +526,7 @@ class ProxyResolverFactoryMojoTest : public testing::Test, const mojo::String& pac_script, mojo::InterfaceRequest<interfaces::ProxyResolver> req, interfaces::ProxyResolverFactoryRequestClientPtr client) override { - factory_ptr_->CreateResolver(pac_script, req.Pass(), client.Pass()); + factory_ptr_->CreateResolver(pac_script, std::move(req), std::move(client)); return make_scoped_ptr( new base::ScopedClosureRunner(on_delete_callback_.closure())); } diff --git a/net/proxy/proxy_resolver_perftest.cc b/net/proxy/proxy_resolver_perftest.cc index 6b8501c..7aae5b2 100644 --- a/net/proxy/proxy_resolver_perftest.cc +++ b/net/proxy/proxy_resolver_perftest.cc @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include <utility> + #include "base/base_paths.h" #include "base/compiler_specific.h" #include "base/files/file_util.h" @@ -227,7 +229,7 @@ class ProxyResolverV8Wrapper : public ProxyResolver { public: ProxyResolverV8Wrapper(scoped_ptr<ProxyResolverV8> resolver, scoped_ptr<MockJSBindings> bindings) - : resolver_(resolver.Pass()), bindings_(bindings.Pass()) {} + : resolver_(std::move(resolver)), bindings_(std::move(bindings)) {} int GetProxyForURL(const GURL& url, ProxyInfo* results, @@ -264,8 +266,8 @@ class ProxyResolverV8Factory : public ProxyResolverFactory { int result = ProxyResolverV8::Create(pac_script, js_bindings_.get(), &v8_resolver); if (result == OK) { - resolver->reset( - new ProxyResolverV8Wrapper(v8_resolver.Pass(), js_bindings_.Pass())); + resolver->reset(new ProxyResolverV8Wrapper(std::move(v8_resolver), + std::move(js_bindings_))); } return result; } diff --git a/net/proxy/proxy_resolver_v8.cc b/net/proxy/proxy_resolver_v8.cc index f386e1b..97fb166 100644 --- a/net/proxy/proxy_resolver_v8.cc +++ b/net/proxy/proxy_resolver_v8.cc @@ -6,6 +6,7 @@ #include <algorithm> #include <cstdio> +#include <utility> #include "base/auto_reset.h" #include "base/compiler_specific.h" @@ -826,7 +827,7 @@ class ProxyResolverV8::Context { // ProxyResolverV8 ------------------------------------------------------------ ProxyResolverV8::ProxyResolverV8(scoped_ptr<Context> context) - : context_(context.Pass()) { + : context_(std::move(context)) { DCHECK(context_); } @@ -854,7 +855,7 @@ int ProxyResolverV8::Create( new Context(g_isolate_factory.Get().GetSharedIsolate())); int rv = context->InitV8(script_data, js_bindings); if (rv == OK) - resolver->reset(new ProxyResolverV8(context.Pass())); + resolver->reset(new ProxyResolverV8(std::move(context))); return rv; } diff --git a/net/proxy/proxy_resolver_v8_tracing.cc b/net/proxy/proxy_resolver_v8_tracing.cc index 00b59e2..94ad9f0 100644 --- a/net/proxy/proxy_resolver_v8_tracing.cc +++ b/net/proxy/proxy_resolver_v8_tracing.cc @@ -6,6 +6,7 @@ #include <map> #include <string> +#include <utility> #include <vector> #include "base/bind.h" @@ -332,7 +333,7 @@ Job::Job(const Job::Params* params, scoped_ptr<ProxyResolverV8Tracing::Bindings> bindings) : origin_runner_(base::ThreadTaskRunnerHandle::Get()), params_(params), - bindings_(bindings.Pass()), + bindings_(std::move(bindings)), event_(true, false), last_num_dns_(0), pending_dns_(NULL) { @@ -554,7 +555,7 @@ int Job::ExecuteProxyResolver() { scoped_ptr<ProxyResolverV8> resolver; result = ProxyResolverV8::Create(script_data_, this, &resolver); if (result == OK) - *resolver_out_ = resolver.Pass(); + *resolver_out_ = std::move(resolver); break; } case GET_PROXY_FOR_URL: { @@ -917,9 +918,9 @@ ProxyResolverV8TracingImpl::ProxyResolverV8TracingImpl( scoped_ptr<base::Thread> thread, scoped_ptr<ProxyResolverV8> resolver, scoped_ptr<Job::Params> job_params) - : thread_(thread.Pass()), - v8_resolver_(resolver.Pass()), - job_params_(job_params.Pass()), + : thread_(std::move(thread)), + v8_resolver_(std::move(resolver)), + job_params_(std::move(job_params)), num_outstanding_callbacks_(0) { job_params_->num_outstanding_callbacks = &num_outstanding_callbacks_; } @@ -942,7 +943,7 @@ void ProxyResolverV8TracingImpl::GetProxyForURL( DCHECK(CalledOnValidThread()); DCHECK(!callback.is_null()); - scoped_refptr<Job> job = new Job(job_params_.get(), bindings.Pass()); + scoped_refptr<Job> job = new Job(job_params_.get(), std::move(bindings)); if (request) *request = job.get(); @@ -1003,7 +1004,7 @@ class ProxyResolverV8TracingFactoryImpl::CreateJob CHECK(thread_->StartWithOptions(options)); job_params_.reset( new Job::Params(thread_->task_runner(), &num_outstanding_callbacks_)); - create_resolver_job_ = new Job(job_params_.get(), bindings.Pass()); + create_resolver_job_ = new Job(job_params_.get(), std::move(bindings)); create_resolver_job_->StartCreateV8Resolver( pac_script, &v8_resolver_, base::Bind( @@ -1034,7 +1035,7 @@ class ProxyResolverV8TracingFactoryImpl::CreateJob if (error == OK) { job_params_->v8_resolver = v8_resolver_.get(); resolver_out_->reset(new ProxyResolverV8TracingImpl( - thread_.Pass(), v8_resolver_.Pass(), job_params_.Pass())); + std::move(thread_), std::move(v8_resolver_), std::move(job_params_))); } else { StopWorkerThread(); } @@ -1079,9 +1080,9 @@ void ProxyResolverV8TracingFactoryImpl::CreateProxyResolverV8Tracing( const CompletionCallback& callback, scoped_ptr<ProxyResolverFactory::Request>* request) { scoped_ptr<CreateJob> job( - new CreateJob(this, bindings.Pass(), pac_script, resolver, callback)); + new CreateJob(this, std::move(bindings), pac_script, resolver, callback)); jobs_.insert(job.get()); - *request = job.Pass(); + *request = std::move(job); } void ProxyResolverV8TracingFactoryImpl::RemoveJob( diff --git a/net/proxy/proxy_resolver_v8_tracing_unittest.cc b/net/proxy/proxy_resolver_v8_tracing_unittest.cc index fbca99f..888dd18 100644 --- a/net/proxy/proxy_resolver_v8_tracing_unittest.cc +++ b/net/proxy/proxy_resolver_v8_tracing_unittest.cc @@ -5,6 +5,7 @@ #include "net/proxy/proxy_resolver_v8_tracing.h" #include <string> +#include <utility> #include "base/files/file_util.h" #include "base/path_service.h" @@ -142,11 +143,11 @@ scoped_ptr<ProxyResolverV8Tracing> CreateResolver( TestCompletionCallback callback; scoped_ptr<ProxyResolverFactory::Request> request; factory->CreateProxyResolverV8Tracing(LoadScriptData(filename), - bindings.Pass(), &resolver, + std::move(bindings), &resolver, callback.callback(), &request); EXPECT_EQ(OK, callback.WaitForResult()); EXPECT_TRUE(resolver); - return resolver.Pass(); + return resolver; } TEST_F(ProxyResolverV8TracingTest, Simple) { diff --git a/net/proxy/proxy_resolver_v8_tracing_wrapper.cc b/net/proxy/proxy_resolver_v8_tracing_wrapper.cc index fa06298..25144b6 100644 --- a/net/proxy/proxy_resolver_v8_tracing_wrapper.cc +++ b/net/proxy/proxy_resolver_v8_tracing_wrapper.cc @@ -5,6 +5,7 @@ #include "net/proxy/proxy_resolver_v8_tracing_wrapper.h" #include <string> +#include <utility> #include "base/bind.h" #include "base/macros.h" @@ -24,7 +25,7 @@ scoped_ptr<base::Value> NetLogErrorCallback( scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); dict->SetInteger("line_number", line_number); dict->SetString("message", *message); - return dict.Pass(); + return std::move(dict); } class BindingsImpl : public ProxyResolverV8Tracing::Bindings { @@ -108,11 +109,10 @@ ProxyResolverV8TracingWrapper::ProxyResolverV8TracingWrapper( NetLog* net_log, HostResolver* host_resolver, scoped_ptr<ProxyResolverErrorObserver> error_observer) - : resolver_impl_(resolver_impl.Pass()), + : resolver_impl_(std::move(resolver_impl)), net_log_(net_log), host_resolver_(host_resolver), - error_observer_(error_observer.Pass()) { -} + error_observer_(std::move(error_observer)) {} int ProxyResolverV8TracingWrapper::GetProxyForURL( const GURL& url, @@ -186,7 +186,8 @@ void ProxyResolverFactoryV8TracingWrapper::OnProxyResolverCreated( int error) { if (error == OK) { resolver->reset(new ProxyResolverV8TracingWrapper( - v8_resolver->Pass(), net_log_, host_resolver_, error_observer.Pass())); + std::move(*v8_resolver), net_log_, host_resolver_, + std::move(error_observer))); } callback.Run(error); } diff --git a/net/proxy/proxy_resolver_v8_tracing_wrapper_unittest.cc b/net/proxy/proxy_resolver_v8_tracing_wrapper_unittest.cc index fdb823e..946d4bf 100644 --- a/net/proxy/proxy_resolver_v8_tracing_wrapper_unittest.cc +++ b/net/proxy/proxy_resolver_v8_tracing_wrapper_unittest.cc @@ -84,7 +84,7 @@ scoped_ptr<ProxyResolver> CreateResolver( EXPECT_EQ(ERR_IO_PENDING, rv); EXPECT_EQ(OK, callback.WaitForResult()); EXPECT_TRUE(resolver); - return resolver.Pass(); + return resolver; } class MockErrorObserver : public ProxyResolverErrorObserver { diff --git a/net/proxy/proxy_script_decider.cc b/net/proxy/proxy_script_decider.cc index f30c162a..d131725 100644 --- a/net/proxy/proxy_script_decider.cc +++ b/net/proxy/proxy_script_decider.cc @@ -4,6 +4,8 @@ #include "net/proxy/proxy_script_decider.h" +#include <utility> + #include "base/bind.h" #include "base/bind_helpers.h" #include "base/compiler_specific.h" @@ -72,7 +74,7 @@ scoped_ptr<base::Value> ProxyScriptDecider::PacSource::NetLogCallback( break; } dict->SetString("source", source); - return dict.Pass(); + return std::move(dict); } ProxyScriptDecider::ProxyScriptDecider( diff --git a/net/proxy/proxy_script_fetcher_impl_unittest.cc b/net/proxy/proxy_script_fetcher_impl_unittest.cc index ecbe3fd..a230ab3 100644 --- a/net/proxy/proxy_script_fetcher_impl_unittest.cc +++ b/net/proxy/proxy_script_fetcher_impl_unittest.cc @@ -5,6 +5,7 @@ #include "net/proxy/proxy_script_fetcher_impl.h" #include <string> +#include <utility> #include "base/compiler_specific.h" #include "base/files/file_path.h" @@ -89,7 +90,7 @@ class RequestContext : public URLRequestContext { make_scoped_ptr(new FileProtocolHandler( base::ThreadTaskRunnerHandle::Get()))); #endif - storage_.set_job_factory(job_factory.Pass()); + storage_.set_job_factory(std::move(job_factory)); } ~RequestContext() override { AssertNoURLRequests(); } diff --git a/net/proxy/proxy_service.cc b/net/proxy/proxy_service.cc index 47cf452..2c30f74 100644 --- a/net/proxy/proxy_service.cc +++ b/net/proxy/proxy_service.cc @@ -5,6 +5,7 @@ #include "net/proxy/proxy_service.h" #include <algorithm> +#include <utility> #include "base/bind.h" #include "base/bind_helpers.h" @@ -303,7 +304,7 @@ scoped_ptr<base::Value> NetLogProxyConfigChangedCallback( if (old_config->is_valid()) dict->Set("old_config", old_config->ToValue()); dict->Set("new_config", new_config->ToValue()); - return dict.Pass(); + return std::move(dict); } scoped_ptr<base::Value> NetLogBadProxyListCallback( @@ -317,7 +318,7 @@ scoped_ptr<base::Value> NetLogBadProxyListCallback( list->Append(new base::StringValue(iter->first)); } dict->Set("bad_proxy_list", list); - return dict.Pass(); + return std::move(dict); } // Returns NetLog parameters on a successfuly proxy resolution. @@ -326,7 +327,7 @@ scoped_ptr<base::Value> NetLogFinishedResolvingProxyCallback( NetLogCaptureMode /* capture_mode */) { scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); dict->SetString("pac_string", result->ToPacString()); - return dict.Pass(); + return std::move(dict); } #if defined(OS_CHROMEOS) @@ -923,7 +924,7 @@ class ProxyService::PacRequest ProxyService::ProxyService(scoped_ptr<ProxyConfigService> config_service, scoped_ptr<ProxyResolverFactory> resolver_factory, NetLog* net_log) - : resolver_factory_(resolver_factory.Pass()), + : resolver_factory_(std::move(resolver_factory)), next_config_id_(1), current_state_(STATE_NONE), net_log_(net_log), @@ -932,7 +933,7 @@ ProxyService::ProxyService(scoped_ptr<ProxyConfigService> config_service, quick_check_enabled_(true) { NetworkChangeNotifier::AddIPAddressObserver(this); NetworkChangeNotifier::AddDNSObserver(this); - ResetConfigService(config_service.Pass()); + ResetConfigService(std::move(config_service)); } // static @@ -944,14 +945,14 @@ scoped_ptr<ProxyService> ProxyService::CreateUsingSystemProxyResolver( if (!ProxyResolverFactoryForSystem::IsSupported()) { VLOG(1) << "PAC support disabled because there is no system implementation"; - return CreateWithoutProxyResolver(proxy_config_service.Pass(), net_log); + return CreateWithoutProxyResolver(std::move(proxy_config_service), net_log); } if (num_pac_threads == 0) num_pac_threads = kDefaultNumPacThreads; return make_scoped_ptr(new ProxyService( - proxy_config_service.Pass(), + std::move(proxy_config_service), make_scoped_ptr(new ProxyResolverFactoryForSystem(num_pac_threads)), net_log)); } @@ -961,7 +962,7 @@ scoped_ptr<ProxyService> ProxyService::CreateWithoutProxyResolver( scoped_ptr<ProxyConfigService> proxy_config_service, NetLog* net_log) { return make_scoped_ptr(new ProxyService( - proxy_config_service.Pass(), + std::move(proxy_config_service), make_scoped_ptr(new ProxyResolverFactoryForNullResolver), net_log)); } @@ -1001,7 +1002,7 @@ scoped_ptr<ProxyService> ProxyService::CreateFixedFromPacResult( new ProxyConfigServiceFixed(ProxyConfig::CreateAutoDetect())); return make_scoped_ptr(new ProxyService( - proxy_config_service.Pass(), + std::move(proxy_config_service), make_scoped_ptr(new ProxyResolverFactoryForPacResult(pac_string)), NULL)); } @@ -1446,7 +1447,7 @@ void ProxyService::SetProxyScriptFetchers( DCHECK(CalledOnValidThread()); State previous_state = ResetProxyConfig(false); proxy_script_fetcher_.reset(proxy_script_fetcher); - dhcp_proxy_script_fetcher_ = dhcp_proxy_script_fetcher.Pass(); + dhcp_proxy_script_fetcher_ = std::move(dhcp_proxy_script_fetcher); if (previous_state != STATE_NONE) ApplyProxyConfigIfAvailable(); } @@ -1484,7 +1485,7 @@ void ProxyService::ResetConfigService( config_service_->RemoveObserver(this); // Set the new configuration service. - config_service_ = new_proxy_config_service.Pass(); + config_service_ = std::move(new_proxy_config_service); config_service_->AddObserver(this); if (previous_state != STATE_NONE) @@ -1529,7 +1530,7 @@ scoped_ptr<ProxyConfigService> ProxyService::CreateSystemProxyConfigService( linux_config_service->SetupAndFetchInitialConfig( glib_thread_task_runner, io_task_runner, file_task_runner); - return linux_config_service.Pass(); + return std::move(linux_config_service); #elif defined(OS_ANDROID) return make_scoped_ptr(new ProxyConfigServiceAndroid( io_task_runner, base::ThreadTaskRunnerHandle::Get())); diff --git a/net/proxy/proxy_service_mojo.cc b/net/proxy/proxy_service_mojo.cc index b7910ad..41bbc3c 100644 --- a/net/proxy/proxy_service_mojo.cc +++ b/net/proxy/proxy_service_mojo.cc @@ -4,6 +4,8 @@ #include "net/proxy/proxy_service_mojo.h" +#include <utility> + #include "base/logging.h" #include "base/memory/scoped_ptr.h" #include "base/thread_task_runner_handle.h" @@ -34,7 +36,7 @@ scoped_ptr<ProxyService> CreateProxyServiceUsingMojoFactory( DCHECK(host_resolver); scoped_ptr<ProxyService> proxy_service(new ProxyService( - proxy_config_service.Pass(), + std::move(proxy_config_service), make_scoped_ptr(new ProxyResolverFactoryMojo( mojo_proxy_factory, host_resolver, base::Bind(&NetworkDelegateErrorObserver::Create, network_delegate, @@ -44,7 +46,7 @@ scoped_ptr<ProxyService> CreateProxyServiceUsingMojoFactory( // Configure fetchers to use for PAC script downloads and auto-detect. proxy_service->SetProxyScriptFetchers(proxy_script_fetcher, - dhcp_proxy_script_fetcher.Pass()); + std::move(dhcp_proxy_script_fetcher)); return proxy_service; } @@ -58,8 +60,8 @@ scoped_ptr<ProxyService> CreateProxyServiceUsingMojoInProcess( NetworkDelegate* network_delegate) { return CreateProxyServiceUsingMojoFactory( InProcessMojoProxyResolverFactory::GetInstance(), - proxy_config_service.Pass(), proxy_script_fetcher, - dhcp_proxy_script_fetcher.Pass(), host_resolver, net_log, + std::move(proxy_config_service), proxy_script_fetcher, + std::move(dhcp_proxy_script_fetcher), host_resolver, net_log, network_delegate); } diff --git a/net/proxy/proxy_service_mojo_unittest.cc b/net/proxy/proxy_service_mojo_unittest.cc index 45beba4..5dd94b0 100644 --- a/net/proxy/proxy_service_mojo_unittest.cc +++ b/net/proxy/proxy_service_mojo_unittest.cc @@ -6,6 +6,7 @@ #include <algorithm> #include <string> +#include <utility> #include "base/callback_helpers.h" #include "base/memory/scoped_ptr.h" @@ -138,7 +139,7 @@ class ProxyServiceMojoTest : public testing::Test, mojo::InterfaceRequest<interfaces::ProxyResolver> req, interfaces::ProxyResolverFactoryRequestClientPtr client) override { InProcessMojoProxyResolverFactory::GetInstance()->CreateResolver( - pac_script, req.Pass(), client.Pass()); + pac_script, std::move(req), std::move(client)); return make_scoped_ptr( new base::ScopedClosureRunner(on_delete_closure_.closure())); } diff --git a/net/proxy/proxy_service_v8.cc b/net/proxy/proxy_service_v8.cc index 358a244..4c34492 100644 --- a/net/proxy/proxy_service_v8.cc +++ b/net/proxy/proxy_service_v8.cc @@ -4,6 +4,8 @@ #include "net/proxy/proxy_service_v8.h" +#include <utility> + #include "base/logging.h" #include "base/memory/scoped_ptr.h" #include "base/thread_task_runner_handle.h" @@ -30,7 +32,7 @@ scoped_ptr<ProxyService> CreateProxyServiceUsingV8ProxyResolver( DCHECK(host_resolver); scoped_ptr<ProxyService> proxy_service(new ProxyService( - proxy_config_service.Pass(), + std::move(proxy_config_service), make_scoped_ptr(new ProxyResolverFactoryV8TracingWrapper( host_resolver, net_log, base::Bind(&NetworkDelegateErrorObserver::Create, network_delegate, @@ -39,7 +41,7 @@ scoped_ptr<ProxyService> CreateProxyServiceUsingV8ProxyResolver( // Configure fetchers to use for PAC script downloads and auto-detect. proxy_service->SetProxyScriptFetchers(proxy_script_fetcher, - dhcp_proxy_script_fetcher.Pass()); + std::move(dhcp_proxy_script_fetcher)); return proxy_service; } diff --git a/net/quic/crypto/channel_id_chromium.cc b/net/quic/crypto/channel_id_chromium.cc index ffcb67b..3f50b76 100644 --- a/net/quic/crypto/channel_id_chromium.cc +++ b/net/quic/crypto/channel_id_chromium.cc @@ -5,6 +5,7 @@ #include "net/quic/crypto/channel_id_chromium.h" #include <string> +#include <utility> #include "base/macros.h" #include "base/stl_util.h" @@ -195,7 +196,7 @@ int ChannelIDSourceChromium::Job::DoGetChannelIDKeyComplete(int result) { return ERR_UNEXPECTED; } channel_id_key_.reset( - new ChannelIDKeyChromium(channel_id_crypto_key_.Pass())); + new ChannelIDKeyChromium(std::move(channel_id_crypto_key_))); return result; } diff --git a/net/quic/crypto/proof_verifier_chromium.cc b/net/quic/crypto/proof_verifier_chromium.cc index fa8b8c5..d7ee393 100644 --- a/net/quic/crypto/proof_verifier_chromium.cc +++ b/net/quic/crypto/proof_verifier_chromium.cc @@ -4,6 +4,8 @@ #include "net/quic/crypto/proof_verifier_chromium.h" +#include <utility> + #include "base/bind.h" #include "base/bind_helpers.h" #include "base/callback_helpers.h" @@ -176,7 +178,7 @@ QuicAsyncStatus ProofVerifierChromium::Job::VerifyProof( *error_details = "Failed to create certificate chain. Certs are empty."; DLOG(WARNING) << *error_details; verify_details_->cert_verify_result.cert_status = CERT_STATUS_INVALID; - *verify_details = verify_details_.Pass(); + *verify_details = std::move(verify_details_); return QUIC_FAILURE; } @@ -190,7 +192,7 @@ QuicAsyncStatus ProofVerifierChromium::Job::VerifyProof( *error_details = "Failed to create certificate chain"; DLOG(WARNING) << *error_details; verify_details_->cert_verify_result.cert_status = CERT_STATUS_INVALID; - *verify_details = verify_details_.Pass(); + *verify_details = std::move(verify_details_); return QUIC_FAILURE; } @@ -209,7 +211,7 @@ QuicAsyncStatus ProofVerifierChromium::Job::VerifyProof( *error_details = "Failed to verify signature of server config"; DLOG(WARNING) << *error_details; verify_details_->cert_verify_result.cert_status = CERT_STATUS_INVALID; - *verify_details = verify_details_.Pass(); + *verify_details = std::move(verify_details_); return QUIC_FAILURE; } @@ -218,14 +220,14 @@ QuicAsyncStatus ProofVerifierChromium::Job::VerifyProof( next_state_ = STATE_VERIFY_CERT; switch (DoLoop(OK)) { case OK: - *verify_details = verify_details_.Pass(); + *verify_details = std::move(verify_details_); return QUIC_SUCCESS; case ERR_IO_PENDING: callback_.reset(callback); return QUIC_PENDING; default: *error_details = error_details_; - *verify_details = verify_details_.Pass(); + *verify_details = std::move(verify_details_); return QUIC_FAILURE; } } @@ -256,9 +258,9 @@ int ProofVerifierChromium::Job::DoLoop(int last_result) { void ProofVerifierChromium::Job::OnIOComplete(int result) { int rv = DoLoop(result); if (rv != ERR_IO_PENDING) { - scoped_ptr<ProofVerifierCallback> callback(callback_.Pass()); + scoped_ptr<ProofVerifierCallback> callback(std::move(callback_)); // Callback expects ProofVerifyDetails not ProofVerifyDetailsChromium. - scoped_ptr<ProofVerifyDetails> verify_details(verify_details_.Pass()); + scoped_ptr<ProofVerifyDetails> verify_details(std::move(verify_details_)); callback->Run(rv == OK, error_details_, &verify_details); // Will delete |this|. proof_verifier_->OnJobComplete(this); diff --git a/net/quic/p2p/quic_p2p_session.cc b/net/quic/p2p/quic_p2p_session.cc index 1177105..e326a01 100644 --- a/net/quic/p2p/quic_p2p_session.cc +++ b/net/quic/p2p/quic_p2p_session.cc @@ -4,6 +4,8 @@ #include "net/quic/p2p/quic_p2p_session.h" +#include <utility> + #include "base/callback_helpers.h" #include "net/base/io_buffer.h" #include "net/base/net_errors.h" @@ -19,7 +21,7 @@ QuicP2PSession::QuicP2PSession(const QuicConfig& config, scoped_ptr<QuicConnection> connection, scoped_ptr<net::Socket> socket) : QuicSession(connection.release(), config), - socket_(socket.Pass()), + socket_(std::move(socket)), crypto_stream_(new QuicP2PCryptoStream(this, crypto_config)), read_buffer_(new net::IOBuffer(static_cast<size_t>(kMaxPacketSize))) { DCHECK(config.negotiated()); diff --git a/net/quic/p2p/quic_p2p_session_test.cc b/net/quic/p2p/quic_p2p_session_test.cc index 3c029ea..b5f632f 100644 --- a/net/quic/p2p/quic_p2p_session_test.cc +++ b/net/quic/p2p/quic_p2p_session_test.cc @@ -4,6 +4,8 @@ #include "net/quic/p2p/quic_p2p_session.h" +#include <utility> + #include "base/callback_helpers.h" #include "base/location.h" #include "base/macros.h" @@ -230,10 +232,10 @@ class QuicP2PSessionTest : public ::testing::Test { QuicP2PCryptoConfig crypto_config(kTestSharedKey); - session1_ = - CreateP2PSession(socket1.Pass(), crypto_config, Perspective::IS_SERVER); - session2_ = - CreateP2PSession(socket2.Pass(), crypto_config, Perspective::IS_CLIENT); + session1_ = CreateP2PSession(std::move(socket1), crypto_config, + Perspective::IS_SERVER); + session2_ = CreateP2PSession(std::move(socket2), crypto_config, + Perspective::IS_CLIENT); } scoped_ptr<QuicP2PSession> CreateP2PSession(scoped_ptr<Socket> socket, @@ -245,10 +247,11 @@ class QuicP2PSessionTest : public ::testing::Test { 0, net::IPEndPoint(ip, 0), &quic_helper_, writer_factory, true /* owns_writer */, perspective, QuicSupportedVersions())); - scoped_ptr<QuicP2PSession> result(new QuicP2PSession( - config_, crypto_config, quic_connection1.Pass(), socket.Pass())); + scoped_ptr<QuicP2PSession> result( + new QuicP2PSession(config_, crypto_config, std::move(quic_connection1), + std::move(socket))); result->Initialize(); - return result.Pass(); + return result; } void TestStreamConnection(QuicP2PSession* from_session, diff --git a/net/quic/quic_chromium_client_session.cc b/net/quic/quic_chromium_client_session.cc index a46c57c1..12e34c8 100644 --- a/net/quic/quic_chromium_client_session.cc +++ b/net/quic/quic_chromium_client_session.cc @@ -4,6 +4,8 @@ #include "net/quic/quic_chromium_client_session.h" +#include <utility> + #include "base/callback_helpers.h" #include "base/location.h" #include "base/metrics/histogram_macros.h" @@ -110,7 +112,7 @@ scoped_ptr<base::Value> NetLogQuicClientSessionCallback( server_id->privacy_mode() == PRIVACY_MODE_ENABLED); dict->SetBoolean("require_confirmation", require_confirmation); dict->SetInteger("cert_verify_flags", cert_verify_flags); - return dict.Pass(); + return std::move(dict); } } // namespace @@ -178,9 +180,9 @@ QuicChromiumClientSession::QuicChromiumClientSession( server_id_(server_id), require_confirmation_(false), stream_factory_(stream_factory), - socket_(socket.Pass()), + socket_(std::move(socket)), transport_security_state_(transport_security_state), - server_info_(server_info.Pass()), + server_info_(std::move(server_info)), num_total_streams_(0), task_runner_(task_runner), net_log_(BoundNetLog::Make(net_log, NetLog::SOURCE_QUIC_SESSION)), @@ -193,7 +195,7 @@ QuicChromiumClientSession::QuicChromiumClientSession( dns_resolution_end_time_(dns_resolution_end_time), logger_(new QuicConnectionLogger(this, connection_description, - socket_performance_watcher.Pass(), + std::move(socket_performance_watcher), net_log_)), going_away_(false), disabled_reason_(QUIC_DISABLED_NOT), @@ -814,7 +816,7 @@ void QuicChromiumClientSession::OnProofVerifyDetailsAvailable( pinning_failure_log_ = verify_details_chromium->pinning_failure_log; scoped_ptr<ct::CTVerifyResult> ct_verify_result_copy( new ct::CTVerifyResult(verify_details_chromium->ct_verify_result)); - ct_verify_result_ = ct_verify_result_copy.Pass(); + ct_verify_result_ = std::move(ct_verify_result_copy); logger_->OnCertificateVerified(*cert_verify_result_); } @@ -887,7 +889,7 @@ scoped_ptr<base::Value> QuicChromiumClientSession::GetInfoAsValue( stream_list->Append( new base::StringValue(base::UintToString(it->second->id()))); } - dict->Set("active_streams", stream_list.Pass()); + dict->Set("active_streams", std::move(stream_list)); dict->SetInteger("total_streams", num_total_streams_); dict->SetString("peer_address", peer_address().ToString()); @@ -905,9 +907,9 @@ scoped_ptr<base::Value> QuicChromiumClientSession::GetInfoAsValue( it != aliases.end(); it++) { alias_list->Append(new base::StringValue(it->ToString())); } - dict->Set("aliases", alias_list.Pass()); + dict->Set("aliases", std::move(alias_list)); - return dict.Pass(); + return std::move(dict); } base::WeakPtr<QuicChromiumClientSession> diff --git a/net/quic/quic_chromium_client_session_test.cc b/net/quic/quic_chromium_client_session_test.cc index 113e998..38dd849 100644 --- a/net/quic/quic_chromium_client_session_test.cc +++ b/net/quic/quic_chromium_client_session_test.cc @@ -54,7 +54,7 @@ class QuicChromiumClientSessionTest SupportedVersions(GetParam()))), session_( connection_, - GetSocket().Pass(), + GetSocket(), /*stream_factory=*/nullptr, /*crypto_client_stream_factory=*/nullptr, &clock_, diff --git a/net/quic/quic_connection_logger.cc b/net/quic/quic_connection_logger.cc index 90462f5..33fa4e0 100644 --- a/net/quic/quic_connection_logger.cc +++ b/net/quic/quic_connection_logger.cc @@ -6,6 +6,7 @@ #include <algorithm> #include <string> +#include <utility> #include "base/bind.h" #include "base/callback.h" @@ -44,7 +45,7 @@ scoped_ptr<base::Value> NetLogQuicPacketCallback( dict->SetString("self_address", self_address->ToString()); dict->SetString("peer_address", peer_address->ToString()); dict->SetInteger("size", packet_size); - return dict.Pass(); + return std::move(dict); } scoped_ptr<base::Value> NetLogQuicPacketSentCallback( @@ -60,7 +61,7 @@ scoped_ptr<base::Value> NetLogQuicPacketSentCallback( dict->SetInteger("size", packet_size); dict->SetString("sent_time_us", base::Int64ToString(sent_time.ToDebuggingValue())); - return dict.Pass(); + return std::move(dict); } scoped_ptr<base::Value> NetLogQuicPacketRetransmittedCallback( @@ -70,7 +71,7 @@ scoped_ptr<base::Value> NetLogQuicPacketRetransmittedCallback( scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); dict->SetString("old_packet_number", base::Uint64ToString(old_packet_number)); dict->SetString("new_packet_number", base::Uint64ToString(new_packet_number)); - return dict.Pass(); + return std::move(dict); } scoped_ptr<base::Value> NetLogQuicDuplicatePacketCallback( @@ -78,7 +79,7 @@ scoped_ptr<base::Value> NetLogQuicDuplicatePacketCallback( NetLogCaptureMode /* capture_mode */) { scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); dict->SetString("packet_number", base::Uint64ToString(packet_number)); - return dict.Pass(); + return std::move(dict); } scoped_ptr<base::Value> NetLogQuicPacketHeaderCallback( @@ -93,7 +94,7 @@ scoped_ptr<base::Value> NetLogQuicPacketHeaderCallback( dict->SetInteger("entropy_flag", header->entropy_flag); dict->SetInteger("fec_flag", header->fec_flag); dict->SetInteger("fec_group", static_cast<int>(header->fec_group)); - return dict.Pass(); + return std::move(dict); } scoped_ptr<base::Value> NetLogQuicStreamFrameCallback( @@ -104,7 +105,7 @@ scoped_ptr<base::Value> NetLogQuicStreamFrameCallback( dict->SetBoolean("fin", frame->fin); dict->SetString("offset", base::Uint64ToString(frame->offset)); dict->SetInteger("length", frame->frame_length); - return dict.Pass(); + return std::move(dict); } scoped_ptr<base::Value> NetLogQuicAckFrameCallback( @@ -139,7 +140,7 @@ scoped_ptr<base::Value> NetLogQuicAckFrameCallback( received->Append(info); } - return dict.Pass(); + return std::move(dict); } scoped_ptr<base::Value> NetLogQuicRstStreamFrameCallback( @@ -148,7 +149,7 @@ scoped_ptr<base::Value> NetLogQuicRstStreamFrameCallback( scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); dict->SetInteger("stream_id", frame->stream_id); dict->SetInteger("quic_rst_stream_error", frame->error_code); - return dict.Pass(); + return std::move(dict); } scoped_ptr<base::Value> NetLogQuicConnectionCloseFrameCallback( @@ -157,7 +158,7 @@ scoped_ptr<base::Value> NetLogQuicConnectionCloseFrameCallback( scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); dict->SetInteger("quic_error", frame->error_code); dict->SetString("details", frame->error_details); - return dict.Pass(); + return std::move(dict); } scoped_ptr<base::Value> NetLogQuicWindowUpdateFrameCallback( @@ -166,7 +167,7 @@ scoped_ptr<base::Value> NetLogQuicWindowUpdateFrameCallback( scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); dict->SetInteger("stream_id", frame->stream_id); dict->SetString("byte_offset", base::Uint64ToString(frame->byte_offset)); - return dict.Pass(); + return std::move(dict); } scoped_ptr<base::Value> NetLogQuicBlockedFrameCallback( @@ -174,7 +175,7 @@ scoped_ptr<base::Value> NetLogQuicBlockedFrameCallback( NetLogCaptureMode /* capture_mode */) { scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); dict->SetInteger("stream_id", frame->stream_id); - return dict.Pass(); + return std::move(dict); } scoped_ptr<base::Value> NetLogQuicGoAwayFrameCallback( @@ -184,7 +185,7 @@ scoped_ptr<base::Value> NetLogQuicGoAwayFrameCallback( dict->SetInteger("quic_error", frame->error_code); dict->SetInteger("last_good_stream_id", frame->last_good_stream_id); dict->SetString("reason_phrase", frame->reason_phrase); - return dict.Pass(); + return std::move(dict); } scoped_ptr<base::Value> NetLogQuicStopWaitingFrameCallback( @@ -195,7 +196,7 @@ scoped_ptr<base::Value> NetLogQuicStopWaitingFrameCallback( dict->Set("sent_info", sent_info); sent_info->SetString("least_unacked", base::Uint64ToString(frame->least_unacked)); - return dict.Pass(); + return std::move(dict); } scoped_ptr<base::Value> NetLogQuicVersionNegotiationPacketCallback( @@ -208,7 +209,7 @@ scoped_ptr<base::Value> NetLogQuicVersionNegotiationPacketCallback( it != packet->versions.end(); ++it) { versions->AppendString(QuicVersionToString(*it)); } - return dict.Pass(); + return std::move(dict); } scoped_ptr<base::Value> NetLogQuicCryptoHandshakeMessageCallback( @@ -216,7 +217,7 @@ scoped_ptr<base::Value> NetLogQuicCryptoHandshakeMessageCallback( NetLogCaptureMode /* capture_mode */) { scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); dict->SetString("quic_crypto_handshake_message", message->DebugString()); - return dict.Pass(); + return std::move(dict); } scoped_ptr<base::Value> NetLogQuicOnConnectionClosedCallback( @@ -226,7 +227,7 @@ scoped_ptr<base::Value> NetLogQuicOnConnectionClosedCallback( scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); dict->SetInteger("quic_error", error); dict->SetBoolean("from_peer", from_peer); - return dict.Pass(); + return std::move(dict); } scoped_ptr<base::Value> NetLogQuicCertificateVerifiedCallback( @@ -243,7 +244,7 @@ scoped_ptr<base::Value> NetLogQuicCertificateVerifiedCallback( subjects->Append(new base::StringValue(*it)); } dict->Set("subjects", subjects); - return dict.Pass(); + return std::move(dict); } void UpdatePacketGapSentHistogram(size_t num_consecutive_missing_packets) { @@ -299,7 +300,7 @@ QuicConnectionLogger::QuicConnectionLogger( num_blocked_frames_received_(0), num_blocked_frames_sent_(0), connection_description_(connection_description), - socket_performance_watcher_(socket_performance_watcher.Pass()) {} + socket_performance_watcher_(std::move(socket_performance_watcher)) {} QuicConnectionLogger::~QuicConnectionLogger() { UMA_HISTOGRAM_COUNTS("Net.QuicSession.OutOfOrderPacketsReceived", diff --git a/net/quic/quic_end_to_end_unittest.cc b/net/quic/quic_end_to_end_unittest.cc index 6e631e4..d3aba8e 100644 --- a/net/quic/quic_end_to_end_unittest.cc +++ b/net/quic/quic_end_to_end_unittest.cc @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include <utility> #include <vector> #include "base/compiler_specific.h" @@ -79,7 +80,7 @@ class QuicEndToEndTest : public PlatformTest { protected: QuicEndToEndTest() : host_resolver_impl_(CreateResolverImpl()), - host_resolver_(host_resolver_impl_.Pass()), + host_resolver_(std::move(host_resolver_impl_)), cert_transparency_verifier_(new MultiLogCTVerifier()), ssl_config_service_(new SSLConfigServiceDefaults), proxy_service_(ProxyService::CreateDirect()), diff --git a/net/quic/quic_http_utils.cc b/net/quic/quic_http_utils.cc index f9524f5..6091c08 100644 --- a/net/quic/quic_http_utils.cc +++ b/net/quic/quic_http_utils.cc @@ -4,6 +4,8 @@ #include "net/quic/quic_http_utils.h" +#include <utility> + namespace net { SpdyPriority ConvertRequestPriorityToQuicPriority( @@ -29,7 +31,7 @@ scoped_ptr<base::Value> QuicRequestNetLogCallback( SpdyHeaderBlockNetLogCallback(headers, capture_mode).release())); dict->SetInteger("quic_priority", static_cast<int>(priority)); dict->SetInteger("quic_stream_id", static_cast<int>(stream_id)); - return dict.Pass(); + return std::move(dict); } } // namespace net diff --git a/net/quic/quic_stream_factory.cc b/net/quic/quic_stream_factory.cc index 976cfcf..e48985d 100644 --- a/net/quic/quic_stream_factory.cc +++ b/net/quic/quic_stream_factory.cc @@ -6,6 +6,7 @@ #include <algorithm> #include <set> +#include <utility> #include "base/location.h" #include "base/macros.h" @@ -428,7 +429,7 @@ int QuicStreamFactory::Job::DoConnect() { io_state_ = STATE_CONNECT_COMPLETE; int rv = factory_->CreateSession( - server_id_, cert_verify_flags_, server_info_.Pass(), address_list_, + server_id_, cert_verify_flags_, std::move(server_info_), address_list_, dns_resolution_end_time_, net_log_, &session_); if (rv != OK) { DCHECK(rv != ERR_IO_PENDING); @@ -518,7 +519,7 @@ int QuicStreamRequest::Request(const HostPortPair& host_port_pair, void QuicStreamRequest::set_stream(scoped_ptr<QuicHttpStream> stream) { DCHECK(stream); - stream_ = stream.Pass(); + stream_ = std::move(stream); } void QuicStreamRequest::OnRequestComplete(int rv) { @@ -535,7 +536,7 @@ base::TimeDelta QuicStreamRequest::GetTimeDelayForWaitingJob() const { scoped_ptr<QuicHttpStream> QuicStreamRequest::ReleaseStream() { DCHECK(stream_); - return stream_.Pass(); + return std::move(stream_); } QuicStreamFactory::QuicStreamFactory( @@ -1134,7 +1135,7 @@ scoped_ptr<base::Value> QuicStreamFactory::QuicStreamFactoryInfoToValue() list->Append(session->GetInfoAsValue(hosts)); } } - return list.Pass(); + return std::move(list); } void QuicStreamFactory::ClearCachedStatesInCryptoConfig() { @@ -1296,12 +1297,12 @@ int QuicStreamFactory::CreateSession(const QuicServerId& server_id, } *session = new QuicChromiumClientSession( - connection, socket.Pass(), this, quic_crypto_client_stream_factory_, - clock_.get(), transport_security_state_, server_info.Pass(), server_id, - yield_after_packets_, yield_after_duration_, cert_verify_flags, config, - &crypto_config_, network_connection_.GetDescription(), + connection, std::move(socket), this, quic_crypto_client_stream_factory_, + clock_.get(), transport_security_state_, std::move(server_info), + server_id, yield_after_packets_, yield_after_duration_, cert_verify_flags, + config, &crypto_config_, network_connection_.GetDescription(), dns_resolution_end_time, base::ThreadTaskRunnerHandle::Get().get(), - socket_performance_watcher.Pass(), net_log.net_log()); + std::move(socket_performance_watcher), net_log.net_log()); all_sessions_[*session] = server_id; // owning pointer diff --git a/net/quic/test_tools/crypto_test_utils_chromium.cc b/net/quic/test_tools/crypto_test_utils_chromium.cc index 9cc1368..249f193 100644 --- a/net/quic/test_tools/crypto_test_utils_chromium.cc +++ b/net/quic/test_tools/crypto_test_utils_chromium.cc @@ -4,6 +4,8 @@ #include "net/quic/test_tools/crypto_test_utils.h" +#include <utility> + #include "base/callback_helpers.h" #include "base/logging.h" #include "base/macros.h" @@ -53,9 +55,9 @@ class TestProofVerifierChromium : public ProofVerifierChromium { nullptr, transport_security_state.get(), cert_transparency_verifier.get()), - cert_verifier_(cert_verifier.Pass()), - transport_security_state_(transport_security_state.Pass()), - cert_transparency_verifier_(cert_transparency_verifier.Pass()) { + cert_verifier_(std::move(cert_verifier)), + transport_security_state_(std::move(transport_security_state)), + cert_transparency_verifier_(std::move(cert_transparency_verifier)) { // Load and install the root for the validated chain. scoped_refptr<X509Certificate> root_cert = ImportCertFromFile(GetTestCertsDirectory(), cert_file); @@ -136,9 +138,9 @@ class FakeProofVerifier : public TestProofVerifierChromium { scoped_ptr<TransportSecurityState> transport_security_state, scoped_ptr<CTVerifier> cert_transparency_verifier, const std::string& cert_file) - : TestProofVerifierChromium(cert_verifier.Pass(), - transport_security_state.Pass(), - cert_transparency_verifier.Pass(), + : TestProofVerifierChromium(std::move(cert_verifier), + std::move(transport_security_state), + std::move(cert_transparency_verifier), cert_file) {} ~FakeProofVerifier() override {} @@ -168,7 +170,7 @@ class FakeProofVerifier : public TestProofVerifierChromium { *error_details = "Failed to create certificate chain"; verify_details_chromium->cert_verify_result.cert_status = CERT_STATUS_INVALID; - *verify_details = verify_details_chromium.Pass(); + *verify_details = std::move(verify_details_chromium); return QUIC_FAILURE; } @@ -188,17 +190,17 @@ class FakeProofVerifier : public TestProofVerifierChromium { error_string.c_str()); verify_details_chromium->cert_verify_result.cert_status = CERT_STATUS_INVALID; - *verify_details = verify_details_chromium.Pass(); + *verify_details = std::move(verify_details_chromium); return QUIC_FAILURE; } if (signature != kSignature) { *error_details = "Invalid proof"; verify_details_chromium->cert_verify_result.cert_status = CERT_STATUS_INVALID; - *verify_details = verify_details_chromium.Pass(); + *verify_details = std::move(verify_details_chromium); return QUIC_FAILURE; } - *verify_details = verify_details_chromium.Pass(); + *verify_details = std::move(verify_details_chromium); return QUIC_SUCCESS; } @@ -238,12 +240,12 @@ ProofVerifier* ProofVerifierForTestingInternal(bool use_real_proof_verifier) { "test.example.com", verify_result, OK); if (use_real_proof_verifier) { return new TestProofVerifierChromium( - cert_verifier.Pass(), make_scoped_ptr(new TransportSecurityState), + std::move(cert_verifier), make_scoped_ptr(new TransportSecurityState), make_scoped_ptr(new MultiLogCTVerifier), "quic_root.crt"); } #if defined(USE_OPENSSL) return new TestProofVerifierChromium( - cert_verifier.Pass(), make_scoped_ptr(new TransportSecurityState), + std::move(cert_verifier), make_scoped_ptr(new TransportSecurityState), make_scoped_ptr(new MultiLogCTVerifier), "quic_root.crt"); #else return new FakeProofVerifier( diff --git a/net/sdch/sdch_owner.cc b/net/sdch/sdch_owner.cc index 954732a..30b9476 100644 --- a/net/sdch/sdch_owner.cc +++ b/net/sdch/sdch_owner.cc @@ -4,6 +4,8 @@ #include "net/sdch/sdch_owner.h" +#include <utility> + #include "base/bind.h" #include "base/debug/alias.h" #include "base/logging.h" @@ -103,7 +105,7 @@ void InitializePrefStore(WriteablePrefStore* store) { empty_store->SetInteger(kVersionKey, kVersion); empty_store->Set(kDictionariesKey, make_scoped_ptr(new base::DictionaryValue)); - store->SetValue(kPreferenceName, empty_store.Pass(), + store->SetValue(kPreferenceName, std::move(empty_store), WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS); } @@ -444,7 +446,7 @@ void SdchOwner::OnDictionaryFetched(base::Time last_used, dictionary_description->SetInteger(kDictionaryUseCountKey, use_count); dictionary_description->SetInteger(kDictionarySizeKey, dictionary_text.size()); - pref_dictionary_map->Set(server_hash, dictionary_description.Pass()); + pref_dictionary_map->Set(server_hash, std::move(dictionary_description)); load_times_[server_hash] = clock_->Now(); } @@ -620,7 +622,7 @@ void SdchOwner::OnInitializationCompleted(bool succeeded) { } void SdchOwner::SetClockForTesting(scoped_ptr<base::Clock> clock) { - clock_ = clock.Pass(); + clock_ = std::move(clock); } int SdchOwner::GetDictionaryCountForTesting() const { diff --git a/net/sdch/sdch_owner_unittest.cc b/net/sdch/sdch_owner_unittest.cc index da5b48b..b575084 100644 --- a/net/sdch/sdch_owner_unittest.cc +++ b/net/sdch/sdch_owner_unittest.cc @@ -2,6 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "net/sdch/sdch_owner.h" + +#include <utility> + #include "base/location.h" #include "base/macros.h" #include "base/memory/memory_pressure_listener.h" @@ -15,7 +19,6 @@ #include "base/values.h" #include "net/base/sdch_manager.h" #include "net/log/net_log.h" -#include "net/sdch/sdch_owner.h" #include "net/url_request/url_request.h" #include "net/url_request/url_request_context.h" #include "net/url_request/url_request_error_job.h" @@ -788,7 +791,7 @@ TEST_F(SdchOwnerPersistenceTest, Persistent_EmptyDict) { TEST_F(SdchOwnerPersistenceTest, Persistent_BadVersion) { scoped_ptr<base::DictionaryValue> sdch_dict(new base::DictionaryValue()); sdch_dict->SetInteger("version", 2); - pref_store_->SetValue("SDCH", sdch_dict.Pass(), + pref_store_->SetValue("SDCH", std::move(sdch_dict), WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS); ResetOwner(false); @@ -800,8 +803,8 @@ TEST_F(SdchOwnerPersistenceTest, Persistent_EmptyDictList) { scoped_ptr<base::DictionaryValue> sdch_dict(new base::DictionaryValue()); scoped_ptr<base::DictionaryValue> dicts(new base::DictionaryValue()); sdch_dict->SetInteger("version", 1); - sdch_dict->Set("dictionaries", dicts.Pass()); - pref_store_->SetValue("SDCH", sdch_dict.Pass(), + sdch_dict->Set("dictionaries", std::move(dicts)); + pref_store_->SetValue("SDCH", std::move(sdch_dict), WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS); ResetOwner(false); diff --git a/net/server/http_connection.cc b/net/server/http_connection.cc index 3401f81..d4d16ca 100644 --- a/net/server/http_connection.cc +++ b/net/server/http_connection.cc @@ -4,6 +4,8 @@ #include "net/server/http_connection.h" +#include <utility> + #include "base/logging.h" #include "net/server/web_socket.h" #include "net/socket/stream_socket.h" @@ -150,17 +152,16 @@ int HttpConnection::QueuedWriteIOBuffer::GetSizeToWrite() const { HttpConnection::HttpConnection(int id, scoped_ptr<StreamSocket> socket) : id_(id), - socket_(socket.Pass()), + socket_(std::move(socket)), read_buf_(new ReadIOBuffer()), - write_buf_(new QueuedWriteIOBuffer()) { -} + write_buf_(new QueuedWriteIOBuffer()) {} HttpConnection::~HttpConnection() { } void HttpConnection::SetWebSocket(scoped_ptr<WebSocket> web_socket) { DCHECK(!web_socket_); - web_socket_ = web_socket.Pass(); + web_socket_ = std::move(web_socket); } } // namespace net diff --git a/net/server/http_server.cc b/net/server/http_server.cc index d6c615e..ab05af8 100644 --- a/net/server/http_server.cc +++ b/net/server/http_server.cc @@ -4,6 +4,8 @@ #include "net/server/http_server.h" +#include <utility> + #include "base/bind.h" #include "base/compiler_specific.h" #include "base/location.h" @@ -29,7 +31,7 @@ namespace net { HttpServer::HttpServer(scoped_ptr<ServerSocket> server_socket, HttpServer::Delegate* delegate) - : server_socket_(server_socket.Pass()), + : server_socket_(std::move(server_socket)), delegate_(delegate), last_id_(0), weak_ptr_factory_(this) { @@ -159,7 +161,7 @@ int HttpServer::HandleAcceptResult(int rv) { } HttpConnection* connection = - new HttpConnection(++last_id_, accepted_socket_.Pass()); + new HttpConnection(++last_id_, std::move(accepted_socket_)); id_to_connection_[connection->id()] = connection; delegate_->OnConnect(connection->id()); if (!HasClosedConnection(connection)) diff --git a/net/server/http_server_unittest.cc b/net/server/http_server_unittest.cc index ce754e8..bda95d1 100644 --- a/net/server/http_server_unittest.cc +++ b/net/server/http_server_unittest.cc @@ -189,7 +189,7 @@ class HttpServerTest : public testing::Test, scoped_ptr<ServerSocket> server_socket( new TCPServerSocket(NULL, NetLog::Source())); server_socket->ListenWithAddressAndPort("127.0.0.1", 0, 1); - server_.reset(new HttpServer(server_socket.Pass(), this)); + server_.reset(new HttpServer(std::move(server_socket), this)); ASSERT_EQ(OK, server_->GetLocalAddress(&server_address_)); } diff --git a/net/server/web_socket_encoder.cc b/net/server/web_socket_encoder.cc index 40d82410..6d59713 100644 --- a/net/server/web_socket_encoder.cc +++ b/net/server/web_socket_encoder.cc @@ -4,6 +4,7 @@ #include "net/server/web_socket_encoder.h" +#include <utility> #include <vector> #include "base/logging.h" @@ -226,8 +227,8 @@ scoped_ptr<WebSocketEncoder> WebSocketEncoder::CreateServer( continue; } *deflate_parameters = response; - return make_scoped_ptr( - new WebSocketEncoder(FOR_SERVER, deflater.Pass(), inflater.Pass())); + return make_scoped_ptr(new WebSocketEncoder(FOR_SERVER, std::move(deflater), + std::move(inflater))); } // We cannot find an acceptable offer. @@ -272,14 +273,16 @@ scoped_ptr<WebSocketEncoder> WebSocketEncoder::CreateClient( return make_scoped_ptr(new WebSocketEncoder(FOR_CLIENT, nullptr, nullptr)); } - return make_scoped_ptr( - new WebSocketEncoder(FOR_CLIENT, deflater.Pass(), inflater.Pass())); + return make_scoped_ptr(new WebSocketEncoder(FOR_CLIENT, std::move(deflater), + std::move(inflater))); } WebSocketEncoder::WebSocketEncoder(Type type, scoped_ptr<WebSocketDeflater> deflater, scoped_ptr<WebSocketInflater> inflater) - : type_(type), deflater_(deflater.Pass()), inflater_(inflater.Pass()) {} + : type_(type), + deflater_(std::move(deflater)), + inflater_(std::move(inflater)) {} WebSocketEncoder::~WebSocketEncoder() {} diff --git a/net/socket/client_socket_factory.cc b/net/socket/client_socket_factory.cc index e0bc81d..cc2a243 100644 --- a/net/socket/client_socket_factory.cc +++ b/net/socket/client_socket_factory.cc @@ -4,6 +4,8 @@ #include "net/socket/client_socket_factory.h" +#include <utility> + #include "base/lazy_instance.h" #include "build/build_config.h" #include "net/cert/cert_database.h" @@ -70,9 +72,8 @@ class DefaultClientSocketFactory : public ClientSocketFactory, const SSLConfig& ssl_config, const SSLClientSocketContext& context) override { #if defined(USE_OPENSSL) - return scoped_ptr<SSLClientSocket>( - new SSLClientSocketOpenSSL(transport_socket.Pass(), host_and_port, - ssl_config, context)); + return scoped_ptr<SSLClientSocket>(new SSLClientSocketOpenSSL( + std::move(transport_socket), host_and_port, ssl_config, context)); #else return scoped_ptr<SSLClientSocket>(new SSLClientSocketNSS( transport_socket.Pass(), host_and_port, ssl_config, context)); diff --git a/net/socket/client_socket_handle.cc b/net/socket/client_socket_handle.cc index f38187b..b177fb6 100644 --- a/net/socket/client_socket_handle.cc +++ b/net/socket/client_socket_handle.cc @@ -4,6 +4,8 @@ #include "net/socket/client_socket_handle.h" +#include <utility> + #include "base/bind.h" #include "base/bind_helpers.h" #include "base/compiler_specific.h" @@ -43,7 +45,7 @@ void ClientSocketHandle::ResetInternal(bool cancel) { socket_->NetLog().EndEvent(NetLog::TYPE_SOCKET_IN_USE); // Release the socket back to the ClientSocketPool so it can be // deleted or reused. - pool_->ReleaseSocket(group_name_, socket_.Pass(), pool_id_); + pool_->ReleaseSocket(group_name_, std::move(socket_), pool_id_); } else { // If the handle has been initialized, we should still have a // socket. @@ -134,7 +136,7 @@ bool ClientSocketHandle::GetLoadTimingInfo( } void ClientSocketHandle::SetSocket(scoped_ptr<StreamSocket> s) { - socket_ = s.Pass(); + socket_ = std::move(s); } void ClientSocketHandle::OnIOComplete(int result) { @@ -145,7 +147,7 @@ void ClientSocketHandle::OnIOComplete(int result) { } scoped_ptr<StreamSocket> ClientSocketHandle::PassSocket() { - return socket_.Pass(); + return std::move(socket_); } void ClientSocketHandle::HandleInitCompletion(int result) { diff --git a/net/socket/client_socket_pool_base.cc b/net/socket/client_socket_pool_base.cc index c4b624a..4a76913 100644 --- a/net/socket/client_socket_pool_base.cc +++ b/net/socket/client_socket_pool_base.cc @@ -5,6 +5,7 @@ #include "net/socket/client_socket_pool_base.h" #include <algorithm> +#include <utility> #include "base/compiler_specific.h" #include "base/format_macros.h" @@ -71,7 +72,7 @@ ConnectJob::~ConnectJob() { } scoped_ptr<StreamSocket> ConnectJob::PassSocket() { - return socket_.Pass(); + return std::move(socket_); } int ConnectJob::Connect() { @@ -97,7 +98,7 @@ void ConnectJob::SetSocket(scoped_ptr<StreamSocket> socket) { net_log().AddEvent(NetLog::TYPE_CONNECT_JOB_SET_SOCKET, socket->NetLog().source().ToEventParametersCallback()); } - socket_ = socket.Pass(); + socket_ = std::move(socket); } void ConnectJob::NotifyDelegateOfCompletion(int rv) { @@ -288,7 +289,7 @@ int ClientSocketPoolBaseHelper::RequestSocket( CHECK(!request->handle()->is_initialized()); request.reset(); } else { - group->InsertPendingRequest(request.Pass()); + group->InsertPendingRequest(std::move(request)); // Have to do this asynchronously, as closing sockets in higher level pools // call back in to |this|, which will cause all sorts of fun and exciting // re-entrancy issues if the socket pool is doing something else at the @@ -430,7 +431,7 @@ int ClientSocketPoolBaseHelper::RequestSocketInternal( connecting_socket_count_++; - group->AddJob(connect_job.Pass(), preconnecting); + group->AddJob(std::move(connect_job), preconnecting); } else { LogBoundConnectJobToRequest(connect_job->net_log().source(), request); scoped_ptr<StreamSocket> error_socket; @@ -440,7 +441,7 @@ int ClientSocketPoolBaseHelper::RequestSocketInternal( error_socket = connect_job->PassSocket(); } if (error_socket) { - HandOutSocket(error_socket.Pass(), ClientSocketHandle::UNUSED, + HandOutSocket(std::move(error_socket), ClientSocketHandle::UNUSED, connect_job->connect_timing(), handle, base::TimeDelta(), group, request.net_log()); } else if (group->IsEmpty()) { @@ -533,7 +534,7 @@ void ClientSocketPoolBaseHelper::CancelRequest( if (socket) { if (result != OK) socket->Disconnect(); - ReleaseSocket(handle->group_name(), socket.Pass(), handle->id()); + ReleaseSocket(handle->group_name(), std::move(socket), handle->id()); } return; } @@ -615,7 +616,7 @@ scoped_ptr<base::DictionaryValue> ClientSocketPoolBaseHelper::GetInfoAsValue( dict->SetInteger("pool_generation_number", pool_generation_number_); if (group_map_.empty()) - return dict.Pass(); + return dict; base::DictionaryValue* all_groups_dict = new base::DictionaryValue(); for (GroupMap::const_iterator it = group_map_.begin(); @@ -659,7 +660,7 @@ scoped_ptr<base::DictionaryValue> ClientSocketPoolBaseHelper::GetInfoAsValue( all_groups_dict->SetWithoutPathExpansion(it->first, group_dict); } dict->Set("groups", all_groups_dict); - return dict.Pass(); + return dict; } bool ClientSocketPoolBaseHelper::IdleSocket::IsUsable() const { @@ -795,7 +796,7 @@ void ClientSocketPoolBaseHelper::ReleaseSocket(const std::string& group_name, id == pool_generation_number_; if (can_reuse) { // Add it to the idle list. - AddIdleSocket(socket.Pass(), group); + AddIdleSocket(std::move(socket), group); OnAvailableSocketSlot(group_name, group); } else { socket.reset(); @@ -901,13 +902,13 @@ void ClientSocketPoolBaseHelper::OnConnectJobComplete( scoped_ptr<const Request> request = group->PopNextPendingRequest(); if (request) { LogBoundConnectJobToRequest(job_log.source(), *request); - HandOutSocket( - socket.Pass(), ClientSocketHandle::UNUSED, connect_timing, - request->handle(), base::TimeDelta(), group, request->net_log()); + HandOutSocket(std::move(socket), ClientSocketHandle::UNUSED, + connect_timing, request->handle(), base::TimeDelta(), group, + request->net_log()); request->net_log().EndEvent(NetLog::TYPE_SOCKET_POOL); InvokeUserCallbackLater(request->handle(), request->callback(), result); } else { - AddIdleSocket(socket.Pass(), group); + AddIdleSocket(std::move(socket), group); OnAvailableSocketSlot(group_name, group); CheckForStalledSocketGroups(); } @@ -922,7 +923,7 @@ void ClientSocketPoolBaseHelper::OnConnectJobComplete( RemoveConnectJob(job, group); if (socket.get()) { handed_out_socket = true; - HandOutSocket(socket.Pass(), ClientSocketHandle::UNUSED, + HandOutSocket(std::move(socket), ClientSocketHandle::UNUSED, connect_timing, request->handle(), base::TimeDelta(), group, request->net_log()); } @@ -1003,7 +1004,7 @@ void ClientSocketPoolBaseHelper::HandOutSocket( Group* group, const BoundNetLog& net_log) { DCHECK(socket); - handle->SetSocket(socket.Pass()); + handle->SetSocket(std::move(socket)); handle->set_reuse_type(reuse_type); handle->set_idle_time(idle_time); handle->set_pool_id(pool_generation_number_); @@ -1256,7 +1257,7 @@ void ClientSocketPoolBaseHelper::Group::OnBackupJobTimerFired( int rv = backup_job->Connect(); pool->connecting_socket_count_++; ConnectJob* raw_backup_job = backup_job.get(); - AddJob(backup_job.Pass(), false); + AddJob(std::move(backup_job), false); if (rv != ERR_IO_PENDING) pool->OnConnectJobComplete(rv, raw_backup_job); } @@ -1327,7 +1328,7 @@ ClientSocketPoolBaseHelper::Group::FindAndRemovePendingRequest( pointer = pending_requests_.GetNextTowardsLastMin(pointer)) { if (pointer.value()->handle() == handle) { scoped_ptr<const Request> request = RemovePendingRequest(pointer); - return request.Pass(); + return request; } } return scoped_ptr<const ClientSocketPoolBaseHelper::Request>(); @@ -1344,7 +1345,7 @@ ClientSocketPoolBaseHelper::Group::RemovePendingRequest( if (pending_requests_.empty()) backup_job_timer_.Stop(); request->CrashIfInvalid(); - return request.Pass(); + return request; } } // namespace internal diff --git a/net/socket/client_socket_pool_base.h b/net/socket/client_socket_pool_base.h index c033724..cd13ce0 100644 --- a/net/socket/client_socket_pool_base.h +++ b/net/socket/client_socket_pool_base.h @@ -24,13 +24,13 @@ #include <stddef.h> #include <stdint.h> - #include <cstddef> #include <deque> #include <list> #include <map> #include <set> #include <string> +#include <utility> #include <vector> #include "base/macros.h" @@ -757,7 +757,7 @@ class ClientSocketPoolBase { internal::ClientSocketPoolBaseHelper::NORMAL, params->ignore_limits(), params, net_log)); - return helper_.RequestSocket(group_name, request.Pass()); + return helper_.RequestSocket(group_name, std::move(request)); } // RequestSockets bundles up the parameters into a Request and then forwards @@ -781,7 +781,7 @@ class ClientSocketPoolBase { void ReleaseSocket(const std::string& group_name, scoped_ptr<StreamSocket> socket, int id) { - return helper_.ReleaseSocket(group_name, socket.Pass(), id); + return helper_.ReleaseSocket(group_name, std::move(socket), id); } void FlushWithError(int error) { helper_.FlushWithError(error); } diff --git a/net/socket/client_socket_pool_base_unittest.cc b/net/socket/client_socket_pool_base_unittest.cc index 05fab62..a467f49 100644 --- a/net/socket/client_socket_pool_base_unittest.cc +++ b/net/socket/client_socket_pool_base_unittest.cc @@ -5,7 +5,7 @@ #include "net/socket/client_socket_pool_base.h" #include <stdint.h> - +#include <utility> #include <vector> #include "base/bind.h" @@ -532,7 +532,7 @@ class TestClientSocketPool : public ClientSocketPool { void ReleaseSocket(const std::string& group_name, scoped_ptr<StreamSocket> socket, int id) override { - base_.ReleaseSocket(group_name, socket.Pass(), id); + base_.ReleaseSocket(group_name, std::move(socket), id); } void FlushWithError(int error) override { base_.FlushWithError(error); } diff --git a/net/socket/client_socket_pool_manager_impl.cc b/net/socket/client_socket_pool_manager_impl.cc index 5cf98f3..6917036 100644 --- a/net/socket/client_socket_pool_manager_impl.cc +++ b/net/socket/client_socket_pool_manager_impl.cc @@ -5,6 +5,7 @@ #include "net/socket/client_socket_pool_manager_impl.h" #include <algorithm> +#include <utility> #include "base/logging.h" #include "base/values.h" @@ -358,7 +359,7 @@ scoped_ptr<base::Value> ClientSocketPoolManagerImpl::SocketPoolInfoToValue() // socket pools in |http_proxy_socket_pools_| and |socks_socket_pools_|. AddSocketPoolsToList(list.get(), ssl_socket_pools_for_proxies_, "ssl_socket_pool_for_proxies", false); - return list.Pass(); + return std::move(list); } void ClientSocketPoolManagerImpl::OnCertAdded(const X509Certificate* cert) { diff --git a/net/socket/socket_net_log_params.cc b/net/socket/socket_net_log_params.cc index e699d20..37be0a6 100644 --- a/net/socket/socket_net_log_params.cc +++ b/net/socket/socket_net_log_params.cc @@ -4,6 +4,8 @@ #include "net/socket/socket_net_log_params.h" +#include <utility> + #include "base/bind.h" #include "base/values.h" #include "net/base/host_port_pair.h" @@ -21,7 +23,7 @@ scoped_ptr<base::Value> NetLogSocketErrorCallback( scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); dict->SetInteger("net_error", net_error); dict->SetInteger("os_error", os_error); - return dict.Pass(); + return std::move(dict); } scoped_ptr<base::Value> NetLogHostPortPairCallback( @@ -29,7 +31,7 @@ scoped_ptr<base::Value> NetLogHostPortPairCallback( NetLogCaptureMode /* capture_mode */) { scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); dict->SetString("host_and_port", host_and_port->ToString()); - return dict.Pass(); + return std::move(dict); } scoped_ptr<base::Value> NetLogIPEndPointCallback( @@ -37,7 +39,7 @@ scoped_ptr<base::Value> NetLogIPEndPointCallback( NetLogCaptureMode /* capture_mode */) { scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); dict->SetString("address", address->ToString()); - return dict.Pass(); + return std::move(dict); } scoped_ptr<base::Value> NetLogSourceAddressCallback( @@ -49,7 +51,7 @@ scoped_ptr<base::Value> NetLogSourceAddressCallback( bool result = ipe.FromSockAddr(net_address, address_len); DCHECK(result); dict->SetString("source_address", ipe.ToString()); - return dict.Pass(); + return std::move(dict); } } // namespace diff --git a/net/socket/socket_posix.cc b/net/socket/socket_posix.cc index cd7aff1..a18e22d 100644 --- a/net/socket/socket_posix.cc +++ b/net/socket/socket_posix.cc @@ -7,6 +7,7 @@ #include <errno.h> #include <netinet/in.h> #include <sys/socket.h> +#include <utility> #include "base/callback_helpers.h" #include "base/files/file_util.h" @@ -377,7 +378,7 @@ int SocketPosix::DoAccept(scoped_ptr<SocketPosix>* socket) { if (rv != OK) return rv; - *socket = accepted_socket.Pass(); + *socket = std::move(accepted_socket); return OK; } diff --git a/net/socket/socket_test_util.cc b/net/socket/socket_test_util.cc index 0b99c5d..cc5ea78 100644 --- a/net/socket/socket_test_util.cc +++ b/net/socket/socket_test_util.cc @@ -5,6 +5,7 @@ #include "net/socket/socket_test_util.h" #include <algorithm> +#include <utility> #include <vector> #include "base/bind.h" @@ -710,7 +711,7 @@ MockClientSocketFactory::CreateDatagramClientSocket( socket->set_source_port( static_cast<uint16_t>(rand_int_cb.Run(1025, 65535))); udp_client_socket_ports_.push_back(socket->source_port()); - return socket.Pass(); + return std::move(socket); } scoped_ptr<StreamSocket> MockClientSocketFactory::CreateTransportClientSocket( @@ -720,7 +721,7 @@ scoped_ptr<StreamSocket> MockClientSocketFactory::CreateTransportClientSocket( SocketDataProvider* data_provider = mock_data_.GetNext(); scoped_ptr<MockTCPClientSocket> socket( new MockTCPClientSocket(addresses, net_log, data_provider)); - return socket.Pass(); + return std::move(socket); } scoped_ptr<SSLClientSocket> MockClientSocketFactory::CreateSSLClientSocket( @@ -738,7 +739,7 @@ scoped_ptr<SSLClientSocket> MockClientSocketFactory::CreateSSLClientSocket( ssl_config.alpn_protos.begin())); } return scoped_ptr<SSLClientSocket>(new MockSSLClientSocket( - transport_socket.Pass(), host_and_port, ssl_config, next_ssl_data)); + std::move(transport_socket), host_and_port, ssl_config, next_ssl_data)); } void MockClientSocketFactory::ClearSSLSessionCache() { @@ -1130,8 +1131,9 @@ MockSSLClientSocket::MockSSLClientSocket( : MockClientSocket( // Have to use the right BoundNetLog for LoadTimingInfo regression // tests. - transport_socket->socket()->NetLog()), - transport_(transport_socket.Pass()), + transport_socket->socket() + ->NetLog()), + transport_(std::move(transport_socket)), data_(data) { DCHECK(data_); peer_addr_ = data->connect.peer_addr; @@ -1515,10 +1517,7 @@ MockTransportClientSocketPool::MockConnectJob::MockConnectJob( scoped_ptr<StreamSocket> socket, ClientSocketHandle* handle, const CompletionCallback& callback) - : socket_(socket.Pass()), - handle_(handle), - user_callback_(callback) { -} + : socket_(std::move(socket)), handle_(handle), user_callback_(callback) {} MockTransportClientSocketPool::MockConnectJob::~MockConnectJob() {} @@ -1546,7 +1545,7 @@ void MockTransportClientSocketPool::MockConnectJob::OnConnect(int rv) { if (!socket_.get()) return; if (rv == OK) { - handle_->SetSocket(socket_.Pass()); + handle_->SetSocket(std::move(socket_)); // Needed for socket pool tests that layer other sockets on top of mock // sockets. @@ -1600,7 +1599,7 @@ int MockTransportClientSocketPool::RequestSocket( scoped_ptr<StreamSocket> socket = client_socket_factory_->CreateTransportClientSocket( AddressList(), net_log.net_log(), NetLog::Source()); - MockConnectJob* job = new MockConnectJob(socket.Pass(), handle, callback); + MockConnectJob* job = new MockConnectJob(std::move(socket), handle, callback); job_list_.push_back(make_scoped_ptr(job)); handle->set_pool_id(1); return job->Connect(); @@ -1655,7 +1654,7 @@ void MockSOCKSClientSocketPool::CancelRequest( void MockSOCKSClientSocketPool::ReleaseSocket(const std::string& group_name, scoped_ptr<StreamSocket> socket, int id) { - return transport_pool_->ReleaseSocket(group_name, socket.Pass(), id); + return transport_pool_->ReleaseSocket(group_name, std::move(socket), id); } ScopedWebSocketEndpointZeroUnlockDelay:: diff --git a/net/socket/socks5_client_socket.cc b/net/socket/socks5_client_socket.cc index 10b9de7..20baaf2 100644 --- a/net/socket/socks5_client_socket.cc +++ b/net/socket/socks5_client_socket.cc @@ -4,6 +4,8 @@ #include "net/socket/socks5_client_socket.h" +#include <utility> + #include "base/callback_helpers.h" #include "base/compiler_specific.h" #include "base/format_macros.h" @@ -32,7 +34,7 @@ SOCKS5ClientSocket::SOCKS5ClientSocket( const HostResolver::RequestInfo& req_info) : io_callback_(base::Bind(&SOCKS5ClientSocket::OnIOComplete, base::Unretained(this))), - transport_(transport_socket.Pass()), + transport_(std::move(transport_socket)), next_state_(STATE_NONE), completed_handshake_(false), bytes_sent_(0), @@ -40,8 +42,7 @@ SOCKS5ClientSocket::SOCKS5ClientSocket( read_header_size(kReadHeaderSize), was_ever_used_(false), host_request_info_(req_info), - net_log_(transport_->socket()->NetLog()) { -} + net_log_(transport_->socket()->NetLog()) {} SOCKS5ClientSocket::~SOCKS5ClientSocket() { Disconnect(); diff --git a/net/socket/socks5_client_socket_unittest.cc b/net/socket/socks5_client_socket_unittest.cc index 8919b3a..c41c6b9 100644 --- a/net/socket/socks5_client_socket_unittest.cc +++ b/net/socket/socks5_client_socket_unittest.cc @@ -7,6 +7,7 @@ #include <algorithm> #include <iterator> #include <map> +#include <utility> #include "base/macros.h" #include "base/sys_byteorder.h" @@ -108,7 +109,7 @@ scoped_ptr<SOCKS5ClientSocket> SOCKS5ClientSocketTest::BuildMockSocket( // non-owning pointer to it. connection->SetSocket(scoped_ptr<StreamSocket>(tcp_sock_)); return scoped_ptr<SOCKS5ClientSocket>(new SOCKS5ClientSocket( - connection.Pass(), + std::move(connection), HostResolver::RequestInfo(HostPortPair(hostname, port)))); } diff --git a/net/socket/socks_client_socket.cc b/net/socket/socks_client_socket.cc index 678af10..69805bb 100644 --- a/net/socket/socks_client_socket.cc +++ b/net/socket/socks_client_socket.cc @@ -4,6 +4,8 @@ #include "net/socket/socks_client_socket.h" +#include <utility> + #include "base/bind.h" #include "base/callback_helpers.h" #include "base/compiler_specific.h" @@ -60,7 +62,7 @@ SOCKSClientSocket::SOCKSClientSocket( const HostResolver::RequestInfo& req_info, RequestPriority priority, HostResolver* host_resolver) - : transport_(transport_socket.Pass()), + : transport_(std::move(transport_socket)), next_state_(STATE_NONE), completed_handshake_(false), bytes_sent_(0), diff --git a/net/socket/socks_client_socket_pool.cc b/net/socket/socks_client_socket_pool.cc index dda4aec..543c2c4 100644 --- a/net/socket/socks_client_socket_pool.cc +++ b/net/socket/socks_client_socket_pool.cc @@ -4,6 +4,8 @@ #include "net/socket/socks_client_socket_pool.h" +#include <utility> + #include "base/bind.h" #include "base/bind_helpers.h" #include "base/time/time.h" @@ -141,13 +143,12 @@ int SOCKSConnectJob::DoSOCKSConnect() { // Add a SOCKS connection on top of the tcp socket. if (socks_params_->is_socks_v5()) { - socket_.reset(new SOCKS5ClientSocket(transport_socket_handle_.Pass(), + socket_.reset(new SOCKS5ClientSocket(std::move(transport_socket_handle_), socks_params_->destination())); } else { - socket_.reset(new SOCKSClientSocket(transport_socket_handle_.Pass(), + socket_.reset(new SOCKSClientSocket(std::move(transport_socket_handle_), socks_params_->destination(), - priority(), - resolver_)); + priority(), resolver_)); } return socket_->Connect( base::Bind(&SOCKSConnectJob::OnIOComplete, base::Unretained(this))); @@ -159,7 +160,7 @@ int SOCKSConnectJob::DoSOCKSConnectComplete(int result) { return result; } - SetSocket(socket_.Pass()); + SetSocket(std::move(socket_)); return result; } @@ -241,7 +242,7 @@ void SOCKSClientSocketPool::CancelRequest(const std::string& group_name, void SOCKSClientSocketPool::ReleaseSocket(const std::string& group_name, scoped_ptr<StreamSocket> socket, int id) { - base_.ReleaseSocket(group_name, socket.Pass(), id); + base_.ReleaseSocket(group_name, std::move(socket), id); } void SOCKSClientSocketPool::FlushWithError(int error) { @@ -276,9 +277,9 @@ scoped_ptr<base::DictionaryValue> SOCKSClientSocketPool::GetInfoAsValue( list->Append(transport_pool_->GetInfoAsValue("transport_socket_pool", "transport_socket_pool", false)); - dict->Set("nested_pools", list.Pass()); + dict->Set("nested_pools", std::move(list)); } - return dict.Pass(); + return dict; } base::TimeDelta SOCKSClientSocketPool::ConnectionTimeout() const { diff --git a/net/socket/socks_client_socket_unittest.cc b/net/socket/socks_client_socket_unittest.cc index 4d2711a..bff76c1 100644 --- a/net/socket/socks_client_socket_unittest.cc +++ b/net/socket/socks_client_socket_unittest.cc @@ -4,6 +4,8 @@ #include "net/socket/socks_client_socket.h" +#include <utility> + #include "base/macros.h" #include "base/memory/scoped_ptr.h" #include "net/base/address_list.h" @@ -86,9 +88,8 @@ scoped_ptr<SOCKSClientSocket> SOCKSClientSocketTest::BuildMockSocket( // non-owning pointer to it. connection->SetSocket(scoped_ptr<StreamSocket>(tcp_sock_)); return scoped_ptr<SOCKSClientSocket>(new SOCKSClientSocket( - connection.Pass(), - HostResolver::RequestInfo(HostPortPair(hostname, port)), - DEFAULT_PRIORITY, + std::move(connection), + HostResolver::RequestInfo(HostPortPair(hostname, port)), DEFAULT_PRIORITY, host_resolver)); } diff --git a/net/socket/ssl_client_socket_openssl.cc b/net/socket/ssl_client_socket_openssl.cc index eeb931c..88941f8 100644 --- a/net/socket/ssl_client_socket_openssl.cc +++ b/net/socket/ssl_client_socket_openssl.cc @@ -150,7 +150,7 @@ ScopedX509Stack OSCertHandlesToOpenSSL( return ScopedX509Stack(); sk_X509_push(stack.get(), x509.release()); } - return stack.Pass(); + return stack; } bool EVP_MDToPrivateKeyHash(const EVP_MD* md, SSLPrivateKey::Hash* hash) { @@ -528,7 +528,7 @@ SSLClientSocketOpenSSL::SSLClientSocketOpenSSL( tb_negotiated_param_(TB_PARAM_ECDSAP256), ssl_(NULL), transport_bio_(NULL), - transport_(transport_socket.Pass()), + transport_(std::move(transport_socket)), host_and_port_(host_and_port), ssl_config_(ssl_config), ssl_session_cache_shard_(context.ssl_session_cache_shard), diff --git a/net/socket/ssl_client_socket_pool.cc b/net/socket/ssl_client_socket_pool.cc index 0fdfc40..303bb86 100644 --- a/net/socket/ssl_client_socket_pool.cc +++ b/net/socket/ssl_client_socket_pool.cc @@ -4,6 +4,8 @@ #include "net/socket/ssl_client_socket_pool.h" +#include <utility> + #include "base/bind.h" #include "base/bind_helpers.h" #include "base/metrics/field_trial.h" @@ -319,10 +321,8 @@ int SSLConnectJob::DoSSLConnect() { connect_timing_.ssl_start = base::TimeTicks::Now(); ssl_socket_ = client_socket_factory_->CreateSSLClientSocket( - transport_socket_handle_.Pass(), - params_->host_and_port(), - params_->ssl_config(), - context_); + std::move(transport_socket_handle_), params_->host_and_port(), + params_->ssl_config(), context_); return ssl_socket_->Connect(callback_); } @@ -440,7 +440,7 @@ int SSLConnectJob::DoSSLConnectComplete(int result) { UMA_HISTOGRAM_SPARSE_SLOWLY("Net.SSL_Connection_Error", std::abs(result)); if (result == OK || IsCertificateError(result)) { - SetSocket(ssl_socket_.Pass()); + SetSocket(std::move(ssl_socket_)); } else if (result == ERR_SSL_CLIENT_AUTH_CERT_NEEDED) { error_response_info_.cert_request_info = new SSLCertRequestInfo; ssl_socket_->GetSSLCertRequestInfo( @@ -608,7 +608,7 @@ void SSLClientSocketPool::CancelRequest(const std::string& group_name, void SSLClientSocketPool::ReleaseSocket(const std::string& group_name, scoped_ptr<StreamSocket> socket, int id) { - base_.ReleaseSocket(group_name, socket.Pass(), id); + base_.ReleaseSocket(group_name, std::move(socket), id); } void SSLClientSocketPool::FlushWithError(int error) { @@ -657,7 +657,7 @@ scoped_ptr<base::DictionaryValue> SSLClientSocketPool::GetInfoAsValue( } dict->Set("nested_pools", list); } - return dict.Pass(); + return dict; } base::TimeDelta SSLClientSocketPool::ConnectionTimeout() const { diff --git a/net/socket/ssl_client_socket_unittest.cc b/net/socket/ssl_client_socket_unittest.cc index df3c44b..ac573ed 100644 --- a/net/socket/ssl_client_socket_unittest.cc +++ b/net/socket/ssl_client_socket_unittest.cc @@ -4,6 +4,8 @@ #include "net/socket/ssl_client_socket.h" +#include <utility> + #include "base/callback_helpers.h" #include "base/location.h" #include "base/macros.h" @@ -61,7 +63,7 @@ namespace { class WrappedStreamSocket : public StreamSocket { public: explicit WrappedStreamSocket(scoped_ptr<StreamSocket> transport) - : transport_(transport.Pass()) {} + : transport_(std::move(transport)) {} ~WrappedStreamSocket() override {} // StreamSocket implementation: @@ -179,7 +181,7 @@ class ReadBufferingStreamSocket : public WrappedStreamSocket { ReadBufferingStreamSocket::ReadBufferingStreamSocket( scoped_ptr<StreamSocket> transport) - : WrappedStreamSocket(transport.Pass()), + : WrappedStreamSocket(std::move(transport)), read_buffer_(new GrowableIOBuffer()), buffer_size_(0) {} @@ -313,7 +315,7 @@ class SynchronousErrorStreamSocket : public WrappedStreamSocket { SynchronousErrorStreamSocket::SynchronousErrorStreamSocket( scoped_ptr<StreamSocket> transport) - : WrappedStreamSocket(transport.Pass()), + : WrappedStreamSocket(std::move(transport)), have_read_error_(false), pending_read_error_(OK), have_write_error_(false), @@ -415,7 +417,7 @@ class FakeBlockingStreamSocket : public WrappedStreamSocket { FakeBlockingStreamSocket::FakeBlockingStreamSocket( scoped_ptr<StreamSocket> transport) - : WrappedStreamSocket(transport.Pass()), + : WrappedStreamSocket(std::move(transport)), should_block_read_(false), pending_read_result_(ERR_IO_PENDING), should_block_write_(false), @@ -563,7 +565,7 @@ void FakeBlockingStreamSocket::OnReadCompleted(int result) { class CountingStreamSocket : public WrappedStreamSocket { public: explicit CountingStreamSocket(scoped_ptr<StreamSocket> transport) - : WrappedStreamSocket(transport.Pass()), + : WrappedStreamSocket(std::move(transport)), read_count_(0), write_count_(0) {} ~CountingStreamSocket() override {} @@ -736,9 +738,9 @@ class SSLClientSocketTest : public PlatformTest { const HostPortPair& host_and_port, const SSLConfig& ssl_config) { scoped_ptr<ClientSocketHandle> connection(new ClientSocketHandle); - connection->SetSocket(transport_socket.Pass()); + connection->SetSocket(std::move(transport_socket)); return socket_factory_->CreateSSLClientSocket( - connection.Pass(), host_and_port, ssl_config, context_); + std::move(connection), host_and_port, ssl_config, context_); } // Create an SSLClientSocket object and use it to connect to a test @@ -759,8 +761,9 @@ class SSLClientSocketTest : public PlatformTest { return false; } - sock_ = CreateSSLClientSocket( - transport.Pass(), spawned_test_server_->host_port_pair(), ssl_config); + sock_ = CreateSSLClientSocket(std::move(transport), + spawned_test_server_->host_port_pair(), + ssl_config); EXPECT_FALSE(sock_->IsConnected()); *result = callback_.GetResult(sock_->Connect(callback_.callback())); @@ -819,7 +822,8 @@ class SSLClientSocketCertRequestInfoTest : public SSLClientSocketTest { EXPECT_EQ(OK, rv); scoped_ptr<SSLClientSocket> sock(CreateSSLClientSocket( - transport.Pass(), spawned_test_server.host_port_pair(), SSLConfig())); + std::move(transport), spawned_test_server.host_port_pair(), + SSLConfig())); EXPECT_FALSE(sock->IsConnected()); rv = callback.GetResult(sock->Connect(callback.callback())); @@ -861,13 +865,13 @@ class SSLClientSocketFalseStartTest : public SSLClientSocketTest { scoped_ptr<StreamSocket> real_transport( new TCPClientSocket(addr(), NULL, NetLog::Source())); scoped_ptr<FakeBlockingStreamSocket> transport( - new FakeBlockingStreamSocket(real_transport.Pass())); + new FakeBlockingStreamSocket(std::move(real_transport))); int rv = callback->GetResult(transport->Connect(callback->callback())); EXPECT_EQ(OK, rv); FakeBlockingStreamSocket* raw_transport = transport.get(); scoped_ptr<SSLClientSocket> sock = CreateSSLClientSocket( - transport.Pass(), spawned_test_server()->host_port_pair(), + std::move(transport), spawned_test_server()->host_port_pair(), client_config); // Connect. Stop before the client processes the first server leg @@ -891,7 +895,7 @@ class SSLClientSocketFalseStartTest : public SSLClientSocketTest { raw_transport->UnblockWrite(); *out_raw_transport = raw_transport; - *out_sock = sock.Pass(); + *out_sock = std::move(sock); } void TestFalseStart(const SpawnedTestServer::SSLOptions& server_options, @@ -983,7 +987,8 @@ TEST_F(SSLClientSocketTest, Connect) { EXPECT_EQ(OK, rv); scoped_ptr<SSLClientSocket> sock(CreateSSLClientSocket( - transport.Pass(), spawned_test_server()->host_port_pair(), SSLConfig())); + std::move(transport), spawned_test_server()->host_port_pair(), + SSLConfig())); EXPECT_FALSE(sock->IsConnected()); @@ -1130,7 +1135,8 @@ TEST_F(SSLClientSocketTest, Read) { EXPECT_EQ(OK, rv); scoped_ptr<SSLClientSocket> sock(CreateSSLClientSocket( - transport.Pass(), spawned_test_server()->host_port_pair(), SSLConfig())); + std::move(transport), spawned_test_server()->host_port_pair(), + SSLConfig())); EXPECT_EQ(0, sock->GetTotalReceivedBytes()); rv = callback.GetResult(sock->Connect(callback.callback())); @@ -1181,7 +1187,7 @@ TEST_F(SSLClientSocketTest, Connect_WithSynchronousError) { scoped_ptr<StreamSocket> real_transport( new TCPClientSocket(addr(), NULL, NetLog::Source())); scoped_ptr<SynchronousErrorStreamSocket> transport( - new SynchronousErrorStreamSocket(real_transport.Pass())); + new SynchronousErrorStreamSocket(std::move(real_transport))); int rv = callback.GetResult(transport->Connect(callback.callback())); EXPECT_EQ(OK, rv); @@ -1191,7 +1197,8 @@ TEST_F(SSLClientSocketTest, Connect_WithSynchronousError) { SynchronousErrorStreamSocket* raw_transport = transport.get(); scoped_ptr<SSLClientSocket> sock(CreateSSLClientSocket( - transport.Pass(), spawned_test_server()->host_port_pair(), ssl_config)); + std::move(transport), spawned_test_server()->host_port_pair(), + ssl_config)); raw_transport->SetNextWriteError(ERR_CONNECTION_RESET); @@ -1211,7 +1218,7 @@ TEST_F(SSLClientSocketTest, Read_WithSynchronousError) { scoped_ptr<StreamSocket> real_transport( new TCPClientSocket(addr(), NULL, NetLog::Source())); scoped_ptr<SynchronousErrorStreamSocket> transport( - new SynchronousErrorStreamSocket(real_transport.Pass())); + new SynchronousErrorStreamSocket(std::move(real_transport))); int rv = callback.GetResult(transport->Connect(callback.callback())); EXPECT_EQ(OK, rv); @@ -1221,7 +1228,8 @@ TEST_F(SSLClientSocketTest, Read_WithSynchronousError) { SynchronousErrorStreamSocket* raw_transport = transport.get(); scoped_ptr<SSLClientSocket> sock(CreateSSLClientSocket( - transport.Pass(), spawned_test_server()->host_port_pair(), ssl_config)); + std::move(transport), spawned_test_server()->host_port_pair(), + ssl_config)); rv = callback.GetResult(sock->Connect(callback.callback())); EXPECT_EQ(OK, rv); @@ -1262,10 +1270,10 @@ TEST_F(SSLClientSocketTest, Write_WithSynchronousError) { // Note: |error_socket|'s ownership is handed to |transport|, but a pointer // is retained in order to configure additional errors. scoped_ptr<SynchronousErrorStreamSocket> error_socket( - new SynchronousErrorStreamSocket(real_transport.Pass())); + new SynchronousErrorStreamSocket(std::move(real_transport))); SynchronousErrorStreamSocket* raw_error_socket = error_socket.get(); scoped_ptr<FakeBlockingStreamSocket> transport( - new FakeBlockingStreamSocket(error_socket.Pass())); + new FakeBlockingStreamSocket(std::move(error_socket))); FakeBlockingStreamSocket* raw_transport = transport.get(); int rv = callback.GetResult(transport->Connect(callback.callback())); EXPECT_EQ(OK, rv); @@ -1275,7 +1283,8 @@ TEST_F(SSLClientSocketTest, Write_WithSynchronousError) { ssl_config.false_start_enabled = false; scoped_ptr<SSLClientSocket> sock(CreateSSLClientSocket( - transport.Pass(), spawned_test_server()->host_port_pair(), ssl_config)); + std::move(transport), spawned_test_server()->host_port_pair(), + ssl_config)); rv = callback.GetResult(sock->Connect(callback.callback())); EXPECT_EQ(OK, rv); @@ -1328,10 +1337,10 @@ TEST_F(SSLClientSocketTest, Write_WithSynchronousErrorNoRead) { // Note: intermediate sockets' ownership are handed to |sock|, but a pointer // is retained in order to query them. scoped_ptr<SynchronousErrorStreamSocket> error_socket( - new SynchronousErrorStreamSocket(real_transport.Pass())); + new SynchronousErrorStreamSocket(std::move(real_transport))); SynchronousErrorStreamSocket* raw_error_socket = error_socket.get(); scoped_ptr<CountingStreamSocket> counting_socket( - new CountingStreamSocket(error_socket.Pass())); + new CountingStreamSocket(std::move(error_socket))); CountingStreamSocket* raw_counting_socket = counting_socket.get(); int rv = callback.GetResult(counting_socket->Connect(callback.callback())); ASSERT_EQ(OK, rv); @@ -1341,7 +1350,7 @@ TEST_F(SSLClientSocketTest, Write_WithSynchronousErrorNoRead) { ssl_config.false_start_enabled = false; scoped_ptr<SSLClientSocket> sock(CreateSSLClientSocket( - counting_socket.Pass(), spawned_test_server()->host_port_pair(), + std::move(counting_socket), spawned_test_server()->host_port_pair(), ssl_config)); rv = callback.GetResult(sock->Connect(callback.callback())); @@ -1428,10 +1437,10 @@ TEST_F(SSLClientSocketTest, Read_DeleteWhilePendingFullDuplex) { // Note: |error_socket|'s ownership is handed to |transport|, but a pointer // is retained in order to configure additional errors. scoped_ptr<SynchronousErrorStreamSocket> error_socket( - new SynchronousErrorStreamSocket(real_transport.Pass())); + new SynchronousErrorStreamSocket(std::move(real_transport))); SynchronousErrorStreamSocket* raw_error_socket = error_socket.get(); scoped_ptr<FakeBlockingStreamSocket> transport( - new FakeBlockingStreamSocket(error_socket.Pass())); + new FakeBlockingStreamSocket(std::move(error_socket))); FakeBlockingStreamSocket* raw_transport = transport.get(); int rv = callback.GetResult(transport->Connect(callback.callback())); @@ -1442,7 +1451,8 @@ TEST_F(SSLClientSocketTest, Read_DeleteWhilePendingFullDuplex) { ssl_config.false_start_enabled = false; scoped_ptr<SSLClientSocket> sock = CreateSSLClientSocket( - transport.Pass(), spawned_test_server()->host_port_pair(), ssl_config); + std::move(transport), spawned_test_server()->host_port_pair(), + ssl_config); rv = callback.GetResult(sock->Connect(callback.callback())); EXPECT_EQ(OK, rv); @@ -1536,10 +1546,10 @@ TEST_F(SSLClientSocketTest, Read_WithWriteError) { // Note: |error_socket|'s ownership is handed to |transport|, but a pointer // is retained in order to configure additional errors. scoped_ptr<SynchronousErrorStreamSocket> error_socket( - new SynchronousErrorStreamSocket(real_transport.Pass())); + new SynchronousErrorStreamSocket(std::move(real_transport))); SynchronousErrorStreamSocket* raw_error_socket = error_socket.get(); scoped_ptr<FakeBlockingStreamSocket> transport( - new FakeBlockingStreamSocket(error_socket.Pass())); + new FakeBlockingStreamSocket(std::move(error_socket))); FakeBlockingStreamSocket* raw_transport = transport.get(); int rv = callback.GetResult(transport->Connect(callback.callback())); @@ -1550,7 +1560,8 @@ TEST_F(SSLClientSocketTest, Read_WithWriteError) { ssl_config.false_start_enabled = false; scoped_ptr<SSLClientSocket> sock(CreateSSLClientSocket( - transport.Pass(), spawned_test_server()->host_port_pair(), ssl_config)); + std::move(transport), spawned_test_server()->host_port_pair(), + ssl_config)); rv = callback.GetResult(sock->Connect(callback.callback())); EXPECT_EQ(OK, rv); @@ -1630,13 +1641,14 @@ TEST_F(SSLClientSocketTest, Connect_WithZeroReturn) { scoped_ptr<StreamSocket> real_transport( new TCPClientSocket(addr(), NULL, NetLog::Source())); scoped_ptr<SynchronousErrorStreamSocket> transport( - new SynchronousErrorStreamSocket(real_transport.Pass())); + new SynchronousErrorStreamSocket(std::move(real_transport))); int rv = callback.GetResult(transport->Connect(callback.callback())); EXPECT_EQ(OK, rv); SynchronousErrorStreamSocket* raw_transport = transport.get(); scoped_ptr<SSLClientSocket> sock(CreateSSLClientSocket( - transport.Pass(), spawned_test_server()->host_port_pair(), SSLConfig())); + std::move(transport), spawned_test_server()->host_port_pair(), + SSLConfig())); raw_transport->SetNextReadError(0); @@ -1655,7 +1667,7 @@ TEST_F(SSLClientSocketTest, Read_WithZeroReturn) { scoped_ptr<StreamSocket> real_transport( new TCPClientSocket(addr(), NULL, NetLog::Source())); scoped_ptr<SynchronousErrorStreamSocket> transport( - new SynchronousErrorStreamSocket(real_transport.Pass())); + new SynchronousErrorStreamSocket(std::move(real_transport))); int rv = callback.GetResult(transport->Connect(callback.callback())); EXPECT_EQ(OK, rv); @@ -1665,7 +1677,8 @@ TEST_F(SSLClientSocketTest, Read_WithZeroReturn) { SynchronousErrorStreamSocket* raw_transport = transport.get(); scoped_ptr<SSLClientSocket> sock(CreateSSLClientSocket( - transport.Pass(), spawned_test_server()->host_port_pair(), ssl_config)); + std::move(transport), spawned_test_server()->host_port_pair(), + ssl_config)); rv = callback.GetResult(sock->Connect(callback.callback())); EXPECT_EQ(OK, rv); @@ -1687,10 +1700,10 @@ TEST_F(SSLClientSocketTest, Read_WithAsyncZeroReturn) { scoped_ptr<StreamSocket> real_transport( new TCPClientSocket(addr(), NULL, NetLog::Source())); scoped_ptr<SynchronousErrorStreamSocket> error_socket( - new SynchronousErrorStreamSocket(real_transport.Pass())); + new SynchronousErrorStreamSocket(std::move(real_transport))); SynchronousErrorStreamSocket* raw_error_socket = error_socket.get(); scoped_ptr<FakeBlockingStreamSocket> transport( - new FakeBlockingStreamSocket(error_socket.Pass())); + new FakeBlockingStreamSocket(std::move(error_socket))); FakeBlockingStreamSocket* raw_transport = transport.get(); int rv = callback.GetResult(transport->Connect(callback.callback())); EXPECT_EQ(OK, rv); @@ -1700,7 +1713,8 @@ TEST_F(SSLClientSocketTest, Read_WithAsyncZeroReturn) { ssl_config.false_start_enabled = false; scoped_ptr<SSLClientSocket> sock(CreateSSLClientSocket( - transport.Pass(), spawned_test_server()->host_port_pair(), ssl_config)); + std::move(transport), spawned_test_server()->host_port_pair(), + ssl_config)); rv = callback.GetResult(sock->Connect(callback.callback())); EXPECT_EQ(OK, rv); @@ -1767,13 +1781,14 @@ TEST_F(SSLClientSocketTest, Read_ManySmallRecords) { scoped_ptr<StreamSocket> real_transport( new TCPClientSocket(addr(), NULL, NetLog::Source())); scoped_ptr<ReadBufferingStreamSocket> transport( - new ReadBufferingStreamSocket(real_transport.Pass())); + new ReadBufferingStreamSocket(std::move(real_transport))); ReadBufferingStreamSocket* raw_transport = transport.get(); int rv = callback.GetResult(transport->Connect(callback.callback())); ASSERT_EQ(OK, rv); scoped_ptr<SSLClientSocket> sock(CreateSSLClientSocket( - transport.Pass(), spawned_test_server()->host_port_pair(), SSLConfig())); + std::move(transport), spawned_test_server()->host_port_pair(), + SSLConfig())); rv = callback.GetResult(sock->Connect(callback.callback())); ASSERT_EQ(OK, rv); @@ -1840,7 +1855,8 @@ TEST_F(SSLClientSocketTest, Read_FullLogging) { EXPECT_EQ(OK, rv); scoped_ptr<SSLClientSocket> sock(CreateSSLClientSocket( - transport.Pass(), spawned_test_server()->host_port_pair(), SSLConfig())); + std::move(transport), spawned_test_server()->host_port_pair(), + SSLConfig())); rv = callback.GetResult(sock->Connect(callback.callback())); EXPECT_EQ(OK, rv); @@ -1908,7 +1924,8 @@ TEST_F(SSLClientSocketTest, PrematureApplicationData) { EXPECT_EQ(OK, rv); scoped_ptr<SSLClientSocket> sock(CreateSSLClientSocket( - transport.Pass(), spawned_test_server()->host_port_pair(), SSLConfig())); + std::move(transport), spawned_test_server()->host_port_pair(), + SSLConfig())); rv = callback.GetResult(sock->Connect(callback.callback())); EXPECT_EQ(ERR_SSL_PROTOCOL_ERROR, rv); @@ -1952,10 +1969,10 @@ TEST_F(SSLClientSocketTest, ClientSocketHandleNotFromPool) { EXPECT_EQ(OK, rv); scoped_ptr<ClientSocketHandle> socket_handle(new ClientSocketHandle()); - socket_handle->SetSocket(transport.Pass()); + socket_handle->SetSocket(std::move(transport)); scoped_ptr<SSLClientSocket> sock(socket_factory_->CreateSSLClientSocket( - socket_handle.Pass(), spawned_test_server()->host_port_pair(), + std::move(socket_handle), spawned_test_server()->host_port_pair(), SSLConfig(), context_)); EXPECT_FALSE(sock->IsConnected()); @@ -2472,12 +2489,13 @@ TEST_F(SSLClientSocketTest, ReusableAfterWrite) { scoped_ptr<StreamSocket> real_transport( new TCPClientSocket(addr(), NULL, NetLog::Source())); scoped_ptr<FakeBlockingStreamSocket> transport( - new FakeBlockingStreamSocket(real_transport.Pass())); + new FakeBlockingStreamSocket(std::move(real_transport))); FakeBlockingStreamSocket* raw_transport = transport.get(); ASSERT_EQ(OK, callback.GetResult(transport->Connect(callback.callback()))); scoped_ptr<SSLClientSocket> sock(CreateSSLClientSocket( - transport.Pass(), spawned_test_server()->host_port_pair(), SSLConfig())); + std::move(transport), spawned_test_server()->host_port_pair(), + SSLConfig())); ASSERT_EQ(OK, callback.GetResult(sock->Connect(callback.callback()))); // Block any application data from reaching the network. @@ -2529,7 +2547,7 @@ TEST_F(SSLClientSocketTest, SessionResumption) { TestCompletionCallback callback; ASSERT_EQ(OK, callback.GetResult(transport->Connect(callback.callback()))); scoped_ptr<SSLClientSocket> sock = CreateSSLClientSocket( - transport.Pass(), HostPortPair("example.com", 443), ssl_config); + std::move(transport), HostPortPair("example.com", 443), ssl_config); ASSERT_EQ(OK, callback.GetResult(sock->Connect(callback.callback()))); ASSERT_TRUE(sock->GetSSLInfo(&ssl_info)); EXPECT_EQ(SSLInfo::HANDSHAKE_FULL, ssl_info.handshake_type); diff --git a/net/socket/ssl_server_socket_openssl.cc b/net/socket/ssl_server_socket_openssl.cc index 5485858..014cfe6 100644 --- a/net/socket/ssl_server_socket_openssl.cc +++ b/net/socket/ssl_server_socket_openssl.cc @@ -6,6 +6,7 @@ #include <openssl/err.h> #include <openssl/ssl.h> +#include <utility> #include "base/callback_helpers.h" #include "base/logging.h" @@ -31,8 +32,8 @@ scoped_ptr<SSLServerSocket> CreateSSLServerSocket( crypto::RSAPrivateKey* key, const SSLServerConfig& ssl_config) { crypto::EnsureOpenSSLInit(); - return scoped_ptr<SSLServerSocket>( - new SSLServerSocketOpenSSL(socket.Pass(), certificate, key, ssl_config)); + return scoped_ptr<SSLServerSocket>(new SSLServerSocketOpenSSL( + std::move(socket), certificate, key, ssl_config)); } SSLServerSocketOpenSSL::SSLServerSocketOpenSSL( @@ -48,7 +49,7 @@ SSLServerSocketOpenSSL::SSLServerSocketOpenSSL( transport_write_error_(OK), ssl_(NULL), transport_bio_(NULL), - transport_socket_(transport_socket.Pass()), + transport_socket_(std::move(transport_socket)), ssl_config_(ssl_config), cert_(certificate), next_handshake_state_(STATE_NONE), diff --git a/net/socket/ssl_server_socket_unittest.cc b/net/socket/ssl_server_socket_unittest.cc index c6937b9..1419f5c 100644 --- a/net/socket/ssl_server_socket_unittest.cc +++ b/net/socket/ssl_server_socket_unittest.cc @@ -17,8 +17,8 @@ #include <stdint.h> #include <stdlib.h> - #include <queue> +#include <utility> #include "base/compiler_specific.h" #include "base/files/file_path.h" @@ -348,9 +348,10 @@ class SSLServerSocketTest : public PlatformTest { context.cert_verifier = cert_verifier_.get(); context.transport_security_state = transport_security_state_.get(); client_socket_ = socket_factory_->CreateSSLClientSocket( - client_connection.Pass(), host_and_pair, client_ssl_config_, context); + std::move(client_connection), host_and_pair, client_ssl_config_, + context); server_socket_ = - CreateSSLServerSocket(server_socket.Pass(), cert.get(), + CreateSSLServerSocket(std::move(server_socket), cert.get(), private_key.get(), server_ssl_config_); } diff --git a/net/socket/tcp_client_socket.cc b/net/socket/tcp_client_socket.cc index 5dbae5a..700fa1c 100644 --- a/net/socket/tcp_client_socket.cc +++ b/net/socket/tcp_client_socket.cc @@ -4,6 +4,8 @@ #include "net/socket/tcp_client_socket.h" +#include <utility> + #include "base/callback_helpers.h" #include "base/logging.h" #include "base/metrics/histogram_macros.h" @@ -28,7 +30,7 @@ TCPClientSocket::TCPClientSocket(const AddressList& addresses, TCPClientSocket::TCPClientSocket(scoped_ptr<TCPSocket> connected_socket, const IPEndPoint& peer_address) - : socket_(connected_socket.Pass()), + : socket_(std::move(connected_socket)), addresses_(AddressList(peer_address)), current_address_index_(0), next_connect_state_(CONNECT_STATE_NONE), diff --git a/net/socket/tcp_server_socket.cc b/net/socket/tcp_server_socket.cc index 5b1ad65..06f7512 100644 --- a/net/socket/tcp_server_socket.cc +++ b/net/socket/tcp_server_socket.cc @@ -4,6 +4,8 @@ #include "net/socket/tcp_server_socket.h" +#include <utility> + #include "base/bind.h" #include "base/bind_helpers.h" #include "base/logging.h" @@ -87,12 +89,12 @@ int TCPServerSocket::ConvertAcceptedSocket( int result, scoped_ptr<StreamSocket>* output_accepted_socket) { // Make sure the TCPSocket object is destroyed in any case. - scoped_ptr<TCPSocket> temp_accepted_socket(accepted_socket_.Pass()); + scoped_ptr<TCPSocket> temp_accepted_socket(std::move(accepted_socket_)); if (result != OK) return result; - output_accepted_socket->reset(new TCPClientSocket( - temp_accepted_socket.Pass(), accepted_address_)); + output_accepted_socket->reset( + new TCPClientSocket(std::move(temp_accepted_socket), accepted_address_)); return OK; } diff --git a/net/socket/transport_client_socket_pool.cc b/net/socket/transport_client_socket_pool.cc index e8c9f85..0949193 100644 --- a/net/socket/transport_client_socket_pool.cc +++ b/net/socket/transport_client_socket_pool.cc @@ -5,6 +5,7 @@ #include "net/socket/transport_client_socket_pool.h" #include <algorithm> +#include <utility> #include "base/compiler_specific.h" #include "base/lazy_instance.h" @@ -382,7 +383,7 @@ int TransportConnectJob::DoTransportConnectComplete(int result) { break; } - SetSocket(transport_socket_.Pass()); + SetSocket(std::move(transport_socket_)); } else { // Failure will be returned via |GetAdditionalErrorState|, so save // connection attempts from both sockets for use there. @@ -452,7 +453,7 @@ void TransportConnectJob::DoIPv6FallbackTransportConnectComplete(int result) { connect_timing_.connect_start = fallback_connect_start_time_; helper_.HistogramDuration( TransportConnectJobHelper::CONNECTION_LATENCY_IPV4_WINS_RACE); - SetSocket(fallback_transport_socket_.Pass()); + SetSocket(std::move(fallback_transport_socket_)); helper_.set_next_state(TransportConnectJobHelper::STATE_NONE); } else { // Failure will be returned via |GetAdditionalErrorState|, so save @@ -579,7 +580,7 @@ void TransportClientSocketPool::ReleaseSocket( const std::string& group_name, scoped_ptr<StreamSocket> socket, int id) { - base_.ReleaseSocket(group_name, socket.Pass(), id); + base_.ReleaseSocket(group_name, std::move(socket), id); } void TransportClientSocketPool::FlushWithError(int error) { diff --git a/net/socket/transport_client_socket_pool_test_util.cc b/net/socket/transport_client_socket_pool_test_util.cc index c4378cd..0140c25 100644 --- a/net/socket/transport_client_socket_pool_test_util.cc +++ b/net/socket/transport_client_socket_pool_test_util.cc @@ -5,8 +5,8 @@ #include "net/socket/transport_client_socket_pool_test_util.h" #include <stdint.h> - #include <string> +#include <utility> #include "base/location.h" #include "base/logging.h" @@ -205,7 +205,7 @@ class MockTriggerableClientSocket : public StreamSocket { new MockTriggerableClientSocket(addrlist, should_connect, net_log)); base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, socket->GetConnectCallback()); - return socket.Pass(); + return std::move(socket); } static scoped_ptr<StreamSocket> MakeMockDelayedClientSocket( @@ -217,7 +217,7 @@ class MockTriggerableClientSocket : public StreamSocket { new MockTriggerableClientSocket(addrlist, should_connect, net_log)); base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( FROM_HERE, socket->GetConnectCallback(), delay); - return socket.Pass(); + return std::move(socket); } static scoped_ptr<StreamSocket> MakeMockStalledClientSocket( @@ -232,7 +232,7 @@ class MockTriggerableClientSocket : public StreamSocket { attempts.push_back(ConnectionAttempt(addrlist[0], ERR_CONNECTION_FAILED)); socket->AddConnectionAttempts(attempts); } - return socket.Pass(); + return std::move(socket); } // StreamSocket implementation. @@ -425,7 +425,7 @@ MockTransportClientSocketFactory::CreateTransportClientSocket( // single-threaded. if (!run_loop_quit_closure_.is_null()) run_loop_quit_closure_.Run(); - return rv.Pass(); + return std::move(rv); } default: NOTREACHED(); diff --git a/net/socket/unix_domain_client_socket_posix.cc b/net/socket/unix_domain_client_socket_posix.cc index 8b15e73..fc2b303 100644 --- a/net/socket/unix_domain_client_socket_posix.cc +++ b/net/socket/unix_domain_client_socket_posix.cc @@ -6,6 +6,7 @@ #include <sys/socket.h> #include <sys/un.h> +#include <utility> #include "base/logging.h" #include "base/posix/eintr_wrapper.h" @@ -23,7 +24,7 @@ UnixDomainClientSocket::UnixDomainClientSocket(const std::string& socket_path, } UnixDomainClientSocket::UnixDomainClientSocket(scoped_ptr<SocketPosix> socket) - : use_abstract_namespace_(false), socket_(socket.Pass()) {} + : use_abstract_namespace_(false), socket_(std::move(socket)) {} UnixDomainClientSocket::~UnixDomainClientSocket() { Disconnect(); diff --git a/net/socket/unix_domain_client_socket_posix_unittest.cc b/net/socket/unix_domain_client_socket_posix_unittest.cc index 256853d..814595e 100644 --- a/net/socket/unix_domain_client_socket_posix_unittest.cc +++ b/net/socket/unix_domain_client_socket_posix_unittest.cc @@ -5,6 +5,7 @@ #include "net/socket/unix_domain_client_socket_posix.h" #include <unistd.h> +#include <utility> #include "base/bind.h" #include "base/files/file_path.h" @@ -185,7 +186,7 @@ TEST_F(UnixDomainClientSocketTest, ConnectWithSocketDescriptor) { ASSERT_TRUE(UnixDomainClientSocket::FillAddress(socket_path_, false, &addr)); scoped_ptr<SocketPosix> adopter(new SocketPosix); adopter->AdoptConnectedSocket(client_socket_fd, addr); - UnixDomainClientSocket rewrapped_socket(adopter.Pass()); + UnixDomainClientSocket rewrapped_socket(std::move(adopter)); EXPECT_TRUE(rewrapped_socket.IsConnected()); // Try to read data. diff --git a/net/socket/unix_domain_server_socket_posix.cc b/net/socket/unix_domain_server_socket_posix.cc index efe1f10..49945c3 100644 --- a/net/socket/unix_domain_server_socket_posix.cc +++ b/net/socket/unix_domain_server_socket_posix.cc @@ -8,6 +8,7 @@ #include <sys/socket.h> #include <sys/un.h> #include <unistd.h> +#include <utility> #include "base/logging.h" #include "net/base/net_errors.h" @@ -22,7 +23,7 @@ namespace { // Intended for use as SetterCallbacks in Accept() helper methods. void SetStreamSocket(scoped_ptr<StreamSocket>* socket, scoped_ptr<SocketPosix> accepted_socket) { - socket->reset(new UnixDomainClientSocket(accepted_socket.Pass())); + socket->reset(new UnixDomainClientSocket(std::move(accepted_socket))); } void SetSocketDescriptor(SocketDescriptor* socket, @@ -183,7 +184,7 @@ bool UnixDomainServerSocket::AuthenticateAndGetStreamSocket( return false; } - setter_callback.Run(accept_socket_.Pass()); + setter_callback.Run(std::move(accept_socket_)); return true; } diff --git a/net/socket/websocket_transport_client_socket_pool.cc b/net/socket/websocket_transport_client_socket_pool.cc index 4a7da5c..73d8599 100644 --- a/net/socket/websocket_transport_client_socket_pool.cc +++ b/net/socket/websocket_transport_client_socket_pool.cc @@ -5,6 +5,7 @@ #include "net/socket/websocket_transport_client_socket_pool.h" #include <algorithm> +#include <utility> #include "base/compiler_specific.h" #include "base/location.h" @@ -332,16 +333,14 @@ int WebSocketTransportClientSocketPool::RequestSocket( request_net_log.EndEvent(NetLog::TYPE_SOCKET_POOL); } else if (rv == ERR_IO_PENDING) { // TODO(ricea): Implement backup job timer? - AddJob(handle, connect_job.Pass()); + AddJob(handle, std::move(connect_job)); } else { scoped_ptr<StreamSocket> error_socket; connect_job->GetAdditionalErrorState(handle); error_socket = connect_job->PassSocket(); if (error_socket) { - HandOutSocket(error_socket.Pass(), - connect_job->connect_timing(), - handle, - request_net_log); + HandOutSocket(std::move(error_socket), connect_job->connect_timing(), + handle, request_net_log); } } @@ -368,7 +367,7 @@ void WebSocketTransportClientSocketPool::CancelRequest( return; scoped_ptr<StreamSocket> socket = handle->PassSocket(); if (socket) - ReleaseSocket(handle->group_name(), socket.Pass(), handle->id()); + ReleaseSocket(handle->group_name(), std::move(socket), handle->id()); if (!DeleteJob(handle)) pending_callbacks_.erase(handle); if (!ReachedMaxSocketsLimit() && !stalled_request_queue_.empty()) @@ -449,7 +448,7 @@ scoped_ptr<base::DictionaryValue> dict->SetInteger("max_socket_count", max_sockets_); dict->SetInteger("max_sockets_per_group", max_sockets_); dict->SetInteger("pool_generation_number", 0); - return dict.Pass(); + return dict; } TimeDelta WebSocketTransportClientSocketPool::ConnectionTimeout() const { @@ -483,7 +482,7 @@ void WebSocketTransportClientSocketPool::OnConnectJobComplete( if (result == OK) { DCHECK(socket.get()); handed_out_socket = true; - HandOutSocket(socket.Pass(), connect_timing, handle, request_net_log); + HandOutSocket(std::move(socket), connect_timing, handle, request_net_log); request_net_log.EndEvent(NetLog::TYPE_SOCKET_POOL); } else { // If we got a socket, it must contain error information so pass that @@ -491,7 +490,7 @@ void WebSocketTransportClientSocketPool::OnConnectJobComplete( job->GetAdditionalErrorState(handle); if (socket.get()) { handed_out_socket = true; - HandOutSocket(socket.Pass(), connect_timing, handle, request_net_log); + HandOutSocket(std::move(socket), connect_timing, handle, request_net_log); } request_net_log.EndEventWithNetErrorCode(NetLog::TYPE_SOCKET_POOL, result); } @@ -535,7 +534,7 @@ void WebSocketTransportClientSocketPool::HandOutSocket( ClientSocketHandle* handle, const BoundNetLog& net_log) { DCHECK(socket); - handle->SetSocket(socket.Pass()); + handle->SetSocket(std::move(socket)); DCHECK_EQ(ClientSocketHandle::UNUSED, handle->reuse_type()); DCHECK_EQ(0, handle->idle_time().InMicroseconds()); handle->set_pool_id(0); diff --git a/net/socket/websocket_transport_connect_sub_job.h b/net/socket/websocket_transport_connect_sub_job.h index d74a37e..36a4e943 100644 --- a/net/socket/websocket_transport_connect_sub_job.h +++ b/net/socket/websocket_transport_connect_sub_job.h @@ -6,6 +6,7 @@ #define NET_SOCKET_WEBSOCKET_TRANSPORT_CONNECT_SUB_JOB_H_ #include <stddef.h> +#include <utility> #include "base/compiler_specific.h" #include "base/macros.h" @@ -46,7 +47,7 @@ class WebSocketTransportConnectSubJob SubJobType type() const { return type_; } - scoped_ptr<StreamSocket> PassSocket() { return transport_socket_.Pass(); } + scoped_ptr<StreamSocket> PassSocket() { return std::move(transport_socket_); } // Implementation of WebSocketEndpointLockManager::EndpointWaiter. void GotEndpointLock() override; diff --git a/net/spdy/spdy_buffer.cc b/net/spdy/spdy_buffer.cc index 4482f99..fad3305 100644 --- a/net/spdy/spdy_buffer.cc +++ b/net/spdy/spdy_buffer.cc @@ -5,6 +5,7 @@ #include "net/spdy/spdy_buffer.h" #include <cstring> +#include <utility> #include "base/callback.h" #include "base/logging.h" @@ -29,7 +30,7 @@ scoped_ptr<SpdyFrame> MakeSpdyFrame(const char* data, size_t size) { std::memcpy(frame_data.get(), data, size); scoped_ptr<SpdyFrame> frame( new SpdyFrame(frame_data.release(), size, true /* owns_buffer */)); - return frame.Pass(); + return frame; } } // namespace @@ -58,7 +59,7 @@ class SpdyBuffer::SharedFrameIOBuffer : public IOBuffer { SpdyBuffer::SpdyBuffer(scoped_ptr<SpdyFrame> frame) : shared_frame_(new SharedFrame()), offset_(0) { - shared_frame_->data = frame.Pass(); + shared_frame_->data = std::move(frame); } // The given data may not be strictly a SPDY frame; we (ab)use diff --git a/net/spdy/spdy_buffer_producer.cc b/net/spdy/spdy_buffer_producer.cc index 3a9598c..8f18d19 100644 --- a/net/spdy/spdy_buffer_producer.cc +++ b/net/spdy/spdy_buffer_producer.cc @@ -4,6 +4,8 @@ #include "net/spdy/spdy_buffer_producer.h" +#include <utility> + #include "base/logging.h" #include "net/spdy/spdy_buffer.h" #include "net/spdy/spdy_protocol.h" @@ -15,13 +17,13 @@ SpdyBufferProducer::SpdyBufferProducer() {} SpdyBufferProducer::~SpdyBufferProducer() {} SimpleBufferProducer::SimpleBufferProducer(scoped_ptr<SpdyBuffer> buffer) - : buffer_(buffer.Pass()) {} + : buffer_(std::move(buffer)) {} SimpleBufferProducer::~SimpleBufferProducer() {} scoped_ptr<SpdyBuffer> SimpleBufferProducer::ProduceBuffer() { DCHECK(buffer_); - return buffer_.Pass(); + return std::move(buffer_); } } // namespace net diff --git a/net/spdy/spdy_header_block.cc b/net/spdy/spdy_header_block.cc index 4287433..49243a7 100644 --- a/net/spdy/spdy_header_block.cc +++ b/net/spdy/spdy_header_block.cc @@ -238,7 +238,7 @@ scoped_ptr<base::Value> SpdyHeaderBlockNetLogCallback( capture_mode, it->first.as_string(), it->second.as_string()))); } dict->Set("headers", headers_dict); - return dict.Pass(); + return std::move(dict); } bool SpdyHeaderBlockFromNetLogParam( diff --git a/net/spdy/spdy_http_stream.cc b/net/spdy/spdy_http_stream.cc index 45fe832..16e19b2 100644 --- a/net/spdy/spdy_http_stream.cc +++ b/net/spdy/spdy_http_stream.cc @@ -6,6 +6,7 @@ #include <algorithm> #include <list> +#include <utility> #include "base/bind.h" #include "base/callback_helpers.h" @@ -282,7 +283,7 @@ int SpdyHttpStream::SendRequest(const HttpRequestHeaders& request_headers, NetLog::TYPE_HTTP_TRANSACTION_HTTP2_SEND_REQUEST_HEADERS, base::Bind(&SpdyHeaderBlockNetLogCallback, headers.get())); result = stream_->SendRequestHeaders( - headers.Pass(), + std::move(headers), HasUploadData() ? MORE_DATA_TO_SEND : NO_MORE_DATA_TO_SEND); if (result == ERR_IO_PENDING) { @@ -360,7 +361,7 @@ void SpdyHttpStream::OnDataReceived(scoped_ptr<SpdyBuffer> buffer) { DCHECK(stream_.get()); DCHECK(!stream_->IsClosed() || stream_->type() == SPDY_PUSH_STREAM); if (buffer) { - response_body_queue_.Enqueue(buffer.Pass()); + response_body_queue_.Enqueue(std::move(buffer)); if (user_buffer_.get()) { // Handing small chunks of data to the caller creates measurable overhead. diff --git a/net/spdy/spdy_network_transaction_unittest.cc b/net/spdy/spdy_network_transaction_unittest.cc index de58732..1c41254 100644 --- a/net/spdy/spdy_network_transaction_unittest.cc +++ b/net/spdy/spdy_network_transaction_unittest.cc @@ -3,6 +3,7 @@ // found in the LICENSE file. #include <string> +#include <utility> #include <vector> #include "base/bind.h" @@ -123,8 +124,8 @@ scoped_ptr<SpdySessionDependencies> CreateSpdySessionDependencies( scoped_ptr<SpdySessionDependencies> CreateSpdySessionDependencies( SpdyNetworkTransactionTestParams test_params, scoped_ptr<ProxyService> proxy_service) { - scoped_ptr<SpdySessionDependencies> session_deps( - new SpdySessionDependencies(test_params.protocol, proxy_service.Pass())); + scoped_ptr<SpdySessionDependencies> session_deps(new SpdySessionDependencies( + test_params.protocol, std::move(proxy_service))); UpdateSpdySessionDependencies(test_params, session_deps.get()); return session_deps; } @@ -176,7 +177,7 @@ class SpdyNetworkTransactionTest priority_(priority), session_deps_(session_deps.get() == NULL ? CreateSpdySessionDependencies(test_params) - : session_deps.Pass()), + : std::move(session_deps)), session_( SpdySessionDependencies::SpdyCreateSession(session_deps_.get())), log_(log), @@ -306,7 +307,7 @@ class SpdyNetworkTransactionTest SocketDataProvider* data, scoped_ptr<SSLSocketDataProvider> ssl_provider) { RunPreTestSetup(); - AddDataWithSSLSocketDataProvider(data, ssl_provider.Pass()); + AddDataWithSSLSocketDataProvider(data, std::move(ssl_provider)); RunDefaultTest(); VerifyDataConsumed(); } @@ -316,7 +317,7 @@ class SpdyNetworkTransactionTest new SSLSocketDataProvider(ASYNC, OK)); ssl_provider->cert = ImportCertFromFile(GetTestCertsDirectory(), "spdy_pooling.pem"); - AddDataWithSSLSocketDataProvider(data, ssl_provider.Pass()); + AddDataWithSSLSocketDataProvider(data, std::move(ssl_provider)); } void AddDataWithSSLSocketDataProvider( @@ -345,7 +346,7 @@ class SpdyNetworkTransactionTest } void SetSession(scoped_ptr<HttpNetworkSession> session) { - session_ = session.Pass(); + session_ = std::move(session); } HttpNetworkTransaction* trans() { return trans_.get(); } void ResetTrans() { trans_.reset(); } @@ -2976,7 +2977,7 @@ TEST_P(SpdyNetworkTransactionTest, ServerPushNoURL) { (*incomplete_headers)[spdy_util_.GetVersionKey()] = "HTTP/1.1"; (*incomplete_headers)["hello"] = "bye"; scoped_ptr<SpdyFrame> stream2_syn(spdy_util_.ConstructInitialSpdyPushFrame( - incomplete_headers.Pass(), 2, 1)); + std::move(incomplete_headers), 2, 1)); MockRead reads[] = { CreateMockRead(*stream1_reply, 1), CreateMockRead(*stream2_syn, 2), @@ -3487,7 +3488,7 @@ TEST_P(SpdyNetworkTransactionTest, DecompressFailureOnSynReply) { session_deps->enable_compression = true; NormalSpdyTransactionHelper helper(CreateGetRequest(), DEFAULT_PRIORITY, BoundNetLog(), GetParam(), - session_deps.Pass()); + std::move(session_deps)); helper.RunToCompletion(&data); TransactionHelperResult out = helper.output(); EXPECT_EQ(ERR_SPDY_COMPRESSION_ERROR, out.rv); @@ -4056,7 +4057,7 @@ TEST_P(SpdyNetworkTransactionTest, SettingsSaved) { (*reply_headers)[spdy_util_.GetStatusKey()] = "200"; (*reply_headers)[spdy_util_.GetVersionKey()] = "HTTP/1.1"; scoped_ptr<SpdyFrame> reply( - spdy_util_.ConstructSpdyFrame(kSynReplyInfo, reply_headers.Pass())); + spdy_util_.ConstructSpdyFrame(kSynReplyInfo, std::move(reply_headers))); const SpdySettingsIds kSampleId1 = SETTINGS_UPLOAD_BANDWIDTH; unsigned int kSampleValue1 = 0x0a0a0a0a; @@ -4207,7 +4208,7 @@ TEST_P(SpdyNetworkTransactionTest, SettingsPlayback) { (*reply_headers)[spdy_util_.GetStatusKey()] = "200"; (*reply_headers)[spdy_util_.GetVersionKey()] = "HTTP/1.1"; scoped_ptr<SpdyFrame> reply( - spdy_util_.ConstructSpdyFrame(kSynReplyInfo, reply_headers.Pass())); + spdy_util_.ConstructSpdyFrame(kSynReplyInfo, std::move(reply_headers))); scoped_ptr<SpdyFrame> body(spdy_util_.ConstructSpdyBodyFrame(1, true)); MockRead reads[] = { @@ -4344,7 +4345,7 @@ TEST_P(SpdyNetworkTransactionTest, HTTP11RequiredRetry) { // Do not force SPDY so that second socket can negotiate HTTP/1.1. session_deps->next_protos = SpdyNextProtos(); NormalSpdyTransactionHelper helper(request, DEFAULT_PRIORITY, BoundNetLog(), - GetParam(), session_deps.Pass()); + GetParam(), std::move(session_deps)); // First socket: HTTP/2 request rejected with HTTP_1_1_REQUIRED. const char* url = request.url.spec().c_str(); @@ -4366,7 +4367,7 @@ TEST_P(SpdyNetworkTransactionTest, HTTP11RequiredRetry) { ssl_provider0->next_protos_expected_in_ssl_config.push_back(kProtoHTTP2); // Force SPDY. ssl_provider0->SetNextProto(GetParam().protocol); - helper.AddDataWithSSLSocketDataProvider(&data0, ssl_provider0.Pass()); + helper.AddDataWithSSLSocketDataProvider(&data0, std::move(ssl_provider0)); // Second socket: falling back to HTTP/1.1. MockWrite writes1[] = {MockWrite(ASYNC, 0, @@ -4386,7 +4387,7 @@ TEST_P(SpdyNetworkTransactionTest, HTTP11RequiredRetry) { ssl_provider1->next_protos_expected_in_ssl_config.push_back(kProtoHTTP11); // Force HTTP/1.1. ssl_provider1->SetNextProto(kProtoHTTP11); - helper.AddDataWithSSLSocketDataProvider(&data1, ssl_provider1.Pass()); + helper.AddDataWithSSLSocketDataProvider(&data1, std::move(ssl_provider1)); base::WeakPtr<HttpServerProperties> http_server_properties = helper.session()->spdy_session_pool()->http_server_properties(); @@ -4436,7 +4437,7 @@ TEST_P(SpdyNetworkTransactionTest, HTTP11RequiredProxyRetry) { // Do not force SPDY so that second socket can negotiate HTTP/1.1. session_deps->next_protos = SpdyNextProtos(); NormalSpdyTransactionHelper helper(request, DEFAULT_PRIORITY, BoundNetLog(), - GetParam(), session_deps.Pass()); + GetParam(), std::move(session_deps)); // First socket: HTTP/2 CONNECT rejected with HTTP_1_1_REQUIRED. scoped_ptr<SpdyFrame> req(spdy_util_.ConstructSpdyConnect( @@ -4456,7 +4457,7 @@ TEST_P(SpdyNetworkTransactionTest, HTTP11RequiredProxyRetry) { ssl_provider0->next_protos_expected_in_ssl_config.push_back(kProtoHTTP2); // Force SPDY. ssl_provider0->SetNextProto(GetParam().protocol); - helper.AddDataWithSSLSocketDataProvider(&data0, ssl_provider0.Pass()); + helper.AddDataWithSSLSocketDataProvider(&data0, std::move(ssl_provider0)); // Second socket: retry using HTTP/1.1. MockWrite writes1[] = { @@ -4486,7 +4487,7 @@ TEST_P(SpdyNetworkTransactionTest, HTTP11RequiredProxyRetry) { ssl_provider1->next_protos_expected_in_ssl_config.push_back(kProtoHTTP11); // Force HTTP/1.1. ssl_provider1->SetNextProto(kProtoHTTP11); - helper.AddDataWithSSLSocketDataProvider(&data1, ssl_provider1.Pass()); + helper.AddDataWithSSLSocketDataProvider(&data1, std::move(ssl_provider1)); // A third socket is needed for the tunnelled connection. scoped_ptr<SSLSocketDataProvider> ssl_provider2( @@ -4691,7 +4692,7 @@ TEST_P(SpdyNetworkTransactionTest, DirectConnectProxyReconnect) { ProxyService::CreateFixedFromPacResult("PROXY myproxy:70")); session_peer.SetProxyService(proxy_service.get()); helper_proxy.session_deps().swap(ssd_proxy); - helper_proxy.SetSession(session_proxy.Pass()); + helper_proxy.SetSession(std::move(session_proxy)); helper_proxy.RunPreTestSetup(); helper_proxy.AddData(data_proxy.get()); @@ -4963,21 +4964,16 @@ TEST_P(SpdyNetworkTransactionTest, ServerPushWithHeaders) { scoped_ptr<SpdyHeaderBlock> initial_headers(new SpdyHeaderBlock()); spdy_util_.AddUrlToHeaderBlock(GetDefaultUrlWithPath("/foo.dat"), initial_headers.get()); - scoped_ptr<SpdyFrame> stream2_syn( - spdy_util_.ConstructInitialSpdyPushFrame(initial_headers.Pass(), 2, 1)); + scoped_ptr<SpdyFrame> stream2_syn(spdy_util_.ConstructInitialSpdyPushFrame( + std::move(initial_headers), 2, 1)); scoped_ptr<SpdyHeaderBlock> late_headers(new SpdyHeaderBlock()); (*late_headers)[spdy_util_.GetStatusKey()] = "200"; (*late_headers)[spdy_util_.GetVersionKey()] = "HTTP/1.1"; (*late_headers)["hello"] = "bye"; - scoped_ptr<SpdyFrame> stream2_headers( - spdy_util_.ConstructSpdyControlFrame(late_headers.Pass(), - false, - 2, - LOWEST, - HEADERS, - CONTROL_FLAG_NONE, - 0)); + scoped_ptr<SpdyFrame> stream2_headers(spdy_util_.ConstructSpdyControlFrame( + std::move(late_headers), false, 2, LOWEST, HEADERS, CONTROL_FLAG_NONE, + 0)); scoped_ptr<SpdyFrame> stream1_reply(spdy_util_.ConstructSpdyGetSynReply(NULL, 0, 1)); @@ -5025,21 +5021,16 @@ TEST_P(SpdyNetworkTransactionTest, ServerPushClaimBeforeHeaders) { scoped_ptr<SpdyHeaderBlock> initial_headers(new SpdyHeaderBlock()); spdy_util_.AddUrlToHeaderBlock(GetDefaultUrlWithPath("/foo.dat"), initial_headers.get()); - scoped_ptr<SpdyFrame> stream2_syn( - spdy_util_.ConstructInitialSpdyPushFrame(initial_headers.Pass(), 2, 1)); + scoped_ptr<SpdyFrame> stream2_syn(spdy_util_.ConstructInitialSpdyPushFrame( + std::move(initial_headers), 2, 1)); scoped_ptr<SpdyHeaderBlock> late_headers(new SpdyHeaderBlock()); (*late_headers)[spdy_util_.GetStatusKey()] = "200"; (*late_headers)[spdy_util_.GetVersionKey()] = "HTTP/1.1"; (*late_headers)["hello"] = "bye"; - scoped_ptr<SpdyFrame> stream2_headers( - spdy_util_.ConstructSpdyControlFrame(late_headers.Pass(), - false, - 2, - LOWEST, - HEADERS, - CONTROL_FLAG_NONE, - 0)); + scoped_ptr<SpdyFrame> stream2_headers(spdy_util_.ConstructSpdyControlFrame( + std::move(late_headers), false, 2, LOWEST, HEADERS, CONTROL_FLAG_NONE, + 0)); scoped_ptr<SpdyFrame> stream1_reply(spdy_util_.ConstructSpdyGetSynReply(NULL, 0, 1)); @@ -5144,19 +5135,14 @@ TEST_P(SpdyNetworkTransactionTest, ServerPushWithTwoHeaderFrames) { } spdy_util_.AddUrlToHeaderBlock(GetDefaultUrlWithPath("/foo.dat"), initial_headers.get()); - scoped_ptr<SpdyFrame> stream2_syn( - spdy_util_.ConstructInitialSpdyPushFrame(initial_headers.Pass(), 2, 1)); + scoped_ptr<SpdyFrame> stream2_syn(spdy_util_.ConstructInitialSpdyPushFrame( + std::move(initial_headers), 2, 1)); scoped_ptr<SpdyHeaderBlock> middle_headers(new SpdyHeaderBlock()); (*middle_headers)["hello"] = "bye"; - scoped_ptr<SpdyFrame> stream2_headers1( - spdy_util_.ConstructSpdyControlFrame(middle_headers.Pass(), - false, - 2, - LOWEST, - HEADERS, - CONTROL_FLAG_NONE, - 0)); + scoped_ptr<SpdyFrame> stream2_headers1(spdy_util_.ConstructSpdyControlFrame( + std::move(middle_headers), false, 2, LOWEST, HEADERS, CONTROL_FLAG_NONE, + 0)); scoped_ptr<SpdyHeaderBlock> late_headers(new SpdyHeaderBlock()); (*late_headers)[spdy_util_.GetStatusKey()] = "200"; @@ -5164,14 +5150,9 @@ TEST_P(SpdyNetworkTransactionTest, ServerPushWithTwoHeaderFrames) { // HTTP/2 eliminates use of the :version header. (*late_headers)[spdy_util_.GetVersionKey()] = "HTTP/1.1"; } - scoped_ptr<SpdyFrame> stream2_headers2( - spdy_util_.ConstructSpdyControlFrame(late_headers.Pass(), - false, - 2, - LOWEST, - HEADERS, - CONTROL_FLAG_NONE, - 0)); + scoped_ptr<SpdyFrame> stream2_headers2(spdy_util_.ConstructSpdyControlFrame( + std::move(late_headers), false, 2, LOWEST, HEADERS, CONTROL_FLAG_NONE, + 0)); scoped_ptr<SpdyFrame> stream1_reply(spdy_util_.ConstructSpdyGetSynReply(NULL, 0, 1)); @@ -5280,19 +5261,14 @@ TEST_P(SpdyNetworkTransactionTest, ServerPushWithNoStatusHeaderFrames) { scoped_ptr<SpdyHeaderBlock> initial_headers(new SpdyHeaderBlock()); spdy_util_.AddUrlToHeaderBlock(GetDefaultUrlWithPath("/foo.dat"), initial_headers.get()); - scoped_ptr<SpdyFrame> stream2_syn( - spdy_util_.ConstructInitialSpdyPushFrame(initial_headers.Pass(), 2, 1)); + scoped_ptr<SpdyFrame> stream2_syn(spdy_util_.ConstructInitialSpdyPushFrame( + std::move(initial_headers), 2, 1)); scoped_ptr<SpdyHeaderBlock> middle_headers(new SpdyHeaderBlock()); (*middle_headers)["hello"] = "bye"; - scoped_ptr<SpdyFrame> stream2_headers1( - spdy_util_.ConstructSpdyControlFrame(middle_headers.Pass(), - false, - 2, - LOWEST, - HEADERS, - CONTROL_FLAG_NONE, - 0)); + scoped_ptr<SpdyFrame> stream2_headers1(spdy_util_.ConstructSpdyControlFrame( + std::move(middle_headers), false, 2, LOWEST, HEADERS, CONTROL_FLAG_NONE, + 0)); scoped_ptr<SpdyFrame> stream1_reply(spdy_util_.ConstructSpdyGetSynReply(NULL, 0, 1)); @@ -5382,14 +5358,9 @@ TEST_P(SpdyNetworkTransactionTest, SynReplyWithHeaders) { scoped_ptr<SpdyHeaderBlock> late_headers(new SpdyHeaderBlock()); (*late_headers)["hello"] = "bye"; - scoped_ptr<SpdyFrame> stream1_headers( - spdy_util_.ConstructSpdyControlFrame(late_headers.Pass(), - false, - 1, - LOWEST, - HEADERS, - CONTROL_FLAG_NONE, - 0)); + scoped_ptr<SpdyFrame> stream1_headers(spdy_util_.ConstructSpdyControlFrame( + std::move(late_headers), false, 1, LOWEST, HEADERS, CONTROL_FLAG_NONE, + 0)); scoped_ptr<SpdyFrame> stream1_body( spdy_util_.ConstructSpdyBodyFrame(1, true)); MockRead reads[] = { @@ -5424,14 +5395,9 @@ TEST_P(SpdyNetworkTransactionTest, SyncReplyDataAfterTrailers) { scoped_ptr<SpdyHeaderBlock> late_headers(new SpdyHeaderBlock()); (*late_headers)["hello"] = "bye"; - scoped_ptr<SpdyFrame> stream1_headers( - spdy_util_.ConstructSpdyControlFrame(late_headers.Pass(), - false, - 1, - LOWEST, - HEADERS, - CONTROL_FLAG_NONE, - 0)); + scoped_ptr<SpdyFrame> stream1_headers(spdy_util_.ConstructSpdyControlFrame( + std::move(late_headers), false, 1, LOWEST, HEADERS, CONTROL_FLAG_NONE, + 0)); scoped_ptr<SpdyFrame> stream1_body( spdy_util_.ConstructSpdyBodyFrame(1, false)); scoped_ptr<SpdyFrame> stream1_body2( @@ -5532,7 +5498,7 @@ TEST_P(SpdyNetworkTransactionTest, ServerPushCrossOriginCorrectness) { CreateSpdySessionDependencies(GetParam())); session_deps->trusted_spdy_proxy = "123.45.67.89:8080"; NormalSpdyTransactionHelper helper(request, DEFAULT_PRIORITY, BoundNetLog(), - GetParam(), session_deps.Pass()); + GetParam(), std::move(session_deps)); helper.RunPreTestSetup(); helper.AddData(&data); @@ -6390,7 +6356,7 @@ TEST_P(SpdyNetworkTransactionTest, GoAwayOnOddPushStreamId) { spdy_util_.AddUrlToHeaderBlock("http://www.example.org/a.dat", push_headers.get()); scoped_ptr<SpdyFrame> push( - spdy_util_.ConstructInitialSpdyPushFrame(push_headers.Pass(), 3, 1)); + spdy_util_.ConstructInitialSpdyPushFrame(std::move(push_headers), 3, 1)); MockRead reads[] = {CreateMockRead(*push, 1)}; scoped_ptr<SpdyFrame> req( @@ -6419,8 +6385,8 @@ TEST_P(SpdyNetworkTransactionTest, scoped_ptr<SpdyHeaderBlock> push_b_headers(new SpdyHeaderBlock); spdy_util_.AddUrlToHeaderBlock(GetDefaultUrlWithPath("/b.dat"), push_b_headers.get()); - scoped_ptr<SpdyFrame> push_b( - spdy_util_.ConstructInitialSpdyPushFrame(push_b_headers.Pass(), 2, 1)); + scoped_ptr<SpdyFrame> push_b(spdy_util_.ConstructInitialSpdyPushFrame( + std::move(push_b_headers), 2, 1)); MockRead reads[] = { CreateMockRead(*push_a, 1), CreateMockRead(*push_b, 2), }; @@ -6507,7 +6473,7 @@ class SpdyNetworkTransactionNoTLSUsageCheckTest request.url = GURL("https://www.example.org/"); NormalSpdyTransactionHelper helper( request, DEFAULT_PRIORITY, BoundNetLog(), GetParam(), NULL); - helper.RunToCompletionWithSSLData(&data, ssl_provider.Pass()); + helper.RunToCompletionWithSSLData(&data, std::move(ssl_provider)); TransactionHelperResult out = helper.output(); EXPECT_EQ(OK, out.rv); EXPECT_EQ("HTTP/1.1 200", out.status_line); @@ -6534,7 +6500,7 @@ TEST_P(SpdyNetworkTransactionNoTLSUsageCheckTest, TLSVersionTooOld) { SSLConnectionStatusSetVersion(SSL_CONNECTION_VERSION_SSL3, &ssl_provider->connection_status); - RunNoTLSUsageCheckTest(ssl_provider.Pass()); + RunNoTLSUsageCheckTest(std::move(ssl_provider)); } TEST_P(SpdyNetworkTransactionNoTLSUsageCheckTest, TLSCipherSuiteSucky) { @@ -6543,7 +6509,7 @@ TEST_P(SpdyNetworkTransactionNoTLSUsageCheckTest, TLSCipherSuiteSucky) { // Set to TLS_RSA_WITH_NULL_MD5 SSLConnectionStatusSetCipherSuite(0x1, &ssl_provider->connection_status); - RunNoTLSUsageCheckTest(ssl_provider.Pass()); + RunNoTLSUsageCheckTest(std::move(ssl_provider)); } class SpdyNetworkTransactionTLSUsageCheckTest @@ -6560,7 +6526,7 @@ class SpdyNetworkTransactionTLSUsageCheckTest request.url = GURL("https://www.example.org/"); NormalSpdyTransactionHelper helper( request, DEFAULT_PRIORITY, BoundNetLog(), GetParam(), NULL); - helper.RunToCompletionWithSSLData(&data, ssl_provider.Pass()); + helper.RunToCompletionWithSSLData(&data, std::move(ssl_provider)); TransactionHelperResult out = helper.output(); EXPECT_EQ(ERR_SPDY_INADEQUATE_TRANSPORT_SECURITY, out.rv); } @@ -6582,7 +6548,7 @@ TEST_P(SpdyNetworkTransactionTLSUsageCheckTest, TLSVersionTooOld) { SSLConnectionStatusSetVersion(SSL_CONNECTION_VERSION_SSL3, &ssl_provider->connection_status); - RunTLSUsageCheckTest(ssl_provider.Pass()); + RunTLSUsageCheckTest(std::move(ssl_provider)); } TEST_P(SpdyNetworkTransactionTLSUsageCheckTest, TLSCipherSuiteSucky) { @@ -6591,7 +6557,7 @@ TEST_P(SpdyNetworkTransactionTLSUsageCheckTest, TLSCipherSuiteSucky) { // Set to TLS_RSA_WITH_NULL_MD5 SSLConnectionStatusSetCipherSuite(0x1, &ssl_provider->connection_status); - RunTLSUsageCheckTest(ssl_provider.Pass()); + RunTLSUsageCheckTest(std::move(ssl_provider)); } } // namespace net diff --git a/net/spdy/spdy_proxy_client_socket.cc b/net/spdy/spdy_proxy_client_socket.cc index 5f0b162..df2530b 100644 --- a/net/spdy/spdy_proxy_client_socket.cc +++ b/net/spdy/spdy_proxy_client_socket.cc @@ -5,6 +5,7 @@ #include "net/spdy/spdy_proxy_client_socket.h" #include <algorithm> // min +#include <utility> #include "base/bind.h" #include "base/bind_helpers.h" @@ -373,7 +374,8 @@ int SpdyProxyClientSocket::DoSendRequest() { spdy_stream_->GetProtocolVersion(), true, headers.get()); - return spdy_stream_->SendRequestHeaders(headers.Pass(), MORE_DATA_TO_SEND); + return spdy_stream_->SendRequestHeaders(std::move(headers), + MORE_DATA_TO_SEND); } int SpdyProxyClientSocket::DoSendRequestComplete(int result) { @@ -468,7 +470,7 @@ void SpdyProxyClientSocket::OnDataReceived(scoped_ptr<SpdyBuffer> buffer) { net_log_.AddByteTransferEvent(NetLog::TYPE_SOCKET_BYTES_RECEIVED, buffer->GetRemainingSize(), buffer->GetRemainingData()); - read_buffer_queue_.Enqueue(buffer.Pass()); + read_buffer_queue_.Enqueue(std::move(buffer)); } else { net_log_.AddByteTransferEvent(NetLog::TYPE_SOCKET_BYTES_RECEIVED, 0, NULL); } diff --git a/net/spdy/spdy_session.cc b/net/spdy/spdy_session.cc index 4a13b641..a2fec98 100644 --- a/net/spdy/spdy_session.cc +++ b/net/spdy/spdy_session.cc @@ -7,6 +7,7 @@ #include <algorithm> #include <limits> #include <map> +#include <utility> #include "base/bind.h" #include "base/compiler_specific.h" @@ -78,7 +79,7 @@ scoped_ptr<base::ListValue> SpdyHeaderBlockToListValue( ElideHeaderValueForNetLog(capture_mode, it->first.as_string(), it->second.as_string())); } - return headers_list.Pass(); + return headers_list; } scoped_ptr<base::Value> NetLogSpdySynStreamSentCallback( @@ -94,7 +95,7 @@ scoped_ptr<base::Value> NetLogSpdySynStreamSentCallback( dict->SetBoolean("unidirectional", unidirectional); dict->SetInteger("priority", static_cast<int>(spdy_priority)); dict->SetInteger("stream_id", stream_id); - return dict.Pass(); + return std::move(dict); } scoped_ptr<base::Value> NetLogSpdySynStreamReceivedCallback( @@ -112,7 +113,7 @@ scoped_ptr<base::Value> NetLogSpdySynStreamReceivedCallback( dict->SetInteger("priority", static_cast<int>(spdy_priority)); dict->SetInteger("stream_id", stream_id); dict->SetInteger("associated_stream", associated_stream); - return dict.Pass(); + return std::move(dict); } scoped_ptr<base::Value> NetLogSpdySynReplyOrHeadersReceivedCallback( @@ -124,7 +125,7 @@ scoped_ptr<base::Value> NetLogSpdySynReplyOrHeadersReceivedCallback( dict->Set("headers", SpdyHeaderBlockToListValue(*headers, capture_mode)); dict->SetBoolean("fin", fin); dict->SetInteger("stream_id", stream_id); - return dict.Pass(); + return std::move(dict); } scoped_ptr<base::Value> NetLogSpdySessionCloseCallback( @@ -134,7 +135,7 @@ scoped_ptr<base::Value> NetLogSpdySessionCloseCallback( scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); dict->SetInteger("net_error", net_error); dict->SetString("description", *description); - return dict.Pass(); + return std::move(dict); } scoped_ptr<base::Value> NetLogSpdySessionCallback( @@ -143,7 +144,7 @@ scoped_ptr<base::Value> NetLogSpdySessionCallback( scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); dict->SetString("host", host_pair->first.ToString()); dict->SetString("proxy", host_pair->second.ToPacString()); - return dict.Pass(); + return std::move(dict); } scoped_ptr<base::Value> NetLogSpdyInitializedCallback( @@ -156,7 +157,7 @@ scoped_ptr<base::Value> NetLogSpdyInitializedCallback( } dict->SetString("protocol", SSLClientSocket::NextProtoToString(protocol_version)); - return dict.Pass(); + return std::move(dict); } scoped_ptr<base::Value> NetLogSpdySettingsCallback( @@ -166,7 +167,7 @@ scoped_ptr<base::Value> NetLogSpdySettingsCallback( scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); dict->SetString("host", host_port_pair.ToString()); dict->SetBoolean("clear_persisted", clear_persisted); - return dict.Pass(); + return std::move(dict); } scoped_ptr<base::Value> NetLogSpdySettingCallback( @@ -180,7 +181,7 @@ scoped_ptr<base::Value> NetLogSpdySettingCallback( SpdyConstants::SerializeSettingId(protocol_version, id)); dict->SetInteger("flags", flags); dict->SetInteger("value", value); - return dict.Pass(); + return std::move(dict); } scoped_ptr<base::Value> NetLogSpdySendSettingsCallback( @@ -200,8 +201,8 @@ scoped_ptr<base::Value> NetLogSpdySendSettingsCallback( flags, value))); } - dict->Set("settings", settings_list.Pass()); - return dict.Pass(); + dict->Set("settings", std::move(settings_list)); + return std::move(dict); } scoped_ptr<base::Value> NetLogSpdyWindowUpdateFrameCallback( @@ -211,7 +212,7 @@ scoped_ptr<base::Value> NetLogSpdyWindowUpdateFrameCallback( scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); dict->SetInteger("stream_id", static_cast<int>(stream_id)); dict->SetInteger("delta", delta); - return dict.Pass(); + return std::move(dict); } scoped_ptr<base::Value> NetLogSpdySessionWindowUpdateCallback( @@ -221,7 +222,7 @@ scoped_ptr<base::Value> NetLogSpdySessionWindowUpdateCallback( scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); dict->SetInteger("delta", delta); dict->SetInteger("window_size", window_size); - return dict.Pass(); + return std::move(dict); } scoped_ptr<base::Value> NetLogSpdyDataCallback( @@ -233,7 +234,7 @@ scoped_ptr<base::Value> NetLogSpdyDataCallback( dict->SetInteger("stream_id", static_cast<int>(stream_id)); dict->SetInteger("size", size); dict->SetBoolean("fin", fin); - return dict.Pass(); + return std::move(dict); } scoped_ptr<base::Value> NetLogSpdyRstCallback( @@ -245,7 +246,7 @@ scoped_ptr<base::Value> NetLogSpdyRstCallback( dict->SetInteger("stream_id", static_cast<int>(stream_id)); dict->SetInteger("status", status); dict->SetString("description", *description); - return dict.Pass(); + return std::move(dict); } scoped_ptr<base::Value> NetLogSpdyPingCallback( @@ -257,7 +258,7 @@ scoped_ptr<base::Value> NetLogSpdyPingCallback( dict->SetInteger("unique_id", static_cast<int>(unique_id)); dict->SetString("type", type); dict->SetBoolean("is_ack", is_ack); - return dict.Pass(); + return std::move(dict); } scoped_ptr<base::Value> NetLogSpdyGoAwayCallback( @@ -275,7 +276,7 @@ scoped_ptr<base::Value> NetLogSpdyGoAwayCallback( dict->SetInteger("status", static_cast<int>(status)); dict->SetString("debug_data", ElideGoAwayDebugDataForNetLog(capture_mode, debug_data)); - return dict.Pass(); + return std::move(dict); } scoped_ptr<base::Value> NetLogSpdyPushPromiseReceivedCallback( @@ -287,7 +288,7 @@ scoped_ptr<base::Value> NetLogSpdyPushPromiseReceivedCallback( dict->Set("headers", SpdyHeaderBlockToListValue(*headers, capture_mode)); dict->SetInteger("id", stream_id); dict->SetInteger("promised_stream_id", promised_stream_id); - return dict.Pass(); + return std::move(dict); } scoped_ptr<base::Value> NetLogSpdyAdoptedPushStreamCallback( @@ -297,7 +298,7 @@ scoped_ptr<base::Value> NetLogSpdyAdoptedPushStreamCallback( scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); dict->SetInteger("stream_id", stream_id); dict->SetString("url", url->spec()); - return dict.Pass(); + return std::move(dict); } // Helper function to return the total size of an array of objects @@ -746,7 +747,7 @@ void SpdySession::InitializeWithSocket( // requires re-working CreateFakeSpdySession(), though. DCHECK(connection->socket()); - connection_ = connection.Pass(); + connection_ = std::move(connection); is_secure_ = is_secure; certificate_error_code_ = certificate_error_code; @@ -921,7 +922,7 @@ int SpdySession::CreateStream(const SpdyStreamRequest& request, request.priority(), stream_initial_send_window_size_, stream_max_recv_window_size_, request.net_log())); *stream = new_stream->GetWeakPtr(); - InsertCreatedStream(new_stream.Pass()); + InsertCreatedStream(std::move(new_stream)); UMA_HISTOGRAM_CUSTOM_COUNTS( "Net.SpdyPriorityCount", @@ -1068,7 +1069,7 @@ void SpdySession::EnqueueStreamWrite( DCHECK(frame_type == HEADERS || frame_type == DATA || frame_type == SYN_STREAM); - EnqueueWrite(stream->priority(), frame_type, producer.Pass(), stream); + EnqueueWrite(stream->priority(), frame_type, std::move(producer), stream); } scoped_ptr<SpdyFrame> SpdySession::CreateSynStream( @@ -1154,7 +1155,7 @@ scoped_ptr<SpdyFrame> SpdySession::CreateSynStream( spdy_priority, stream_id)); } - return syn_frame.Pass(); + return syn_frame; } scoped_ptr<SpdyBuffer> SpdySession::CreateDataBuffer(SpdyStreamId stream_id, @@ -1267,7 +1268,7 @@ scoped_ptr<SpdyBuffer> SpdySession::CreateDataBuffer(SpdyStreamId stream_id, scoped_ptr<SpdyFrame> frame(buffered_spdy_framer_->CreateDataFrame( stream_id, data->data(), static_cast<uint32_t>(effective_len), flags)); - scoped_ptr<SpdyBuffer> data_buffer(new SpdyBuffer(frame.Pass())); + scoped_ptr<SpdyBuffer> data_buffer(new SpdyBuffer(std::move(frame))); // Send window size is based on payload size, so nothing to do if this is // just a FIN with no payload. @@ -1280,7 +1281,7 @@ scoped_ptr<SpdyBuffer> SpdySession::CreateDataBuffer(SpdyStreamId stream_id, static_cast<size_t>(effective_len))); } - return data_buffer.Pass(); + return data_buffer; } void SpdySession::CloseActiveStream(SpdyStreamId stream_id, int status) { @@ -1356,7 +1357,7 @@ void SpdySession::CloseActiveStreamIterator(ActiveStreamMap::iterator it, num_active_pushed_streams_--; } - DeleteStream(owned_stream.Pass(), status); + DeleteStream(std::move(owned_stream), status); // If there are no active streams and the socket pool is stalled, close the // session to free up a socket slot. @@ -1370,7 +1371,7 @@ void SpdySession::CloseCreatedStreamIterator(CreatedStreamSet::iterator it, int status) { scoped_ptr<SpdyStream> owned_stream(*it); created_streams_.erase(it); - DeleteStream(owned_stream.Pass(), status); + DeleteStream(std::move(owned_stream), status); } void SpdySession::ResetStreamIterator(ActiveStreamMap::iterator it, @@ -1401,7 +1402,7 @@ void SpdySession::EnqueueResetStreamFrame(SpdyStreamId stream_id, scoped_ptr<SpdyFrame> rst_frame( buffered_spdy_framer_->CreateRstStream(stream_id, status)); - EnqueueSessionWrite(priority, RST_STREAM, rst_frame.Pass()); + EnqueueSessionWrite(priority, RST_STREAM, std::move(rst_frame)); RecordProtocolErrorHistogram(MapRstStreamStatusToProtocolError(status)); } @@ -1603,7 +1604,7 @@ int SpdySession::DoWrite() { CHECK_EQ(stream->stream_id(), 0u); scoped_ptr<SpdyStream> owned_stream = ActivateCreatedStream(stream.get()); - InsertActivatedStream(owned_stream.Pass()); + InsertActivatedStream(std::move(owned_stream)); if (stream_hi_water_mark_ > kLastStreamId) { CHECK_EQ(stream->stream_id(), kLastStreamId); @@ -1875,7 +1876,7 @@ scoped_ptr<base::Value> SpdySession::GetInfoAsValue() const { for (const auto& alias : pooled_aliases_) { alias_list->AppendString(alias.host_port_pair().ToString()); } - dict->Set("aliases", alias_list.Pass()); + dict->Set("aliases", std::move(alias_list)); } dict->SetString("proxy", host_port_proxy_pair().second.ToURI()); @@ -1908,7 +1909,7 @@ scoped_ptr<base::Value> SpdySession::GetInfoAsValue() const { dict->SetInteger("recv_window_size", session_recv_window_size_); dict->SetInteger("unacked_recv_window_bytes", session_unacked_recv_window_bytes_); - return dict.Pass(); + return std::move(dict); } bool SpdySession::IsReused() const { @@ -1952,12 +1953,10 @@ void SpdySession::EnqueueSessionWrite(RequestPriority priority, DCHECK(frame_type == RST_STREAM || frame_type == SETTINGS || frame_type == WINDOW_UPDATE || frame_type == PING || frame_type == GOAWAY); - EnqueueWrite( - priority, frame_type, - scoped_ptr<SpdyBufferProducer>( - new SimpleBufferProducer( - scoped_ptr<SpdyBuffer>(new SpdyBuffer(frame.Pass())))), - base::WeakPtr<SpdyStream>()); + EnqueueWrite(priority, frame_type, + scoped_ptr<SpdyBufferProducer>(new SimpleBufferProducer( + scoped_ptr<SpdyBuffer>(new SpdyBuffer(std::move(frame))))), + base::WeakPtr<SpdyStream>()); } void SpdySession::EnqueueWrite(RequestPriority priority, @@ -1967,7 +1966,7 @@ void SpdySession::EnqueueWrite(RequestPriority priority, if (availability_state_ == STATE_DRAINING) return; - write_queue_.Enqueue(priority, frame_type, producer.Pass(), stream); + write_queue_.Enqueue(priority, frame_type, std::move(producer), stream); MaybePostWriteLoop(); } @@ -1994,7 +1993,7 @@ scoped_ptr<SpdyStream> SpdySession::ActivateCreatedStream(SpdyStream* stream) { stream->set_stream_id(GetNewStreamId()); scoped_ptr<SpdyStream> owned_stream(stream); created_streams_.erase(stream); - return owned_stream.Pass(); + return owned_stream; } void SpdySession::InsertActivatedStream(scoped_ptr<SpdyStream> stream) { @@ -2151,7 +2150,7 @@ void SpdySession::OnStreamFrameData(SpdyStreamId stream_id, return; } - stream->OnDataReceived(buffer.Pass()); + stream->OnDataReceived(std::move(buffer)); } void SpdySession::OnStreamPadding(SpdyStreamId stream_id, size_t len) { @@ -2782,7 +2781,7 @@ bool SpdySession::TryCreatePushStream(SpdyStreamId stream_id, DCHECK(inserted_pushed_it != pushed_it); DeleteExpiredPushedStreams(); - InsertActivatedStream(stream.Pass()); + InsertActivatedStream(std::move(stream)); ActiveStreamMap::iterator active_it = active_streams_.find(stream_id); if (active_it == active_streams_.end()) { @@ -2834,7 +2833,7 @@ void SpdySession::SendInitialData() { false /* take_ownership */)); // Count the prefix as part of the subsequent SETTINGS frame. EnqueueSessionWrite(HIGHEST, SETTINGS, - connection_header_prefix_frame.Pass()); + std::move(connection_header_prefix_frame)); } // First, notify the server about the settings they should use when @@ -2902,7 +2901,7 @@ void SpdySession::SendSettings(const SettingsMap& settings) { scoped_ptr<SpdyFrame> settings_frame( buffered_spdy_framer_->CreateSettings(settings)); sent_settings_ = true; - EnqueueSessionWrite(HIGHEST, SETTINGS, settings_frame.Pass()); + EnqueueSessionWrite(HIGHEST, SETTINGS, std::move(settings_frame)); } void SpdySession::HandleSetting(uint32_t id, uint32_t value) { @@ -2985,14 +2984,14 @@ void SpdySession::SendWindowUpdateFrame(SpdyStreamId stream_id, DCHECK(buffered_spdy_framer_.get()); scoped_ptr<SpdyFrame> window_update_frame( buffered_spdy_framer_->CreateWindowUpdate(stream_id, delta_window_size)); - EnqueueSessionWrite(priority, WINDOW_UPDATE, window_update_frame.Pass()); + EnqueueSessionWrite(priority, WINDOW_UPDATE, std::move(window_update_frame)); } void SpdySession::WritePingFrame(SpdyPingId unique_id, bool is_ack) { DCHECK(buffered_spdy_framer_.get()); scoped_ptr<SpdyFrame> ping_frame( buffered_spdy_framer_->CreatePingFrame(unique_id, is_ack)); - EnqueueSessionWrite(HIGHEST, PING, ping_frame.Pass()); + EnqueueSessionWrite(HIGHEST, PING, std::move(ping_frame)); if (net_log().IsCapturing()) { net_log().AddEvent( diff --git a/net/spdy/spdy_session_pool.cc b/net/spdy/spdy_session_pool.cc index e8fe3fa..1208878 100644 --- a/net/spdy/spdy_session_pool.cc +++ b/net/spdy/spdy_session_pool.cc @@ -4,6 +4,8 @@ #include "net/spdy/spdy_session_pool.h" +#include <utility> + #include "base/logging.h" #include "base/metrics/histogram_macros.h" #include "base/profiler/scoped_tracker.h" @@ -101,8 +103,8 @@ base::WeakPtr<SpdySession> SpdySessionPool::CreateAvailableSessionFromSocket( stream_max_recv_window_size_, initial_max_concurrent_streams_, time_func_, trusted_spdy_proxy_, net_log.net_log())); - new_session->InitializeWithSocket( - connection.Pass(), this, is_secure, certificate_error_code); + new_session->InitializeWithSocket(std::move(connection), this, is_secure, + certificate_error_code); base::WeakPtr<SpdySession> available_session = new_session->GetWeakPtr(); sessions_.insert(new_session.release()); @@ -259,7 +261,7 @@ scoped_ptr<base::Value> SpdySessionPool::SpdySessionPoolInfoToValue() const { if (key.Equals(session_key)) list->Append(it->second->GetInfoAsValue()); } - return list.Pass(); + return std::move(list); } void SpdySessionPool::OnIPAddressChanged() { diff --git a/net/spdy/spdy_session_pool_unittest.cc b/net/spdy/spdy_session_pool_unittest.cc index dd1e3ba..3791c7f 100644 --- a/net/spdy/spdy_session_pool_unittest.cc +++ b/net/spdy/spdy_session_pool_unittest.cc @@ -6,6 +6,7 @@ #include <cstddef> #include <string> +#include <utility> #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" @@ -555,7 +556,7 @@ TEST_P(SpdySessionPoolTest, IPAddressChanged) { scoped_ptr<SpdyHeaderBlock> headers( spdy_util.ConstructGetHeaderBlock(urlA.spec())); - spdy_streamA->SendRequestHeaders(headers.Pass(), NO_MORE_DATA_TO_SEND); + spdy_streamA->SendRequestHeaders(std::move(headers), NO_MORE_DATA_TO_SEND); EXPECT_TRUE(spdy_streamA->HasUrlFromHeaders()); base::MessageLoop::current()->RunUntilIdle(); // Allow headers to write. diff --git a/net/spdy/spdy_session_unittest.cc b/net/spdy/spdy_session_unittest.cc index e2367ab..ea8ae11 100644 --- a/net/spdy/spdy_session_unittest.cc +++ b/net/spdy/spdy_session_unittest.cc @@ -4,6 +4,8 @@ #include "net/spdy/spdy_session.h" +#include <utility> + #include "base/base64.h" #include "base/bind.h" #include "base/callback.h" @@ -238,7 +240,7 @@ class StreamRequestDestroyingCallback : public TestCompletionCallbackBase { ~StreamRequestDestroyingCallback() override {} void SetRequestToDestroy(scoped_ptr<SpdyStreamRequest> request) { - request_ = request.Pass(); + request_ = std::move(request); } CompletionCallback MakeCallback() { @@ -294,7 +296,7 @@ TEST_P(SpdySessionTest, PendingStreamCancellingAnother) { SPDY_BIDIRECTIONAL_STREAM, session_, test_url_, MEDIUM, BoundNetLog(), callback2.callback())); - callback1.SetRequestToDestroy(request2.Pass()); + callback1.SetRequestToDestroy(std::move(request2)); session_->CloseSessionOnError(ERR_ABORTED, "Aborting session"); @@ -390,9 +392,9 @@ TEST_P(SpdySessionTest, GoAwayWithActiveStreams) { spdy_util_.ConstructGetHeaderBlock(kDefaultURL)); scoped_ptr<SpdyHeaderBlock> headers2(new SpdyHeaderBlock(*headers)); - spdy_stream1->SendRequestHeaders(headers.Pass(), NO_MORE_DATA_TO_SEND); + spdy_stream1->SendRequestHeaders(std::move(headers), NO_MORE_DATA_TO_SEND); EXPECT_TRUE(spdy_stream1->HasUrlFromHeaders()); - spdy_stream2->SendRequestHeaders(headers2.Pass(), NO_MORE_DATA_TO_SEND); + spdy_stream2->SendRequestHeaders(std::move(headers2), NO_MORE_DATA_TO_SEND); EXPECT_TRUE(spdy_stream2->HasUrlFromHeaders()); base::RunLoop().RunUntilIdle(); @@ -453,7 +455,7 @@ TEST_P(SpdySessionTest, GoAwayWithActiveAndCreatedStream) { spdy_stream1->SetDelegate(&delegate1); scoped_ptr<SpdyHeaderBlock> headers1( spdy_util_.ConstructGetHeaderBlock(kDefaultURL)); - spdy_stream1->SendRequestHeaders(headers1.Pass(), NO_MORE_DATA_TO_SEND); + spdy_stream1->SendRequestHeaders(std::move(headers1), NO_MORE_DATA_TO_SEND); EXPECT_TRUE(spdy_stream1->HasUrlFromHeaders()); EXPECT_EQ(0u, spdy_stream1->stream_id()); @@ -526,9 +528,9 @@ TEST_P(SpdySessionTest, GoAwayTwice) { spdy_util_.ConstructGetHeaderBlock(kDefaultURL)); scoped_ptr<SpdyHeaderBlock> headers2(new SpdyHeaderBlock(*headers)); - spdy_stream1->SendRequestHeaders(headers.Pass(), NO_MORE_DATA_TO_SEND); + spdy_stream1->SendRequestHeaders(std::move(headers), NO_MORE_DATA_TO_SEND); EXPECT_TRUE(spdy_stream1->HasUrlFromHeaders()); - spdy_stream2->SendRequestHeaders(headers2.Pass(), NO_MORE_DATA_TO_SEND); + spdy_stream2->SendRequestHeaders(std::move(headers2), NO_MORE_DATA_TO_SEND); EXPECT_TRUE(spdy_stream2->HasUrlFromHeaders()); base::RunLoop().RunUntilIdle(); @@ -599,9 +601,9 @@ TEST_P(SpdySessionTest, GoAwayWithActiveStreamsThenClose) { spdy_util_.ConstructGetHeaderBlock(kDefaultURL)); scoped_ptr<SpdyHeaderBlock> headers2(new SpdyHeaderBlock(*headers)); - spdy_stream1->SendRequestHeaders(headers.Pass(), NO_MORE_DATA_TO_SEND); + spdy_stream1->SendRequestHeaders(std::move(headers), NO_MORE_DATA_TO_SEND); EXPECT_TRUE(spdy_stream1->HasUrlFromHeaders()); - spdy_stream2->SendRequestHeaders(headers2.Pass(), NO_MORE_DATA_TO_SEND); + spdy_stream2->SendRequestHeaders(std::move(headers2), NO_MORE_DATA_TO_SEND); EXPECT_TRUE(spdy_stream2->HasUrlFromHeaders()); base::RunLoop().RunUntilIdle(); @@ -680,7 +682,7 @@ TEST_P(SpdySessionTest, GoAwayWhileDraining) { scoped_ptr<SpdyHeaderBlock> headers( spdy_util_.ConstructGetHeaderBlock(kDefaultURL)); - spdy_stream->SendRequestHeaders(headers.Pass(), NO_MORE_DATA_TO_SEND); + spdy_stream->SendRequestHeaders(std::move(headers), NO_MORE_DATA_TO_SEND); EXPECT_TRUE(spdy_stream->HasUrlFromHeaders()); base::RunLoop().RunUntilIdle(); @@ -724,7 +726,7 @@ TEST_P(SpdySessionTest, CreateStreamAfterGoAway) { scoped_ptr<SpdyHeaderBlock> headers( spdy_util_.ConstructGetHeaderBlock(kDefaultURL)); - spdy_stream->SendRequestHeaders(headers.Pass(), NO_MORE_DATA_TO_SEND); + spdy_stream->SendRequestHeaders(std::move(headers), NO_MORE_DATA_TO_SEND); EXPECT_TRUE(spdy_stream->HasUrlFromHeaders()); base::RunLoop().RunUntilIdle(); @@ -787,7 +789,7 @@ TEST_P(SpdySessionTest, SynStreamAfterGoAway) { scoped_ptr<SpdyHeaderBlock> headers( spdy_util_.ConstructGetHeaderBlock(kDefaultURL)); - spdy_stream->SendRequestHeaders(headers.Pass(), NO_MORE_DATA_TO_SEND); + spdy_stream->SendRequestHeaders(std::move(headers), NO_MORE_DATA_TO_SEND); EXPECT_TRUE(spdy_stream->HasUrlFromHeaders()); base::RunLoop().RunUntilIdle(); @@ -839,7 +841,7 @@ TEST_P(SpdySessionTest, NetworkChangeWithActiveStreams) { scoped_ptr<SpdyHeaderBlock> headers( spdy_util_.ConstructGetHeaderBlock(kDefaultURL)); - spdy_stream->SendRequestHeaders(headers.Pass(), NO_MORE_DATA_TO_SEND); + spdy_stream->SendRequestHeaders(std::move(headers), NO_MORE_DATA_TO_SEND); EXPECT_TRUE(spdy_stream->HasUrlFromHeaders()); base::RunLoop().RunUntilIdle(); @@ -994,7 +996,7 @@ TEST_P(SpdySessionTest, PingAndWriteLoop) { scoped_ptr<SpdyHeaderBlock> headers( spdy_util_.ConstructGetHeaderBlock(kDefaultURL)); - spdy_stream->SendRequestHeaders(headers.Pass(), NO_MORE_DATA_TO_SEND); + spdy_stream->SendRequestHeaders(std::move(headers), NO_MORE_DATA_TO_SEND); // Shift time so that a ping will be sent out. g_time_delta = base::TimeDelta::FromSeconds(11); @@ -1230,7 +1232,7 @@ TEST_P(SpdySessionTest, DeleteExpiredPushStreams) { scoped_ptr<SpdyHeaderBlock> headers( spdy_util_.ConstructGetHeaderBlock(kDefaultURL)); - spdy_stream->SendRequestHeaders(headers.Pass(), NO_MORE_DATA_TO_SEND); + spdy_stream->SendRequestHeaders(std::move(headers), NO_MORE_DATA_TO_SEND); base::RunLoop().RunUntilIdle(); @@ -1752,7 +1754,7 @@ TEST_P(SpdySessionTest, SynCompressionHistograms) { scoped_ptr<SpdyHeaderBlock> headers( spdy_util_.ConstructGetHeaderBlock(kDefaultURL)); - spdy_stream->SendRequestHeaders(headers.Pass(), NO_MORE_DATA_TO_SEND); + spdy_stream->SendRequestHeaders(std::move(headers), NO_MORE_DATA_TO_SEND); EXPECT_TRUE(spdy_stream->HasUrlFromHeaders()); // Write request headers & capture resulting histogram update. @@ -1837,14 +1839,14 @@ TEST_P(SpdySessionTest, OutOfOrderSynStreams) { scoped_ptr<SpdyHeaderBlock> headers_lowest( spdy_util_.ConstructGetHeaderBlock(kDefaultURL)); - spdy_stream_lowest->SendRequestHeaders( - headers_lowest.Pass(), NO_MORE_DATA_TO_SEND); + spdy_stream_lowest->SendRequestHeaders(std::move(headers_lowest), + NO_MORE_DATA_TO_SEND); EXPECT_TRUE(spdy_stream_lowest->HasUrlFromHeaders()); scoped_ptr<SpdyHeaderBlock> headers_highest( spdy_util_.ConstructGetHeaderBlock(kDefaultURL)); - spdy_stream_highest->SendRequestHeaders( - headers_highest.Pass(), NO_MORE_DATA_TO_SEND); + spdy_stream_highest->SendRequestHeaders(std::move(headers_highest), + NO_MORE_DATA_TO_SEND); EXPECT_TRUE(spdy_stream_highest->HasUrlFromHeaders()); base::RunLoop().RunUntilIdle(); @@ -1899,12 +1901,12 @@ TEST_P(SpdySessionTest, CancelStream) { scoped_ptr<SpdyHeaderBlock> headers( spdy_util_.ConstructGetHeaderBlock(kDefaultURL)); - spdy_stream1->SendRequestHeaders(headers.Pass(), NO_MORE_DATA_TO_SEND); + spdy_stream1->SendRequestHeaders(std::move(headers), NO_MORE_DATA_TO_SEND); EXPECT_TRUE(spdy_stream1->HasUrlFromHeaders()); scoped_ptr<SpdyHeaderBlock> headers2( spdy_util_.ConstructGetHeaderBlock(kDefaultURL)); - spdy_stream2->SendRequestHeaders(headers2.Pass(), NO_MORE_DATA_TO_SEND); + spdy_stream2->SendRequestHeaders(std::move(headers2), NO_MORE_DATA_TO_SEND); EXPECT_TRUE(spdy_stream2->HasUrlFromHeaders()); EXPECT_EQ(0u, spdy_stream1->stream_id()); @@ -1962,12 +1964,12 @@ TEST_P(SpdySessionTest, CloseSessionWithTwoCreatedSelfClosingStreams) { scoped_ptr<SpdyHeaderBlock> headers( spdy_util_.ConstructGetHeaderBlock(kDefaultURL)); - spdy_stream1->SendRequestHeaders(headers.Pass(), NO_MORE_DATA_TO_SEND); + spdy_stream1->SendRequestHeaders(std::move(headers), NO_MORE_DATA_TO_SEND); EXPECT_TRUE(spdy_stream1->HasUrlFromHeaders()); scoped_ptr<SpdyHeaderBlock> headers2( spdy_util_.ConstructGetHeaderBlock(kDefaultURL)); - spdy_stream2->SendRequestHeaders(headers2.Pass(), NO_MORE_DATA_TO_SEND); + spdy_stream2->SendRequestHeaders(std::move(headers2), NO_MORE_DATA_TO_SEND); EXPECT_TRUE(spdy_stream2->HasUrlFromHeaders()); // Ensure that the streams have not yet been activated and assigned an id. @@ -2018,12 +2020,12 @@ TEST_P(SpdySessionTest, CloseSessionWithTwoCreatedMutuallyClosingStreams) { scoped_ptr<SpdyHeaderBlock> headers( spdy_util_.ConstructGetHeaderBlock(kDefaultURL)); - spdy_stream1->SendRequestHeaders(headers.Pass(), NO_MORE_DATA_TO_SEND); + spdy_stream1->SendRequestHeaders(std::move(headers), NO_MORE_DATA_TO_SEND); EXPECT_TRUE(spdy_stream1->HasUrlFromHeaders()); scoped_ptr<SpdyHeaderBlock> headers2( spdy_util_.ConstructGetHeaderBlock(kDefaultURL)); - spdy_stream2->SendRequestHeaders(headers2.Pass(), NO_MORE_DATA_TO_SEND); + spdy_stream2->SendRequestHeaders(std::move(headers2), NO_MORE_DATA_TO_SEND); EXPECT_TRUE(spdy_stream2->HasUrlFromHeaders()); // Ensure that the streams have not yet been activated and assigned an id. @@ -2085,12 +2087,12 @@ TEST_P(SpdySessionTest, CloseSessionWithTwoActivatedSelfClosingStreams) { scoped_ptr<SpdyHeaderBlock> headers( spdy_util_.ConstructGetHeaderBlock(kDefaultURL)); - spdy_stream1->SendRequestHeaders(headers.Pass(), NO_MORE_DATA_TO_SEND); + spdy_stream1->SendRequestHeaders(std::move(headers), NO_MORE_DATA_TO_SEND); EXPECT_TRUE(spdy_stream1->HasUrlFromHeaders()); scoped_ptr<SpdyHeaderBlock> headers2( spdy_util_.ConstructGetHeaderBlock(kDefaultURL)); - spdy_stream2->SendRequestHeaders(headers2.Pass(), NO_MORE_DATA_TO_SEND); + spdy_stream2->SendRequestHeaders(std::move(headers2), NO_MORE_DATA_TO_SEND); EXPECT_TRUE(spdy_stream2->HasUrlFromHeaders()); // Ensure that the streams have not yet been activated and assigned an id. @@ -2161,12 +2163,12 @@ TEST_P(SpdySessionTest, CloseSessionWithTwoActivatedMutuallyClosingStreams) { scoped_ptr<SpdyHeaderBlock> headers( spdy_util_.ConstructGetHeaderBlock(kDefaultURL)); - spdy_stream1->SendRequestHeaders(headers.Pass(), NO_MORE_DATA_TO_SEND); + spdy_stream1->SendRequestHeaders(std::move(headers), NO_MORE_DATA_TO_SEND); EXPECT_TRUE(spdy_stream1->HasUrlFromHeaders()); scoped_ptr<SpdyHeaderBlock> headers2( spdy_util_.ConstructGetHeaderBlock(kDefaultURL)); - spdy_stream2->SendRequestHeaders(headers2.Pass(), NO_MORE_DATA_TO_SEND); + spdy_stream2->SendRequestHeaders(std::move(headers2), NO_MORE_DATA_TO_SEND); EXPECT_TRUE(spdy_stream2->HasUrlFromHeaders()); // Ensure that the streams have not yet been activated and assigned an id. @@ -2249,7 +2251,7 @@ TEST_P(SpdySessionTest, CloseActivatedStreamThatClosesSession) { scoped_ptr<SpdyHeaderBlock> headers( spdy_util_.ConstructGetHeaderBlock(kDefaultURL)); - spdy_stream->SendRequestHeaders(headers.Pass(), NO_MORE_DATA_TO_SEND); + spdy_stream->SendRequestHeaders(std::move(headers), NO_MORE_DATA_TO_SEND); EXPECT_TRUE(spdy_stream->HasUrlFromHeaders()); EXPECT_EQ(0u, spdy_stream->stream_id()); @@ -2420,7 +2422,7 @@ TEST_P(SpdySessionTest, CloseTwoStalledCreateStream) { scoped_ptr<SpdyHeaderBlock> headers( spdy_util_.ConstructGetHeaderBlock(kDefaultURL)); - spdy_stream1->SendRequestHeaders(headers.Pass(), NO_MORE_DATA_TO_SEND); + spdy_stream1->SendRequestHeaders(std::move(headers), NO_MORE_DATA_TO_SEND); EXPECT_TRUE(spdy_stream1->HasUrlFromHeaders()); // Run until 1st stream is activated and then closed. @@ -2445,7 +2447,7 @@ TEST_P(SpdySessionTest, CloseTwoStalledCreateStream) { stream2->SetDelegate(&delegate2); scoped_ptr<SpdyHeaderBlock> headers2( spdy_util_.ConstructGetHeaderBlock(kDefaultURL)); - stream2->SendRequestHeaders(headers2.Pass(), NO_MORE_DATA_TO_SEND); + stream2->SendRequestHeaders(std::move(headers2), NO_MORE_DATA_TO_SEND); EXPECT_TRUE(stream2->HasUrlFromHeaders()); // Run until 2nd stream is activated and then closed. @@ -2470,7 +2472,7 @@ TEST_P(SpdySessionTest, CloseTwoStalledCreateStream) { stream3->SetDelegate(&delegate3); scoped_ptr<SpdyHeaderBlock> headers3( spdy_util_.ConstructGetHeaderBlock(kDefaultURL)); - stream3->SendRequestHeaders(headers3.Pass(), NO_MORE_DATA_TO_SEND); + stream3->SendRequestHeaders(std::move(headers3), NO_MORE_DATA_TO_SEND); EXPECT_TRUE(stream3->HasUrlFromHeaders()); // Run until 2nd stream is activated and then closed. @@ -2619,7 +2621,7 @@ TEST_P(SpdySessionTest, ReadDataWithoutYielding) { scoped_ptr<SpdyHeaderBlock> headers1( spdy_util_.ConstructGetHeaderBlock(kDefaultURL)); - spdy_stream1->SendRequestHeaders(headers1.Pass(), NO_MORE_DATA_TO_SEND); + spdy_stream1->SendRequestHeaders(std::move(headers1), NO_MORE_DATA_TO_SEND); EXPECT_TRUE(spdy_stream1->HasUrlFromHeaders()); // Set up the TaskObserver to verify SpdySession::DoReadLoop doesn't @@ -2683,7 +2685,7 @@ TEST_P(SpdySessionTest, TestYieldingSlowReads) { scoped_ptr<SpdyHeaderBlock> headers1( spdy_util_.ConstructGetHeaderBlock(kDefaultURL)); - spdy_stream1->SendRequestHeaders(headers1.Pass(), NO_MORE_DATA_TO_SEND); + spdy_stream1->SendRequestHeaders(std::move(headers1), NO_MORE_DATA_TO_SEND); EXPECT_TRUE(spdy_stream1->HasUrlFromHeaders()); // Set up the TaskObserver to verify that SpdySession::DoReadLoop posts a @@ -2754,7 +2756,7 @@ TEST_P(SpdySessionTest, TestYieldingSlowSynchronousReads) { scoped_ptr<SpdyHeaderBlock> headers1( spdy_util_.ConstructGetHeaderBlock(kDefaultURL)); - spdy_stream1->SendRequestHeaders(headers1.Pass(), NO_MORE_DATA_TO_SEND); + spdy_stream1->SendRequestHeaders(std::move(headers1), NO_MORE_DATA_TO_SEND); EXPECT_TRUE(spdy_stream1->HasUrlFromHeaders()); // Run until 1st read. @@ -2835,7 +2837,7 @@ TEST_P(SpdySessionTest, TestYieldingDuringReadData) { scoped_ptr<SpdyHeaderBlock> headers1( spdy_util_.ConstructGetHeaderBlock(kDefaultURL)); - spdy_stream1->SendRequestHeaders(headers1.Pass(), NO_MORE_DATA_TO_SEND); + spdy_stream1->SendRequestHeaders(std::move(headers1), NO_MORE_DATA_TO_SEND); EXPECT_TRUE(spdy_stream1->HasUrlFromHeaders()); // Set up the TaskObserver to verify SpdySession::DoReadLoop posts a task. @@ -2942,7 +2944,7 @@ TEST_P(SpdySessionTest, TestYieldingDuringAsyncReadData) { scoped_ptr<SpdyHeaderBlock> headers1( spdy_util_.ConstructGetHeaderBlock(kDefaultURL)); - spdy_stream1->SendRequestHeaders(headers1.Pass(), NO_MORE_DATA_TO_SEND); + spdy_stream1->SendRequestHeaders(std::move(headers1), NO_MORE_DATA_TO_SEND); EXPECT_TRUE(spdy_stream1->HasUrlFromHeaders()); // Set up the TaskObserver to monitor SpdySession::DoReadLoop @@ -3010,7 +3012,7 @@ TEST_P(SpdySessionTest, GoAwayWhileInDoReadLoop) { scoped_ptr<SpdyHeaderBlock> headers1( spdy_util_.ConstructGetHeaderBlock(kDefaultURL)); - spdy_stream1->SendRequestHeaders(headers1.Pass(), NO_MORE_DATA_TO_SEND); + spdy_stream1->SendRequestHeaders(std::move(headers1), NO_MORE_DATA_TO_SEND); EXPECT_TRUE(spdy_stream1->HasUrlFromHeaders()); // Run until 1st read. @@ -3229,9 +3231,8 @@ TEST_P(SpdySessionTest, CloseSessionOnIdleWhenPoolStalled) { scoped_ptr<SpdyHeaderBlock> headers1( spdy_util_.ConstructGetHeaderBlock(kDefaultURL)); - EXPECT_EQ(ERR_IO_PENDING, - spdy_stream1->SendRequestHeaders( - headers1.Pass(), NO_MORE_DATA_TO_SEND)); + EXPECT_EQ(ERR_IO_PENDING, spdy_stream1->SendRequestHeaders( + std::move(headers1), NO_MORE_DATA_TO_SEND)); EXPECT_TRUE(spdy_stream1->HasUrlFromHeaders()); base::RunLoop().RunUntilIdle(); @@ -3360,7 +3361,7 @@ TEST_P(SpdySessionTest, CreateStreamOnStreamReset) { scoped_ptr<SpdyHeaderBlock> headers( spdy_util_.ConstructGetHeaderBlock(kDefaultURL)); - spdy_stream->SendRequestHeaders(headers.Pass(), NO_MORE_DATA_TO_SEND); + spdy_stream->SendRequestHeaders(std::move(headers), NO_MORE_DATA_TO_SEND); EXPECT_TRUE(spdy_stream->HasUrlFromHeaders()); EXPECT_EQ(0u, spdy_stream->stream_id()); @@ -3652,7 +3653,7 @@ TEST_P(SpdySessionTest, StreamFlowControlTooMuchData) { scoped_ptr<SpdyHeaderBlock> headers( spdy_util_.ConstructGetHeaderBlock(kDefaultURL)); EXPECT_EQ(ERR_IO_PENDING, spdy_stream->SendRequestHeaders( - headers.Pass(), NO_MORE_DATA_TO_SEND)); + std::move(headers), NO_MORE_DATA_TO_SEND)); // Request and response. base::RunLoop().RunUntilIdle(); @@ -3793,7 +3794,7 @@ TEST_P(SpdySessionTest, StreamFlowControlTooMuchDataTwoDataFrames) { scoped_ptr<SpdyHeaderBlock> headers( spdy_util_.ConstructGetHeaderBlock(kDefaultURL)); EXPECT_EQ(ERR_IO_PENDING, spdy_stream->SendRequestHeaders( - headers.Pass(), NO_MORE_DATA_TO_SEND)); + std::move(headers), NO_MORE_DATA_TO_SEND)); // Request and response. base::RunLoop().RunUntilIdle(); @@ -3885,7 +3886,7 @@ TEST_P(SpdySessionTest, SessionFlowControlNoReceiveLeaks) { scoped_ptr<SpdyHeaderBlock> headers( spdy_util_.ConstructPostHeaderBlock(kDefaultURL, kMsgDataSize)); EXPECT_EQ(ERR_IO_PENDING, - stream->SendRequestHeaders(headers.Pass(), MORE_DATA_TO_SEND)); + stream->SendRequestHeaders(std::move(headers), MORE_DATA_TO_SEND)); EXPECT_TRUE(stream->HasUrlFromHeaders()); const int32_t initial_window_size = @@ -3951,7 +3952,7 @@ TEST_P(SpdySessionTest, SessionFlowControlNoSendLeaks) { scoped_ptr<SpdyHeaderBlock> headers( spdy_util_.ConstructPostHeaderBlock(kDefaultURL, kMsgDataSize)); EXPECT_EQ(ERR_IO_PENDING, - stream->SendRequestHeaders(headers.Pass(), MORE_DATA_TO_SEND)); + stream->SendRequestHeaders(std::move(headers), MORE_DATA_TO_SEND)); EXPECT_TRUE(stream->HasUrlFromHeaders()); const int32_t initial_window_size = @@ -4035,7 +4036,7 @@ TEST_P(SpdySessionTest, SessionFlowControlEndToEnd) { scoped_ptr<SpdyHeaderBlock> headers( spdy_util_.ConstructPostHeaderBlock(kDefaultURL, kMsgDataSize)); EXPECT_EQ(ERR_IO_PENDING, - stream->SendRequestHeaders(headers.Pass(), MORE_DATA_TO_SEND)); + stream->SendRequestHeaders(std::move(headers), MORE_DATA_TO_SEND)); EXPECT_TRUE(stream->HasUrlFromHeaders()); const int32_t initial_window_size = @@ -4138,7 +4139,7 @@ void SpdySessionTest::RunResumeAfterUnstallTest( scoped_ptr<SpdyHeaderBlock> headers( spdy_util_.ConstructPostHeaderBlock(kDefaultURL, kBodyDataSize)); EXPECT_EQ(ERR_IO_PENDING, - stream->SendRequestHeaders(headers.Pass(), MORE_DATA_TO_SEND)); + stream->SendRequestHeaders(std::move(headers), MORE_DATA_TO_SEND)); EXPECT_TRUE(stream->HasUrlFromHeaders()); EXPECT_EQ(kDefaultURL, stream->GetUrlFromHeaders().spec()); @@ -4278,8 +4279,8 @@ TEST_P(SpdySessionTest, ResumeByPriorityAfterSendWindowSizeIncrease) { scoped_ptr<SpdyHeaderBlock> headers1( spdy_util_.ConstructPostHeaderBlock(kDefaultURL, kBodyDataSize)); - EXPECT_EQ(ERR_IO_PENDING, - stream1->SendRequestHeaders(headers1.Pass(), MORE_DATA_TO_SEND)); + EXPECT_EQ(ERR_IO_PENDING, stream1->SendRequestHeaders(std::move(headers1), + MORE_DATA_TO_SEND)); EXPECT_TRUE(stream1->HasUrlFromHeaders()); EXPECT_EQ(kDefaultURL, stream1->GetUrlFromHeaders().spec()); @@ -4289,8 +4290,8 @@ TEST_P(SpdySessionTest, ResumeByPriorityAfterSendWindowSizeIncrease) { scoped_ptr<SpdyHeaderBlock> headers2( spdy_util_.ConstructPostHeaderBlock(kDefaultURL, kBodyDataSize)); - EXPECT_EQ(ERR_IO_PENDING, - stream2->SendRequestHeaders(headers2.Pass(), MORE_DATA_TO_SEND)); + EXPECT_EQ(ERR_IO_PENDING, stream2->SendRequestHeaders(std::move(headers2), + MORE_DATA_TO_SEND)); EXPECT_TRUE(stream2->HasUrlFromHeaders()); EXPECT_EQ(kDefaultURL, stream2->GetUrlFromHeaders().spec()); @@ -4429,8 +4430,8 @@ TEST_P(SpdySessionTest, SendWindowSizeIncreaseWithDeletedStreams) { scoped_ptr<SpdyHeaderBlock> headers1( spdy_util_.ConstructPostHeaderBlock(kDefaultURL, kBodyDataSize)); - EXPECT_EQ(ERR_IO_PENDING, - stream1->SendRequestHeaders(headers1.Pass(), MORE_DATA_TO_SEND)); + EXPECT_EQ(ERR_IO_PENDING, stream1->SendRequestHeaders(std::move(headers1), + MORE_DATA_TO_SEND)); EXPECT_TRUE(stream1->HasUrlFromHeaders()); EXPECT_EQ(kDefaultURL, stream1->GetUrlFromHeaders().spec()); @@ -4440,8 +4441,8 @@ TEST_P(SpdySessionTest, SendWindowSizeIncreaseWithDeletedStreams) { scoped_ptr<SpdyHeaderBlock> headers2( spdy_util_.ConstructPostHeaderBlock(kDefaultURL, kBodyDataSize)); - EXPECT_EQ(ERR_IO_PENDING, - stream2->SendRequestHeaders(headers2.Pass(), MORE_DATA_TO_SEND)); + EXPECT_EQ(ERR_IO_PENDING, stream2->SendRequestHeaders(std::move(headers2), + MORE_DATA_TO_SEND)); EXPECT_TRUE(stream2->HasUrlFromHeaders()); EXPECT_EQ(kDefaultURL, stream2->GetUrlFromHeaders().spec()); @@ -4451,8 +4452,8 @@ TEST_P(SpdySessionTest, SendWindowSizeIncreaseWithDeletedStreams) { scoped_ptr<SpdyHeaderBlock> headers3( spdy_util_.ConstructPostHeaderBlock(kDefaultURL, kBodyDataSize)); - EXPECT_EQ(ERR_IO_PENDING, - stream3->SendRequestHeaders(headers3.Pass(), MORE_DATA_TO_SEND)); + EXPECT_EQ(ERR_IO_PENDING, stream3->SendRequestHeaders(std::move(headers3), + MORE_DATA_TO_SEND)); EXPECT_TRUE(stream3->HasUrlFromHeaders()); EXPECT_EQ(kDefaultURL, stream3->GetUrlFromHeaders().spec()); @@ -4560,8 +4561,8 @@ TEST_P(SpdySessionTest, SendWindowSizeIncreaseWithDeletedSession) { scoped_ptr<SpdyHeaderBlock> headers1( spdy_util_.ConstructPostHeaderBlock(kDefaultURL, kBodyDataSize)); - EXPECT_EQ(ERR_IO_PENDING, - stream1->SendRequestHeaders(headers1.Pass(), MORE_DATA_TO_SEND)); + EXPECT_EQ(ERR_IO_PENDING, stream1->SendRequestHeaders(std::move(headers1), + MORE_DATA_TO_SEND)); EXPECT_TRUE(stream1->HasUrlFromHeaders()); EXPECT_EQ(kDefaultURL, stream1->GetUrlFromHeaders().spec()); @@ -4571,8 +4572,8 @@ TEST_P(SpdySessionTest, SendWindowSizeIncreaseWithDeletedSession) { scoped_ptr<SpdyHeaderBlock> headers2( spdy_util_.ConstructPostHeaderBlock(kDefaultURL, kBodyDataSize)); - EXPECT_EQ(ERR_IO_PENDING, - stream2->SendRequestHeaders(headers2.Pass(), MORE_DATA_TO_SEND)); + EXPECT_EQ(ERR_IO_PENDING, stream2->SendRequestHeaders(std::move(headers2), + MORE_DATA_TO_SEND)); EXPECT_TRUE(stream2->HasUrlFromHeaders()); EXPECT_EQ(kDefaultURL, stream2->GetUrlFromHeaders().spec()); @@ -4640,7 +4641,7 @@ TEST_P(SpdySessionTest, GoAwayOnSessionFlowControlError) { scoped_ptr<SpdyHeaderBlock> headers( spdy_util_.ConstructGetHeaderBlock(kDefaultURL)); - spdy_stream->SendRequestHeaders(headers.Pass(), NO_MORE_DATA_TO_SEND); + spdy_stream->SendRequestHeaders(std::move(headers), NO_MORE_DATA_TO_SEND); // Write request. base::RunLoop().RunUntilIdle(); @@ -4727,7 +4728,7 @@ TEST_P(SpdySessionTest, PushedStreamShouldNotCountToClientConcurrencyLimit) { scoped_ptr<SpdyHeaderBlock> headers( spdy_util_.ConstructGetHeaderBlock(kDefaultURL)); - spdy_stream1->SendRequestHeaders(headers.Pass(), NO_MORE_DATA_TO_SEND); + spdy_stream1->SendRequestHeaders(std::move(headers), NO_MORE_DATA_TO_SEND); EXPECT_TRUE(spdy_stream1->HasUrlFromHeaders()); // Run until 1st stream is activated. @@ -4807,7 +4808,7 @@ TEST_P(SpdySessionTest, RejectPushedStreamExceedingConcurrencyLimit) { scoped_ptr<SpdyHeaderBlock> headers( spdy_util_.ConstructGetHeaderBlock(kDefaultURL)); - spdy_stream1->SendRequestHeaders(headers.Pass(), NO_MORE_DATA_TO_SEND); + spdy_stream1->SendRequestHeaders(std::move(headers), NO_MORE_DATA_TO_SEND); EXPECT_TRUE(spdy_stream1->HasUrlFromHeaders()); // Run until 1st stream is activated. @@ -4852,7 +4853,7 @@ TEST_P(SpdySessionTest, IgnoreReservedRemoteStreamsCount) { spdy_util_.AddUrlToHeaderBlock("http://www.example.org/b.dat", push_headers.get()); scoped_ptr<SpdyFrame> push_b( - spdy_util_.ConstructInitialSpdyPushFrame(push_headers.Pass(), 4, 1)); + spdy_util_.ConstructInitialSpdyPushFrame(std::move(push_headers), 4, 1)); scoped_ptr<SpdyFrame> headers_b( spdy_util_.ConstructSpdyPushHeaders(4, nullptr, 0)); MockRead reads[] = { @@ -4895,7 +4896,7 @@ TEST_P(SpdySessionTest, IgnoreReservedRemoteStreamsCount) { scoped_ptr<SpdyHeaderBlock> headers( spdy_util_.ConstructGetHeaderBlock(kDefaultURL)); - spdy_stream1->SendRequestHeaders(headers.Pass(), NO_MORE_DATA_TO_SEND); + spdy_stream1->SendRequestHeaders(std::move(headers), NO_MORE_DATA_TO_SEND); EXPECT_TRUE(spdy_stream1->HasUrlFromHeaders()); // Run until 1st stream is activated. @@ -4947,7 +4948,7 @@ TEST_P(SpdySessionTest, CancelReservedStreamOnHeadersReceived) { scoped_ptr<SpdyHeaderBlock> push_headers(new SpdyHeaderBlock); spdy_util_.AddUrlToHeaderBlock(kPushedUrl, push_headers.get()); scoped_ptr<SpdyFrame> push_promise( - spdy_util_.ConstructInitialSpdyPushFrame(push_headers.Pass(), 2, 1)); + spdy_util_.ConstructInitialSpdyPushFrame(std::move(push_headers), 2, 1)); scoped_ptr<SpdyFrame> headers_frame( spdy_util_.ConstructSpdyPushHeaders(2, nullptr, 0)); MockRead reads[] = { @@ -4987,7 +4988,7 @@ TEST_P(SpdySessionTest, CancelReservedStreamOnHeadersReceived) { scoped_ptr<SpdyHeaderBlock> headers( spdy_util_.ConstructGetHeaderBlock(kDefaultURL)); - spdy_stream1->SendRequestHeaders(headers.Pass(), NO_MORE_DATA_TO_SEND); + spdy_stream1->SendRequestHeaders(std::move(headers), NO_MORE_DATA_TO_SEND); EXPECT_TRUE(spdy_stream1->HasUrlFromHeaders()); // Run until 1st stream is activated. diff --git a/net/spdy/spdy_stream.cc b/net/spdy/spdy_stream.cc index 3fdb1ee..95979a9 100644 --- a/net/spdy/spdy_stream.cc +++ b/net/spdy/spdy_stream.cc @@ -5,6 +5,7 @@ #include "net/spdy/spdy_stream.h" #include <limits> +#include <utility> #include "base/bind.h" #include "base/compiler_specific.h" @@ -33,7 +34,7 @@ scoped_ptr<base::Value> NetLogSpdyStreamErrorCallback( dict->SetInteger("stream_id", static_cast<int>(stream_id)); dict->SetInteger("status", status); dict->SetString("description", *description); - return dict.Pass(); + return std::move(dict); } scoped_ptr<base::Value> NetLogSpdyStreamWindowUpdateCallback( @@ -45,7 +46,7 @@ scoped_ptr<base::Value> NetLogSpdyStreamWindowUpdateCallback( dict->SetInteger("stream_id", stream_id); dict->SetInteger("delta", delta); dict->SetInteger("window_size", window_size); - return dict.Pass(); + return std::move(dict); } bool ContainsUppercaseAscii(const std::string& str) { @@ -186,7 +187,7 @@ void SpdyStream::PushedStreamReplay() { bool eof = (buffer == NULL); CHECK(delegate_); - delegate_->OnDataReceived(buffer.Pass()); + delegate_->OnDataReceived(std::move(buffer)); // OnDataReceived() may have closed |this|. if (!weak_this) @@ -213,7 +214,7 @@ scoped_ptr<SpdyFrame> SpdyStream::ProduceSynStreamFrame() { scoped_ptr<SpdyFrame> frame(session_->CreateSynStream( stream_id_, priority_, flags, *request_headers_)); send_time_ = base::TimeTicks::Now(); - return frame.Pass(); + return frame; } void SpdyStream::DetachDelegate() { @@ -557,7 +558,7 @@ void SpdyStream::OnDataReceived(scoped_ptr<SpdyBuffer> buffer) { recv_last_byte_time_ = base::TimeTicks::Now(); // May close |this|. - delegate_->OnDataReceived(buffer.Pass()); + delegate_->OnDataReceived(std::move(buffer)); } void SpdyStream::OnPaddingConsumed(size_t len) { @@ -708,7 +709,7 @@ int SpdyStream::SendRequestHeaders(scoped_ptr<SpdyHeaderBlock> request_headers, CHECK(!request_headers_); CHECK(!pending_send_data_.get()); CHECK_EQ(io_state_, STATE_IDLE); - request_headers_ = request_headers.Pass(); + request_headers_ = std::move(request_headers); pending_send_status_ = send_status; session_->EnqueueStreamWrite( GetWeakPtr(), SYN_STREAM, @@ -882,7 +883,7 @@ void SpdyStream::QueueNextDataFrame() { session_->EnqueueStreamWrite( GetWeakPtr(), DATA, scoped_ptr<SpdyBufferProducer>( - new SimpleBufferProducer(data_buffer.Pass()))); + new SimpleBufferProducer(std::move(data_buffer)))); } int SpdyStream::MergeWithResponseHeaders( diff --git a/net/spdy/spdy_stream_test_util.cc b/net/spdy/spdy_stream_test_util.cc index 4ea4f4b..e0d8e69 100644 --- a/net/spdy/spdy_stream_test_util.cc +++ b/net/spdy/spdy_stream_test_util.cc @@ -5,6 +5,7 @@ #include "net/spdy/spdy_stream_test_util.h" #include <cstddef> +#include <utility> #include "base/stl_util.h" #include "net/base/completion_callback.h" @@ -66,7 +67,7 @@ SpdyResponseHeadersStatus StreamDelegateBase::OnResponseHeadersUpdated( void StreamDelegateBase::OnDataReceived(scoped_ptr<SpdyBuffer> buffer) { if (buffer) - received_data_queue_.Enqueue(buffer.Pass()); + received_data_queue_.Enqueue(std::move(buffer)); } void StreamDelegateBase::OnDataSent() {} diff --git a/net/spdy/spdy_stream_unittest.cc b/net/spdy/spdy_stream_unittest.cc index d59a64a..7177651 100644 --- a/net/spdy/spdy_stream_unittest.cc +++ b/net/spdy/spdy_stream_unittest.cc @@ -2,11 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include <stdint.h> +#include "net/spdy/spdy_stream.h" +#include <stdint.h> #include <cstddef> #include <limits> #include <string> +#include <utility> #include <vector> #include "base/memory/ref_counted.h" @@ -24,7 +26,6 @@ #include "net/spdy/spdy_http_utils.h" #include "net/spdy/spdy_protocol.h" #include "net/spdy/spdy_session.h" -#include "net/spdy/spdy_stream.h" #include "net/spdy/spdy_stream_test_util.h" #include "net/spdy/spdy_test_util_common.h" #include "testing/gtest/include/gtest/gtest.h" @@ -196,7 +197,7 @@ TEST_P(SpdyStreamTest, SendDataAfterOpen) { scoped_ptr<SpdyHeaderBlock> headers( spdy_util_.ConstructPostHeaderBlock(kStreamUrl, kPostBodyLength)); EXPECT_EQ(ERR_IO_PENDING, - stream->SendRequestHeaders(headers.Pass(), MORE_DATA_TO_SEND)); + stream->SendRequestHeaders(std::move(headers), MORE_DATA_TO_SEND)); EXPECT_TRUE(stream->HasUrlFromHeaders()); EXPECT_EQ(kStreamUrl, stream->GetUrlFromHeaders().spec()); @@ -275,7 +276,7 @@ TEST_P(SpdyStreamTest, Trailers) { scoped_ptr<SpdyHeaderBlock> headers( spdy_util_.ConstructPostHeaderBlock(kStreamUrl, kPostBodyLength)); EXPECT_EQ(ERR_IO_PENDING, - stream->SendRequestHeaders(headers.Pass(), MORE_DATA_TO_SEND)); + stream->SendRequestHeaders(std::move(headers), MORE_DATA_TO_SEND)); EXPECT_TRUE(stream->HasUrlFromHeaders()); EXPECT_EQ(kStreamUrl, stream->GetUrlFromHeaders().spec()); @@ -389,7 +390,7 @@ TEST_P(SpdyStreamTest, StreamError) { scoped_ptr<SpdyHeaderBlock> headers( spdy_util_.ConstructPostHeaderBlock(kStreamUrl, kPostBodyLength)); EXPECT_EQ(ERR_IO_PENDING, - stream->SendRequestHeaders(headers.Pass(), MORE_DATA_TO_SEND)); + stream->SendRequestHeaders(std::move(headers), MORE_DATA_TO_SEND)); EXPECT_TRUE(stream->HasUrlFromHeaders()); EXPECT_EQ(kStreamUrl, stream->GetUrlFromHeaders().spec()); @@ -468,7 +469,7 @@ TEST_P(SpdyStreamTest, SendLargeDataAfterOpenRequestResponse) { scoped_ptr<SpdyHeaderBlock> headers( spdy_util_.ConstructPostHeaderBlock(kStreamUrl, kPostBodyLength)); EXPECT_EQ(ERR_IO_PENDING, - stream->SendRequestHeaders(headers.Pass(), MORE_DATA_TO_SEND)); + stream->SendRequestHeaders(std::move(headers), MORE_DATA_TO_SEND)); EXPECT_TRUE(stream->HasUrlFromHeaders()); EXPECT_EQ(kStreamUrl, stream->GetUrlFromHeaders().spec()); @@ -527,7 +528,7 @@ TEST_P(SpdyStreamTest, SendLargeDataAfterOpenBidirectional) { scoped_ptr<SpdyHeaderBlock> headers( spdy_util_.ConstructPostHeaderBlock(kStreamUrl, kPostBodyLength)); EXPECT_EQ(ERR_IO_PENDING, - stream->SendRequestHeaders(headers.Pass(), MORE_DATA_TO_SEND)); + stream->SendRequestHeaders(std::move(headers), MORE_DATA_TO_SEND)); EXPECT_TRUE(stream->HasUrlFromHeaders()); EXPECT_EQ(kStreamUrl, stream->GetUrlFromHeaders().spec()); @@ -580,8 +581,8 @@ TEST_P(SpdyStreamTest, UpperCaseHeaders) { scoped_ptr<SpdyHeaderBlock> headers( spdy_util_.ConstructGetHeaderBlock(kStreamUrl)); - EXPECT_EQ(ERR_IO_PENDING, - stream->SendRequestHeaders(headers.Pass(), NO_MORE_DATA_TO_SEND)); + EXPECT_EQ(ERR_IO_PENDING, stream->SendRequestHeaders(std::move(headers), + NO_MORE_DATA_TO_SEND)); EXPECT_TRUE(stream->HasUrlFromHeaders()); EXPECT_EQ(kStreamUrl, stream->GetUrlFromHeaders().spec()); @@ -635,8 +636,8 @@ TEST_P(SpdyStreamTest, UpperCaseHeadersOnPush) { scoped_ptr<SpdyHeaderBlock> headers( spdy_util_.ConstructGetHeaderBlock(kStreamUrl)); - EXPECT_EQ(ERR_IO_PENDING, - stream->SendRequestHeaders(headers.Pass(), NO_MORE_DATA_TO_SEND)); + EXPECT_EQ(ERR_IO_PENDING, stream->SendRequestHeaders(std::move(headers), + NO_MORE_DATA_TO_SEND)); EXPECT_TRUE(stream->HasUrlFromHeaders()); EXPECT_EQ(kStreamUrl, stream->GetUrlFromHeaders().spec()); @@ -672,14 +673,9 @@ TEST_P(SpdyStreamTest, UpperCaseHeadersInHeadersFrame) { scoped_ptr<SpdyHeaderBlock> late_headers(new SpdyHeaderBlock()); (*late_headers)["X-UpperCase"] = "yes"; - scoped_ptr<SpdyFrame> headers_frame( - spdy_util_.ConstructSpdyControlFrame(late_headers.Pass(), - false, - 2, - LOWEST, - HEADERS, - CONTROL_FLAG_NONE, - 0)); + scoped_ptr<SpdyFrame> headers_frame(spdy_util_.ConstructSpdyControlFrame( + std::move(late_headers), false, 2, LOWEST, HEADERS, CONTROL_FLAG_NONE, + 0)); AddRead(*headers_frame); AddWritePause(); @@ -711,8 +707,8 @@ TEST_P(SpdyStreamTest, UpperCaseHeadersInHeadersFrame) { scoped_ptr<SpdyHeaderBlock> headers( spdy_util_.ConstructGetHeaderBlock(kStreamUrl)); - EXPECT_EQ(ERR_IO_PENDING, - stream->SendRequestHeaders(headers.Pass(), NO_MORE_DATA_TO_SEND)); + EXPECT_EQ(ERR_IO_PENDING, stream->SendRequestHeaders(std::move(headers), + NO_MORE_DATA_TO_SEND)); EXPECT_TRUE(stream->HasUrlFromHeaders()); EXPECT_EQ(kStreamUrl, stream->GetUrlFromHeaders().spec()); @@ -754,14 +750,9 @@ TEST_P(SpdyStreamTest, DuplicateHeaders) { scoped_ptr<SpdyHeaderBlock> late_headers(new SpdyHeaderBlock()); (*late_headers)[spdy_util_.GetStatusKey()] = "500 Server Error"; - scoped_ptr<SpdyFrame> headers_frame( - spdy_util_.ConstructSpdyControlFrame(late_headers.Pass(), - false, - 2, - LOWEST, - HEADERS, - CONTROL_FLAG_NONE, - 0)); + scoped_ptr<SpdyFrame> headers_frame(spdy_util_.ConstructSpdyControlFrame( + std::move(late_headers), false, 2, LOWEST, HEADERS, CONTROL_FLAG_NONE, + 0)); AddRead(*headers_frame); AddReadPause(); @@ -793,8 +784,8 @@ TEST_P(SpdyStreamTest, DuplicateHeaders) { scoped_ptr<SpdyHeaderBlock> headers( spdy_util_.ConstructGetHeaderBlock(kStreamUrl)); - EXPECT_EQ(ERR_IO_PENDING, - stream->SendRequestHeaders(headers.Pass(), NO_MORE_DATA_TO_SEND)); + EXPECT_EQ(ERR_IO_PENDING, stream->SendRequestHeaders(std::move(headers), + NO_MORE_DATA_TO_SEND)); EXPECT_TRUE(stream->HasUrlFromHeaders()); EXPECT_EQ(kStreamUrl, stream->GetUrlFromHeaders().spec()); @@ -856,7 +847,7 @@ TEST_P(SpdyStreamTest, IncreaseSendWindowSizeOverflow) { scoped_ptr<SpdyHeaderBlock> headers( spdy_util_.ConstructPostHeaderBlock(kStreamUrl, kPostBodyLength)); EXPECT_EQ(ERR_IO_PENDING, - stream->SendRequestHeaders(headers.Pass(), MORE_DATA_TO_SEND)); + stream->SendRequestHeaders(std::move(headers), MORE_DATA_TO_SEND)); EXPECT_TRUE(stream->HasUrlFromHeaders()); EXPECT_EQ(kStreamUrl, stream->GetUrlFromHeaders().spec()); @@ -949,7 +940,7 @@ void SpdyStreamTest::RunResumeAfterUnstallRequestResponseTest( scoped_ptr<SpdyHeaderBlock> headers( spdy_util_.ConstructPostHeaderBlock(kStreamUrl, kPostBodyLength)); EXPECT_EQ(ERR_IO_PENDING, - stream->SendRequestHeaders(headers.Pass(), MORE_DATA_TO_SEND)); + stream->SendRequestHeaders(std::move(headers), MORE_DATA_TO_SEND)); EXPECT_TRUE(stream->HasUrlFromHeaders()); EXPECT_EQ(kStreamUrl, stream->GetUrlFromHeaders().spec()); @@ -1030,7 +1021,7 @@ void SpdyStreamTest::RunResumeAfterUnstallBidirectionalTest( scoped_ptr<SpdyHeaderBlock> headers( spdy_util_.ConstructPostHeaderBlock(kStreamUrl, kPostBodyLength)); EXPECT_EQ(ERR_IO_PENDING, - stream->SendRequestHeaders(headers.Pass(), MORE_DATA_TO_SEND)); + stream->SendRequestHeaders(std::move(headers), MORE_DATA_TO_SEND)); EXPECT_TRUE(stream->HasUrlFromHeaders()); EXPECT_EQ(kStreamUrl, stream->GetUrlFromHeaders().spec()); @@ -1113,8 +1104,8 @@ TEST_P(SpdyStreamTest, ReceivedBytes) { scoped_ptr<SpdyHeaderBlock> headers( spdy_util_.ConstructGetHeaderBlock(kStreamUrl)); - EXPECT_EQ(ERR_IO_PENDING, - stream->SendRequestHeaders(headers.Pass(), NO_MORE_DATA_TO_SEND)); + EXPECT_EQ(ERR_IO_PENDING, stream->SendRequestHeaders(std::move(headers), + NO_MORE_DATA_TO_SEND)); EXPECT_TRUE(stream->HasUrlFromHeaders()); EXPECT_EQ(kStreamUrl, stream->GetUrlFromHeaders().spec()); diff --git a/net/spdy/spdy_test_util_common.cc b/net/spdy/spdy_test_util_common.cc index ec5f16b..6a28794 100644 --- a/net/spdy/spdy_test_util_common.cc +++ b/net/spdy/spdy_test_util_common.cc @@ -5,8 +5,8 @@ #include "net/spdy/spdy_test_util_common.h" #include <stdint.h> - #include <cstddef> +#include <utility> #include "base/compiler_specific.h" #include "base/logging.h" @@ -373,7 +373,7 @@ SpdySessionDependencies::SpdySessionDependencies( : host_resolver(new MockHostResolver), cert_verifier(new MockCertVerifier), transport_security_state(new TransportSecurityState), - proxy_service(proxy_service.Pass()), + proxy_service(std::move(proxy_service)), ssl_config_service(new SSLConfigServiceDefaults), socket_factory(new MockClientSocketFactory), http_auth_handler_factory( @@ -404,7 +404,7 @@ scoped_ptr<HttpNetworkSession> SpdySessionDependencies::SpdyCreateSession( scoped_ptr<HttpNetworkSession> http_session(new HttpNetworkSession(params)); SpdySessionPoolPeer pool_peer(http_session->spdy_session_pool()); pool_peer.SetEnableSendingInitialData(false); - return http_session.Pass(); + return http_session; } // static @@ -542,7 +542,7 @@ base::WeakPtr<SpdySession> CreateSpdySessionHelper( base::WeakPtr<SpdySession> spdy_session = http_session->spdy_session_pool()->CreateAvailableSessionFromSocket( - key, connection.Pass(), net_log, OK, is_secure); + key, std::move(connection), net_log, OK, is_secure); // Failure is reported asynchronously. EXPECT_TRUE(spdy_session != NULL); EXPECT_TRUE(HasSpdySession(http_session->spdy_session_pool(), key)); @@ -649,7 +649,7 @@ base::WeakPtr<SpdySession> CreateFakeSpdySessionHelper( expected_status == OK ? ERR_IO_PENDING : expected_status))); base::WeakPtr<SpdySession> spdy_session = pool->CreateAvailableSessionFromSocket( - key, handle.Pass(), BoundNetLog(), OK, true /* is_secure */); + key, std::move(handle), BoundNetLog(), OK, true /* is_secure */); // Failure is reported asynchronously. EXPECT_TRUE(spdy_session != NULL); EXPECT_TRUE(HasSpdySession(pool, key)); @@ -721,7 +721,7 @@ scoped_ptr<SpdyHeaderBlock> SpdyTestUtil::ConstructGetHeaderBlock( scoped_ptr<SpdyHeaderBlock> SpdyTestUtil::ConstructGetHeaderBlockForProxy( base::StringPiece url) const { scoped_ptr<SpdyHeaderBlock> headers(ConstructGetHeaderBlock(url)); - return headers.Pass(); + return headers; } scoped_ptr<SpdyHeaderBlock> SpdyTestUtil::ConstructHeadHeaderBlock( @@ -789,7 +789,7 @@ SpdyFrame* SpdyTestUtil::ConstructSpdyFrame(const SpdyHeaderInfo& header_info, AppendToHeaderBlock(extra_headers, extra_header_count, headers.get()); if (tail_headers && tail_header_count) AppendToHeaderBlock(tail_headers, tail_header_count, headers.get()); - return ConstructSpdyFrame(header_info, headers.Pass()); + return ConstructSpdyFrame(header_info, std::move(headers)); } SpdyFrame* SpdyTestUtil::ConstructSpdyControlFrame( @@ -814,7 +814,7 @@ SpdyFrame* SpdyTestUtil::ConstructSpdyControlFrame( 0, // length DATA_FLAG_NONE }; - return ConstructSpdyFrame(header_info, headers.Pass()); + return ConstructSpdyFrame(header_info, std::move(headers)); } SpdyFrame* SpdyTestUtil::ConstructSpdyControlFrame( @@ -832,9 +832,9 @@ SpdyFrame* SpdyTestUtil::ConstructSpdyControlFrame( AppendToHeaderBlock(extra_headers, extra_header_count, headers.get()); if (tail_headers && tail_header_size) AppendToHeaderBlock(tail_headers, tail_header_size / 2, headers.get()); - return ConstructSpdyControlFrame( - headers.Pass(), compressed, stream_id, - request_priority, type, flags, associated_stream_id); + return ConstructSpdyControlFrame(std::move(headers), compressed, stream_id, + request_priority, type, flags, + associated_stream_id); } std::string SpdyTestUtil::ConstructSpdyReplyString( @@ -1277,7 +1277,7 @@ void SpdyTestUtil::UpdateWithStreamDestruction(int stream_id) { scoped_ptr<SpdyFramer> SpdyTestUtil::CreateFramer(bool compressed) const { scoped_ptr<SpdyFramer> framer(new SpdyFramer(spdy_version_)); framer->set_enable_compression(compressed); - return framer.Pass(); + return framer; } const char* SpdyTestUtil::GetMethodKey() const { @@ -1325,7 +1325,7 @@ scoped_ptr<SpdyHeaderBlock> SpdyTestUtil::ConstructHeaderBlock( std::string length_str = base::Int64ToString(*content_length); (*headers)["content-length"] = length_str; } - return headers.Pass(); + return headers; } void SpdyTestUtil::MaybeAddVersionHeader( diff --git a/net/spdy/spdy_write_queue_unittest.cc b/net/spdy/spdy_write_queue_unittest.cc index 61e925b..1c7bc0a 100644 --- a/net/spdy/spdy_write_queue_unittest.cc +++ b/net/spdy/spdy_write_queue_unittest.cc @@ -7,6 +7,7 @@ #include <cstddef> #include <cstring> #include <string> +#include <utility> #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" @@ -58,7 +59,7 @@ class RequeingBufferProducer : public SpdyBufferProducer { base::Bind(RequeingBufferProducer::ConsumeCallback, queue)); } - scoped_ptr<SpdyBuffer> ProduceBuffer() override { return buffer_.Pass(); } + scoped_ptr<SpdyBuffer> ProduceBuffer() override { return std::move(buffer_); } static void ConsumeCallback(SpdyWriteQueue* queue, size_t size, @@ -67,8 +68,8 @@ class RequeingBufferProducer : public SpdyBufferProducer { new SimpleBufferProducer(scoped_ptr<SpdyBuffer>( new SpdyBuffer(kRequeued, arraysize(kRequeued))))); - queue->Enqueue( - MEDIUM, RST_STREAM, producer.Pass(), base::WeakPtr<SpdyStream>()); + queue->Enqueue(MEDIUM, RST_STREAM, std::move(producer), + base::WeakPtr<SpdyStream>()); } private: @@ -86,7 +87,7 @@ std::string ProducerToString(scoped_ptr<SpdyBufferProducer> producer) { // data as an int (converted from a string). int ProducerToInt(scoped_ptr<SpdyBufferProducer> producer) { int i = 0; - EXPECT_TRUE(base::StringToInt(ProducerToString(producer.Pass()), &i)); + EXPECT_TRUE(base::StringToInt(ProducerToString(std::move(producer)), &i)); return i; } @@ -112,30 +113,29 @@ TEST_F(SpdyWriteQueueTest, DequeuesByPriority) { scoped_ptr<SpdyStream> stream_highest(MakeTestStream(HIGHEST)); // A NULL stream should still work. - write_queue.Enqueue( - LOW, SYN_STREAM, producer_low.Pass(), base::WeakPtr<SpdyStream>()); - write_queue.Enqueue( - MEDIUM, SYN_REPLY, producer_medium.Pass(), stream_medium->GetWeakPtr()); - write_queue.Enqueue( - HIGHEST, RST_STREAM, producer_highest.Pass(), - stream_highest->GetWeakPtr()); + write_queue.Enqueue(LOW, SYN_STREAM, std::move(producer_low), + base::WeakPtr<SpdyStream>()); + write_queue.Enqueue(MEDIUM, SYN_REPLY, std::move(producer_medium), + stream_medium->GetWeakPtr()); + write_queue.Enqueue(HIGHEST, RST_STREAM, std::move(producer_highest), + stream_highest->GetWeakPtr()); SpdyFrameType frame_type = DATA; scoped_ptr<SpdyBufferProducer> frame_producer; base::WeakPtr<SpdyStream> stream; ASSERT_TRUE(write_queue.Dequeue(&frame_type, &frame_producer, &stream)); EXPECT_EQ(RST_STREAM, frame_type); - EXPECT_EQ("HIGHEST", ProducerToString(frame_producer.Pass())); + EXPECT_EQ("HIGHEST", ProducerToString(std::move(frame_producer))); EXPECT_EQ(stream_highest.get(), stream.get()); ASSERT_TRUE(write_queue.Dequeue(&frame_type, &frame_producer, &stream)); EXPECT_EQ(SYN_REPLY, frame_type); - EXPECT_EQ("MEDIUM", ProducerToString(frame_producer.Pass())); + EXPECT_EQ("MEDIUM", ProducerToString(std::move(frame_producer))); EXPECT_EQ(stream_medium.get(), stream.get()); ASSERT_TRUE(write_queue.Dequeue(&frame_type, &frame_producer, &stream)); EXPECT_EQ(SYN_STREAM, frame_type); - EXPECT_EQ("LOW", ProducerToString(frame_producer.Pass())); + EXPECT_EQ("LOW", ProducerToString(std::move(frame_producer))); EXPECT_EQ(nullptr, stream.get()); EXPECT_FALSE(write_queue.Dequeue(&frame_type, &frame_producer, &stream)); @@ -154,11 +154,11 @@ TEST_F(SpdyWriteQueueTest, DequeuesFIFO) { scoped_ptr<SpdyStream> stream2(MakeTestStream(DEFAULT_PRIORITY)); scoped_ptr<SpdyStream> stream3(MakeTestStream(DEFAULT_PRIORITY)); - write_queue.Enqueue(DEFAULT_PRIORITY, SYN_STREAM, producer1.Pass(), + write_queue.Enqueue(DEFAULT_PRIORITY, SYN_STREAM, std::move(producer1), stream1->GetWeakPtr()); - write_queue.Enqueue(DEFAULT_PRIORITY, SYN_REPLY, producer2.Pass(), + write_queue.Enqueue(DEFAULT_PRIORITY, SYN_REPLY, std::move(producer2), stream2->GetWeakPtr()); - write_queue.Enqueue(DEFAULT_PRIORITY, RST_STREAM, producer3.Pass(), + write_queue.Enqueue(DEFAULT_PRIORITY, RST_STREAM, std::move(producer3), stream3->GetWeakPtr()); SpdyFrameType frame_type = DATA; @@ -166,17 +166,17 @@ TEST_F(SpdyWriteQueueTest, DequeuesFIFO) { base::WeakPtr<SpdyStream> stream; ASSERT_TRUE(write_queue.Dequeue(&frame_type, &frame_producer, &stream)); EXPECT_EQ(SYN_STREAM, frame_type); - EXPECT_EQ(1, ProducerToInt(frame_producer.Pass())); + EXPECT_EQ(1, ProducerToInt(std::move(frame_producer))); EXPECT_EQ(stream1.get(), stream.get()); ASSERT_TRUE(write_queue.Dequeue(&frame_type, &frame_producer, &stream)); EXPECT_EQ(SYN_REPLY, frame_type); - EXPECT_EQ(2, ProducerToInt(frame_producer.Pass())); + EXPECT_EQ(2, ProducerToInt(std::move(frame_producer))); EXPECT_EQ(stream2.get(), stream.get()); ASSERT_TRUE(write_queue.Dequeue(&frame_type, &frame_producer, &stream)); EXPECT_EQ(RST_STREAM, frame_type); - EXPECT_EQ(3, ProducerToInt(frame_producer.Pass())); + EXPECT_EQ(3, ProducerToInt(std::move(frame_producer))); EXPECT_EQ(stream3.get(), stream.get()); EXPECT_FALSE(write_queue.Dequeue(&frame_type, &frame_producer, &stream)); @@ -205,7 +205,7 @@ TEST_F(SpdyWriteQueueTest, RemovePendingWritesForStream) { base::WeakPtr<SpdyStream> stream; ASSERT_TRUE(write_queue.Dequeue(&frame_type, &frame_producer, &stream)); EXPECT_EQ(SYN_STREAM, frame_type); - EXPECT_EQ(i, ProducerToInt(frame_producer.Pass())); + EXPECT_EQ(i, ProducerToInt(std::move(frame_producer))); EXPECT_EQ(stream1.get(), stream.get()); } @@ -249,7 +249,7 @@ TEST_F(SpdyWriteQueueTest, RemovePendingWritesForStreamsAfter) { ASSERT_TRUE(write_queue.Dequeue(&frame_type, &frame_producer, &stream)) << "Unable to Dequeue i: " << i; EXPECT_EQ(SYN_STREAM, frame_type); - EXPECT_EQ(i, ProducerToInt(frame_producer.Pass())); + EXPECT_EQ(i, ProducerToInt(std::move(frame_producer))); EXPECT_EQ(stream1.get(), stream.get()); } diff --git a/net/ssl/channel_id_service.cc b/net/ssl/channel_id_service.cc index fbf21c7..e17b813 100644 --- a/net/ssl/channel_id_service.cc +++ b/net/ssl/channel_id_service.cc @@ -6,6 +6,7 @@ #include <algorithm> #include <limits> +#include <utility> #include "base/bind.h" #include "base/bind_helpers.h" @@ -94,18 +95,18 @@ scoped_ptr<ChannelIDStore::ChannelID> GenerateChannelID( if (!key) { DLOG(ERROR) << "Unable to create channel ID key pair"; *error = ERR_KEY_GENERATION_FAILED; - return result.Pass(); + return result; } result.reset(new ChannelIDStore::ChannelID(server_identifier, creation_time, - key.Pass())); + std::move(key))); UMA_HISTOGRAM_CUSTOM_TIMES("DomainBoundCerts.GenerateCertTime", base::TimeTicks::Now() - start, base::TimeDelta::FromMilliseconds(1), base::TimeDelta::FromMinutes(5), 50); *error = OK; - return result.Pass(); + return result; } } // namespace @@ -183,7 +184,7 @@ class ChannelIDServiceJob { } void HandleResult(int error, scoped_ptr<crypto::ECPrivateKey> key) { - PostAll(error, key.Pass()); + PostAll(error, std::move(key)); } bool CreateIfMissing() const { return create_if_missing_; } @@ -204,7 +205,7 @@ class ChannelIDServiceJob { scoped_ptr<crypto::ECPrivateKey> key_copy; if (key) key_copy.reset(key->Copy()); - (*i)->Post(error, key_copy.Pass()); + (*i)->Post(error, std::move(key_copy)); } } @@ -275,7 +276,7 @@ void ChannelIDService::Request::Post(int error, service_ = NULL; DCHECK(!callback_.is_null()); if (key) - *key_ = key.Pass(); + *key_ = std::move(key); // Running the callback might delete |this| (e.g. the callback cleans up // resources created for the request), so we can't touch any of our // members afterwards. Reset callback_ first. @@ -413,14 +414,14 @@ void ChannelIDService::GotChannelID(int err, // Async DB lookup found a valid channel ID. key_store_hits_++; // ChannelIDService::Request::Post will do the histograms and stuff. - HandleResult(OK, server_identifier, key.Pass()); + HandleResult(OK, server_identifier, std::move(key)); return; } // Async lookup failed or the channel ID was missing. Return the error // directly, unless the channel ID was missing and a request asked to create // one. if (err != ERR_FILE_NOT_FOUND || !j->second->CreateIfMissing()) { - HandleResult(err, server_identifier, key.Pass()); + HandleResult(err, server_identifier, std::move(key)); return; } // At least one request asked to create a channel ID => start generating a new @@ -450,9 +451,9 @@ void ChannelIDService::GeneratedChannelID( scoped_ptr<crypto::ECPrivateKey> key; if (error == OK) { key.reset(channel_id->key()->Copy()); - channel_id_store_->SetChannelID(channel_id.Pass()); + channel_id_store_->SetChannelID(std::move(channel_id)); } - HandleResult(error, server_identifier, key.Pass()); + HandleResult(error, server_identifier, std::move(key)); } void ChannelIDService::HandleResult(int error, @@ -469,7 +470,7 @@ void ChannelIDService::HandleResult(int error, ChannelIDServiceJob* job = j->second; inflight_.erase(j); - job->HandleResult(error, key.Pass()); + job->HandleResult(error, std::move(key)); delete job; } diff --git a/net/ssl/channel_id_store.cc b/net/ssl/channel_id_store.cc index e1835ff..1345da1 100644 --- a/net/ssl/channel_id_store.cc +++ b/net/ssl/channel_id_store.cc @@ -2,9 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "crypto/ec_private_key.h" #include "net/ssl/channel_id_store.h" +#include <utility> + +#include "crypto/ec_private_key.h" + namespace net { ChannelIDStore::ChannelID::ChannelID() { @@ -15,8 +18,7 @@ ChannelIDStore::ChannelID::ChannelID(const std::string& server_identifier, scoped_ptr<crypto::ECPrivateKey> key) : server_identifier_(server_identifier), creation_time_(creation_time), - key_(key.Pass()) { -} + key_(std::move(key)) {} ChannelIDStore::ChannelID::ChannelID(const ChannelID& other) : server_identifier_(other.server_identifier_), diff --git a/net/ssl/client_cert_store_nss.cc b/net/ssl/client_cert_store_nss.cc index 1693517..8a6c329 100644 --- a/net/ssl/client_cert_store_nss.cc +++ b/net/ssl/client_cert_store_nss.cc @@ -6,6 +6,7 @@ #include <nss.h> #include <ssl.h> +#include <utility> #include "base/bind.h" #include "base/bind_helpers.h" @@ -117,7 +118,7 @@ void ClientCertStoreNSS::GetAndFilterCertsOnWorkerThread( const SSLCertRequestInfo* request, CertificateList* selected_certs) { CertificateList platform_certs; - GetPlatformCertsOnWorkerThread(password_delegate.Pass(), &platform_certs); + GetPlatformCertsOnWorkerThread(std::move(password_delegate), &platform_certs); FilterCertsOnWorkerThread(platform_certs, *request, true, selected_certs); } diff --git a/net/ssl/default_channel_id_store.cc b/net/ssl/default_channel_id_store.cc index f9db093..8fff6f0 100644 --- a/net/ssl/default_channel_id_store.cc +++ b/net/ssl/default_channel_id_store.cc @@ -4,6 +4,8 @@ #include "net/ssl/default_channel_id_store.h" +#include <utility> + #include "base/bind.h" #include "base/message_loop/message_loop.h" #include "base/metrics/histogram_macros.h" @@ -68,7 +70,7 @@ void DefaultChannelIDStore::GetChannelIDTask::Run( DCHECK(err != ERR_IO_PENDING); InvokeCallback(base::Bind(callback_, err, server_identifier_, - base::Passed(key_result.Pass()))); + base::Passed(std::move(key_result)))); } // -------------------------------------------------------------------------- @@ -86,15 +88,14 @@ class DefaultChannelIDStore::SetChannelIDTask DefaultChannelIDStore::SetChannelIDTask::SetChannelIDTask( scoped_ptr<ChannelID> channel_id) - : channel_id_(channel_id.Pass()) { -} + : channel_id_(std::move(channel_id)) {} DefaultChannelIDStore::SetChannelIDTask::~SetChannelIDTask() { } void DefaultChannelIDStore::SetChannelIDTask::Run( DefaultChannelIDStore* store) { - store->SyncSetChannelID(channel_id_.Pass()); + store->SyncSetChannelID(std::move(channel_id_)); } // -------------------------------------------------------------------------- @@ -235,7 +236,7 @@ int DefaultChannelIDStore::GetChannelID( } void DefaultChannelIDStore::SetChannelID(scoped_ptr<ChannelID> channel_id) { - auto task = new SetChannelIDTask(channel_id.Pass()); + auto task = new SetChannelIDTask(std::move(channel_id)); RunOrEnqueueTask(scoped_ptr<Task>(task)); } @@ -337,7 +338,7 @@ void DefaultChannelIDStore::SyncSetChannelID(scoped_ptr<ChannelID> channel_id) { DCHECK(loaded_); InternalDeleteChannelID(channel_id->server_identifier()); - InternalInsertChannelID(channel_id.Pass()); + InternalInsertChannelID(std::move(channel_id)); } void DefaultChannelIDStore::SyncDeleteChannelID( @@ -382,7 +383,7 @@ void DefaultChannelIDStore::EnqueueTask(scoped_ptr<Task> task) { DCHECK(!loaded_); if (waiting_tasks_.empty()) waiting_tasks_start_time_ = base::TimeTicks::Now(); - waiting_tasks_.push_back(task.Pass()); + waiting_tasks_.push_back(std::move(task)); } void DefaultChannelIDStore::RunOrEnqueueTask(scoped_ptr<Task> task) { @@ -390,7 +391,7 @@ void DefaultChannelIDStore::RunOrEnqueueTask(scoped_ptr<Task> task) { InitIfNecessary(); if (!loaded_) { - EnqueueTask(task.Pass()); + EnqueueTask(std::move(task)); return; } diff --git a/net/ssl/default_channel_id_store_unittest.cc b/net/ssl/default_channel_id_store_unittest.cc index 639e0ac..80f0657 100644 --- a/net/ssl/default_channel_id_store_unittest.cc +++ b/net/ssl/default_channel_id_store_unittest.cc @@ -6,6 +6,7 @@ #include <map> #include <string> +#include <utility> #include <vector> #include "base/bind.h" @@ -45,7 +46,7 @@ class AsyncGetChannelIDHelper { scoped_ptr<crypto::ECPrivateKey> key_result) { err_ = err; server_identifier_ = server_identifier; - key_ = key_result.Pass(); + key_ = std::move(key_result); called_ = true; } diff --git a/net/ssl/openssl_ssl_util.cc b/net/ssl/openssl_ssl_util.cc index f16103a..b91acdd 100644 --- a/net/ssl/openssl_ssl_util.cc +++ b/net/ssl/openssl_ssl_util.cc @@ -5,9 +5,9 @@ #include "net/ssl/openssl_ssl_util.h" #include <errno.h> - #include <openssl/err.h> #include <openssl/ssl.h> +#include <utility> #include "base/bind.h" #include "base/lazy_instance.h" @@ -132,7 +132,7 @@ scoped_ptr<base::Value> NetLogOpenSSLErrorCallback( dict->SetString("file", error_info.file); if (error_info.line != 0) dict->SetInteger("line", error_info.line); - return dict.Pass(); + return std::move(dict); } } // namespace diff --git a/net/ssl/ssl_client_session_cache_openssl.cc b/net/ssl/ssl_client_session_cache_openssl.cc index 0ff7d3b..6246bd5 100644 --- a/net/ssl/ssl_client_session_cache_openssl.cc +++ b/net/ssl/ssl_client_session_cache_openssl.cc @@ -68,7 +68,7 @@ void SSLClientSessionCacheOpenSSL::Flush() { void SSLClientSessionCacheOpenSSL::SetClockForTesting( scoped_ptr<base::Clock> clock) { - clock_ = clock.Pass(); + clock_ = std::move(clock); } SSLClientSessionCacheOpenSSL::CacheEntry::CacheEntry() { diff --git a/net/ssl/ssl_platform_key_nss.cc b/net/ssl/ssl_platform_key_nss.cc index 5a42864..858ffb9 100644 --- a/net/ssl/ssl_platform_key_nss.cc +++ b/net/ssl/ssl_platform_key_nss.cc @@ -5,12 +5,12 @@ #include "net/ssl/ssl_platform_key.h" #include <keyhi.h> -#include <pk11pub.h> -#include <prerror.h> - #include <openssl/bn.h> #include <openssl/ecdsa.h> #include <openssl/rsa.h> +#include <pk11pub.h> +#include <prerror.h> +#include <utility> #include "base/logging.h" #include "base/macros.h" @@ -39,7 +39,7 @@ class SSLPlatformKeyNSS : public ThreadedSSLPrivateKey::Delegate { public: SSLPlatformKeyNSS(SSLPrivateKey::Type type, crypto::ScopedSECKEYPrivateKey key) - : type_(type), key_(key.Pass()) {} + : type_(type), key_(std::move(key)) {} ~SSLPlatformKeyNSS() override {} SSLPrivateKey::Type GetType() override { return type_; } @@ -182,7 +182,7 @@ scoped_refptr<SSLPrivateKey> FetchClientCertPrivateKey( return nullptr; } return make_scoped_refptr(new ThreadedSSLPrivateKey( - make_scoped_ptr(new SSLPlatformKeyNSS(type, key.Pass())), + make_scoped_ptr(new SSLPlatformKeyNSS(type, std::move(key))), GetSSLPlatformKeyTaskRunner())); } diff --git a/net/ssl/threaded_ssl_private_key.cc b/net/ssl/threaded_ssl_private_key.cc index 1169862..d2f1d95 100644 --- a/net/ssl/threaded_ssl_private_key.cc +++ b/net/ssl/threaded_ssl_private_key.cc @@ -31,7 +31,7 @@ class ThreadedSSLPrivateKey::Core : public base::RefCountedThreadSafe<ThreadedSSLPrivateKey::Core> { public: Core(scoped_ptr<ThreadedSSLPrivateKey::Delegate> delegate) - : delegate_(delegate.Pass()) {} + : delegate_(std::move(delegate)) {} ThreadedSSLPrivateKey::Delegate* delegate() { return delegate_.get(); } diff --git a/net/test/embedded_test_server/default_handlers.cc b/net/test/embedded_test_server/default_handlers.cc index f2e1acc..039ac3c 100644 --- a/net/test/embedded_test_server/default_handlers.cc +++ b/net/test/embedded_test_server/default_handlers.cc @@ -9,6 +9,7 @@ #include <map> #include <sstream> #include <string> +#include <utility> #include "base/base64.h" #include "base/files/file_path.h" @@ -53,7 +54,7 @@ scoped_ptr<HttpResponse> HandleDefaultConnect(const HttpRequest& request) { http_response->set_content( "Your client has issued a malformed or illegal request."); http_response->set_content_type("text/html"); - return http_response.Pass(); + return std::move(http_response); } // /cachetime @@ -64,7 +65,7 @@ scoped_ptr<HttpResponse> HandleCacheTime(const HttpRequest& request) { "<html><head><title>Cache: max-age=60</title></head></html>"); http_response->set_content_type("text/html"); http_response->AddCustomHeader("Cache-Control", "max-age=60"); - return http_response.Pass(); + return std::move(http_response); } // /echoheader | /echoheadercache @@ -90,7 +91,7 @@ scoped_ptr<HttpResponse> HandleEchoHeader(const std::string& url, http_response->set_content_type("text/plain"); http_response->AddCustomHeader("Cache-Control", cache_control); - return http_response.Pass(); + return std::move(http_response); } // /echo?status=STATUS @@ -112,7 +113,7 @@ scoped_ptr<HttpResponse> HandleEcho(const HttpRequest& request) { http_response->set_content("Echo"); else http_response->set_content(request.content); - return http_response.Pass(); + return std::move(http_response); } // /echotitle @@ -122,7 +123,7 @@ scoped_ptr<HttpResponse> HandleEchoTitle(const HttpRequest& request) { http_response->set_content_type("text/html"); http_response->set_content("<html><head><title>" + request.content + "</title></head></html>"); - return http_response.Pass(); + return std::move(http_response); } // /echoall?QUERY @@ -154,7 +155,7 @@ scoped_ptr<HttpResponse> HandleEchoAll(const HttpRequest& request) { http_response->set_content_type("text/html"); http_response->set_content(body); - return http_response.Pass(); + return std::move(http_response); } // /set-cookie?COOKIES @@ -174,7 +175,7 @@ scoped_ptr<HttpResponse> HandleSetCookie(const HttpRequest& request) { } http_response->set_content(content); - return http_response.Pass(); + return std::move(http_response); } // /set-many-cookies?N @@ -195,7 +196,7 @@ scoped_ptr<HttpResponse> HandleSetManyCookies(const HttpRequest& request) { http_response->set_content( base::StringPrintf("%" PRIuS " cookies were sent", num)); - return http_response.Pass(); + return std::move(http_response); } // /expect-and-set-cookie?expect=EXPECTED&set=SET&data=DATA @@ -239,7 +240,7 @@ scoped_ptr<HttpResponse> HandleExpectAndSetCookie(const HttpRequest& request) { } http_response->set_content(content); - return http_response.Pass(); + return std::move(http_response); } // /set-header?HEADERS @@ -265,7 +266,7 @@ scoped_ptr<HttpResponse> HandleSetHeader(const HttpRequest& request) { } http_response->set_content(content); - return http_response.Pass(); + return std::move(http_response); } // /nocontent @@ -273,14 +274,14 @@ scoped_ptr<HttpResponse> HandleSetHeader(const HttpRequest& request) { scoped_ptr<HttpResponse> HandleNoContent(const HttpRequest& request) { scoped_ptr<BasicHttpResponse> http_response(new BasicHttpResponse); http_response->set_code(HTTP_NO_CONTENT); - return http_response.Pass(); + return std::move(http_response); } // /close-socket // Immediately closes the connection. scoped_ptr<HttpResponse> HandleCloseSocket(const HttpRequest& request) { scoped_ptr<RawHttpResponse> http_response(new RawHttpResponse("", "")); - return http_response.Pass(); + return std::move(http_response); } // /auth-basic?password=PASS&realm=REALM @@ -341,13 +342,13 @@ scoped_ptr<HttpResponse> HandleAuthBasic(const HttpRequest& request) { "password: %s<p>You sent:<br>%s<p></body></html>", error.c_str(), auth.c_str(), b64str.c_str(), username.c_str(), userpass.c_str(), password.c_str(), request.all_headers.c_str())); - return http_response.Pass(); + return std::move(http_response); } if (request.headers.find("If-None-Match") != request.headers.end() && request.headers.at("If-None-Match") == kEtag) { http_response->set_code(HTTP_NOT_MODIFIED); - return http_response.Pass(); + return std::move(http_response); } base::FilePath file_path = @@ -371,7 +372,7 @@ scoped_ptr<HttpResponse> HandleAuthBasic(const HttpRequest& request) { http_response->AddCustomHeader("Cache-Control", "max-age=60000"); http_response->AddCustomHeader("Etag", kEtag); - return http_response.Pass(); + return std::move(http_response); } // /auth-digest @@ -460,7 +461,7 @@ scoped_ptr<HttpResponse> HandleAuthDigest(const HttpRequest& request) { "You sent:<br>%s<p>We are replying:<br>%s<p></body></html>", error.c_str(), auth.c_str(), request.all_headers.c_str(), auth_header.c_str())); - return http_response.Pass(); + return std::move(http_response); } http_response->set_content_type("text/html"); @@ -469,7 +470,7 @@ scoped_ptr<HttpResponse> HandleAuthDigest(const HttpRequest& request) { "<body>auth=%s<p></body></html>", username.c_str(), password.c_str(), auth.c_str())); - return http_response.Pass(); + return std::move(http_response); } // /server-redirect?URL @@ -486,7 +487,7 @@ scoped_ptr<HttpResponse> HandleServerRedirect(const HttpRequest& request) { http_response->set_content(base::StringPrintf( "<html><head></head><body>Redirecting to %s</body></html>", dest.c_str())); - return http_response.Pass(); + return std::move(http_response); } // /cross-site?URL @@ -515,7 +516,7 @@ scoped_ptr<HttpResponse> HandleCrossSiteRedirect(EmbeddedTestServer* server, http_response->set_content(base::StringPrintf( "<html><head></head><body>Redirecting to %s</body></html>", dest.c_str())); - return http_response.Pass(); + return std::move(http_response); } // /client-redirect?URL @@ -531,7 +532,7 @@ scoped_ptr<HttpResponse> HandleClientRedirect(const HttpRequest& request) { "<html><head><meta http-equiv=\"refresh\" content=\"0;url=%s\"></head>" "<body>Redirecting to %s</body></html>", dest.c_str(), dest.c_str())); - return http_response.Pass(); + return std::move(http_response); } // /defaultresponse @@ -541,7 +542,7 @@ scoped_ptr<HttpResponse> HandleDefaultResponse(const HttpRequest& request) { http_response->set_content_type("text/html"); http_response->set_content("Default response given for path: " + request.relative_url); - return http_response.Pass(); + return std::move(http_response); } // Delays |delay| seconds before sending a response to the client. @@ -574,7 +575,7 @@ scoped_ptr<HttpResponse> HandleSlowServer(const HttpRequest& request) { scoped_ptr<BasicHttpResponse> http_response(new DelayedHttpResponse(delay)); http_response->set_content_type("text/plain"); http_response->set_content(base::StringPrintf("waited %.1f seconds", delay)); - return http_response.Pass(); + return std::move(http_response); } } // namespace anonymous diff --git a/net/test/embedded_test_server/embedded_test_server.cc b/net/test/embedded_test_server/embedded_test_server.cc index bc401c9..6cf6895 100644 --- a/net/test/embedded_test_server/embedded_test_server.cc +++ b/net/test/embedded_test_server/embedded_test_server.cc @@ -4,6 +4,8 @@ #include "net/test/embedded_test_server/embedded_test_server.h" +#include <utility> + #include "base/bind.h" #include "base/files/file_path.h" #include "base/files/file_util.h" @@ -166,7 +168,7 @@ void EmbeddedTestServer::HandleRequest(HttpConnection* connection, << request->relative_url; scoped_ptr<BasicHttpResponse> not_found_response(new BasicHttpResponse); not_found_response->set_code(HTTP_NOT_FOUND); - response = not_found_response.Pass(); + response = std::move(not_found_response); } response->SendResponse( @@ -290,7 +292,7 @@ scoped_ptr<StreamSocket> EmbeddedTestServer::DoSSLUpgrade( scoped_ptr<crypto::RSAPrivateKey> server_key( crypto::RSAPrivateKey::CreateFromPrivateKeyInfo(key_vector)); - return CreateSSLServerSocket(connection.Pass(), GetCertificate().get(), + return CreateSSLServerSocket(std::move(connection), GetCertificate().get(), server_key.get(), ssl_config_); } @@ -302,13 +304,13 @@ void EmbeddedTestServer::DoAcceptLoop() { base::Unretained(this))); if (rv == ERR_IO_PENDING) return; - HandleAcceptResult(accepted_socket_.Pass()); + HandleAcceptResult(std::move(accepted_socket_)); } } void EmbeddedTestServer::OnAcceptCompleted(int rv) { DCHECK_NE(ERR_IO_PENDING, rv); - HandleAcceptResult(accepted_socket_.Pass()); + HandleAcceptResult(std::move(accepted_socket_)); DoAcceptLoop(); } @@ -325,10 +327,10 @@ void EmbeddedTestServer::HandleAcceptResult(scoped_ptr<StreamSocket> socket) { connection_listener_->AcceptedSocket(*socket); if (is_using_ssl_) - socket = DoSSLUpgrade(socket.Pass()); + socket = DoSSLUpgrade(std::move(socket)); HttpConnection* http_connection = new HttpConnection( - socket.Pass(), + std::move(socket), base::Bind(&EmbeddedTestServer::HandleRequest, base::Unretained(this))); connections_[http_connection->socket_.get()] = http_connection; diff --git a/net/test/embedded_test_server/embedded_test_server_unittest.cc b/net/test/embedded_test_server/embedded_test_server_unittest.cc index 03061e4..a08d3b7 100644 --- a/net/test/embedded_test_server/embedded_test_server_unittest.cc +++ b/net/test/embedded_test_server/embedded_test_server_unittest.cc @@ -4,6 +4,8 @@ #include "net/test/embedded_test_server/embedded_test_server.h" +#include <utility> + #include "base/macros.h" #include "base/memory/weak_ptr.h" #include "base/path_service.h" @@ -178,7 +180,7 @@ class EmbeddedTestServerTest http_response->set_code(code); http_response->set_content(content); http_response->set_content_type(content_type); - return http_response.Pass(); + return std::move(http_response); } return nullptr; diff --git a/net/test/embedded_test_server/http_connection.cc b/net/test/embedded_test_server/http_connection.cc index 5fc39ba..ce95f43 100644 --- a/net/test/embedded_test_server/http_connection.cc +++ b/net/test/embedded_test_server/http_connection.cc @@ -4,6 +4,8 @@ #include "net/test/embedded_test_server/http_connection.h" +#include <utility> + #include "net/base/net_errors.h" #include "net/socket/stream_socket.h" @@ -12,7 +14,7 @@ namespace test_server { HttpConnection::HttpConnection(scoped_ptr<StreamSocket> socket, const HandleRequestCallback& callback) - : socket_(socket.Pass()), + : socket_(std::move(socket)), callback_(callback), read_buf_(new IOBufferWithSize(4096)), weak_factory_(this) {} diff --git a/net/test/embedded_test_server/http_request.cc b/net/test/embedded_test_server/http_request.cc index 23a4f92..b5b2e4f 100644 --- a/net/test/embedded_test_server/http_request.cc +++ b/net/test/embedded_test_server/http_request.cc @@ -5,11 +5,12 @@ #include "net/test/embedded_test_server/http_request.h" #include <algorithm> +#include <utility> #include "base/logging.h" -#include "base/strings/string_util.h" #include "base/strings/string_number_conversions.h" #include "base/strings/string_split.h" +#include "base/strings/string_util.h" #include "net/http/http_chunked_decoder.h" #include "url/gurl.h" @@ -216,7 +217,7 @@ HttpRequestParser::ParseResult HttpRequestParser::ParseContent() { scoped_ptr<HttpRequest> HttpRequestParser::GetRequest() { DCHECK_EQ(STATE_ACCEPTED, state_); - scoped_ptr<HttpRequest> result = http_request_.Pass(); + scoped_ptr<HttpRequest> result = std::move(http_request_); // Prepare for parsing a new request. state_ = STATE_HEADERS; @@ -225,7 +226,7 @@ scoped_ptr<HttpRequest> HttpRequestParser::GetRequest() { buffer_position_ = 0; declared_content_length_ = 0; - return result.Pass(); + return result; } HttpMethod HttpRequestParser::GetMethodType(const std::string& token) const { diff --git a/net/test/embedded_test_server/request_handler_util.cc b/net/test/embedded_test_server/request_handler_util.cc index aacfcc5..ab3e975 100644 --- a/net/test/embedded_test_server/request_handler_util.cc +++ b/net/test/embedded_test_server/request_handler_util.cc @@ -7,6 +7,7 @@ #include <stdlib.h> #include <ctime> #include <sstream> +#include <utility> #include "base/base64.h" #include "base/files/file_util.h" @@ -139,19 +140,19 @@ scoped_ptr<HttpResponse> HandleFileRequest(const base::FilePath& server_root, if (query.find("expected_body") != query.end()) { if (request.content.find(query["expected_body"].front()) == std::string::npos) { - return failed_response.Pass(); + return std::move(failed_response); } } if (query.find("expected_headers") != query.end()) { for (const auto& header : query["expected_headers"]) { if (header.find(":") == std::string::npos) - return failed_response.Pass(); + return std::move(failed_response); std::string key = header.substr(0, header.find(":")); std::string value = header.substr(header.find(":") + 1); if (request.headers.find(key) == request.headers.end() || request.headers.at(key) != value) { - return failed_response.Pass(); + return std::move(failed_response); } } } @@ -173,7 +174,7 @@ scoped_ptr<HttpResponse> HandleFileRequest(const base::FilePath& server_root, if (query.find("replace_text") != query.end()) { for (const auto& replacement : query["replace_text"]) { if (replacement.find(":") == std::string::npos) - return failed_response.Pass(); + return std::move(failed_response); std::string find; std::string with; base::Base64Decode(replacement.substr(0, replacement.find(":")), &find); @@ -221,7 +222,7 @@ scoped_ptr<HttpResponse> HandleFileRequest(const base::FilePath& server_root, http_response->AddCustomHeader("Accept-Ranges", "bytes"); http_response->AddCustomHeader("ETag", "'" + file_path.MaybeAsASCII() + "'"); http_response->set_content(file_contents); - return http_response.Pass(); + return std::move(http_response); } } // namespace test_server diff --git a/net/test/spawned_test_server/base_test_server.cc b/net/test/spawned_test_server/base_test_server.cc index f45ef4a..e69233e 100644 --- a/net/test/spawned_test_server/base_test_server.cc +++ b/net/test/spawned_test_server/base_test_server.cc @@ -5,9 +5,9 @@ #include "net/test/spawned_test_server/base_test_server.h" #include <stdint.h> - #include <limits> #include <string> +#include <utility> #include <vector> #include "base/base64.h" @@ -560,7 +560,7 @@ bool BaseTestServer::GenerateArguments(base::DictionaryValue* arguments) const { for (const std::string& proto : ssl_options_.npn_protocols) { npn_protocols->Append(new base::StringValue(proto)); } - arguments->Set("npn-protocols", npn_protocols.Pass()); + arguments->Set("npn-protocols", std::move(npn_protocols)); } if (ssl_options_.alert_after_handshake) arguments->Set("alert-after-handshake", base::Value::CreateNullValue()); diff --git a/net/tools/gdig/gdig.cc b/net/tools/gdig/gdig.cc index 982436849..9a0176b 100644 --- a/net/tools/gdig/gdig.cc +++ b/net/tools/gdig/gdig.cc @@ -4,6 +4,7 @@ #include <stdio.h> #include <string> +#include <utility> #include "base/at_exit.h" #include "base/bind.h" @@ -431,8 +432,8 @@ void GDig::OnDnsConfig(const DnsConfig& dns_config_const) { options.max_retry_attempts = 1u; scoped_ptr<HostResolverImpl> resolver( new HostResolverImpl(options, log_.get())); - resolver->SetDnsClient(dns_client.Pass()); - resolver_ = resolver.Pass(); + resolver->SetDnsClient(std::move(dns_client)); + resolver_ = std::move(resolver); start_time_ = base::Time::Now(); diff --git a/net/tools/get_server_time/get_server_time.cc b/net/tools/get_server_time/get_server_time.cc index 0cbabd7..3363bb0 100644 --- a/net/tools/get_server_time/get_server_time.cc +++ b/net/tools/get_server_time/get_server_time.cc @@ -148,7 +148,7 @@ BuildURLRequestContext(net::NetLog* net_log) { #endif scoped_ptr<net::URLRequestContext> context(builder.Build()); context->set_net_log(net_log); - return context.Pass(); + return context; } // Assuming that the time |server_time| was received from a server, diff --git a/net/udp/udp_net_log_parameters.cc b/net/udp/udp_net_log_parameters.cc index 423f074..d157fe8 100644 --- a/net/udp/udp_net_log_parameters.cc +++ b/net/udp/udp_net_log_parameters.cc @@ -4,6 +4,8 @@ #include "net/udp/udp_net_log_parameters.h" +#include <utility> + #include "base/bind.h" #include "base/strings/string_number_conversions.h" #include "base/values.h" @@ -24,7 +26,7 @@ scoped_ptr<base::Value> NetLogUDPDataTranferCallback( dict->SetString("hex_encoded_bytes", base::HexEncode(bytes, byte_count)); if (address) dict->SetString("address", address->ToString()); - return dict.Pass(); + return std::move(dict); } scoped_ptr<base::Value> NetLogUDPConnectCallback( @@ -32,7 +34,7 @@ scoped_ptr<base::Value> NetLogUDPConnectCallback( NetLogCaptureMode /* capture_mode */) { scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); dict->SetString("address", address->ToString()); - return dict.Pass(); + return std::move(dict); } } // namespace diff --git a/net/url_request/certificate_report_sender.cc b/net/url_request/certificate_report_sender.cc index 0ff637b..55b27a5 100644 --- a/net/url_request/certificate_report_sender.cc +++ b/net/url_request/certificate_report_sender.cc @@ -4,6 +4,8 @@ #include "net/url_request/certificate_report_sender.h" +#include <utility> + #include "base/stl_util.h" #include "net/base/elements_upload_data_stream.h" #include "net/base/load_flags.h" @@ -42,7 +44,7 @@ void CertificateReportSender::Send(const GURL& report_uri, scoped_ptr<UploadElementReader> reader( UploadOwnedBytesElementReader::CreateWithString(report)); url_request->set_upload( - ElementsUploadDataStream::CreateWithReader(reader.Pass(), 0)); + ElementsUploadDataStream::CreateWithReader(std::move(reader), 0)); URLRequest* raw_url_request = url_request.get(); inflight_requests_.insert(url_request.release()); diff --git a/net/url_request/sdch_dictionary_fetcher_unittest.cc b/net/url_request/sdch_dictionary_fetcher_unittest.cc index 6acad54..e676a25 100644 --- a/net/url_request/sdch_dictionary_fetcher_unittest.cc +++ b/net/url_request/sdch_dictionary_fetcher_unittest.cc @@ -5,6 +5,7 @@ #include "net/url_request/sdch_dictionary_fetcher.h" #include <string> +#include <utility> #include <vector> #include "base/bind.h" @@ -124,8 +125,8 @@ class SpecifiedResponseJobInterceptor : public URLRequestInterceptor { new SpecifiedResponseJobInterceptor(http_response_info, lifecycle_callback)); - URLRequestFilter::GetInstance()->AddHostnameInterceptor("http", kTestDomain, - interceptor.Pass()); + URLRequestFilter::GetInstance()->AddHostnameInterceptor( + "http", kTestDomain, std::move(interceptor)); } static void Unregister() { diff --git a/net/url_request/test_url_fetcher_factory.cc b/net/url_request/test_url_fetcher_factory.cc index fb90566..805ef64 100644 --- a/net/url_request/test_url_fetcher_factory.cc +++ b/net/url_request/test_url_fetcher_factory.cc @@ -5,6 +5,7 @@ #include "net/url_request/test_url_fetcher_factory.h" #include <string> +#include <utility> #include "base/bind.h" #include "base/compiler_specific.h" @@ -179,7 +180,7 @@ void TestURLFetcher::SaveResponseWithWriter( // to be done in SaveResponseToFileAtPath(), and this method supports only // URLFetcherStringWriter (for testing of this method only). if (fake_response_destination_ == STRING) { - response_writer_ = response_writer.Pass(); + response_writer_ = std::move(response_writer); int response = response_writer_->Initialize(CompletionCallback()); // The TestURLFetcher doesn't handle asynchronous writes. DCHECK_EQ(OK, response); diff --git a/net/url_request/url_fetcher_core.cc b/net/url_request/url_fetcher_core.cc index 7a2c5e3..5fe0dbd 100644 --- a/net/url_request/url_fetcher_core.cc +++ b/net/url_request/url_fetcher_core.cc @@ -5,6 +5,7 @@ #include "net/url_request/url_fetcher_core.h" #include <stdint.h> +#include <utility> #include "base/bind.h" #include "base/logging.h" @@ -301,7 +302,7 @@ void URLFetcherCore::SaveResponseToTemporaryFile( void URLFetcherCore::SaveResponseWithWriter( scoped_ptr<URLFetcherResponseWriter> response_writer) { DCHECK(delegate_task_runner_->BelongsToCurrentThread()); - response_writer_ = response_writer.Pass(); + response_writer_ = std::move(response_writer); } HttpResponseHeaders* URLFetcherCore::GetResponseHeaders() const { @@ -583,7 +584,7 @@ void URLFetcherCore::StartURLRequest() { scoped_ptr<UploadElementReader> reader(new UploadBytesElementReader( upload_content_.data(), upload_content_.size())); request_->set_upload( - ElementsUploadDataStream::CreateWithReader(reader.Pass(), 0)); + ElementsUploadDataStream::CreateWithReader(std::move(reader), 0)); } else if (!upload_file_path_.empty()) { scoped_ptr<UploadElementReader> reader( new UploadFileElementReader(upload_file_task_runner_.get(), @@ -592,11 +593,11 @@ void URLFetcherCore::StartURLRequest() { upload_range_length_, base::Time())); request_->set_upload( - ElementsUploadDataStream::CreateWithReader(reader.Pass(), 0)); + ElementsUploadDataStream::CreateWithReader(std::move(reader), 0)); } else if (!upload_stream_factory_.is_null()) { scoped_ptr<UploadDataStream> stream = upload_stream_factory_.Run(); DCHECK(stream); - request_->set_upload(stream.Pass()); + request_->set_upload(std::move(stream)); } current_upload_bytes_ = -1; diff --git a/net/url_request/url_fetcher_impl.cc b/net/url_request/url_fetcher_impl.cc index 02a3ae9..ed00e4e 100644 --- a/net/url_request/url_fetcher_impl.cc +++ b/net/url_request/url_fetcher_impl.cc @@ -4,6 +4,8 @@ #include "net/url_request/url_fetcher_impl.h" +#include <utility> + #include "base/bind.h" #include "base/sequenced_task_runner.h" #include "net/base/upload_data_stream.h" @@ -139,7 +141,7 @@ void URLFetcherImpl::SaveResponseToTemporaryFile( void URLFetcherImpl::SaveResponseWithWriter( scoped_ptr<URLFetcherResponseWriter> response_writer) { - core_->SaveResponseWithWriter(response_writer.Pass()); + core_->SaveResponseWithWriter(std::move(response_writer)); } HttpResponseHeaders* URLFetcherImpl::GetResponseHeaders() const { diff --git a/net/url_request/url_request.cc b/net/url_request/url_request.cc index ef5a413..4d1a871 100644 --- a/net/url_request/url_request.cc +++ b/net/url_request/url_request.cc @@ -4,6 +4,8 @@ #include "net/url_request/url_request.h" +#include <utility> + #include "base/bind.h" #include "base/bind_helpers.h" #include "base/callback.h" @@ -208,7 +210,7 @@ void URLRequest::AppendChunkToUpload(const char* bytes, } void URLRequest::set_upload(scoped_ptr<UploadDataStream> upload) { - upload_data_stream_ = upload.Pass(); + upload_data_stream_ = std::move(upload); } const UploadDataStream* URLRequest::get_upload() const { @@ -287,7 +289,7 @@ scoped_ptr<base::Value> URLRequest::GetStateAsValue() const { for (const GURL& url : url_chain_) { list->AppendString(url.possibly_invalid_spec()); } - dict->Set("url_chain", list.Pass()); + dict->Set("url_chain", std::move(list)); } dict->SetInteger("load_flags", load_flags_); @@ -322,7 +324,7 @@ scoped_ptr<base::Value> URLRequest::GetStateAsValue() const { } if (status_.error() != OK) dict->SetInteger("net_error", status_.error()); - return dict.Pass(); + return std::move(dict); } void URLRequest::LogBlockedBy(const char* blocked_by) { diff --git a/net/url_request/url_request_context_builder.cc b/net/url_request/url_request_context_builder.cc index 734292b..8290c5d 100644 --- a/net/url_request/url_request_context_builder.cc +++ b/net/url_request/url_request_context_builder.cc @@ -5,6 +5,7 @@ #include "net/url_request/url_request_context_builder.h" #include <string> +#include <utility> #include <vector> #include "base/compiler_specific.h" @@ -152,7 +153,7 @@ class ContainerURLRequestContext : public URLRequestContext { void set_transport_security_persister( scoped_ptr<TransportSecurityPersister> transport_security_persister) { - transport_security_persister_ = transport_security_persister.Pass(); + transport_security_persister_ = std::move(transport_security_persister); } private: @@ -242,7 +243,7 @@ void URLRequestContextBuilder::SetSpdyAndQuicEnabled(bool spdy_enabled, void URLRequestContextBuilder::SetCertVerifier( scoped_ptr<CertVerifier> cert_verifier) { - cert_verifier_ = cert_verifier.Pass(); + cert_verifier_ = std::move(cert_verifier); } void URLRequestContextBuilder::SetInterceptors( @@ -255,7 +256,7 @@ void URLRequestContextBuilder::SetCookieAndChannelIdStores( scoped_ptr<ChannelIDService> channel_id_service) { DCHECK(cookie_store); cookie_store_ = cookie_store; - channel_id_service_ = channel_id_service.Pass(); + channel_id_service_ = std::move(channel_id_service); } void URLRequestContextBuilder::SetFileTaskRunner( @@ -265,12 +266,12 @@ void URLRequestContextBuilder::SetFileTaskRunner( void URLRequestContextBuilder::SetHttpAuthHandlerFactory( scoped_ptr<HttpAuthHandlerFactory> factory) { - http_auth_handler_factory_ = factory.Pass(); + http_auth_handler_factory_ = std::move(factory); } void URLRequestContextBuilder::SetHttpServerProperties( scoped_ptr<HttpServerProperties> http_server_properties) { - http_server_properties_ = http_server_properties.Pass(); + http_server_properties_ = std::move(http_server_properties); } scoped_ptr<URLRequestContext> URLRequestContextBuilder::Build() { @@ -283,7 +284,7 @@ scoped_ptr<URLRequestContext> URLRequestContextBuilder::Build() { if (!network_delegate_) network_delegate_.reset(new BasicNetworkDelegate); - storage->set_network_delegate(network_delegate_.Pass()); + storage->set_network_delegate(std::move(network_delegate_)); if (net_log_) { // Unlike the other builder parameters, |net_log_| is not owned by the @@ -296,7 +297,7 @@ scoped_ptr<URLRequestContext> URLRequestContextBuilder::Build() { if (!host_resolver_) { host_resolver_ = HostResolver::CreateDefaultResolver(context->net_log()); } - storage->set_host_resolver(host_resolver_.Pass()); + storage->set_host_resolver(std::move(host_resolver_)); if (!proxy_service_) { // TODO(willchan): Switch to using this code when @@ -309,11 +310,11 @@ scoped_ptr<URLRequestContext> URLRequestContextBuilder::Build() { } #endif // !defined(OS_LINUX) && !defined(OS_ANDROID) proxy_service_ = ProxyService::CreateUsingSystemProxyResolver( - proxy_config_service_.Pass(), + std::move(proxy_config_service_), 0, // This results in using the default value. context->net_log()); } - storage->set_proxy_service(proxy_service_.Pass()); + storage->set_proxy_service(std::move(proxy_service_)); storage->set_ssl_config_service(new SSLConfigServiceDefaults); @@ -322,11 +323,11 @@ scoped_ptr<URLRequestContext> URLRequestContextBuilder::Build() { HttpAuthHandlerRegistryFactory::CreateDefault(context->host_resolver()); } - storage->set_http_auth_handler_factory(http_auth_handler_factory_.Pass()); + storage->set_http_auth_handler_factory(std::move(http_auth_handler_factory_)); if (cookie_store_) { storage->set_cookie_store(cookie_store_.get()); - storage->set_channel_id_service(channel_id_service_.Pass()); + storage->set_channel_id_service(std::move(channel_id_service_)); } else { storage->set_cookie_store(new CookieMonster(NULL, NULL)); // TODO(mmenke): This always creates a file thread, even when it ends up @@ -336,8 +337,7 @@ scoped_ptr<URLRequestContext> URLRequestContextBuilder::Build() { } if (sdch_enabled_) { - storage->set_sdch_manager( - scoped_ptr<net::SdchManager>(new SdchManager()).Pass()); + storage->set_sdch_manager(scoped_ptr<net::SdchManager>(new SdchManager())); } storage->set_transport_security_state( @@ -352,14 +352,14 @@ scoped_ptr<URLRequestContext> URLRequestContextBuilder::Build() { } if (http_server_properties_) { - storage->set_http_server_properties(http_server_properties_.Pass()); + storage->set_http_server_properties(std::move(http_server_properties_)); } else { storage->set_http_server_properties( scoped_ptr<HttpServerProperties>(new HttpServerPropertiesImpl())); } if (cert_verifier_) { - storage->set_cert_verifier(cert_verifier_.Pass()); + storage->set_cert_verifier(std::move(cert_verifier_)); } else { storage->set_cert_verifier(CertVerifier::CreateDefault()); } @@ -424,12 +424,12 @@ scoped_ptr<URLRequestContext> URLRequestContextBuilder::Build() { } http_transaction_factory.reset(new HttpCache( - storage->http_network_session(), http_cache_backend.Pass(), true)); + storage->http_network_session(), std::move(http_cache_backend), true)); } else { http_transaction_factory.reset( new HttpNetworkLayer(storage->http_network_session())); } - storage->set_http_transaction_factory(http_transaction_factory.Pass()); + storage->set_http_transaction_factory(std::move(http_transaction_factory)); URLRequestJobFactoryImpl* job_factory = new URLRequestJobFactoryImpl; if (data_enabled_) diff --git a/net/url_request/url_request_context_builder.h b/net/url_request/url_request_context_builder.h index 6e8b45a..5b70b4c 100644 --- a/net/url_request/url_request_context_builder.h +++ b/net/url_request/url_request_context_builder.h @@ -15,8 +15,8 @@ #define NET_URL_REQUEST_URL_REQUEST_CONTEXT_BUILDER_H_ #include <stdint.h> - #include <string> +#include <utility> #include "base/files/file_path.h" #include "base/macros.h" @@ -110,10 +110,10 @@ class NET_EXPORT URLRequestContextBuilder { // set, will be used to construct a ProxyService. void set_proxy_config_service( scoped_ptr<ProxyConfigService> proxy_config_service) { - proxy_config_service_ = proxy_config_service.Pass(); + proxy_config_service_ = std::move(proxy_config_service); } void set_proxy_service(scoped_ptr<ProxyService> proxy_service) { - proxy_service_ = proxy_service.Pass(); + proxy_service_ = std::move(proxy_service); } // Call these functions to specify hard-coded Accept-Language @@ -153,14 +153,14 @@ class NET_EXPORT URLRequestContextBuilder { // By default host_resolver is constructed with CreateDefaultResolver. void set_host_resolver(scoped_ptr<HostResolver> host_resolver) { - host_resolver_ = host_resolver.Pass(); + host_resolver_ = std::move(host_resolver); } // Uses BasicNetworkDelegate by default. Note that calling Build will unset // any custom delegate in builder, so this must be called each time before // Build is called. void set_network_delegate(scoped_ptr<NetworkDelegate> delegate) { - network_delegate_ = delegate.Pass(); + network_delegate_ = std::move(delegate); } // Sets a specific HttpAuthHandlerFactory to be used by the URLRequestContext diff --git a/net/url_request/url_request_context_storage.cc b/net/url_request/url_request_context_storage.cc index e4294b2..399bc47 100644 --- a/net/url_request/url_request_context_storage.cc +++ b/net/url_request/url_request_context_storage.cc @@ -4,6 +4,8 @@ #include "net/url_request/url_request_context_storage.h" +#include <utility> + #include "base/logging.h" #include "net/base/network_delegate.h" #include "net/base/sdch_manager.h" @@ -34,37 +36,37 @@ URLRequestContextStorage::~URLRequestContextStorage() {} void URLRequestContextStorage::set_net_log(scoped_ptr<NetLog> net_log) { context_->set_net_log(net_log.get()); - net_log_ = net_log.Pass(); + net_log_ = std::move(net_log); } void URLRequestContextStorage::set_host_resolver( scoped_ptr<HostResolver> host_resolver) { context_->set_host_resolver(host_resolver.get()); - host_resolver_ = host_resolver.Pass(); + host_resolver_ = std::move(host_resolver); } void URLRequestContextStorage::set_cert_verifier( scoped_ptr<CertVerifier> cert_verifier) { context_->set_cert_verifier(cert_verifier.get()); - cert_verifier_ = cert_verifier.Pass(); + cert_verifier_ = std::move(cert_verifier); } void URLRequestContextStorage::set_channel_id_service( scoped_ptr<ChannelIDService> channel_id_service) { context_->set_channel_id_service(channel_id_service.get()); - channel_id_service_ = channel_id_service.Pass(); + channel_id_service_ = std::move(channel_id_service); } void URLRequestContextStorage::set_http_auth_handler_factory( scoped_ptr<HttpAuthHandlerFactory> http_auth_handler_factory) { context_->set_http_auth_handler_factory(http_auth_handler_factory.get()); - http_auth_handler_factory_ = http_auth_handler_factory.Pass(); + http_auth_handler_factory_ = std::move(http_auth_handler_factory); } void URLRequestContextStorage::set_proxy_service( scoped_ptr<ProxyService> proxy_service) { context_->set_proxy_service(proxy_service.get()); - proxy_service_ = proxy_service.Pass(); + proxy_service_ = std::move(proxy_service); } void URLRequestContextStorage::set_ssl_config_service( @@ -76,12 +78,12 @@ void URLRequestContextStorage::set_ssl_config_service( void URLRequestContextStorage::set_network_delegate( scoped_ptr<NetworkDelegate> network_delegate) { context_->set_network_delegate(network_delegate.get()); - network_delegate_ = network_delegate.Pass(); + network_delegate_ = std::move(network_delegate); } void URLRequestContextStorage::set_http_server_properties( scoped_ptr<HttpServerProperties> http_server_properties) { - http_server_properties_ = http_server_properties.Pass(); + http_server_properties_ = std::move(http_server_properties); context_->set_http_server_properties(http_server_properties_->GetWeakPtr()); } @@ -93,48 +95,48 @@ void URLRequestContextStorage::set_cookie_store(CookieStore* cookie_store) { void URLRequestContextStorage::set_transport_security_state( scoped_ptr<TransportSecurityState> transport_security_state) { context_->set_transport_security_state(transport_security_state.get()); - transport_security_state_ = transport_security_state.Pass(); + transport_security_state_ = std::move(transport_security_state); } void URLRequestContextStorage::set_http_network_session( scoped_ptr<HttpNetworkSession> http_network_session) { - http_network_session_ = http_network_session.Pass(); + http_network_session_ = std::move(http_network_session); } void URLRequestContextStorage::set_http_transaction_factory( scoped_ptr<HttpTransactionFactory> http_transaction_factory) { context_->set_http_transaction_factory(http_transaction_factory.get()); - http_transaction_factory_ = http_transaction_factory.Pass(); + http_transaction_factory_ = std::move(http_transaction_factory); } void URLRequestContextStorage::set_job_factory( scoped_ptr<URLRequestJobFactory> job_factory) { context_->set_job_factory(job_factory.get()); - job_factory_ = job_factory.Pass(); + job_factory_ = std::move(job_factory); } void URLRequestContextStorage::set_throttler_manager( scoped_ptr<URLRequestThrottlerManager> throttler_manager) { context_->set_throttler_manager(throttler_manager.get()); - throttler_manager_ = throttler_manager.Pass(); + throttler_manager_ = std::move(throttler_manager); } void URLRequestContextStorage::set_backoff_manager( scoped_ptr<URLRequestBackoffManager> backoff_manager) { context_->set_backoff_manager(backoff_manager.get()); - backoff_manager_ = backoff_manager.Pass(); + backoff_manager_ = std::move(backoff_manager); } void URLRequestContextStorage::set_http_user_agent_settings( scoped_ptr<HttpUserAgentSettings> http_user_agent_settings) { context_->set_http_user_agent_settings(http_user_agent_settings.get()); - http_user_agent_settings_ = http_user_agent_settings.Pass(); + http_user_agent_settings_ = std::move(http_user_agent_settings); } void URLRequestContextStorage::set_sdch_manager( scoped_ptr<SdchManager> sdch_manager) { context_->set_sdch_manager(sdch_manager.get()); - sdch_manager_ = sdch_manager.Pass(); + sdch_manager_ = std::move(sdch_manager); } } // namespace net diff --git a/net/url_request/url_request_ftp_job_unittest.cc b/net/url_request/url_request_ftp_job_unittest.cc index ab1a7d9..cb31ecf 100644 --- a/net/url_request/url_request_ftp_job_unittest.cc +++ b/net/url_request/url_request_ftp_job_unittest.cc @@ -4,6 +4,7 @@ #include "net/url_request/url_request_ftp_job.h" +#include <utility> #include <vector> #include "base/memory/ref_counted.h" @@ -46,7 +47,7 @@ class MockProxyResolverFactory : public ProxyResolverFactory { scoped_ptr<MockAsyncProxyResolver> owned_resolver( new MockAsyncProxyResolver()); resolver_ = owned_resolver.get(); - *resolver = owned_resolver.Pass(); + *resolver = std::move(owned_resolver); return OK; } @@ -67,13 +68,13 @@ class FtpTestURLRequestContext : public TestURLRequestContext { : TestURLRequestContext(true), ftp_protocol_handler_(new FtpProtocolHandler(ftp_transaction_factory)) { set_client_socket_factory(socket_factory); - context_storage_.set_proxy_service(proxy_service.Pass()); + context_storage_.set_proxy_service(std::move(proxy_service)); set_network_delegate(network_delegate); scoped_ptr<URLRequestJobFactoryImpl> job_factory = make_scoped_ptr(new URLRequestJobFactoryImpl); job_factory->SetProtocolHandler("ftp", make_scoped_ptr(ftp_protocol_handler_)); - context_storage_.set_job_factory(job_factory.Pass()); + context_storage_.set_job_factory(std::move(job_factory)); Init(); } @@ -82,7 +83,7 @@ class FtpTestURLRequestContext : public TestURLRequestContext { } void set_proxy_service(scoped_ptr<ProxyService> proxy_service) { - context_storage_.set_proxy_service(proxy_service.Pass()); + context_storage_.set_proxy_service(std::move(proxy_service)); } private: @@ -321,7 +322,7 @@ TEST_F(URLRequestFtpJobTest, FtpProxyRequestOrphanJob) { request_context()->set_proxy_service(make_scoped_ptr(new ProxyService( make_scoped_ptr(new ProxyConfigServiceFixed( ProxyConfig::CreateFromCustomPacURL(GURL("http://foo")))), - owned_resolver_factory.Pass(), nullptr))); + std::move(owned_resolver_factory), nullptr))); TestDelegate request_delegate; scoped_ptr<URLRequest> url_request(request_context()->CreateRequest( @@ -352,7 +353,7 @@ TEST_F(URLRequestFtpJobTest, FtpProxyRequestCancelRequest) { request_context()->set_proxy_service(make_scoped_ptr(new ProxyService( make_scoped_ptr(new ProxyConfigServiceFixed( ProxyConfig::CreateFromCustomPacURL(GURL("http://foo")))), - owned_resolver_factory.Pass(), nullptr))); + std::move(owned_resolver_factory), nullptr))); TestDelegate request_delegate; scoped_ptr<URLRequest> url_request(request_context()->CreateRequest( diff --git a/net/url_request/url_request_http_job_unittest.cc b/net/url_request/url_request_http_job_unittest.cc index d7a7c83..1714af9 100644 --- a/net/url_request/url_request_http_job_unittest.cc +++ b/net/url_request/url_request_http_job_unittest.cc @@ -87,7 +87,7 @@ class URLRequestHttpJobTest : public ::testing::Test { } void EnableSdch() { - context_.SetSdchManager(scoped_ptr<SdchManager>(new SdchManager).Pass()); + context_.SetSdchManager(scoped_ptr<SdchManager>(new SdchManager)); } MockNetworkLayer network_layer_; @@ -132,10 +132,8 @@ TEST_F(URLRequestHttpJobWithMockSocketsTest, socket_factory_.AddSocketDataProvider(&socket_data); TestDelegate delegate; - scoped_ptr<URLRequest> request = - context_->CreateRequest(GURL("http://www.example.com"), DEFAULT_PRIORITY, - &delegate) - .Pass(); + scoped_ptr<URLRequest> request = context_->CreateRequest( + GURL("http://www.example.com"), DEFAULT_PRIORITY, &delegate); request->Start(); ASSERT_TRUE(request->is_pending()); @@ -163,10 +161,8 @@ TEST_F(URLRequestHttpJobWithMockSocketsTest, socket_factory_.AddSocketDataProvider(&socket_data); TestDelegate delegate; - scoped_ptr<URLRequest> request = - context_->CreateRequest(GURL("http://www.example.com"), DEFAULT_PRIORITY, - &delegate) - .Pass(); + scoped_ptr<URLRequest> request = context_->CreateRequest( + GURL("http://www.example.com"), DEFAULT_PRIORITY, &delegate); request->Start(); ASSERT_TRUE(request->is_pending()); @@ -196,10 +192,8 @@ TEST_F(URLRequestHttpJobWithMockSocketsTest, TestContentLengthFailedRequest) { socket_factory_.AddSocketDataProvider(&socket_data); TestDelegate delegate; - scoped_ptr<URLRequest> request = - context_->CreateRequest(GURL("http://www.example.com"), DEFAULT_PRIORITY, - &delegate) - .Pass(); + scoped_ptr<URLRequest> request = context_->CreateRequest( + GURL("http://www.example.com"), DEFAULT_PRIORITY, &delegate); request->Start(); ASSERT_TRUE(request->is_pending()); @@ -230,10 +224,8 @@ TEST_F(URLRequestHttpJobWithMockSocketsTest, socket_factory_.AddSocketDataProvider(&socket_data); TestDelegate delegate; - scoped_ptr<URLRequest> request = - context_->CreateRequest(GURL("http://www.example.com"), DEFAULT_PRIORITY, - &delegate) - .Pass(); + scoped_ptr<URLRequest> request = context_->CreateRequest( + GURL("http://www.example.com"), DEFAULT_PRIORITY, &delegate); delegate.set_cancel_in_received_data(true); request->Start(); @@ -280,10 +272,8 @@ TEST_F(URLRequestHttpJobWithMockSocketsTest, socket_factory_.AddSocketDataProvider(&final_socket_data); TestDelegate delegate; - scoped_ptr<URLRequest> request = - context_->CreateRequest(GURL("http://www.redirect.com"), DEFAULT_PRIORITY, - &delegate) - .Pass(); + scoped_ptr<URLRequest> request = context_->CreateRequest( + GURL("http://www.redirect.com"), DEFAULT_PRIORITY, &delegate); request->Start(); ASSERT_TRUE(request->is_pending()); @@ -314,10 +304,8 @@ TEST_F(URLRequestHttpJobWithMockSocketsTest, socket_factory_.AddSocketDataProvider(&socket_data); TestDelegate delegate; - scoped_ptr<URLRequest> request = - context_->CreateRequest(GURL("http://www.example.com"), DEFAULT_PRIORITY, - &delegate) - .Pass(); + scoped_ptr<URLRequest> request = context_->CreateRequest( + GURL("http://www.example.com"), DEFAULT_PRIORITY, &delegate); delegate.set_cancel_in_response_started(true); request->Start(); @@ -341,10 +329,8 @@ TEST_F(URLRequestHttpJobWithMockSocketsTest, socket_factory_.AddSocketDataProvider(&socket_data); TestDelegate delegate; - scoped_ptr<URLRequest> request = - context_->CreateRequest(GURL("http://www.example.com"), DEFAULT_PRIORITY, - &delegate) - .Pass(); + scoped_ptr<URLRequest> request = context_->CreateRequest( + GURL("http://www.example.com"), DEFAULT_PRIORITY, &delegate); request->Start(); request->Cancel(); @@ -376,9 +362,8 @@ TEST_F(URLRequestHttpJobWithMockSocketsTest, BackoffHeader) { socket_factory_.AddSocketDataProvider(&socket_data); TestDelegate delegate1; - scoped_ptr<URLRequest> request1 = - context_->CreateRequest(GURL("https://www.example.com"), DEFAULT_PRIORITY, - &delegate1).Pass(); + scoped_ptr<URLRequest> request1 = context_->CreateRequest( + GURL("https://www.example.com"), DEFAULT_PRIORITY, &delegate1); request1->Start(); ASSERT_TRUE(request1->is_pending()); @@ -391,9 +376,8 @@ TEST_F(URLRequestHttpJobWithMockSocketsTest, BackoffHeader) { // Issue another request, and backoff logic should apply. TestDelegate delegate2; - scoped_ptr<URLRequest> request2 = - context_->CreateRequest(GURL("https://www.example.com"), DEFAULT_PRIORITY, - &delegate2).Pass(); + scoped_ptr<URLRequest> request2 = context_->CreateRequest( + GURL("https://www.example.com"), DEFAULT_PRIORITY, &delegate2); request2->Start(); ASSERT_TRUE(request2->is_pending()); @@ -441,10 +425,8 @@ TEST_F(URLRequestHttpJobWithMockSocketsTest, BackoffHeaderUserGesture) { socket_factory_.AddSocketDataProvider(&socket_data); TestDelegate delegate1; - scoped_ptr<URLRequest> request1 = - context_->CreateRequest(GURL("https://www.example.com"), DEFAULT_PRIORITY, - &delegate1) - .Pass(); + scoped_ptr<URLRequest> request1 = context_->CreateRequest( + GURL("https://www.example.com"), DEFAULT_PRIORITY, &delegate1); request1->Start(); ASSERT_TRUE(request1->is_pending()); @@ -457,10 +439,8 @@ TEST_F(URLRequestHttpJobWithMockSocketsTest, BackoffHeaderUserGesture) { // Issue a user-initiated request, backoff logic should not apply. TestDelegate delegate2; - scoped_ptr<URLRequest> request2 = - context_->CreateRequest(GURL("https://www.example.com"), DEFAULT_PRIORITY, - &delegate2) - .Pass(); + scoped_ptr<URLRequest> request2 = context_->CreateRequest( + GURL("https://www.example.com"), DEFAULT_PRIORITY, &delegate2); request2->SetLoadFlags(request2->load_flags() | LOAD_MAYBE_USER_GESTURE); request2->Start(); @@ -487,9 +467,8 @@ TEST_F(URLRequestHttpJobWithMockSocketsTest, BackoffHeaderNotSecure) { socket_factory_.AddSocketDataProvider(&socket_data); TestDelegate delegate; - scoped_ptr<URLRequest> request = - context_->CreateRequest(GURL("http://www.example.com"), DEFAULT_PRIORITY, - &delegate).Pass(); + scoped_ptr<URLRequest> request = context_->CreateRequest( + GURL("http://www.example.com"), DEFAULT_PRIORITY, &delegate); request->Start(); ASSERT_TRUE(request->is_pending()); @@ -522,9 +501,8 @@ TEST_F(URLRequestHttpJobWithMockSocketsTest, BackoffHeaderCachedResponse) { socket_factory_.AddSocketDataProvider(&socket_data); TestDelegate delegate1; - scoped_ptr<URLRequest> request1 = - context_->CreateRequest(GURL("https://www.example.com"), DEFAULT_PRIORITY, - &delegate1).Pass(); + scoped_ptr<URLRequest> request1 = context_->CreateRequest( + GURL("https://www.example.com"), DEFAULT_PRIORITY, &delegate1); request1->Start(); ASSERT_TRUE(request1->is_pending()); @@ -538,9 +516,8 @@ TEST_F(URLRequestHttpJobWithMockSocketsTest, BackoffHeaderCachedResponse) { // Backoff logic does not apply to a second request, since it is fetched // from cache. TestDelegate delegate2; - scoped_ptr<URLRequest> request2 = - context_->CreateRequest(GURL("https://www.example.com"), DEFAULT_PRIORITY, - &delegate2).Pass(); + scoped_ptr<URLRequest> request2 = context_->CreateRequest( + GURL("https://www.example.com"), DEFAULT_PRIORITY, &delegate2); request2->Start(); ASSERT_TRUE(request2->is_pending()); @@ -554,10 +531,8 @@ TEST_F(URLRequestHttpJobTest, TestCancelWhileReadingCookies) { context_.set_cookie_store(new DelayedCookieMonster()); TestDelegate delegate; - scoped_ptr<URLRequest> request = - context_.CreateRequest(GURL("http://www.example.com"), DEFAULT_PRIORITY, - &delegate) - .Pass(); + scoped_ptr<URLRequest> request = context_.CreateRequest( + GURL("http://www.example.com"), DEFAULT_PRIORITY, &delegate); request->Start(); request->Cancel(); diff --git a/net/url_request/url_request_intercepting_job_factory.cc b/net/url_request/url_request_intercepting_job_factory.cc index ea2d1f2..3ced003 100644 --- a/net/url_request/url_request_intercepting_job_factory.cc +++ b/net/url_request/url_request_intercepting_job_factory.cc @@ -4,6 +4,8 @@ #include "net/url_request/url_request_intercepting_job_factory.h" +#include <utility> + #include "base/logging.h" #include "net/url_request/url_request_interceptor.h" @@ -12,9 +14,8 @@ namespace net { URLRequestInterceptingJobFactory::URLRequestInterceptingJobFactory( scoped_ptr<URLRequestJobFactory> job_factory, scoped_ptr<URLRequestInterceptor> interceptor) - : job_factory_(job_factory.Pass()), - interceptor_(interceptor.Pass()) { -} + : job_factory_(std::move(job_factory)), + interceptor_(std::move(interceptor)) {} URLRequestInterceptingJobFactory::~URLRequestInterceptingJobFactory() {} diff --git a/net/url_request/url_request_job.cc b/net/url_request/url_request_job.cc index 2a90ce0..55a4f51 100644 --- a/net/url_request/url_request_job.cc +++ b/net/url_request/url_request_job.cc @@ -4,6 +4,8 @@ #include "net/url_request/url_request_job.h" +#include <utility> + #include "base/bind.h" #include "base/compiler_specific.h" #include "base/location.h" @@ -37,7 +39,7 @@ scoped_ptr<base::Value> FiltersSetCallback( NetLogCaptureMode /* capture_mode */) { scoped_ptr<base::DictionaryValue> event_params(new base::DictionaryValue()); event_params->SetString("filters", filter->OrderedFilterList()); - return event_params.Pass(); + return std::move(event_params); } std::string ComputeMethodForRedirect(const std::string& method, diff --git a/net/url_request/url_request_netlog_params.cc b/net/url_request/url_request_netlog_params.cc index 14fb453..f238b87 100644 --- a/net/url_request/url_request_netlog_params.cc +++ b/net/url_request/url_request_netlog_params.cc @@ -4,6 +4,8 @@ #include "net/url_request/url_request_netlog_params.h" +#include <utility> + #include "base/strings/string_number_conversions.h" #include "base/values.h" #include "url/gurl.h" @@ -24,7 +26,7 @@ scoped_ptr<base::Value> NetLogURLRequestStartCallback( dict->SetString("priority", RequestPriorityToString(priority)); if (upload_id > -1) dict->SetString("upload_id", base::Int64ToString(upload_id)); - return dict.Pass(); + return std::move(dict); } } // namespace net diff --git a/net/url_request/url_request_test_util.cc b/net/url_request/url_request_test_util.cc index 317ee74..b3c03c7 100644 --- a/net/url_request/url_request_test_util.cc +++ b/net/url_request/url_request_test_util.cc @@ -4,6 +4,8 @@ #include "net/url_request/url_request_test_util.h" +#include <utility> + #include "base/compiler_specific.h" #include "base/location.h" #include "base/logging.h" @@ -143,7 +145,7 @@ TestURLRequestContextGetter::TestURLRequestContextGetter( TestURLRequestContextGetter::TestURLRequestContextGetter( const scoped_refptr<base::SingleThreadTaskRunner>& network_task_runner, scoped_ptr<TestURLRequestContext> context) - : network_task_runner_(network_task_runner), context_(context.Pass()) { + : network_task_runner_(network_task_runner), context_(std::move(context)) { DCHECK(network_task_runner_.get()); } diff --git a/net/url_request/url_request_test_util.h b/net/url_request/url_request_test_util.h index 63e36c1..1a829d5 100644 --- a/net/url_request/url_request_test_util.h +++ b/net/url_request/url_request_test_util.h @@ -7,9 +7,9 @@ #include <stdint.h> #include <stdlib.h> - #include <map> #include <string> +#include <utility> #include "base/compiler_specific.h" #include "base/memory/ref_counted.h" @@ -71,11 +71,11 @@ class TestURLRequestContext : public URLRequestContext { void set_http_network_session_params( scoped_ptr<HttpNetworkSession::Params> params) { - http_network_session_params_ = params.Pass(); + http_network_session_params_ = std::move(params); } void SetSdchManager(scoped_ptr<SdchManager> sdch_manager) { - context_storage_.set_sdch_manager(sdch_manager.Pass()); + context_storage_.set_sdch_manager(std::move(sdch_manager)); } private: diff --git a/net/url_request/url_request_throttler_entry.cc b/net/url_request/url_request_throttler_entry.cc index 8b8fae9..7c85edc 100644 --- a/net/url_request/url_request_throttler_entry.cc +++ b/net/url_request/url_request_throttler_entry.cc @@ -5,6 +5,7 @@ #include "net/url_request/url_request_throttler_entry.h" #include <cmath> +#include <utility> #include "base/logging.h" #include "base/metrics/field_trial.h" @@ -57,7 +58,7 @@ scoped_ptr<base::Value> NetLogRejectedRequestCallback( dict->SetInteger("num_failures", num_failures); dict->SetInteger("release_after_ms", static_cast<int>(release_after.InMilliseconds())); - return dict.Pass(); + return std::move(dict); } URLRequestThrottlerEntry::URLRequestThrottlerEntry( diff --git a/net/url_request/url_request_unittest.cc b/net/url_request/url_request_unittest.cc index 6811c8f..eea6a69 100644 --- a/net/url_request/url_request_unittest.cc +++ b/net/url_request/url_request_unittest.cc @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include <utility> + #include "build/build_config.h" #if defined(OS_WIN) @@ -315,7 +317,7 @@ bool ContainsString(const std::string& haystack, const char* needle) { scoped_ptr<UploadDataStream> CreateSimpleUploadData(const char* data) { scoped_ptr<UploadElementReader> reader( new UploadBytesElementReader(data, strlen(data))); - return ElementsUploadDataStream::CreateWithReader(reader.Pass(), 0); + return ElementsUploadDataStream::CreateWithReader(std::move(reader), 0); } // Verify that the SSLInfo of a successful SSL connection has valid values. @@ -1546,7 +1548,7 @@ class URLRequestInterceptorTest : public URLRequestTest { void SetUpFactory() override { interceptor_ = new MockURLRequestInterceptor(); job_factory_.reset(new URLRequestInterceptingJobFactory( - job_factory_.Pass(), make_scoped_ptr(interceptor_))); + std::move(job_factory_), make_scoped_ptr(interceptor_))); } MockURLRequestInterceptor* interceptor() const { @@ -3331,7 +3333,7 @@ scoped_ptr<test_server::HttpResponse> HandleRedirectConnect( http_response->set_code(HTTP_FOUND); http_response->AddCustomHeader("Location", "http://www.destination.com/foo.js"); - return http_response.Pass(); + return std::move(http_response); } } // namespace @@ -4196,7 +4198,7 @@ scoped_ptr<test_server::HttpResponse> HandleServerAuthConnect( http_response->set_code(HTTP_UNAUTHORIZED); http_response->AddCustomHeader("WWW-Authenticate", "Basic realm=\"WallyWorld\""); - return http_response.Pass(); + return std::move(http_response); } } // namespace @@ -7394,7 +7396,7 @@ TEST_F(URLRequestTestHTTP, NetworkSuspendTest) { default_context_.http_transaction_factory()->GetSession())); network_layer->OnSuspend(); - HttpCache http_cache(network_layer.Pass(), + HttpCache http_cache(std::move(network_layer), HttpCache::DefaultBackend::InMemory(0), true); TestURLRequestContext context(true); @@ -7540,7 +7542,7 @@ class URLRequestInterceptorTestHTTP : public URLRequestTestHTTP { void SetUpFactory() override { interceptor_ = new MockURLRequestInterceptor(); job_factory_.reset(new URLRequestInterceptingJobFactory( - job_factory_.Pass(), make_scoped_ptr(interceptor_))); + std::move(job_factory_), make_scoped_ptr(interceptor_))); } MockURLRequestInterceptor* interceptor() const { diff --git a/net/websockets/websocket_basic_handshake_stream.cc b/net/websockets/websocket_basic_handshake_stream.cc index 4a43ad3..92af20c 100644 --- a/net/websockets/websocket_basic_handshake_stream.cc +++ b/net/websockets/websocket_basic_handshake_stream.cc @@ -9,6 +9,7 @@ #include <iterator> #include <set> #include <string> +#include <utility> #include <vector> #include "base/base64.h" @@ -357,7 +358,7 @@ int WebSocketBasicHandshakeStream::SendRequest( scoped_ptr<WebSocketHandshakeRequestInfo> request( new WebSocketHandshakeRequestInfo(url_, base::Time::Now())); request->headers.CopyFrom(enriched_headers); - connect_delegate_->OnStartOpeningHandshake(request.Pass()); + connect_delegate_->OnStartOpeningHandshake(std::move(request)); return parser()->SendRequest( state_.GenerateRequestLine(), enriched_headers, response, callback); @@ -481,11 +482,11 @@ scoped_ptr<WebSocketStream> WebSocketBasicHandshakeStream::Upgrade() { WebSocketDeflater::NUM_CONTEXT_TAKEOVER_MODE_TYPES); return scoped_ptr<WebSocketStream>(new WebSocketDeflateStream( - basic_stream.Pass(), extension_params_->deflate_parameters, + std::move(basic_stream), extension_params_->deflate_parameters, scoped_ptr<WebSocketDeflatePredictor>( new WebSocketDeflatePredictorImpl))); } else { - return basic_stream.Pass(); + return basic_stream; } } diff --git a/net/websockets/websocket_basic_stream.cc b/net/websockets/websocket_basic_stream.cc index 29fe581..c54ef71 100644 --- a/net/websockets/websocket_basic_stream.cc +++ b/net/websockets/websocket_basic_stream.cc @@ -72,7 +72,7 @@ WebSocketBasicStream::WebSocketBasicStream( const std::string& sub_protocol, const std::string& extensions) : read_buffer_(new IOBufferWithSize(kReadBufferSize)), - connection_(connection.Pass()), + connection_(std::move(connection)), http_read_buffer_(http_read_buffer), sub_protocol_(sub_protocol), extensions_(extensions), @@ -192,9 +192,9 @@ WebSocketBasicStream::CreateWebSocketBasicStreamForTesting( const std::string& extensions, WebSocketMaskingKeyGeneratorFunction key_generator_function) { scoped_ptr<WebSocketBasicStream> stream(new WebSocketBasicStream( - connection.Pass(), http_read_buffer, sub_protocol, extensions)); + std::move(connection), http_read_buffer, sub_protocol, extensions)); stream->generate_websocket_masking_key_ = key_generator_function; - return stream.Pass(); + return stream; } int WebSocketBasicStream::WriteEverything( @@ -262,7 +262,7 @@ int WebSocketBasicStream::ConvertChunksToFrames( if (result != OK) return result; if (frame) - frames->push_back(frame.Pass()); + frames->push_back(std::move(frame)); } frame_chunks->clear(); if (frames->empty()) @@ -390,7 +390,7 @@ scoped_ptr<WebSocketFrame> WebSocketBasicStream::CreateFrame( // belong to it. if (is_final_chunk) current_frame_header_.reset(); - return result_frame.Pass(); + return result_frame; } void WebSocketBasicStream::AddToIncompleteControlFrameBody( diff --git a/net/websockets/websocket_basic_stream_test.cc b/net/websockets/websocket_basic_stream_test.cc index 81be165..d7796d3 100644 --- a/net/websockets/websocket_basic_stream_test.cc +++ b/net/websockets/websocket_basic_stream_test.cc @@ -11,8 +11,8 @@ #include <stddef.h> #include <stdint.h> #include <string.h> // for memcpy() and memset(). - #include <string> +#include <utility> #include <vector> #include "base/big_endian.h" @@ -134,7 +134,7 @@ class WebSocketBasicStreamSocketTest : public WebSocketBasicStreamTest { CompletionCallback(), &pool_, bound_net_log_.bound()); - return transport_socket.Pass(); + return transport_socket; } void SetHttpReadBuffer(const char* data, size_t size) { @@ -255,7 +255,7 @@ class WebSocketBasicStreamSocketWriteTest header.final = true; header.masked = true; header.payload_length = payload_size; - frames_.push_back(frame.Pass()); + frames_.push_back(std::move(frame)); } // Creates a stream that expects the listed writes. @@ -898,7 +898,7 @@ TEST_F(WebSocketBasicStreamSocketWriteTest, WriteNullPong) { header.masked = true; header.payload_length = 0; std::vector<scoped_ptr<WebSocketFrame>> frames; - frames.push_back(frame.Pass()); + frames.push_back(std::move(frame)); EXPECT_EQ(OK, stream_->WriteFrames(&frames, cb_.callback())); } @@ -922,7 +922,7 @@ TEST_F(WebSocketBasicStreamSocketTest, WriteNonNulMask) { header.final = true; header.masked = true; header.payload_length = payload_size; - frames_.push_back(frame.Pass()); + frames_.push_back(std::move(frame)); EXPECT_EQ(OK, stream_->WriteFrames(&frames_, cb_.callback())); } diff --git a/net/websockets/websocket_channel.cc b/net/websockets/websocket_channel.cc index 0fb1787..f977ee2 100644 --- a/net/websockets/websocket_channel.cc +++ b/net/websockets/websocket_channel.cc @@ -153,7 +153,7 @@ class WebSocketChannel::SendBuffer { void WebSocketChannel::SendBuffer::AddFrame(scoped_ptr<WebSocketFrame> frame) { total_bytes_ += frame->header.payload_length; - frames_.push_back(frame.Pass()); + frames_.push_back(std::move(frame)); } // Implementation of WebSocketStream::ConnectDelegate that simply forwards the @@ -164,7 +164,7 @@ class WebSocketChannel::ConnectDelegate explicit ConnectDelegate(WebSocketChannel* creator) : creator_(creator) {} void OnSuccess(scoped_ptr<WebSocketStream> stream) override { - creator_->OnConnectSuccess(stream.Pass()); + creator_->OnConnectSuccess(std::move(stream)); // |this| may have been deleted. } @@ -175,12 +175,12 @@ class WebSocketChannel::ConnectDelegate void OnStartOpeningHandshake( scoped_ptr<WebSocketHandshakeRequestInfo> request) override { - creator_->OnStartOpeningHandshake(request.Pass()); + creator_->OnStartOpeningHandshake(std::move(request)); } void OnFinishOpeningHandshake( scoped_ptr<WebSocketHandshakeResponseInfo> response) override { - creator_->OnFinishOpeningHandshake(response.Pass()); + creator_->OnFinishOpeningHandshake(std::move(response)); } void OnSSLCertificateError( @@ -188,8 +188,8 @@ class WebSocketChannel::ConnectDelegate ssl_error_callbacks, const SSLInfo& ssl_info, bool fatal) override { - creator_->OnSSLCertificateError( - ssl_error_callbacks.Pass(), ssl_info, fatal); + creator_->OnSSLCertificateError(std::move(ssl_error_callbacks), ssl_info, + fatal); } private: @@ -218,7 +218,7 @@ class WebSocketChannel::HandshakeNotificationSender void set_handshake_request_info( scoped_ptr<WebSocketHandshakeRequestInfo> request_info) { - handshake_request_info_ = request_info.Pass(); + handshake_request_info_ = std::move(request_info); } const WebSocketHandshakeResponseInfo* handshake_response_info() const { @@ -227,7 +227,7 @@ class WebSocketChannel::HandshakeNotificationSender void set_handshake_response_info( scoped_ptr<WebSocketHandshakeResponseInfo> response_info) { - handshake_response_info_ = response_info.Pass(); + handshake_response_info_ = std::move(response_info); } private: @@ -255,14 +255,16 @@ ChannelState WebSocketChannel::HandshakeNotificationSender::SendImmediately( WebSocketEventInterface* event_interface) { if (handshake_request_info_.get()) { - if (CHANNEL_DELETED == event_interface->OnStartOpeningHandshake( - handshake_request_info_.Pass())) + if (CHANNEL_DELETED == + event_interface->OnStartOpeningHandshake( + std::move(handshake_request_info_))) return CHANNEL_DELETED; } if (handshake_response_info_.get()) { - if (CHANNEL_DELETED == event_interface->OnFinishOpeningHandshake( - handshake_response_info_.Pass())) + if (CHANNEL_DELETED == + event_interface->OnFinishOpeningHandshake( + std::move(handshake_response_info_))) return CHANNEL_DELETED; // TODO(yhirano): We can release |this| to save memory because @@ -300,14 +302,14 @@ void WebSocketChannel::PendingReceivedFrame::DidConsume(uint64_t bytes) { WebSocketChannel::WebSocketChannel( scoped_ptr<WebSocketEventInterface> event_interface, URLRequestContext* url_request_context) - : event_interface_(event_interface.Pass()), + : event_interface_(std::move(event_interface)), url_request_context_(url_request_context), send_quota_low_water_mark_(kDefaultSendQuotaLowWaterMark), send_quota_high_water_mark_(kDefaultSendQuotaHighWaterMark), current_send_quota_(0), current_receive_quota_(0), - closing_handshake_timeout_(base::TimeDelta::FromSeconds( - kClosingHandshakeTimeoutSeconds)), + closing_handshake_timeout_( + base::TimeDelta::FromSeconds(kClosingHandshakeTimeoutSeconds)), underlying_connection_close_timeout_(base::TimeDelta::FromSeconds( kUnderlyingConnectionCloseTimeoutSeconds)), has_received_close_frame_(false), @@ -559,12 +561,9 @@ void WebSocketChannel::SendAddChannelRequestWithSuppliedCreator( socket_url_ = socket_url; scoped_ptr<WebSocketStream::ConnectDelegate> connect_delegate( new ConnectDelegate(this)); - stream_request_ = creator.Run(socket_url_, - requested_subprotocols, - origin, - url_request_context_, - BoundNetLog(), - connect_delegate.Pass()); + stream_request_ = creator.Run(socket_url_, requested_subprotocols, origin, + url_request_context_, BoundNetLog(), + std::move(connect_delegate)); SetState(CONNECTING); } @@ -572,7 +571,7 @@ void WebSocketChannel::OnConnectSuccess(scoped_ptr<WebSocketStream> stream) { DCHECK(stream); DCHECK_EQ(CONNECTING, state_); - stream_ = stream.Pass(); + stream_ = std::move(stream); SetState(CONNECTED); @@ -619,7 +618,7 @@ void WebSocketChannel::OnSSLCertificateError( const SSLInfo& ssl_info, bool fatal) { ignore_result(event_interface_->OnSSLCertificateError( - ssl_error_callbacks.Pass(), socket_url_, ssl_info, fatal)); + std::move(ssl_error_callbacks), socket_url_, ssl_info, fatal)); } void WebSocketChannel::OnStartOpeningHandshake( @@ -628,7 +627,7 @@ void WebSocketChannel::OnStartOpeningHandshake( // Because it is hard to handle an IPC error synchronously is difficult, // we asynchronously notify the information. - notification_sender_->set_handshake_request_info(request.Pass()); + notification_sender_->set_handshake_request_info(std::move(request)); ScheduleOpeningHandshakeNotification(); } @@ -638,7 +637,7 @@ void WebSocketChannel::OnFinishOpeningHandshake( // Because it is hard to handle an IPC error synchronously is difficult, // we asynchronously notify the information. - notification_sender_->set_handshake_response_info(response.Pass()); + notification_sender_->set_handshake_response_info(std::move(response)); ScheduleOpeningHandshakeNotification(); } @@ -676,7 +675,7 @@ ChannelState WebSocketChannel::OnWriteDone(bool synchronous, int result) { switch (result) { case OK: if (data_to_send_next_) { - data_being_sent_ = data_to_send_next_.Pass(); + data_being_sent_ = std::move(data_to_send_next_); if (!synchronous) return WriteFrames(); } else { @@ -1018,12 +1017,12 @@ ChannelState WebSocketChannel::SendFrameFromIOBuffer( // quota appropriately. if (!data_to_send_next_) data_to_send_next_.reset(new SendBuffer); - data_to_send_next_->AddFrame(frame.Pass()); + data_to_send_next_->AddFrame(std::move(frame)); return CHANNEL_ALIVE; } data_being_sent_.reset(new SendBuffer); - data_being_sent_->AddFrame(frame.Pass()); + data_being_sent_->AddFrame(std::move(frame)); return WriteFrames(); } diff --git a/net/websockets/websocket_channel_test.cc b/net/websockets/websocket_channel_test.cc index 90d26df..5413444 100644 --- a/net/websockets/websocket_channel_test.cc +++ b/net/websockets/websocket_channel_test.cc @@ -338,7 +338,7 @@ std::vector<scoped_ptr<WebSocketFrame>> CreateFrameVector( result_frame->data = new IOBuffer(frame_length); memcpy(result_frame->data->data(), source_frame.data, frame_length); } - result_frames.push_back(result_frame.Pass()); + result_frames.push_back(std::move(result_frame)); } return result_frames; } @@ -702,7 +702,7 @@ struct ArgumentCopyingWebSocketStreamCreator { this->origin = origin; this->url_request_context = url_request_context; this->net_log = net_log; - this->connect_delegate = connect_delegate.Pass(); + this->connect_delegate = std::move(connect_delegate); return make_scoped_ptr(new WebSocketStreamRequest); } @@ -753,7 +753,7 @@ class WebSocketChannelTest : public ::testing::Test { // Most tests aren't concerned with flow control from the renderer, so allow // MAX_INT quota units. channel_->SendFlowControl(kPlentyOfQuota); - connect_data_.creator.connect_delegate->OnSuccess(stream_.Pass()); + connect_data_.creator.connect_delegate->OnSuccess(std::move(stream_)); } // Returns a WebSocketEventInterface to be passed to the WebSocketChannel. @@ -768,7 +768,7 @@ class WebSocketChannelTest : public ::testing::Test { // will have unpleasant compile errors. template <class T> void set_stream(scoped_ptr<T> stream) { - stream_ = stream.Pass(); + stream_ = std::move(stream); } // A struct containing the data that will be used to connect the channel. @@ -945,7 +945,7 @@ class WebSocketChannelStreamTest : public WebSocketChannelTest { : mock_stream_(new StrictMock<MockWebSocketStream>) {} void CreateChannelAndConnectSuccessfully() override { - set_stream(mock_stream_.Pass()); + set_stream(std::move(mock_stream_)); WebSocketChannelTest::CreateChannelAndConnectSuccessfully(); } @@ -977,7 +977,7 @@ class WebSocketChannelFlowControlTest void CreateChannelAndConnectWithQuota(int64_t quota) { CreateChannelAndConnect(); channel_->SendFlowControl(quota); - connect_data_.creator.connect_delegate->OnSuccess(stream_.Pass()); + connect_data_.creator.connect_delegate->OnSuccess(std::move(stream_)); } virtual void CreateChannelAndConnectSuccesfully() { NOTREACHED(); } @@ -1046,7 +1046,7 @@ TEST_F(WebSocketChannelDeletingTest, OnDataFrameSync) { static const InitFrame frames[] = { {FINAL_FRAME, WebSocketFrameHeader::kOpCodeText, NOT_MASKED, "HELLO"}}; stream->PrepareReadFrames(ReadableFakeWebSocketStream::SYNC, OK, frames); - set_stream(stream.Pass()); + set_stream(std::move(stream)); deleting_ = EVENT_ON_DATA_FRAME; CreateChannelAndConnectSuccessfully(); @@ -1059,7 +1059,7 @@ TEST_F(WebSocketChannelDeletingTest, OnDataFrameAsync) { static const InitFrame frames[] = { {FINAL_FRAME, WebSocketFrameHeader::kOpCodeText, NOT_MASKED, "HELLO"}}; stream->PrepareReadFrames(ReadableFakeWebSocketStream::ASYNC, OK, frames); - set_stream(stream.Pass()); + set_stream(std::move(stream)); deleting_ = EVENT_ON_DATA_FRAME; CreateChannelAndConnectSuccessfully(); @@ -1095,7 +1095,7 @@ TEST_F(WebSocketChannelDeletingTest, OnClosingHandshakeSync) { {FINAL_FRAME, WebSocketFrameHeader::kOpCodeClose, NOT_MASKED, CLOSE_DATA(NORMAL_CLOSURE, "Success")}}; stream->PrepareReadFrames(ReadableFakeWebSocketStream::SYNC, OK, frames); - set_stream(stream.Pass()); + set_stream(std::move(stream)); deleting_ = EVENT_ON_CLOSING_HANDSHAKE; CreateChannelAndConnectSuccessfully(); EXPECT_EQ(NULL, channel_.get()); @@ -1108,7 +1108,7 @@ TEST_F(WebSocketChannelDeletingTest, OnClosingHandshakeAsync) { {FINAL_FRAME, WebSocketFrameHeader::kOpCodeClose, NOT_MASKED, CLOSE_DATA(NORMAL_CLOSURE, "Success")}}; stream->PrepareReadFrames(ReadableFakeWebSocketStream::ASYNC, OK, frames); - set_stream(stream.Pass()); + set_stream(std::move(stream)); deleting_ = EVENT_ON_CLOSING_HANDSHAKE; CreateChannelAndConnectSuccessfully(); ASSERT_TRUE(channel_); @@ -1131,7 +1131,7 @@ TEST_F(WebSocketChannelDeletingTest, OnDropChannelReadError) { new ReadableFakeWebSocketStream); stream->PrepareReadFramesError(ReadableFakeWebSocketStream::ASYNC, ERR_FAILED); - set_stream(stream.Pass()); + set_stream(std::move(stream)); deleting_ = EVENT_ON_DROP_CHANNEL; CreateChannelAndConnectSuccessfully(); ASSERT_TRUE(channel_); @@ -1145,7 +1145,7 @@ TEST_F(WebSocketChannelDeletingTest, OnNotifyStartOpeningHandshakeError) { static const InitFrame frames[] = { {FINAL_FRAME, WebSocketFrameHeader::kOpCodeText, NOT_MASKED, "HELLO"}}; stream->PrepareReadFrames(ReadableFakeWebSocketStream::ASYNC, OK, frames); - set_stream(stream.Pass()); + set_stream(std::move(stream)); deleting_ = EVENT_ON_START_OPENING_HANDSHAKE; CreateChannelAndConnectSuccessfully(); @@ -1163,7 +1163,7 @@ TEST_F(WebSocketChannelDeletingTest, OnNotifyFinishOpeningHandshakeError) { static const InitFrame frames[] = { {FINAL_FRAME, WebSocketFrameHeader::kOpCodeText, NOT_MASKED, "HELLO"}}; stream->PrepareReadFrames(ReadableFakeWebSocketStream::ASYNC, OK, frames); - set_stream(stream.Pass()); + set_stream(std::move(stream)); deleting_ = EVENT_ON_FINISH_OPENING_HANDSHAKE; CreateChannelAndConnectSuccessfully(); @@ -1196,7 +1196,7 @@ TEST_F(WebSocketChannelDeletingTest, FailChannelInOnReadDone) { new ReadableFakeWebSocketStream); stream->PrepareReadFramesError(ReadableFakeWebSocketStream::ASYNC, ERR_WS_PROTOCOL_ERROR); - set_stream(stream.Pass()); + set_stream(std::move(stream)); deleting_ = EVENT_ON_FAIL_CHANNEL; CreateChannelAndConnectSuccessfully(); ASSERT_TRUE(channel_); @@ -1210,7 +1210,7 @@ TEST_F(WebSocketChannelDeletingTest, FailChannelDueToMaskedFrame) { static const InitFrame frames[] = { {FINAL_FRAME, WebSocketFrameHeader::kOpCodeText, MASKED, "HELLO"}}; stream->PrepareReadFrames(ReadableFakeWebSocketStream::SYNC, OK, frames); - set_stream(stream.Pass()); + set_stream(std::move(stream)); deleting_ = EVENT_ON_FAIL_CHANNEL; CreateChannelAndConnectSuccessfully(); @@ -1223,7 +1223,7 @@ TEST_F(WebSocketChannelDeletingTest, FailChannelDueToBadControlFrame) { static const InitFrame frames[] = { {FINAL_FRAME, 0xF, NOT_MASKED, ""}}; stream->PrepareReadFrames(ReadableFakeWebSocketStream::SYNC, OK, frames); - set_stream(stream.Pass()); + set_stream(std::move(stream)); deleting_ = EVENT_ON_FAIL_CHANNEL; CreateChannelAndConnectSuccessfully(); @@ -1237,7 +1237,7 @@ TEST_F(WebSocketChannelDeletingTest, FailChannelDueToBadControlFrameNull) { static const InitFrame frames[] = { {FINAL_FRAME, 0xF, NOT_MASKED, NULL}}; stream->PrepareReadFrames(ReadableFakeWebSocketStream::SYNC, OK, frames); - set_stream(stream.Pass()); + set_stream(std::move(stream)); deleting_ = EVENT_ON_FAIL_CHANNEL; CreateChannelAndConnectSuccessfully(); @@ -1252,7 +1252,7 @@ TEST_F(WebSocketChannelDeletingTest, FailChannelDueToPongAfterClose) { CLOSE_DATA(NORMAL_CLOSURE, "Success")}, {FINAL_FRAME, WebSocketFrameHeader::kOpCodePong, NOT_MASKED, ""}}; stream->PrepareReadFrames(ReadableFakeWebSocketStream::SYNC, OK, frames); - set_stream(stream.Pass()); + set_stream(std::move(stream)); deleting_ = EVENT_ON_FAIL_CHANNEL; CreateChannelAndConnectSuccessfully(); @@ -1267,7 +1267,7 @@ TEST_F(WebSocketChannelDeletingTest, FailChannelDueToPongAfterCloseNull) { CLOSE_DATA(NORMAL_CLOSURE, "Success")}, {FINAL_FRAME, WebSocketFrameHeader::kOpCodePong, NOT_MASKED, NULL}}; stream->PrepareReadFrames(ReadableFakeWebSocketStream::SYNC, OK, frames); - set_stream(stream.Pass()); + set_stream(std::move(stream)); deleting_ = EVENT_ON_FAIL_CHANNEL; CreateChannelAndConnectSuccessfully(); @@ -1279,7 +1279,7 @@ TEST_F(WebSocketChannelDeletingTest, FailChannelDueToUnknownOpCode) { new ReadableFakeWebSocketStream); static const InitFrame frames[] = {{FINAL_FRAME, 0x7, NOT_MASKED, ""}}; stream->PrepareReadFrames(ReadableFakeWebSocketStream::SYNC, OK, frames); - set_stream(stream.Pass()); + set_stream(std::move(stream)); deleting_ = EVENT_ON_FAIL_CHANNEL; CreateChannelAndConnectSuccessfully(); @@ -1291,7 +1291,7 @@ TEST_F(WebSocketChannelDeletingTest, FailChannelDueToUnknownOpCodeNull) { new ReadableFakeWebSocketStream); static const InitFrame frames[] = {{FINAL_FRAME, 0x7, NOT_MASKED, NULL}}; stream->PrepareReadFrames(ReadableFakeWebSocketStream::SYNC, OK, frames); - set_stream(stream.Pass()); + set_stream(std::move(stream)); deleting_ = EVENT_ON_FAIL_CHANNEL; CreateChannelAndConnectSuccessfully(); @@ -1305,7 +1305,7 @@ TEST_F(WebSocketChannelDeletingTest, FailChannelDueInvalidCloseReason) { {FINAL_FRAME, WebSocketFrameHeader::kOpCodeClose, NOT_MASKED, CLOSE_DATA(NORMAL_CLOSURE, "\xFF")}}; stream->PrepareReadFrames(ReadableFakeWebSocketStream::SYNC, OK, frames); - set_stream(stream.Pass()); + set_stream(std::move(stream)); deleting_ = EVENT_ON_FAIL_CHANNEL; CreateChannelAndConnectSuccessfully(); @@ -1321,7 +1321,7 @@ TEST_F(WebSocketChannelEventInterfaceTest, ConnectSuccessReported) { CreateChannelAndConnect(); - connect_data_.creator.connect_delegate->OnSuccess(stream_.Pass()); + connect_data_.creator.connect_delegate->OnSuccess(std::move(stream_)); } TEST_F(WebSocketChannelEventInterfaceTest, ConnectFailureReported) { @@ -1368,7 +1368,7 @@ TEST_F(WebSocketChannelEventInterfaceTest, DataLeftFromHandshake) { static const InitFrame frames[] = { {FINAL_FRAME, WebSocketFrameHeader::kOpCodeText, NOT_MASKED, "HELLO"}}; stream->PrepareReadFrames(ReadableFakeWebSocketStream::SYNC, OK, frames); - set_stream(stream.Pass()); + set_stream(std::move(stream)); { InSequence s; EXPECT_CALL(*event_interface_, OnAddChannelResponse(_, _)); @@ -1393,7 +1393,7 @@ TEST_F(WebSocketChannelEventInterfaceTest, CloseAfterHandshake) { stream->PrepareReadFrames(ReadableFakeWebSocketStream::SYNC, OK, frames); stream->PrepareReadFramesError(ReadableFakeWebSocketStream::SYNC, ERR_CONNECTION_CLOSED); - set_stream(stream.Pass()); + set_stream(std::move(stream)); { InSequence s; EXPECT_CALL(*event_interface_, OnAddChannelResponse(_, _)); @@ -1415,7 +1415,7 @@ TEST_F(WebSocketChannelEventInterfaceTest, ConnectionCloseAfterHandshake) { new ReadableFakeWebSocketStream); stream->PrepareReadFramesError(ReadableFakeWebSocketStream::SYNC, ERR_CONNECTION_CLOSED); - set_stream(stream.Pass()); + set_stream(std::move(stream)); { InSequence s; EXPECT_CALL(*event_interface_, OnAddChannelResponse(_, _)); @@ -1436,7 +1436,7 @@ TEST_F(WebSocketChannelEventInterfaceTest, NormalAsyncRead) { // until we expect it to be. Checkpoint checkpoint; stream->PrepareReadFrames(ReadableFakeWebSocketStream::ASYNC, OK, frames); - set_stream(stream.Pass()); + set_stream(std::move(stream)); { InSequence s; EXPECT_CALL(*event_interface_, OnAddChannelResponse(_, _)); @@ -1466,7 +1466,7 @@ TEST_F(WebSocketChannelEventInterfaceTest, AsyncThenSyncRead) { {FINAL_FRAME, WebSocketFrameHeader::kOpCodeText, NOT_MASKED, "WORLD"}}; stream->PrepareReadFrames(ReadableFakeWebSocketStream::ASYNC, OK, frames1); stream->PrepareReadFrames(ReadableFakeWebSocketStream::SYNC, OK, frames2); - set_stream(stream.Pass()); + set_stream(std::move(stream)); { InSequence s; EXPECT_CALL(*event_interface_, OnAddChannelResponse(_, _)); @@ -1508,7 +1508,7 @@ TEST_F(WebSocketChannelEventInterfaceTest, FragmentedMessage) { stream->PrepareReadFrames(ReadableFakeWebSocketStream::ASYNC, OK, frames1); stream->PrepareReadFrames(ReadableFakeWebSocketStream::ASYNC, OK, frames2); stream->PrepareReadFrames(ReadableFakeWebSocketStream::ASYNC, OK, frames3); - set_stream(stream.Pass()); + set_stream(std::move(stream)); { InSequence s; EXPECT_CALL(*event_interface_, OnAddChannelResponse(_, _)); @@ -1546,7 +1546,7 @@ TEST_F(WebSocketChannelEventInterfaceTest, NullMessage) { static const InitFrame frames[] = { {FINAL_FRAME, WebSocketFrameHeader::kOpCodeText, NOT_MASKED, NULL}}; stream->PrepareReadFrames(ReadableFakeWebSocketStream::SYNC, OK, frames); - set_stream(stream.Pass()); + set_stream(std::move(stream)); EXPECT_CALL(*event_interface_, OnAddChannelResponse(_, _)); EXPECT_CALL(*event_interface_, OnFlowControl(_)); EXPECT_CALL( @@ -1561,7 +1561,7 @@ TEST_F(WebSocketChannelEventInterfaceTest, AsyncAbnormalClosure) { new ReadableFakeWebSocketStream); stream->PrepareReadFramesError(ReadableFakeWebSocketStream::ASYNC, ERR_CONNECTION_CLOSED); - set_stream(stream.Pass()); + set_stream(std::move(stream)); { InSequence s; EXPECT_CALL(*event_interface_, OnAddChannelResponse(_, _)); @@ -1580,7 +1580,7 @@ TEST_F(WebSocketChannelEventInterfaceTest, ConnectionReset) { new ReadableFakeWebSocketStream); stream->PrepareReadFramesError(ReadableFakeWebSocketStream::ASYNC, ERR_CONNECTION_RESET); - set_stream(stream.Pass()); + set_stream(std::move(stream)); { InSequence s; EXPECT_CALL(*event_interface_, OnAddChannelResponse(_, _)); @@ -1601,7 +1601,7 @@ TEST_F(WebSocketChannelEventInterfaceTest, MaskedFramesAreRejected) { {FINAL_FRAME, WebSocketFrameHeader::kOpCodeText, MASKED, "HELLO"}}; stream->PrepareReadFrames(ReadableFakeWebSocketStream::ASYNC, OK, frames); - set_stream(stream.Pass()); + set_stream(std::move(stream)); { InSequence s; EXPECT_CALL(*event_interface_, OnAddChannelResponse(_, _)); @@ -1624,7 +1624,7 @@ TEST_F(WebSocketChannelEventInterfaceTest, UnknownOpCodeIsRejected) { static const InitFrame frames[] = {{FINAL_FRAME, 4, NOT_MASKED, "HELLO"}}; stream->PrepareReadFrames(ReadableFakeWebSocketStream::ASYNC, OK, frames); - set_stream(stream.Pass()); + set_stream(std::move(stream)); { InSequence s; EXPECT_CALL(*event_interface_, OnAddChannelResponse(_, _)); @@ -1655,7 +1655,7 @@ TEST_F(WebSocketChannelEventInterfaceTest, ControlFrameInDataMessage) { stream->PrepareReadFrames(ReadableFakeWebSocketStream::ASYNC, OK, frames1); stream->PrepareReadFrames(ReadableFakeWebSocketStream::ASYNC, OK, frames2); stream->PrepareReadFrames(ReadableFakeWebSocketStream::ASYNC, OK, frames3); - set_stream(stream.Pass()); + set_stream(std::move(stream)); { InSequence s; EXPECT_CALL(*event_interface_, OnAddChannelResponse(_, _)); @@ -1682,7 +1682,7 @@ TEST_F(WebSocketChannelEventInterfaceTest, PongWithNullData) { static const InitFrame frames[] = { {FINAL_FRAME, WebSocketFrameHeader::kOpCodePong, NOT_MASKED, NULL}}; stream->PrepareReadFrames(ReadableFakeWebSocketStream::ASYNC, OK, frames); - set_stream(stream.Pass()); + set_stream(std::move(stream)); EXPECT_CALL(*event_interface_, OnAddChannelResponse(_, _)); EXPECT_CALL(*event_interface_, OnFlowControl(_)); @@ -1700,7 +1700,7 @@ TEST_F(WebSocketChannelEventInterfaceTest, FrameAfterInvalidFrame) { {FINAL_FRAME, WebSocketFrameHeader::kOpCodeText, NOT_MASKED, " WORLD"}}; stream->PrepareReadFrames(ReadableFakeWebSocketStream::ASYNC, OK, frames); - set_stream(stream.Pass()); + set_stream(std::move(stream)); { InSequence s; EXPECT_CALL(*event_interface_, OnAddChannelResponse(_, _)); @@ -1875,7 +1875,7 @@ TEST_F(WebSocketChannelEventInterfaceTest, CloseWithNoPayloadGivesStatus1005) { stream->PrepareReadFrames(ReadableFakeWebSocketStream::SYNC, OK, frames); stream->PrepareReadFramesError(ReadableFakeWebSocketStream::SYNC, ERR_CONNECTION_CLOSED); - set_stream(stream.Pass()); + set_stream(std::move(stream)); EXPECT_CALL(*event_interface_, OnAddChannelResponse(_, _)); EXPECT_CALL(*event_interface_, OnFlowControl(_)); EXPECT_CALL(*event_interface_, OnClosingHandshake()); @@ -1895,7 +1895,7 @@ TEST_F(WebSocketChannelEventInterfaceTest, stream->PrepareReadFrames(ReadableFakeWebSocketStream::SYNC, OK, frames); stream->PrepareReadFramesError(ReadableFakeWebSocketStream::SYNC, ERR_CONNECTION_CLOSED); - set_stream(stream.Pass()); + set_stream(std::move(stream)); EXPECT_CALL(*event_interface_, OnAddChannelResponse(_, _)); EXPECT_CALL(*event_interface_, OnFlowControl(_)); EXPECT_CALL(*event_interface_, OnClosingHandshake()); @@ -1912,7 +1912,7 @@ TEST_F(WebSocketChannelEventInterfaceTest, SyncProtocolErrorGivesStatus1002) { new ReadableFakeWebSocketStream); stream->PrepareReadFramesError(ReadableFakeWebSocketStream::SYNC, ERR_WS_PROTOCOL_ERROR); - set_stream(stream.Pass()); + set_stream(std::move(stream)); EXPECT_CALL(*event_interface_, OnAddChannelResponse(_, _)); EXPECT_CALL(*event_interface_, OnFlowControl(_)); @@ -1927,7 +1927,7 @@ TEST_F(WebSocketChannelEventInterfaceTest, AsyncProtocolErrorGivesStatus1002) { new ReadableFakeWebSocketStream); stream->PrepareReadFramesError(ReadableFakeWebSocketStream::ASYNC, ERR_WS_PROTOCOL_ERROR); - set_stream(stream.Pass()); + set_stream(std::move(stream)); EXPECT_CALL(*event_interface_, OnAddChannelResponse(_, _)); EXPECT_CALL(*event_interface_, OnFlowControl(_)); @@ -1951,7 +1951,7 @@ TEST_F(WebSocketChannelEventInterfaceTest, StartHandshakeRequest) { new WebSocketHandshakeRequestInfo(GURL("ws://www.example.com/"), base::Time())); connect_data_.creator.connect_delegate->OnStartOpeningHandshake( - request_info.Pass()); + std::move(request_info)); base::MessageLoop::current()->RunUntilIdle(); } @@ -1975,7 +1975,7 @@ TEST_F(WebSocketChannelEventInterfaceTest, FinishHandshakeRequest) { response_headers, base::Time())); connect_data_.creator.connect_delegate->OnFinishOpeningHandshake( - response_info.Pass()); + std::move(response_info)); base::MessageLoop::current()->RunUntilIdle(); } @@ -2002,8 +2002,8 @@ TEST_F(WebSocketChannelEventInterfaceTest, FailJustAfterHandshake) { "OK", response_headers, base::Time())); - connect_delegate->OnStartOpeningHandshake(request_info.Pass()); - connect_delegate->OnFinishOpeningHandshake(response_info.Pass()); + connect_delegate->OnStartOpeningHandshake(std::move(request_info)); + connect_delegate->OnFinishOpeningHandshake(std::move(response_info)); connect_delegate->OnFailure("bye"); base::MessageLoop::current()->RunUntilIdle(); @@ -2019,7 +2019,7 @@ TEST_F(WebSocketChannelEventInterfaceTest, DataAfterCloseIsRejected) { CLOSE_DATA(NORMAL_CLOSURE, "OK")}, {FINAL_FRAME, WebSocketFrameHeader::kOpCodeText, NOT_MASKED, "Payload"}}; stream->PrepareReadFrames(ReadableFakeWebSocketStream::SYNC, OK, frames); - set_stream(stream.Pass()); + set_stream(std::move(stream)); EXPECT_CALL(*event_interface_, OnAddChannelResponse(_, _)); EXPECT_CALL(*event_interface_, OnFlowControl(_)); @@ -2041,7 +2041,7 @@ TEST_F(WebSocketChannelEventInterfaceTest, OneByteClosePayloadMessage) { static const InitFrame frames[] = { {FINAL_FRAME, WebSocketFrameHeader::kOpCodeClose, NOT_MASKED, "\x03"}}; stream->PrepareReadFrames(ReadableFakeWebSocketStream::SYNC, OK, frames); - set_stream(stream.Pass()); + set_stream(std::move(stream)); EXPECT_CALL(*event_interface_, OnAddChannelResponse(_, _)); EXPECT_CALL(*event_interface_, OnFlowControl(_)); EXPECT_CALL( @@ -2061,7 +2061,7 @@ TEST_F(WebSocketChannelEventInterfaceTest, ClosePayloadReservedStatusMessage) { {FINAL_FRAME, WebSocketFrameHeader::kOpCodeClose, NOT_MASKED, CLOSE_DATA(ABNORMAL_CLOSURE, "Not valid on wire")}}; stream->PrepareReadFrames(ReadableFakeWebSocketStream::SYNC, OK, frames); - set_stream(stream.Pass()); + set_stream(std::move(stream)); EXPECT_CALL(*event_interface_, OnAddChannelResponse(_, _)); EXPECT_CALL(*event_interface_, OnFlowControl(_)); EXPECT_CALL( @@ -2081,7 +2081,7 @@ TEST_F(WebSocketChannelEventInterfaceTest, ClosePayloadInvalidReason) { {FINAL_FRAME, WebSocketFrameHeader::kOpCodeClose, NOT_MASKED, CLOSE_DATA(NORMAL_CLOSURE, "\xFF")}}; stream->PrepareReadFrames(ReadableFakeWebSocketStream::SYNC, OK, frames); - set_stream(stream.Pass()); + set_stream(std::move(stream)); EXPECT_CALL(*event_interface_, OnAddChannelResponse(_, _)); EXPECT_CALL(*event_interface_, OnFlowControl(_)); EXPECT_CALL( @@ -2107,7 +2107,7 @@ TEST_F(WebSocketChannelEventInterfaceTest, ReservedBitsMustNotBeSet) { raw_frames[0]->header.reserved1 = true; stream->PrepareRawReadFrames(ReadableFakeWebSocketStream::SYNC, OK, std::move(raw_frames)); - set_stream(stream.Pass()); + set_stream(std::move(stream)); EXPECT_CALL(*event_interface_, OnAddChannelResponse(_, _)); EXPECT_CALL(*event_interface_, OnFlowControl(_)); EXPECT_CALL(*event_interface_, @@ -2126,7 +2126,7 @@ TEST_F(WebSocketChannelEventInterfaceTest, new ReadableFakeWebSocketStream); stream->PrepareReadFramesError(ReadableFakeWebSocketStream::SYNC, ERR_IO_PENDING); - set_stream(stream.Pass()); + set_stream(std::move(stream)); EXPECT_CALL(*event_interface_, OnAddChannelResponse(_, _)); EXPECT_CALL(*event_interface_, OnFlowControl(_)); // This checkpoint object verifies that the OnDropChannel message comes after @@ -2163,7 +2163,7 @@ TEST_F(WebSocketChannelEventInterfaceTest, {FINAL_FRAME, WebSocketFrameHeader::kOpCodeClose, NOT_MASKED, CLOSE_DATA(NORMAL_CLOSURE, "OK")}}; stream->PrepareReadFrames(ReadableFakeWebSocketStream::ASYNC, OK, frames); - set_stream(stream.Pass()); + set_stream(std::move(stream)); EXPECT_CALL(*event_interface_, OnAddChannelResponse(_, _)); EXPECT_CALL(*event_interface_, OnFlowControl(_)); Checkpoint checkpoint; @@ -2199,11 +2199,11 @@ TEST_F(WebSocketChannelStreamTest, FlowControlEarly) { EXPECT_CALL(checkpoint, Call(2)); } - set_stream(mock_stream_.Pass()); + set_stream(std::move(mock_stream_)); CreateChannelAndConnect(); channel_->SendFlowControl(kPlentyOfQuota); checkpoint.Call(1); - connect_data_.creator.connect_delegate->OnSuccess(stream_.Pass()); + connect_data_.creator.connect_delegate->OnSuccess(std::move(stream_)); checkpoint.Call(2); } @@ -2224,9 +2224,9 @@ TEST_F(WebSocketChannelStreamTest, FlowControlLate) { EXPECT_CALL(checkpoint, Call(2)); } - set_stream(mock_stream_.Pass()); + set_stream(std::move(mock_stream_)); CreateChannelAndConnect(); - connect_data_.creator.connect_delegate->OnSuccess(stream_.Pass()); + connect_data_.creator.connect_delegate->OnSuccess(std::move(stream_)); checkpoint.Call(1); channel_->SendFlowControl(kPlentyOfQuota); checkpoint.Call(2); @@ -2242,10 +2242,10 @@ TEST_F(WebSocketChannelStreamTest, FlowControlStopsReadFrames) { EXPECT_CALL(*mock_stream_, ReadFrames(_, _)) .WillOnce(ReturnFrames(&frames)); - set_stream(mock_stream_.Pass()); + set_stream(std::move(mock_stream_)); CreateChannelAndConnect(); channel_->SendFlowControl(4); - connect_data_.creator.connect_delegate->OnSuccess(stream_.Pass()); + connect_data_.creator.connect_delegate->OnSuccess(std::move(stream_)); } // Providing extra quota causes ReadFrames() to be called again. @@ -2265,10 +2265,10 @@ TEST_F(WebSocketChannelStreamTest, FlowControlStartsWithMoreQuota) { .WillOnce(Return(ERR_IO_PENDING)); } - set_stream(mock_stream_.Pass()); + set_stream(std::move(mock_stream_)); CreateChannelAndConnect(); channel_->SendFlowControl(4); - connect_data_.creator.connect_delegate->OnSuccess(stream_.Pass()); + connect_data_.creator.connect_delegate->OnSuccess(std::move(stream_)); checkpoint.Call(1); channel_->SendFlowControl(4); } @@ -2292,10 +2292,10 @@ TEST_F(WebSocketChannelStreamTest, ReadFramesNotCalledUntilQuotaAvailable) { .WillOnce(Return(ERR_IO_PENDING)); } - set_stream(mock_stream_.Pass()); + set_stream(std::move(mock_stream_)); CreateChannelAndConnect(); channel_->SendFlowControl(2); - connect_data_.creator.connect_delegate->OnSuccess(stream_.Pass()); + connect_data_.creator.connect_delegate->OnSuccess(std::move(stream_)); checkpoint.Call(1); channel_->SendFlowControl(2); checkpoint.Call(2); @@ -2310,7 +2310,7 @@ TEST_F(WebSocketChannelFlowControlTest, SingleFrameMessageSplitSync) { static const InitFrame frames[] = { {FINAL_FRAME, WebSocketFrameHeader::kOpCodeText, NOT_MASKED, "FOUR"}}; stream->PrepareReadFrames(ReadableFakeWebSocketStream::SYNC, OK, frames); - set_stream(stream.Pass()); + set_stream(std::move(stream)); { InSequence s; EXPECT_CALL(*event_interface_, OnAddChannelResponse(_, _)); @@ -2341,7 +2341,7 @@ TEST_F(WebSocketChannelFlowControlTest, SingleFrameMessageSplitAsync) { static const InitFrame frames[] = { {FINAL_FRAME, WebSocketFrameHeader::kOpCodeText, NOT_MASKED, "FOUR"}}; stream->PrepareReadFrames(ReadableFakeWebSocketStream::ASYNC, OK, frames); - set_stream(stream.Pass()); + set_stream(std::move(stream)); Checkpoint checkpoint; { InSequence s; @@ -2388,7 +2388,7 @@ TEST_F(WebSocketChannelFlowControlTest, MultipleFrameSplit) { {FINAL_FRAME, WebSocketFrameHeader::kOpCodeContinuation, NOT_MASKED, "FINAL FRAME IS 24 BYTES."}}; stream->PrepareReadFrames(ReadableFakeWebSocketStream::SYNC, OK, frames); - set_stream(stream.Pass()); + set_stream(std::move(stream)); { InSequence s; EXPECT_CALL(*event_interface_, OnAddChannelResponse(_, _)); @@ -2432,7 +2432,7 @@ TEST_F(WebSocketChannelFlowControlTest, EmptyMessageNoQuota) { {FINAL_FRAME, WebSocketFrameHeader::kOpCodeText, NOT_MASKED, "THIRD MESSAGE"}}; stream->PrepareReadFrames(ReadableFakeWebSocketStream::SYNC, OK, frames); - set_stream(stream.Pass()); + set_stream(std::move(stream)); { InSequence s; EXPECT_CALL(*event_interface_, OnAddChannelResponse(_, _)); @@ -2862,12 +2862,12 @@ TEST_F(WebSocketChannelEventInterfaceTest, ReadBinaryFramesAre8BitClean) { frame->data = new IOBuffer(kBinaryBlobSize); memcpy(frame->data->data(), kBinaryBlob, kBinaryBlobSize); std::vector<scoped_ptr<WebSocketFrame>> frames; - frames.push_back(frame.Pass()); + frames.push_back(std::move(frame)); scoped_ptr<ReadableFakeWebSocketStream> stream( new ReadableFakeWebSocketStream); stream->PrepareRawReadFrames(ReadableFakeWebSocketStream::SYNC, OK, std::move(frames)); - set_stream(stream.Pass()); + set_stream(std::move(stream)); EXPECT_CALL(*event_interface_, OnAddChannelResponse(_, _)); EXPECT_CALL(*event_interface_, OnFlowControl(_)); EXPECT_CALL(*event_interface_, @@ -2983,7 +2983,7 @@ TEST_F(WebSocketChannelEventInterfaceTest, ReceivedInvalidUtf8) { static const InitFrame frames[] = { {FINAL_FRAME, WebSocketFrameHeader::kOpCodeText, NOT_MASKED, "\xff"}}; stream->PrepareReadFrames(ReadableFakeWebSocketStream::SYNC, OK, frames); - set_stream(stream.Pass()); + set_stream(std::move(stream)); EXPECT_CALL(*event_interface_, OnAddChannelResponse(_, _)); EXPECT_CALL(*event_interface_, OnFlowControl(kDefaultInitialQuota)); @@ -3175,7 +3175,7 @@ TEST_F(WebSocketChannelEventInterfaceTest, BogusContinuation) { {FINAL_FRAME, WebSocketFrameHeader::kOpCodeText, NOT_MASKED, "frame2"}}; stream->PrepareReadFrames(ReadableFakeWebSocketStream::SYNC, OK, frames); - set_stream(stream.Pass()); + set_stream(std::move(stream)); EXPECT_CALL(*event_interface_, OnAddChannelResponse(_, _)); EXPECT_CALL(*event_interface_, OnFlowControl(kDefaultInitialQuota)); @@ -3199,7 +3199,7 @@ TEST_F(WebSocketChannelEventInterfaceTest, MessageStartingWithContinuation) { {FINAL_FRAME, WebSocketFrameHeader::kOpCodeContinuation, NOT_MASKED, "continuation"}}; stream->PrepareReadFrames(ReadableFakeWebSocketStream::SYNC, OK, frames); - set_stream(stream.Pass()); + set_stream(std::move(stream)); EXPECT_CALL(*event_interface_, OnAddChannelResponse(_, _)); EXPECT_CALL(*event_interface_, OnFlowControl(kDefaultInitialQuota)); @@ -3220,7 +3220,7 @@ TEST_F(WebSocketChannelEventInterfaceTest, DataFramesNonEmptyOrFinal) { NOT_MASKED, ""}, {FINAL_FRAME, WebSocketFrameHeader::kOpCodeContinuation, NOT_MASKED, ""}}; stream->PrepareReadFrames(ReadableFakeWebSocketStream::SYNC, OK, frames); - set_stream(stream.Pass()); + set_stream(std::move(stream)); EXPECT_CALL(*event_interface_, OnAddChannelResponse(_, _)); EXPECT_CALL(*event_interface_, OnFlowControl(kDefaultInitialQuota)); @@ -3246,7 +3246,7 @@ TEST_F(WebSocketChannelEventInterfaceTest, OnSSLCertificateErrorCalled) { CreateChannelAndConnect(); connect_data_.creator.connect_delegate->OnSSLCertificateError( - fake_callbacks.Pass(), ssl_info, fatal); + std::move(fake_callbacks), ssl_info, fatal); } // If we receive another frame after Close, it is not valid. It is not @@ -3304,14 +3304,14 @@ class WebSocketChannelStreamTimeoutTest : public WebSocketChannelStreamTest { WebSocketChannelStreamTimeoutTest() {} void CreateChannelAndConnectSuccessfully() override { - set_stream(mock_stream_.Pass()); + set_stream(std::move(mock_stream_)); CreateChannelAndConnect(); channel_->SendFlowControl(kPlentyOfQuota); channel_->SetClosingHandshakeTimeoutForTesting( TimeDelta::FromMilliseconds(kVeryTinyTimeoutMillis)); channel_->SetUnderlyingConnectionCloseTimeoutForTesting( TimeDelta::FromMilliseconds(kVeryTinyTimeoutMillis)); - connect_data_.creator.connect_delegate->OnSuccess(stream_.Pass()); + connect_data_.creator.connect_delegate->OnSuccess(std::move(stream_)); } }; diff --git a/net/websockets/websocket_deflate_stream.cc b/net/websockets/websocket_deflate_stream.cc index 8eae497..798d9b7 100644 --- a/net/websockets/websocket_deflate_stream.cc +++ b/net/websockets/websocket_deflate_stream.cc @@ -40,14 +40,14 @@ WebSocketDeflateStream::WebSocketDeflateStream( scoped_ptr<WebSocketStream> stream, const WebSocketDeflateParameters& params, scoped_ptr<WebSocketDeflatePredictor> predictor) - : stream_(stream.Pass()), + : stream_(std::move(stream)), deflater_(params.client_context_take_over_mode()), inflater_(kChunkSize, kChunkSize), reading_state_(NOT_READING), writing_state_(NOT_WRITING), current_reading_opcode_(WebSocketFrameHeader::kOpCodeText), current_writing_opcode_(WebSocketFrameHeader::kOpCodeText), - predictor_(predictor.Pass()) { + predictor_(std::move(predictor)) { DCHECK(stream_); DCHECK(params.IsValidAsResponse()); int client_max_window_bits = 15; @@ -136,7 +136,7 @@ int WebSocketDeflateStream::Deflate( if (frame->header.final) writing_state_ = NOT_WRITING; predictor_->RecordWrittenDataFrame(frame.get()); - frames_to_write.push_back(frame.Pass()); + frames_to_write.push_back(std::move(frame)); current_writing_opcode_ = WebSocketFrameHeader::kOpCodeContinuation; } else { if (frame->data.get() && @@ -165,7 +165,7 @@ int WebSocketDeflateStream::Deflate( } else { DCHECK_EQ(WRITING_POSSIBLY_COMPRESSED_MESSAGE, writing_state_); bool final = frame->header.final; - frames_of_message.push_back(frame.Pass()); + frames_of_message.push_back(std::move(frame)); if (final) { int result = AppendPossiblyCompressedMessage(&frames_of_message, &frames_to_write); @@ -228,7 +228,7 @@ int WebSocketDeflateStream::AppendCompressedFrame( current_writing_opcode_ = WebSocketFrameHeader::kOpCodeContinuation; predictor_->RecordWrittenDataFrame(compressed.get()); - frames_to_write->push_back(compressed.Pass()); + frames_to_write->push_back(std::move(compressed)); return OK; } @@ -277,7 +277,7 @@ int WebSocketDeflateStream::AppendPossiblyCompressedMessage( compressed->header.payload_length = compressed_payload->size(); predictor_->RecordWrittenDataFrame(compressed.get()); - frames_to_write->push_back(compressed.Pass()); + frames_to_write->push_back(std::move(compressed)); return OK; } @@ -295,7 +295,7 @@ int WebSocketDeflateStream::Inflate( << " payload_length=" << frame->header.payload_length; if (!WebSocketFrameHeader::IsKnownDataOpCode(frame->header.opcode)) { - frames_to_output.push_back(frame.Pass()); + frames_to_output.push_back(std::move(frame)); continue; } @@ -317,7 +317,7 @@ int WebSocketDeflateStream::Inflate( if (frame->header.final) reading_state_ = NOT_READING; current_reading_opcode_ = WebSocketFrameHeader::kOpCodeContinuation; - frames_to_output.push_back(frame.Pass()); + frames_to_output.push_back(std::move(frame)); } else { DCHECK_EQ(reading_state_, READING_COMPRESSED_MESSAGE); if (frame->data.get() && @@ -361,7 +361,7 @@ int WebSocketDeflateStream::Inflate( << " final=" << inflated->header.final << " reserved1=" << inflated->header.reserved1 << " payload_length=" << inflated->header.payload_length; - frames_to_output.push_back(inflated.Pass()); + frames_to_output.push_back(std::move(inflated)); current_reading_opcode_ = WebSocketFrameHeader::kOpCodeContinuation; if (is_final) break; diff --git a/net/websockets/websocket_frame.cc b/net/websockets/websocket_frame.cc index 94d1389..da596d8 100644 --- a/net/websockets/websocket_frame.cc +++ b/net/websockets/websocket_frame.cc @@ -59,7 +59,7 @@ inline void MaskWebSocketFramePayloadByBytes( scoped_ptr<WebSocketFrameHeader> WebSocketFrameHeader::Clone() const { scoped_ptr<WebSocketFrameHeader> ret(new WebSocketFrameHeader(opcode)); ret->CopyFrom(*this); - return ret.Pass(); + return ret; } void WebSocketFrameHeader::CopyFrom(const WebSocketFrameHeader& source) { diff --git a/net/websockets/websocket_frame_parser.cc b/net/websockets/websocket_frame_parser.cc index 51581e9..7c2a075 100644 --- a/net/websockets/websocket_frame_parser.cc +++ b/net/websockets/websocket_frame_parser.cc @@ -6,6 +6,7 @@ #include <algorithm> #include <limits> +#include <utility> #include <vector> #include "base/big_endian.h" @@ -71,7 +72,7 @@ bool WebSocketFrameParser::Decode( scoped_ptr<WebSocketFrameChunk> frame_chunk = DecodeFramePayload(first_chunk); DCHECK(frame_chunk.get()); - frame_chunks->push_back(frame_chunk.Pass()); + frame_chunks->push_back(std::move(frame_chunk)); if (current_frame_header_.get()) { DCHECK(current_read_pos_ == buffer_.size()); @@ -203,7 +204,7 @@ scoped_ptr<WebSocketFrameChunk> WebSocketFrameParser::DecodeFramePayload( frame_offset_ = 0; } - return frame_chunk.Pass(); + return frame_chunk; } } // namespace net diff --git a/net/websockets/websocket_handshake_stream_create_helper.cc b/net/websockets/websocket_handshake_stream_create_helper.cc index 2bd59a12..e8985a1 100644 --- a/net/websockets/websocket_handshake_stream_create_helper.cc +++ b/net/websockets/websocket_handshake_stream_create_helper.cc @@ -4,6 +4,8 @@ #include "net/websockets/websocket_handshake_stream_create_helper.h" +#include <utility> + #include "base/logging.h" #include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" @@ -35,13 +37,9 @@ WebSocketHandshakeStreamCreateHelper::CreateBasicStream( // method. std::vector<std::string> extensions( 1, "permessage-deflate; client_max_window_bits"); - WebSocketBasicHandshakeStream* stream = - new WebSocketBasicHandshakeStream(connection.Pass(), - connect_delegate_, - using_proxy, - requested_subprotocols_, - extensions, - failure_message_); + WebSocketBasicHandshakeStream* stream = new WebSocketBasicHandshakeStream( + std::move(connection), connect_delegate_, using_proxy, + requested_subprotocols_, extensions, failure_message_); OnStreamCreated(stream); stream_ = stream; return stream; diff --git a/net/websockets/websocket_handshake_stream_create_helper_test.cc b/net/websockets/websocket_handshake_stream_create_helper_test.cc index de16ae1..ffdbfe2 100644 --- a/net/websockets/websocket_handshake_stream_create_helper_test.cc +++ b/net/websockets/websocket_handshake_stream_create_helper_test.cc @@ -5,6 +5,7 @@ #include "net/websockets/websocket_handshake_stream_create_helper.h" #include <string> +#include <utility> #include <vector> #include "base/macros.h" @@ -47,7 +48,7 @@ class MockClientSocketHandleFactory { CompletionCallback(), &pool_, BoundNetLog()); - return socket_handle.Pass(); + return socket_handle; } private: @@ -93,7 +94,7 @@ class WebSocketHandshakeStreamCreateHelperTest : public ::testing::Test { WebSocketStandardResponse(extra_response_headers)); scoped_ptr<WebSocketHandshakeStreamBase> handshake( - create_helper.CreateBasicStream(socket_handle.Pass(), false)); + create_helper.CreateBasicStream(std::move(socket_handle), false)); // If in future the implementation type returned by CreateBasicStream() // changes, this static_cast will be wrong. However, in that case the test diff --git a/net/websockets/websocket_stream.cc b/net/websockets/websocket_stream.cc index 1a72a93..6e6ae09 100644 --- a/net/websockets/websocket_stream.cc +++ b/net/websockets/websocket_stream.cc @@ -4,6 +4,8 @@ #include "net/websockets/websocket_stream.h" +#include <utility> + #include "base/logging.h" #include "base/memory/scoped_ptr.h" #include "base/metrics/histogram_macros.h" @@ -88,7 +90,7 @@ class StreamRequestImpl : public WebSocketStreamRequest { : delegate_(new Delegate(this)), url_request_( context->CreateRequest(url, DEFAULT_PRIORITY, delegate_.get())), - connect_delegate_(connect_delegate.Pass()), + connect_delegate_(std::move(connect_delegate)), create_helper_(create_helper.release()) { create_helper_->set_failure_message(&failure_message_); HttpRequestHeaders headers; @@ -114,7 +116,7 @@ class StreamRequestImpl : public WebSocketStreamRequest { DCHECK(timer); base::TimeDelta timeout(base::TimeDelta::FromSeconds( kHandshakeTimeoutIntervalInSeconds)); - timer_ = timer.Pass(); + timer_ = std::move(timer); timer_->Start(FROM_HERE, timeout, base::Bind(&StreamRequestImpl::OnTimeout, base::Unretained(this))); @@ -336,14 +338,11 @@ scoped_ptr<WebSocketStreamRequest> WebSocketStream::CreateAndConnectStream( scoped_ptr<WebSocketHandshakeStreamCreateHelper> create_helper( new WebSocketHandshakeStreamCreateHelper(connect_delegate.get(), requested_subprotocols)); - scoped_ptr<StreamRequestImpl> request( - new StreamRequestImpl(socket_url, - url_request_context, - origin, - connect_delegate.Pass(), - create_helper.Pass())); + scoped_ptr<StreamRequestImpl> request(new StreamRequestImpl( + socket_url, url_request_context, origin, std::move(connect_delegate), + std::move(create_helper))); request->Start(scoped_ptr<base::Timer>(new base::Timer(false, false))); - return request.Pass(); + return std::move(request); } // This is declared in websocket_test_util.h. @@ -355,14 +354,11 @@ scoped_ptr<WebSocketStreamRequest> CreateAndConnectStreamForTesting( const BoundNetLog& net_log, scoped_ptr<WebSocketStream::ConnectDelegate> connect_delegate, scoped_ptr<base::Timer> timer) { - scoped_ptr<StreamRequestImpl> request( - new StreamRequestImpl(socket_url, - url_request_context, - origin, - connect_delegate.Pass(), - create_helper.Pass())); - request->Start(timer.Pass()); - return request.Pass(); + scoped_ptr<StreamRequestImpl> request(new StreamRequestImpl( + socket_url, url_request_context, origin, std::move(connect_delegate), + std::move(create_helper))); + request->Start(std::move(timer)); + return std::move(request); } void WebSocketDispatchOnFinishOpeningHandshake( diff --git a/net/websockets/websocket_stream_create_test_base.cc b/net/websockets/websocket_stream_create_test_base.cc index 5c0a299..4211e1a 100644 --- a/net/websockets/websocket_stream_create_test_base.cc +++ b/net/websockets/websocket_stream_create_test_base.cc @@ -4,6 +4,8 @@ #include "net/websockets/websocket_stream_create_test_base.h" +#include <utility> + #include "base/callback.h" #include "base/macros.h" #include "net/http/http_request_headers.h" @@ -62,14 +64,14 @@ class WebSocketStreamCreateTestBase::TestConnectDelegate scoped_ptr<WebSocketHandshakeRequestInfo> request) override { // Can be called multiple times (in the case of HTTP auth). Last call // wins. - owner_->request_info_ = request.Pass(); + owner_->request_info_ = std::move(request); } void OnFinishOpeningHandshake( scoped_ptr<WebSocketHandshakeResponseInfo> response) override { if (owner_->response_info_) ADD_FAILURE(); - owner_->response_info_ = response.Pass(); + owner_->response_info_ = std::move(response); } void OnSSLCertificateError( @@ -77,7 +79,7 @@ class WebSocketStreamCreateTestBase::TestConnectDelegate ssl_error_callbacks, const SSLInfo& ssl_info, bool fatal) override { - owner_->ssl_error_callbacks_ = ssl_error_callbacks.Pass(); + owner_->ssl_error_callbacks_ = std::move(ssl_error_callbacks); owner_->ssl_info_ = ssl_info; owner_->ssl_fatal_ = fatal; } @@ -111,10 +113,10 @@ void WebSocketStreamCreateTestBase::CreateAndConnectStream( new DeterministicKeyWebSocketHandshakeStreamCreateHelper(delegate, sub_protocols)); stream_request_ = CreateAndConnectStreamForTesting( - GURL(socket_url), create_helper.Pass(), origin, + GURL(socket_url), std::move(create_helper), origin, url_request_context_host_.GetURLRequestContext(), BoundNetLog(), - connect_delegate.Pass(), - timer ? timer.Pass() + std::move(connect_delegate), + timer ? std::move(timer) : scoped_ptr<base::Timer>(new base::Timer(false, false))); } diff --git a/net/websockets/websocket_stream_test.cc b/net/websockets/websocket_stream_test.cc index 962de90..a5f5f41 100644 --- a/net/websockets/websocket_stream_test.cc +++ b/net/websockets/websocket_stream_test.cc @@ -51,7 +51,7 @@ scoped_ptr<SequencedSocketData> BuildSocketData( scoped_ptr<SequencedSocketData> socket_data( new SequencedSocketData(reads, reads_count, writes, writes_count)); socket_data->set_connect_data(MockConnect(SYNCHRONOUS, OK)); - return socket_data.Pass(); + return socket_data; } // Builder for a SequencedSocketData that expects nothing. This does not @@ -98,7 +98,7 @@ class WebSocketStreamCreateTest : public ::testing::Test, WebSocketStandardRequest(socket_path, socket_host, origin, extra_request_headers), response_body); - CreateAndConnectStream(socket_url, sub_protocols, origin, timer.Pass()); + CreateAndConnectStream(socket_url, sub_protocols, origin, std::move(timer)); } // |extra_request_headers| and |extra_response_headers| must end in "\r\n" or @@ -115,7 +115,7 @@ class WebSocketStreamCreateTest : public ::testing::Test, CreateAndConnectCustomResponse( socket_url, socket_host, socket_path, sub_protocols, origin, extra_request_headers, - WebSocketStandardResponse(extra_response_headers), timer.Pass()); + WebSocketStandardResponse(extra_response_headers), std::move(timer)); } void CreateAndConnectRawExpectations( @@ -124,13 +124,13 @@ class WebSocketStreamCreateTest : public ::testing::Test, const url::Origin& origin, scoped_ptr<SequencedSocketData> socket_data, scoped_ptr<base::Timer> timer = scoped_ptr<base::Timer>()) { - AddRawExpectations(socket_data.Pass()); - CreateAndConnectStream(socket_url, sub_protocols, origin, timer.Pass()); + AddRawExpectations(std::move(socket_data)); + CreateAndConnectStream(socket_url, sub_protocols, origin, std::move(timer)); } // Add additional raw expectations for sockets created before the final one. void AddRawExpectations(scoped_ptr<SequencedSocketData> socket_data) { - url_request_context_host_.AddRawExpectations(socket_data.Pass()); + url_request_context_host_.AddRawExpectations(std::move(socket_data)); } }; @@ -804,7 +804,7 @@ TEST_F(WebSocketStreamCreateTest, ConnectionFailure) { socket_data->set_connect_data( MockConnect(SYNCHRONOUS, ERR_CONNECTION_REFUSED)); CreateAndConnectRawExpectations("ws://localhost/", NoSubProtocols(), - LocalhostOrigin(), socket_data.Pass()); + LocalhostOrigin(), std::move(socket_data)); WaitUntilConnectDone(); EXPECT_TRUE(has_failed()); EXPECT_EQ("Error in connection establishment: net::ERR_CONNECTION_REFUSED", @@ -819,7 +819,7 @@ TEST_F(WebSocketStreamCreateTest, ConnectionTimeout) { socket_data->set_connect_data( MockConnect(ASYNC, ERR_CONNECTION_TIMED_OUT)); CreateAndConnectRawExpectations("ws://localhost/", NoSubProtocols(), - LocalhostOrigin(), socket_data.Pass()); + LocalhostOrigin(), std::move(socket_data)); WaitUntilConnectDone(); EXPECT_TRUE(has_failed()); EXPECT_EQ("Error in connection establishment: net::ERR_CONNECTION_TIMED_OUT", @@ -833,8 +833,8 @@ TEST_F(WebSocketStreamCreateTest, HandshakeTimeout) { scoped_ptr<MockWeakTimer> timer(new MockWeakTimer(false, false)); base::WeakPtr<MockWeakTimer> weak_timer = timer->AsWeakPtr(); CreateAndConnectRawExpectations("ws://localhost/", NoSubProtocols(), - LocalhostOrigin(), socket_data.Pass(), - timer.Pass()); + LocalhostOrigin(), std::move(socket_data), + std::move(timer)); EXPECT_FALSE(has_failed()); ASSERT_TRUE(weak_timer.get()); EXPECT_TRUE(weak_timer->IsRunning()); @@ -855,7 +855,7 @@ TEST_F(WebSocketStreamCreateTest, HandshakeTimerOnSuccess) { CreateAndConnectStandard("ws://localhost/", "localhost", "/", NoSubProtocols(), LocalhostOrigin(), "", "", - timer.Pass()); + std::move(timer)); ASSERT_TRUE(weak_timer); EXPECT_TRUE(weak_timer->IsRunning()); @@ -874,8 +874,8 @@ TEST_F(WebSocketStreamCreateTest, HandshakeTimerOnFailure) { scoped_ptr<MockWeakTimer> timer(new MockWeakTimer(false, false)); base::WeakPtr<MockWeakTimer> weak_timer = timer->AsWeakPtr(); CreateAndConnectRawExpectations("ws://localhost/", NoSubProtocols(), - LocalhostOrigin(), socket_data.Pass(), - timer.Pass()); + LocalhostOrigin(), std::move(socket_data), + std::move(timer)); ASSERT_TRUE(weak_timer.get()); EXPECT_TRUE(weak_timer->IsRunning()); @@ -892,7 +892,7 @@ TEST_F(WebSocketStreamCreateTest, CancellationDuringConnect) { scoped_ptr<SequencedSocketData> socket_data(BuildNullSocketData()); socket_data->set_connect_data(MockConnect(SYNCHRONOUS, ERR_IO_PENDING)); CreateAndConnectRawExpectations("ws://localhost/", NoSubProtocols(), - LocalhostOrigin(), socket_data.Pass()); + LocalhostOrigin(), std::move(socket_data)); stream_request_.reset(); // WaitUntilConnectDone doesn't work in this case. base::RunLoop().RunUntilIdle(); @@ -932,7 +932,7 @@ TEST_F(WebSocketStreamCreateTest, CancellationDuringRead) { scoped_ptr<SequencedSocketData> socket_data(BuildSocketData(reads, writes)); SequencedSocketData* socket_data_raw_ptr = socket_data.get(); CreateAndConnectRawExpectations("ws://localhost/", NoSubProtocols(), - LocalhostOrigin(), socket_data.Pass()); + LocalhostOrigin(), std::move(socket_data)); base::RunLoop().RunUntilIdle(); EXPECT_TRUE(socket_data_raw_ptr->AllReadDataConsumed()); stream_request_.reset(); @@ -973,7 +973,7 @@ TEST_F(WebSocketStreamCreateTest, NoResponse) { scoped_ptr<SequencedSocketData> socket_data(BuildSocketData(reads, writes)); SequencedSocketData* socket_data_raw_ptr = socket_data.get(); CreateAndConnectRawExpectations("ws://localhost/", NoSubProtocols(), - LocalhostOrigin(), socket_data.Pass()); + LocalhostOrigin(), std::move(socket_data)); base::RunLoop().RunUntilIdle(); EXPECT_TRUE(socket_data_raw_ptr->AllReadDataConsumed()); EXPECT_TRUE(has_failed()); @@ -991,7 +991,8 @@ TEST_F(WebSocketStreamCreateTest, SelfSignedCertificateFailure) { ASSERT_TRUE(ssl_data_[0]->cert.get()); scoped_ptr<SequencedSocketData> raw_socket_data(BuildNullSocketData()); CreateAndConnectRawExpectations("wss://localhost/", NoSubProtocols(), - LocalhostOrigin(), raw_socket_data.Pass()); + LocalhostOrigin(), + std::move(raw_socket_data)); // WaitUntilConnectDone doesn't work in this case. base::RunLoop().RunUntilIdle(); EXPECT_FALSE(has_failed()); @@ -1008,9 +1009,9 @@ TEST_F(WebSocketStreamCreateTest, SelfSignedCertificateSuccess) { ssl_data->cert = ImportCertFromFile(GetTestCertsDirectory(), "unittest.selfsigned.der"); ASSERT_TRUE(ssl_data->cert.get()); - ssl_data_.push_back(ssl_data.Pass()); + ssl_data_.push_back(std::move(ssl_data)); ssl_data.reset(new SSLSocketDataProvider(ASYNC, OK)); - ssl_data_.push_back(ssl_data.Pass()); + ssl_data_.push_back(std::move(ssl_data)); url_request_context_host_.AddRawExpectations(BuildNullSocketData()); CreateAndConnectStandard("wss://localhost/", "localhost", "/", NoSubProtocols(), LocalhostOrigin(), "", ""); @@ -1161,7 +1162,7 @@ TEST_F(WebSocketStreamCreateTest, HandleErrConnectionClosed) { scoped_ptr<SequencedSocketData> socket_data(BuildSocketData(reads, writes)); socket_data->set_connect_data(MockConnect(SYNCHRONOUS, OK)); CreateAndConnectRawExpectations("ws://localhost/", NoSubProtocols(), - LocalhostOrigin(), socket_data.Pass()); + LocalhostOrigin(), std::move(socket_data)); WaitUntilConnectDone(); EXPECT_TRUE(has_failed()); } @@ -1186,7 +1187,7 @@ TEST_F(WebSocketStreamCreateTest, HandleErrTunnelConnectionFailed) { scoped_ptr<SequencedSocketData> socket_data(BuildSocketData(reads, writes)); url_request_context_host_.SetProxyConfig("https=proxy:8000"); CreateAndConnectRawExpectations("ws://localhost/", NoSubProtocols(), - LocalhostOrigin(), socket_data.Pass()); + LocalhostOrigin(), std::move(socket_data)); WaitUntilConnectDone(); EXPECT_TRUE(has_failed()); EXPECT_EQ("Establishing a tunnel via proxy server failed.", diff --git a/net/websockets/websocket_test_util.cc b/net/websockets/websocket_test_util.cc index 5b5d13a..3b7ad10 100644 --- a/net/websockets/websocket_test_util.cc +++ b/net/websockets/websocket_test_util.cc @@ -6,6 +6,7 @@ #include <stddef.h> #include <algorithm> +#include <utility> #include <vector> #include "base/strings/stringprintf.h" @@ -127,19 +128,19 @@ void WebSocketMockClientSocketFactoryMaker::SetExpectations( scoped_ptr<SequencedSocketData> socket_data(new SequencedSocketData( detail_->reads.data(), detail_->reads.size(), &detail_->write, 1)); socket_data->set_connect_data(MockConnect(SYNCHRONOUS, OK)); - AddRawExpectations(socket_data.Pass()); + AddRawExpectations(std::move(socket_data)); } void WebSocketMockClientSocketFactoryMaker::AddRawExpectations( scoped_ptr<SequencedSocketData> socket_data) { detail_->factory.AddSocketDataProvider(socket_data.get()); - detail_->socket_data_vector.push_back(socket_data.Pass()); + detail_->socket_data_vector.push_back(std::move(socket_data)); } void WebSocketMockClientSocketFactoryMaker::AddSSLSocketDataProvider( scoped_ptr<SSLSocketDataProvider> ssl_socket_data) { detail_->factory.AddSSLSocketDataProvider(ssl_socket_data.get()); - detail_->ssl_socket_data_vector.push_back(ssl_socket_data.Pass()); + detail_->ssl_socket_data_vector.push_back(std::move(ssl_socket_data)); } WebSocketTestURLRequestContextHost::WebSocketTestURLRequestContextHost() @@ -151,12 +152,12 @@ WebSocketTestURLRequestContextHost::~WebSocketTestURLRequestContextHost() {} void WebSocketTestURLRequestContextHost::AddRawExpectations( scoped_ptr<SequencedSocketData> socket_data) { - maker_.AddRawExpectations(socket_data.Pass()); + maker_.AddRawExpectations(std::move(socket_data)); } void WebSocketTestURLRequestContextHost::AddSSLSocketDataProvider( scoped_ptr<SSLSocketDataProvider> ssl_socket_data) { - maker_.AddSSLSocketDataProvider(ssl_socket_data.Pass()); + maker_.AddSSLSocketDataProvider(std::move(ssl_socket_data)); } void WebSocketTestURLRequestContextHost::SetProxyConfig( |