Commit d0cf8b99 authored by dcheng's avatar dcheng Committed by Commit bot

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