diff options
author | dcheng <dcheng@chromium.org> | 2015-12-29 17:51:49 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-12-30 01:52:46 +0000 |
commit | d0cf8b99e51ec3695b944fd803437a2ea5989b08 (patch) | |
tree | a8dc9f56421a5272386bc017e61df7370aa07067 | |
parent | 3ea246d66fe9bcab77d2c3ecc77331cf1ffb3fc5 (diff) | |
download | chromium_src-d0cf8b99e51ec3695b944fd803437a2ea5989b08.zip chromium_src-d0cf8b99e51ec3695b944fd803437a2ea5989b08.tar.gz chromium_src-d0cf8b99e51ec3695b944fd803437a2ea5989b08.tar.bz2 |
Convert Pass()→std::move() in //components (Android edition)
(╯^□^)╯︵ ❄☃❄
BUG=557422
R=avi@chromium.org
TBR=jochen@chromium.org
Review URL: https://codereview.chromium.org/1550383002
Cr-Commit-Position: refs/heads/master@{#367127}
18 files changed, 88 insertions, 74 deletions
diff --git a/components/crash/content/browser/crash_dump_manager_android.cc b/components/crash/content/browser/crash_dump_manager_android.cc index a21a894..1a618ff 100644 --- a/components/crash/content/browser/crash_dump_manager_android.cc +++ b/components/crash/content/browser/crash_dump_manager_android.cc @@ -80,7 +80,7 @@ base::File CrashDumpManager::CreateMinidumpFile(int child_process_id) { DCHECK(!ContainsKey(child_process_id_to_minidump_path_, child_process_id)); child_process_id_to_minidump_path_[child_process_id] = minidump_path; } - return minidump_file.Pass(); + return minidump_file; } // static diff --git a/components/cronet/android/chromium_url_request_context.cc b/components/cronet/android/chromium_url_request_context.cc index 3969ec0..05233be 100644 --- a/components/cronet/android/chromium_url_request_context.cc +++ b/components/cronet/android/chromium_url_request_context.cc @@ -5,6 +5,7 @@ #include "components/cronet/android/chromium_url_request_context.h" #include <string> +#include <utility> #include "base/android/jni_android.h" #include "base/android/jni_string.h" @@ -80,7 +81,7 @@ static jlong CreateRequestContextAdapter( URLRequestContextAdapter* context_adapter = new URLRequestContextAdapter( new JniURLRequestContextAdapterDelegate(env, jcaller), user_agent); context_adapter->AddRef(); // Hold onto this ref-counted object. - context_adapter->Initialize(context_config.Pass()); + context_adapter->Initialize(std::move(context_config)); return reinterpret_cast<jlong>(context_adapter); } diff --git a/components/cronet/android/cronet_in_memory_pref_store.cc b/components/cronet/android/cronet_in_memory_pref_store.cc index 43a484b..3bf641f 100644 --- a/components/cronet/android/cronet_in_memory_pref_store.cc +++ b/components/cronet/android/cronet_in_memory_pref_store.cc @@ -4,6 +4,8 @@ #include "components/cronet/android/cronet_in_memory_pref_store.h" +#include <utility> + #include "base/logging.h" #include "base/values.h" @@ -41,14 +43,14 @@ void CronetInMemoryPrefStore::SetValue(const std::string& key, scoped_ptr<base::Value> value, uint32_t flags) { DCHECK(value); - if (prefs_.SetValue(key, value.Pass())) + if (prefs_.SetValue(key, std::move(value))) ReportValueChanged(key, flags); } void CronetInMemoryPrefStore::SetValueSilently(const std::string& key, scoped_ptr<base::Value> value, uint32_t flags) { - prefs_.SetValue(key, value.Pass()); + prefs_.SetValue(key, std::move(value)); } void CronetInMemoryPrefStore::RemoveValue(const std::string& key, diff --git a/components/cronet/android/cronet_upload_data_stream_adapter.cc b/components/cronet/android/cronet_upload_data_stream_adapter.cc index 53fafa5..0ae18c6 100644 --- a/components/cronet/android/cronet_upload_data_stream_adapter.cc +++ b/components/cronet/android/cronet_upload_data_stream_adapter.cc @@ -5,6 +5,7 @@ #include "components/cronet/android/cronet_upload_data_stream_adapter.h" #include <string> +#include <utility> #include "base/android/jni_android.h" #include "base/android/jni_string.h" @@ -122,7 +123,7 @@ static jlong AttachUploadDataToRequest( scoped_ptr<CronetUploadDataStream> upload_data_stream( new CronetUploadDataStream(adapter, jlength)); - request_adapter->SetUpload(upload_data_stream.Pass()); + request_adapter->SetUpload(std::move(upload_data_stream)); return reinterpret_cast<jlong>(adapter); } diff --git a/components/cronet/android/cronet_url_request_adapter.cc b/components/cronet/android/cronet_url_request_adapter.cc index 4f964a7..2994e24 100644 --- a/components/cronet/android/cronet_url_request_adapter.cc +++ b/components/cronet/android/cronet_url_request_adapter.cc @@ -2,9 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "cronet_url_request_adapter.h" +#include "components/cronet/android/cronet_url_request_adapter.h" #include <limits> +#include <utility> #include <vector> #include "base/bind.h" @@ -147,7 +148,7 @@ void CronetURLRequestAdapter::SetUpload( scoped_ptr<net::UploadDataStream> upload) { DCHECK(!context_->IsOnNetworkThread()); DCHECK(!upload_); - upload_ = upload.Pass(); + upload_ = std::move(upload); } void CronetURLRequestAdapter::Start(JNIEnv* env, @@ -336,7 +337,7 @@ void CronetURLRequestAdapter::StartOnNetworkThread() { url_request_->SetExtraRequestHeaders(initial_request_headers_); url_request_->SetPriority(initial_priority_); if (upload_) - url_request_->set_upload(upload_.Pass()); + url_request_->set_upload(std::move(upload_)); url_request_->Start(); } diff --git a/components/cronet/android/cronet_url_request_context_adapter.cc b/components/cronet/android/cronet_url_request_context_adapter.cc index 7ed7f6c..231d64f 100644 --- a/components/cronet/android/cronet_url_request_context_adapter.cc +++ b/components/cronet/android/cronet_url_request_context_adapter.cc @@ -6,8 +6,8 @@ #include <limits.h> #include <stddef.h> - #include <map> +#include <utility> #include "base/android/jni_android.h" #include "base/android/jni_array.h" @@ -138,7 +138,7 @@ CronetURLRequestContextAdapter::CronetURLRequestContextAdapter( scoped_ptr<URLRequestContextConfig> context_config) : network_thread_(new base::Thread("network")), http_server_properties_manager_(nullptr), - context_config_(context_config.Pass()), + context_config_(std::move(context_config)), is_context_initialized_(false), default_load_flags_(net::LOAD_NORMAL) { base::Thread::Options options; @@ -285,7 +285,7 @@ void CronetURLRequestContextAdapter::InitializeOnNetworkThread( context_builder.SetInterceptors(std::move(interceptors)); } #endif // defined(DATA_REDUCTION_PROXY_SUPPORT) - context_builder.set_network_delegate(network_delegate.Pass()); + context_builder.set_network_delegate(std::move(network_delegate)); context_builder.set_net_log(net_log_.get()); // Android provides a local HTTP proxy server that handles proxying when a PAC @@ -293,7 +293,7 @@ void CronetURLRequestContextAdapter::InitializeOnNetworkThread( // local HTTP proxy. See: crbug.com/432539. context_builder.set_proxy_service( net::ProxyService::CreateWithoutProxyResolver( - proxy_config_service_.Pass(), net_log_.get())); + std::move(proxy_config_service_), net_log_.get())); config->ConfigureURLRequestContextBuilder(&context_builder, net_log_.get()); // Set up pref file if storage path is specified. @@ -310,7 +310,7 @@ void CronetURLRequestContextAdapter::InitializeOnNetworkThread( scoped_refptr<PrefRegistrySimple> registry(new PrefRegistrySimple()); registry->RegisterDictionaryPref(kHttpServerProperties, new base::DictionaryValue()); - pref_service_ = factory.Create(registry.get()).Pass(); + pref_service_ = factory.Create(registry.get()); scoped_ptr<net::HttpServerPropertiesManager> http_server_properties_manager( new net::HttpServerPropertiesManager(pref_service_.get(), @@ -319,7 +319,7 @@ void CronetURLRequestContextAdapter::InitializeOnNetworkThread( http_server_properties_manager->InitializeOnNetworkThread(); http_server_properties_manager_ = http_server_properties_manager.get(); context_builder.SetHttpServerProperties( - http_server_properties_manager.Pass()); + std::move(http_server_properties_manager)); } // Explicitly disable the persister for Cronet to avoid persistence of dynamic @@ -327,7 +327,7 @@ void CronetURLRequestContextAdapter::InitializeOnNetworkThread( // of HPKP by specifying transport_security_persister_path in the future. context_builder.set_transport_security_persister_path(base::FilePath()); - context_ = context_builder.Build().Pass(); + context_ = context_builder.Build(); default_load_flags_ = net::LOAD_DO_NOT_SAVE_COOKIES | net::LOAD_DO_NOT_SEND_COOKIES; @@ -499,8 +499,8 @@ void CronetURLRequestContextAdapter::StartNetLogToFileOnNetworkThread( write_to_file_observer_->set_capture_mode( net::NetLogCaptureMode::IncludeSocketBytes()); } - write_to_file_observer_->StartObserving(context_->net_log(), file.Pass(), - nullptr, context_.get()); + write_to_file_observer_->StartObserving(context_->net_log(), std::move(file), + nullptr, context_.get()); } void CronetURLRequestContextAdapter::StopNetLogOnNetworkThread() { @@ -641,7 +641,7 @@ static jlong CreateRequestContextAdapter(JNIEnv* env, reinterpret_cast<URLRequestContextConfig*>(jconfig)); CronetURLRequestContextAdapter* context_adapter = - new CronetURLRequestContextAdapter(context_config.Pass()); + new CronetURLRequestContextAdapter(std::move(context_config)); return reinterpret_cast<jlong>(context_adapter); } diff --git a/components/cronet/android/test/native_test_server.cc b/components/cronet/android/test/native_test_server.cc index aab2d32..e042a6a 100644 --- a/components/cronet/android/test/native_test_server.cc +++ b/components/cronet/android/test/native_test_server.cc @@ -2,9 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "native_test_server.h" +#include "components/cronet/android/test/native_test_server.h" #include <string> +#include <utility> #include "base/android/jni_android.h" #include "base/android/jni_string.h" @@ -68,7 +69,7 @@ scoped_ptr<net::test_server::RawHttpResponse> ConstructResponseBasedOnFile( DCHECK(read_headers); scoped_ptr<net::test_server::RawHttpResponse> http_response( new net::test_server::RawHttpResponse(headers_contents, file_contents)); - return http_response.Pass(); + return http_response; } scoped_ptr<net::test_server::HttpResponse> NativeTestServerRequestHandler( @@ -84,7 +85,7 @@ scoped_ptr<net::test_server::HttpResponse> NativeTestServerRequestHandler( } else { response->set_content("Request has no body. :("); } - return response.Pass(); + return std::move(response); } if (base::StartsWith(request.relative_url, kEchoHeaderPath, @@ -96,23 +97,23 @@ scoped_ptr<net::test_server::HttpResponse> NativeTestServerRequestHandler( } else { response->set_content("Header not found. :("); } - return response.Pass(); + return std::move(response); } if (request.relative_url == kEchoAllHeadersPath) { response->set_content(request.all_headers); - return response.Pass(); + return std::move(response); } if (request.relative_url == kEchoMethodPath) { response->set_content(request.method_string); - return response.Pass(); + return std::move(response); } if (request.relative_url == kRedirectToEchoBodyPath) { response->set_code(net::HTTP_TEMPORARY_REDIRECT); response->AddCustomHeader("Location", kEchoBodyPath); - return response.Pass(); + return std::move(response); } // Unhandled requests result in the Embedded test server sending a 404. @@ -131,7 +132,7 @@ scoped_ptr<net::test_server::HttpResponse> SdchRequestHandler( base::CompareCase::SENSITIVE)) { base::FilePath file_path = dir_path.Append("sdch/index"); scoped_ptr<net::test_server::RawHttpResponse> response = - ConstructResponseBasedOnFile(file_path).Pass(); + ConstructResponseBasedOnFile(file_path); // Check for query params to see which dictionary to advertise. // For instance, ?q=dictionaryA will make the server advertise dictionaryA. GURL url = g_test_server->GetURL(request.relative_url); @@ -146,7 +147,7 @@ scoped_ptr<net::test_server::HttpResponse> SdchRequestHandler( response->AddHeader(base::StringPrintf( "Get-Dictionary: %s%s", kSdchDictPath, dictionary.c_str())); } - return response.Pass(); + return std::move(response); } if (base::StartsWith(request.relative_url, kSdchTestPath, @@ -155,13 +156,13 @@ scoped_ptr<net::test_server::HttpResponse> SdchRequestHandler( if (avail_dictionary_header != request.headers.end()) { base::FilePath file_path = dir_path.Append( "sdch/" + avail_dictionary_header->second + "_encoded"); - return ConstructResponseBasedOnFile(file_path).Pass(); + return ConstructResponseBasedOnFile(file_path); } scoped_ptr<net::test_server::BasicHttpResponse> response( new net::test_server::BasicHttpResponse()); response->set_content_type("text/plain"); response->set_content("Sdch is not used.\n"); - return response.Pass(); + return std::move(response); } // Unhandled requests result in the Embedded test server sending a 404. diff --git a/components/cronet/android/test/test_upload_data_stream_handler.cc b/components/cronet/android/test/test_upload_data_stream_handler.cc index 6e59c6c..302ea6d 100644 --- a/components/cronet/android/test/test_upload_data_stream_handler.cc +++ b/components/cronet/android/test/test_upload_data_stream_handler.cc @@ -2,11 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "test_upload_data_stream_handler.h" +#include "components/cronet/android/test/test_upload_data_stream_handler.h" #include <stddef.h> - #include <string> +#include <utility> #include "base/android/jni_android.h" #include "base/android/jni_string.h" @@ -26,7 +26,7 @@ TestUploadDataStreamHandler::TestUploadDataStreamHandler( read_callback_invoked_(false), bytes_read_(0), network_thread_(new base::Thread("network")) { - upload_data_stream_ = upload_data_stream.Pass(); + upload_data_stream_ = std::move(upload_data_stream); base::Thread::Options options; options.message_loop_type = base::MessageLoop::TYPE_IO; network_thread_->StartWithOptions(options); @@ -43,7 +43,7 @@ void TestUploadDataStreamHandler::Destroy( DCHECK(!network_thread_->task_runner()->BelongsToCurrentThread()); // Stick network_thread_ in a local, so |this| may be destroyed from the // network thread before the network thread is destroyed. - scoped_ptr<base::Thread> network_thread = network_thread_.Pass(); + scoped_ptr<base::Thread> network_thread = std::move(network_thread_); network_thread->task_runner()->DeleteSoon(FROM_HERE, this); // Deleting thread stops it after all tasks are completed. network_thread.reset(); @@ -183,7 +183,7 @@ static jlong CreateTestUploadDataStreamHandler( scoped_ptr<net::UploadDataStream> upload_data_stream( reinterpret_cast<net::UploadDataStream*>(jupload_data_stream)); TestUploadDataStreamHandler* handler = new TestUploadDataStreamHandler( - upload_data_stream.Pass(), env, jtest_upload_data_stream_handler); + std::move(upload_data_stream), env, jtest_upload_data_stream_handler); return reinterpret_cast<jlong>(handler); } diff --git a/components/cronet/android/url_request_adapter.cc b/components/cronet/android/url_request_adapter.cc index c226073..d657637 100644 --- a/components/cronet/android/url_request_adapter.cc +++ b/components/cronet/android/url_request_adapter.cc @@ -2,10 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "url_request_adapter.h" +#include "components/cronet/android/url_request_adapter.h" #include <stddef.h> #include <string.h> +#include <utility> #include "base/bind.h" #include "base/location.h" @@ -62,14 +63,14 @@ void URLRequestAdapter::SetUploadContent(const char* bytes, int bytes_len) { scoped_ptr<net::UploadElementReader> reader( new net::UploadOwnedBytesElementReader(&data)); upload_data_stream_ = - net::ElementsUploadDataStream::CreateWithReader(reader.Pass(), 0); + net::ElementsUploadDataStream::CreateWithReader(std::move(reader), 0); } void URLRequestAdapter::SetUploadChannel(JNIEnv* env, int64_t content_length) { scoped_ptr<net::UploadElementReader> reader( new WrappedChannelElementReader(delegate_, content_length)); upload_data_stream_ = - net::ElementsUploadDataStream::CreateWithReader(reader.Pass(), 0); + net::ElementsUploadDataStream::CreateWithReader(std::move(reader), 0); } void URLRequestAdapter::DisableRedirects() { @@ -163,7 +164,7 @@ void URLRequestAdapter::OnInitiateConnection() { } if (upload_data_stream_) { - url_request_->set_upload(upload_data_stream_.Pass()); + url_request_->set_upload(std::move(upload_data_stream_)); } else if (chunked_upload_) { url_request_->EnableChunkedUpload(); } diff --git a/components/cronet/android/url_request_context_adapter.cc b/components/cronet/android/url_request_context_adapter.cc index 9198b76..b6acd74 100644 --- a/components/cronet/android/url_request_context_adapter.cc +++ b/components/cronet/android/url_request_context_adapter.cc @@ -6,8 +6,8 @@ #include <stddef.h> #include <stdint.h> - #include <limits> +#include <utility> #include "base/bind.h" #include "base/files/file_util.h" @@ -126,7 +126,7 @@ void URLRequestContextAdapter::Initialize( base::Thread::Options options; options.message_loop_type = base::MessageLoop::TYPE_IO; network_thread_->StartWithOptions(options); - config_ = config.Pass(); + config_ = std::move(config); } void URLRequestContextAdapter::InitRequestContextOnMainThread() { @@ -153,10 +153,10 @@ void URLRequestContextAdapter::InitRequestContextOnNetworkThread() { context_builder.set_network_delegate( make_scoped_ptr(new BasicNetworkDelegate())); - context_builder.set_proxy_config_service(proxy_config_service_.Pass()); + context_builder.set_proxy_config_service(std::move(proxy_config_service_)); config_->ConfigureURLRequestContextBuilder(&context_builder, nullptr); - context_ = context_builder.Build().Pass(); + context_ = context_builder.Build(); if (config_->enable_sdch) { DCHECK(context_->sdch_manager()); @@ -306,8 +306,8 @@ void URLRequestContextAdapter::StartNetLogToFileHelper( write_to_file_observer_->set_capture_mode( net::NetLogCaptureMode::IncludeSocketBytes()); } - write_to_file_observer_->StartObserving(context_->net_log(), file.Pass(), - nullptr, context_.get()); + write_to_file_observer_->StartObserving(context_->net_log(), std::move(file), + nullptr, context_.get()); } void URLRequestContextAdapter::StopNetLogHelper() { diff --git a/components/cronet/url_request_context_config.cc b/components/cronet/url_request_context_config.cc index 32b845c..892fd57 100644 --- a/components/cronet/url_request_context_config.cc +++ b/components/cronet/url_request_context_config.cc @@ -4,6 +4,8 @@ #include "components/cronet/url_request_context_config.h" +#include <utility> + #include "base/json/json_reader.h" #include "base/logging.h" #include "base/memory/scoped_ptr.h" @@ -55,7 +57,7 @@ void ParseAndSetExperimentalOptions( } scoped_ptr<base::DictionaryValue> dict = - base::DictionaryValue::From(options.Pass()); + base::DictionaryValue::From(std::move(options)); if (!dict) { DCHECK(false) << "Experimental options string is not a dictionary: " @@ -200,7 +202,7 @@ void URLRequestContextConfig::ConfigureURLRequestContextBuilder( net_log); if (mock_cert_verifier) - context_builder->SetCertVerifier(mock_cert_verifier.Pass()); + context_builder->SetCertVerifier(std::move(mock_cert_verifier)); // TODO(mef): Use |config| to set cookies. } diff --git a/components/data_usage/android/traffic_stats_amortizer.cc b/components/data_usage/android/traffic_stats_amortizer.cc index 09d5ecb..94207ac 100644 --- a/components/data_usage/android/traffic_stats_amortizer.cc +++ b/components/data_usage/android/traffic_stats_amortizer.cc @@ -6,6 +6,7 @@ #include <algorithm> // For std::min. #include <cmath> // For std::modf. +#include <utility> #include "base/location.h" #include "base/metrics/histogram_base.h" @@ -149,7 +150,7 @@ void TrafficStatsAmortizer::AmortizeDataUse( // identical except for byte counts and have the same callback. buffered_data_use_.push_back( std::pair<scoped_ptr<DataUse>, AmortizationCompleteCallback>( - data_use.Pass(), callback)); + std::move(data_use), callback)); AddPreAmortizationBytes(tx_bytes, rx_bytes); } @@ -171,8 +172,8 @@ TrafficStatsAmortizer::TrafficStatsAmortizer( const base::TimeDelta& traffic_stats_query_delay, const base::TimeDelta& max_amortization_delay, size_t max_data_use_buffer_size) - : tick_clock_(tick_clock.Pass()), - traffic_stats_query_timer_(traffic_stats_query_timer.Pass()), + : tick_clock_(std::move(tick_clock)), + traffic_stats_query_timer_(std::move(traffic_stats_query_timer)), traffic_stats_query_delay_(traffic_stats_query_delay), max_amortization_delay_(max_amortization_delay), max_data_use_buffer_size_(max_data_use_buffer_size), @@ -328,7 +329,7 @@ void TrafficStatsAmortizer::AmortizeNow() { // Pass post-amortization DataUse objects to their respective callbacks. for (auto& data_use_buffer_pair : data_use_sequence) - data_use_buffer_pair.second.Run(data_use_buffer_pair.first.Pass()); + data_use_buffer_pair.second.Run(std::move(data_use_buffer_pair.first)); } } // namespace android diff --git a/components/data_usage/android/traffic_stats_amortizer_unittest.cc b/components/data_usage/android/traffic_stats_amortizer_unittest.cc index 8a80e41..8d755fa 100644 --- a/components/data_usage/android/traffic_stats_amortizer_unittest.cc +++ b/components/data_usage/android/traffic_stats_amortizer_unittest.cc @@ -6,8 +6,8 @@ #include <stddef.h> #include <stdint.h> - #include <string> +#include <utility> #include "base/bind.h" #include "base/macros.h" @@ -107,8 +107,8 @@ class TestTrafficStatsAmortizer : public TrafficStatsAmortizer { public: TestTrafficStatsAmortizer(scoped_ptr<base::TickClock> tick_clock, scoped_ptr<base::Timer> traffic_stats_query_timer) - : TrafficStatsAmortizer(tick_clock.Pass(), - traffic_stats_query_timer.Pass(), + : TrafficStatsAmortizer(std::move(tick_clock), + std::move(traffic_stats_query_timer), kTrafficStatsQueryDelay, kMaxAmortizationDelay, kMaxDataUseBufferSize), diff --git a/components/policy/core/browser/android/android_combined_policy_provider.cc b/components/policy/core/browser/android/android_combined_policy_provider.cc index 1673204..8ace29b 100644 --- a/components/policy/core/browser/android/android_combined_policy_provider.cc +++ b/components/policy/core/browser/android/android_combined_policy_provider.cc @@ -46,7 +46,7 @@ void AndroidCombinedPolicyProvider::FlushPolicies( JNIEnv* env, const JavaParamRef<jobject>& obj) { initialized_ = true; - UpdatePolicy(policy_converter_->GetPolicyBundle().Pass()); + UpdatePolicy(policy_converter_->GetPolicyBundle()); } // static diff --git a/components/policy/core/browser/android/policy_converter.cc b/components/policy/core/browser/android/policy_converter.cc index 0d199c4..6edbe70 100644 --- a/components/policy/core/browser/android/policy_converter.cc +++ b/components/policy/core/browser/android/policy_converter.cc @@ -4,6 +4,7 @@ #include "components/policy/core/browser/android/policy_converter.h" +#include <utility> #include <vector> #include "base/android/jni_android.h" @@ -41,9 +42,9 @@ PolicyConverter::~PolicyConverter() { } scoped_ptr<PolicyBundle> PolicyConverter::GetPolicyBundle() { - scoped_ptr<PolicyBundle> filled_bundle(policy_bundle_.Pass()); + scoped_ptr<PolicyBundle> filled_bundle(std::move(policy_bundle_)); policy_bundle_.reset(new PolicyBundle); - return filled_bundle.Pass(); + return filled_bundle; } base::android::ScopedJavaLocalRef<jobject> PolicyConverter::GetJavaObject() { @@ -82,7 +83,7 @@ void PolicyConverter::SetPolicyStringArray(JNIEnv* env, const JavaRef<jstring>& policyKey, const JavaRef<jobjectArray>& array) { SetPolicyValue(ConvertJavaStringToUTF8(env, policyKey), - ConvertJavaStringArrayToListValue(env, array).Pass()); + ConvertJavaStringArrayToListValue(env, array)); } // static @@ -100,7 +101,7 @@ scoped_ptr<base::ListValue> PolicyConverter::ConvertJavaStringArrayToListValue( list_value->AppendString(ConvertJavaStringToUTF8(env, str)); } - return list_value.Pass(); + return list_value; } // static @@ -108,7 +109,7 @@ scoped_ptr<base::Value> PolicyConverter::ConvertValueToSchema( scoped_ptr<base::Value> value, const Schema& schema) { if (!schema.valid()) - return value.Pass(); + return value; switch (schema.type()) { case base::Value::TYPE_NULL: @@ -123,13 +124,13 @@ scoped_ptr<base::Value> PolicyConverter::ConvertValueToSchema( if (string_value.compare("false") == 0) return make_scoped_ptr(new base::FundamentalValue(false)); - return value.Pass(); + return value; } int int_value = 0; if (value->GetAsInteger(&int_value)) return make_scoped_ptr(new base::FundamentalValue(int_value != 0)); - return value.Pass(); + return value; } case base::Value::TYPE_INTEGER: { @@ -139,7 +140,7 @@ scoped_ptr<base::Value> PolicyConverter::ConvertValueToSchema( if (base::StringToInt(string_value, &int_value)) return make_scoped_ptr(new base::FundamentalValue(int_value)); } - return value.Pass(); + return value; } case base::Value::TYPE_DOUBLE: { @@ -149,12 +150,12 @@ scoped_ptr<base::Value> PolicyConverter::ConvertValueToSchema( if (base::StringToDouble(string_value, &double_value)) return make_scoped_ptr(new base::FundamentalValue(double_value)); } - return value.Pass(); + return value; } // String can't be converted from other types. case base::Value::TYPE_STRING: { - return value.Pass(); + return value; } // Binary is not a valid schema type. @@ -171,9 +172,9 @@ scoped_ptr<base::Value> PolicyConverter::ConvertValueToSchema( scoped_ptr<base::Value> decoded_value = base::JSONReader::Read(string_value); if (decoded_value) - return decoded_value.Pass(); + return decoded_value; } - return value.Pass(); + return value; } } @@ -190,10 +191,9 @@ void PolicyConverter::SetPolicyValue(const std::string& key, scoped_ptr<base::Value> value) { const Schema schema = policy_schema_->GetKnownProperty(key); const PolicyNamespace ns(POLICY_DOMAIN_CHROME, std::string()); - policy_bundle_->Get(ns) - .Set(key, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE, - POLICY_SOURCE_PLATFORM, - ConvertValueToSchema(value.Pass(), schema).release(), nullptr); + policy_bundle_->Get(ns).Set( + key, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE, POLICY_SOURCE_PLATFORM, + ConvertValueToSchema(std::move(value), schema).release(), nullptr); } } // namespace android diff --git a/components/safe_json/safe_json_parser_android.cc b/components/safe_json/safe_json_parser_android.cc index 9266ec7..3bfe628d 100644 --- a/components/safe_json/safe_json_parser_android.cc +++ b/components/safe_json/safe_json_parser_android.cc @@ -4,6 +4,8 @@ #include "components/safe_json/safe_json_parser_android.h" +#include <utility> + #include "base/bind.h" #include "base/json/json_reader.h" #include "base/values.h" @@ -45,7 +47,7 @@ void SafeJsonParserAndroid::OnSanitizationSuccess( return; } - success_callback_.Run(value.Pass()); + success_callback_.Run(std::move(value)); } void SafeJsonParserAndroid::OnSanitizationError(const std::string& error) { diff --git a/components/sessions/core/in_memory_tab_restore_service.cc b/components/sessions/core/in_memory_tab_restore_service.cc index 27b6892..d350aec 100644 --- a/components/sessions/core/in_memory_tab_restore_service.cc +++ b/components/sessions/core/in_memory_tab_restore_service.cc @@ -4,6 +4,7 @@ #include "components/sessions/core/in_memory_tab_restore_service.h" +#include <utility> #include <vector> #include "base/compiler_specific.h" @@ -13,7 +14,7 @@ namespace sessions { InMemoryTabRestoreService::InMemoryTabRestoreService( scoped_ptr<TabRestoreServiceClient> client, TabRestoreService::TimeFactory* time_factory) - : client_(client.Pass()), + : client_(std::move(client)), helper_(this, NULL, client_.get(), time_factory) {} InMemoryTabRestoreService::~InMemoryTabRestoreService() {} diff --git a/components/translate/core/browser/translate_infobar_delegate.cc b/components/translate/core/browser/translate_infobar_delegate.cc index d038466..c8fd02d 100644 --- a/components/translate/core/browser/translate_infobar_delegate.cc +++ b/components/translate/core/browser/translate_infobar_delegate.cc @@ -5,6 +5,7 @@ #include "components/translate/core/browser/translate_infobar_delegate.h" #include <algorithm> +#include <utility> #include "base/i18n/string_compare.h" #include "base/metrics/histogram_macros.h" @@ -105,9 +106,9 @@ void TranslateInfoBarDelegate::Create( original_language, target_language, error_type, triggered_from_menu)))); if (old_delegate) - infobar_manager->ReplaceInfoBar(old_infobar, infobar.Pass()); + infobar_manager->ReplaceInfoBar(old_infobar, std::move(infobar)); else - infobar_manager->AddInfoBar(infobar.Pass()); + infobar_manager->AddInfoBar(std::move(infobar)); } void TranslateInfoBarDelegate::UpdateOriginalLanguage( |