diff options
author | dcheng <dcheng@chromium.org> | 2015-12-26 14:45:17 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-12-26 22:46:08 +0000 |
commit | 51ace48ad51bae53cef3d63a27fbabeb7d0ecafa (patch) | |
tree | 75688ca279a49d844a7f7b08026836c7e352ccfd | |
parent | 4a9d9829bc889e6a2cc02dbc443d3032e1d2c81f (diff) | |
download | chromium_src-51ace48ad51bae53cef3d63a27fbabeb7d0ecafa.zip chromium_src-51ace48ad51bae53cef3d63a27fbabeb7d0ecafa.tar.gz chromium_src-51ace48ad51bae53cef3d63a27fbabeb7d0ecafa.tar.bz2 |
Convert Pass()→std::move() in //components/[n-z]*
BUG=557422
R=avi@chromium.org
TBR=jochen@chromium.org
Review URL: https://codereview.chromium.org/1548203002
Cr-Commit-Position: refs/heads/master@{#366914}
302 files changed, 1417 insertions, 1195 deletions
diff --git a/components/nacl/browser/nacl_browser.cc b/components/nacl/browser/nacl_browser.cc index 541a080..fbf7de9 100644 --- a/components/nacl/browser/nacl_browser.cc +++ b/components/nacl/browser/nacl_browser.cc @@ -130,7 +130,7 @@ base::File OpenNaClReadExecImpl(const base::FilePath& file_path, flags |= base::File::FLAG_EXECUTE; // Windows only flag. base::File file(file_path, flags); if (!file.IsValid()) - return file.Pass(); + return file; // Check that the file does not reference a directory. Returning a descriptor // to an extension directory could allow an outer sandbox escape. openat(...) @@ -139,7 +139,7 @@ base::File OpenNaClReadExecImpl(const base::FilePath& file_path, if (!file.GetInfo(&file_info) || file_info.is_directory) return base::File(); - return file.Pass(); + return file; } NaClBrowser::NaClBrowser() diff --git a/components/nacl/browser/nacl_file_host.cc b/components/nacl/browser/nacl_file_host.cc index 8ce9c7f..0c10254 100644 --- a/components/nacl/browser/nacl_file_host.cc +++ b/components/nacl/browser/nacl_file_host.cc @@ -6,6 +6,7 @@ #include <stddef.h> #include <stdint.h> +#include <utility> #include "base/bind.h" #include "base/files/file.h" @@ -61,8 +62,7 @@ void DoRegisterOpenedNaClExecutableFile( nacl_browser->PutFilePath(file_path, &file_token_lo, &file_token_hi); IPC::PlatformFileForTransit file_desc = IPC::TakeFileHandleForProcess( - file.Pass(), - nacl_host_message_filter->PeerHandle()); + std::move(file), nacl_host_message_filter->PeerHandle()); write_reply_message(reply_msg, file_desc, file_token_lo, file_token_hi); nacl_host_message_filter->Send(reply_msg); @@ -105,14 +105,13 @@ void DoOpenPnaclFile( BrowserThread::PostTask( BrowserThread::IO, FROM_HERE, base::Bind(&DoRegisterOpenedNaClExecutableFile, - nacl_host_message_filter, - Passed(file_to_open.Pass()), full_filepath, reply_msg, + nacl_host_message_filter, Passed(std::move(file_to_open)), + full_filepath, reply_msg, static_cast<WriteFileInfoReply>( NaClHostMsg_GetReadonlyPnaclFD::WriteReplyParams))); } else { - IPC::PlatformFileForTransit target_desc = - IPC::TakeFileHandleForProcess(file_to_open.Pass(), - nacl_host_message_filter->PeerHandle()); + IPC::PlatformFileForTransit target_desc = IPC::TakeFileHandleForProcess( + std::move(file_to_open), nacl_host_message_filter->PeerHandle()); uint64_t dummy_file_token = 0; NaClHostMsg_GetReadonlyPnaclFD::WriteReplyParams( reply_msg, target_desc, dummy_file_token, dummy_file_token); @@ -153,16 +152,14 @@ void DoOpenNaClExecutableOnThreadPool( // registered in a structure owned by the IO thread. BrowserThread::PostTask( BrowserThread::IO, FROM_HERE, - base::Bind( - &DoRegisterOpenedNaClExecutableFile, - nacl_host_message_filter, - Passed(file.Pass()), file_path, reply_msg, - static_cast<WriteFileInfoReply>( - NaClHostMsg_OpenNaClExecutable::WriteReplyParams))); + base::Bind(&DoRegisterOpenedNaClExecutableFile, + nacl_host_message_filter, Passed(std::move(file)), + file_path, reply_msg, + static_cast<WriteFileInfoReply>( + NaClHostMsg_OpenNaClExecutable::WriteReplyParams))); } else { - IPC::PlatformFileForTransit file_desc = - IPC::TakeFileHandleForProcess(file.Pass(), - nacl_host_message_filter->PeerHandle()); + IPC::PlatformFileForTransit file_desc = IPC::TakeFileHandleForProcess( + std::move(file), nacl_host_message_filter->PeerHandle()); uint64_t dummy_file_token = 0; NaClHostMsg_OpenNaClExecutable::WriteReplyParams( reply_msg, file_desc, dummy_file_token, dummy_file_token); diff --git a/components/nacl/browser/nacl_host_message_filter.cc b/components/nacl/browser/nacl_host_message_filter.cc index c4f5d5f..a29103f 100644 --- a/components/nacl/browser/nacl_host_message_filter.cc +++ b/components/nacl/browser/nacl_host_message_filter.cc @@ -6,6 +6,7 @@ #include <stddef.h> #include <stdint.h> +#include <utility> #include "base/sys_info.h" #include "build/build_config.h" @@ -224,9 +225,8 @@ void NaClHostMessageFilter::BatchOpenResourceFiles( continue; prefetched_resource_files.push_back(NaClResourcePrefetchResult( - IPC::TakeFileHandleForProcess(file.Pass(), PeerHandle()), - file_path_metadata, - request_list[i].file_key)); + IPC::TakeFileHandleForProcess(std::move(file), PeerHandle()), + file_path_metadata, request_list[i].file_key)); if (prefetched_resource_files.size() >= kMaxPreOpenResourceFiles) break; @@ -324,7 +324,7 @@ void NaClHostMessageFilter::SyncReturnTemporaryFile( if (file.IsValid()) { NaClHostMsg_NaClCreateTemporaryFile::WriteReplyParams( reply_msg, - IPC::TakeFileHandleForProcess(file.Pass(), PeerHandle())); + IPC::TakeFileHandleForProcess(std::move(file), PeerHandle())); } else { reply_msg->set_reply_error(); } diff --git a/components/nacl/browser/nacl_process_host.cc b/components/nacl/browser/nacl_process_host.cc index 6de7817..41e337a 100644 --- a/components/nacl/browser/nacl_process_host.cc +++ b/components/nacl/browser/nacl_process_host.cc @@ -5,9 +5,9 @@ #include "components/nacl/browser/nacl_process_host.h" #include <string.h> - #include <algorithm> #include <string> +#include <utility> #include <vector> #include "base/base_switches.h" @@ -289,7 +289,7 @@ NaClProcessHost::NaClProcessHost( NaClAppProcessType process_type, const base::FilePath& profile_directory) : manifest_url_(manifest_url), - nexe_file_(nexe_file.Pass()), + nexe_file_(std::move(nexe_file)), nexe_token_(nexe_token), prefetched_resource_files_(prefetched_resource_files), permissions_(permissions), @@ -350,21 +350,18 @@ NaClProcessHost::~NaClProcessHost() { base::File file(IPC::PlatformFileForTransitToFile( prefetched_resource_files_[i].file)); content::BrowserThread::GetBlockingPool()->PostTask( - FROM_HERE, - base::Bind(&CloseFile, base::Passed(file.Pass()))); + FROM_HERE, base::Bind(&CloseFile, base::Passed(std::move(file)))); } #endif base::File files_to_close[] = { - nexe_file_.Pass(), - socket_for_renderer_.Pass(), - socket_for_sel_ldr_.Pass(), + std::move(nexe_file_), std::move(socket_for_renderer_), + std::move(socket_for_sel_ldr_), }; // Open files need to be closed on the blocking pool. for (auto& file : files_to_close) { if (file.IsValid()) { content::BrowserThread::GetBlockingPool()->PostTask( - FROM_HERE, - base::Bind(&CloseFile, base::Passed(file.Pass()))); + FROM_HERE, base::Bind(&CloseFile, base::Passed(std::move(file)))); } } @@ -751,7 +748,7 @@ void NaClProcessHost::ReplyToRenderer( // First, create an |imc_channel_handle| for the renderer. IPC::PlatformFileForTransit imc_handle_for_renderer = - IPC::TakeFileHandleForProcess(socket_for_renderer_.Pass(), + IPC::TakeFileHandleForProcess(std::move(socket_for_renderer_), nacl_host_message_filter_->PeerHandle()); if (imc_handle_for_renderer == IPC::InvalidPlatformFileForTransit()) { // Failed to create the handle. @@ -916,8 +913,8 @@ bool NaClProcessHost::StartNaClExecution() { params.enable_debug_stub = enable_nacl_debug; const ChildProcessData& data = process_->GetData(); - params.imc_bootstrap_handle = - IPC::TakeFileHandleForProcess(socket_for_sel_ldr_.Pass(), data.handle); + params.imc_bootstrap_handle = IPC::TakeFileHandleForProcess( + std::move(socket_for_sel_ldr_), data.handle); if (params.imc_bootstrap_handle == IPC::InvalidPlatformFileForTransit()) { return false; } @@ -1031,14 +1028,13 @@ void NaClProcessHost::StartNaClFileResolved( // Release the file received from the renderer. This has to be done on a // thread where IO is permitted, though. content::BrowserThread::GetBlockingPool()->PostTask( - FROM_HERE, - base::Bind(&CloseFile, base::Passed(nexe_file_.Pass()))); + FROM_HERE, base::Bind(&CloseFile, base::Passed(std::move(nexe_file_)))); params.nexe_file_path_metadata = file_path; params.nexe_file = IPC::TakeFileHandleForProcess( - checked_nexe_file.Pass(), process_->GetData().handle); + std::move(checked_nexe_file), process_->GetData().handle); } else { params.nexe_file = IPC::TakeFileHandleForProcess( - nexe_file_.Pass(), process_->GetData().handle); + std::move(nexe_file_), process_->GetData().handle); } #if defined(OS_LINUX) @@ -1076,7 +1072,7 @@ void NaClProcessHost::StartNaClFileResolved( } if (!has_error && - !StartPPAPIProxy(ppapi_browser_client_channel_handle.Pass())) { + !StartPPAPIProxy(std::move(ppapi_browser_client_channel_handle))) { SendErrorToRenderer("Failed to start browser PPAPI proxy."); has_error = true; } @@ -1085,9 +1081,9 @@ void NaClProcessHost::StartNaClFileResolved( // On success, send back a success message to the renderer process, // and transfer the channel handles for the NaCl loader process to // |params|. - ReplyToRenderer(ppapi_renderer_client_channel_handle.Pass(), - trusted_service_client_channel_handle.Pass(), - manifest_service_client_channel_handle.Pass()); + ReplyToRenderer(std::move(ppapi_renderer_client_channel_handle), + std::move(trusted_service_client_channel_handle), + std::move(manifest_service_client_channel_handle)); params.ppapi_browser_channel_handle = ppapi_browser_server_channel_handle.release(); params.ppapi_renderer_channel_handle = @@ -1197,15 +1193,15 @@ void NaClProcessHost::OnPpapiChannelsCreated( ScopedChannelHandle manifest_service_channel_handle( raw_manifest_service_channel_handle); - if (!StartPPAPIProxy(ppapi_browser_channel_handle.Pass())) { + if (!StartPPAPIProxy(std::move(ppapi_browser_channel_handle))) { SendErrorToRenderer("Browser PPAPI proxy could not start."); return; } // Let the renderer know that the IPC channels are established. - ReplyToRenderer(ppapi_renderer_channel_handle.Pass(), - trusted_renderer_channel_handle.Pass(), - manifest_service_channel_handle.Pass()); + ReplyToRenderer(std::move(ppapi_renderer_channel_handle), + std::move(trusted_renderer_channel_handle), + std::move(manifest_service_channel_handle)); } bool NaClProcessHost::StartWithLaunchedProcess() { @@ -1301,9 +1297,8 @@ void NaClProcessHost::FileResolved( IPC::PlatformFileForTransit out_handle; if (file.IsValid()) { out_file_path = file_path; - out_handle = IPC::TakeFileHandleForProcess( - file.Pass(), - process_->GetData().handle); + out_handle = IPC::TakeFileHandleForProcess(std::move(file), + process_->GetData().handle); } else { out_handle = IPC::InvalidPlatformFileForTransit(); } diff --git a/components/nacl/browser/pnacl_host.cc b/components/nacl/browser/pnacl_host.cc index a0375e2..f5f18f3 100644 --- a/components/nacl/browser/pnacl_host.cc +++ b/components/nacl/browser/pnacl_host.cc @@ -4,6 +4,8 @@ #include "components/nacl/browser/pnacl_host.h" +#include <utility> + #include "base/bind.h" #include "base/bind_helpers.h" #include "base/files/file_path.h" @@ -50,9 +52,7 @@ class FileProxy { FileProxy::FileProxy(scoped_ptr<base::File> file, base::WeakPtr<pnacl::PnaclHost> host) - : file_(file.Pass()), - host_(host) { -} + : file_(std::move(file)), host_(host) {} int FileProxy::Write(scoped_refptr<net::DrainableIOBuffer> buffer) { int rv = file_->Write(0, buffer->data(), buffer->size()); @@ -63,7 +63,7 @@ int FileProxy::Write(scoped_refptr<net::DrainableIOBuffer> buffer) { void FileProxy::WriteDone(const PnaclHost::TranslationID& id, int result) { if (host_) { - host_->OnBufferCopiedToTempFile(id, file_.Pass(), result); + host_->OnBufferCopiedToTempFile(id, std::move(file_), result); } else { BrowserThread::PostBlockingPoolTask( FROM_HERE, @@ -207,8 +207,8 @@ void PnaclHost::DoCreateTemporaryFile(base::FilePath temp_dir, if (!file.IsValid()) PLOG(ERROR) << "Temp file open failed: " << file.error_details(); } - BrowserThread::PostTask( - BrowserThread::IO, FROM_HERE, base::Bind(cb, Passed(file.Pass()))); + BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, + base::Bind(cb, Passed(std::move(file)))); } void PnaclHost::CreateTemporaryFile(TempFileCallback cb) { @@ -331,7 +331,7 @@ void PnaclHost::OnTempFileReturn(const TranslationID& id, // file was being created. LOG(ERROR) << "OnTempFileReturn: id not found"; BrowserThread::PostBlockingPoolTask( - FROM_HERE, base::Bind(CloseBaseFile, Passed(file.Pass()))); + FROM_HERE, base::Bind(CloseBaseFile, Passed(std::move(file)))); return; } if (!file.IsValid()) { @@ -349,7 +349,7 @@ void PnaclHost::OnTempFileReturn(const TranslationID& id, } PendingTranslation* pt = &entry->second; pt->got_nexe_fd = true; - pt->nexe_fd = new base::File(file.Pass()); + pt->nexe_fd = new base::File(std::move(file)); CheckCacheQueryReady(entry); } @@ -385,7 +385,7 @@ void PnaclHost::CheckCacheQueryReady( scoped_ptr<base::File> file(pt->nexe_fd); pt->nexe_fd = NULL; pt->got_nexe_fd = false; - FileProxy* proxy(new FileProxy(file.Pass(), weak_factory_.GetWeakPtr())); + FileProxy* proxy(new FileProxy(std::move(file), weak_factory_.GetWeakPtr())); if (!base::PostTaskAndReplyWithResult( BrowserThread::GetBlockingPool(), diff --git a/components/nacl/loader/nacl_ipc_adapter.cc b/components/nacl/loader/nacl_ipc_adapter.cc index 14db5f9..d8ac1c7 100644 --- a/components/nacl/loader/nacl_ipc_adapter.cc +++ b/components/nacl/loader/nacl_ipc_adapter.cc @@ -6,6 +6,7 @@ #include <limits.h> #include <string.h> +#include <utility> #include "base/bind.h" #include "base/location.h" @@ -365,7 +366,7 @@ NaClIPCAdapter::NaClIPCAdapter(scoped_ptr<IPC::Channel> channel, cond_var_(&lock_), task_runner_(runner), locked_data_() { - io_thread_data_.channel_ = channel.Pass(); + io_thread_data_.channel_ = std::move(channel); } void NaClIPCAdapter::ConnectChannel() { @@ -636,7 +637,7 @@ scoped_ptr<IPC::Message> CreateOpenResourceReply( // Write empty file tokens. new_msg->WriteUInt64(0); // token_lo new_msg->WriteUInt64(0); // token_hi - return new_msg.Pass(); + return new_msg; } void NaClIPCAdapter::SaveOpenResourceMessage( diff --git a/components/nacl/loader/nacl_main.cc b/components/nacl/loader/nacl_main.cc index f0c7cbf..fdf680e 100644 --- a/components/nacl/loader/nacl_main.cc +++ b/components/nacl/loader/nacl_main.cc @@ -2,13 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "build/build_config.h" +#include <utility> #include "base/command_line.h" #include "base/message_loop/message_loop.h" #include "base/power_monitor/power_monitor.h" #include "base/power_monitor/power_monitor_device_source.h" #include "base/timer/hi_res_timer_manager.h" +#include "build/build_config.h" #include "components/nacl/loader/nacl_listener.h" #include "components/nacl/loader/nacl_main_platform_delegate.h" #include "content/public/common/content_switches.h" @@ -24,7 +25,7 @@ int NaClMain(const content::MainFunctionParams& parameters) { scoped_ptr<base::PowerMonitorSource> power_monitor_source( new base::PowerMonitorDeviceSource()); - base::PowerMonitor power_monitor(power_monitor_source.Pass()); + base::PowerMonitor power_monitor(std::move(power_monitor_source)); base::HighResolutionTimerManager hi_res_timer_manager; #if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_LINUX) || \ diff --git a/components/nacl/loader/nacl_trusted_listener.cc b/components/nacl/loader/nacl_trusted_listener.cc index 2881a02..771dd7d 100644 --- a/components/nacl/loader/nacl_trusted_listener.cc +++ b/components/nacl/loader/nacl_trusted_listener.cc @@ -38,12 +38,10 @@ NaClTrustedListener::NaClTrustedListener( base::SingleThreadTaskRunner* ipc_task_runner, base::WaitableEvent* shutdown_event) : channel_handle_(handle) { - channel_ = IPC::SyncChannel::Create(handle, - IPC::Channel::MODE_SERVER, - this, - ipc_task_runner, - true, /* create_channel_now */ - shutdown_event).Pass(); + channel_ = + IPC::SyncChannel::Create(handle, IPC::Channel::MODE_SERVER, this, + ipc_task_runner, true, /* create_channel_now */ + shutdown_event); channel_->AddFilter(new EOFMessageFilter()); } diff --git a/components/nacl/loader/sandbox_linux/nacl_bpf_sandbox_linux.cc b/components/nacl/loader/sandbox_linux/nacl_bpf_sandbox_linux.cc index 4083a3b..66a606a 100644 --- a/components/nacl/loader/sandbox_linux/nacl_bpf_sandbox_linux.cc +++ b/components/nacl/loader/sandbox_linux/nacl_bpf_sandbox_linux.cc @@ -4,6 +4,8 @@ #include "components/nacl/loader/sandbox_linux/nacl_bpf_sandbox_linux.h" +#include <utility> + #include "base/macros.h" #include "build/build_config.h" @@ -166,7 +168,7 @@ bool InitializeBPFSandbox(base::ScopedFD proc_fd) { #if defined(USE_SECCOMP_BPF) bool sandbox_is_initialized = content::InitializeSandbox( scoped_ptr<sandbox::bpf_dsl::Policy>(new NaClBPFSandboxPolicy), - proc_fd.Pass()); + std::move(proc_fd)); if (sandbox_is_initialized) { RunSandboxSanityChecks(); return true; diff --git a/components/nacl/loader/sandbox_linux/nacl_sandbox_linux.cc b/components/nacl/loader/sandbox_linux/nacl_sandbox_linux.cc index b66330d..3b7e07f 100644 --- a/components/nacl/loader/sandbox_linux/nacl_sandbox_linux.cc +++ b/components/nacl/loader/sandbox_linux/nacl_sandbox_linux.cc @@ -11,8 +11,8 @@ #include <sys/stat.h> #include <sys/types.h> #include <unistd.h> - #include <limits> +#include <utility> #include "base/callback.h" #include "base/command_line.h" @@ -191,7 +191,7 @@ void NaClSandbox::InitializeLayerTwoSandbox(bool uses_nonsfi_mode) { layer_two_is_nonsfi_ = true; #else CHECK(!uses_nonsfi_mode); - layer_two_enabled_ = nacl::InitializeBPFSandbox(proc_fd_.Pass()); + layer_two_enabled_ = nacl::InitializeBPFSandbox(std::move(proc_fd_)); #endif } diff --git a/components/nacl/renderer/file_downloader.cc b/components/nacl/renderer/file_downloader.cc index b2771f2..fa94d84 100644 --- a/components/nacl/renderer/file_downloader.cc +++ b/components/nacl/renderer/file_downloader.cc @@ -4,6 +4,8 @@ #include "components/nacl/renderer/file_downloader.h" +#include <utility> + #include "base/callback.h" #include "components/nacl/renderer/nexe_load_manager.h" #include "net/base/net_errors.h" @@ -17,8 +19,8 @@ FileDownloader::FileDownloader(scoped_ptr<blink::WebURLLoader> url_loader, base::File file, StatusCallback status_cb, ProgressCallback progress_cb) - : url_loader_(url_loader.Pass()), - file_(file.Pass()), + : url_loader_(std::move(url_loader)), + file_(std::move(file)), status_cb_(status_cb), progress_cb_(progress_cb), http_status_code_(-1), @@ -74,7 +76,7 @@ void FileDownloader::didFinishLoading( if (file_.Seek(base::File::FROM_BEGIN, 0) != 0) status_ = FAILED; } - status_cb_.Run(status_, file_.Pass(), http_status_code_); + status_cb_.Run(status_, std::move(file_), http_status_code_); delete this; } @@ -98,7 +100,7 @@ void FileDownloader::didFail( // some implementations of blink::WebURLLoader will do after calling didFail. url_loader_.reset(); - status_cb_.Run(status_, file_.Pass(), http_status_code_); + status_cb_.Run(status_, std::move(file_), http_status_code_); delete this; } diff --git a/components/nacl/renderer/manifest_downloader.cc b/components/nacl/renderer/manifest_downloader.cc index a3721ff..1aa8995 100644 --- a/components/nacl/renderer/manifest_downloader.cc +++ b/components/nacl/renderer/manifest_downloader.cc @@ -4,6 +4,8 @@ #include "components/nacl/renderer/manifest_downloader.h" +#include <utility> + #include "base/callback.h" #include "components/nacl/renderer/histogram.h" #include "components/nacl/renderer/nexe_load_manager.h" @@ -18,7 +20,7 @@ ManifestDownloader::ManifestDownloader( scoped_ptr<blink::WebURLLoader> url_loader, bool is_installed, Callback cb) - : url_loader_(url_loader.Pass()), + : url_loader_(std::move(url_loader)), is_installed_(is_installed), cb_(cb), status_code_(-1), diff --git a/components/nacl/renderer/manifest_service_channel.cc b/components/nacl/renderer/manifest_service_channel.cc index 249737f..be9ccbe 100644 --- a/components/nacl/renderer/manifest_service_channel.cc +++ b/components/nacl/renderer/manifest_service_channel.cc @@ -4,6 +4,8 @@ #include "components/nacl/renderer/manifest_service_channel.h" +#include <utility> + #include "base/bind.h" #include "base/callback.h" #include "base/callback_helpers.h" @@ -24,7 +26,7 @@ ManifestServiceChannel::ManifestServiceChannel( scoped_ptr<Delegate> delegate, base::WaitableEvent* waitable_event) : connected_callback_(connected_callback), - delegate_(delegate.Pass()), + delegate_(std::move(delegate)), channel_(IPC::SyncChannel::Create( handle, IPC::Channel::MODE_CLIENT, @@ -33,8 +35,7 @@ ManifestServiceChannel::ManifestServiceChannel( true, waitable_event)), peer_pid_(base::kNullProcessId), - weak_ptr_factory_(this) { -} + weak_ptr_factory_(this) {} ManifestServiceChannel::~ManifestServiceChannel() { if (!connected_callback_.is_null()) @@ -97,7 +98,7 @@ void ManifestServiceChannel::DidOpenResource(IPC::Message* reply, if (ok) handle.set_file_handle(file_for_transit, PP_FILEOPENFLAG_READ, 0); #else - file_for_transit = base::FileDescriptor(file.Pass()); + file_for_transit = base::FileDescriptor(std::move(file)); handle.set_file_handle(file_for_transit, PP_FILEOPENFLAG_READ, 0); #endif } diff --git a/components/nacl/renderer/nexe_load_manager.cc b/components/nacl/renderer/nexe_load_manager.cc index 59910bb..f5adbc1 100644 --- a/components/nacl/renderer/nexe_load_manager.cc +++ b/components/nacl/renderer/nexe_load_manager.cc @@ -5,6 +5,7 @@ #include "components/nacl/renderer/nexe_load_manager.h" #include <stddef.h> +#include <utility> #include "base/command_line.h" #include "base/logging.h" @@ -287,12 +288,12 @@ void NexeLoadManager::NexeDidCrash() { void NexeLoadManager::set_trusted_plugin_channel( scoped_ptr<TrustedPluginChannel> channel) { - trusted_plugin_channel_ = channel.Pass(); + trusted_plugin_channel_ = std::move(channel); } void NexeLoadManager::set_manifest_service_channel( scoped_ptr<ManifestServiceChannel> channel) { - manifest_service_channel_ = channel.Pass(); + manifest_service_channel_ = std::move(channel); } PP_NaClReadyState NexeLoadManager::nacl_ready_state() { diff --git a/components/nacl/renderer/ppb_nacl_private_impl.cc b/components/nacl/renderer/ppb_nacl_private_impl.cc index 7e191dc..6cbdfe4 100644 --- a/components/nacl/renderer/ppb_nacl_private_impl.cc +++ b/components/nacl/renderer/ppb_nacl_private_impl.cc @@ -6,9 +6,9 @@ #include <stddef.h> #include <stdint.h> - #include <numeric> #include <string> +#include <utility> #include <vector> #include "base/bind.h" @@ -537,7 +537,7 @@ void LaunchSelLdr(PP_Instance instance, launch_result.trusted_ipc_channel_handle, content::RenderThread::Get()->GetShutdownEvent(), is_helper_nexe)); - load_manager->set_trusted_plugin_channel(trusted_plugin_channel.Pass()); + load_manager->set_trusted_plugin_channel(std::move(trusted_plugin_channel)); } else { PostPPCompletionCallback(callback, PP_ERROR_FAILED); return; @@ -549,10 +549,10 @@ void LaunchSelLdr(PP_Instance instance, new ManifestServiceChannel( launch_result.manifest_service_ipc_channel_handle, base::Bind(&PostPPCompletionCallback, callback), - manifest_service_proxy.Pass(), + std::move(manifest_service_proxy), content::RenderThread::Get()->GetShutdownEvent())); load_manager->set_manifest_service_channel( - manifest_service_channel.Pass()); + std::move(manifest_service_channel)); } } @@ -575,7 +575,7 @@ PP_Bool StartPpapiProxy(PP_Instance instance) { return PP_FALSE; } scoped_ptr<InstanceInfo> instance_info = - nacl_plugin_instance->instance_info.Pass(); + std::move(nacl_plugin_instance->instance_info); PP_ExternalPluginResult result = plugin_instance->SwitchToOutOfProcessProxy( base::FilePath().AppendASCII(instance_info->url.spec()), @@ -863,7 +863,7 @@ void InstanceCreated(PP_Instance instance) { InstanceMap& map = g_instance_map.Get(); CHECK(map.find(instance) == map.end()); // Sanity check. scoped_ptr<NaClPluginInstance> new_instance(new NaClPluginInstance(instance)); - map.add(instance, new_instance.Pass()); + map.add(instance, std::move(new_instance)); } void InstanceDestroyed(PP_Instance instance) { @@ -1006,10 +1006,9 @@ void DownloadManifestToBuffer(PP_Instance instance, // ManifestDownloader deletes itself after invoking the callback. ManifestDownloader* manifest_downloader = new ManifestDownloader( - url_loader.Pass(), - load_manager->is_installed(), - base::Bind(DownloadManifestToBufferCompletion, - instance, callback, base::Time::Now())); + std::move(url_loader), load_manager->is_installed(), + base::Bind(DownloadManifestToBufferCompletion, instance, callback, + base::Time::Now())); manifest_downloader->Load(request); } @@ -1348,8 +1347,7 @@ void DownloadNexe(PP_Instance instance, // FileDownloader deletes itself after invoking DownloadNexeCompletion. FileDownloader* file_downloader = new FileDownloader( - url_loader.Pass(), - target_file.Pass(), + std::move(url_loader), std::move(target_file), base::Bind(&DownloadNexeCompletion, request, out_file_info), base::Bind(&ProgressEventRateLimiter::ReportProgress, base::Owned(tracker), std::string(url))); @@ -1497,12 +1495,11 @@ void DownloadFile(PP_Instance instance, ProgressEventRateLimiter* tracker = new ProgressEventRateLimiter(instance); // FileDownloader deletes itself after invoking DownloadNexeCompletion. - FileDownloader* file_downloader = new FileDownloader( - url_loader.Pass(), - target_file.Pass(), - base::Bind(&DownloadFileCompletion, callback), - base::Bind(&ProgressEventRateLimiter::ReportProgress, - base::Owned(tracker), std::string(url))); + FileDownloader* file_downloader = + new FileDownloader(std::move(url_loader), std::move(target_file), + base::Bind(&DownloadFileCompletion, callback), + base::Bind(&ProgressEventRateLimiter::ReportProgress, + base::Owned(tracker), std::string(url))); file_downloader->Load(url_request); } @@ -1545,7 +1542,7 @@ class PexeDownloader : public blink::WebURLLoaderClient { const PPP_PexeStreamHandler* stream_handler, void* stream_handler_user_data) : instance_(instance), - url_loader_(url_loader.Pass()), + url_loader_(std::move(url_loader)), pexe_url_(pexe_url), pexe_opt_level_(pexe_opt_level), use_subzero_(use_subzero), @@ -1686,7 +1683,7 @@ void StreamPexe(PP_Instance instance, scoped_ptr<blink::WebURLLoader> url_loader( CreateWebURLLoader(document, gurl)); PexeDownloader* downloader = - new PexeDownloader(instance, url_loader.Pass(), pexe_url, opt_level, + new PexeDownloader(instance, std::move(url_loader), pexe_url, opt_level, PP_ToBool(use_subzero), handler, handler_user_data); blink::WebURLRequest url_request = CreateWebURLRequest(document, gurl); diff --git a/components/nacl/renderer/trusted_plugin_channel.cc b/components/nacl/renderer/trusted_plugin_channel.cc index 1ba39fe..8428cbb 100644 --- a/components/nacl/renderer/trusted_plugin_channel.cc +++ b/components/nacl/renderer/trusted_plugin_channel.cc @@ -23,12 +23,9 @@ TrustedPluginChannel::TrustedPluginChannel( : nexe_load_manager_(nexe_load_manager), is_helper_nexe_(is_helper_nexe) { channel_ = IPC::SyncChannel::Create( - handle, - IPC::Channel::MODE_CLIENT, - this, - content::RenderThread::Get()->GetIOMessageLoopProxy(), - true, - shutdown_event).Pass(); + handle, IPC::Channel::MODE_CLIENT, this, + content::RenderThread::Get()->GetIOMessageLoopProxy(), true, + shutdown_event); } TrustedPluginChannel::~TrustedPluginChannel() { diff --git a/components/navigation_interception/intercept_navigation_throttle_unittest.cc b/components/navigation_interception/intercept_navigation_throttle_unittest.cc index 8c15876..f3096de 100644 --- a/components/navigation_interception/intercept_navigation_throttle_unittest.cc +++ b/components/navigation_interception/intercept_navigation_throttle_unittest.cc @@ -62,14 +62,11 @@ class InterceptNavigationThrottleTest content::NavigationHandle::CreateNavigationHandleForTesting( url, main_rfh()); test_handle->RegisterThrottleForTesting( - scoped_ptr<NavigationThrottle>( - new InterceptNavigationThrottle( - test_handle.get(), - base::Bind( - &MockInterceptCallbackReceiver::ShouldIgnoreNavigation, - base::Unretained(mock_callback_receiver_.get())), - true)) - .Pass()); + scoped_ptr<NavigationThrottle>(new InterceptNavigationThrottle( + test_handle.get(), + base::Bind(&MockInterceptCallbackReceiver::ShouldIgnoreNavigation, + base::Unretained(mock_callback_receiver_.get())), + true))); return test_handle->CallWillStartRequestForTesting( is_post, content::Referrer(), false, ui::PAGE_TRANSITION_LINK, false); } @@ -79,14 +76,11 @@ class InterceptNavigationThrottleTest content::NavigationHandle::CreateNavigationHandleForTesting( GURL(kTestUrl), main_rfh()); test_handle->RegisterThrottleForTesting( - scoped_ptr<NavigationThrottle>( - new InterceptNavigationThrottle( - test_handle.get(), - base::Bind( - &MockInterceptCallbackReceiver::ShouldIgnoreNavigation, - base::Unretained(mock_callback_receiver_.get())), - true)) - .Pass()); + scoped_ptr<NavigationThrottle>(new InterceptNavigationThrottle( + test_handle.get(), + base::Bind(&MockInterceptCallbackReceiver::ShouldIgnoreNavigation, + base::Unretained(mock_callback_receiver_.get())), + true))); test_handle->CallWillStartRequestForTesting( true, content::Referrer(), false, ui::PAGE_TRANSITION_LINK, false); return test_handle->CallWillRedirectRequestForTesting(GURL(kTestUrl), false, diff --git a/components/net_log/chrome_net_log.cc b/components/net_log/chrome_net_log.cc index ad3c2d5..f17908f 100644 --- a/components/net_log/chrome_net_log.cc +++ b/components/net_log/chrome_net_log.cc @@ -5,6 +5,7 @@ #include "components/net_log/chrome_net_log.h" #include <stdio.h> +#include <utility> #include "base/command_line.h" #include "base/files/scoped_file.h" @@ -54,7 +55,7 @@ ChromeNetLog::ChromeNetLog( write_to_file_observer_->set_capture_mode(log_file_mode); - write_to_file_observer_->StartObserving(this, file.Pass(), + write_to_file_observer_->StartObserving(this, std::move(file), constants.get(), nullptr); } } diff --git a/components/net_log/net_log_temp_file.cc b/components/net_log/net_log_temp_file.cc index e775567..d4643ad 100644 --- a/components/net_log/net_log_temp_file.cc +++ b/components/net_log/net_log_temp_file.cc @@ -4,6 +4,8 @@ #include "components/net_log/net_log_temp_file.h" +#include <utility> + #include "base/files/file_path.h" #include "base/files/file_util.h" #include "base/files/scoped_file.h" @@ -188,7 +190,7 @@ void NetLogTempFile::StartNetLog(LogType log_type) { ChromeNetLog::GetConstants(command_line_string_, channel_string_)); write_to_file_observer_.reset(new net::WriteToFileNetLogObserver()); write_to_file_observer_->set_capture_mode(GetCaptureModeForLogType(log_type)); - write_to_file_observer_->StartObserving(chrome_net_log_, file.Pass(), + write_to_file_observer_->StartObserving(chrome_net_log_, std::move(file), constants.get(), nullptr); } diff --git a/components/network_time/network_time_tracker.cc b/components/network_time/network_time_tracker.cc index 17efaff..470a8e8 100644 --- a/components/network_time/network_time_tracker.cc +++ b/components/network_time/network_time_tracker.cc @@ -5,6 +5,7 @@ #include "components/network_time/network_time_tracker.h" #include <stdint.h> +#include <utility> #include "base/i18n/time_formatting.h" #include "base/logging.h" @@ -39,7 +40,7 @@ void NetworkTimeTracker::RegisterPrefs(PrefRegistrySimple* registry) { NetworkTimeTracker::NetworkTimeTracker(scoped_ptr<base::TickClock> tick_clock, PrefService* pref_service) - : tick_clock_(tick_clock.Pass()), + : tick_clock_(std::move(tick_clock)), pref_service_(pref_service), received_network_time_(false) { const base::DictionaryValue* time_mapping = diff --git a/components/offline_pages/offline_page_metadata_store_impl.cc b/components/offline_pages/offline_page_metadata_store_impl.cc index 4d465cf..5262063 100644 --- a/components/offline_pages/offline_page_metadata_store_impl.cc +++ b/components/offline_pages/offline_page_metadata_store_impl.cc @@ -5,6 +5,7 @@ #include "components/offline_pages/offline_page_metadata_store_impl.h" #include <string> +#include <utility> #include <vector> #include "base/bind.h" @@ -189,7 +190,8 @@ void OfflinePageMetadataStoreImpl::AddOrUpdateOfflinePage( std::make_pair(base::Int64ToString(offline_page_item.bookmark_id), offline_page_proto)); - UpdateEntries(entries_to_save.Pass(), keys_to_remove.Pass(), callback); + UpdateEntries(std::move(entries_to_save), std::move(keys_to_remove), + callback); } void OfflinePageMetadataStoreImpl::RemoveOfflinePages( @@ -203,7 +205,8 @@ void OfflinePageMetadataStoreImpl::RemoveOfflinePages( for (int64_t id : bookmark_ids) keys_to_remove->push_back(base::Int64ToString(id)); - UpdateEntries(entries_to_save.Pass(), keys_to_remove.Pass(), callback); + UpdateEntries(std::move(entries_to_save), std::move(keys_to_remove), + callback); } void OfflinePageMetadataStoreImpl::UpdateEntries( @@ -222,10 +225,9 @@ void OfflinePageMetadataStoreImpl::UpdateEntries( } database_->UpdateEntries( - entries_to_save.Pass(), keys_to_remove.Pass(), + std::move(entries_to_save), std::move(keys_to_remove), base::Bind(&OfflinePageMetadataStoreImpl::UpdateDone, - weak_ptr_factory_.GetWeakPtr(), - callback)); + weak_ptr_factory_.GetWeakPtr(), callback)); } void OfflinePageMetadataStoreImpl::UpdateDone( diff --git a/components/offline_pages/offline_page_metadata_store_impl_unittest.cc b/components/offline_pages/offline_page_metadata_store_impl_unittest.cc index 01b5f3c..412ae2a 100644 --- a/components/offline_pages/offline_page_metadata_store_impl_unittest.cc +++ b/components/offline_pages/offline_page_metadata_store_impl_unittest.cc @@ -85,7 +85,7 @@ OfflinePageMetadataStoreImplTest::BuildStore() { store->Load(base::Bind(&OfflinePageMetadataStoreImplTest::LoadCallback, base::Unretained(this))); PumpLoop(); - return store.Pass(); + return store; } void OfflinePageMetadataStoreImplTest::LoadCallback( @@ -138,7 +138,7 @@ TEST_F(OfflinePageMetadataStoreImplTest, AddOfflinePage) { // Close the store first to ensure file lock is removed. store.reset(); - store = BuildStore().Pass(); + store = BuildStore(); PumpLoop(); EXPECT_EQ(LOAD, last_called_callback_); @@ -203,7 +203,7 @@ TEST_F(OfflinePageMetadataStoreImplTest, RemoveOfflinePage) { // Close and reload the store. store.reset(); - store = BuildStore().Pass(); + store = BuildStore(); EXPECT_EQ(LOAD, last_called_callback_); EXPECT_EQ(STATUS_TRUE, last_status_); EXPECT_EQ(0U, offline_pages_.size()); @@ -265,7 +265,7 @@ TEST_F(OfflinePageMetadataStoreImplTest, AddRemoveMultipleOfflinePages) { // Close and reload the store. store.reset(); - store = BuildStore().Pass(); + store = BuildStore(); store->Load(base::Bind(&OfflinePageMetadataStoreImplTest::LoadCallback, base::Unretained(this))); PumpLoop(); diff --git a/components/offline_pages/offline_page_model.cc b/components/offline_pages/offline_page_model.cc index ffb5872..18b656c 100644 --- a/components/offline_pages/offline_page_model.cc +++ b/components/offline_pages/offline_page_model.cc @@ -117,7 +117,7 @@ OfflinePageModel::OfflinePageModel( scoped_ptr<OfflinePageMetadataStore> store, const base::FilePath& archives_dir, const scoped_refptr<base::SequencedTaskRunner>& task_runner) - : store_(store.Pass()), + : store_(std::move(store)), archives_dir_(archives_dir), is_loaded_(false), task_runner_(task_runner), @@ -166,7 +166,7 @@ void OfflinePageModel::SavePage(const GURL& url, base::Bind(&OfflinePageModel::OnCreateArchiveDone, weak_ptr_factory_.GetWeakPtr(), url, bookmark_id, base::Time::Now(), callback)); - pending_archivers_.push_back(archiver.Pass()); + pending_archivers_.push_back(std::move(archiver)); } void OfflinePageModel::MarkPageAccessed(int64_t bookmark_id) { diff --git a/components/offline_pages/offline_page_model_unittest.cc b/components/offline_pages/offline_page_model_unittest.cc index aa2797b..0f5aeb7 100644 --- a/components/offline_pages/offline_page_model_unittest.cc +++ b/components/offline_pages/offline_page_model_unittest.cc @@ -5,8 +5,8 @@ #include "components/offline_pages/offline_page_model.h" #include <stdint.h> - #include <algorithm> +#include <utility> #include "base/bind.h" #include "base/files/file_util.h" @@ -138,7 +138,7 @@ OfflinePageModelTest::~OfflinePageModelTest() { void OfflinePageModelTest::SetUp() { ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); - model_ = BuildModel(BuildStore().Pass()).Pass(); + model_ = BuildModel(BuildStore()); model_->AddObserver(this); PumpLoop(); } @@ -197,7 +197,7 @@ scoped_ptr<OfflinePageMetadataStore> OfflinePageModelTest::BuildStore() { scoped_ptr<OfflinePageModel> OfflinePageModelTest::BuildModel( scoped_ptr<OfflinePageMetadataStore> store) { return scoped_ptr<OfflinePageModel>(new OfflinePageModel( - store.Pass(), temp_dir_.path(), base::ThreadTaskRunnerHandle::Get())); + std::move(store), temp_dir_.path(), base::ThreadTaskRunnerHandle::Get())); } void OfflinePageModelTest::ResetModel() { @@ -205,7 +205,7 @@ void OfflinePageModelTest::ResetModel() { OfflinePageTestStore* old_store = GetStore(); scoped_ptr<OfflinePageMetadataStore> new_store( new OfflinePageTestStore(*old_store)); - model_ = BuildModel(new_store.Pass()).Pass(); + model_ = BuildModel(std::move(new_store)); model_->AddObserver(this); PumpLoop(); } @@ -239,10 +239,9 @@ void OfflinePageModelTest::SavePageWithArchiverResult( const GURL& url, int64_t bookmark_id, OfflinePageArchiver::ArchiverResult result) { - scoped_ptr<OfflinePageTestArchiver> archiver( - BuildArchiver(url, result).Pass()); + scoped_ptr<OfflinePageTestArchiver> archiver(BuildArchiver(url, result)); model()->SavePage( - url, bookmark_id, archiver.Pass(), + url, bookmark_id, std::move(archiver), base::Bind(&OfflinePageModelTest::OnSavePageDone, AsWeakPtr())); PumpLoop(); } @@ -308,10 +307,9 @@ TEST_F(OfflinePageModelTest, SavePageOfflineCreationFailed) { TEST_F(OfflinePageModelTest, SavePageOfflineArchiverReturnedWrongUrl) { scoped_ptr<OfflinePageTestArchiver> archiver( BuildArchiver(GURL("http://other.random.url.com"), - OfflinePageArchiver::ArchiverResult::SUCCESSFULLY_CREATED) - .Pass()); + OfflinePageArchiver::ArchiverResult::SUCCESSFULLY_CREATED)); model()->SavePage( - kTestUrl, kTestPageBookmarkId1, archiver.Pass(), + kTestUrl, kTestPageBookmarkId1, std::move(archiver), base::Bind(&OfflinePageModelTest::OnSavePageDone, AsWeakPtr())); PumpLoop(); EXPECT_EQ(SavePageResult::ARCHIVE_CREATION_FAILED, last_save_result()); @@ -335,16 +333,14 @@ TEST_F(OfflinePageModelTest, SavePageLocalFileFailed) { } TEST_F(OfflinePageModelTest, SavePageOfflineArchiverTwoPages) { - scoped_ptr<OfflinePageTestArchiver> archiver( - BuildArchiver(kTestUrl, - OfflinePageArchiver::ArchiverResult::SUCCESSFULLY_CREATED) - .Pass()); + scoped_ptr<OfflinePageTestArchiver> archiver(BuildArchiver( + kTestUrl, OfflinePageArchiver::ArchiverResult::SUCCESSFULLY_CREATED)); // archiver_ptr will be valid until after first PumpLoop() call after // CompleteCreateArchive() is called. OfflinePageTestArchiver* archiver_ptr = archiver.get(); archiver_ptr->set_delayed(true); model()->SavePage( - kTestUrl, kTestPageBookmarkId1, archiver.Pass(), + kTestUrl, kTestPageBookmarkId1, std::move(archiver), base::Bind(&OfflinePageModelTest::OnSavePageDone, AsWeakPtr())); EXPECT_TRUE(archiver_ptr->create_archive_called()); @@ -439,12 +435,10 @@ TEST_F(OfflinePageModelTest, MarkPageForDeletion) { } TEST_F(OfflinePageModelTest, FinalizePageDeletion) { - scoped_ptr<OfflinePageTestArchiver> archiver( - BuildArchiver(kTestUrl, - OfflinePageArchiver::ArchiverResult::SUCCESSFULLY_CREATED) - .Pass()); + scoped_ptr<OfflinePageTestArchiver> archiver(BuildArchiver( + kTestUrl, OfflinePageArchiver::ArchiverResult::SUCCESSFULLY_CREATED)); model()->SavePage( - kTestUrl, kTestPageBookmarkId1, archiver.Pass(), + kTestUrl, kTestPageBookmarkId1, std::move(archiver), base::Bind(&OfflinePageModelTest::OnSavePageDone, AsWeakPtr())); PumpLoop(); @@ -581,30 +575,24 @@ TEST_F(OfflinePageModelTest, DeleteMultiplePages) { OfflinePageTestStore* store = GetStore(); // Save 3 pages. - scoped_ptr<OfflinePageTestArchiver> archiver( - BuildArchiver(kTestUrl, - OfflinePageArchiver::ArchiverResult::SUCCESSFULLY_CREATED) - .Pass()); + scoped_ptr<OfflinePageTestArchiver> archiver(BuildArchiver( + kTestUrl, OfflinePageArchiver::ArchiverResult::SUCCESSFULLY_CREATED)); model()->SavePage( - kTestUrl, kTestPageBookmarkId1, archiver.Pass(), + kTestUrl, kTestPageBookmarkId1, std::move(archiver), base::Bind(&OfflinePageModelTest::OnSavePageDone, AsWeakPtr())); PumpLoop(); - scoped_ptr<OfflinePageTestArchiver> archiver2( - BuildArchiver(kTestUrl2, - OfflinePageArchiver::ArchiverResult::SUCCESSFULLY_CREATED) - .Pass()); + scoped_ptr<OfflinePageTestArchiver> archiver2(BuildArchiver( + kTestUrl2, OfflinePageArchiver::ArchiverResult::SUCCESSFULLY_CREATED)); model()->SavePage( - kTestUrl2, kTestPageBookmarkId2, archiver2.Pass(), + kTestUrl2, kTestPageBookmarkId2, std::move(archiver2), base::Bind(&OfflinePageModelTest::OnSavePageDone, AsWeakPtr())); PumpLoop(); - scoped_ptr<OfflinePageTestArchiver> archiver3( - BuildArchiver(kTestUrl3, - OfflinePageArchiver::ArchiverResult::SUCCESSFULLY_CREATED) - .Pass()); + scoped_ptr<OfflinePageTestArchiver> archiver3(BuildArchiver( + kTestUrl3, OfflinePageArchiver::ArchiverResult::SUCCESSFULLY_CREATED)); model()->SavePage( - kTestUrl3, kTestPageBookmarkId3, archiver3.Pass(), + kTestUrl3, kTestPageBookmarkId3, std::move(archiver3), base::Bind(&OfflinePageModelTest::OnSavePageDone, AsWeakPtr())); PumpLoop(); @@ -817,7 +805,7 @@ void OfflinePageModelBookmarkChangeTest::OnBookmarkNodeRemoved( scoped_ptr<bookmarks::BookmarkNode> node) { removed_bookmark_parent_ = parent; removed_bookmark_index_ = index; - removed_bookmark_node_ = node.Pass(); + removed_bookmark_node_ = std::move(node); } const bookmarks::BookmarkNode* @@ -828,9 +816,9 @@ OfflinePageModelBookmarkChangeTest::CreateBookmarkNode(const GURL& url) { } void OfflinePageModelBookmarkChangeTest::UndoBookmarkRemoval() { - bookmark_undo_provider_->RestoreRemovedNode(removed_bookmark_parent_, - removed_bookmark_index_, - removed_bookmark_node_.Pass()); + bookmark_undo_provider_->RestoreRemovedNode( + removed_bookmark_parent_, removed_bookmark_index_, + std::move(removed_bookmark_node_)); removed_bookmark_parent_ = nullptr; removed_bookmark_index_ = -1; } diff --git a/components/omnibox/browser/autocomplete_classifier.cc b/components/omnibox/browser/autocomplete_classifier.cc index 26e349a6..cd60893 100644 --- a/components/omnibox/browser/autocomplete_classifier.cc +++ b/components/omnibox/browser/autocomplete_classifier.cc @@ -4,6 +4,8 @@ #include "components/omnibox/browser/autocomplete_classifier.h" +#include <utility> + #include "base/auto_reset.h" #include "build/build_config.h" #include "components/metrics/proto/omnibox_event.pb.h" @@ -36,10 +38,9 @@ const int AutocompleteClassifier::kDefaultOmniboxProviders = AutocompleteClassifier::AutocompleteClassifier( scoped_ptr<AutocompleteController> controller, scoped_ptr<AutocompleteSchemeClassifier> scheme_classifier) - : controller_(controller.Pass()), - scheme_classifier_(scheme_classifier.Pass()), - inside_classify_(false) { -} + : controller_(std::move(controller)), + scheme_classifier_(std::move(scheme_classifier)), + inside_classify_(false) {} AutocompleteClassifier::~AutocompleteClassifier() { // We should only reach here after Shutdown() has been called. diff --git a/components/omnibox/browser/autocomplete_controller.cc b/components/omnibox/browser/autocomplete_controller.cc index f040752..df7990d 100644 --- a/components/omnibox/browser/autocomplete_controller.cc +++ b/components/omnibox/browser/autocomplete_controller.cc @@ -5,9 +5,9 @@ #include "components/omnibox/browser/autocomplete_controller.h" #include <stddef.h> - #include <set> #include <string> +#include <utility> #include "base/format_macros.h" #include "base/logging.h" @@ -172,7 +172,7 @@ AutocompleteController::AutocompleteController( AutocompleteControllerDelegate* delegate, int provider_types) : delegate_(delegate), - provider_client_(provider_client.Pass()), + provider_client_(std::move(provider_client)), history_url_provider_(NULL), keyword_provider_(NULL), search_provider_(NULL), diff --git a/components/omnibox/browser/base_search_provider_unittest.cc b/components/omnibox/browser/base_search_provider_unittest.cc index afd1490..c09fe90 100644 --- a/components/omnibox/browser/base_search_provider_unittest.cc +++ b/components/omnibox/browser/base_search_provider_unittest.cc @@ -4,6 +4,8 @@ #include "components/omnibox/browser/base_search_provider.h" +#include <utility> + #include "base/macros.h" #include "base/strings/string16.h" #include "base/strings/utf_string_conversions.h" @@ -72,7 +74,7 @@ class BaseSearchProviderTest : public testing::Test { scoped_ptr<TemplateURLServiceClient>(), nullptr, nullptr, base::Closure())); client_.reset(new NiceMock<MockAutocompleteProviderClient>()); - client_->set_template_url_service(template_url_service.Pass()); + client_->set_template_url_service(std::move(template_url_service)); provider_ = new NiceMock<TestBaseSearchProvider>( AutocompleteProvider::TYPE_SEARCH, client_.get()); } diff --git a/components/omnibox/browser/keyword_provider_unittest.cc b/components/omnibox/browser/keyword_provider_unittest.cc index fa44fba..c0476a5 100644 --- a/components/omnibox/browser/keyword_provider_unittest.cc +++ b/components/omnibox/browser/keyword_provider_unittest.cc @@ -2,7 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "components/omnibox/browser/keyword_provider.h" + #include <stddef.h> +#include <utility> #include "base/command_line.h" #include "base/macros.h" @@ -12,7 +15,6 @@ #include "components/metrics/proto/omnibox_event.pb.h" #include "components/omnibox/browser/autocomplete_match.h" #include "components/omnibox/browser/autocomplete_scheme_classifier.h" -#include "components/omnibox/browser/keyword_provider.h" #include "components/omnibox/browser/mock_autocomplete_provider_client.h" #include "components/omnibox/browser/omnibox_field_trial.h" #include "components/search_engines/search_engines_switches.h" @@ -111,7 +113,7 @@ void KeywordProviderTest::SetUpClientAndKeywordProvider() { scoped_ptr<TemplateURLService> template_url_service( new TemplateURLService(kTestData, arraysize(kTestData))); client_.reset(new MockAutocompleteProviderClient()); - client_->set_template_url_service(template_url_service.Pass()); + client_->set_template_url_service(std::move(template_url_service)); kw_provider_ = new KeywordProvider(client_.get(), nullptr); } diff --git a/components/omnibox/browser/mock_autocomplete_provider_client.h b/components/omnibox/browser/mock_autocomplete_provider_client.h index 5367ba3..af390d3 100644 --- a/components/omnibox/browser/mock_autocomplete_provider_client.h +++ b/components/omnibox/browser/mock_autocomplete_provider_client.h @@ -6,6 +6,7 @@ #define COMPONENTS_OMNIBOX_BROWSER_MOCK_AUTOCOMPLETE_PROVIDER_CLIENT_H_ #include <string> +#include <utility> #include "base/macros.h" #include "components/omnibox/browser/autocomplete_provider_client.h" @@ -78,7 +79,7 @@ class MockAutocompleteProviderClient : public AutocompleteProviderClient { MOCK_METHOD1(PrefetchImage, void(const GURL& url)); void set_template_url_service(scoped_ptr<TemplateURLService> service) { - template_url_service_ = service.Pass(); + template_url_service_ = std::move(service); } private: diff --git a/components/omnibox/browser/omnibox_edit_model.cc b/components/omnibox/browser/omnibox_edit_model.cc index 369a77d..03311cb 100644 --- a/components/omnibox/browser/omnibox_edit_model.cc +++ b/components/omnibox/browser/omnibox_edit_model.cc @@ -6,6 +6,7 @@ #include <algorithm> #include <string> +#include <utility> #include "base/auto_reset.h" #include "base/format_macros.h" @@ -172,7 +173,7 @@ OmniboxEditModel::State::~State() { OmniboxEditModel::OmniboxEditModel(OmniboxView* view, OmniboxEditController* controller, scoped_ptr<OmniboxClient> client) - : client_(client.Pass()), + : client_(std::move(client)), view_(view), controller_(controller), focus_state_(OMNIBOX_FOCUS_NONE), diff --git a/components/omnibox/browser/omnibox_view.cc b/components/omnibox/browser/omnibox_view.cc index bf9f8f8..6101def 100644 --- a/components/omnibox/browser/omnibox_view.cc +++ b/components/omnibox/browser/omnibox_view.cc @@ -7,6 +7,8 @@ #include "components/omnibox/browser/omnibox_view.h" +#include <utility> + #include "base/strings/string16.h" #include "base/strings/string_util.h" #include "base/strings/utf_string_conversions.h" @@ -176,8 +178,7 @@ OmniboxView::OmniboxView(OmniboxEditController* controller, : controller_(controller) { // |client| can be null in tests. if (client) { - model_.reset( - new OmniboxEditModel(this, controller, client.Pass())); + model_.reset(new OmniboxEditModel(this, controller, std::move(client))); } } diff --git a/components/omnibox/browser/search_provider.cc b/components/omnibox/browser/search_provider.cc index 72cb2fe..75eddbe 100644 --- a/components/omnibox/browser/search_provider.cc +++ b/components/omnibox/browser/search_provider.cc @@ -5,9 +5,9 @@ #include "components/omnibox/browser/search_provider.h" #include <stddef.h> - #include <algorithm> #include <cmath> +#include <utility> #include "base/base64.h" #include "base/bind.h" @@ -941,7 +941,7 @@ void SearchProvider::ConvertResultsToAutocompleteMatches() { SearchSuggestionParser::SuggestResult verbatim( trimmed_verbatim, AutocompleteMatchType::SEARCH_WHAT_YOU_TYPED, trimmed_verbatim, base::string16(), base::string16(), answer_contents, - answer_type, answer.Pass(), std::string(), std::string(), false, + answer_type, std::move(answer), std::string(), std::string(), false, verbatim_relevance, relevance_from_server, false, trimmed_verbatim); AddMatchToMap(verbatim, std::string(), did_not_accept_default_suggestion, false, keyword_url != NULL, &map); diff --git a/components/omnibox/browser/search_suggestion_parser.cc b/components/omnibox/browser/search_suggestion_parser.cc index 95558ec..d1cbc04 100644 --- a/components/omnibox/browser/search_suggestion_parser.cc +++ b/components/omnibox/browser/search_suggestion_parser.cc @@ -5,8 +5,8 @@ #include "components/omnibox/browser/search_suggestion_parser.h" #include <stddef.h> - #include <algorithm> +#include <utility> #include "base/i18n/icu_string_conversions.h" #include "base/json/json_string_value_serializer.h" @@ -93,7 +93,7 @@ SearchSuggestionParser::SuggestResult::SuggestResult( suggest_query_params_(suggest_query_params), answer_contents_(answer_contents), answer_type_(answer_type), - answer_(answer.Pass()), + answer_(std::move(answer)), should_prefetch_(should_prefetch) { match_contents_ = match_contents; DCHECK(!match_contents_.empty()); @@ -380,7 +380,7 @@ scoped_ptr<base::Value> SearchSuggestionParser::DeserializeJsonData( int error_code = 0; scoped_ptr<base::Value> data = deserializer.Deserialize(&error_code, NULL); if (error_code == 0) - return data.Pass(); + return data; } return scoped_ptr<base::Value>(); } @@ -550,8 +550,9 @@ bool SearchSuggestionParser::ParseSuggestResults( base::CollapseWhitespace(suggestion, false), match_type, base::CollapseWhitespace(match_contents, false), match_contents_prefix, annotation, answer_contents, answer_type_str, - answer.Pass(), suggest_query_params, deletion_url, is_keyword_result, - relevance, relevances != NULL, should_prefetch, trimmed_input)); + std::move(answer), suggest_query_params, deletion_url, + is_keyword_result, relevance, relevances != NULL, should_prefetch, + trimmed_input)); } } results->relevances_from_server = relevances != NULL; diff --git a/components/omnibox/browser/shortcuts_backend.cc b/components/omnibox/browser/shortcuts_backend.cc index 8bfa6e6..f020ed1 100644 --- a/components/omnibox/browser/shortcuts_backend.cc +++ b/components/omnibox/browser/shortcuts_backend.cc @@ -5,9 +5,9 @@ #include "components/omnibox/browser/shortcuts_backend.h" #include <stddef.h> - #include <map> #include <string> +#include <utility> #include <vector> #include "base/bind.h" @@ -72,7 +72,7 @@ ShortcutsBackend::ShortcutsBackend( base::FilePath database_path, bool suppress_db) : template_url_service_(template_url_service), - search_terms_data_(search_terms_data.Pass()), + search_terms_data_(std::move(search_terms_data)), current_state_(NOT_INITIALIZED), history_service_observer_(this), main_runner_(base::ThreadTaskRunnerHandle::Get()), diff --git a/components/omnibox/browser/suggestion_answer.cc b/components/omnibox/browser/suggestion_answer.cc index cf6f2b4..85c48d3 100644 --- a/components/omnibox/browser/suggestion_answer.cc +++ b/components/omnibox/browser/suggestion_answer.cc @@ -198,7 +198,7 @@ scoped_ptr<SuggestionAnswer> SuggestionAnswer::ParseAnswer( !ImageLine::ParseImageLine(second_line_json, &result->second_line_)) return nullptr; - return result.Pass(); + return result; } bool SuggestionAnswer::Equals(const SuggestionAnswer& answer) const { diff --git a/components/page_load_metrics/browser/metrics_web_contents_observer.cc b/components/page_load_metrics/browser/metrics_web_contents_observer.cc index e5d6fae..ab15c52 100644 --- a/components/page_load_metrics/browser/metrics_web_contents_observer.cc +++ b/components/page_load_metrics/browser/metrics_web_contents_observer.cc @@ -6,6 +6,7 @@ #include <stddef.h> #include <stdint.h> +#include <utility> #include "base/location.h" #include "base/logging.h" @@ -413,7 +414,7 @@ void PageLoadTracker::RecordRappor(const PageLoadExtraInfo& info) { sample->SetFlagsField("IsSlow", first_contentful_paint.InSecondsF() >= 10, 1); rappor_service->RecordSampleObj(kRapporMetricsNameCoarseTiming, - sample.Pass()); + std::move(sample)); } } @@ -423,7 +424,7 @@ MetricsWebContentsObserver::MetricsWebContentsObserver( scoped_ptr<PageLoadMetricsEmbedderInterface> embedder_interface) : content::WebContentsObserver(web_contents), in_foreground_(false), - embedder_interface_(embedder_interface.Pass()) {} + embedder_interface_(std::move(embedder_interface)) {} MetricsWebContentsObserver* MetricsWebContentsObserver::CreateForWebContents( content::WebContents* web_contents, @@ -432,8 +433,8 @@ MetricsWebContentsObserver* MetricsWebContentsObserver::CreateForWebContents( MetricsWebContentsObserver* metrics = FromWebContents(web_contents); if (!metrics) { - metrics = - new MetricsWebContentsObserver(web_contents, embedder_interface.Pass()); + metrics = new MetricsWebContentsObserver(web_contents, + std::move(embedder_interface)); web_contents->SetUserData(UserDataKey(), metrics); } return metrics; @@ -521,7 +522,7 @@ void MetricsWebContentsObserver::DidFinishNavigation( AbortTypeForPageTransition(navigation_handle->GetPageTransition()), navigation_handle->NavigationStart()); - committed_load_ = finished_nav.Pass(); + committed_load_ = std::move(finished_nav); aborted_provisional_loads_.clear(); const GURL& browser_url = web_contents()->GetLastCommittedURL(); diff --git a/components/page_load_metrics/renderer/metrics_render_frame_observer_unittest.cc b/components/page_load_metrics/renderer/metrics_render_frame_observer_unittest.cc index 1482166..15fe26d 100644 --- a/components/page_load_metrics/renderer/metrics_render_frame_observer_unittest.cc +++ b/components/page_load_metrics/renderer/metrics_render_frame_observer_unittest.cc @@ -4,6 +4,8 @@ #include "components/page_load_metrics/renderer/metrics_render_frame_observer.h" +#include <utility> + #include "base/memory/scoped_ptr.h" #include "base/time/time.h" #include "base/timer/mock_timer.h" @@ -46,7 +48,7 @@ class MockMetricsRenderFrameObserver : public MetricsRenderFrameObserver { scoped_ptr<base::Timer> CreateTimer() const override { if (!mock_timer_) ADD_FAILURE() << "CreateTimer() called, but no MockTimer available."; - return mock_timer_.Pass(); + return std::move(mock_timer_); } // We intercept sent messages and dispatch them to a MockIPCInterceptor, which @@ -59,7 +61,7 @@ class MockMetricsRenderFrameObserver : public MetricsRenderFrameObserver { void set_mock_timer(scoped_ptr<base::Timer> timer) { ASSERT_EQ(nullptr, mock_timer_); - mock_timer_ = timer.Pass(); + mock_timer_ = std::move(timer); } MOCK_CONST_METHOD0(GetTiming, PageLoadTiming()); diff --git a/components/page_load_metrics/renderer/page_timing_metrics_sender.cc b/components/page_load_metrics/renderer/page_timing_metrics_sender.cc index 84fdb45..52d8770 100644 --- a/components/page_load_metrics/renderer/page_timing_metrics_sender.cc +++ b/components/page_load_metrics/renderer/page_timing_metrics_sender.cc @@ -2,11 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "components/page_load_metrics/renderer/page_timing_metrics_sender.h" + +#include <utility> + #include "base/callback.h" #include "base/time/time.h" #include "base/timer/timer.h" #include "components/page_load_metrics/common/page_load_metrics_messages.h" -#include "components/page_load_metrics/renderer/page_timing_metrics_sender.h" #include "ipc/ipc_sender.h" namespace page_load_metrics { @@ -18,7 +21,9 @@ const int kTimerDelayMillis = 1000; PageTimingMetricsSender::PageTimingMetricsSender(IPC::Sender* ipc_sender, int routing_id, scoped_ptr<base::Timer> timer) - : ipc_sender_(ipc_sender), routing_id_(routing_id), timer_(timer.Pass()) {} + : ipc_sender_(ipc_sender), + routing_id_(routing_id), + timer_(std::move(timer)) {} // On destruction, we want to send any data we have if we have a timer // currently running (and thus are talking to a browser process) diff --git a/components/password_manager/content/browser/content_password_manager_driver_factory.cc b/components/password_manager/content/browser/content_password_manager_driver_factory.cc index 6b448f4..1432e14 100644 --- a/components/password_manager/content/browser/content_password_manager_driver_factory.cc +++ b/components/password_manager/content/browser/content_password_manager_driver_factory.cc @@ -115,7 +115,7 @@ void ContentPasswordManagerDriverFactory::DidNavigateAnyFrame( void ContentPasswordManagerDriverFactory::TestingSetDriverForFrame( content::RenderFrameHost* render_frame_host, scoped_ptr<ContentPasswordManagerDriver> driver) { - frame_driver_map_[render_frame_host] = driver.Pass(); + frame_driver_map_[render_frame_host] = std::move(driver); } void ContentPasswordManagerDriverFactory::RequestSendLoggingAvailability() { diff --git a/components/password_manager/content/browser/credential_manager_dispatcher.cc b/components/password_manager/content/browser/credential_manager_dispatcher.cc index 770b484..3c97a5d 100644 --- a/components/password_manager/content/browser/credential_manager_dispatcher.cc +++ b/components/password_manager/content/browser/credential_manager_dispatcher.cc @@ -4,6 +4,8 @@ #include "components/password_manager/content/browser/credential_manager_dispatcher.h" +#include <utility> + #include "base/bind.h" #include "base/strings/string16.h" #include "base/strings/utf_string_conversions.h" @@ -78,7 +80,7 @@ void CredentialManagerDispatcher::OnProvisionalSaveComplete() { // If the PasswordForm we were given does not match an existing // PasswordForm, ask the user if they'd like to save. client_->PromptUserToSaveOrUpdatePassword( - form_manager_.Pass(), CredentialSourceType::CREDENTIAL_SOURCE_API, + std::move(form_manager_), CredentialSourceType::CREDENTIAL_SOURCE_API, false); } else { // Otherwise, update the existing form, as we've been told by the site diff --git a/components/password_manager/core/browser/affiliated_match_helper.cc b/components/password_manager/core/browser/affiliated_match_helper.cc index 3ab4b0e..283b7e7 100644 --- a/components/password_manager/core/browser/affiliated_match_helper.cc +++ b/components/password_manager/core/browser/affiliated_match_helper.cc @@ -4,6 +4,8 @@ #include "components/password_manager/core/browser/affiliated_match_helper.h" +#include <utility> + #include "base/bind.h" #include "base/callback.h" #include "base/single_thread_task_runner.h" @@ -37,9 +39,8 @@ AffiliatedMatchHelper::AffiliatedMatchHelper( scoped_ptr<AffiliationService> affiliation_service) : password_store_(password_store), task_runner_for_waiting_(base::ThreadTaskRunnerHandle::Get()), - affiliation_service_(affiliation_service.Pass()), - weak_ptr_factory_(this) { -} + affiliation_service_(std::move(affiliation_service)), + weak_ptr_factory_(this) {} AffiliatedMatchHelper::~AffiliatedMatchHelper() { if (password_store_) diff --git a/components/password_manager/core/browser/affiliated_match_helper_unittest.cc b/components/password_manager/core/browser/affiliated_match_helper_unittest.cc index 2e9a8f4..df4ec0b 100644 --- a/components/password_manager/core/browser/affiliated_match_helper_unittest.cc +++ b/components/password_manager/core/browser/affiliated_match_helper_unittest.cc @@ -5,6 +5,7 @@ #include "components/password_manager/core/browser/affiliated_match_helper.h" #include <stddef.h> +#include <utility> #include "base/macros.h" #include "base/memory/ref_counted.h" @@ -292,7 +293,7 @@ class AffiliatedMatchHelperTest : public testing::Test { password_store_ = new TestPasswordStore; match_helper_.reset( - new AffiliatedMatchHelper(password_store_.get(), service.Pass())); + new AffiliatedMatchHelper(password_store_.get(), std::move(service))); match_helper_->SetTaskRunnerUsedForWaitingForTesting(waiting_task_runner_); } diff --git a/components/password_manager/core/browser/affiliation_backend.cc b/components/password_manager/core/browser/affiliation_backend.cc index 63eec16..bd258f2 100644 --- a/components/password_manager/core/browser/affiliation_backend.cc +++ b/components/password_manager/core/browser/affiliation_backend.cc @@ -6,6 +6,7 @@ #include <stdint.h> #include <algorithm> +#include <utility> #include "base/bind.h" #include "base/location.h" @@ -30,8 +31,8 @@ AffiliationBackend::AffiliationBackend( scoped_ptr<base::TickClock> time_tick_source) : request_context_getter_(request_context_getter), task_runner_(task_runner), - clock_(time_source.Pass()), - tick_clock_(time_tick_source.Pass()), + clock_(std::move(time_source)), + tick_clock_(std::move(time_tick_source)), construction_time_(clock_->Now()), weak_ptr_factory_(this) { DCHECK_LT(base::Time(), clock_->Now()); @@ -123,7 +124,7 @@ FacetManager* AffiliationBackend::GetOrCreateFacetManager( if (!facet_managers_.contains(facet_uri)) { scoped_ptr<FacetManager> new_manager( new FacetManager(facet_uri, this, clock_.get())); - facet_managers_.add(facet_uri, new_manager.Pass()); + facet_managers_.add(facet_uri, std::move(new_manager)); } return facet_managers_.get(facet_uri); } @@ -283,7 +284,7 @@ void AffiliationBackend::ReportStatistics(size_t requested_facet_uri_count) { void AffiliationBackend::SetThrottlerForTesting( scoped_ptr<AffiliationFetchThrottler> throttler) { - throttler_ = throttler.Pass(); + throttler_ = std::move(throttler); } } // namespace password_manager diff --git a/components/password_manager/core/browser/affiliation_fetcher.cc b/components/password_manager/core/browser/affiliation_fetcher.cc index b37378b..cad2e7a 100644 --- a/components/password_manager/core/browser/affiliation_fetcher.cc +++ b/components/password_manager/core/browser/affiliation_fetcher.cc @@ -5,6 +5,7 @@ #include "components/password_manager/core/browser/affiliation_fetcher.h" #include <stddef.h> +#include <utility> #include "base/metrics/histogram_macros.h" #include "base/metrics/sparse_histogram.h" @@ -204,7 +205,7 @@ void AffiliationFetcher::OnURLFetchComplete(const net::URLFetcher* source) { fetcher_->GetResponseCode() == net::HTTP_OK) { if (ParseResponse(result_data.get())) { ReportStatistics(AFFILIATION_FETCH_RESULT_SUCCESS, nullptr); - delegate_->OnFetchSucceeded(result_data.Pass()); + delegate_->OnFetchSucceeded(std::move(result_data)); } else { ReportStatistics(AFFILIATION_FETCH_RESULT_MALFORMED, nullptr); delegate_->OnMalformedResponse(); diff --git a/components/password_manager/core/browser/affiliation_fetcher_unittest.cc b/components/password_manager/core/browser/affiliation_fetcher_unittest.cc index 6c8aacb..0b1ecb1 100644 --- a/components/password_manager/core/browser/affiliation_fetcher_unittest.cc +++ b/components/password_manager/core/browser/affiliation_fetcher_unittest.cc @@ -4,6 +4,8 @@ #include "components/password_manager/core/browser/affiliation_fetcher.h" +#include <utility> + #include "base/macros.h" #include "base/test/null_task_runner.h" #include "components/password_manager/core/browser/affiliation_api.pb.h" @@ -32,7 +34,7 @@ class MockAffiliationFetcherDelegate void OnFetchSucceeded(scoped_ptr<Result> result) override { OnFetchSucceededProxy(); - result_ = result.Pass(); + result_ = std::move(result); } const Result& result() const { return *result_.get(); } diff --git a/components/password_manager/core/browser/credential_manager_password_form_manager.cc b/components/password_manager/core/browser/credential_manager_password_form_manager.cc index 61b7949..194f9c6 100644 --- a/components/password_manager/core/browser/credential_manager_password_form_manager.cc +++ b/components/password_manager/core/browser/credential_manager_password_form_manager.cc @@ -4,6 +4,8 @@ #include "components/password_manager/core/browser/credential_manager_password_form_manager.h" +#include <utility> + #include "base/macros.h" #include "components/autofill/core/common/password_form.h" #include "components/password_manager/core/browser/password_manager_client.h" @@ -32,7 +34,7 @@ CredentialManagerPasswordFormManager::~CredentialManagerPasswordFormManager() { void CredentialManagerPasswordFormManager::OnGetPasswordStoreResults( ScopedVector<autofill::PasswordForm> results) { - PasswordFormManager::OnGetPasswordStoreResults(results.Pass()); + PasswordFormManager::OnGetPasswordStoreResults(std::move(results)); // Mark the form as "preferred", as we've been told by the API that this is // indeed the credential set that the user used to sign into the site. diff --git a/components/password_manager/core/browser/credential_manager_pending_request_task.cc b/components/password_manager/core/browser/credential_manager_pending_request_task.cc index d31a0ee..f96be5d 100644 --- a/components/password_manager/core/browser/credential_manager_pending_request_task.cc +++ b/components/password_manager/core/browser/credential_manager_pending_request_task.cc @@ -4,6 +4,8 @@ #include "components/password_manager/core/browser/credential_manager_pending_request_task.h" +#include <utility> + #include "components/autofill/core/common/password_form.h" #include "components/password_manager/core/browser/affiliated_match_helper.h" #include "components/password_manager/core/browser/password_manager_client.h" @@ -102,14 +104,14 @@ void CredentialManagerPendingRequestTask::OnGetPasswordStoreResults( std::swap(*it, local_results[0]); // Clear the form pointer since its owner is being passed. zero_click_form_to_return = nullptr; - delegate_->client()->NotifyUserAutoSignin(local_results.Pass()); + delegate_->client()->NotifyUserAutoSignin(std::move(local_results)); delegate_->SendCredential(id_, info); return; } if (zero_click_only_ || !delegate_->client()->PromptUserToChooseCredentials( - local_results.Pass(), federated_results.Pass(), origin_, + std::move(local_results), std::move(federated_results), origin_, base::Bind( &CredentialManagerPendingRequestTaskDelegate::SendCredential, base::Unretained(delegate_), id_))) { diff --git a/components/password_manager/core/browser/fake_affiliation_api.cc b/components/password_manager/core/browser/fake_affiliation_api.cc index 7c39896..6edd706 100644 --- a/components/password_manager/core/browser/fake_affiliation_api.cc +++ b/components/password_manager/core/browser/fake_affiliation_api.cc @@ -5,6 +5,7 @@ #include "components/password_manager/core/browser/fake_affiliation_api.h" #include <algorithm> +#include <utility> #include "base/memory/scoped_ptr.h" #include "testing/gtest/include/gtest/gtest.h" @@ -57,7 +58,7 @@ void ScopedFakeAffiliationAPI::ServeNextRequest() { if (had_intersection_with_request) fake_response->push_back(preset_equivalence_class); } - fetcher->SimulateSuccess(fake_response.Pass()); + fetcher->SimulateSuccess(std::move(fake_response)); } void ScopedFakeAffiliationAPI::FailNextRequest() { diff --git a/components/password_manager/core/browser/fake_affiliation_fetcher.cc b/components/password_manager/core/browser/fake_affiliation_fetcher.cc index cb96fa7..2aa5842f 100644 --- a/components/password_manager/core/browser/fake_affiliation_fetcher.cc +++ b/components/password_manager/core/browser/fake_affiliation_fetcher.cc @@ -4,6 +4,8 @@ #include "components/password_manager/core/browser/fake_affiliation_fetcher.h" +#include <utility> + namespace password_manager { password_manager::FakeAffiliationFetcher::FakeAffiliationFetcher( @@ -18,7 +20,7 @@ password_manager::FakeAffiliationFetcher::~FakeAffiliationFetcher() { void password_manager::FakeAffiliationFetcher::SimulateSuccess( scoped_ptr<AffiliationFetcherDelegate::Result> fake_result) { - delegate()->OnFetchSucceeded(fake_result.Pass()); + delegate()->OnFetchSucceeded(std::move(fake_result)); } void password_manager::FakeAffiliationFetcher::SimulateFailure() { diff --git a/components/password_manager/core/browser/login_database.cc b/components/password_manager/core/browser/login_database.cc index 525ddb4..36617d9 100644 --- a/components/password_manager/core/browser/login_database.cc +++ b/components/password_manager/core/browser/login_database.cc @@ -6,9 +6,9 @@ #include <stddef.h> #include <stdint.h> - #include <algorithm> #include <limits> +#include <utility> #include "base/bind.h" #include "base/files/file_path.h" @@ -1287,7 +1287,7 @@ bool LoginDatabase::StatementToForms( psl_domain_match_metric = PSL_DOMAIN_MATCH_FOUND; new_form->is_public_suffix_match = true; } - forms->push_back(new_form.Pass()); + forms->push_back(std::move(new_form)); } if (psl_match) { diff --git a/components/password_manager/core/browser/password_form_manager.cc b/components/password_manager/core/browser/password_form_manager.cc index 7a4f649..9ff8533 100644 --- a/components/password_manager/core/browser/password_form_manager.cc +++ b/components/password_manager/core/browser/password_form_manager.cc @@ -264,7 +264,7 @@ void PasswordFormManager::ProvisionallySave( mutable_provisionally_saved_form->username_element.clear(); is_possible_change_password_form_without_username_ = true; } - provisionally_saved_form_ = mutable_provisionally_saved_form.Pass(); + provisionally_saved_form_ = std::move(mutable_provisionally_saved_form); other_possible_username_action_ = action; if (HasCompletedMatching()) @@ -405,7 +405,7 @@ void PasswordFormManager::OnRequestDone( logins_result.end()); } logins_result = - client_->GetStoreResultFilter()->FilterResults(logins_result.Pass()); + client_->GetStoreResultFilter()->FilterResults(std::move(logins_result)); // Deal with blacklisted forms. auto begin_blacklisted = std::partition( @@ -476,9 +476,9 @@ void PasswordFormManager::OnRequestDone( is_credential_protected |= IsValidAndroidFacetURI(login->signon_realm); if (is_credential_protected) - protected_credentials.push_back(login.Pass()); + protected_credentials.push_back(std::move(login)); else - not_best_matches_.push_back(login.Pass()); + not_best_matches_.push_back(std::move(login)); continue; } @@ -506,7 +506,7 @@ void PasswordFormManager::OnRequestDone( if (best_matches_.find(username) == best_matches_.end()) best_matches_.insert(std::make_pair(username, std::move(protege))); else - not_best_matches_.push_back(protege.Pass()); + not_best_matches_.push_back(std::move(protege)); } UMA_HISTOGRAM_COUNTS("PasswordManager.NumPasswordsNotShown", @@ -603,7 +603,7 @@ void PasswordFormManager::OnGetPasswordStoreResults( } if (!results.empty()) - OnRequestDone(results.Pass()); + OnRequestDone(std::move(results)); state_ = POST_MATCHING_PHASE; // If password store was slow and provisionally saved form is already here diff --git a/components/password_manager/core/browser/password_form_manager_unittest.cc b/components/password_manager/core/browser/password_form_manager_unittest.cc index 06e4cdb..e9e1571 100644 --- a/components/password_manager/core/browser/password_form_manager_unittest.cc +++ b/components/password_manager/core/browser/password_form_manager_unittest.cc @@ -2,7 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "components/password_manager/core/browser/password_form_manager.h" + #include <map> +#include <utility> #include "base/macros.h" #include "base/memory/scoped_ptr.h" @@ -21,7 +24,6 @@ #include "components/autofill/core/common/password_form.h" #include "components/password_manager/core/browser/credentials_filter.h" #include "components/password_manager/core/browser/mock_password_store.h" -#include "components/password_manager/core/browser/password_form_manager.h" #include "components/password_manager/core/browser/password_manager.h" #include "components/password_manager/core/browser/password_manager_driver.h" #include "components/password_manager/core/browser/password_manager_metrics_util.h" @@ -56,7 +58,7 @@ ACTION_P4(InvokeConsumer, form1, form2, form3, form4) { result.push_back(make_scoped_ptr(new PasswordForm(form2))); result.push_back(make_scoped_ptr(new PasswordForm(form3))); result.push_back(make_scoped_ptr(new PasswordForm(form4))); - arg0->OnGetPasswordStoreResults(result.Pass()); + arg0->OnGetPasswordStoreResults(std::move(result)); } MATCHER_P(CheckUsername, username_value, "Username incorrect") { @@ -138,7 +140,7 @@ class MockPasswordManagerDriver : public StubPasswordManagerDriver { scoped_ptr<TestingPrefServiceSimple> prefs(new TestingPrefServiceSimple()); prefs->registry()->RegisterBooleanPref(autofill::prefs::kAutofillEnabled, true); - test_autofill_client_.SetPrefs(prefs.Pass()); + test_autofill_client_.SetPrefs(std::move(prefs)); mock_autofill_download_manager_ = new MockAutofillDownloadManager( &test_autofill_driver_, &mock_autofill_manager_); // AutofillManager takes ownership of |mock_autofill_download_manager_|. @@ -180,7 +182,7 @@ class MockStoreResultFilter : public CredentialsFilter { ScopedVector<autofill::PasswordForm> FilterResults( ScopedVector<autofill::PasswordForm> results) const override { FilterResultsPtr(&results); - return results.Pass(); + return results; } }; @@ -333,7 +335,7 @@ class PasswordFormManagerTest : public testing::Test { if (result & RESULT_PSL_MATCH) { result_form.push_back(new PasswordForm(psl_saved_match_)); } - p->OnGetPasswordStoreResults(result_form.Pass()); + p->OnGetPasswordStoreResults(std::move(result_form)); } // Save saved_match() for observed_form() where |observed_form_data|, @@ -369,7 +371,7 @@ class PasswordFormManagerTest : public testing::Test { : base::string16(); form_manager.SimulateFetchMatchingLoginsFromPasswordStore(); - form_manager.OnGetPasswordStoreResults(result.Pass()); + form_manager.OnGetPasswordStoreResults(std::move(result)); std::string expected_login_signature; autofill::FormStructure observed_structure(observed_form_data); autofill::FormStructure pending_structure(saved_match()->form_data); @@ -652,7 +654,7 @@ TEST_F(PasswordFormManagerTest, TestBlacklistMatching) { result.push_back(new PasswordForm(blacklisted_not_match2)); result.push_back(new PasswordForm(blacklisted_match)); result.push_back(new PasswordForm(*saved_match())); - form_manager.OnGetPasswordStoreResults(result.Pass()); + form_manager.OnGetPasswordStoreResults(std::move(result)); EXPECT_TRUE(form_manager.IsBlacklisted()); EXPECT_THAT(form_manager.blacklisted_matches(), ElementsAre(Pointee(blacklisted_match))); @@ -681,7 +683,7 @@ TEST_F(PasswordFormManagerTest, AutofillBlacklisted) { EXPECT_CALL(*client()->mock_driver(), FillPasswordForm(_)) .WillOnce(SaveArg<0>(&fill_data)); - form_manager()->OnGetPasswordStoreResults(result.Pass()); + form_manager()->OnGetPasswordStoreResults(std::move(result)); EXPECT_EQ(1u, form_manager()->blacklisted_matches().size()); EXPECT_TRUE(form_manager()->IsBlacklisted()); EXPECT_EQ(1u, form_manager()->best_matches().size()); @@ -889,7 +891,7 @@ TEST_F(PasswordFormManagerTest, TestIgnoreResult_SSL) { saved_form.ssl_valid = kObservedFormSSLValid; result.push_back(new PasswordForm(saved_form)); form_manager.SimulateFetchMatchingLoginsFromPasswordStore(); - form_manager.OnGetPasswordStoreResults(result.Pass()); + form_manager.OnGetPasswordStoreResults(std::move(result)); // Make sure we don't match a PasswordForm if it was originally saved on // an SSL-valid page and we are now on a page with invalid certificate. @@ -912,7 +914,7 @@ TEST_F(PasswordFormManagerTest, TestIgnoreResult_Paths) { ScopedVector<PasswordForm> result; result.push_back(new PasswordForm(saved_form)); form_manager.SimulateFetchMatchingLoginsFromPasswordStore(); - form_manager.OnGetPasswordStoreResults(result.Pass()); + form_manager.OnGetPasswordStoreResults(std::move(result)); // Different paths for action / origin are okay. EXPECT_FALSE(form_manager.best_matches().empty()); @@ -932,7 +934,7 @@ TEST_F(PasswordFormManagerTest, TestIgnoreResult_IgnoredCredentials) { ScopedVector<PasswordForm> result; result.push_back(new PasswordForm(saved_form)); form_manager.SimulateFetchMatchingLoginsFromPasswordStore(); - form_manager.OnGetPasswordStoreResults(result.Pass()); + form_manager.OnGetPasswordStoreResults(std::move(result)); // Results should be ignored if the client requests it. EXPECT_TRUE(form_manager.best_matches().empty()); @@ -995,7 +997,7 @@ TEST_F(PasswordFormManagerTest, TestAlternateUsername_NoChange) { ScopedVector<PasswordForm> result; result.push_back(new PasswordForm(saved_form)); form_manager()->SimulateFetchMatchingLoginsFromPasswordStore(); - form_manager()->OnGetPasswordStoreResults(result.Pass()); + form_manager()->OnGetPasswordStoreResults(std::move(result)); // The saved match has the right username already. PasswordForm login(*observed_form()); @@ -1032,7 +1034,7 @@ TEST_F(PasswordFormManagerTest, TestAlternateUsername_OtherUsername) { ScopedVector<PasswordForm> result; result.push_back(new PasswordForm(saved_form)); form_manager()->SimulateFetchMatchingLoginsFromPasswordStore(); - form_manager()->OnGetPasswordStoreResults(result.Pass()); + form_manager()->OnGetPasswordStoreResults(std::move(result)); // The saved match has the right username already. PasswordForm login(*observed_form()); @@ -1081,7 +1083,7 @@ TEST_F(PasswordFormManagerTest, TestSendNotBlacklistedMessage_Credentials) { form_manager()->SimulateFetchMatchingLoginsFromPasswordStore(); ScopedVector<PasswordForm> simulated_results; simulated_results.push_back(CreateSavedMatch(false)); - form_manager()->OnGetPasswordStoreResults(simulated_results.Pass()); + form_manager()->OnGetPasswordStoreResults(std::move(simulated_results)); } TEST_F(PasswordFormManagerTest, @@ -1099,7 +1101,7 @@ TEST_F(PasswordFormManagerTest, form_manager.SimulateFetchMatchingLoginsFromPasswordStore(); ScopedVector<PasswordForm> simulated_results; simulated_results.push_back(CreateSavedMatch(false)); - form_manager.OnGetPasswordStoreResults(simulated_results.Pass()); + form_manager.OnGetPasswordStoreResults(std::move(simulated_results)); } TEST_F(PasswordFormManagerTest, @@ -1111,7 +1113,7 @@ TEST_F(PasswordFormManagerTest, form_manager()->SimulateFetchMatchingLoginsFromPasswordStore(); ScopedVector<PasswordForm> simulated_results; simulated_results.push_back(CreateSavedMatch(true)); - form_manager()->OnGetPasswordStoreResults(simulated_results.Pass()); + form_manager()->OnGetPasswordStoreResults(std::move(simulated_results)); } TEST_F(PasswordFormManagerTest, TestForceInclusionOfGeneratedPasswords_Match) { @@ -1132,7 +1134,7 @@ TEST_F(PasswordFormManagerTest, TestForceInclusionOfGeneratedPasswords_Match) { EXPECT_CALL(*client()->mock_driver(), FillPasswordForm(_)) .WillOnce(SaveArg<0>(&fill_data)); - form_manager()->OnGetPasswordStoreResults(simulated_results.Pass()); + form_manager()->OnGetPasswordStoreResults(std::move(simulated_results)); EXPECT_EQ(1u, form_manager()->best_matches().size()); EXPECT_TRUE(fill_data.additional_logins.empty()); } @@ -1156,7 +1158,7 @@ TEST_F(PasswordFormManagerTest, EXPECT_CALL(*client()->mock_driver(), FillPasswordForm(_)) .WillOnce(SaveArg<0>(&fill_data)); - form_manager()->OnGetPasswordStoreResults(simulated_results.Pass()); + form_manager()->OnGetPasswordStoreResults(std::move(simulated_results)); EXPECT_EQ(2u, form_manager()->best_matches().size()); EXPECT_EQ(1u, fill_data.additional_logins.size()); } @@ -1271,8 +1273,8 @@ TEST_F(PasswordFormManagerTest, TestUpdateIncompleteCredentials) { // Feed the incomplete credentials to the manager. ScopedVector<PasswordForm> simulated_results; - simulated_results.push_back(incomplete_form.Pass()); - form_manager.OnGetPasswordStoreResults(simulated_results.Pass()); + simulated_results.push_back(std::move(incomplete_form)); + form_manager.OnGetPasswordStoreResults(std::move(simulated_results)); form_manager.ProvisionallySave( complete_form, PasswordFormManager::IGNORE_OTHER_POSSIBLE_USERNAMES); @@ -1308,7 +1310,7 @@ TEST_F(PasswordFormManagerTest, TestScoringPublicSuffixMatch) { EXPECT_CALL(*client()->mock_driver(), FillPasswordForm(_)) .WillOnce(SaveArg<0>(&fill_data)); - form_manager()->OnGetPasswordStoreResults(simulated_results.Pass()); + form_manager()->OnGetPasswordStoreResults(std::move(simulated_results)); EXPECT_TRUE(fill_data.additional_logins.empty()); EXPECT_EQ(1u, form_manager()->best_matches().size()); EXPECT_TRUE( @@ -1334,7 +1336,7 @@ TEST_F(PasswordFormManagerTest, AndroidCredentialsAreAutofilled) { EXPECT_CALL(*client()->mock_driver(), FillPasswordForm(_)) .WillOnce(SaveArg<0>(&fill_data)); - form_manager()->OnGetPasswordStoreResults(simulated_results.Pass()); + form_manager()->OnGetPasswordStoreResults(std::move(simulated_results)); EXPECT_TRUE(fill_data.additional_logins.empty()); EXPECT_FALSE(fill_data.wait_for_username); EXPECT_EQ(1u, form_manager()->best_matches().size()); @@ -1376,7 +1378,7 @@ TEST_F(PasswordFormManagerTest, AndroidCredentialsAreProtected) { EXPECT_CALL(*client()->mock_driver(), FillPasswordForm(_)) .WillOnce(SaveArg<0>(&fill_data)); form_manager()->SimulateFetchMatchingLoginsFromPasswordStore(); - form_manager()->OnGetPasswordStoreResults(simulated_results.Pass()); + form_manager()->OnGetPasswordStoreResults(std::move(simulated_results)); EXPECT_FALSE(fill_data.wait_for_username); EXPECT_EQ(1u, fill_data.additional_logins.size()); @@ -1516,7 +1518,7 @@ TEST_F(PasswordFormManagerTest, CorrectlyUpdatePasswordsWithSameUsername) { result.push_back(new PasswordForm(first)); result.push_back(new PasswordForm(second)); form_manager()->SimulateFetchMatchingLoginsFromPasswordStore(); - form_manager()->OnGetPasswordStoreResults(result.Pass()); + form_manager()->OnGetPasswordStoreResults(std::move(result)); // We always take the first credential with a particular username, regardless // of which ones are labeled preferred. @@ -1676,8 +1678,8 @@ TEST_F(PasswordFormManagerTest, DriverDeletedBeforeStoreDone) { client()->KillDriver(); ScopedVector<PasswordForm> simulated_results; - simulated_results.push_back(form.Pass()); - form_manager.OnGetPasswordStoreResults(simulated_results.Pass()); + simulated_results.push_back(std::move(form)); + form_manager.OnGetPasswordStoreResults(std::move(simulated_results)); } TEST_F(PasswordFormManagerTest, PreferredMatchIsUpToDate) { @@ -1699,10 +1701,10 @@ TEST_F(PasswordFormManagerTest, PreferredMatchIsUpToDate) { generated_form->password_value = ASCIIToUTF16("password2"); generated_form->preferred = true; - simulated_results.push_back(generated_form.Pass()); - simulated_results.push_back(form.Pass()); + simulated_results.push_back(std::move(generated_form)); + simulated_results.push_back(std::move(form)); - form_manager()->OnGetPasswordStoreResults(simulated_results.Pass()); + form_manager()->OnGetPasswordStoreResults(std::move(simulated_results)); EXPECT_EQ(1u, form_manager()->best_matches().size()); EXPECT_EQ(form_manager()->preferred_match(), form_manager()->best_matches().begin()->second.get()); @@ -1824,7 +1826,7 @@ TEST_F(PasswordFormManagerTest, TestSuggestingPasswordChangeForms) { EXPECT_CALL(*client()->mock_driver(), FillPasswordForm(_)) .WillOnce(SaveArg<0>(&fill_data)); - manager_creds.OnGetPasswordStoreResults(simulated_results.Pass()); + manager_creds.OnGetPasswordStoreResults(std::move(simulated_results)); EXPECT_EQ(1u, manager_creds.best_matches().size()); EXPECT_EQ(0u, fill_data.additional_logins.size()); EXPECT_TRUE(fill_data.wait_for_username); @@ -2052,7 +2054,7 @@ TEST_F(PasswordFormManagerTest, RemoveNoUsernameAccounts) { ScopedVector<PasswordForm> result; result.push_back(new PasswordForm(saved_form)); form_manager()->SimulateFetchMatchingLoginsFromPasswordStore(); - form_manager()->OnGetPasswordStoreResults(result.Pass()); + form_manager()->OnGetPasswordStoreResults(std::move(result)); PasswordForm submitted_form(*observed_form()); submitted_form.preferred = true; @@ -2076,7 +2078,7 @@ TEST_F(PasswordFormManagerTest, NotRemovePSLNoUsernameAccounts) { ScopedVector<PasswordForm> result; result.push_back(new PasswordForm(saved_form)); form_manager()->SimulateFetchMatchingLoginsFromPasswordStore(); - form_manager()->OnGetPasswordStoreResults(result.Pass()); + form_manager()->OnGetPasswordStoreResults(std::move(result)); PasswordForm submitted_form(*observed_form()); submitted_form.preferred = true; @@ -2098,7 +2100,7 @@ TEST_F(PasswordFormManagerTest, NotRemoveCredentialsWithUsername) { ScopedVector<PasswordForm> result; result.push_back(new PasswordForm(saved_form)); form_manager()->SimulateFetchMatchingLoginsFromPasswordStore(); - form_manager()->OnGetPasswordStoreResults(result.Pass()); + form_manager()->OnGetPasswordStoreResults(std::move(result)); PasswordForm submitted_form(*observed_form()); submitted_form.preferred = true; @@ -2120,7 +2122,7 @@ TEST_F(PasswordFormManagerTest, NotRemoveCredentialsWithDiferrentPassword) { ScopedVector<PasswordForm> result; result.push_back(new PasswordForm(saved_form)); form_manager()->SimulateFetchMatchingLoginsFromPasswordStore(); - form_manager()->OnGetPasswordStoreResults(result.Pass()); + form_manager()->OnGetPasswordStoreResults(std::move(result)); PasswordForm submitted_form(*observed_form()); submitted_form.preferred = true; @@ -2142,7 +2144,7 @@ TEST_F(PasswordFormManagerTest, SaveNoUsernameEvenIfWithUsernamePresent) { ScopedVector<PasswordForm> result; result.push_back(new PasswordForm(*saved_form)); form_manager()->SimulateFetchMatchingLoginsFromPasswordStore(); - form_manager()->OnGetPasswordStoreResults(result.Pass()); + form_manager()->OnGetPasswordStoreResults(std::move(result)); PasswordForm submitted_form(*observed_form()); submitted_form.preferred = true; @@ -2165,7 +2167,7 @@ TEST_F(PasswordFormManagerTest, NotRemoveOnUpdate) { saved_form.preferred = false; result.push_back(new PasswordForm(saved_form)); form_manager()->SimulateFetchMatchingLoginsFromPasswordStore(); - form_manager()->OnGetPasswordStoreResults(result.Pass()); + form_manager()->OnGetPasswordStoreResults(std::move(result)); PasswordForm submitted_form(*observed_form()); submitted_form.preferred = true; @@ -2198,8 +2200,8 @@ TEST_F(PasswordFormManagerTest, GenerationStatusChangedWithPassword) { submitted_form.password_value = ASCIIToUTF16("password3"); ScopedVector<PasswordForm> simulated_results; - simulated_results.push_back(generated_form.Pass()); - form_manager()->OnGetPasswordStoreResults(simulated_results.Pass()); + simulated_results.push_back(std::move(generated_form)); + form_manager()->OnGetPasswordStoreResults(std::move(simulated_results)); form_manager()->ProvisionallySave( submitted_form, PasswordFormManager::IGNORE_OTHER_POSSIBLE_USERNAMES); @@ -2230,8 +2232,8 @@ TEST_F(PasswordFormManagerTest, GenerationStatusNotUpdatedIfPasswordUnchanged) { PasswordForm submitted_form(*generated_form); ScopedVector<PasswordForm> simulated_results; - simulated_results.push_back(generated_form.Pass()); - form_manager()->OnGetPasswordStoreResults(simulated_results.Pass()); + simulated_results.push_back(std::move(generated_form)); + form_manager()->OnGetPasswordStoreResults(std::move(simulated_results)); form_manager()->ProvisionallySave( submitted_form, PasswordFormManager::IGNORE_OTHER_POSSIBLE_USERNAMES); @@ -2260,18 +2262,18 @@ TEST_F(PasswordFormManagerTest, scoped_ptr<PasswordForm> saved_form(new PasswordForm(*saved_match())); saved_form->username_value = ASCIIToUTF16("a@gmail.com"); ScopedVector<PasswordForm> results; - results.push_back(saved_form.Pass()); - form_manager()->OnGetPasswordStoreResults(results.Pass()); + results.push_back(std::move(saved_form)); + form_manager()->OnGetPasswordStoreResults(std::move(results)); EXPECT_TRUE(form_manager()->best_matches().empty()); // Second response from the store should not be ignored. saved_form.reset(new PasswordForm(*saved_match())); saved_form->username_value = ASCIIToUTF16("b@gmail.com"); - results.push_back(saved_form.Pass()); + results.push_back(std::move(saved_form)); saved_form.reset(new PasswordForm(*saved_match())); saved_form->username_value = ASCIIToUTF16("c@gmail.com"); - results.push_back(saved_form.Pass()); - form_manager()->OnGetPasswordStoreResults(results.Pass()); + results.push_back(std::move(saved_form)); + form_manager()->OnGetPasswordStoreResults(std::move(results)); EXPECT_EQ(2U, form_manager()->best_matches().size()); } @@ -2311,8 +2313,8 @@ TEST_F(PasswordFormManagerTest, ProcessFrame_DriverBeforeMatching) { // Password store responds. scoped_ptr<PasswordForm> match(new PasswordForm(*saved_match())); ScopedVector<PasswordForm> result_form; - result_form.push_back(match.Pass()); - form_manager()->OnGetPasswordStoreResults(result_form.Pass()); + result_form.push_back(std::move(match)); + form_manager()->OnGetPasswordStoreResults(std::move(result_form)); } TEST_F(PasswordFormManagerTest, ProcessFrame_StoreUpdatesCausesAutofill) { diff --git a/components/password_manager/core/browser/password_generation_manager_unittest.cc b/components/password_manager/core/browser/password_generation_manager_unittest.cc index 2aa6780..3acd10e5 100644 --- a/components/password_manager/core/browser/password_generation_manager_unittest.cc +++ b/components/password_manager/core/browser/password_generation_manager_unittest.cc @@ -2,6 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "components/password_manager/core/browser/password_generation_manager.h" + +#include <utility> #include <vector> #include "base/message_loop/message_loop.h" @@ -16,7 +19,6 @@ #include "components/autofill/core/common/form_field_data.h" #include "components/autofill/core/common/password_form_generation_data.h" #include "components/password_manager/core/browser/password_autofill_manager.h" -#include "components/password_manager/core/browser/password_generation_manager.h" #include "components/password_manager/core/browser/password_manager.h" #include "components/password_manager/core/browser/stub_password_manager_client.h" #include "components/password_manager/core/browser/stub_password_manager_driver.h" @@ -76,7 +78,9 @@ class MockPasswordManagerClient : public StubPasswordManagerClient { MOCK_CONST_METHOD0(IsOffTheRecord, bool()); explicit MockPasswordManagerClient(scoped_ptr<PrefService> prefs) - : prefs_(prefs.Pass()), store_(new TestPasswordStore), driver_(this) {} + : prefs_(std::move(prefs)), + store_(new TestPasswordStore), + driver_(this) {} ~MockPasswordManagerClient() override { store_->ShutdownOnUIThread(); } @@ -102,7 +106,7 @@ class PasswordGenerationManagerTest : public testing::Test { scoped_ptr<TestingPrefServiceSimple> prefs(new TestingPrefServiceSimple()); prefs->registry()->RegisterBooleanPref(prefs::kPasswordManagerSavingEnabled, true); - client_.reset(new MockPasswordManagerClient(prefs.Pass())); + client_.reset(new MockPasswordManagerClient(std::move(prefs))); } void TearDown() override { client_.reset(); } diff --git a/components/password_manager/core/browser/password_manager.cc b/components/password_manager/core/browser/password_manager.cc index bd85173..dda28e8 100644 --- a/components/password_manager/core/browser/password_manager.cc +++ b/components/password_manager/core/browser/password_manager.cc @@ -5,8 +5,8 @@ #include "components/password_manager/core/browser/password_manager.h" #include <stddef.h> - #include <map> +#include <utility> #include "base/command_line.h" #include "base/metrics/field_trial.h" @@ -704,7 +704,7 @@ void PasswordManager::OnLoginSuccessful() { provisional_save_manager_->password_overridden() || provisional_save_manager_->retry_password_form_password_update(); if (client_->PromptUserToSaveOrUpdatePassword( - provisional_save_manager_.Pass(), + std::move(provisional_save_manager_), CredentialSourceType::CREDENTIAL_SOURCE_PASSWORD_MANAGER, update_password)) { if (logger) @@ -716,7 +716,7 @@ void PasswordManager::OnLoginSuccessful() { provisional_save_manager_->Save(); if (provisional_save_manager_->has_generated_password()) { - client_->AutomaticPasswordSave(provisional_save_manager_.Pass()); + client_->AutomaticPasswordSave(std::move(provisional_save_manager_)); } else { provisional_save_manager_.reset(); } diff --git a/components/password_manager/core/browser/password_manager_test_utils.cc b/components/password_manager/core/browser/password_manager_test_utils.cc index de096e9..170be56 100644 --- a/components/password_manager/core/browser/password_manager_test_utils.cc +++ b/components/password_manager/core/browser/password_manager_test_utils.cc @@ -56,7 +56,7 @@ scoped_ptr<PasswordForm> CreatePasswordFormFromDataForTesting( form->blacklisted_by_user = true; } form->icon_url = GURL(kTestingIconUrlSpec); - return form.Pass(); + return form; } bool ContainsEqualPasswordFormsUnordered( diff --git a/components/password_manager/core/browser/password_manager_unittest.cc b/components/password_manager/core/browser/password_manager_unittest.cc index fb3fdc7..734b15a 100644 --- a/components/password_manager/core/browser/password_manager_unittest.cc +++ b/components/password_manager/core/browser/password_manager_unittest.cc @@ -5,6 +5,7 @@ #include "components/password_manager/core/browser/password_manager.h" #include <string> +#include <utility> #include <vector> #include "base/command_line.h" @@ -47,7 +48,7 @@ class MockStoreResultFilter : public CredentialsFilter { ScopedVector<autofill::PasswordForm> FilterResults( ScopedVector<autofill::PasswordForm> results) const override { FilterResultsPtr(&results); - return results.Pass(); + return results; } }; @@ -101,7 +102,7 @@ class MockPasswordManagerDriver : public StubPasswordManagerDriver { ACTION_P(InvokeConsumer, form) { ScopedVector<PasswordForm> result; result.push_back(make_scoped_ptr(new PasswordForm(form))); - arg0->OnGetPasswordStoreResults(result.Pass()); + arg0->OnGetPasswordStoreResults(std::move(result)); } ACTION(InvokeEmptyConsumerWithForms) { diff --git a/components/password_manager/core/browser/password_store.cc b/components/password_manager/core/browser/password_store.cc index 12a36d8..52bb385 100644 --- a/components/password_manager/core/browser/password_store.cc +++ b/components/password_manager/core/browser/password_store.cc @@ -57,7 +57,7 @@ void PasswordStore::GetLoginsRequest::NotifyConsumerWithResults( login = nullptr; } } - results = remaining_logins.Pass(); + results = std::move(remaining_logins); } origin_task_runner_->PostTask( @@ -91,7 +91,7 @@ bool PasswordStore::Init(const syncer::SyncableService::StartSyncFlare& flare) { void PasswordStore::SetAffiliatedMatchHelper( scoped_ptr<AffiliatedMatchHelper> helper) { - affiliated_match_helper_ = helper.Pass(); + affiliated_match_helper_ = std::move(helper); } void PasswordStore::AddLogin(const PasswordForm& form) { @@ -402,7 +402,7 @@ void PasswordStore::GetAutofillableLoginsImpl( ScopedVector<PasswordForm> obtained_forms; if (!FillAutofillableLogins(&obtained_forms)) obtained_forms.clear(); - request->NotifyConsumerWithResults(obtained_forms.Pass()); + request->NotifyConsumerWithResults(std::move(obtained_forms)); } void PasswordStore::GetBlacklistLoginsImpl( @@ -410,7 +410,7 @@ void PasswordStore::GetBlacklistLoginsImpl( ScopedVector<PasswordForm> obtained_forms; if (!FillBlacklistLogins(&obtained_forms)) obtained_forms.clear(); - request->NotifyConsumerWithResults(obtained_forms.Pass()); + request->NotifyConsumerWithResults(std::move(obtained_forms)); } void PasswordStore::NotifySiteStats(const GURL& origin_domain, @@ -441,7 +441,7 @@ void PasswordStore::GetLoginsWithAffiliationsImpl( results.insert(results.end(), more_results.begin(), more_results.end()); more_results.weak_clear(); } - request->NotifyConsumerWithResults(results.Pass()); + request->NotifyConsumerWithResults(std::move(results)); } void PasswordStore::ScheduleGetLoginsWithAffiliations( @@ -464,7 +464,7 @@ scoped_ptr<PasswordForm> PasswordStore::GetLoginImpl( !candidate->is_public_suffix_match) { scoped_ptr<PasswordForm> result(candidate); candidate = nullptr; - return result.Pass(); + return result; } } return make_scoped_ptr<PasswordForm>(nullptr); diff --git a/components/password_manager/core/browser/password_store_default.cc b/components/password_manager/core/browser/password_store_default.cc index 7e3fac6..30861b1 100644 --- a/components/password_manager/core/browser/password_store_default.cc +++ b/components/password_manager/core/browser/password_store_default.cc @@ -5,6 +5,7 @@ #include "components/password_manager/core/browser/password_store_default.h" #include <set> +#include <utility> #include "base/logging.h" #include "base/prefs/pref_service.h" @@ -21,8 +22,7 @@ PasswordStoreDefault::PasswordStoreDefault( scoped_refptr<base::SingleThreadTaskRunner> db_thread_runner, scoped_ptr<LoginDatabase> login_db) : PasswordStore(main_thread_runner, db_thread_runner), - login_db_(login_db.Pass()) { -} + login_db_(std::move(login_db)) {} PasswordStoreDefault::~PasswordStoreDefault() { } @@ -150,7 +150,7 @@ ScopedVector<autofill::PasswordForm> PasswordStoreDefault::FillMatchingLogins( ScopedVector<autofill::PasswordForm> matched_forms; if (login_db_ && !login_db_->GetLogins(form, &matched_forms)) return ScopedVector<autofill::PasswordForm>(); - return matched_forms.Pass(); + return matched_forms; } bool PasswordStoreDefault::FillAutofillableLogins( diff --git a/components/password_manager/core/browser/password_store_default_unittest.cc b/components/password_manager/core/browser/password_store_default_unittest.cc index 0e2be84..9c05f74 100644 --- a/components/password_manager/core/browser/password_store_default_unittest.cc +++ b/components/password_manager/core/browser/password_store_default_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 "components/password_manager/core/browser/password_store_default.h" + +#include <utility> + #include "base/bind.h" #include "base/bind_helpers.h" #include "base/files/file_util.h" @@ -17,7 +21,6 @@ #include "components/password_manager/core/browser/password_manager_test_utils.h" #include "components/password_manager/core/browser/password_store_change.h" #include "components/password_manager/core/browser/password_store_consumer.h" -#include "components/password_manager/core/browser/password_store_default.h" #include "components/password_manager/core/browser/password_store_origin_unittest.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" @@ -111,7 +114,7 @@ PasswordStoreDefaultTestDelegate::PasswordStoreDefaultTestDelegate() { PasswordStoreDefaultTestDelegate::PasswordStoreDefaultTestDelegate( scoped_ptr<LoginDatabase> database) { SetupTempDir(); - store_ = CreateInitializedStore(database.Pass()); + store_ = CreateInitializedStore(std::move(database)); } PasswordStoreDefaultTestDelegate::~PasswordStoreDefaultTestDelegate() { @@ -137,7 +140,7 @@ PasswordStoreDefaultTestDelegate::CreateInitializedStore( scoped_ptr<LoginDatabase> database) { scoped_refptr<PasswordStoreDefault> store(new PasswordStoreDefault( base::ThreadTaskRunnerHandle::Get(), base::ThreadTaskRunnerHandle::Get(), - database.Pass())); + std::move(database))); store->Init(syncer::SyncableService::StartSyncFlare()); return store; @@ -180,7 +183,7 @@ TEST(PasswordStoreDefaultTest, NonASCIIData) { ScopedVector<PasswordForm> expected_forms; for (unsigned int i = 0; i < arraysize(form_data); ++i) { expected_forms.push_back( - CreatePasswordFormFromDataForTesting(form_data[i]).Pass()); + CreatePasswordFormFromDataForTesting(form_data[i])); store->AddLogin(*expected_forms.back()); } diff --git a/components/password_manager/core/browser/password_store_factory_util.cc b/components/password_manager/core/browser/password_store_factory_util.cc index eaf114b..5f6eb80 100644 --- a/components/password_manager/core/browser/password_store_factory_util.cc +++ b/components/password_manager/core/browser/password_store_factory_util.cc @@ -4,6 +4,8 @@ #include "components/password_manager/core/browser/password_store_factory_util.h" +#include <utility> + #include "base/command_line.h" #include "components/password_manager/core/browser/affiliated_match_helper.h" #include "components/password_manager/core/browser/affiliation_service.h" @@ -38,9 +40,10 @@ void ActivateAffiliationBasedMatching( new AffiliationService(db_thread_runner)); affiliation_service->Initialize(request_context_getter, db_path); scoped_ptr<AffiliatedMatchHelper> affiliated_match_helper( - new AffiliatedMatchHelper(password_store, affiliation_service.Pass())); + new AffiliatedMatchHelper(password_store, + std::move(affiliation_service))); affiliated_match_helper->Initialize(); - password_store->SetAffiliatedMatchHelper(affiliated_match_helper.Pass()); + password_store->SetAffiliatedMatchHelper(std::move(affiliated_match_helper)); password_store->enable_propagating_password_changes_to_web_credentials( IsPropagatingPasswordChangesToWebCredentialsEnabled( diff --git a/components/password_manager/core/browser/password_store_unittest.cc b/components/password_manager/core/browser/password_store_unittest.cc index 07ce31b..7607c59 100644 --- a/components/password_manager/core/browser/password_store_unittest.cc +++ b/components/password_manager/core/browser/password_store_unittest.cc @@ -8,6 +8,7 @@ // passwords. This will not be needed anymore if crbug.com/466638 is fixed. #include <stddef.h> +#include <utility> #include "base/bind.h" #include "base/files/scoped_temp_dir.h" @@ -169,8 +170,7 @@ TEST_F(PasswordStoreTest, IgnoreOldWwwGoogleLogins) { // Build the forms vector and add the forms to the store. ScopedVector<PasswordForm> all_forms; for (size_t i = 0; i < arraysize(form_data); ++i) { - all_forms.push_back( - CreatePasswordFormFromDataForTesting(form_data[i]).Pass()); + all_forms.push_back(CreatePasswordFormFromDataForTesting(form_data[i])); store->AddLogin(*all_forms.back()); } base::MessageLoop::current()->RunUntilIdle(); @@ -340,7 +340,7 @@ TEST_F(PasswordStoreTest, UpdateLoginPrimaryKeyFields) { MockPasswordStoreConsumer mock_consumer; ScopedVector<autofill::PasswordForm> expected_forms; - expected_forms.push_back(new_form.Pass()); + expected_forms.push_back(std::move(new_form)); EXPECT_CALL(mock_consumer, OnGetPasswordStoreResultsConstRef( UnorderedPasswordFormElementsAre(expected_forms.get()))); diff --git a/components/password_manager/core/browser/password_syncable_service.cc b/components/password_manager/core/browser/password_syncable_service.cc index 887750f..f790d3d 100644 --- a/components/password_manager/core/browser/password_syncable_service.cc +++ b/components/password_manager/core/browser/password_syncable_service.cc @@ -4,6 +4,8 @@ #include "components/password_manager/core/browser/password_syncable_service.h" +#include <utility> + #include "base/auto_reset.h" #include "base/location.h" #include "base/memory/scoped_vector.h" @@ -218,8 +220,8 @@ syncer::SyncMergeResult PasswordSyncableService::MergeDataAndStartSyncing( // Save |sync_processor_| only if the whole procedure succeeded. In case of // failure Sync shouldn't receive any updates from the PasswordStore. - sync_error_factory_ = sync_error_factory.Pass(); - sync_processor_ = sync_processor.Pass(); + sync_error_factory_ = std::move(sync_error_factory); + sync_processor_ = std::move(sync_processor); metrics_util::LogPasswordSyncState(metrics_util::SYNCING_OK); return merge_result; diff --git a/components/password_manager/core/browser/password_syncable_service_unittest.cc b/components/password_manager/core/browser/password_syncable_service_unittest.cc index 7ca42ad..dcad212 100644 --- a/components/password_manager/core/browser/password_syncable_service_unittest.cc +++ b/components/password_manager/core/browser/password_syncable_service_unittest.cc @@ -6,6 +6,7 @@ #include <algorithm> #include <string> +#include <utility> #include <vector> #include "base/location.h" @@ -203,7 +204,7 @@ class PasswordSyncableServiceWrapper { // Returnes the scoped_ptr to |service_| thus NULLing out it. scoped_ptr<syncer::SyncChangeProcessor> ReleaseSyncableService() { - return service_.Pass(); + return std::move(service_); } private: @@ -250,9 +251,8 @@ TEST_F(PasswordSyncableServiceTest, AdditionsInBoth) { EXPECT_CALL(*processor_, ProcessSyncChanges(_, ElementsAre( SyncChangeIs(SyncChange::ACTION_ADD, form)))); - service()->MergeDataAndStartSyncing(syncer::PASSWORDS, - list, - processor_.Pass(), + service()->MergeDataAndStartSyncing(syncer::PASSWORDS, list, + std::move(processor_), scoped_ptr<syncer::SyncErrorFactory>()); } @@ -269,9 +269,8 @@ TEST_F(PasswordSyncableServiceTest, AdditionOnlyInSync) { EXPECT_CALL(*password_store(), AddLoginImpl(PasswordIs(new_from_sync))); EXPECT_CALL(*processor_, ProcessSyncChanges(_, IsEmpty())); - service()->MergeDataAndStartSyncing(syncer::PASSWORDS, - list, - processor_.Pass(), + service()->MergeDataAndStartSyncing(syncer::PASSWORDS, list, + std::move(processor_), scoped_ptr<syncer::SyncErrorFactory>()); } @@ -293,9 +292,8 @@ TEST_F(PasswordSyncableServiceTest, AdditionOnlyInPasswordStore) { EXPECT_CALL(*processor_, ProcessSyncChanges(_, ElementsAre( SyncChangeIs(SyncChange::ACTION_ADD, form)))); - service()->MergeDataAndStartSyncing(syncer::PASSWORDS, - SyncDataList(), - processor_.Pass(), + service()->MergeDataAndStartSyncing(syncer::PASSWORDS, SyncDataList(), + std::move(processor_), scoped_ptr<syncer::SyncErrorFactory>()); } @@ -314,10 +312,8 @@ TEST_F(PasswordSyncableServiceTest, BothInSync) { EXPECT_CALL(*processor_, ProcessSyncChanges(_, IsEmpty())); service()->MergeDataAndStartSyncing( - syncer::PASSWORDS, - SyncDataList(1, SyncDataFromPassword(form)), - processor_.Pass(), - scoped_ptr<syncer::SyncErrorFactory>()); + syncer::PASSWORDS, SyncDataList(1, SyncDataFromPassword(form)), + std::move(processor_), scoped_ptr<syncer::SyncErrorFactory>()); } // Both passwords db and sync have the same data but they need to be merged @@ -340,10 +336,8 @@ TEST_F(PasswordSyncableServiceTest, Merge) { EXPECT_CALL(*processor_, ProcessSyncChanges(_, IsEmpty())); service()->MergeDataAndStartSyncing( - syncer::PASSWORDS, - SyncDataList(1, SyncDataFromPassword(form2)), - processor_.Pass(), - scoped_ptr<syncer::SyncErrorFactory>()); + syncer::PASSWORDS, SyncDataList(1, SyncDataFromPassword(form2)), + std::move(processor_), scoped_ptr<syncer::SyncErrorFactory>()); } // Initiate sync due to local DB changes. @@ -356,9 +350,8 @@ TEST_F(PasswordSyncableServiceTest, PasswordStoreChanges) { .WillOnce(Return(true)); EXPECT_CALL(*password_store(), FillBlacklistLogins(_)) .WillOnce(Return(true)); - service()->MergeDataAndStartSyncing(syncer::PASSWORDS, - SyncDataList(), - processor_.Pass(), + service()->MergeDataAndStartSyncing(syncer::PASSWORDS, SyncDataList(), + std::move(processor_), scoped_ptr<syncer::SyncErrorFactory>()); autofill::PasswordForm form1; @@ -518,11 +511,9 @@ TEST_F(PasswordSyncableServiceTest, FailedReadFromPasswordStore) { // ActOnPasswordStoreChanges() below shouldn't generate any changes for Sync. // |processor_| will be destroyed in MergeDataAndStartSyncing(). EXPECT_CALL(*processor_, ProcessSyncChanges(_, _)).Times(0); - syncer::SyncMergeResult result = - service()->MergeDataAndStartSyncing(syncer::PASSWORDS, - syncer::SyncDataList(), - processor_.Pass(), - error_factory.Pass()); + syncer::SyncMergeResult result = service()->MergeDataAndStartSyncing( + syncer::PASSWORDS, syncer::SyncDataList(), std::move(processor_), + std::move(error_factory)); EXPECT_TRUE(result.error().IsSet()); autofill::PasswordForm form; @@ -552,11 +543,9 @@ TEST_F(PasswordSyncableServiceTest, FailedProcessSyncChanges) { EXPECT_CALL(*processor_, ProcessSyncChanges(_, _)) .Times(1) .WillOnce(Return(error)); - syncer::SyncMergeResult result = - service()->MergeDataAndStartSyncing(syncer::PASSWORDS, - syncer::SyncDataList(), - processor_.Pass(), - error_factory.Pass()); + syncer::SyncMergeResult result = service()->MergeDataAndStartSyncing( + syncer::PASSWORDS, syncer::SyncDataList(), std::move(processor_), + std::move(error_factory)); EXPECT_TRUE(result.error().IsSet()); form.signon_realm = kSignonRealm2; @@ -592,9 +581,8 @@ TEST_F(PasswordSyncableServiceTest, MergeEmptyPasswords) { SyncChangeIs(SyncChange::ACTION_DELETE, old_empty_form), SyncChangeIs(SyncChange::ACTION_DELETE, sync_empty_form)))); - service()->MergeDataAndStartSyncing(syncer::PASSWORDS, - sync_data, - processor_.Pass(), + service()->MergeDataAndStartSyncing(syncer::PASSWORDS, sync_data, + std::move(processor_), scoped_ptr<syncer::SyncErrorFactory>()); } diff --git a/components/password_manager/core/browser/stub_password_manager_client.cc b/components/password_manager/core/browser/stub_password_manager_client.cc index 64ec537..f450b40 100644 --- a/components/password_manager/core/browser/stub_password_manager_client.cc +++ b/components/password_manager/core/browser/stub_password_manager_client.cc @@ -14,7 +14,7 @@ namespace password_manager { ScopedVector<autofill::PasswordForm> StubPasswordManagerClient::PassThroughCredentialsFilter::FilterResults( ScopedVector<autofill::PasswordForm> results) const { - return results.Pass(); + return results; } bool StubPasswordManagerClient::PassThroughCredentialsFilter::ShouldSave( diff --git a/components/password_manager/core/browser/test_password_store.cc b/components/password_manager/core/browser/test_password_store.cc index 77df359..1f583525 100644 --- a/components/password_manager/core/browser/test_password_store.cc +++ b/components/password_manager/core/browser/test_password_store.cc @@ -89,7 +89,7 @@ ScopedVector<autofill::PasswordForm> TestPasswordStore::FillMatchingLogins( for (const auto& stored_form : forms) { matched_forms.push_back(new autofill::PasswordForm(stored_form)); } - return matched_forms.Pass(); + return matched_forms; } void TestPasswordStore::ReportMetricsImpl(const std::string& sync_username, diff --git a/components/password_manager/core/common/credential_manager_types.cc b/components/password_manager/core/common/credential_manager_types.cc index acdff8d..6af4a50 100644 --- a/components/password_manager/core/common/credential_manager_types.cc +++ b/components/password_manager/core/common/credential_manager_types.cc @@ -42,7 +42,7 @@ scoped_ptr<autofill::PasswordForm> CreatePasswordFormFromCredentialInfo( const GURL& origin) { scoped_ptr<autofill::PasswordForm> form; if (info.type == CredentialType::CREDENTIAL_TYPE_EMPTY) - return form.Pass(); + return form; form.reset(new autofill::PasswordForm); form->icon_url = info.icon; @@ -58,7 +58,7 @@ scoped_ptr<autofill::PasswordForm> CreatePasswordFormFromCredentialInfo( ? origin.spec() : "federation://" + origin.host() + "/" + info.federation.host(); form->username_value = info.id; - return form.Pass(); + return form; } bool CredentialInfo::operator==(const CredentialInfo& rhs) const { return (type == rhs.type && id == rhs.id && name == rhs.name && diff --git a/components/password_manager/sync/browser/sync_credentials_filter.cc b/components/password_manager/sync/browser/sync_credentials_filter.cc index e5ea09c..93031c7 100644 --- a/components/password_manager/sync/browser/sync_credentials_filter.cc +++ b/components/password_manager/sync/browser/sync_credentials_filter.cc @@ -57,7 +57,7 @@ ScopedVector<PasswordForm> SyncCredentialsFilter::FilterResults( (autofill_sync_state != DISALLOW_SYNC_CREDENTIALS_FOR_REAUTH || !LastLoadWasTransactionalReauthPage( client_->GetLastCommittedEntryURL()))) { - return results.Pass(); + return results; } auto begin_of_removed = @@ -72,7 +72,7 @@ ScopedVector<PasswordForm> SyncCredentialsFilter::FilterResults( results.erase(begin_of_removed, results.end()); - return results.Pass(); + return results; } bool SyncCredentialsFilter::ShouldSave( diff --git a/components/password_manager/sync/browser/sync_credentials_filter_unittest.cc b/components/password_manager/sync/browser/sync_credentials_filter_unittest.cc index 1efcba1..cc43857 100644 --- a/components/password_manager/sync/browser/sync_credentials_filter_unittest.cc +++ b/components/password_manager/sync/browser/sync_credentials_filter_unittest.cc @@ -5,6 +5,7 @@ #include "components/password_manager/sync/browser/sync_credentials_filter.h" #include <stddef.h> +#include <utility> #include "base/bind.h" #include "base/bind_helpers.h" @@ -43,7 +44,7 @@ class FakePasswordManagerClient : public StubPasswordManagerClient { bool IsFormFiltered(const CredentialsFilter* filter, const PasswordForm& form) { ScopedVector<PasswordForm> vector; vector.push_back(new PasswordForm(form)); - vector = filter->FilterResults(vector.Pass()); + vector = filter->FilterResults(std::move(vector)); return vector.empty(); } @@ -257,7 +258,7 @@ TEST_F(CredentialsFilterTest, ShouldFilterOneForm) { FakeSigninAs("test1@gmail.com"); - results = filter()->FilterResults(results.Pass()); + results = filter()->FilterResults(std::move(results)); ASSERT_EQ(1u, results.size()); EXPECT_EQ(SimpleGaiaForm("test2@gmail.com"), *results[0]); diff --git a/components/pdf/browser/pdf_web_contents_helper.cc b/components/pdf/browser/pdf_web_contents_helper.cc index b1b8cd1..e40735c 100644 --- a/components/pdf/browser/pdf_web_contents_helper.cc +++ b/components/pdf/browser/pdf_web_contents_helper.cc @@ -4,6 +4,8 @@ #include "components/pdf/browser/pdf_web_contents_helper.h" +#include <utility> + #include "base/bind.h" #include "base/strings/utf_string_conversions.h" #include "components/pdf/browser/open_pdf_in_reader_prompt_client.h" @@ -22,21 +24,20 @@ void PDFWebContentsHelper::CreateForWebContentsWithClient( if (FromWebContents(contents)) return; contents->SetUserData(UserDataKey(), - new PDFWebContentsHelper(contents, client.Pass())); + new PDFWebContentsHelper(contents, std::move(client))); } PDFWebContentsHelper::PDFWebContentsHelper( content::WebContents* web_contents, scoped_ptr<PDFWebContentsHelperClient> client) - : content::WebContentsObserver(web_contents), client_(client.Pass()) { -} + : content::WebContentsObserver(web_contents), client_(std::move(client)) {} PDFWebContentsHelper::~PDFWebContentsHelper() { } void PDFWebContentsHelper::ShowOpenInReaderPrompt( scoped_ptr<OpenPDFInReaderPromptClient> prompt) { - open_in_reader_prompt_ = prompt.Pass(); + open_in_reader_prompt_ = std::move(prompt); UpdateLocationBar(); } diff --git a/components/pdf_viewer/pdf_viewer.cc b/components/pdf_viewer/pdf_viewer.cc index a542c3a..38eef0b 100644 --- a/components/pdf_viewer/pdf_viewer.cc +++ b/components/pdf_viewer/pdf_viewer.cc @@ -4,6 +4,7 @@ #include <stddef.h> #include <stdint.h> +#include <utility> #include "base/bind.h" #include "base/callback.h" @@ -102,7 +103,7 @@ class PDFView : public mus::WindowTreeDelegate, FPDF_ClosePage(page); - bitmap_uploader_->SetBitmap(width, height, bitmap.Pass(), + bitmap_uploader_->SetBitmap(width, height, std::move(bitmap), bitmap_uploader::BitmapUploader::BGRA); } @@ -178,7 +179,7 @@ class PDFView : public mus::WindowTreeDelegate, const OnConnectCallback& callback) override { callback.Run(); - frame_ = frame.Pass(); + frame_ = std::move(frame); frame_->DidCommitProvisionalLoad(); } void OnFrameAdded(uint32_t change_id, @@ -217,7 +218,7 @@ class PDFView : public mus::WindowTreeDelegate, void Create( mojo::ApplicationConnection* connection, mojo::InterfaceRequest<web_view::mojom::FrameClient> request) override { - frame_client_binding_.Bind(request.Pass()); + frame_client_binding_.Bind(std::move(request)); } scoped_ptr<mojo::AppRefCount> app_ref_; @@ -247,13 +248,13 @@ class PDFViewerApplicationDelegate mojo::URLResponsePtr response, const mojo::Callback<void()>& destruct_callback) : app_(this, - request.Pass(), + std::move(request), base::Bind(&PDFViewerApplicationDelegate::OnTerminate, base::Unretained(this))), doc_(nullptr), is_destroying_(false), destruct_callback_(destruct_callback) { - FetchPDF(response.Pass()); + FetchPDF(std::move(response)); } ~PDFViewerApplicationDelegate() override { @@ -268,7 +269,7 @@ class PDFViewerApplicationDelegate private: void FetchPDF(mojo::URLResponsePtr response) { data_.clear(); - mojo::common::BlockingCopyToString(response->body.Pass(), &data_); + mojo::common::BlockingCopyToString(std::move(response->body), &data_); if (data_.length() >= static_cast<size_t>(std::numeric_limits<int>::max())) return; doc_ = FPDF_LoadMemDocument(data_.data(), static_cast<int>(data_.length()), @@ -303,7 +304,7 @@ class PDFViewerApplicationDelegate base::Unretained(this))); pdf_views_.push_back(pdf_view); mus::WindowTreeConnection::Create( - pdf_view, request.Pass(), + pdf_view, std::move(request), mus::WindowTreeConnection::CreateType::DONT_WAIT_FOR_EMBED); } @@ -320,7 +321,7 @@ class PDFViewerApplicationDelegate class ContentHandlerImpl : public mojo::ContentHandler { public: ContentHandlerImpl(mojo::InterfaceRequest<ContentHandler> request) - : binding_(this, request.Pass()) {} + : binding_(this, std::move(request)) {} ~ContentHandlerImpl() override {} private: @@ -329,8 +330,8 @@ class ContentHandlerImpl : public mojo::ContentHandler { mojo::InterfaceRequest<mojo::Application> request, mojo::URLResponsePtr response, const mojo::Callback<void()>& destruct_callback) override { - new PDFViewerApplicationDelegate( - request.Pass(), response.Pass(), destruct_callback); + new PDFViewerApplicationDelegate(std::move(request), std::move(response), + destruct_callback); } mojo::StrongBinding<mojo::ContentHandler> binding_; @@ -363,7 +364,7 @@ class PDFViewer : public mojo::ApplicationDelegate, // InterfaceFactory<ContentHandler>: void Create(mojo::ApplicationConnection* connection, mojo::InterfaceRequest<mojo::ContentHandler> request) override { - new ContentHandlerImpl(request.Pass()); + new ContentHandlerImpl(std::move(request)); } mojo::TracingImpl tracing_; diff --git a/components/policy/core/browser/browser_policy_connector.cc b/components/policy/core/browser/browser_policy_connector.cc index 3b783f3..a043fe1 100644 --- a/components/policy/core/browser/browser_policy_connector.cc +++ b/components/policy/core/browser/browser_policy_connector.cc @@ -5,8 +5,8 @@ #include "components/policy/core/browser/browser_policy_connector.h" #include <stddef.h> - #include <algorithm> +#include <utility> #include <vector> #include "base/command_line.h" @@ -103,7 +103,7 @@ void BrowserPolicyConnector::InitInternal( scoped_ptr<DeviceManagementService> device_management_service) { DCHECK(!is_initialized()); - device_management_service_ = device_management_service.Pass(); + device_management_service_ = std::move(device_management_service); policy_statistics_collector_.reset(new policy::PolicyStatisticsCollector( base::Bind(&GetChromePolicyDetails), GetChromeSchema(), diff --git a/components/policy/core/browser/browser_policy_connector_base.cc b/components/policy/core/browser/browser_policy_connector_base.cc index 4b0c6fb..a36a78a 100644 --- a/components/policy/core/browser/browser_policy_connector_base.cc +++ b/components/policy/core/browser/browser_policy_connector_base.cc @@ -5,7 +5,7 @@ #include "components/policy/core/browser/browser_policy_connector_base.h" #include <stddef.h> - +#include <utility> #include <vector> #include "base/logging.h" @@ -129,7 +129,7 @@ void BrowserPolicyConnectorBase::SetPlatformPolicyProvider( scoped_ptr<ConfigurationPolicyProvider> provider) { CHECK(!platform_policy_provider_); platform_policy_provider_ = provider.get(); - AddPolicyProvider(provider.Pass()); + AddPolicyProvider(std::move(provider)); } } // namespace policy diff --git a/components/policy/core/browser/configuration_policy_handler.cc b/components/policy/core/browser/configuration_policy_handler.cc index 064cb7f..fff61fe 100644 --- a/components/policy/core/browser/configuration_policy_handler.cc +++ b/components/policy/core/browser/configuration_policy_handler.cc @@ -5,8 +5,8 @@ #include "components/policy/core/browser/configuration_policy_handler.h" #include <stddef.h> - #include <algorithm> +#include <utility> #include "base/callback.h" #include "base/files/file_path.h" @@ -151,8 +151,9 @@ bool IntRangePolicyHandlerBase::EnsureInRange(const base::Value* input, // StringMappingListPolicyHandler implementation ----------------------------- StringMappingListPolicyHandler::MappingEntry::MappingEntry( - const char* policy_value, scoped_ptr<base::Value> map) - : enum_value(policy_value), mapped_value(map.Pass()) {} + const char* policy_value, + scoped_ptr<base::Value> map) + : enum_value(policy_value), mapped_value(std::move(map)) {} StringMappingListPolicyHandler::MappingEntry::~MappingEntry() {} @@ -182,7 +183,7 @@ void StringMappingListPolicyHandler::ApplyPolicySettings( const base::Value* value = policies.GetValue(policy_name()); scoped_ptr<base::ListValue> list(new base::ListValue()); if (value && Convert(value, list.get(), NULL)) - prefs->SetValue(pref_path_, list.Pass()); + prefs->SetValue(pref_path_, std::move(list)); } bool StringMappingListPolicyHandler::Convert(const base::Value* input, @@ -241,7 +242,7 @@ scoped_ptr<base::Value> StringMappingListPolicyHandler::Map( break; } } - return return_value.Pass(); + return return_value; } // IntRangePolicyHandler implementation ---------------------------------------- @@ -436,9 +437,8 @@ void SimpleSchemaValidatingPolicyHandler::ApplyPolicySettings( LegacyPoliciesDeprecatingPolicyHandler::LegacyPoliciesDeprecatingPolicyHandler( ScopedVector<ConfigurationPolicyHandler> legacy_policy_handlers, scoped_ptr<SchemaValidatingPolicyHandler> new_policy_handler) - : legacy_policy_handlers_(legacy_policy_handlers.Pass()), - new_policy_handler_(new_policy_handler.Pass()) { -} + : legacy_policy_handlers_(std::move(legacy_policy_handlers)), + new_policy_handler_(std::move(new_policy_handler)) {} LegacyPoliciesDeprecatingPolicyHandler:: ~LegacyPoliciesDeprecatingPolicyHandler() { diff --git a/components/policy/core/browser/url_blacklist_manager.cc b/components/policy/core/browser/url_blacklist_manager.cc index ae7b071..ffc8dac 100644 --- a/components/policy/core/browser/url_blacklist_manager.cc +++ b/components/policy/core/browser/url_blacklist_manager.cc @@ -5,8 +5,8 @@ #include "components/policy/core/browser/url_blacklist_manager.h" #include <stdint.h> - #include <limits> +#include <utility> #include "base/bind.h" #include "base/files/file_path.h" @@ -67,7 +67,7 @@ scoped_ptr<URLBlacklist> BuildBlacklist( scoped_ptr<URLBlacklist> blacklist(new URLBlacklist(segment_url)); blacklist->Block(block.get()); blacklist->Allow(allow.get()); - return blacklist.Pass(); + return blacklist; } // Tokenise the parameter |query| and add appropriate query element matcher @@ -361,11 +361,9 @@ scoped_refptr<URLMatcherConditionSet> URLBlacklist::CreateConditionSet( port_filter.reset(new URLMatcherPortFilter(ranges)); } - return new URLMatcherConditionSet(id, - conditions, - query_conditions, - scheme_filter.Pass(), - port_filter.Pass()); + return new URLMatcherConditionSet(id, conditions, query_conditions, + std::move(scheme_filter), + std::move(port_filter)); } // static @@ -485,7 +483,7 @@ void URLBlacklistManager::UpdateOnIO(scoped_ptr<base::ListValue> block, void URLBlacklistManager::SetBlacklist(scoped_ptr<URLBlacklist> blacklist) { DCHECK(io_task_runner_->RunsTasksOnCurrentThread()); - blacklist_ = blacklist.Pass(); + blacklist_ = std::move(blacklist); } bool URLBlacklistManager::IsURLBlocked(const GURL& url) const { diff --git a/components/policy/core/browser/url_blacklist_manager_unittest.cc b/components/policy/core/browser/url_blacklist_manager_unittest.cc index 734ae21..5e6e7f5 100644 --- a/components/policy/core/browser/url_blacklist_manager_unittest.cc +++ b/components/policy/core/browser/url_blacklist_manager_unittest.cc @@ -5,8 +5,8 @@ #include "components/policy/core/browser/url_blacklist_manager.h" #include <stdint.h> - #include <ostream> +#include <utility> #include "base/bind.h" #include "base/callback.h" @@ -57,13 +57,13 @@ class TestingURLBlacklistManager : public URLBlacklistManager { scoped_ptr<base::ListValue> block(new base::ListValue); block->Append(new base::StringValue("example.com")); scoped_ptr<base::ListValue> allow(new base::ListValue); - URLBlacklistManager::UpdateOnIO(block.Pass(), allow.Pass()); + URLBlacklistManager::UpdateOnIO(std::move(block), std::move(allow)); } // URLBlacklistManager overrides: void SetBlacklist(scoped_ptr<URLBlacklist> blacklist) override { set_blacklist_called_ = true; - URLBlacklistManager::SetBlacklist(blacklist.Pass()); + URLBlacklistManager::SetBlacklist(std::move(blacklist)); } void Update() override { @@ -642,7 +642,7 @@ TEST_F(URLBlacklistManagerTest, DontBlockResources) { scoped_ptr<base::ListValue> blocked(new base::ListValue); blocked->Append(new base::StringValue("google.com")); blacklist->Block(blocked.get()); - blacklist_manager_->SetBlacklist(blacklist.Pass()); + blacklist_manager_->SetBlacklist(std::move(blacklist)); EXPECT_TRUE(blacklist_manager_->IsURLBlocked(GURL("http://google.com"))); int reason = net::ERR_UNEXPECTED; diff --git a/components/policy/core/browser/url_blacklist_policy_handler.cc b/components/policy/core/browser/url_blacklist_policy_handler.cc index e905b77..6bfa20e 100644 --- a/components/policy/core/browser/url_blacklist_policy_handler.cc +++ b/components/policy/core/browser/url_blacklist_policy_handler.cc @@ -4,6 +4,8 @@ #include "components/policy/core/browser/url_blacklist_policy_handler.h" +#include <utility> + #include "base/memory/scoped_ptr.h" #include "base/prefs/pref_value_map.h" #include "base/values.h" @@ -77,7 +79,8 @@ void URLBlacklistPolicyHandler::ApplyPolicySettings(const PolicyMap& policies, } if (disabled_schemes || url_blacklist) { - prefs->SetValue(policy_prefs::kUrlBlacklist, merged_url_blacklist.Pass()); + prefs->SetValue(policy_prefs::kUrlBlacklist, + std::move(merged_url_blacklist)); } } diff --git a/components/policy/core/common/async_policy_loader.cc b/components/policy/core/common/async_policy_loader.cc index e704673..1c974fa 100644 --- a/components/policy/core/common/async_policy_loader.cc +++ b/components/policy/core/common/async_policy_loader.cc @@ -4,6 +4,8 @@ #include "components/policy/core/common/async_policy_loader.h" +#include <utility> + #include "base/bind.h" #include "base/location.h" #include "base/sequenced_task_runner.h" @@ -60,7 +62,7 @@ void AsyncPolicyLoader::Reload(bool force) { // Filter out mismatching policies. schema_map_->FilterBundle(bundle.get()); - update_callback_.Run(bundle.Pass()); + update_callback_.Run(std::move(bundle)); ScheduleNextReload(TimeDelta::FromSeconds(kReloadIntervalSeconds)); } @@ -74,7 +76,7 @@ scoped_ptr<PolicyBundle> AsyncPolicyLoader::InitialLoad( scoped_ptr<PolicyBundle> bundle(Load()); // Filter out mismatching policies. schema_map_->FilterBundle(bundle.get()); - return bundle.Pass(); + return bundle; } void AsyncPolicyLoader::Init(const UpdateCallback& update_callback) { diff --git a/components/policy/core/common/async_policy_provider.cc b/components/policy/core/common/async_policy_provider.cc index ae08b20..80e1be8 100644 --- a/components/policy/core/common/async_policy_provider.cc +++ b/components/policy/core/common/async_policy_provider.cc @@ -4,6 +4,8 @@ #include "components/policy/core/common/async_policy_provider.h" +#include <utility> + #include "base/bind.h" #include "base/bind_helpers.h" #include "base/location.h" @@ -16,11 +18,9 @@ namespace policy { -AsyncPolicyProvider::AsyncPolicyProvider( - SchemaRegistry* registry, - scoped_ptr<AsyncPolicyLoader> loader) - : loader_(loader.Pass()), - weak_factory_(this) { +AsyncPolicyProvider::AsyncPolicyProvider(SchemaRegistry* registry, + scoped_ptr<AsyncPolicyLoader> loader) + : loader_(std::move(loader)), weak_factory_(this) { // Make an immediate synchronous load on startup. OnLoaderReloaded(loader_->InitialLoad(registry->schema_map())); } @@ -115,7 +115,7 @@ void AsyncPolicyProvider::OnLoaderReloaded(scoped_ptr<PolicyBundle> bundle) { // Only propagate policy updates if there are no pending refreshes, and if // Shutdown() hasn't been called yet. if (refresh_callback_.IsCancelled() && loader_) - UpdatePolicy(bundle.Pass()); + UpdatePolicy(std::move(bundle)); } // static diff --git a/components/policy/core/common/async_policy_provider_unittest.cc b/components/policy/core/common/async_policy_provider_unittest.cc index 2dc5b68..b81c132 100644 --- a/components/policy/core/common/async_policy_provider_unittest.cc +++ b/components/policy/core/common/async_policy_provider_unittest.cc @@ -72,7 +72,7 @@ scoped_ptr<PolicyBundle> MockPolicyLoader::Load() { bundle.reset(new PolicyBundle()); bundle->CopyFrom(*loaded); } - return bundle.Pass(); + return bundle; } } // namespace diff --git a/components/policy/core/common/cloud/cloud_policy_client.cc b/components/policy/core/common/cloud/cloud_policy_client.cc index fda118b..ccd6d0e 100644 --- a/components/policy/core/common/cloud/cloud_policy_client.cc +++ b/components/policy/core/common/cloud/cloud_policy_client.cc @@ -4,6 +4,8 @@ #include "components/policy/core/common/cloud/cloud_policy_client.h" +#include <utility> + #include "base/bind.h" #include "base/bind_helpers.h" #include "base/guid.h" @@ -262,7 +264,7 @@ void CloudPolicyClient::UploadCertificate( base::Bind(&CloudPolicyClient::OnCertificateUploadCompleted, base::Unretained(this), request_job.get(), callback); - request_jobs_.push_back(request_job.Pass()); + request_jobs_.push_back(std::move(request_job)); request_jobs_.back()->Start(job_callback); } @@ -289,7 +291,7 @@ void CloudPolicyClient::UploadDeviceStatus( base::Bind(&CloudPolicyClient::OnStatusUploadCompleted, base::Unretained(this), request_job.get(), callback); - request_jobs_.push_back(request_job.Pass()); + request_jobs_.push_back(std::move(request_job)); request_jobs_.back()->Start(job_callback); } @@ -317,7 +319,7 @@ void CloudPolicyClient::FetchRemoteCommands( base::Bind(&CloudPolicyClient::OnRemoteCommandsFetched, base::Unretained(this), request_job.get(), callback); - request_jobs_.push_back(request_job.Pass()); + request_jobs_.push_back(std::move(request_job)); request_jobs_.back()->Start(job_callback); } @@ -342,7 +344,7 @@ void CloudPolicyClient::GetDeviceAttributeUpdatePermission( base::Bind(&CloudPolicyClient::OnDeviceAttributeUpdatePermissionCompleted, base::Unretained(this), request_job.get(), callback); - request_jobs_.push_back(request_job.Pass()); + request_jobs_.push_back(std::move(request_job)); request_jobs_.back()->Start(job_callback); } @@ -372,7 +374,7 @@ void CloudPolicyClient::UpdateDeviceAttributes( base::Bind(&CloudPolicyClient::OnDeviceAttributeUpdated, base::Unretained(this), request_job.get(), callback); - request_jobs_.push_back(request_job.Pass()); + request_jobs_.push_back(std::move(request_job)); request_jobs_.back()->Start(job_callback); } @@ -396,7 +398,7 @@ void CloudPolicyClient::UpdateGcmId( base::Bind(&CloudPolicyClient::OnGcmIdUpdated, base::Unretained(this), request_job.get(), callback); - request_jobs_.push_back(request_job.Pass()); + request_jobs_.push_back(std::move(request_job)); request_jobs_.back()->Start(job_callback); } diff --git a/components/policy/core/common/cloud/cloud_policy_core.cc b/components/policy/core/common/cloud/cloud_policy_core.cc index a2fd68e..fd8e9ef 100644 --- a/components/policy/core/common/cloud/cloud_policy_core.cc +++ b/components/policy/core/common/cloud/cloud_policy_core.cc @@ -4,6 +4,8 @@ #include "components/policy/core/common/cloud/cloud_policy_core.h" +#include <utility> + #include "base/bind.h" #include "base/bind_helpers.h" #include "base/logging.h" @@ -38,7 +40,7 @@ CloudPolicyCore::~CloudPolicyCore() {} void CloudPolicyCore::Connect(scoped_ptr<CloudPolicyClient> client) { CHECK(!client_); CHECK(client); - client_ = client.Pass(); + client_ = std::move(client); service_.reset(new CloudPolicyService(policy_type_, settings_entity_id_, client_.get(), store_)); FOR_EACH_OBSERVER(Observer, observers_, OnCoreConnected(this)); @@ -60,7 +62,7 @@ void CloudPolicyCore::StartRemoteCommandsService( DCHECK(factory); remote_commands_service_.reset( - new RemoteCommandsService(factory.Pass(), client_.get())); + new RemoteCommandsService(std::move(factory), client_.get())); // Do an initial remote commands fetch immediately. remote_commands_service_->FetchRemoteCommands(); diff --git a/components/policy/core/common/cloud/cloud_policy_manager.cc b/components/policy/core/common/cloud/cloud_policy_manager.cc index 4c523bf..db6a3ec 100644 --- a/components/policy/core/common/cloud/cloud_policy_manager.cc +++ b/components/policy/core/common/cloud/cloud_policy_manager.cc @@ -4,6 +4,8 @@ #include "components/policy/core/common/cloud/cloud_policy_manager.h" +#include <utility> + #include "base/bind.h" #include "base/bind_helpers.h" #include "base/command_line.h" @@ -99,7 +101,7 @@ void CloudPolicyManager::CheckAndPublishPolicy() { &bundle->Get(PolicyNamespace(POLICY_DOMAIN_CHROME, std::string()))); if (component_policy_service_) bundle->MergeFrom(component_policy_service_->policy()); - UpdatePolicy(bundle.Pass()); + UpdatePolicy(std::move(bundle)); } } @@ -132,14 +134,8 @@ void CloudPolicyManager::CreateComponentCloudPolicyService( scoped_ptr<ResourceCache> resource_cache( new ResourceCache(policy_cache_path, file_task_runner_)); component_policy_service_.reset(new ComponentCloudPolicyService( - this, - schema_registry(), - core(), - client, - resource_cache.Pass(), - request_context, - file_task_runner_, - io_task_runner_)); + this, schema_registry(), core(), client, std::move(resource_cache), + request_context, file_task_runner_, io_task_runner_)); #endif // !defined(OS_ANDROID) && !defined(OS_IOS) } diff --git a/components/policy/core/common/cloud/cloud_policy_validator.cc b/components/policy/core/common/cloud/cloud_policy_validator.cc index 22e16cf..be2bd6f 100644 --- a/components/policy/core/common/cloud/cloud_policy_validator.cc +++ b/components/policy/core/common/cloud/cloud_policy_validator.cc @@ -5,6 +5,7 @@ #include "components/policy/core/common/cloud/cloud_policy_validator.h" #include <stddef.h> +#include <utility> #include "base/bind_helpers.h" #include "base/location.h" @@ -171,7 +172,7 @@ CloudPolicyValidatorBase::CloudPolicyValidatorBase( google::protobuf::MessageLite* payload, scoped_refptr<base::SequencedTaskRunner> background_task_runner) : status_(VALIDATION_OK), - policy_(policy_response.Pass()), + policy_(std::move(policy_response)), payload_(payload), validation_flags_(0), timestamp_not_before_(0), diff --git a/components/policy/core/common/cloud/cloud_policy_validator.h b/components/policy/core/common/cloud/cloud_policy_validator.h index 983ddbc..ba5803f 100644 --- a/components/policy/core/common/cloud/cloud_policy_validator.h +++ b/components/policy/core/common/cloud/cloud_policy_validator.h @@ -6,8 +6,8 @@ #define COMPONENTS_POLICY_CORE_COMMON_CLOUD_CLOUD_POLICY_VALIDATOR_H_ #include <stdint.h> - #include <string> +#include <utility> #include <vector> #include "base/bind.h" @@ -323,9 +323,8 @@ class POLICY_EXPORT CloudPolicyValidator : public CloudPolicyValidatorBase { scoped_ptr<enterprise_management::PolicyFetchResponse> policy_response, scoped_refptr<base::SequencedTaskRunner> background_task_runner) { return new CloudPolicyValidator( - policy_response.Pass(), - scoped_ptr<PayloadProto>(new PayloadProto()), - background_task_runner); + std::move(policy_response), + scoped_ptr<PayloadProto>(new PayloadProto()), background_task_runner); } scoped_ptr<PayloadProto>& payload() { @@ -345,10 +344,10 @@ class POLICY_EXPORT CloudPolicyValidator : public CloudPolicyValidatorBase { scoped_ptr<enterprise_management::PolicyFetchResponse> policy_response, scoped_ptr<PayloadProto> payload, scoped_refptr<base::SequencedTaskRunner> background_task_runner) - : CloudPolicyValidatorBase(policy_response.Pass(), + : CloudPolicyValidatorBase(std::move(policy_response), payload.get(), background_task_runner), - payload_(payload.Pass()) {} + payload_(std::move(payload)) {} scoped_ptr<PayloadProto> payload_; diff --git a/components/policy/core/common/cloud/cloud_policy_validator_unittest.cc b/components/policy/core/common/cloud/cloud_policy_validator_unittest.cc index cf078bb..3b947c5 100644 --- a/components/policy/core/common/cloud/cloud_policy_validator_unittest.cc +++ b/components/policy/core/common/cloud/cloud_policy_validator_unittest.cc @@ -2,8 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include <stdint.h> +#include "components/policy/core/common/cloud/cloud_policy_validator.h" +#include <stdint.h> +#include <utility> #include <vector> #include "base/bind.h" @@ -15,7 +17,6 @@ #include "base/thread_task_runner_handle.h" #include "build/build_config.h" #include "components/policy/core/common/cloud/cloud_policy_constants.h" -#include "components/policy/core/common/cloud/cloud_policy_validator.h" #include "components/policy/core/common/cloud/policy_builder.h" #include "components/policy/core/common/policy_switches.h" #include "crypto/rsa_private_key.h" @@ -60,8 +61,8 @@ class CloudPolicyValidatorTest : public testing::Test { testing::Action<void(UserCloudPolicyValidator*)> check_action, scoped_ptr<enterprise_management::PolicyFetchResponse> policy_response) { // Create a validator. - scoped_ptr<UserCloudPolicyValidator> validator = CreateValidator( - policy_response.Pass()); + scoped_ptr<UserCloudPolicyValidator> validator = + CreateValidator(std::move(policy_response)); // Run validation and check the result. EXPECT_CALL(*this, ValidationCompletion(validator.get())).WillOnce( @@ -87,7 +88,7 @@ class CloudPolicyValidatorTest : public testing::Test { public_key_bytes.size()); UserCloudPolicyValidator* validator = UserCloudPolicyValidator::Create( - policy_response.Pass(), base::ThreadTaskRunnerHandle::Get()); + std::move(policy_response), base::ThreadTaskRunnerHandle::Get()); validator->ValidateTimestamp(timestamp_, timestamp_, timestamp_option_); validator->ValidateUsername(PolicyBuilder::kFakeUsername, true); diff --git a/components/policy/core/common/cloud/component_cloud_policy_service.cc b/components/policy/core/common/cloud/component_cloud_policy_service.cc index e0f8f5d..07ea05f 100644 --- a/components/policy/core/common/cloud/component_cloud_policy_service.cc +++ b/components/policy/core/common/cloud/component_cloud_policy_service.cc @@ -5,8 +5,8 @@ #include "components/policy/core/common/cloud/component_cloud_policy_service.h" #include <stddef.h> - #include <string> +#include <utility> #include "base/bind.h" #include "base/bind_helpers.h" @@ -135,8 +135,8 @@ ComponentCloudPolicyService::Backend::Backend( : service_(service), task_runner_(task_runner), service_task_runner_(service_task_runner), - cache_(cache.Pass()), - external_policy_data_fetcher_(external_policy_data_fetcher.Pass()), + cache_(std::move(cache)), + external_policy_data_fetcher_(std::move(external_policy_data_fetcher)), store_(this, cache_.get()), initialized_(false) {} @@ -171,7 +171,7 @@ void ComponentCloudPolicyService::Backend::Init( // Start downloading any pending data. updater_.reset(new ComponentCloudPolicyUpdater( - task_runner_, external_policy_data_fetcher_.Pass(), &store_)); + task_runner_, std::move(external_policy_data_fetcher_), &store_)); service_task_runner_->PostTask( FROM_HERE, @@ -254,10 +254,8 @@ ComponentCloudPolicyService::ComponentCloudPolicyService( new ExternalPolicyDataFetcherBackend(io_task_runner_, request_context)); backend_.reset( - new Backend(weak_ptr_factory_.GetWeakPtr(), - backend_task_runner_, - base::ThreadTaskRunnerHandle::Get(), - cache.Pass(), + new Backend(weak_ptr_factory_.GetWeakPtr(), backend_task_runner_, + base::ThreadTaskRunnerHandle::Get(), std::move(cache), external_policy_data_fetcher_backend_->CreateFrontend( backend_task_runner_))); @@ -328,7 +326,7 @@ void ComponentCloudPolicyService::OnSchemaRegistryUpdated( // Filter the |unfiltered_policy_| again, now that |current_schema_map_| has // been updated. We must make sure we never serve invalid policy; we must // also filter again if an invalid Schema has now been loaded. - OnPolicyUpdated(unfiltered_policy_.Pass()); + OnPolicyUpdated(std::move(unfiltered_policy_)); } void ComponentCloudPolicyService::OnCoreConnected(CloudPolicyCore* core) { @@ -489,7 +487,7 @@ void ComponentCloudPolicyService::OnBackendInitialized( ReloadSchema(); // We're now ready to serve the initial policy; notify the policy observers. - OnPolicyUpdated(initial_policy.Pass()); + OnPolicyUpdated(std::move(initial_policy)); } void ComponentCloudPolicyService::ReloadSchema() { @@ -525,7 +523,7 @@ void ComponentCloudPolicyService::OnPolicyUpdated( DCHECK(CalledOnValidThread()); // Store the current unfiltered policies. - unfiltered_policy_ = policy.Pass(); + unfiltered_policy_ = std::move(policy); // Make a copy in |policy_| and filter it; this is what's passed to the // outside world. diff --git a/components/policy/core/common/cloud/component_cloud_policy_service_unittest.cc b/components/policy/core/common/cloud/component_cloud_policy_service_unittest.cc index 9f181bf..f857a99 100644 --- a/components/policy/core/common/cloud/component_cloud_policy_service_unittest.cc +++ b/components/policy/core/common/cloud/component_cloud_policy_service_unittest.cc @@ -6,6 +6,7 @@ #include <map> #include <string> +#include <utility> #include "base/callback.h" #include "base/files/scoped_temp_dir.h" @@ -153,7 +154,7 @@ class ComponentCloudPolicyServiceTest : public testing::Test { void Connect() { client_ = new MockCloudPolicyClient(); service_.reset(new ComponentCloudPolicyService( - &delegate_, ®istry_, &core_, client_, owned_cache_.Pass(), + &delegate_, ®istry_, &core_, client_, std::move(owned_cache_), request_context_, loop_.task_runner(), loop_.task_runner())); client_->SetDMToken(ComponentPolicyBuilder::kFakeToken); diff --git a/components/policy/core/common/cloud/component_cloud_policy_store.cc b/components/policy/core/common/cloud/component_cloud_policy_store.cc index f04df00..15f9c24 100644 --- a/components/policy/core/common/cloud/component_cloud_policy_store.cc +++ b/components/policy/core/common/cloud/component_cloud_policy_store.cc @@ -5,6 +5,7 @@ #include "components/policy/core/common/cloud/component_cloud_policy_store.h" #include <stddef.h> +#include <utility> #include "base/callback.h" #include "base/json/json_reader.h" @@ -137,8 +138,8 @@ void ComponentCloudPolicyStore::Load() { scoped_ptr<em::PolicyFetchResponse> proto(new em::PolicyFetchResponse); em::ExternalPolicyData payload; if (!proto->ParseFromString(it->second) || - !ValidateProto( - proto.Pass(), constants.policy_type, id, &payload, NULL)) { + !ValidateProto(std::move(proto), constants.policy_type, id, &payload, + NULL)) { Delete(ns); continue; } @@ -253,8 +254,8 @@ bool ComponentCloudPolicyStore::ValidatePolicy( PolicyNamespace* ns, em::ExternalPolicyData* payload) { em::PolicyData policy_data; - if (!ValidateProto( - proto.Pass(), std::string(), std::string(), payload, &policy_data)) { + if (!ValidateProto(std::move(proto), std::string(), std::string(), payload, + &policy_data)) { return false; } @@ -282,7 +283,7 @@ bool ComponentCloudPolicyStore::ValidateProto( scoped_ptr<ComponentCloudPolicyValidator> validator( ComponentCloudPolicyValidator::Create( - proto.Pass(), scoped_refptr<base::SequencedTaskRunner>())); + std::move(proto), scoped_refptr<base::SequencedTaskRunner>())); validator->ValidateUsername(username_, true); validator->ValidateDMToken(dm_token_, ComponentCloudPolicyValidator::DM_TOKEN_REQUIRED); diff --git a/components/policy/core/common/cloud/component_cloud_policy_updater.cc b/components/policy/core/common/cloud/component_cloud_policy_updater.cc index 50e489c..cea825d 100644 --- a/components/policy/core/common/cloud/component_cloud_policy_updater.cc +++ b/components/policy/core/common/cloud/component_cloud_policy_updater.cc @@ -6,6 +6,7 @@ #include <stddef.h> #include <stdint.h> +#include <utility> #include "base/bind.h" #include "base/bind_helpers.h" @@ -40,9 +41,8 @@ ComponentCloudPolicyUpdater::ComponentCloudPolicyUpdater( ComponentCloudPolicyStore* store) : store_(store), external_policy_data_updater_(task_runner, - external_policy_data_fetcher.Pass(), - kMaxParallelPolicyDataFetches) { -} + std::move(external_policy_data_fetcher), + kMaxParallelPolicyDataFetches) {} ComponentCloudPolicyUpdater::~ComponentCloudPolicyUpdater() { } @@ -60,7 +60,7 @@ void ComponentCloudPolicyUpdater::UpdateExternalPolicy( // Validate the policy before doing anything else. PolicyNamespace ns; em::ExternalPolicyData data; - if (!store_->ValidatePolicy(response.Pass(), &ns, &data)) { + if (!store_->ValidatePolicy(std::move(response), &ns, &data)) { LOG(ERROR) << "Failed to validate component policy fetched from DMServer"; return; } diff --git a/components/policy/core/common/cloud/device_management_service.cc b/components/policy/core/common/cloud/device_management_service.cc index 284a8de..0796656 100644 --- a/components/policy/core/common/cloud/device_management_service.cc +++ b/components/policy/core/common/cloud/device_management_service.cc @@ -455,7 +455,7 @@ void DeviceManagementService::Shutdown() { DeviceManagementService::DeviceManagementService( scoped_ptr<Configuration> configuration) - : configuration_(configuration.Pass()), + : configuration_(std::move(configuration)), initialized_(false), weak_ptr_factory_(this) { DCHECK(configuration_); diff --git a/components/policy/core/common/cloud/device_management_service_unittest.cc b/components/policy/core/common/cloud/device_management_service_unittest.cc index 30d0e73..7d3704b 100644 --- a/components/policy/core/common/cloud/device_management_service_unittest.cc +++ b/components/policy/core/common/cloud/device_management_service_unittest.cc @@ -2,7 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "components/policy/core/common/cloud/device_management_service.h" + #include <ostream> +#include <utility> #include <vector> #include "base/bind.h" @@ -10,7 +13,6 @@ #include "base/run_loop.h" #include "base/strings/string_split.h" #include "components/policy/core/common/cloud/cloud_policy_constants.h" -#include "components/policy/core/common/cloud/device_management_service.h" #include "components/policy/core/common/cloud/mock_device_management_service.h" #include "net/base/escape.h" #include "net/base/load_flags.h" @@ -63,7 +65,7 @@ class DeviceManagementServiceTestBase : public testing::Test { void ResetService() { scoped_ptr<DeviceManagementService::Configuration> configuration( new MockDeviceManagementServiceConfiguration(kServiceUrl)); - service_.reset(new DeviceManagementService(configuration.Pass())); + service_.reset(new DeviceManagementService(std::move(configuration))); } void InitializeService() { diff --git a/components/policy/core/common/cloud/external_policy_data_fetcher.cc b/components/policy/core/common/cloud/external_policy_data_fetcher.cc index 6c22b1d..d085060 100644 --- a/components/policy/core/common/cloud/external_policy_data_fetcher.cc +++ b/components/policy/core/common/cloud/external_policy_data_fetcher.cc @@ -4,6 +4,8 @@ #include "components/policy/core/common/cloud/external_policy_data_fetcher.h" +#include <utility> + #include "base/bind.h" #include "base/bind_helpers.h" #include "base/location.h" @@ -140,7 +142,7 @@ void ExternalPolicyDataFetcher::OnJobFinished(const FetchCallback& callback, // finish before the cancellation has reached that thread. return; } - callback.Run(result, data.Pass()); + callback.Run(result, std::move(data)); jobs_.erase(it); delete job; } @@ -241,7 +243,7 @@ void ExternalPolicyDataFetcherBackend::OnURLFetchComplete( ExternalPolicyDataFetcher::Job* job = it->second; delete it->first; job_map_.erase(it); - job->callback.Run(job, result, data.Pass()); + job->callback.Run(job, result, std::move(data)); } void ExternalPolicyDataFetcherBackend::OnURLFetchDownloadProgress( diff --git a/components/policy/core/common/cloud/policy_builder.cc b/components/policy/core/common/cloud/policy_builder.cc index e61059d..debf326 100644 --- a/components/policy/core/common/cloud/policy_builder.cc +++ b/components/policy/core/common/cloud/policy_builder.cc @@ -260,7 +260,7 @@ std::string PolicyBuilder::GetBlob() { scoped_ptr<em::PolicyFetchResponse> PolicyBuilder::GetCopy() { scoped_ptr<em::PolicyFetchResponse> result(new em::PolicyFetchResponse()); result->CopyFrom(policy_); - return result.Pass(); + return result; } // static diff --git a/components/policy/core/common/cloud/policy_header_service.cc b/components/policy/core/common/cloud/policy_header_service.cc index 62519c75..607843db 100644 --- a/components/policy/core/common/cloud/policy_header_service.cc +++ b/components/policy/core/common/cloud/policy_header_service.cc @@ -45,7 +45,7 @@ PolicyHeaderService::CreatePolicyHeaderIOHelper( scoped_ptr<PolicyHeaderIOHelper> helper = make_scoped_ptr( new PolicyHeaderIOHelper(server_url_, initial_header_value, task_runner)); helpers_.push_back(helper.get()); - return helper.Pass(); + return helper; } std::string PolicyHeaderService::CreateHeaderValue() { diff --git a/components/policy/core/common/cloud/policy_header_service_unittest.cc b/components/policy/core/common/cloud/policy_header_service_unittest.cc index 90c5c4b..54d2aba 100644 --- a/components/policy/core/common/cloud/policy_header_service_unittest.cc +++ b/components/policy/core/common/cloud/policy_header_service_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 "components/policy/core/common/cloud/policy_header_service.h" + +#include <utility> + #include "base/base64.h" #include "base/json/json_reader.h" #include "base/memory/scoped_ptr.h" @@ -10,7 +14,6 @@ #include "components/policy/core/common/cloud/cloud_policy_constants.h" #include "components/policy/core/common/cloud/mock_cloud_policy_store.h" #include "components/policy/core/common/cloud/policy_header_io_helper.h" -#include "components/policy/core/common/cloud/policy_header_service.h" #include "net/http/http_request_headers.h" #include "net/url_request/url_request.h" #include "net/url_request/url_request_test_util.h" @@ -26,7 +29,7 @@ const char kPolicyHeaderName[] = "Chrome-Policy-Posture"; class TestCloudPolicyStore : public MockCloudPolicyStore { public: void SetPolicy(scoped_ptr<PolicyData> policy) { - policy_ = policy.Pass(); + policy_ = std::move(policy); // Notify observers. NotifyStoreLoaded(); } @@ -44,7 +47,7 @@ class PolicyHeaderServiceTest : public testing::Test { kPolicyVerificationKeyHash, &user_store_, &device_store_)); - helper_ = service_->CreatePolicyHeaderIOHelper(task_runner_).Pass(); + helper_ = service_->CreatePolicyHeaderIOHelper(task_runner_); } void TearDown() override { @@ -104,7 +107,7 @@ TEST_F(PolicyHeaderServiceTest, TestWithAndWithoutPolicyHeader) { std::string expected_policy_token = "expected_dmtoken"; policy->set_request_token(expected_dmtoken); policy->set_policy_token(expected_policy_token); - user_store_.SetPolicy(policy.Pass()); + user_store_.SetPolicy(std::move(policy)); task_runner_->RunUntilIdle(); net::TestURLRequestContext context; diff --git a/components/policy/core/common/cloud/user_cloud_policy_manager.cc b/components/policy/core/common/cloud/user_cloud_policy_manager.cc index 416d9b2..672ad3f 100644 --- a/components/policy/core/common/cloud/user_cloud_policy_manager.cc +++ b/components/policy/core/common/cloud/user_cloud_policy_manager.cc @@ -4,6 +4,8 @@ #include "components/policy/core/common/cloud/user_cloud_policy_manager.h" +#include <utility> + #include "base/bind.h" #include "base/bind_helpers.h" #include "base/sequenced_task_runner.h" @@ -32,10 +34,9 @@ UserCloudPolicyManager::UserCloudPolicyManager( task_runner, file_task_runner, io_task_runner), - store_(store.Pass()), + store_(std::move(store)), component_policy_cache_path_(component_policy_cache_path), - external_data_manager_(external_data_manager.Pass()) { -} + external_data_manager_(std::move(external_data_manager)) {} UserCloudPolicyManager::~UserCloudPolicyManager() {} @@ -55,7 +56,7 @@ void UserCloudPolicyManager::Connect( scoped_ptr<CloudPolicyClient> client) { CreateComponentCloudPolicyService(component_policy_cache_path_, request_context, client.get()); - core()->Connect(client.Pass()); + core()->Connect(std::move(client)); core()->StartRefreshScheduler(); core()->TrackRefreshDelayPref(local_state, policy_prefs::kUserPolicyRefreshRate); @@ -68,13 +69,9 @@ scoped_ptr<CloudPolicyClient> UserCloudPolicyManager::CreateCloudPolicyClient( DeviceManagementService* device_management_service, scoped_refptr<net::URLRequestContextGetter> request_context) { - return make_scoped_ptr( - new CloudPolicyClient( - std::string(), - std::string(), - kPolicyVerificationKeyHash, - device_management_service, - request_context)).Pass(); + return make_scoped_ptr(new CloudPolicyClient( + std::string(), std::string(), kPolicyVerificationKeyHash, + device_management_service, request_context)); } void UserCloudPolicyManager::DisconnectAndRemovePolicy() { diff --git a/components/policy/core/common/cloud/user_cloud_policy_store.cc b/components/policy/core/common/cloud/user_cloud_policy_store.cc index f86ea80..9240d06e 100644 --- a/components/policy/core/common/cloud/user_cloud_policy_store.cc +++ b/components/policy/core/common/cloud/user_cloud_policy_store.cc @@ -5,6 +5,7 @@ #include "components/policy/core/common/cloud/user_cloud_policy_store.h" #include <stddef.h> +#include <utility> #include "base/bind.h" #include "base/files/file_util.h" @@ -270,16 +271,13 @@ void UserCloudPolicyStore::PolicyLoaded(bool validate_in_background, // we've done our first key rotation). } - Validate(cloud_policy.Pass(), - key.Pass(), - verification_key, - validate_in_background, - base::Bind( - &UserCloudPolicyStore::InstallLoadedPolicyAfterValidation, - weak_factory_.GetWeakPtr(), - doing_key_rotation, - result.key.has_signing_key() ? - result.key.signing_key() : std::string())); + Validate( + std::move(cloud_policy), std::move(key), verification_key, + validate_in_background, + base::Bind(&UserCloudPolicyStore::InstallLoadedPolicyAfterValidation, + weak_factory_.GetWeakPtr(), doing_key_rotation, + result.key.has_signing_key() ? result.key.signing_key() + : std::string())); break; } default: @@ -317,7 +315,8 @@ void UserCloudPolicyStore::InstallLoadedPolicyAfterValidation( policy_key_ = signing_key; } - InstallPolicy(validator->policy_data().Pass(), validator->payload().Pass()); + InstallPolicy(std::move(validator->policy_data()), + std::move(validator->payload())); status_ = STATUS_OK; NotifyStoreLoaded(); } @@ -328,10 +327,8 @@ void UserCloudPolicyStore::Store(const em::PolicyFetchResponse& policy) { weak_factory_.InvalidateWeakPtrs(); scoped_ptr<em::PolicyFetchResponse> policy_copy( new em::PolicyFetchResponse(policy)); - Validate(policy_copy.Pass(), - scoped_ptr<em::PolicySigningKey>(), - verification_key_, - true, + Validate(std::move(policy_copy), scoped_ptr<em::PolicySigningKey>(), + verification_key_, true, base::Bind(&UserCloudPolicyStore::StorePolicyAfterValidation, weak_factory_.GetWeakPtr())); } @@ -344,8 +341,7 @@ void UserCloudPolicyStore::Validate( const UserCloudPolicyValidator::CompletionCallback& callback) { // Configure the validator. scoped_ptr<UserCloudPolicyValidator> validator = CreateValidator( - policy.Pass(), - CloudPolicyValidatorBase::TIMESTAMP_NOT_BEFORE); + std::move(policy), CloudPolicyValidatorBase::TIMESTAMP_NOT_BEFORE); // Extract the owning domain from the signed-in user (if any is set yet). // If there's no owning domain, then the code just ensures that the policy @@ -451,7 +447,8 @@ void UserCloudPolicyStore::StorePolicyAfterValidation( base::Bind(&StorePolicyToDiskOnBackgroundThread, policy_path_, key_path_, verification_key_, *validator->policy())); - InstallPolicy(validator->policy_data().Pass(), validator->payload().Pass()); + InstallPolicy(std::move(validator->policy_data()), + std::move(validator->payload())); // If the key was rotated, update our local cache of the key. if (validator->policy()->has_new_public_key()) diff --git a/components/policy/core/common/cloud/user_cloud_policy_store_base.cc b/components/policy/core/common/cloud/user_cloud_policy_store_base.cc index 3b9af52..9384eee 100644 --- a/components/policy/core/common/cloud/user_cloud_policy_store_base.cc +++ b/components/policy/core/common/cloud/user_cloud_policy_store_base.cc @@ -4,6 +4,8 @@ #include "components/policy/core/common/cloud/user_cloud_policy_store_base.h" +#include <utility> + #include "components/policy/core/common/cloud/cloud_external_data_manager.h" #include "components/policy/core/common/cloud/cloud_policy_constants.h" #include "components/policy/core/common/policy_map.h" @@ -28,8 +30,8 @@ scoped_ptr<UserCloudPolicyValidator> UserCloudPolicyStoreBase::CreateValidator( scoped_ptr<enterprise_management::PolicyFetchResponse> policy, CloudPolicyValidatorBase::ValidateTimestampOption timestamp_option) { // Configure the validator. - UserCloudPolicyValidator* validator = - UserCloudPolicyValidator::Create(policy.Pass(), background_task_runner_); + UserCloudPolicyValidator* validator = UserCloudPolicyValidator::Create( + std::move(policy), background_task_runner_); validator->ValidatePolicyType(dm_protocol::kChromeUserPolicyType); validator->ValidateAgainstCurrentPolicy( policy_.get(), @@ -45,7 +47,7 @@ void UserCloudPolicyStoreBase::InstallPolicy( // Decode the payload. policy_map_.Clear(); DecodePolicy(*payload, external_data_manager(), &policy_map_); - policy_ = policy_data.Pass(); + policy_ = std::move(policy_data); } } // namespace policy diff --git a/components/policy/core/common/config_dir_policy_loader.cc b/components/policy/core/common/config_dir_policy_loader.cc index c3c6006..0ddfad0 100644 --- a/components/policy/core/common/config_dir_policy_loader.cc +++ b/components/policy/core/common/config_dir_policy_loader.cc @@ -85,7 +85,7 @@ scoped_ptr<PolicyBundle> ConfigDirPolicyLoader::Load() { LoadFromPath(config_dir_.Append(kRecommendedConfigDir), POLICY_LEVEL_RECOMMENDED, bundle.get()); - return bundle.Pass(); + return bundle; } base::Time ConfigDirPolicyLoader::LastModificationTime() { diff --git a/components/policy/core/common/config_dir_policy_loader_unittest.cc b/components/policy/core/common/config_dir_policy_loader_unittest.cc index f9baff7..3afc8b2 100644 --- a/components/policy/core/common/config_dir_policy_loader_unittest.cc +++ b/components/policy/core/common/config_dir_policy_loader_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 "components/policy/core/common/config_dir_policy_loader.h" + +#include <utility> + #include "base/compiler_specific.h" #include "base/files/file_util.h" #include "base/files/scoped_temp_dir.h" @@ -12,7 +16,6 @@ #include "base/strings/string_number_conversions.h" #include "base/values.h" #include "components/policy/core/common/async_policy_provider.h" -#include "components/policy/core/common/config_dir_policy_loader.h" #include "components/policy/core/common/configuration_policy_provider_test.h" #include "components/policy/core/common/policy_bundle.h" #include "components/policy/core/common/policy_map.h" @@ -86,7 +89,7 @@ ConfigurationPolicyProvider* TestHarness::CreateProvider( scoped_refptr<base::SequencedTaskRunner> task_runner) { scoped_ptr<AsyncPolicyLoader> loader(new ConfigDirPolicyLoader( task_runner, test_dir(), POLICY_SCOPE_MACHINE)); - return new AsyncPolicyProvider(registry, loader.Pass()); + return new AsyncPolicyProvider(registry, std::move(loader)); } void TestHarness::InstallEmptyPolicy() { diff --git a/components/policy/core/common/fake_async_policy_loader.cc b/components/policy/core/common/fake_async_policy_loader.cc index 8c441e5..237a029 100644 --- a/components/policy/core/common/fake_async_policy_loader.cc +++ b/components/policy/core/common/fake_async_policy_loader.cc @@ -18,7 +18,7 @@ FakeAsyncPolicyLoader::FakeAsyncPolicyLoader( scoped_ptr<PolicyBundle> FakeAsyncPolicyLoader::Load() { scoped_ptr<PolicyBundle> result(new PolicyBundle()); result->CopyFrom(policy_bundle_); - return result.Pass(); + return result; } void FakeAsyncPolicyLoader::InitOnBackgroundThread() { diff --git a/components/policy/core/common/mock_configuration_policy_provider.cc b/components/policy/core/common/mock_configuration_policy_provider.cc index 387b8d4..c150321 100644 --- a/components/policy/core/common/mock_configuration_policy_provider.cc +++ b/components/policy/core/common/mock_configuration_policy_provider.cc @@ -5,6 +5,7 @@ #include "components/policy/core/common/mock_configuration_policy_provider.h" #include <string> +#include <utility> #include "base/memory/scoped_ptr.h" #include "base/message_loop/message_loop.h" @@ -24,7 +25,7 @@ void MockConfigurationPolicyProvider::UpdateChromePolicy( scoped_ptr<PolicyBundle> bundle(new PolicyBundle()); bundle->Get(PolicyNamespace(POLICY_DOMAIN_CHROME, std::string())) .CopyFrom(policy); - UpdatePolicy(bundle.Pass()); + UpdatePolicy(std::move(bundle)); if (base::MessageLoop::current()) base::RunLoop().RunUntilIdle(); } @@ -37,7 +38,7 @@ void MockConfigurationPolicyProvider::SetAutoRefresh() { void MockConfigurationPolicyProvider::RefreshWithSamePolicies() { scoped_ptr<PolicyBundle> bundle(new PolicyBundle); bundle->CopyFrom(policies()); - UpdatePolicy(bundle.Pass()); + UpdatePolicy(std::move(bundle)); } MockConfigurationPolicyObserver::MockConfigurationPolicyObserver() {} diff --git a/components/policy/core/common/policy_map.cc b/components/policy/core/common/policy_map.cc index 84b8fd8..febad17 100644 --- a/components/policy/core/common/policy_map.cc +++ b/components/policy/core/common/policy_map.cc @@ -35,7 +35,7 @@ scoped_ptr<PolicyMap::Entry> PolicyMap::Entry::DeepCopy() const { copy->external_data_fetcher = new ExternalDataFetcher(*external_data_fetcher); } - return copy.Pass(); + return copy; } bool PolicyMap::Entry::has_higher_priority_than( diff --git a/components/policy/core/common/policy_service_impl_unittest.cc b/components/policy/core/common/policy_service_impl_unittest.cc index 321eac2..d67d876 100644 --- a/components/policy/core/common/policy_service_impl_unittest.cc +++ b/components/policy/core/common/policy_service_impl_unittest.cc @@ -4,6 +4,8 @@ #include "components/policy/core/common/policy_service_impl.h" +#include <utility> + #include "base/bind.h" #include "base/bind_helpers.h" #include "base/callback.h" @@ -336,7 +338,7 @@ TEST_F(PolicyServiceTest, NotifyObserversInMultipleNamespaces) { OnPolicyUpdated(PolicyNamespace(POLICY_DOMAIN_EXTENSIONS, kExtension1), PolicyEquals(&kEmptyPolicyMap), PolicyEquals(&policy_map))); - provider0_.UpdatePolicy(bundle.Pass()); + provider0_.UpdatePolicy(std::move(bundle)); RunUntilIdle(); Mock::VerifyAndClearExpectations(&chrome_observer); Mock::VerifyAndClearExpectations(&extension_observer); @@ -374,7 +376,7 @@ TEST_F(PolicyServiceTest, NotifyObserversInMultipleNamespaces) { OnPolicyUpdated(PolicyNamespace(POLICY_DOMAIN_EXTENSIONS, kExtension2), PolicyEquals(&kEmptyPolicyMap), PolicyEquals(&policy_map))); - provider0_.UpdatePolicy(bundle.Pass()); + provider0_.UpdatePolicy(std::move(bundle)); RunUntilIdle(); Mock::VerifyAndClearExpectations(&chrome_observer); Mock::VerifyAndClearExpectations(&extension_observer); @@ -606,9 +608,9 @@ TEST_F(PolicyServiceTest, NamespaceMerge) { AddTestPolicies(bundle2.get(), "bundle2", POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE); - provider0_.UpdatePolicy(bundle0.Pass()); - provider1_.UpdatePolicy(bundle1.Pass()); - provider2_.UpdatePolicy(bundle2.Pass()); + provider0_.UpdatePolicy(std::move(bundle0)); + provider1_.UpdatePolicy(std::move(bundle1)); + provider2_.UpdatePolicy(std::move(bundle2)); RunUntilIdle(); PolicyMap expected; @@ -769,7 +771,7 @@ TEST_F(PolicyServiceTest, FixDeprecatedPolicies) { new base::FundamentalValue(3), NULL); - provider0_.UpdatePolicy(policy_bundle.Pass()); + provider0_.UpdatePolicy(std::move(policy_bundle)); RunUntilIdle(); EXPECT_TRUE(VerifyPolicies(chrome_namespace, expected_chrome)); diff --git a/components/policy/core/common/remote_commands/remote_command_job.cc b/components/policy/core/common/remote_commands/remote_command_job.cc index 37c8978..64f897f 100644 --- a/components/policy/core/common/remote_commands/remote_command_job.cc +++ b/components/policy/core/common/remote_commands/remote_command_job.cc @@ -4,6 +4,8 @@ #include "components/policy/core/common/remote_commands/remote_command_job.h" +#include <utility> + #include "base/bind.h" #include "base/logging.h" @@ -120,7 +122,7 @@ scoped_ptr<std::string> RemoteCommandJob::GetResultPayload() const { if (!result_payload_) return nullptr; - return result_payload_->Serialize().Pass(); + return result_payload_->Serialize(); } RemoteCommandJob::RemoteCommandJob() @@ -145,7 +147,7 @@ void RemoteCommandJob::OnCommandExecutionFinishedWithResult( DCHECK_EQ(RUNNING, status_); status_ = succeeded ? SUCCEEDED : FAILED; - result_payload_ = result_payload.Pass(); + result_payload_ = std::move(result_payload); if (!finished_callback_.is_null()) finished_callback_.Run(); diff --git a/components/policy/core/common/remote_commands/remote_commands_queue.cc b/components/policy/core/common/remote_commands/remote_commands_queue.cc index c5ee7ff..e3b2847 100644 --- a/components/policy/core/common/remote_commands/remote_commands_queue.cc +++ b/components/policy/core/common/remote_commands/remote_commands_queue.cc @@ -4,6 +4,8 @@ #include "components/policy/core/common/remote_commands/remote_commands_queue.h" +#include <utility> + #include "base/bind.h" #include "base/bind_helpers.h" #include "base/location.h" @@ -42,7 +44,7 @@ void RemoteCommandsQueue::AddJob(scoped_ptr<RemoteCommandJob> job) { void RemoteCommandsQueue::SetClockForTesting( scoped_ptr<base::TickClock> clock) { - clock_ = clock.Pass(); + clock_ = std::move(clock); } base::TimeTicks RemoteCommandsQueue::GetNowTicks() { diff --git a/components/policy/core/common/remote_commands/remote_commands_queue_unittest.cc b/components/policy/core/common/remote_commands/remote_commands_queue_unittest.cc index f55a0df..28efaa5 100644 --- a/components/policy/core/common/remote_commands/remote_commands_queue_unittest.cc +++ b/components/policy/core/common/remote_commands/remote_commands_queue_unittest.cc @@ -2,7 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "components/policy/core/common/remote_commands/remote_commands_queue.h" + #include <string> +#include <utility> #include "base/macros.h" #include "base/memory/ref_counted.h" @@ -11,7 +14,6 @@ #include "base/time/tick_clock.h" #include "base/time/time.h" #include "components/policy/core/common/remote_commands/remote_command_job.h" -#include "components/policy/core/common/remote_commands/remote_commands_queue.h" #include "components/policy/core/common/remote_commands/test_remote_command_job.h" #include "policy/proto/device_management_backend.pb.h" #include "testing/gmock/include/gmock/gmock.h" @@ -109,7 +111,7 @@ void RemoteCommandsQueueTest::SetUp() { test_start_time_ = clock->NowTicks(); clock_ = clock.get(); - queue_.SetClockForTesting(clock.Pass()); + queue_.SetClockForTesting(std::move(clock)); queue_.AddObserver(&observer_); } @@ -156,7 +158,7 @@ void RemoteCommandsQueueTest::AddJobAndVerifyRunningAfter( OnJobStarted( AllOf(Property(&RemoteCommandJob::status, RemoteCommandJob::RUNNING), Property(&RemoteCommandJob::execution_started_time, now)))); - queue_.AddJob(job.Pass()); + queue_.AddJob(std::move(job)); Mock::VerifyAndClearExpectations(&observer_); // After |delta|, the job should still be running. @@ -180,7 +182,7 @@ TEST_F(RemoteCommandsQueueTest, SingleSucceedCommand) { new TestRemoteCommandJob(true, base::TimeDelta::FromSeconds(5))); InitializeJob(job.get(), kUniqueID, test_start_time_, kPayload); - AddJobAndVerifyRunningAfter(job.Pass(), base::TimeDelta::FromSeconds(4)); + AddJobAndVerifyRunningAfter(std::move(job), base::TimeDelta::FromSeconds(4)); // After 6 seconds, the job is expected to be finished. EXPECT_CALL(observer_, @@ -201,7 +203,7 @@ TEST_F(RemoteCommandsQueueTest, SingleFailedCommand) { new TestRemoteCommandJob(false, base::TimeDelta::FromSeconds(10))); InitializeJob(job.get(), kUniqueID, test_start_time_, kPayload); - AddJobAndVerifyRunningAfter(job.Pass(), base::TimeDelta::FromSeconds(9)); + AddJobAndVerifyRunningAfter(std::move(job), base::TimeDelta::FromSeconds(9)); // After 11 seconds, the job is expected to be finished. EXPECT_CALL(observer_, @@ -222,7 +224,8 @@ TEST_F(RemoteCommandsQueueTest, SingleTerminatedCommand) { new TestRemoteCommandJob(false, base::TimeDelta::FromSeconds(200))); InitializeJob(job.get(), kUniqueID, test_start_time_, kPayload); - AddJobAndVerifyRunningAfter(job.Pass(), base::TimeDelta::FromSeconds(179)); + AddJobAndVerifyRunningAfter(std::move(job), + base::TimeDelta::FromSeconds(179)); // After 181 seconds, the job is expected to be terminated (3 minutes is the // timeout duration). @@ -256,7 +259,7 @@ TEST_F(RemoteCommandsQueueTest, SingleExpiredCommand) { // Add the job to the queue. It should not be started. EXPECT_CALL(observer_, OnJobFinished(Property(&RemoteCommandJob::status, RemoteCommandJob::EXPIRED))); - queue_.AddJob(job.Pass()); + queue_.AddJob(std::move(job)); Mock::VerifyAndClearExpectations(&observer_); task_runner_->FastForwardUntilNoTasksRemain(); @@ -278,7 +281,7 @@ TEST_F(RemoteCommandsQueueTest, TwoCommands) { OnJobStarted(AllOf( Property(&RemoteCommandJob::unique_id, kUniqueID), Property(&RemoteCommandJob::status, RemoteCommandJob::RUNNING)))); - queue_.AddJob(job.Pass()); + queue_.AddJob(std::move(job)); Mock::VerifyAndClearExpectations(&observer_); // Initialize another job expected to succeed after 5 seconds, from a protobuf @@ -291,7 +294,7 @@ TEST_F(RemoteCommandsQueueTest, TwoCommands) { // After 2 seconds, add the second job. It should be queued and not start // running immediately. task_runner_->FastForwardBy(base::TimeDelta::FromSeconds(2)); - queue_.AddJob(job.Pass()); + queue_.AddJob(std::move(job)); // After 4 seconds, nothing happens. task_runner_->FastForwardBy(base::TimeDelta::FromSeconds(2)); diff --git a/components/policy/core/common/remote_commands/remote_commands_service.cc b/components/policy/core/common/remote_commands/remote_commands_service.cc index 4541f65..da7c79a 100644 --- a/components/policy/core/common/remote_commands/remote_commands_service.cc +++ b/components/policy/core/common/remote_commands/remote_commands_service.cc @@ -6,6 +6,7 @@ #include <algorithm> #include <string> +#include <utility> #include "base/bind.h" #include "base/logging.h" @@ -21,7 +22,7 @@ namespace em = enterprise_management; RemoteCommandsService::RemoteCommandsService( scoped_ptr<RemoteCommandsFactory> factory, CloudPolicyClient* client) - : factory_(factory.Pass()), client_(client), weak_factory_(this) { + : factory_(std::move(factory)), client_(client), weak_factory_(this) { DCHECK(client_); queue_.AddObserver(this); } @@ -62,7 +63,7 @@ bool RemoteCommandsService::FetchRemoteCommands() { } client_->FetchRemoteCommands( - id_to_acknowledge.Pass(), previous_results, + std::move(id_to_acknowledge), previous_results, base::Bind(&RemoteCommandsService::OnRemoteCommandsFetched, weak_factory_.GetWeakPtr())); @@ -71,7 +72,7 @@ bool RemoteCommandsService::FetchRemoteCommands() { void RemoteCommandsService::SetClockForTesting( scoped_ptr<base::TickClock> clock) { - queue_.SetClockForTesting(clock.Pass()); + queue_.SetClockForTesting(std::move(clock)); } void RemoteCommandsService::EnqueueCommand( @@ -100,7 +101,7 @@ void RemoteCommandsService::EnqueueCommand( return; } - queue_.AddJob(job.Pass()); + queue_.AddJob(std::move(job)); } void RemoteCommandsService::OnJobStarted(RemoteCommandJob* command) { diff --git a/components/policy/core/common/remote_commands/remote_commands_service_unittest.cc b/components/policy/core/common/remote_commands/remote_commands_service_unittest.cc index fe3f4bc..24ffd9f 100644 --- a/components/policy/core/common/remote_commands/remote_commands_service_unittest.cc +++ b/components/policy/core/common/remote_commands/remote_commands_service_unittest.cc @@ -147,7 +147,7 @@ class TestingCloudPolicyClientForRemoteCommands : public CloudPolicyClient { const RemoteCommandCallback& callback, const FetchCallExpectation& fetch_call_expectation) { const std::vector<em::RemoteCommand> fetched_commands = - server_->FetchCommands(last_command_id.Pass(), command_results); + server_->FetchCommands(std::move(last_command_id), command_results); EXPECT_EQ(fetch_call_expectation.expected_command_results, command_results.size()); @@ -247,7 +247,7 @@ class RemoteCommandsServiceTest : public testing::Test { void SetUp() override { server_.reset(new TestingRemoteCommandsServer()); - server_->SetClock(task_runner_->GetMockTickClock().Pass()); + server_->SetClock(task_runner_->GetMockTickClock()); cloud_policy_client_.reset( new TestingCloudPolicyClientForRemoteCommands(server_.get())); } @@ -259,8 +259,8 @@ class RemoteCommandsServiceTest : public testing::Test { } void StartService(scoped_ptr<RemoteCommandsFactory> factory) { - remote_commands_service_.reset( - new RemoteCommandsService(factory.Pass(), cloud_policy_client_.get())); + remote_commands_service_.reset(new RemoteCommandsService( + std::move(factory), cloud_policy_client_.get())); remote_commands_service_->SetClockForTesting( task_runner_->GetMockTickClock()); } @@ -289,7 +289,7 @@ TEST_F(RemoteCommandsServiceTest, NoCommands) { new MockTestRemoteCommandFactory()); EXPECT_CALL(*factory, BuildTestCommand()).Times(0); - StartService(factory.Pass()); + StartService(std::move(factory)); // A fetch requst should get nothing from server. cloud_policy_client_->ExpectFetchCommands(0u, 0u, base::Closure()); @@ -315,7 +315,7 @@ TEST_F(RemoteCommandsServiceTest, ExistingCommand) { // Start the service, run until the command is fetched. cloud_policy_client_->ExpectFetchCommands(0u, 1u, scoped_runner.QuitClosure()); - StartService(factory.Pass()); + StartService(std::move(factory)); EXPECT_TRUE(remote_commands_service_->FetchRemoteCommands()); scoped_runner.Run(); @@ -335,7 +335,7 @@ TEST_F(RemoteCommandsServiceTest, NewCommand) { new MockTestRemoteCommandFactory()); EXPECT_CALL(*factory, BuildTestCommand()).Times(1); - StartService(factory.Pass()); + StartService(std::move(factory)); // Set up expectations on fetch commands calls. The first request will fetch // one command, and the second will fetch none but provide result for the @@ -360,7 +360,7 @@ TEST_F(RemoteCommandsServiceTest, NewCommandFollwingFetch) { new MockTestRemoteCommandFactory()); EXPECT_CALL(*factory, BuildTestCommand()).Times(1); - StartService(factory.Pass()); + StartService(std::move(factory)); { ScopedMockTimeTaskRunner::ScopedRunner scoped_runner(task_runner_); diff --git a/components/policy/core/common/remote_commands/testing_remote_commands_server.cc b/components/policy/core/common/remote_commands/testing_remote_commands_server.cc index 85629ed..53db3e2 100644 --- a/components/policy/core/common/remote_commands/testing_remote_commands_server.cc +++ b/components/policy/core/common/remote_commands/testing_remote_commands_server.cc @@ -4,6 +4,8 @@ #include "components/policy/core/common/remote_commands/testing_remote_commands_server.h" +#include <utility> + #include "base/bind.h" #include "base/callback.h" #include "base/location.h" @@ -135,7 +137,7 @@ TestingRemoteCommandsServer::FetchCommands( void TestingRemoteCommandsServer::SetClock(scoped_ptr<base::TickClock> clock) { DCHECK(thread_checker_.CalledOnValidThread()); - clock_ = clock.Pass(); + clock_ = std::move(clock); } size_t TestingRemoteCommandsServer::NumberOfCommandsPendingResult() const { diff --git a/components/policy/core/common/schema_registry_tracking_policy_provider.cc b/components/policy/core/common/schema_registry_tracking_policy_provider.cc index 4f8e719..95ffaf1 100644 --- a/components/policy/core/common/schema_registry_tracking_policy_provider.cc +++ b/components/policy/core/common/schema_registry_tracking_policy_provider.cc @@ -4,6 +4,8 @@ #include "components/policy/core/common/schema_registry_tracking_policy_provider.h" +#include <utility> + #include "components/policy/core/common/schema_map.h" #include "components/policy/core/common/schema_registry.h" @@ -91,7 +93,7 @@ void SchemaRegistryTrackingPolicyProvider::OnUpdatePolicy( bundle->Get(chrome_ns).CopyFrom(delegate_->policies().Get(chrome_ns)); } - UpdatePolicy(bundle.Pass()); + UpdatePolicy(std::move(bundle)); } } // namespace policy diff --git a/components/policy/core/common/schema_registry_tracking_policy_provider_unittest.cc b/components/policy/core/common/schema_registry_tracking_policy_provider_unittest.cc index a67b63b..4cad517 100644 --- a/components/policy/core/common/schema_registry_tracking_policy_provider_unittest.cc +++ b/components/policy/core/common/schema_registry_tracking_policy_provider_unittest.cc @@ -5,6 +5,7 @@ #include "components/policy/core/common/schema_registry_tracking_policy_provider.h" #include <string> +#include <utility> #include "base/memory/scoped_ptr.h" #include "base/values.h" @@ -100,7 +101,7 @@ TEST_F(SchemaRegistryTrackingPolicyProviderTest, PassOnChromePolicy) { POLICY_SOURCE_CLOUD, new base::StringValue("not visible"), NULL); - mock_provider_.UpdatePolicy(delegate_bundle.Pass()); + mock_provider_.UpdatePolicy(std::move(delegate_bundle)); Mock::VerifyAndClearExpectations(&observer_); EXPECT_FALSE(schema_registry_tracking_provider_.IsInitializationComplete( @@ -137,7 +138,7 @@ TEST_F(SchemaRegistryTrackingPolicyProviderTest, SchemaReadyWithComponents) { bundle->Get(PolicyNamespace(POLICY_DOMAIN_EXTENSIONS, "xyz")) .CopyFrom(policy_map); EXPECT_CALL(observer_, OnUpdatePolicy(&schema_registry_tracking_provider_)); - mock_provider_.UpdatePolicy(bundle.Pass()); + mock_provider_.UpdatePolicy(std::move(bundle)); Mock::VerifyAndClearExpectations(&observer_); EXPECT_CALL(mock_provider_, RefreshPolicies()).Times(0); @@ -231,7 +232,7 @@ TEST_F(SchemaRegistryTrackingPolicyProviderTest, RemoveAndAddComponent) { scoped_ptr<PolicyBundle> copy(new PolicyBundle); copy->CopyFrom(platform_policy); EXPECT_CALL(observer_, OnUpdatePolicy(_)); - mock_provider_.UpdatePolicy(copy.Pass()); + mock_provider_.UpdatePolicy(std::move(copy)); Mock::VerifyAndClearExpectations(&observer_); EXPECT_TRUE( schema_registry_tracking_provider_.policies().Equals(platform_policy)); @@ -252,7 +253,7 @@ TEST_F(SchemaRegistryTrackingPolicyProviderTest, RemoveAndAddComponent) { EXPECT_CALL(observer_, OnUpdatePolicy(_)); copy.reset(new PolicyBundle); copy->CopyFrom(platform_policy); - mock_provider_.UpdatePolicy(copy.Pass()); + mock_provider_.UpdatePolicy(std::move(copy)); Mock::VerifyAndClearExpectations(&observer_); EXPECT_TRUE( schema_registry_tracking_provider_.policies().Equals(platform_policy)); diff --git a/components/precache/content/precache_manager_unittest.cc b/components/precache/content/precache_manager_unittest.cc index 1de6105..68da1d9 100644 --- a/components/precache/content/precache_manager_unittest.cc +++ b/components/precache/content/precache_manager_unittest.cc @@ -60,7 +60,7 @@ class TestURLFetcherCallback { url, delegate, response_data, response_code, status)); requested_urls_.insert(url); - return fetcher.Pass(); + return fetcher; } const std::multiset<GURL>& requested_urls() const { diff --git a/components/precache/core/precache_fetcher.cc b/components/precache/core/precache_fetcher.cc index 74c1dd4..5aac067 100644 --- a/components/precache/core/precache_fetcher.cc +++ b/components/precache/core/precache_fetcher.cc @@ -5,6 +5,7 @@ #include "components/precache/core/precache_fetcher.h" #include <string> +#include <utility> #include <vector> #include "base/bind.h" @@ -161,7 +162,7 @@ void PrecacheFetcher::Fetcher::LoadFromCache() { url_fetcher_cache_->SetRequestContext(request_context_); url_fetcher_cache_->SetLoadFlags(net::LOAD_ONLY_FROM_CACHE | kNoTracking); scoped_ptr<URLFetcherNullWriter> null_writer(new URLFetcherNullWriter); - url_fetcher_cache_->SaveResponseWithWriter(null_writer.Pass()); + url_fetcher_cache_->SaveResponseWithWriter(std::move(null_writer)); url_fetcher_cache_->Start(); } @@ -177,7 +178,7 @@ void PrecacheFetcher::Fetcher::LoadFromNetwork() { // We don't need a copy of the response body for resource requests. The // request is issued only to populate the browser cache. scoped_ptr<URLFetcherNullWriter> null_writer(new URLFetcherNullWriter); - url_fetcher_network_->SaveResponseWithWriter(null_writer.Pass()); + url_fetcher_network_->SaveResponseWithWriter(std::move(null_writer)); } else { // Config and manifest requests do not need to be revalidated. It's okay if // they expire from the cache minutes after we request them. diff --git a/components/precache/core/precache_fetcher_unittest.cc b/components/precache/core/precache_fetcher_unittest.cc index 6bf89ba..cf47a01 100644 --- a/components/precache/core/precache_fetcher_unittest.cc +++ b/components/precache/core/precache_fetcher_unittest.cc @@ -67,7 +67,7 @@ class TestURLFetcherCallback { total_response_bytes_ += response_data.size(); requested_urls_.insert(url); - return fetcher.Pass(); + return fetcher; } const std::multiset<GURL>& requested_urls() const { diff --git a/components/printing/renderer/print_web_view_helper.cc b/components/printing/renderer/print_web_view_helper.cc index 334c8a5..c09ad6a 100644 --- a/components/printing/renderer/print_web_view_helper.cc +++ b/components/printing/renderer/print_web_view_helper.cc @@ -6,8 +6,8 @@ #include <stddef.h> #include <stdint.h> - #include <string> +#include <utility> #include "base/auto_reset.h" #include "base/json/json_writer.h" @@ -813,7 +813,7 @@ PrintWebViewHelper::PrintWebViewHelper(content::RenderView* render_view, is_scripted_printing_blocked_(false), notify_browser_of_print_failure_(true), print_for_preview_(false), - delegate_(delegate.Pass()), + delegate_(std::move(delegate)), print_node_in_progress_(false), is_loading_(false), is_scripted_preview_delayed_(false), diff --git a/components/proximity_auth/ble/bluetooth_low_energy_characteristics_finder_unittest.cc b/components/proximity_auth/ble/bluetooth_low_energy_characteristics_finder_unittest.cc index 090cd2b..934393b 100644 --- a/components/proximity_auth/ble/bluetooth_low_energy_characteristics_finder_unittest.cc +++ b/components/proximity_auth/ble/bluetooth_low_energy_characteristics_finder_unittest.cc @@ -111,7 +111,7 @@ class ProximityAuthBluetoothLowEnergyCharacteristicFinderTest ON_CALL(*characteristic.get(), GetIdentifier()).WillByDefault(Return(id)); ON_CALL(*characteristic.get(), GetService()) .WillByDefault(Return(service_.get())); - return characteristic.Pass(); + return characteristic; } scoped_refptr<device::MockBluetoothAdapter> adapter_; diff --git a/components/proximity_auth/ble/bluetooth_low_energy_connection.cc b/components/proximity_auth/ble/bluetooth_low_energy_connection.cc index a5ab4bb..13992be 100644 --- a/components/proximity_auth/ble/bluetooth_low_energy_connection.cc +++ b/components/proximity_auth/ble/bluetooth_low_energy_connection.cc @@ -4,6 +4,8 @@ #include "components/proximity_auth/ble/bluetooth_low_energy_connection.h" +#include <utility> + #include "base/bind.h" #include "base/location.h" #include "base/memory/ref_counted.h" @@ -343,7 +345,7 @@ void BluetoothLowEnergyConnection::OnGattConnectionCreated( // Informing |bluetooth_trottler_| a new connection was established. bluetooth_throttler_->OnConnection(this); - gatt_connection_ = gatt_connection.Pass(); + gatt_connection_ = std::move(gatt_connection); SetSubStatus(SubStatus::WAITING_CHARACTERISTICS); characteristic_finder_.reset(CreateCharacteristicsFinder( base::Bind(&BluetoothLowEnergyConnection::OnCharacteristicsFound, @@ -436,7 +438,7 @@ void BluetoothLowEnergyConnection::OnNotifySessionStarted( PrintTimeElapsed(); SetSubStatus(SubStatus::NOTIFY_SESSION_READY); - notify_session_ = notify_session.Pass(); + notify_session_ = std::move(notify_session); SendInviteToConnectSignal(); } diff --git a/components/proximity_auth/ble/bluetooth_low_energy_connection_finder.cc b/components/proximity_auth/ble/bluetooth_low_energy_connection_finder.cc index bf50796..90fbf5f 100644 --- a/components/proximity_auth/ble/bluetooth_low_energy_connection_finder.cc +++ b/components/proximity_auth/ble/bluetooth_low_energy_connection_finder.cc @@ -5,6 +5,7 @@ #include "components/proximity_auth/ble/bluetooth_low_energy_connection_finder.h" #include <string> +#include <utility> #include "base/bind.h" #include "base/bind_helpers.h" @@ -210,7 +211,7 @@ void BluetoothLowEnergyConnectionFinder::OnAdapterInitialized( void BluetoothLowEnergyConnectionFinder::OnDiscoverySessionStarted( scoped_ptr<device::BluetoothDiscoverySession> discovery_session) { PA_LOG(INFO) << "Discovery session started"; - discovery_session_ = discovery_session.Pass(); + discovery_session_ = std::move(discovery_session); } void BluetoothLowEnergyConnectionFinder::OnStartDiscoverySessionError() { @@ -230,7 +231,7 @@ void BluetoothLowEnergyConnectionFinder::StartDiscoverySession() { filter->SetRSSI(kMinDiscoveryRSSI); adapter_->StartDiscoverySessionWithFilter( - filter.Pass(), + std::move(filter), base::Bind(&BluetoothLowEnergyConnectionFinder::OnDiscoverySessionStarted, weak_ptr_factory_.GetWeakPtr()), base::Bind( @@ -310,7 +311,7 @@ BluetoothDevice* BluetoothLowEnergyConnectionFinder::GetDevice( } void BluetoothLowEnergyConnectionFinder::InvokeCallbackAsync() { - connection_callback_.Run(connection_.Pass()); + connection_callback_.Run(std::move(connection_)); } } // namespace proximity_auth diff --git a/components/proximity_auth/ble/bluetooth_low_energy_connection_finder_unittest.cc b/components/proximity_auth/ble/bluetooth_low_energy_connection_finder_unittest.cc index 8133260..e5ba32c 100644 --- a/components/proximity_auth/ble/bluetooth_low_energy_connection_finder_unittest.cc +++ b/components/proximity_auth/ble/bluetooth_low_energy_connection_finder_unittest.cc @@ -5,6 +5,7 @@ #include "components/proximity_auth/ble/bluetooth_low_energy_connection_finder.h" #include <string> +#include <utility> #include "base/bind.h" #include "base/macros.h" @@ -132,7 +133,7 @@ class ProximityAuthBluetoothLowEnergyConnectionFinderTest } void OnConnectionFound(scoped_ptr<Connection> connection) { - last_found_connection_ = connection.Pass(); + last_found_connection_ = std::move(connection); } void FindAndExpectStartDiscovery( @@ -151,7 +152,7 @@ class ProximityAuthBluetoothLowEnergyConnectionFinderTest .WillByDefault(Return(true)); connection_finder.Find(connection_callback_); ASSERT_FALSE(discovery_callback.is_null()); - discovery_callback.Run(discovery_session.Pass()); + discovery_callback.Run(std::move(discovery_session)); } void ExpectRemoveObserver() { @@ -222,7 +223,7 @@ TEST_F(ProximityAuthBluetoothLowEnergyConnectionFinderTest, connection_finder.Find(connection_callback_); ASSERT_FALSE(discovery_callback.is_null()); - discovery_callback.Run(discovery_session.Pass()); + discovery_callback.Run(std::move(discovery_session)); EXPECT_CALL(*adapter_, RemoveObserver(_)); } @@ -418,7 +419,7 @@ TEST_F(ProximityAuthBluetoothLowEnergyConnectionFinderTest, ON_CALL(*last_discovery_session_alias_, IsActive()) .WillByDefault(Return(true)); ASSERT_FALSE(discovery_callback.is_null()); - discovery_callback.Run(discovery_session.Pass()); + discovery_callback.Run(std::move(discovery_session)); // Preparing to create a GATT connection to the right device. PrepareDevice(kServiceUUID, kTestRemoteDeviceBluetoothAddress, true); @@ -472,7 +473,7 @@ TEST_F(ProximityAuthBluetoothLowEnergyConnectionFinderTest, .WillByDefault(Return(true)); ASSERT_FALSE(discovery_callback.is_null()); - discovery_callback.Run(discovery_session.Pass()); + discovery_callback.Run(std::move(discovery_session)); // Preparing to create a GATT connection to the right device. PrepareDevice(kServiceUUID, kTestRemoteDeviceBluetoothAddress, true); diff --git a/components/proximity_auth/ble/bluetooth_low_energy_connection_unittest.cc b/components/proximity_auth/ble/bluetooth_low_energy_connection_unittest.cc index a24a7d7..3427182 100644 --- a/components/proximity_auth/ble/bluetooth_low_energy_connection_unittest.cc +++ b/components/proximity_auth/ble/bluetooth_low_energy_connection_unittest.cc @@ -5,6 +5,7 @@ #include "components/proximity_auth/ble/bluetooth_low_energy_connection.h" #include <stdint.h> +#include <utility> #include "base/bind.h" #include "base/macros.h" @@ -185,7 +186,7 @@ class ProximityAuthBluetoothLowEnergyConnectionTest : public testing::Test { connection->SetTaskRunnerForTesting(task_runner_); - return connection.Pass(); + return connection; } // Transitions |connection| from DISCONNECTED to WAITING_CHARACTERISTICS @@ -260,7 +261,7 @@ class ProximityAuthBluetoothLowEnergyConnectionTest : public testing::Test { kToPeripheralCharID)); notify_session_alias_ = notify_session.get(); - notify_session_success_callback_.Run(notify_session.Pass()); + notify_session_success_callback_.Run(std::move(notify_session)); task_runner_->RunUntilIdle(); EXPECT_EQ(connection->sub_status(), diff --git a/components/proximity_auth/bluetooth_connection.cc b/components/proximity_auth/bluetooth_connection.cc index 7adf8ef..f0cce29 100644 --- a/components/proximity_auth/bluetooth_connection.cc +++ b/components/proximity_auth/bluetooth_connection.cc @@ -4,6 +4,8 @@ #include "components/proximity_auth/bluetooth_connection.h" +#include <utility> + #include "base/bind.h" #include "base/location.h" #include "base/numerics/safe_conversions.h" @@ -80,7 +82,7 @@ void BluetoothConnection::SendMessageImpl(scoped_ptr<WireMessage> message) { memcpy(buffer->data(), serialized_message.c_str(), message_length); // Send it. - pending_message_ = message.Pass(); + pending_message_ = std::move(message); base::WeakPtr<BluetoothConnection> weak_this = weak_ptr_factory_.GetWeakPtr(); socket_->Send(buffer, message_length, diff --git a/components/proximity_auth/bluetooth_connection_finder.cc b/components/proximity_auth/bluetooth_connection_finder.cc index 3595414..b92d767 100644 --- a/components/proximity_auth/bluetooth_connection_finder.cc +++ b/components/proximity_auth/bluetooth_connection_finder.cc @@ -4,6 +4,8 @@ #include "components/proximity_auth/bluetooth_connection_finder.h" +#include <utility> + #include "base/bind.h" #include "base/location.h" #include "base/logging.h" @@ -198,7 +200,7 @@ void BluetoothConnectionFinder::OnConnectionStatusChanged( } void BluetoothConnectionFinder::InvokeCallbackAsync() { - connection_callback_.Run(connection_.Pass()); + connection_callback_.Run(std::move(connection_)); } } // namespace proximity_auth diff --git a/components/proximity_auth/bluetooth_connection_finder_unittest.cc b/components/proximity_auth/bluetooth_connection_finder_unittest.cc index 36432af..f8f1b7d 100644 --- a/components/proximity_auth/bluetooth_connection_finder_unittest.cc +++ b/components/proximity_auth/bluetooth_connection_finder_unittest.cc @@ -4,6 +4,8 @@ #include "components/proximity_auth/bluetooth_connection_finder.h" +#include <utility> + #include "base/bind.h" #include "base/macros.h" #include "base/memory/ref_counted.h" @@ -149,7 +151,7 @@ class ProximityAuthBluetoothConnectionFinderTest : public testing::Test { MOCK_METHOD1(OnConnectionFoundProxy, void(Connection* connection)); void OnConnectionFound(scoped_ptr<Connection> connection) { OnConnectionFoundProxy(connection.get()); - last_found_connection_ = connection.Pass(); + last_found_connection_ = std::move(connection); } // Starts |connection_finder_|. If |expect_connection| is true, then we set an diff --git a/components/proximity_auth/bluetooth_connection_unittest.cc b/components/proximity_auth/bluetooth_connection_unittest.cc index d1f0430..8782bbc 100644 --- a/components/proximity_auth/bluetooth_connection_unittest.cc +++ b/components/proximity_auth/bluetooth_connection_unittest.cc @@ -4,6 +4,8 @@ #include "components/proximity_auth/bluetooth_connection.h" +#include <utility> + #include "base/macros.h" #include "base/message_loop/message_loop.h" #include "base/numerics/safe_conversions.h" @@ -401,7 +403,7 @@ TEST_F(ProximityAuthBluetoothConnectionTest, scoped_ptr<TestWireMessage> wire_message(new TestWireMessage); EXPECT_CALL(*socket_, Send(_, kSerializedMessageLength, _, _)) .WillOnce(SaveArg<0>(&buffer)); - connection.SendMessage(wire_message.Pass()); + connection.SendMessage(std::move(wire_message)); ASSERT_TRUE(buffer.get()); EXPECT_EQ(kSerializedMessage, std::string(buffer->data(), kSerializedMessageLength)); @@ -422,7 +424,7 @@ TEST_F(ProximityAuthBluetoothConnectionTest, SendMessage_Success) { device::BluetoothSocket::SendCompletionCallback callback; EXPECT_CALL(*socket_, Send(_, _, _, _)).WillOnce(SaveArg<2>(&callback)); - connection.SendMessage(wire_message.Pass()); + connection.SendMessage(std::move(wire_message)); ASSERT_FALSE(callback.is_null()); EXPECT_CALL(connection, OnDidSendMessage(Ref(*expected_wire_message), true)); @@ -444,7 +446,7 @@ TEST_F(ProximityAuthBluetoothConnectionTest, SendMessage_Failure) { device::BluetoothSocket::ErrorCompletionCallback error_callback; EXPECT_CALL(*socket_, Send(_, _, _, _)).WillOnce(SaveArg<3>(&error_callback)); - connection.SendMessage(wire_message.Pass()); + connection.SendMessage(std::move(wire_message)); ASSERT_FALSE(error_callback.is_null()); EXPECT_CALL(connection, OnDidSendMessage(Ref(*expected_wire_message), false)); diff --git a/components/proximity_auth/bluetooth_throttler_impl.cc b/components/proximity_auth/bluetooth_throttler_impl.cc index a44ce1e..f9a54e2 100644 --- a/components/proximity_auth/bluetooth_throttler_impl.cc +++ b/components/proximity_auth/bluetooth_throttler_impl.cc @@ -4,6 +4,8 @@ #include "components/proximity_auth/bluetooth_throttler_impl.h" +#include <utility> + #include "base/stl_util.h" #include "base/time/tick_clock.h" #include "components/proximity_auth/connection.h" @@ -18,8 +20,7 @@ const int kCooldownTimeSecs = 7; BluetoothThrottlerImpl::BluetoothThrottlerImpl( scoped_ptr<base::TickClock> clock) - : clock_(clock.Pass()) { -} + : clock_(std::move(clock)) {} BluetoothThrottlerImpl::~BluetoothThrottlerImpl() { for (Connection* connection : connections_) { diff --git a/components/proximity_auth/bluetooth_throttler_impl_unittest.cc b/components/proximity_auth/bluetooth_throttler_impl_unittest.cc index d65ad7d..5cfc4c9 100644 --- a/components/proximity_auth/bluetooth_throttler_impl_unittest.cc +++ b/components/proximity_auth/bluetooth_throttler_impl_unittest.cc @@ -4,6 +4,8 @@ #include "components/proximity_auth/bluetooth_throttler_impl.h" +#include <utility> + #include "base/macros.h" #include "base/test/simple_test_tick_clock.h" #include "base/time/time.h" @@ -17,7 +19,7 @@ namespace { class TestBluetoothThrottler : public BluetoothThrottlerImpl { public: explicit TestBluetoothThrottler(scoped_ptr<base::TickClock> clock) - : BluetoothThrottlerImpl(clock.Pass()) {} + : BluetoothThrottlerImpl(std::move(clock)) {} ~TestBluetoothThrottler() override {} // Increase visibility for testing. diff --git a/components/proximity_auth/connection.cc b/components/proximity_auth/connection.cc index 85249bb..6480c4e 100644 --- a/components/proximity_auth/connection.cc +++ b/components/proximity_auth/connection.cc @@ -4,6 +4,8 @@ #include "components/proximity_auth/connection.h" +#include <utility> + #include "base/logging.h" #include "components/proximity_auth/connection_observer.h" #include "components/proximity_auth/wire_message.h" @@ -35,7 +37,7 @@ void Connection::SendMessage(scoped_ptr<WireMessage> message) { } is_sending_message_ = true; - SendMessageImpl(message.Pass()); + SendMessageImpl(std::move(message)); } void Connection::AddObserver(ConnectionObserver* observer) { diff --git a/components/proximity_auth/cryptauth/cryptauth_client_impl.cc b/components/proximity_auth/cryptauth/cryptauth_client_impl.cc index 1177ce7..9e924bb 100644 --- a/components/proximity_auth/cryptauth/cryptauth_client_impl.cc +++ b/components/proximity_auth/cryptauth/cryptauth_client_impl.cc @@ -4,6 +4,8 @@ #include "components/proximity_auth/cryptauth/cryptauth_client_impl.h" +#include <utility> + #include "base/bind.h" #include "base/command_line.h" #include "components/proximity_auth/cryptauth/cryptauth_access_token_fetcher_impl.h" @@ -50,13 +52,12 @@ CryptAuthClientImpl::CryptAuthClientImpl( scoped_ptr<CryptAuthAccessTokenFetcher> access_token_fetcher, scoped_refptr<net::URLRequestContextGetter> url_request_context, const cryptauth::DeviceClassifier& device_classifier) - : api_call_flow_(api_call_flow.Pass()), - access_token_fetcher_(access_token_fetcher.Pass()), + : api_call_flow_(std::move(api_call_flow)), + access_token_fetcher_(std::move(access_token_fetcher)), url_request_context_(url_request_context), device_classifier_(device_classifier), has_call_started_(false), - weak_ptr_factory_(this) { -} + weak_ptr_factory_(this) {} CryptAuthClientImpl::~CryptAuthClientImpl() { } diff --git a/components/proximity_auth/cryptauth/cryptauth_device_manager.cc b/components/proximity_auth/cryptauth/cryptauth_device_manager.cc index f903597..a931cc8 100644 --- a/components/proximity_auth/cryptauth/cryptauth_device_manager.cc +++ b/components/proximity_auth/cryptauth/cryptauth_device_manager.cc @@ -5,6 +5,7 @@ #include "components/proximity_auth/cryptauth/cryptauth_device_manager.h" #include <stddef.h> +#include <utility> #include "base/base64url.h" #include "base/prefs/pref_registry_simple.h" @@ -58,7 +59,7 @@ scoped_ptr<base::DictionaryValue> UnlockKeyToDictionary( dictionary->SetString(kExternalDeviceKeyDeviceName, device_name_b64); dictionary->SetString(kExternalDeviceKeyBluetoothAddress, bluetooth_address_b64); - return dictionary.Pass(); + return dictionary; } // Converts an unlock key dictionary stored in user prefs to an @@ -104,8 +105,8 @@ CryptAuthDeviceManager::CryptAuthDeviceManager( scoped_ptr<CryptAuthClientFactory> client_factory, CryptAuthGCMManager* gcm_manager, PrefService* pref_service) - : clock_(clock.Pass()), - client_factory_(client_factory.Pass()), + : clock_(std::move(clock)), + client_factory_(std::move(client_factory)), gcm_manager_(gcm_manager), pref_service_(pref_service), weak_ptr_factory_(this) { @@ -266,7 +267,7 @@ void CryptAuthDeviceManager::OnSyncRequested( scoped_ptr<SyncScheduler::SyncRequest> sync_request) { FOR_EACH_OBSERVER(Observer, observers_, OnSyncStarted()); - sync_request_ = sync_request.Pass(); + sync_request_ = std::move(sync_request); cryptauth_client_ = client_factory_->CreateInstance(); cryptauth::InvocationReason invocation_reason = diff --git a/components/proximity_auth/cryptauth/cryptauth_device_manager_unittest.cc b/components/proximity_auth/cryptauth/cryptauth_device_manager_unittest.cc index 7c1bde6..e70f5a9 100644 --- a/components/proximity_auth/cryptauth/cryptauth_device_manager_unittest.cc +++ b/components/proximity_auth/cryptauth/cryptauth_device_manager_unittest.cc @@ -5,6 +5,7 @@ #include "components/proximity_auth/cryptauth/cryptauth_device_manager.h" #include <stddef.h> +#include <utility> #include "base/base64url.h" #include "base/macros.h" @@ -116,8 +117,8 @@ class TestCryptAuthDeviceManager : public CryptAuthDeviceManager { scoped_ptr<CryptAuthClientFactory> client_factory, CryptAuthGCMManager* gcm_manager, PrefService* pref_service) - : CryptAuthDeviceManager(clock.Pass(), - client_factory.Pass(), + : CryptAuthDeviceManager(std::move(clock), + std::move(client_factory), gcm_manager, pref_service), scoped_sync_scheduler_(new NiceMock<MockSyncScheduler>()), @@ -127,7 +128,7 @@ class TestCryptAuthDeviceManager : public CryptAuthDeviceManager { scoped_ptr<SyncScheduler> CreateSyncScheduler() override { EXPECT_TRUE(scoped_sync_scheduler_); - return scoped_sync_scheduler_.Pass(); + return std::move(scoped_sync_scheduler_); } base::WeakPtr<MockSyncScheduler> GetSyncScheduler() { @@ -202,7 +203,7 @@ class ProximityAuthCryptAuthDeviceManagerTest { ListPrefUpdate update(&pref_service_, prefs::kCryptAuthDeviceSyncUnlockKeys); - update.Get()->Append(unlock_key_dictionary.Pass()); + update.Get()->Append(std::move(unlock_key_dictionary)); } device_manager_.reset(new TestCryptAuthDeviceManager( @@ -255,7 +256,7 @@ class ProximityAuthCryptAuthDeviceManagerTest scoped_ptr<SyncScheduler::SyncRequest> sync_request = make_scoped_ptr( new SyncScheduler::SyncRequest(device_manager_->GetSyncScheduler())); EXPECT_CALL(*this, OnSyncStartedProxy()); - delegate->OnSyncRequested(sync_request.Pass()); + delegate->OnSyncRequested(std::move(sync_request)); EXPECT_EQ(expected_invocation_reason, get_my_devices_request_.invocation_reason()); @@ -348,7 +349,7 @@ TEST_F(ProximityAuthCryptAuthDeviceManagerTest, InitWithDefaultPrefs) { CryptAuthDeviceManager::RegisterPrefs(pref_service.registry()); TestCryptAuthDeviceManager device_manager( - clock.Pass(), + std::move(clock), make_scoped_ptr(new MockCryptAuthClientFactory( MockCryptAuthClientFactory::MockType::MAKE_STRICT_MOCKS)), &gcm_manager_, &pref_service); diff --git a/components/proximity_auth/cryptauth/cryptauth_enroller_impl.cc b/components/proximity_auth/cryptauth/cryptauth_enroller_impl.cc index 025a345..393cfe0 100644 --- a/components/proximity_auth/cryptauth/cryptauth_enroller_impl.cc +++ b/components/proximity_auth/cryptauth/cryptauth_enroller_impl.cc @@ -4,6 +4,8 @@ #include "components/proximity_auth/cryptauth/cryptauth_enroller_impl.h" +#include <utility> + #include "base/bind.h" #include "components/proximity_auth/cryptauth/cryptauth_client_impl.h" #include "components/proximity_auth/cryptauth/cryptauth_enrollment_utils.h" @@ -54,10 +56,9 @@ std::string CreateEnrollmentPublicMetadata() { CryptAuthEnrollerImpl::CryptAuthEnrollerImpl( scoped_ptr<CryptAuthClientFactory> client_factory, scoped_ptr<SecureMessageDelegate> secure_message_delegate) - : client_factory_(client_factory.Pass()), - secure_message_delegate_(secure_message_delegate.Pass()), - weak_ptr_factory_(this) { -} + : client_factory_(std::move(client_factory)), + secure_message_delegate_(std::move(secure_message_delegate)), + weak_ptr_factory_(this) {} CryptAuthEnrollerImpl::~CryptAuthEnrollerImpl() { } diff --git a/components/proximity_auth/cryptauth/cryptauth_enrollment_manager.cc b/components/proximity_auth/cryptauth/cryptauth_enrollment_manager.cc index 026b42a1..22d97ec 100644 --- a/components/proximity_auth/cryptauth/cryptauth_enrollment_manager.cc +++ b/components/proximity_auth/cryptauth/cryptauth_enrollment_manager.cc @@ -4,6 +4,8 @@ #include "components/proximity_auth/cryptauth/cryptauth_enrollment_manager.h" +#include <utility> + #include "base/base64url.h" #include "base/prefs/pref_registry_simple.h" #include "base/prefs/pref_service.h" @@ -48,9 +50,9 @@ CryptAuthEnrollmentManager::CryptAuthEnrollmentManager( const cryptauth::GcmDeviceInfo& device_info, CryptAuthGCMManager* gcm_manager, PrefService* pref_service) - : clock_(clock.Pass()), - enroller_factory_(enroller_factory.Pass()), - secure_message_delegate_(secure_message_delegate.Pass()), + : clock_(std::move(clock)), + enroller_factory_(std::move(enroller_factory)), + secure_message_delegate_(std::move(secure_message_delegate)), device_info_(device_info), gcm_manager_(gcm_manager), pref_service_(pref_service), @@ -228,7 +230,7 @@ void CryptAuthEnrollmentManager::OnSyncRequested( scoped_ptr<SyncScheduler::SyncRequest> sync_request) { FOR_EACH_OBSERVER(Observer, observers_, OnEnrollmentStarted()); - sync_request_ = sync_request.Pass(); + sync_request_ = std::move(sync_request); if (gcm_manager_->GetRegistrationId().empty() || pref_service_->GetInteger(prefs::kCryptAuthEnrollmentReason) == cryptauth::INVOCATION_REASON_MANUAL) { diff --git a/components/proximity_auth/cryptauth/cryptauth_enrollment_manager_unittest.cc b/components/proximity_auth/cryptauth/cryptauth_enrollment_manager_unittest.cc index 9b29842..99756d0 100644 --- a/components/proximity_auth/cryptauth/cryptauth_enrollment_manager_unittest.cc +++ b/components/proximity_auth/cryptauth/cryptauth_enrollment_manager_unittest.cc @@ -4,6 +4,8 @@ #include "components/proximity_auth/cryptauth/cryptauth_enrollment_manager.h" +#include <utility> + #include "base/base64url.h" #include "base/macros.h" #include "base/memory/weak_ptr.h" @@ -75,9 +77,9 @@ class MockCryptAuthEnrollerFactory : public CryptAuthEnrollerFactory { // CryptAuthEnrollerFactory: scoped_ptr<CryptAuthEnroller> CreateInstance() override { - auto passed_cryptauth_enroller = next_cryptauth_enroller_.Pass(); + auto passed_cryptauth_enroller = std::move(next_cryptauth_enroller_); next_cryptauth_enroller_.reset(new NiceMock<MockCryptAuthEnroller>()); - return passed_cryptauth_enroller.Pass(); + return std::move(passed_cryptauth_enroller); } MockCryptAuthEnroller* next_cryptauth_enroller() { @@ -102,9 +104,9 @@ class TestCryptAuthEnrollmentManager : public CryptAuthEnrollmentManager { const cryptauth::GcmDeviceInfo& device_info, CryptAuthGCMManager* gcm_manager, PrefService* pref_service) - : CryptAuthEnrollmentManager(clock.Pass(), - enroller_factory.Pass(), - secure_message_delegate.Pass(), + : CryptAuthEnrollmentManager(std::move(clock), + std::move(enroller_factory), + std::move(secure_message_delegate), device_info, gcm_manager, pref_service), @@ -115,7 +117,7 @@ class TestCryptAuthEnrollmentManager : public CryptAuthEnrollmentManager { scoped_ptr<SyncScheduler> CreateSyncScheduler() override { EXPECT_TRUE(scoped_sync_scheduler_); - return scoped_sync_scheduler_.Pass(); + return std::move(scoped_sync_scheduler_); } base::WeakPtr<MockSyncScheduler> GetSyncScheduler() { @@ -224,7 +226,7 @@ class ProximityAuthCryptAuthEnrollmentManagerTest SyncScheduler::Delegate* delegate = static_cast<SyncScheduler::Delegate*>(&enrollment_manager_); - delegate->OnSyncRequested(sync_request.Pass()); + delegate->OnSyncRequested(std::move(sync_request)); return completion_callback; } @@ -305,7 +307,7 @@ TEST_F(ProximityAuthCryptAuthEnrollmentManagerTest, InitWithDefaultPrefs) { CryptAuthEnrollmentManager::RegisterPrefs(pref_service.registry()); TestCryptAuthEnrollmentManager enrollment_manager( - clock.Pass(), make_scoped_ptr(new MockCryptAuthEnrollerFactory()), + std::move(clock), make_scoped_ptr(new MockCryptAuthEnrollerFactory()), make_scoped_ptr(new FakeSecureMessageDelegate()), device_info_, &gcm_manager_, &pref_service); @@ -409,7 +411,7 @@ TEST_F(ProximityAuthCryptAuthEnrollmentManagerTest, auto sync_request = make_scoped_ptr( new SyncScheduler::SyncRequest(enrollment_manager_.GetSyncScheduler())); static_cast<SyncScheduler::Delegate*>(&enrollment_manager_) - ->OnSyncRequested(sync_request.Pass()); + ->OnSyncRequested(std::move(sync_request)); // Complete GCM registration successfully, and expect an enrollment. CryptAuthEnroller::EnrollmentFinishedCallback enrollment_callback; @@ -445,7 +447,7 @@ TEST_F(ProximityAuthCryptAuthEnrollmentManagerTest, GCMRegistrationFails) { auto sync_request = make_scoped_ptr( new SyncScheduler::SyncRequest(enrollment_manager_.GetSyncScheduler())); static_cast<SyncScheduler::Delegate*>(&enrollment_manager_) - ->OnSyncRequested(sync_request.Pass()); + ->OnSyncRequested(std::move(sync_request)); // Complete GCM registration with failure. EXPECT_CALL(*this, OnEnrollmentFinishedProxy(false)); diff --git a/components/proximity_auth/cryptauth/mock_cryptauth_client.cc b/components/proximity_auth/cryptauth/mock_cryptauth_client.cc index 05f9ac6..5086dd4 100644 --- a/components/proximity_auth/cryptauth/mock_cryptauth_client.cc +++ b/components/proximity_auth/cryptauth/mock_cryptauth_client.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 "base/callback.h" #include "components/proximity_auth/cryptauth/mock_cryptauth_client.h" +#include <utility> + +#include "base/callback.h" + namespace proximity_auth { MockCryptAuthClient::MockCryptAuthClient() { @@ -29,7 +32,7 @@ scoped_ptr<CryptAuthClient> MockCryptAuthClientFactory::CreateInstance() { FOR_EACH_OBSERVER(Observer, observer_list_, OnCryptAuthClientCreated(client.get())); - return client.Pass(); + return std::move(client); } void MockCryptAuthClientFactory::AddObserver(Observer* observer) { diff --git a/components/proximity_auth/cryptauth/sync_scheduler_impl_unittest.cc b/components/proximity_auth/cryptauth/sync_scheduler_impl_unittest.cc index 8b736ae..a62fb3f 100644 --- a/components/proximity_auth/cryptauth/sync_scheduler_impl_unittest.cc +++ b/components/proximity_auth/cryptauth/sync_scheduler_impl_unittest.cc @@ -4,6 +4,8 @@ #include "components/proximity_auth/cryptauth/sync_scheduler_impl.h" +#include <utility> + #include "base/macros.h" #include "base/timer/mock_timer.h" #include "testing/gtest/include/gtest/gtest.h" @@ -87,7 +89,7 @@ class ProximityAuthSyncSchedulerImplTest : public testing::Test, void OnSyncRequested( scoped_ptr<SyncScheduler::SyncRequest> sync_request) override { - sync_request_ = sync_request.Pass(); + sync_request_ = std::move(sync_request); } base::MockTimer* timer() { return scheduler_->timer(); } diff --git a/components/proximity_auth/device_to_device_authenticator.cc b/components/proximity_auth/device_to_device_authenticator.cc index ccc3fd1..4335588 100644 --- a/components/proximity_auth/device_to_device_authenticator.cc +++ b/components/proximity_auth/device_to_device_authenticator.cc @@ -4,6 +4,8 @@ #include "components/proximity_auth/device_to_device_authenticator.h" +#include <utility> + #include "base/time/time.h" #include "base/timer/timer.h" #include "components/proximity_auth/connection.h" @@ -35,7 +37,7 @@ DeviceToDeviceAuthenticator::DeviceToDeviceAuthenticator( scoped_ptr<SecureMessageDelegate> secure_message_delegate) : connection_(connection), account_id_(account_id), - secure_message_delegate_(secure_message_delegate.Pass()), + secure_message_delegate_(std::move(secure_message_delegate)), state_(State::NOT_STARTED), weak_ptr_factory_(this) { DCHECK(connection_); @@ -179,7 +181,7 @@ void DeviceToDeviceAuthenticator::Succeed() { callback_.Run( Result::SUCCESS, make_scoped_ptr(new DeviceToDeviceSecureContext( - secure_message_delegate_.Pass(), session_symmetric_key_, + std::move(secure_message_delegate_), session_symmetric_key_, responder_auth_message_, SecureContext::PROTOCOL_VERSION_THREE_ONE))); } diff --git a/components/proximity_auth/device_to_device_authenticator_unittest.cc b/components/proximity_auth/device_to_device_authenticator_unittest.cc index e9512b7..0a1b085 100644 --- a/components/proximity_auth/device_to_device_authenticator_unittest.cc +++ b/components/proximity_auth/device_to_device_authenticator_unittest.cc @@ -4,6 +4,8 @@ #include "components/proximity_auth/device_to_device_authenticator.h" +#include <utility> + #include "base/base64url.h" #include "base/bind.h" #include "base/macros.h" @@ -84,7 +86,7 @@ class FakeConnection : public Connection { // Connection: void SendMessageImpl(scoped_ptr<WireMessage> message) override { const WireMessage& message_alias = *message; - message_buffer_.push_back(message.Pass()); + message_buffer_.push_back(std::move(message)); OnDidSendMessage(message_alias, !connection_blocked_); } @@ -104,7 +106,7 @@ class DeviceToDeviceAuthenticatorForTest : public DeviceToDeviceAuthenticator { scoped_ptr<SecureMessageDelegate> secure_message_delegate) : DeviceToDeviceAuthenticator(connection, kAccountId, - secure_message_delegate.Pass()), + std::move(secure_message_delegate)), timer_(nullptr) {} ~DeviceToDeviceAuthenticatorForTest() override {} @@ -120,7 +122,7 @@ class DeviceToDeviceAuthenticatorForTest : public DeviceToDeviceAuthenticator { new base::MockTimer(retain_user_task, is_repeating)); timer_ = timer.get(); - return timer.Pass(); + return std::move(timer); } // This instance is owned by the super class. @@ -212,7 +214,7 @@ class ProximityAuthDeviceToDeviceAuthenticatorTest : public testing::Test { void OnAuthenticationResult(Authenticator::Result result, scoped_ptr<SecureContext> secure_context) { - secure_context_ = secure_context.Pass(); + secure_context_ = std::move(secure_context); OnAuthenticationResultProxy(result); } diff --git a/components/proximity_auth/device_to_device_secure_context.cc b/components/proximity_auth/device_to_device_secure_context.cc index 701de95..f8356f4 100644 --- a/components/proximity_auth/device_to_device_secure_context.cc +++ b/components/proximity_auth/device_to_device_secure_context.cc @@ -4,6 +4,8 @@ #include "components/proximity_auth/device_to_device_secure_context.h" +#include <utility> + #include "base/bind.h" #include "base/callback.h" #include "components/proximity_auth/cryptauth/proto/cryptauth_api.pb.h" @@ -29,7 +31,7 @@ DeviceToDeviceSecureContext::DeviceToDeviceSecureContext( const std::string& symmetric_key, const std::string& responder_auth_message, ProtocolVersion protocol_version) - : secure_message_delegate_(secure_message_delegate.Pass()), + : secure_message_delegate_(std::move(secure_message_delegate)), symmetric_key_(symmetric_key), responder_auth_message_(responder_auth_message), protocol_version_(protocol_version), diff --git a/components/proximity_auth/fake_connection.cc b/components/proximity_auth/fake_connection.cc index 1c9261d..d721966 100644 --- a/components/proximity_auth/fake_connection.cc +++ b/components/proximity_auth/fake_connection.cc @@ -4,6 +4,8 @@ #include "components/proximity_auth/fake_connection.h" +#include <utility> + #include "components/proximity_auth/wire_message.h" namespace proximity_auth { @@ -29,7 +31,7 @@ void FakeConnection::FinishSendingMessageWithSuccess(bool success) { CHECK(current_message_); // Capture a copy of the message, as OnDidSendMessage() might reentrantly // call SendMessage(). - scoped_ptr<WireMessage> sent_message = current_message_.Pass(); + scoped_ptr<WireMessage> sent_message = std::move(current_message_); OnDidSendMessage(*sent_message, success); } @@ -41,7 +43,7 @@ void FakeConnection::ReceiveMessageWithPayload(const std::string& payload) { void FakeConnection::SendMessageImpl(scoped_ptr<WireMessage> message) { CHECK(!current_message_); - current_message_ = message.Pass(); + current_message_ = std::move(message); } scoped_ptr<WireMessage> FakeConnection::DeserializeWireMessage( diff --git a/components/proximity_auth/messenger_impl.cc b/components/proximity_auth/messenger_impl.cc index d6a1869..3eeaba3 100644 --- a/components/proximity_auth/messenger_impl.cc +++ b/components/proximity_auth/messenger_impl.cc @@ -4,6 +4,8 @@ #include "components/proximity_auth/messenger_impl.h" +#include <utility> + #include "base/base64url.h" #include "base/bind.h" #include "base/json/json_reader.h" @@ -67,8 +69,8 @@ std::string GetMessageType(const base::DictionaryValue& message) { MessengerImpl::MessengerImpl(scoped_ptr<Connection> connection, scoped_ptr<SecureContext> secure_context) - : connection_(connection.Pass()), - secure_context_(secure_context.Pass()), + : connection_(std::move(connection)), + secure_context_(std::move(secure_context)), weak_ptr_factory_(this) { DCHECK(connection_->IsConnected()); connection_->AddObserver(this); diff --git a/components/proximity_auth/proximity_monitor_impl.cc b/components/proximity_auth/proximity_monitor_impl.cc index 702ea77..6114f499 100644 --- a/components/proximity_auth/proximity_monitor_impl.cc +++ b/components/proximity_auth/proximity_monitor_impl.cc @@ -5,6 +5,7 @@ #include "components/proximity_auth/proximity_monitor_impl.h" #include <math.h> +#include <utility> #include "base/bind.h" #include "base/location.h" @@ -37,7 +38,7 @@ ProximityMonitorImpl::ProximityMonitorImpl(const RemoteDevice& remote_device, strategy_(Strategy::NONE), remote_device_is_in_proximity_(false), is_active_(false), - clock_(clock.Pass()), + clock_(std::move(clock)), polling_weak_ptr_factory_(this), weak_ptr_factory_(this) { if (device::BluetoothAdapterFactory::IsBluetoothAdapterAvailable()) { diff --git a/components/proximity_auth/proximity_monitor_impl_unittest.cc b/components/proximity_auth/proximity_monitor_impl_unittest.cc index 4c45189..6fe5506 100644 --- a/components/proximity_auth/proximity_monitor_impl_unittest.cc +++ b/components/proximity_auth/proximity_monitor_impl_unittest.cc @@ -4,6 +4,8 @@ #include "components/proximity_auth/proximity_monitor_impl.h" +#include <utility> + #include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" @@ -39,7 +41,7 @@ class TestProximityMonitorImpl : public ProximityMonitorImpl { public: explicit TestProximityMonitorImpl(const RemoteDevice& remote_device, scoped_ptr<base::TickClock> clock) - : ProximityMonitorImpl(remote_device, clock.Pass()) {} + : ProximityMonitorImpl(remote_device, std::move(clock)) {} ~TestProximityMonitorImpl() override {} using ProximityMonitorImpl::SetStrategy; @@ -543,7 +545,7 @@ TEST_F(ProximityAuthProximityMonitorImplTest, kPersistentSymmetricKey, std::string()); scoped_ptr<base::TickClock> clock(new base::SimpleTestTickClock()); - ProximityMonitorImpl monitor(unnamed_remote_device, clock.Pass()); + ProximityMonitorImpl monitor(unnamed_remote_device, std::move(clock)); monitor.AddObserver(&observer_); monitor.Start(); ProvideConnectionInfo({127, 127, 127}); diff --git a/components/proximity_auth/remote_device_life_cycle_impl.cc b/components/proximity_auth/remote_device_life_cycle_impl.cc index 61ea008..97f9e7d 100644 --- a/components/proximity_auth/remote_device_life_cycle_impl.cc +++ b/components/proximity_auth/remote_device_life_cycle_impl.cc @@ -4,6 +4,8 @@ #include "components/proximity_auth/remote_device_life_cycle_impl.h" +#include <utility> + #include "base/bind.h" #include "base/location.h" #include "base/thread_task_runner_handle.h" @@ -118,7 +120,7 @@ void RemoteDeviceLifeCycleImpl::FindConnection() { void RemoteDeviceLifeCycleImpl::OnConnectionFound( scoped_ptr<Connection> connection) { DCHECK(state_ == RemoteDeviceLifeCycle::State::FINDING_CONNECTION); - connection_ = connection.Pass(); + connection_ = std::move(connection); authenticator_ = CreateAuthenticator(); authenticator_->Authenticate( base::Bind(&RemoteDeviceLifeCycleImpl::OnAuthenticationResult, @@ -146,7 +148,7 @@ void RemoteDeviceLifeCycleImpl::OnAuthenticationResult( // Create the MessengerImpl asynchronously. |messenger_| registers itself as // an observer of |connection_|, so creating it synchronously would trigger // |OnSendCompleted()| as an observer call for |messenger_|. - secure_context_ = secure_context.Pass(); + secure_context_ = std::move(secure_context); base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::Bind(&RemoteDeviceLifeCycleImpl::CreateMessenger, weak_ptr_factory_.GetWeakPtr())); @@ -156,7 +158,7 @@ void RemoteDeviceLifeCycleImpl::CreateMessenger() { DCHECK(state_ == RemoteDeviceLifeCycle::State::AUTHENTICATING); DCHECK(secure_context_); messenger_.reset( - new MessengerImpl(connection_.Pass(), secure_context_.Pass())); + new MessengerImpl(std::move(connection_), std::move(secure_context_))); messenger_->AddObserver(this); TransitionToState(RemoteDeviceLifeCycle::State::SECURE_CHANNEL_ESTABLISHED); diff --git a/components/proximity_auth/remote_device_life_cycle_impl_unittest.cc b/components/proximity_auth/remote_device_life_cycle_impl_unittest.cc index 22945cc..3af5f18 100644 --- a/components/proximity_auth/remote_device_life_cycle_impl_unittest.cc +++ b/components/proximity_auth/remote_device_life_cycle_impl_unittest.cc @@ -5,6 +5,7 @@ #include "components/proximity_auth/remote_device_life_cycle_impl.h" #include <stddef.h> +#include <utility> #include "base/callback.h" #include "base/macros.h" @@ -68,7 +69,7 @@ class FakeConnectionFinder : public ConnectionFinder { scoped_ptr<FakeConnection> scoped_connection_( new FakeConnection(remote_device_)); connection_ = scoped_connection_.get(); - connection_callback_.Run(scoped_connection_.Pass()); + connection_callback_.Run(std::move(scoped_connection_)); } FakeConnection* connection() { return connection_; } @@ -105,7 +106,7 @@ class FakeAuthenticator : public Authenticator { scoped_ptr<SecureContext> secure_context; if (result == Authenticator::Result::SUCCESS) secure_context.reset(new StubSecureContext()); - callback_.Run(result, secure_context.Pass()); + callback_.Run(result, std::move(secure_context)); } private: @@ -139,7 +140,7 @@ class TestableRemoteDeviceLifeCycleImpl : public RemoteDeviceLifeCycleImpl { scoped_ptr<FakeConnectionFinder> scoped_connection_finder( new FakeConnectionFinder(remote_device_)); connection_finder_ = scoped_connection_finder.get(); - return scoped_connection_finder.Pass(); + return std::move(scoped_connection_finder); } scoped_ptr<Authenticator> CreateAuthenticator() override { @@ -147,7 +148,7 @@ class TestableRemoteDeviceLifeCycleImpl : public RemoteDeviceLifeCycleImpl { scoped_ptr<FakeAuthenticator> scoped_authenticator( new FakeAuthenticator(connection_finder_->connection())); authenticator_ = scoped_authenticator.get(); - return scoped_authenticator.Pass(); + return std::move(scoped_authenticator); } const RemoteDevice remote_device_; diff --git a/components/proximity_auth/remote_device_loader.cc b/components/proximity_auth/remote_device_loader.cc index 9d47f64..59af64d 100644 --- a/components/proximity_auth/remote_device_loader.cc +++ b/components/proximity_auth/remote_device_loader.cc @@ -4,6 +4,8 @@ #include "components/proximity_auth/remote_device_loader.h" +#include <utility> + #include "base/base64url.h" #include "base/bind.h" #include "components/proximity_auth/cryptauth/secure_message_delegate.h" @@ -21,7 +23,7 @@ RemoteDeviceLoader::RemoteDeviceLoader( : remaining_unlock_keys_(unlock_keys), user_id_(user_id), user_private_key_(user_private_key), - secure_message_delegate_(secure_message_delegate.Pass()), + secure_message_delegate_(std::move(secure_message_delegate)), pref_manager_(pref_manager), weak_ptr_factory_(this) {} diff --git a/components/proximity_auth/remote_device_loader_unittest.cc b/components/proximity_auth/remote_device_loader_unittest.cc index bfc5e14..d1bf802 100644 --- a/components/proximity_auth/remote_device_loader_unittest.cc +++ b/components/proximity_auth/remote_device_loader_unittest.cc @@ -5,6 +5,7 @@ #include "components/proximity_auth/remote_device_loader.h" #include <stddef.h> +#include <utility> #include "base/bind.h" #include "base/macros.h" @@ -86,7 +87,7 @@ class ProximityAuthRemoteDeviceLoaderTest : public testing::Test { TEST_F(ProximityAuthRemoteDeviceLoaderTest, LoadZeroDevices) { std::vector<cryptauth::ExternalDeviceInfo> unlock_keys; RemoteDeviceLoader loader(unlock_keys, user_private_key_, kUserId, - secure_message_delegate_.Pass(), + std::move(secure_message_delegate_), pref_manager_.get()); std::vector<RemoteDevice> result; @@ -102,7 +103,7 @@ TEST_F(ProximityAuthRemoteDeviceLoaderTest, LoadOneClassicRemoteDevice) { std::vector<cryptauth::ExternalDeviceInfo> unlock_keys(1, CreateUnlockKey("1")); RemoteDeviceLoader loader(unlock_keys, user_private_key_, kUserId, - secure_message_delegate_.Pass(), + std::move(secure_message_delegate_), pref_manager_.get()); std::vector<RemoteDevice> result; @@ -125,7 +126,7 @@ TEST_F(ProximityAuthRemoteDeviceLoaderTest, LoadOneBLERemoteDevice) { CreateUnlockKey("1")); unlock_keys[0].set_bluetooth_address(std::string()); RemoteDeviceLoader loader(unlock_keys, user_private_key_, kUserId, - secure_message_delegate_.Pass(), + std::move(secure_message_delegate_), pref_manager_.get()); std::string ble_address = "00:00:00:00:00:00"; @@ -152,7 +153,7 @@ TEST_F(ProximityAuthRemoteDeviceLoaderTest, LoadThreeRemoteDevice) { unlock_keys.push_back(CreateUnlockKey("2")); unlock_keys.push_back(CreateUnlockKey("3")); RemoteDeviceLoader loader(unlock_keys, user_private_key_, kUserId, - secure_message_delegate_.Pass(), + std::move(secure_message_delegate_), pref_manager_.get()); std::vector<RemoteDevice> result; diff --git a/components/proximity_auth/remote_status_update.cc b/components/proximity_auth/remote_status_update.cc index d4fbc50..4d59350 100644 --- a/components/proximity_auth/remote_status_update.cc +++ b/components/proximity_auth/remote_status_update.cc @@ -93,7 +93,7 @@ scoped_ptr<RemoteStatusUpdate> RemoteStatusUpdate::Deserialize( return scoped_ptr<RemoteStatusUpdate>(); } - return parsed_update.Pass(); + return parsed_update; } } // namespace proximity_auth diff --git a/components/proximity_auth/screenlock_bridge.cc b/components/proximity_auth/screenlock_bridge.cc index 8a6b21b..e95a0a7 100644 --- a/components/proximity_auth/screenlock_bridge.cc +++ b/components/proximity_auth/screenlock_bridge.cc @@ -83,7 +83,7 @@ ScreenlockBridge::UserPodCustomIconOptions::ToDictionaryValue() const { if (is_trial_run_) result->SetBoolean("isTrialRun", true); - return result.Pass(); + return result; } void ScreenlockBridge::UserPodCustomIconOptions::SetIcon( diff --git a/components/proximity_auth/throttled_bluetooth_connection_finder.cc b/components/proximity_auth/throttled_bluetooth_connection_finder.cc index 252a47f..8218a2b 100644 --- a/components/proximity_auth/throttled_bluetooth_connection_finder.cc +++ b/components/proximity_auth/throttled_bluetooth_connection_finder.cc @@ -4,6 +4,8 @@ #include "components/proximity_auth/throttled_bluetooth_connection_finder.h" +#include <utility> + #include "base/bind.h" #include "base/location.h" #include "base/task_runner.h" @@ -17,11 +19,10 @@ ThrottledBluetoothConnectionFinder::ThrottledBluetoothConnectionFinder( scoped_ptr<BluetoothConnectionFinder> connection_finder, scoped_refptr<base::TaskRunner> task_runner, BluetoothThrottler* throttler) - : connection_finder_(connection_finder.Pass()), + : connection_finder_(std::move(connection_finder)), task_runner_(task_runner), throttler_(throttler), - weak_ptr_factory_(this) { -} + weak_ptr_factory_(this) {} ThrottledBluetoothConnectionFinder::~ThrottledBluetoothConnectionFinder() { } @@ -49,7 +50,7 @@ void ThrottledBluetoothConnectionFinder::OnConnection( const ConnectionCallback& connection_callback, scoped_ptr<Connection> connection) { throttler_->OnConnection(connection.get()); - connection_callback.Run(connection.Pass()); + connection_callback.Run(std::move(connection)); } } // namespace proximity_auth diff --git a/components/proximity_auth/throttled_bluetooth_connection_finder_unittest.cc b/components/proximity_auth/throttled_bluetooth_connection_finder_unittest.cc index 3cc6c5d..e979090 100644 --- a/components/proximity_auth/throttled_bluetooth_connection_finder_unittest.cc +++ b/components/proximity_auth/throttled_bluetooth_connection_finder_unittest.cc @@ -4,6 +4,8 @@ #include "components/proximity_auth/throttled_bluetooth_connection_finder.h" +#include <utility> + #include "base/bind.h" #include "base/macros.h" #include "base/test/test_simple_task_runner.h" @@ -30,7 +32,7 @@ const char kUuid[] = "DEADBEEF-CAFE-FEED-FOOD-D15EA5EBEEF"; // A callback that stores a found |connection| into |out|. void SaveConnection(scoped_ptr<Connection>* out, scoped_ptr<Connection> connection) { - *out = connection.Pass(); + *out = std::move(connection); } class MockBluetoothThrottler : public BluetoothThrottler { diff --git a/components/proximity_auth/unlock_manager_unittest.cc b/components/proximity_auth/unlock_manager_unittest.cc index b72900d..9f05d0c 100644 --- a/components/proximity_auth/unlock_manager_unittest.cc +++ b/components/proximity_auth/unlock_manager_unittest.cc @@ -4,6 +4,8 @@ #include "components/proximity_auth/unlock_manager.h" +#include <utility> + #include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" @@ -162,7 +164,7 @@ class TestUnlockManager : public UnlockManager { scoped_ptr<MockProximityMonitor> proximity_monitor( new NiceMock<MockProximityMonitor>()); proximity_monitor_ = proximity_monitor.get(); - return proximity_monitor.Pass(); + return std::move(proximity_monitor); } // Owned by the super class. diff --git a/components/proximity_auth/webui/proximity_auth_webui_handler.cc b/components/proximity_auth/webui/proximity_auth_webui_handler.cc index 929a1c7..5ef9f17 100644 --- a/components/proximity_auth/webui/proximity_auth_webui_handler.cc +++ b/components/proximity_auth/webui/proximity_auth_webui_handler.cc @@ -5,6 +5,7 @@ #include "components/proximity_auth/webui/proximity_auth_webui_handler.h" #include <algorithm> +#include <utility> #include "base/base64url.h" #include "base/bind.h" @@ -61,7 +62,7 @@ scoped_ptr<base::DictionaryValue> LogMessageToDictionary( dictionary->SetInteger(kLogMessageLineKey, log_message.line); dictionary->SetInteger(kLogMessageSeverityKey, static_cast<int>(log_message.severity)); - return dictionary.Pass(); + return dictionary; } // Keys in the JSON representation of an ExternalDeviceInfo proto. @@ -535,7 +536,7 @@ ProximityAuthWebUIHandler::ExternalDeviceInfoToDictionary( last_remote_status_update_->secure_screen_lock_state); status_dictionary->SetInteger( "trustAgent", last_remote_status_update_->trust_agent_state); - dictionary->Set(kExternalDeviceRemoteState, status_dictionary.Pass()); + dictionary->Set(kExternalDeviceRemoteState, std::move(status_dictionary)); } return dictionary; @@ -552,7 +553,7 @@ ProximityAuthWebUIHandler::IneligibleDeviceToDictionary( scoped_ptr<base::DictionaryValue> device_dictionary = ExternalDeviceInfoToDictionary(ineligible_device.device()); device_dictionary->Set(kIneligibleDeviceReasons, - ineligibility_reasons.Pass()); + std::move(ineligibility_reasons)); return device_dictionary; } diff --git a/components/rappor/log_uploader.cc b/components/rappor/log_uploader.cc index 3e594a0..247ddc1 100644 --- a/components/rappor/log_uploader.cc +++ b/components/rappor/log_uploader.cc @@ -6,6 +6,7 @@ #include <stddef.h> #include <stdint.h> +#include <utility> #include "base/metrics/histogram_macros.h" #include "base/metrics/sparse_histogram.h" @@ -142,7 +143,7 @@ void LogUploader::OnURLFetchComplete(const net::URLFetcher* source) { // Note however that |source| is aliased to the fetcher, so we should be // careful not to delete it too early. DCHECK_EQ(current_fetch_.get(), source); - scoped_ptr<net::URLFetcher> fetch(current_fetch_.Pass()); + scoped_ptr<net::URLFetcher> fetch(std::move(current_fetch_)); const net::URLRequestStatus& request_status = source->GetStatus(); diff --git a/components/rappor/rappor_service.cc b/components/rappor/rappor_service.cc index 0d2c423..02853af 100644 --- a/components/rappor/rappor_service.cc +++ b/components/rappor/rappor_service.cc @@ -4,6 +4,8 @@ #include "components/rappor/rappor_service.h" +#include <utility> + #include "base/metrics/field_trial.h" #include "base/metrics/metrics_hashes.h" #include "base/stl_util.h" @@ -67,7 +69,7 @@ RapporService::~RapporService() { void RapporService::AddDailyObserver( scoped_ptr<metrics::DailyEvent::Observer> observer) { - daily_event_.AddObserver(observer.Pass()); + daily_event_.AddObserver(std::move(observer)); } void RapporService::Initialize(net::URLRequestContextGetter* request_context) { @@ -260,7 +262,7 @@ void RapporService::RecordSampleObj(const std::string& metric_name, if (!RecordingAllowed(sample->parameters())) return; DVLOG(1) << "Recording sample of metric \"" << metric_name << "\""; - sampler_.AddSample(metric_name, sample.Pass()); + sampler_.AddSample(metric_name, std::move(sample)); } } // namespace rappor diff --git a/components/rappor/rappor_service_unittest.cc b/components/rappor/rappor_service_unittest.cc index 75f0605..b475dbc 100644 --- a/components/rappor/rappor_service_unittest.cc +++ b/components/rappor/rappor_service_unittest.cc @@ -6,6 +6,7 @@ #include <stddef.h> #include <stdint.h> +#include <utility> #include "base/base64.h" #include "base/metrics/metrics_hashes.h" @@ -124,7 +125,7 @@ TEST(RapporServiceTest, RecordSample) { rappor_service.CreateSample(SAFEBROWSING_RAPPOR_TYPE); sample->SetStringField("Url", "example.com"); sample->SetFlagsField("Flags1", 0xbcd, 12); - rappor_service.RecordSampleObj("ObjMetric", sample.Pass()); + rappor_service.RecordSampleObj("ObjMetric", std::move(sample)); uint64_t url_hash = base::HashMetricName("ObjMetric.Url"); uint64_t flags_hash = base::HashMetricName("ObjMetric.Flags1"); RapporReports reports; diff --git a/components/rappor/sampler.cc b/components/rappor/sampler.cc index 5d3e8e3..9ad0da9 100644 --- a/components/rappor/sampler.cc +++ b/components/rappor/sampler.cc @@ -6,6 +6,7 @@ #include <map> #include <string> +#include <utility> #include "base/rand_util.h" @@ -23,7 +24,7 @@ void Sampler::AddSample(const std::string& metric_name, // Replace the previous sample with a 1 in sample_count_ chance so that each // sample has equal probability of being reported. if (base::RandGenerator(sample_counts_[metric_name]) == 0) - samples_.set(metric_name, sample.Pass()); + samples_.set(metric_name, std::move(sample)); } void Sampler::ExportMetrics(const std::string& secret, RapporReports* reports) { diff --git a/components/rappor/sampler_unittest.cc b/components/rappor/sampler_unittest.cc index 122abc2..210576d 100644 --- a/components/rappor/sampler_unittest.cc +++ b/components/rappor/sampler_unittest.cc @@ -4,6 +4,8 @@ #include "components/rappor/sampler.h" +#include <utility> + #include "components/rappor/byte_vector_utils.h" #include "components/rappor/proto/rappor_metric.pb.h" #include "testing/gtest/include/gtest/gtest.h" @@ -35,11 +37,11 @@ TEST(RapporSamplerTest, TestExport) { scoped_ptr<Sample> sample1 = TestSamplerFactory::CreateSample(); sample1->SetStringField("Foo", "Junk"); - sampler.AddSample("Metric1", sample1.Pass()); + sampler.AddSample("Metric1", std::move(sample1)); scoped_ptr<Sample> sample2 = TestSamplerFactory::CreateSample(); sample2->SetStringField("Foo", "Junk2"); - sampler.AddSample("Metric1", sample2.Pass()); + sampler.AddSample("Metric1", std::move(sample2)); // Since the two samples were for one metric, we should randomly get one // of the two. diff --git a/components/rappor/test_rappor_service.cc b/components/rappor/test_rappor_service.cc index 3056738..fb24202 100644 --- a/components/rappor/test_rappor_service.cc +++ b/components/rappor/test_rappor_service.cc @@ -4,6 +4,8 @@ #include "components/rappor/test_rappor_service.h" +#include <utility> + #include "base/logging.h" #include "components/rappor/byte_vector_utils.h" #include "components/rappor/proto/rappor_metric.pb.h" @@ -65,7 +67,7 @@ TestRapporService::~TestRapporService() {} scoped_ptr<Sample> TestRapporService::CreateSample(RapporType type) { scoped_ptr<TestSample> test_sample(new TestSample(type)); - return test_sample.Pass(); + return std::move(test_sample); } // Intercepts the sample being recorded and saves it in a test structure. @@ -77,7 +79,7 @@ void TestRapporService::RecordSampleObj(const std::string& metric_name, shadows_.insert(std::pair<std::string, TestSample::Shadow>( metric_name, test_sample->GetShadow())); // Original version is still called. - RapporService::RecordSampleObj(metric_name, sample.Pass()); + RapporService::RecordSampleObj(metric_name, std::move(sample)); } void TestRapporService::RecordSample(const std::string& metric_name, diff --git a/components/renderer_context_menu/render_view_context_menu_base.h b/components/renderer_context_menu/render_view_context_menu_base.h index 52a4dff..1b0d839 100644 --- a/components/renderer_context_menu/render_view_context_menu_base.h +++ b/components/renderer_context_menu/render_view_context_menu_base.h @@ -6,9 +6,9 @@ #define COMPONENTS_RENDERER_CONTEXT_MENU_RENDER_VIEW_CONTEXT_MENU_BASE_H_ #include <stddef.h> - #include <map> #include <string> +#include <utility> #include "base/macros.h" #include "base/memory/scoped_ptr.h" @@ -121,7 +121,7 @@ class RenderViewContextMenuBase : public ui::SimpleMenuModel::Delegate, } void set_toolkit_delegate(scoped_ptr<ToolkitDelegate> delegate) { - toolkit_delegate_ = delegate.Pass(); + toolkit_delegate_ = std::move(delegate); } ToolkitDelegate* toolkit_delegate() { diff --git a/components/resource_provider/public/cpp/resource_loader.cc b/components/resource_provider/public/cpp/resource_loader.cc index 0b1ea3b..47f7db1 100644 --- a/components/resource_provider/public/cpp/resource_loader.cc +++ b/components/resource_provider/public/cpp/resource_loader.cc @@ -5,6 +5,7 @@ #include "components/resource_provider/public/cpp/resource_loader.h" #include <stddef.h> +#include <utility> #include "base/bind.h" #include "base/files/file.h" @@ -22,7 +23,7 @@ base::File GetFileFromHandle(mojo::ScopedHandle handle) { MojoPlatformHandle platform_handle; CHECK(MojoExtractPlatformHandle(handle.release().value(), &platform_handle) == MOJO_RESULT_OK); - return base::File(platform_handle).Pass(); + return base::File(platform_handle); } } @@ -51,9 +52,9 @@ bool ResourceLoader::BlockUntilLoaded() { base::File ResourceLoader::ReleaseFile(const std::string& path) { CHECK(resource_map_.count(path)); - scoped_ptr<base::File> file_wrapper(resource_map_[path].Pass()); + scoped_ptr<base::File> file_wrapper(std::move(resource_map_[path])); resource_map_.erase(path); - return file_wrapper->Pass(); + return std::move(*file_wrapper); } void ResourceLoader::OnGotResources(const std::vector<std::string>& paths, @@ -63,7 +64,7 @@ void ResourceLoader::OnGotResources(const std::vector<std::string>& paths, CHECK_EQ(resources.size(), paths.size()); for (size_t i = 0; i < resources.size(); ++i) { resource_map_[paths[i]].reset( - new base::File(GetFileFromHandle(resources[i].Pass()))); + new base::File(GetFileFromHandle(std::move(resources[i])))); } loaded_ = true; } diff --git a/components/resource_provider/resource_provider_app.cc b/components/resource_provider/resource_provider_app.cc index 60d230f..56506e1 100644 --- a/components/resource_provider/resource_provider_app.cc +++ b/components/resource_provider/resource_provider_app.cc @@ -4,6 +4,8 @@ #include "components/resource_provider/resource_provider_app.h" +#include <utility> + #include "components/resource_provider/file_utils.h" #include "components/resource_provider/resource_provider_impl.h" #include "mojo/application/public/cpp/application_connection.h" @@ -44,7 +46,7 @@ void ResourceProviderApp::Create( CHECK(!app_path.empty()); bindings_.AddBinding( new ResourceProviderImpl(app_path, resource_provider_app_url_), - request.Pass()); + std::move(request)); } } // namespace resource_provider diff --git a/components/resource_provider/resource_provider_impl.cc b/components/resource_provider/resource_provider_impl.cc index 8b0168a59..9331703 100644 --- a/components/resource_provider/resource_provider_impl.cc +++ b/components/resource_provider/resource_provider_impl.cc @@ -5,6 +5,7 @@ #include "components/resource_provider/resource_provider_impl.h" #include <stddef.h> +#include <utility> #include "base/bind.h" #include "base/files/file_util.h" @@ -39,7 +40,7 @@ ScopedHandle GetHandleForPath(const base::FilePath& path) { return ScopedHandle(); } - return ScopedHandle(mojo::Handle(mojo_handle)).Pass(); + return ScopedHandle(mojo::Handle(mojo_handle)); } } // namespace @@ -65,7 +66,7 @@ void ResourceProviderImpl::GetResources(mojo::Array<mojo::String> paths, GetPathForResourceNamed(application_path_, paths[i])); } } - callback.Run(handles.Pass()); + callback.Run(std::move(handles)); } } // namespace resource_provider diff --git a/components/safe_browsing_db/prefix_set.cc b/components/safe_browsing_db/prefix_set.cc index 7e63a9e..ede9223 100644 --- a/components/safe_browsing_db/prefix_set.cc +++ b/components/safe_browsing_db/prefix_set.cc @@ -7,6 +7,7 @@ #include <limits.h> #include <algorithm> +#include <utility> #include "base/files/file_util.h" #include "base/files/scoped_file.h" @@ -392,11 +393,11 @@ scoped_ptr<const PrefixSet> PrefixSetBuilder::GetPrefixSet( std::sort(prefix_set_->full_hashes_.begin(), prefix_set_->full_hashes_.end(), SBFullHashLess); - return prefix_set_.Pass(); + return std::move(prefix_set_); } scoped_ptr<const PrefixSet> PrefixSetBuilder::GetPrefixSetNoHashes() { - return GetPrefixSet(std::vector<SBFullHash>()).Pass(); + return GetPrefixSet(std::vector<SBFullHash>()); } void PrefixSetBuilder::EmitRun() { diff --git a/components/safe_json/safe_json_parser_impl.cc b/components/safe_json/safe_json_parser_impl.cc index af79e94..63cabaf 100644 --- a/components/safe_json/safe_json_parser_impl.cc +++ b/components/safe_json/safe_json_parser_impl.cc @@ -4,6 +4,8 @@ #include "components/safe_json/safe_json_parser_impl.h" +#include <utility> + #include "base/sequenced_task_runner.h" #include "base/strings/utf_string_conversions.h" #include "base/thread_task_runner_handle.h" @@ -68,7 +70,7 @@ void SafeJsonParserImpl::ReportResultsOnOriginThread() { DCHECK(caller_task_runner_->RunsTasksOnCurrentThread()); if (error_.empty() && parsed_json_) { if (!success_callback_.is_null()) - success_callback_.Run(parsed_json_.Pass()); + success_callback_.Run(std::move(parsed_json_)); } else { if (!error_callback_.is_null()) error_callback_.Run(error_); diff --git a/components/safe_json/safe_json_parser_message_filter.cc b/components/safe_json/safe_json_parser_message_filter.cc index 8a377e7..955e0b7 100644 --- a/components/safe_json/safe_json_parser_message_filter.cc +++ b/components/safe_json/safe_json_parser_message_filter.cc @@ -4,6 +4,8 @@ #include "components/safe_json/safe_json_parser_message_filter.h" +#include <utility> + #include "base/json/json_reader.h" #include "base/values.h" #include "components/safe_json/safe_json_parser_messages.h" @@ -43,7 +45,7 @@ void SafeJsonParserMessageFilter::OnParseJSON(const std::string& json) { json, base::JSON_PARSE_RFC, &error_code, &error); if (value) { base::ListValue wrapper; - wrapper.Append(value.Pass()); + wrapper.Append(std::move(value)); Send(new SafeJsonParserHostMsg_ParseJSON_Succeeded(wrapper)); } else { Send(new SafeJsonParserHostMsg_ParseJSON_Failed(error)); diff --git a/components/scheduler/base/task_queue_manager_delegate_for_test.cc b/components/scheduler/base/task_queue_manager_delegate_for_test.cc index fe3d0e5c..efa8770 100644 --- a/components/scheduler/base/task_queue_manager_delegate_for_test.cc +++ b/components/scheduler/base/task_queue_manager_delegate_for_test.cc @@ -4,6 +4,8 @@ #include "components/scheduler/base/task_queue_manager_delegate_for_test.h" +#include <utility> + #include "base/bind.h" #include "base/bind_helpers.h" @@ -15,13 +17,13 @@ TaskQueueManagerDelegateForTest::Create( scoped_refptr<base::SingleThreadTaskRunner> task_runner, scoped_ptr<base::TickClock> time_source) { return make_scoped_refptr( - new TaskQueueManagerDelegateForTest(task_runner, time_source.Pass())); + new TaskQueueManagerDelegateForTest(task_runner, std::move(time_source))); } TaskQueueManagerDelegateForTest::TaskQueueManagerDelegateForTest( scoped_refptr<base::SingleThreadTaskRunner> task_runner, scoped_ptr<base::TickClock> time_source) - : task_runner_(task_runner), time_source_(time_source.Pass()) {} + : task_runner_(task_runner), time_source_(std::move(time_source)) {} TaskQueueManagerDelegateForTest::~TaskQueueManagerDelegateForTest() {} diff --git a/components/scheduler/base/task_queue_manager_unittest.cc b/components/scheduler/base/task_queue_manager_unittest.cc index 21cc6f1..c32c43e 100644 --- a/components/scheduler/base/task_queue_manager_unittest.cc +++ b/components/scheduler/base/task_queue_manager_unittest.cc @@ -5,6 +5,7 @@ #include "components/scheduler/base/task_queue_manager.h" #include <stddef.h> +#include <utility> #include "base/location.h" #include "base/run_loop.h" @@ -34,7 +35,7 @@ class MessageLoopTaskRunner : public TaskQueueManagerDelegateForTest { public: static scoped_refptr<MessageLoopTaskRunner> Create( scoped_ptr<base::TickClock> tick_clock) { - return make_scoped_refptr(new MessageLoopTaskRunner(tick_clock.Pass())); + return make_scoped_refptr(new MessageLoopTaskRunner(std::move(tick_clock))); } // NestableTaskRunner implementation. @@ -46,7 +47,7 @@ class MessageLoopTaskRunner : public TaskQueueManagerDelegateForTest { explicit MessageLoopTaskRunner(scoped_ptr<base::TickClock> tick_clock) : TaskQueueManagerDelegateForTest(base::MessageLoop::current() ->task_runner(), - tick_clock.Pass()) {} + std::move(tick_clock)) {} ~MessageLoopTaskRunner() override {} }; diff --git a/components/scheduler/child/idle_helper_unittest.cc b/components/scheduler/child/idle_helper_unittest.cc index 2269a07..03b0447 100644 --- a/components/scheduler/child/idle_helper_unittest.cc +++ b/components/scheduler/child/idle_helper_unittest.cc @@ -4,6 +4,8 @@ #include "components/scheduler/child/idle_helper.h" +#include <utility> + #include "base/callback.h" #include "base/macros.h" #include "base/test/simple_test_tick_clock.h" @@ -134,10 +136,10 @@ scoped_refptr<SchedulerTqmDelegate> CreateTaskRunnerDelegate( scoped_ptr<TestTimeSource> test_time_source) { if (message_loop) return SchedulerTqmDelegateImpl::Create(message_loop, - test_time_source.Pass()); + std::move(test_time_source)); return SchedulerTqmDelegateForTest::Create(mock_task_runner, - test_time_source.Pass()); + std::move(test_time_source)); } }; // namespace diff --git a/components/scheduler/child/scheduler_tqm_delegate_for_test.cc b/components/scheduler/child/scheduler_tqm_delegate_for_test.cc index 10e910f..857bb3e 100644 --- a/components/scheduler/child/scheduler_tqm_delegate_for_test.cc +++ b/components/scheduler/child/scheduler_tqm_delegate_for_test.cc @@ -4,6 +4,8 @@ #include "components/scheduler/child/scheduler_tqm_delegate_for_test.h" +#include <utility> + #include "base/bind.h" #include "base/bind_helpers.h" #include "components/scheduler/base/task_queue_manager_delegate_for_test.h" @@ -15,7 +17,7 @@ scoped_refptr<SchedulerTqmDelegateForTest> SchedulerTqmDelegateForTest::Create( scoped_refptr<base::SingleThreadTaskRunner> task_runner, scoped_ptr<base::TickClock> time_source) { return make_scoped_refptr( - new SchedulerTqmDelegateForTest(task_runner, time_source.Pass())); + new SchedulerTqmDelegateForTest(task_runner, std::move(time_source))); } SchedulerTqmDelegateForTest::SchedulerTqmDelegateForTest( @@ -23,7 +25,7 @@ SchedulerTqmDelegateForTest::SchedulerTqmDelegateForTest( scoped_ptr<base::TickClock> time_source) : task_runner_( TaskQueueManagerDelegateForTest::Create(task_runner, - time_source.Pass())) {} + std::move(time_source))) {} SchedulerTqmDelegateForTest::~SchedulerTqmDelegateForTest() {} diff --git a/components/scheduler/child/scheduler_tqm_delegate_impl.cc b/components/scheduler/child/scheduler_tqm_delegate_impl.cc index dbf2c42..7f0e073 100644 --- a/components/scheduler/child/scheduler_tqm_delegate_impl.cc +++ b/components/scheduler/child/scheduler_tqm_delegate_impl.cc @@ -4,6 +4,8 @@ #include "components/scheduler/child/scheduler_tqm_delegate_impl.h" +#include <utility> + namespace scheduler { // static @@ -11,7 +13,7 @@ scoped_refptr<SchedulerTqmDelegateImpl> SchedulerTqmDelegateImpl::Create( base::MessageLoop* message_loop, scoped_ptr<base::TickClock> time_source) { return make_scoped_refptr( - new SchedulerTqmDelegateImpl(message_loop, time_source.Pass())); + new SchedulerTqmDelegateImpl(message_loop, std::move(time_source))); } SchedulerTqmDelegateImpl::SchedulerTqmDelegateImpl( @@ -19,7 +21,7 @@ SchedulerTqmDelegateImpl::SchedulerTqmDelegateImpl( scoped_ptr<base::TickClock> time_source) : message_loop_(message_loop), message_loop_task_runner_(message_loop->task_runner()), - time_source_(time_source.Pass()) {} + time_source_(std::move(time_source)) {} SchedulerTqmDelegateImpl::~SchedulerTqmDelegateImpl() { RestoreDefaultTaskRunner(); diff --git a/components/scheduler/renderer/renderer_scheduler_impl.cc b/components/scheduler/renderer/renderer_scheduler_impl.cc index 51d56e5..8271b1a 100644 --- a/components/scheduler/renderer/renderer_scheduler_impl.cc +++ b/components/scheduler/renderer/renderer_scheduler_impl.cc @@ -151,7 +151,7 @@ void RendererSchedulerImpl::Shutdown() { } scoped_ptr<blink::WebThread> RendererSchedulerImpl::CreateMainThread() { - return make_scoped_ptr(new WebThreadImplForRendererScheduler(this)).Pass(); + return make_scoped_ptr(new WebThreadImplForRendererScheduler(this)); } scoped_refptr<TaskQueue> RendererSchedulerImpl::DefaultTaskRunner() { diff --git a/components/scheduler/renderer/renderer_scheduler_impl_unittest.cc b/components/scheduler/renderer/renderer_scheduler_impl_unittest.cc index d11fcf9..ad7b47a 100644 --- a/components/scheduler/renderer/renderer_scheduler_impl_unittest.cc +++ b/components/scheduler/renderer/renderer_scheduler_impl_unittest.cc @@ -4,6 +4,8 @@ #include "components/scheduler/renderer/renderer_scheduler_impl.h" +#include <utility> + #include "base/callback.h" #include "base/macros.h" #include "base/test/simple_test_tick_clock.h" @@ -251,7 +253,7 @@ class RendererSchedulerImplTest : public testing::Test { } void Initialize(scoped_ptr<RendererSchedulerImplForTest> scheduler) { - scheduler_ = scheduler.Pass(); + scheduler_ = std::move(scheduler); default_task_runner_ = scheduler_->DefaultTaskRunner(); compositor_task_runner_ = scheduler_->CompositorTaskRunner(); loading_task_runner_ = scheduler_->LoadingTaskRunner(); diff --git a/components/scheduler/renderer/web_view_scheduler_impl.cc b/components/scheduler/renderer/web_view_scheduler_impl.cc index 781158a..1622981 100644 --- a/components/scheduler/renderer/web_view_scheduler_impl.cc +++ b/components/scheduler/renderer/web_view_scheduler_impl.cc @@ -49,7 +49,7 @@ WebViewSchedulerImpl::createWebFrameSchedulerImpl() { new WebFrameSchedulerImpl(renderer_scheduler_, this)); frame_scheduler->SetPageInBackground(page_in_background_); frame_schedulers_.insert(frame_scheduler.get()); - return frame_scheduler.Pass(); + return frame_scheduler; } blink::WebPassOwnPtr<blink::WebFrameScheduler> diff --git a/components/search_engines/default_search_manager.cc b/components/search_engines/default_search_manager.cc index 8a96d8d..15b0083 100644 --- a/components/search_engines/default_search_manager.cc +++ b/components/search_engines/default_search_manager.cc @@ -110,7 +110,8 @@ void DefaultSearchManager::RegisterProfilePrefs( void DefaultSearchManager::AddPrefValueToMap( scoped_ptr<base::DictionaryValue> value, PrefValueMap* pref_value_map) { - pref_value_map->SetValue(kDefaultSearchProviderDataPrefName, value.Pass()); + pref_value_map->SetValue(kDefaultSearchProviderDataPrefName, + std::move(value)); } // static @@ -406,7 +407,7 @@ void DefaultSearchManager::LoadDefaultSearchEngineFromPrefs() { void DefaultSearchManager::LoadPrepopulatedDefaultSearch() { scoped_ptr<TemplateURLData> data = TemplateURLPrepopulateData::GetPrepopulatedDefaultSearch(pref_service_); - fallback_default_search_ = data.Pass(); + fallback_default_search_ = std::move(data); MergePrefsDataWithPrepopulated(); } diff --git a/components/search_engines/default_search_manager_unittest.cc b/components/search_engines/default_search_manager_unittest.cc index 25fe02c..11b4eab 100644 --- a/components/search_engines/default_search_manager_unittest.cc +++ b/components/search_engines/default_search_manager_unittest.cc @@ -137,7 +137,7 @@ scoped_ptr<TemplateURLData> GenerateDummyTemplateURLData( "UTF-8;UTF-16", ";", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); data->date_created = base::Time(); data->last_modified = base::Time(); - return data.Pass(); + return data; } } // namespace diff --git a/components/search_engines/default_search_policy_handler.cc b/components/search_engines/default_search_policy_handler.cc index 6e6172d..e0362e9 100644 --- a/components/search_engines/default_search_policy_handler.cc +++ b/components/search_engines/default_search_policy_handler.cc @@ -5,6 +5,7 @@ #include "components/search_engines/default_search_policy_handler.h" #include <stddef.h> +#include <utility> #include "base/macros.h" #include "base/prefs/pref_value_map.h" @@ -233,7 +234,7 @@ void DefaultSearchPolicyHandler::ApplyPolicySettings(const PolicyMap& policies, if (DefaultSearchProviderIsDisabled(policies)) { scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue); dict->SetBoolean(DefaultSearchManager::kDisabledByPolicy, true); - DefaultSearchManager::AddPrefValueToMap(dict.Pass(), prefs); + DefaultSearchManager::AddPrefValueToMap(std::move(dict), prefs); return; } @@ -297,7 +298,7 @@ void DefaultSearchPolicyHandler::ApplyPolicySettings(const PolicyMap& policies, if (keyword.empty()) dict->SetString(DefaultSearchManager::kKeyword, host); - DefaultSearchManager::AddPrefValueToMap(dict.Pass(), prefs); + DefaultSearchManager::AddPrefValueToMap(std::move(dict), prefs); } bool DefaultSearchPolicyHandler::CheckIndividualPolicies( diff --git a/components/search_engines/default_search_pref_migration.cc b/components/search_engines/default_search_pref_migration.cc index bf1835a..c85db9b 100644 --- a/components/search_engines/default_search_pref_migration.cc +++ b/components/search_engines/default_search_pref_migration.cc @@ -98,7 +98,7 @@ scoped_ptr<TemplateURLData> LoadDefaultSearchProviderFromLegacyPrefs( default_provider_data->prepopulate_id = value; } - return default_provider_data.Pass(); + return default_provider_data; } void ClearDefaultSearchProviderFromLegacyPrefs(PrefService* prefs) { diff --git a/components/search_engines/default_search_pref_migration_unittest.cc b/components/search_engines/default_search_pref_migration_unittest.cc index d2d1510..90b8101 100644 --- a/components/search_engines/default_search_pref_migration_unittest.cc +++ b/components/search_engines/default_search_pref_migration_unittest.cc @@ -136,7 +136,7 @@ scoped_ptr<TemplateURL> DefaultSearchPrefMigrationTest::CreateKeyword( data.SetKeyword(base::ASCIIToUTF16(keyword)); data.SetURL(url); scoped_ptr<TemplateURL> t_url(new TemplateURL(data)); - return t_url.Pass(); + return t_url; } TEST_F(DefaultSearchPrefMigrationTest, MigrateUserSelectedValue) { diff --git a/components/search_engines/default_search_pref_test_util.cc b/components/search_engines/default_search_pref_test_util.cc index 22acd42..aa80db9 100644 --- a/components/search_engines/default_search_pref_test_util.cc +++ b/components/search_engines/default_search_pref_test_util.cc @@ -23,7 +23,7 @@ DefaultSearchPrefTestUtil::CreateDefaultSearchPreferenceValue( scoped_ptr<base::DictionaryValue> value(new base::DictionaryValue); if (!enabled) { value->SetBoolean(DefaultSearchManager::kDisabledByPolicy, true); - return value.Pass(); + return value; } EXPECT_FALSE(keyword.empty()); @@ -52,5 +52,5 @@ DefaultSearchPrefTestUtil::CreateDefaultSearchPreferenceValue( alternate_url_list->Append(new base::StringValue(alternate_url)); value->Set(DefaultSearchManager::kAlternateURLs, alternate_url_list.release()); - return value.Pass(); + return value; } diff --git a/components/search_engines/keyword_web_data_service.cc b/components/search_engines/keyword_web_data_service.cc index e6448d2..1d6f00f 100644 --- a/components/search_engines/keyword_web_data_service.cc +++ b/components/search_engines/keyword_web_data_service.cc @@ -132,7 +132,7 @@ scoped_ptr<WDTypedResult> KeywordWebDataService::GetKeywordsImpl( KeywordTable::FromWebDatabase(db)->GetBuiltinKeywordVersion(); result_ptr.reset(new WDResult<WDKeywordsResult>(KEYWORDS_RESULT, result)); } - return result_ptr.Pass(); + return result_ptr; } WebDatabase::State KeywordWebDataService::SetDefaultSearchProviderIDImpl( diff --git a/components/search_engines/template_url.h b/components/search_engines/template_url.h index 1c377af6..c07f428 100644 --- a/components/search_engines/template_url.h +++ b/components/search_engines/template_url.h @@ -619,7 +619,7 @@ class TemplateURL { // This setter shouldn't be used except by TemplateURLService and // TemplateURLServiceClient implementations. void set_extension_info(scoped_ptr<AssociatedExtensionInfo> extension_info) { - extension_info_ = extension_info.Pass(); + extension_info_ = std::move(extension_info); } // Returns true if |url| supports replacement. diff --git a/components/search_engines/template_url_fetcher.cc b/components/search_engines/template_url_fetcher.cc index 2389eda..39229c3 100644 --- a/components/search_engines/template_url_fetcher.cc +++ b/components/search_engines/template_url_fetcher.cc @@ -71,7 +71,7 @@ TemplateURLFetcher::RequestDelegate::RequestDelegate( const ConfirmAddSearchProviderCallback& confirm_add_callback, ProviderType provider_type) : url_fetcher_( - net::URLFetcher::Create(osdd_url, net::URLFetcher::GET, this).Pass()), + net::URLFetcher::Create(osdd_url, net::URLFetcher::GET, this)), fetcher_(fetcher), keyword_(keyword), osdd_url_(osdd_url), diff --git a/components/search_engines/template_url_fetcher_unittest.cc b/components/search_engines/template_url_fetcher_unittest.cc index 1dd5c59..0ceed62 100644 --- a/components/search_engines/template_url_fetcher_unittest.cc +++ b/components/search_engines/template_url_fetcher_unittest.cc @@ -2,9 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include <stddef.h> +#include "components/search_engines/template_url_fetcher.h" +#include <stddef.h> #include <string> +#include <utility> #include "base/callback_helpers.h" #include "base/files/file_util.h" @@ -16,7 +18,6 @@ #include "chrome/browser/search_engines/template_url_service_test_util.h" #include "chrome/test/base/testing_profile.h" #include "components/search_engines/template_url.h" -#include "components/search_engines/template_url_fetcher.h" #include "components/search_engines/template_url_service.h" #include "content/public/test/test_browser_thread_bundle.h" #include "net/test/embedded_test_server/embedded_test_server.h" @@ -123,7 +124,7 @@ void TemplateURLFetcherTest::DestroyedCallback() { void TemplateURLFetcherTest::ConfirmAddSearchProvider( base::ScopedClosureRunner* callback_destruction_notifier, scoped_ptr<TemplateURL> template_url) { - last_callback_template_url_ = template_url.Pass(); + last_callback_template_url_ = std::move(template_url); add_provider_called_++; } diff --git a/components/search_engines/template_url_prepopulate_data.cc b/components/search_engines/template_url_prepopulate_data.cc index 4b15de4..4127ce6 100644 --- a/components/search_engines/template_url_prepopulate_data.cc +++ b/components/search_engines/template_url_prepopulate_data.cc @@ -1014,18 +1014,18 @@ scoped_ptr<TemplateURLData> MakePrepopulatedTemplateURLData( data->alternate_urls.push_back(alternate_url); } data->search_terms_replacement_key = search_terms_replacement_key.as_string(); - return data.Pass(); + return data; } ScopedVector<TemplateURLData> GetPrepopulatedTemplateURLData( PrefService* prefs) { ScopedVector<TemplateURLData> t_urls; if (!prefs) - return t_urls.Pass(); + return t_urls; const base::ListValue* list = prefs->GetList(prefs::kSearchProviderOverrides); if (!list) - return t_urls.Pass(); + return t_urls; size_t num_engines = list->GetSize(); for (size_t i = 0; i != num_engines; ++i) { @@ -1078,7 +1078,7 @@ ScopedVector<TemplateURLData> GetPrepopulatedTemplateURLData( search_terms_replacement_key, id).release()); } } - return t_urls.Pass(); + return t_urls; } bool SameDomain(const GURL& given_url, const GURL& prepopulated_url) { @@ -1113,7 +1113,7 @@ ScopedVector<TemplateURLData> GetPrepopulatedEngines( *default_search_provider_index = 0; ScopedVector<TemplateURLData> t_urls = GetPrepopulatedTemplateURLData(prefs); if (!t_urls.empty()) - return t_urls.Pass(); + return t_urls; const PrepopulatedEngine** engines; size_t num_engines; @@ -1122,7 +1122,7 @@ ScopedVector<TemplateURLData> GetPrepopulatedEngines( t_urls.push_back( MakeTemplateURLDataFromPrepopulatedEngine(*engines[i]).release()); } - return t_urls.Pass(); + return t_urls; } scoped_ptr<TemplateURLData> MakeTemplateURLDataFromPrepopulatedEngine( @@ -1162,7 +1162,7 @@ scoped_ptr<TemplateURLData> GetPrepopulatedDefaultSearch(PrefService* prefs) { default_search_provider.reset(loaded_urls[default_search_index]); loaded_urls.weak_erase(loaded_urls.begin() + default_search_index); } - return default_search_provider.Pass(); + return default_search_provider; } SearchEngineType GetEngineType(const TemplateURL& url, diff --git a/components/search_engines/template_url_service.cc b/components/search_engines/template_url_service.cc index fac64b6..3a2bf14 100644 --- a/components/search_engines/template_url_service.cc +++ b/components/search_engines/template_url_service.cc @@ -224,9 +224,9 @@ TemplateURLService::TemplateURLService( rappor::RapporService* rappor_service, const base::Closure& dsp_change_callback) : prefs_(prefs), - search_terms_data_(search_terms_data.Pass()), + search_terms_data_(std::move(search_terms_data)), web_data_service_(web_data_service), - client_(client.Pass()), + client_(std::move(client)), google_url_tracker_(google_url_tracker), rappor_service_(rappor_service), dsp_change_callback_(dsp_change_callback), @@ -550,7 +550,7 @@ void TemplateURLService::RegisterOmniboxKeyword( scoped_ptr<TemplateURL::AssociatedExtensionInfo> info( new TemplateURL::AssociatedExtensionInfo( TemplateURL::OMNIBOX_API_EXTENSION, extension_id)); - AddExtensionControlledTURL(url, info.Pass()); + AddExtensionControlledTURL(url, std::move(info)); } TemplateURLService::TemplateURLVector TemplateURLService::GetTemplateURLs() { @@ -1058,8 +1058,8 @@ syncer::SyncMergeResult TemplateURLService::MergeDataAndStartSyncing( return merge_result; } - sync_processor_ = sync_processor.Pass(); - sync_error_factory_ = sync_error_factory.Pass(); + sync_processor_ = std::move(sync_processor); + sync_error_factory_ = std::move(sync_error_factory); // We do a lot of calls to Add/Remove/ResetTemplateURL here, so ensure we // don't step on our own toes. @@ -1362,7 +1362,7 @@ TemplateURLService::CreateTemplateURLFromTemplateURLAndSyncData( } } - return turl.Pass(); + return turl; } // static diff --git a/components/search_engines/template_url_service.h b/components/search_engines/template_url_service.h index cec2251..751d5ca 100644 --- a/components/search_engines/template_url_service.h +++ b/components/search_engines/template_url_service.h @@ -6,11 +6,11 @@ #define COMPONENTS_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_H_ #include <stddef.h> - #include <list> #include <map> #include <set> #include <string> +#include <utility> #include <vector> #include "base/callback_list.h" @@ -384,7 +384,7 @@ class TemplateURLService : public WebDataServiceConsumer, const syncer::SyncDataList& sync_data); #if defined(UNIT_TEST) - void set_clock(scoped_ptr<base::Clock> clock) { clock_ = clock.Pass(); } + void set_clock(scoped_ptr<base::Clock> clock) { clock_ = std::move(clock); } #endif private: diff --git a/components/search_engines/template_url_service_sync_unittest.cc b/components/search_engines/template_url_service_sync_unittest.cc index 68f3737..e6981d7 100644 --- a/components/search_engines/template_url_service_sync_unittest.cc +++ b/components/search_engines/template_url_service_sync_unittest.cc @@ -3,6 +3,7 @@ // found in the LICENSE file. #include <stddef.h> +#include <utility> #include "base/macros.h" #include "base/memory/scoped_ptr.h" @@ -277,7 +278,7 @@ void TemplateURLServiceSyncTest::TearDown() { scoped_ptr<syncer::SyncChangeProcessor> TemplateURLServiceSyncTest::PassProcessor() { - return sync_processor_wrapper_.Pass(); + return std::move(sync_processor_wrapper_); } scoped_ptr<syncer::SyncErrorFactory> TemplateURLServiceSyncTest:: @@ -1319,10 +1320,8 @@ TEST_F(TemplateURLServiceSyncTest, MergeTwoClientsBasic) { scoped_ptr<syncer::SyncChangeProcessorWrapperForTest> delegate_b( new syncer::SyncChangeProcessorWrapperForTest(model_b())); model_a()->MergeDataAndStartSyncing( - syncer::SEARCH_ENGINES, - model_b()->GetAllSyncData(syncer::SEARCH_ENGINES), - delegate_b.Pass(), - CreateAndPassSyncErrorFactory()); + syncer::SEARCH_ENGINES, model_b()->GetAllSyncData(syncer::SEARCH_ENGINES), + std::move(delegate_b), CreateAndPassSyncErrorFactory()); // They should be consistent. AssertEquals(model_a()->GetAllSyncData(syncer::SEARCH_ENGINES), @@ -1349,10 +1348,8 @@ TEST_F(TemplateURLServiceSyncTest, MergeTwoClientsDupesAndConflicts) { scoped_ptr<syncer::SyncChangeProcessorWrapperForTest> delegate_b( new syncer::SyncChangeProcessorWrapperForTest(model_b())); model_a()->MergeDataAndStartSyncing( - syncer::SEARCH_ENGINES, - model_b()->GetAllSyncData(syncer::SEARCH_ENGINES), - delegate_b.Pass(), - CreateAndPassSyncErrorFactory()); + syncer::SEARCH_ENGINES, model_b()->GetAllSyncData(syncer::SEARCH_ENGINES), + std::move(delegate_b), CreateAndPassSyncErrorFactory()); // They should be consistent. AssertEquals(model_a()->GetAllSyncData(syncer::SEARCH_ENGINES), diff --git a/components/search_engines/template_url_service_unittest.cc b/components/search_engines/template_url_service_unittest.cc index a0e3ab2..75abf44 100644 --- a/components/search_engines/template_url_service_unittest.cc +++ b/components/search_engines/template_url_service_unittest.cc @@ -5,6 +5,7 @@ #include "components/search_engines/template_url_service.h" #include <stddef.h> +#include <utility> #include "base/bind.h" #include "base/bind_helpers.h" @@ -324,7 +325,7 @@ TEST_F(TemplateURLServiceTest, AddUpdateRemove) { base::Time now = base::Time::Now(); scoped_ptr<base::SimpleTestClock> clock(new base::SimpleTestClock); clock->SetNow(now); - model()->set_clock(clock.Pass()); + model()->set_clock(std::move(clock)); // Mutate an element and verify it succeeded. model()->ResetTemplateURL(loaded_url, ASCIIToUTF16("a"), ASCIIToUTF16("b"), @@ -639,7 +640,7 @@ TEST_F(TemplateURLServiceTest, Reset) { base::Time now = base::Time::Now(); scoped_ptr<base::SimpleTestClock> clock(new base::SimpleTestClock); clock->SetNow(now); - model()->set_clock(clock.Pass()); + model()->set_clock(std::move(clock)); // Reset the short name, keyword, url and make sure it takes. const base::string16 new_short_name(ASCIIToUTF16("a")); @@ -1416,7 +1417,7 @@ TEST_F(TemplateURLServiceTest, DefaultExtensionEngine) { new TemplateURL::AssociatedExtensionInfo( TemplateURL::NORMAL_CONTROLLED_BY_EXTENSION, "ext")); extension_info->wants_to_be_default_engine = true; - model()->AddExtensionControlledTURL(ext_dse, extension_info.Pass()); + model()->AddExtensionControlledTURL(ext_dse, std::move(extension_info)); EXPECT_EQ(ext_dse, model()->GetDefaultSearchProvider()); model()->RemoveExtensionControlledTURL( @@ -1442,7 +1443,7 @@ TEST_F(TemplateURLServiceTest, ExtensionEnginesNotPersist) { new TemplateURL::AssociatedExtensionInfo( TemplateURL::NORMAL_CONTROLLED_BY_EXTENSION, "ext1")); extension_info->wants_to_be_default_engine = false; - model()->AddExtensionControlledTURL(ext_dse, extension_info.Pass()); + model()->AddExtensionControlledTURL(ext_dse, std::move(extension_info)); EXPECT_EQ(user_dse, model()->GetDefaultSearchProvider()); ext_dse = CreateKeywordWithDate( @@ -1452,7 +1453,7 @@ TEST_F(TemplateURLServiceTest, ExtensionEnginesNotPersist) { extension_info.reset(new TemplateURL::AssociatedExtensionInfo( TemplateURL::NORMAL_CONTROLLED_BY_EXTENSION, "ext2")); extension_info->wants_to_be_default_engine = true; - model()->AddExtensionControlledTURL(ext_dse, extension_info.Pass()); + model()->AddExtensionControlledTURL(ext_dse, std::move(extension_info)); EXPECT_EQ(ext_dse, model()->GetDefaultSearchProvider()); test_util()->ResetModel(true); @@ -1500,7 +1501,7 @@ TEST_F(TemplateURLServiceTest, ExtensionEngineVsPolicy) { new TemplateURL::AssociatedExtensionInfo( TemplateURL::NORMAL_CONTROLLED_BY_EXTENSION, "ext1")); extension_info->wants_to_be_default_engine = true; - model()->AddExtensionControlledTURL(ext_dse, extension_info.Pass()); + model()->AddExtensionControlledTURL(ext_dse, std::move(extension_info)); EXPECT_EQ(ext_dse, model()->GetTemplateURLForKeyword(ASCIIToUTF16("ext1"))); EXPECT_TRUE(model()->is_default_search_managed()); actual_managed_default = model()->GetDefaultSearchProvider(); diff --git a/components/search_engines/template_url_service_util_unittest.cc b/components/search_engines/template_url_service_util_unittest.cc index 00b2439..e961f9a 100644 --- a/components/search_engines/template_url_service_util_unittest.cc +++ b/components/search_engines/template_url_service_util_unittest.cc @@ -23,7 +23,7 @@ scoped_ptr<TemplateURLData> CreatePrepopulateTemplateURLData( data->prepopulate_id = prepopulate_id; data->SetKeyword(base::ASCIIToUTF16(keyword)); data->id = id; - return data.Pass(); + return data; } // Creates a TemplateURL with default values except for the prepopulate ID, diff --git a/components/search_provider_logos/google_logo_api.cc b/components/search_provider_logos/google_logo_api.cc index 3f001f5..d3bbe33 100644 --- a/components/search_provider_logos/google_logo_api.cc +++ b/components/search_provider_logos/google_logo_api.cc @@ -130,7 +130,7 @@ scoped_ptr<EncodedLogo> GoogleParseLogoResponse( // If this point is reached, parsing has succeeded. *parsing_failed = false; - return logo.Pass(); + return logo; } } // namespace search_provider_logos diff --git a/components/search_provider_logos/logo_cache.cc b/components/search_provider_logos/logo_cache.cc index 4ceb6d8..207ff5a 100644 --- a/components/search_provider_logos/logo_cache.cc +++ b/components/search_provider_logos/logo_cache.cc @@ -6,6 +6,7 @@ #include <stddef.h> #include <stdint.h> +#include <utility> #include "base/files/file_util.h" #include "base/json/json_reader.h" @@ -84,7 +85,7 @@ void LogoCache::SetCachedLogo(const EncodedLogo* logo) { metadata.reset(new LogoMetadata(logo->metadata)); logo_num_bytes_ = static_cast<int>(logo->encoded_image->size()); } - UpdateMetadata(metadata.Pass()); + UpdateMetadata(std::move(metadata)); WriteLogo(logo ? logo->encoded_image : NULL); } @@ -112,7 +113,7 @@ scoped_ptr<EncodedLogo> LogoCache::GetCachedLogo() { scoped_ptr<EncodedLogo> logo(new EncodedLogo()); logo->encoded_image = encoded_image; logo->metadata = *metadata_; - return logo.Pass(); + return logo; } // static @@ -137,7 +138,7 @@ scoped_ptr<LogoMetadata> LogoCache::LogoMetadataFromString( return scoped_ptr<LogoMetadata>(); } - return metadata.Pass(); + return metadata; } // static @@ -167,7 +168,7 @@ base::FilePath LogoCache::GetMetadataPath() { } void LogoCache::UpdateMetadata(scoped_ptr<LogoMetadata> metadata) { - metadata_ = metadata.Pass(); + metadata_ = std::move(metadata); metadata_is_valid_ = true; } @@ -186,7 +187,7 @@ void LogoCache::ReadMetadataIfNeeded() { } } - UpdateMetadata(metadata.Pass()); + UpdateMetadata(std::move(metadata)); } void LogoCache::WriteMetadata() { diff --git a/components/search_provider_logos/logo_tracker.cc b/components/search_provider_logos/logo_tracker.cc index 43536fe..c50b42c 100644 --- a/components/search_provider_logos/logo_tracker.cc +++ b/components/search_provider_logos/logo_tracker.cc @@ -5,6 +5,7 @@ #include "components/search_provider_logos/logo_tracker.h" #include <algorithm> +#include <utility> #include "base/message_loop/message_loop.h" #include "base/metrics/histogram_macros.h" @@ -55,7 +56,7 @@ scoped_ptr<EncodedLogo> GetLogoFromCacheOnFileThread(LogoCache* logo_cache, return scoped_ptr<EncodedLogo>(); } - return logo_cache->GetCachedLogo().Pass(); + return logo_cache->GetCachedLogo(); } void DeleteLogoCacheOnFileThread(LogoCache* logo_cache) { @@ -72,7 +73,7 @@ LogoTracker::LogoTracker( scoped_ptr<LogoDelegate> delegate) : is_idle_(true), is_cached_logo_valid_(false), - logo_delegate_(delegate.Pass()), + logo_delegate_(std::move(delegate)), logo_cache_(new LogoCache(cached_logo_directory)), clock_(new base::DefaultClock()), file_task_runner_(file_task_runner), @@ -135,7 +136,7 @@ void LogoTracker::SetLogoCacheForTests(scoped_ptr<LogoCache> cache) { } void LogoTracker::SetClockForTests(scoped_ptr<base::Clock> clock) { - clock_ = clock.Pass(); + clock_ = std::move(clock); } void LogoTracker::ReturnToIdle(int outcome) { @@ -227,7 +228,7 @@ void LogoTracker::OnFreshLogoParsed(bool* parsing_failed, logo->metadata.source_url = logo_url_.spec(); if (!logo || !logo->encoded_image.get()) { - OnFreshLogoAvailable(logo.Pass(), *parsing_failed, SkBitmap()); + OnFreshLogoAvailable(std::move(logo), *parsing_failed, SkBitmap()); } else { // Store the value of logo->encoded_image for use below. This ensures that // logo->encoded_image is evaulated before base::Passed(&logo), which sets @@ -286,7 +287,7 @@ void LogoTracker::OnFreshLogoAvailable(scoped_ptr<EncodedLogo> encoded_logo, FOR_EACH_OBSERVER(LogoObserver, logo_observers_, OnLogoAvailable(logo.get(), false)); - SetCachedLogo(encoded_logo.Pass()); + SetCachedLogo(std::move(encoded_logo)); } } diff --git a/components/security_interstitials/core/controller_client.cc b/components/security_interstitials/core/controller_client.cc index 0baa07a..0a32c7a 100644 --- a/components/security_interstitials/core/controller_client.cc +++ b/components/security_interstitials/core/controller_client.cc @@ -4,6 +4,8 @@ #include "components/security_interstitials/core/controller_client.h" +#include <utility> + #include "base/prefs/pref_service.h" #include "components/google/core/browser/google_util.h" #include "components/security_interstitials/core/metrics_helper.h" @@ -29,7 +31,7 @@ MetricsHelper* ControllerClient::metrics_helper() const { void ControllerClient::set_metrics_helper( scoped_ptr<MetricsHelper> metrics_helper) { - metrics_helper_ = metrics_helper.Pass(); + metrics_helper_ = std::move(metrics_helper); } void ControllerClient::SetReportingPreference(bool report) { diff --git a/components/security_interstitials/core/metrics_helper.cc b/components/security_interstitials/core/metrics_helper.cc index 34b555d..7b2e3cd19 100644 --- a/components/security_interstitials/core/metrics_helper.cc +++ b/components/security_interstitials/core/metrics_helper.cc @@ -4,6 +4,8 @@ #include "components/security_interstitials/core/metrics_helper.h" +#include <utility> + #include "base/metrics/histogram.h" #include "base/metrics/user_metrics.h" #include "base/metrics/user_metrics_action.h" @@ -179,7 +181,7 @@ void MetricsHelper::RecordUserDecisionToRappor(Decision decision) { InterstitialFlagBits::HIGHEST_USED_BIT + 1); } rappor_service_->RecordSampleObj("interstitial." + settings_.rappor_prefix, - sample.Pass()); + std::move(sample)); } void MetricsHelper::RecordUserInteraction(Interaction interaction) { diff --git a/components/sessions/content/content_serialized_navigation_builder.cc b/components/sessions/content/content_serialized_navigation_builder.cc index 47eb7c0..021b0e8 100644 --- a/components/sessions/content/content_serialized_navigation_builder.cc +++ b/components/sessions/content/content_serialized_navigation_builder.cc @@ -81,7 +81,7 @@ ContentSerializedNavigationBuilder::ToNavigationEntry( navigation->blocked_state_); DCHECK_EQ(0u, navigation->content_pack_categories_.size()); - return entry.Pass(); + return entry; } // static diff --git a/components/sessions/content/content_serialized_navigation_builder_unittest.cc b/components/sessions/content/content_serialized_navigation_builder_unittest.cc index 4904146..4259d32 100644 --- a/components/sessions/content/content_serialized_navigation_builder_unittest.cc +++ b/components/sessions/content/content_serialized_navigation_builder_unittest.cc @@ -43,7 +43,7 @@ scoped_ptr<content::NavigationEntry> MakeNavigationEntryForTest() { redirect_chain.push_back(test_data::kRedirectURL1); redirect_chain.push_back(test_data::kVirtualURL); navigation_entry->SetRedirectChain(redirect_chain); - return navigation_entry.Pass(); + return navigation_entry; } } // namespace diff --git a/components/sessions/core/base_session_service.cc b/components/sessions/core/base_session_service.cc index 8008532..4f2d839 100644 --- a/components/sessions/core/base_session_service.cc +++ b/components/sessions/core/base_session_service.cc @@ -4,6 +4,8 @@ #include "components/sessions/core/base_session_service.h" +#include <utility> + #include "base/bind.h" #include "base/location.h" #include "base/single_thread_task_runner.h" @@ -25,7 +27,7 @@ void RunIfNotCanceled( ScopedVector<SessionCommand> commands) { if (is_canceled.Run()) return; - callback.Run(commands.Pass()); + callback.Run(std::move(commands)); } void PostOrRunInternalGetCommandsCallback( @@ -33,7 +35,7 @@ void PostOrRunInternalGetCommandsCallback( const BaseSessionService::GetCommandsCallback& callback, ScopedVector<SessionCommand> commands) { if (task_runner->RunsTasksOnCurrentThread()) { - callback.Run(commands.Pass()); + callback.Run(std::move(commands)); } else { task_runner->PostTask(FROM_HERE, base::Bind(callback, base::Passed(&commands))); diff --git a/components/sessions/core/persistent_tab_restore_service.cc b/components/sessions/core/persistent_tab_restore_service.cc index fe68c7c..d639e01 100644 --- a/components/sessions/core/persistent_tab_restore_service.cc +++ b/components/sessions/core/persistent_tab_restore_service.cc @@ -7,7 +7,7 @@ #include <stddef.h> #include <stdint.h> #include <string.h> - +#include <utility> #include <vector> #include "base/bind.h" @@ -307,7 +307,7 @@ void PersistentTabRestoreService::Delegate::OnClearEntries() { const Entries& entries = tab_restore_service_helper_->entries(); for (Entries::const_iterator i = entries.begin(); i != entries.end(); ++i) base_session_service_->ScheduleCommand( - CreateRestoredEntryCommand((*i)->id).Pass()); + CreateRestoredEntryCommand((*i)->id)); entries_to_write_ = 0; @@ -316,7 +316,7 @@ void PersistentTabRestoreService::Delegate::OnClearEntries() { // Schedule a command, otherwise if there are no pending commands Save does // nothing. - base_session_service_->ScheduleCommand(CreateRestoredEntryCommand(1).Pass()); + base_session_service_->ScheduleCommand(CreateRestoredEntryCommand(1)); } void PersistentTabRestoreService::Delegate::OnRestoreEntryById( @@ -330,7 +330,7 @@ void PersistentTabRestoreService::Delegate::OnRestoreEntryById( if (static_cast<int>(index) < entries_to_write_) entries_to_write_--; - base_session_service_->ScheduleCommand(CreateRestoredEntryCommand(id).Pass()); + base_session_service_->ScheduleCommand(CreateRestoredEntryCommand(id)); } void PersistentTabRestoreService::Delegate::OnAddEntry() { @@ -407,17 +407,13 @@ void PersistentTabRestoreService::Delegate::ScheduleCommandsForWindow( if (valid_tab_count == 0) return; // No tabs to persist. - base_session_service_->ScheduleCommand( - CreateWindowCommand(window.id, - std::min(real_selected_tab, valid_tab_count - 1), - valid_tab_count, - window.timestamp).Pass()); + base_session_service_->ScheduleCommand(CreateWindowCommand( + window.id, std::min(real_selected_tab, valid_tab_count - 1), + valid_tab_count, window.timestamp)); if (!window.app_name.empty()) { - base_session_service_->ScheduleCommand( - CreateSetWindowAppNameCommand(kCommandSetWindowAppName, window.id, - window.app_name) - .Pass()); + base_session_service_->ScheduleCommand(CreateSetWindowAppNameCommand( + kCommandSetWindowAppName, window.id, window.app_name)); } for (size_t i = 0; i < window.tabs.size(); ++i) { @@ -446,31 +442,25 @@ void PersistentTabRestoreService::Delegate::ScheduleCommandsForTab( } // Write the command that identifies the selected tab. - base_session_service_->ScheduleCommand( - CreateSelectedNavigationInTabCommand(tab.id, - valid_count_before_selected, - tab.timestamp).Pass()); + base_session_service_->ScheduleCommand(CreateSelectedNavigationInTabCommand( + tab.id, valid_count_before_selected, tab.timestamp)); if (tab.pinned) { PinnedStatePayload payload = true; scoped_ptr<SessionCommand> command( new SessionCommand(kCommandPinnedState, sizeof(payload))); memcpy(command->contents(), &payload, sizeof(payload)); - base_session_service_->ScheduleCommand(command.Pass()); + base_session_service_->ScheduleCommand(std::move(command)); } if (!tab.extension_app_id.empty()) { - base_session_service_->ScheduleCommand( - CreateSetTabExtensionAppIDCommand(kCommandSetExtensionAppID, tab.id, - tab.extension_app_id) - .Pass()); + base_session_service_->ScheduleCommand(CreateSetTabExtensionAppIDCommand( + kCommandSetExtensionAppID, tab.id, tab.extension_app_id)); } if (!tab.user_agent_override.empty()) { - base_session_service_->ScheduleCommand( - CreateSetTabUserAgentOverrideCommand(kCommandSetTabUserAgentOverride, - tab.id, tab.user_agent_override) - .Pass()); + base_session_service_->ScheduleCommand(CreateSetTabUserAgentOverrideCommand( + kCommandSetTabUserAgentOverride, tab.id, tab.user_agent_override)); } // Then write the navigations. @@ -918,7 +908,7 @@ void PersistentTabRestoreService::Delegate::RemoveEntryByID( PersistentTabRestoreService::PersistentTabRestoreService( scoped_ptr<TabRestoreServiceClient> client, TimeFactory* time_factory) - : client_(client.Pass()), + : client_(std::move(client)), delegate_(new Delegate(client_.get())), helper_(this, delegate_.get(), client_.get(), time_factory) { delegate_->set_tab_restore_service_helper(&helper_); diff --git a/components/sessions/core/session_backend.cc b/components/sessions/core/session_backend.cc index d120962..51e8163 100644 --- a/components/sessions/core/session_backend.cc +++ b/components/sessions/core/session_backend.cc @@ -5,8 +5,8 @@ #include "components/sessions/core/session_backend.h" #include <stdint.h> - #include <limits> +#include <utility> #include "base/files/file.h" #include "base/files/file_util.h" @@ -254,7 +254,7 @@ void SessionBackend::ReadLastSessionCommands( ScopedVector<sessions::SessionCommand> commands; ReadLastSessionCommandsImpl(&commands); - callback.Run(commands.Pass()); + callback.Run(std::move(commands)); } bool SessionBackend::ReadLastSessionCommandsImpl( diff --git a/components/sessions/core/session_backend_unittest.cc b/components/sessions/core/session_backend_unittest.cc index aad3ac9..c59ca27 100644 --- a/components/sessions/core/session_backend_unittest.cc +++ b/components/sessions/core/session_backend_unittest.cc @@ -2,14 +2,16 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "components/sessions/core/session_backend.h" + #include <stddef.h> +#include <utility> #include "base/files/file_util.h" #include "base/files/scoped_temp_dir.h" #include "base/macros.h" #include "base/stl_util.h" #include "base/strings/string_util.h" -#include "components/sessions/core/session_backend.h" #include "testing/gtest/include/gtest/gtest.h" namespace sessions { @@ -61,7 +63,7 @@ TEST_F(SessionBackendTest, SimpleReadWrite) { struct TestData data = { 1, "a" }; SessionCommands commands; commands.push_back(CreateCommandFromData(data)); - backend->AppendCommands(commands.Pass(), false); + backend->AppendCommands(std::move(commands), false); ASSERT_TRUE(commands.empty()); // Read it back in. @@ -118,10 +120,10 @@ TEST_F(SessionBackendTest, RandomData) { commands.begin(); j != commands.end(); ++j) { AssertCommandEqualsData(data[j - commands.begin()], *j); } - backend->AppendCommands(commands.Pass(), false); + backend->AppendCommands(std::move(commands), false); } commands.push_back(CreateCommandFromData(data[i])); - backend->AppendCommands(commands.Pass(), false); + backend->AppendCommands(std::move(commands), false); } } @@ -145,7 +147,7 @@ TEST_F(SessionBackendTest, BigData) { reinterpret_cast<char*>(big_command->contents())[big_size - 1] = 'z'; commands.push_back(big_command); commands.push_back(CreateCommandFromData(data[1])); - backend->AppendCommands(commands.Pass(), false); + backend->AppendCommands(std::move(commands), false); backend = NULL; backend = new SessionBackend(sessions::BaseSessionService::SESSION_RESTORE, @@ -171,7 +173,7 @@ TEST_F(SessionBackendTest, EmptyCommand) { new SessionBackend(sessions::BaseSessionService::SESSION_RESTORE, path_)); SessionCommands empty_commands; empty_commands.push_back(CreateCommandFromData(empty_command)); - backend->AppendCommands(empty_commands.Pass(), true); + backend->AppendCommands(std::move(empty_commands), true); backend->MoveCurrentSessionToLastSession(); SessionCommands commands; @@ -189,12 +191,12 @@ TEST_F(SessionBackendTest, Truncate) { struct TestData first_data = { 1, "a" }; SessionCommands commands; commands.push_back(CreateCommandFromData(first_data)); - backend->AppendCommands(commands.Pass(), false); + backend->AppendCommands(std::move(commands), false); // Write another command, this time resetting the file when appending. struct TestData second_data = { 2, "b" }; commands.push_back(CreateCommandFromData(second_data)); - backend->AppendCommands(commands.Pass(), true); + backend->AppendCommands(std::move(commands), true); // Read it back in. backend = NULL; diff --git a/components/sessions/core/session_service_commands.cc b/components/sessions/core/session_service_commands.cc index c0828d7..3e81868 100644 --- a/components/sessions/core/session_service_commands.cc +++ b/components/sessions/core/session_service_commands.cc @@ -6,7 +6,7 @@ #include <stdint.h> #include <string.h> - +#include <utility> #include <vector> #include "base/pickle.h" @@ -837,14 +837,15 @@ bool ReplacePendingCommand(BaseSessionService* base_session_service, // it with the new one. We need to add to the end of the list just in // case there is a prune command after the update command. base_session_service->EraseCommand(*(i.base() - 1)); - base_session_service->AppendRebuildCommand((*command).Pass()); + base_session_service->AppendRebuildCommand((std::move(*command))); return true; } return false; } if ((*command)->id() == kCommandSetActiveWindow && existing_command->id() == kCommandSetActiveWindow) { - base_session_service->SwapCommand(existing_command, (*command).Pass()); + base_session_service->SwapCommand(existing_command, + (std::move(*command))); return true; } } diff --git a/components/signin/core/browser/about_signin_internals.cc b/components/signin/core/browser/about_signin_internals.cc index 8b14986..3c2aa80 100644 --- a/components/signin/core/browser/about_signin_internals.cc +++ b/components/signin/core/browser/about_signin_internals.cc @@ -289,12 +289,9 @@ void AboutSigninInternals::NotifyObservers() { } scoped_ptr<base::DictionaryValue> AboutSigninInternals::GetSigninStatus() { - return signin_status_.ToValue(account_tracker_, - signin_manager_, - signin_error_controller_, - token_service_, - cookie_manager_service_, - client_->GetProductVersion()).Pass(); + return signin_status_.ToValue( + account_tracker_, signin_manager_, signin_error_controller_, + token_service_, cookie_manager_service_, client_->GetProductVersion()); } void AboutSigninInternals::OnAccessTokenRequested( @@ -675,5 +672,5 @@ scoped_ptr<base::DictionaryValue> AboutSigninInternals::SigninStatus::ToValue( account_info->Append(entry); } - return signin_status.Pass(); + return signin_status; } diff --git a/components/signin/core/browser/account_fetcher_service.cc b/components/signin/core/browser/account_fetcher_service.cc index 83808b4..1902fcc 100644 --- a/components/signin/core/browser/account_fetcher_service.cc +++ b/components/signin/core/browser/account_fetcher_service.cc @@ -4,6 +4,8 @@ #include "components/signin/core/browser/account_fetcher_service.h" +#include <utility> + #include "base/command_line.h" #include "base/metrics/field_trial.h" #include "base/prefs/pref_service.h" @@ -204,7 +206,7 @@ void AccountFetcherService::StartFetchingUserInfo( scoped_ptr<AccountInfoFetcher> fetcher(new AccountInfoFetcher( token_service_, signin_client_->GetURLRequestContext(), this, account_id)); - user_info_requests_.set(account_id, fetcher.Pass()); + user_info_requests_.set(account_id, std::move(fetcher)); user_info_requests_.get(account_id)->Start(); } } @@ -269,7 +271,7 @@ void AccountFetcherService::SendRefreshTokenAnnotationRequest( // If request was sent AccountFetcherService needs to own request till it // finishes. if (request) - refresh_token_annotation_requests_.set(account_id, request.Pass()); + refresh_token_annotation_requests_.set(account_id, std::move(request)); } #endif } diff --git a/components/signin/core/browser/account_info_fetcher.cc b/components/signin/core/browser/account_info_fetcher.cc index a22fc32..ea68009 100644 --- a/components/signin/core/browser/account_info_fetcher.cc +++ b/components/signin/core/browser/account_info_fetcher.cc @@ -4,6 +4,8 @@ #include "components/signin/core/browser/account_info_fetcher.h" +#include <utility> + #include "base/trace_event/trace_event.h" #include "components/signin/core/browser/account_fetcher_service.h" #include "google_apis/gaia/gaia_constants.h" @@ -63,7 +65,7 @@ void AccountInfoFetcher::OnGetUserInfoResponse( TRACE_EVENT_ASYNC_STEP_PAST1("AccountFetcherService", "AccountIdFetcher", this, "OnGetUserInfoResponse", "account_id", account_id_); - service_->OnUserInfoFetchSuccess(account_id_, user_info.Pass()); + service_->OnUserInfoFetchSuccess(account_id_, std::move(user_info)); } void AccountInfoFetcher::OnOAuthError() { diff --git a/components/signin/core/browser/refresh_token_annotation_request.cc b/components/signin/core/browser/refresh_token_annotation_request.cc index 82b06f2..c36874a 100644 --- a/components/signin/core/browser/refresh_token_annotation_request.cc +++ b/components/signin/core/browser/refresh_token_annotation_request.cc @@ -56,18 +56,18 @@ RefreshTokenAnnotationRequest::SendIfNeeded( scoped_ptr<RefreshTokenAnnotationRequest> request; if (!ShouldSendNow(pref_service)) - return request.Pass(); + return request; // Don't send request if device_id is disabled. std::string device_id = signin_client->GetSigninScopedDeviceId(); if (device_id.empty()) - return request.Pass(); + return request; request.reset(new RefreshTokenAnnotationRequest( request_context_getter, signin_client->GetProductVersion(), device_id, GaiaUrls::GetInstance()->oauth2_chrome_client_id(), request_callback)); request->RequestAccessToken(token_service, account_id); - return request.Pass(); + return request; } // static diff --git a/components/signin/core/browser/signin_status_metrics_provider.cc b/components/signin/core/browser/signin_status_metrics_provider.cc index 4d937db..5552192 100644 --- a/components/signin/core/browser/signin_status_metrics_provider.cc +++ b/components/signin/core/browser/signin_status_metrics_provider.cc @@ -4,6 +4,8 @@ #include "components/signin/core/browser/signin_status_metrics_provider.h" +#include <utility> + #include "base/bind.h" #include "base/location.h" #include "base/metrics/histogram.h" @@ -35,7 +37,7 @@ void RecordComputeSigninStatusHistogram(ComputeSigninStatus status) { SigninStatusMetricsProvider::SigninStatusMetricsProvider( scoped_ptr<SigninStatusMetricsProviderDelegate> delegate, bool is_test) - : delegate_(delegate.Pass()), + : delegate_(std::move(delegate)), scoped_observer_(this), is_test_(is_test), weak_ptr_factory_(this) { @@ -66,7 +68,7 @@ void SigninStatusMetricsProvider::ProvideGeneralMetrics( // static SigninStatusMetricsProvider* SigninStatusMetricsProvider::CreateInstance( scoped_ptr<SigninStatusMetricsProviderDelegate> delegate) { - return new SigninStatusMetricsProvider(delegate.Pass(), false); + return new SigninStatusMetricsProvider(std::move(delegate), false); } void SigninStatusMetricsProvider::OnSigninManagerCreated( diff --git a/components/storage_monitor/storage_monitor_linux.cc b/components/storage_monitor/storage_monitor_linux.cc index a6fefc4..a68e3e8 100644 --- a/components/storage_monitor/storage_monitor_linux.cc +++ b/components/storage_monitor/storage_monitor_linux.cc @@ -9,9 +9,9 @@ #include <mntent.h> #include <stdint.h> #include <stdio.h> - #include <limits> #include <list> +#include <utility> #include "base/bind.h" #include "base/macros.h" @@ -131,11 +131,11 @@ scoped_ptr<StorageInfo> GetDeviceInfo(const base::FilePath& device_path, device::ScopedUdevPtr udev_obj(device::udev_new()); if (!udev_obj.get()) - return storage_info.Pass(); + return storage_info; struct stat device_stat; if (stat(device_path.value().c_str(), &device_stat) < 0) - return storage_info.Pass(); + return storage_info; char device_type; if (S_ISCHR(device_stat.st_mode)) @@ -143,13 +143,13 @@ scoped_ptr<StorageInfo> GetDeviceInfo(const base::FilePath& device_path, else if (S_ISBLK(device_stat.st_mode)) device_type = 'b'; else - return storage_info.Pass(); // Not a supported type. + return storage_info; // Not a supported type. device::ScopedUdevDevicePtr device( device::udev_device_new_from_devnum(udev_obj.get(), device_type, device_stat.st_rdev)); if (!device.get()) - return storage_info.Pass(); + return storage_info; base::string16 volume_label = base::UTF8ToUTF16( device::UdevDeviceGetPropertyValue(device.get(), kLabel)); @@ -195,7 +195,7 @@ scoped_ptr<StorageInfo> GetDeviceInfo(const base::FilePath& device_path, vendor_name, model_name, GetDeviceStorageSize(device_path, device.get()))); - return storage_info.Pass(); + return storage_info; } MtabWatcherLinux* CreateMtabWatcherLinuxOnFileThread( @@ -226,7 +226,7 @@ StorageMonitor::EjectStatus EjectPathOnFileThread( if (!process.WaitForExitWithTimeout(base::TimeDelta::FromMilliseconds(3000), &exit_code)) { process.Terminate(-1, false); - base::EnsureProcessTerminated(process.Pass()); + base::EnsureProcessTerminated(std::move(process)); return StorageMonitor::EJECT_FAILURE; } diff --git a/components/storage_monitor/storage_monitor_linux_unittest.cc b/components/storage_monitor/storage_monitor_linux_unittest.cc index 295215e..03a7dd5 100644 --- a/components/storage_monitor/storage_monitor_linux_unittest.cc +++ b/components/storage_monitor/storage_monitor_linux_unittest.cc @@ -86,7 +86,7 @@ scoped_ptr<StorageInfo> GetDeviceInfo(const base::FilePath& device_path, scoped_ptr<StorageInfo> storage_info; if (!device_found) { NOTREACHED(); - return storage_info.Pass(); + return storage_info; } StorageInfo::Type type = kTestDeviceData[i].type; @@ -97,7 +97,7 @@ scoped_ptr<StorageInfo> GetDeviceInfo(const base::FilePath& device_path, base::ASCIIToUTF16("vendor name"), base::ASCIIToUTF16("model name"), kTestDeviceData[i].partition_size_in_bytes)); - return storage_info.Pass(); + return storage_info; } uint64_t GetDevicePartitionSize(const std::string& device) { diff --git a/components/storage_monitor/test_storage_monitor.cc b/components/storage_monitor/test_storage_monitor.cc index 33e80a5..a7b52f4 100644 --- a/components/storage_monitor/test_storage_monitor.cc +++ b/components/storage_monitor/test_storage_monitor.cc @@ -4,6 +4,8 @@ #include "components/storage_monitor/test_storage_monitor.h" +#include <utility> + #include "base/run_loop.h" #include "base/synchronization/waitable_event.h" #include "build/build_config.h" @@ -35,7 +37,7 @@ TestStorageMonitor* TestStorageMonitor::CreateAndInstall() { monitor->MarkInitialized(); if (StorageMonitor::GetInstance() == NULL) { - StorageMonitor::SetStorageMonitorForTesting(pass_monitor.Pass()); + StorageMonitor::SetStorageMonitorForTesting(std::move(pass_monitor)); return monitor; } @@ -49,7 +51,7 @@ TestStorageMonitor* TestStorageMonitor::CreateForBrowserTests() { monitor->MarkInitialized(); scoped_ptr<StorageMonitor> pass_monitor(monitor); - StorageMonitor::SetStorageMonitorForTesting(pass_monitor.Pass()); + StorageMonitor::SetStorageMonitorForTesting(std::move(pass_monitor)); return monitor; } diff --git a/components/suggestions/image_manager.cc b/components/suggestions/image_manager.cc index 8b50dd3..08cf3d7 100644 --- a/components/suggestions/image_manager.cc +++ b/components/suggestions/image_manager.cc @@ -4,6 +4,8 @@ #include "components/suggestions/image_manager.h" +#include <utility> + #include "base/bind.h" #include "base/location.h" #include "base/task_runner_util.h" @@ -37,8 +39,8 @@ ImageManager::ImageManager( scoped_ptr<ProtoDatabase<ImageData>> database, const base::FilePath& database_dir, scoped_refptr<base::TaskRunner> background_task_runner) - : image_fetcher_(image_fetcher.Pass()), - database_(database.Pass()), + : image_fetcher_(std::move(image_fetcher)), + database_(std::move(database)), background_task_runner_(background_task_runner), database_ready_(false), weak_ptr_factory_(this) { @@ -181,7 +183,8 @@ void ImageManager::SaveImage(const GURL& url, const SkBitmap& bitmap) { scoped_ptr<std::vector<std::string>> keys_to_remove( new std::vector<std::string>()); entries_to_save->push_back(std::make_pair(data.url(), data)); - database_->UpdateEntries(entries_to_save.Pass(), keys_to_remove.Pass(), + database_->UpdateEntries(std::move(entries_to_save), + std::move(keys_to_remove), base::Bind(&ImageManager::OnDatabaseSave, weak_ptr_factory_.GetWeakPtr())); } @@ -207,7 +210,7 @@ void ImageManager::OnDatabaseLoad(bool success, } database_ready_ = true; - LoadEntriesInCache(entries.Pass()); + LoadEntriesInCache(std::move(entries)); ServePendingCacheRequests(); } diff --git a/components/suggestions/suggestions_service.cc b/components/suggestions/suggestions_service.cc index 7af3ddd..f4c8e61 100644 --- a/components/suggestions/suggestions_service.cc +++ b/components/suggestions/suggestions_service.cc @@ -173,9 +173,9 @@ SuggestionsService::SuggestionsService( scoped_ptr<ImageManager> thumbnail_manager, scoped_ptr<BlacklistStore> blacklist_store) : url_request_context_(url_request_context), - suggestions_store_(suggestions_store.Pass()), - thumbnail_manager_(thumbnail_manager.Pass()), - blacklist_store_(blacklist_store.Pass()), + suggestions_store_(std::move(suggestions_store)), + thumbnail_manager_(std::move(thumbnail_manager)), + blacklist_store_(std::move(blacklist_store)), scheduling_delay_(TimeDelta::FromSeconds(kDefaultSchedulingDelaySec)), token_fetcher_(new AccessTokenFetcher(signin_manager, token_service)), weak_ptr_factory_(this) {} diff --git a/components/suggestions/suggestions_service_unittest.cc b/components/suggestions/suggestions_service_unittest.cc index 36d8cef..4e7d950 100644 --- a/components/suggestions/suggestions_service_unittest.cc +++ b/components/suggestions/suggestions_service_unittest.cc @@ -71,7 +71,7 @@ scoped_ptr<net::FakeURLFetcher> CreateURLFetcher( download_headers->AddHeader("Content-Type: text/html"); fetcher->set_response_headers(download_headers); } - return fetcher.Pass(); + return fetcher; } // GMock matcher for protobuf equality. diff --git a/components/suggestions/suggestions_store.cc b/components/suggestions/suggestions_store.cc index dff3211..39dac6c 100644 --- a/components/suggestions/suggestions_store.cc +++ b/components/suggestions/suggestions_store.cc @@ -5,8 +5,8 @@ #include "components/suggestions/suggestions_store.h" #include <stdint.h> - #include <string> +#include <utility> #include "base/base64.h" #include "base/prefs/pref_service.h" @@ -28,7 +28,7 @@ SuggestionsStore::SuggestionsStore() { SuggestionsStore::~SuggestionsStore() {} void SuggestionsStore::SetClockForTesting(scoped_ptr<base::Clock> test_clock) { - this->clock_ = test_clock.Pass(); + this->clock_ = std::move(test_clock); } bool SuggestionsStore::LoadSuggestions(SuggestionsProfile* suggestions) { diff --git a/components/sync_bookmarks/bookmark_change_processor.cc b/components/sync_bookmarks/bookmark_change_processor.cc index 3644a03..c9bc0d7 100644 --- a/components/sync_bookmarks/bookmark_change_processor.cc +++ b/components/sync_bookmarks/bookmark_change_processor.cc @@ -880,7 +880,7 @@ BookmarkChangeProcessor::GetBookmarkMetaInfo( // Verifies that all entries had unique keys. DCHECK_EQ(static_cast<size_t>(specifics.meta_info_size()), meta_info_map->size()); - return meta_info_map.Pass(); + return meta_info_map; } // static diff --git a/components/sync_driver/about_sync_util.cc b/components/sync_driver/about_sync_util.cc index 7842091..f9acf0f 100644 --- a/components/sync_driver/about_sync_util.cc +++ b/components/sync_driver/about_sync_util.cc @@ -357,7 +357,7 @@ scoped_ptr<base::DictionaryValue> ConstructAboutInformation( if (!service) { summary_string.SetValue("Sync service does not exist"); - return about_info.Pass(); + return about_info; } syncer::SyncStatus full_status; @@ -525,7 +525,7 @@ scoped_ptr<base::DictionaryValue> ConstructAboutInformation( about_info->Set("type_status", service->GetTypeStatusMap()); - return about_info.Pass(); + return about_info; } } // namespace sync_ui_util diff --git a/components/sync_driver/device_info_service.cc b/components/sync_driver/device_info_service.cc index 933ff1e..1063bab 100644 --- a/components/sync_driver/device_info_service.cc +++ b/components/sync_driver/device_info_service.cc @@ -4,6 +4,7 @@ #include "components/sync_driver/device_info_service.h" +#include <utility> #include <vector> #include "base/bind.h" @@ -100,7 +101,7 @@ ScopedVector<DeviceInfo> DeviceInfoService::GetAllDeviceInfo() const { list.push_back(CreateDeviceInfo(*iter->second)); } - return list.Pass(); + return list; } void DeviceInfoService::AddObserver(Observer* observer) { @@ -132,7 +133,7 @@ void DeviceInfoService::UpdateLocalDeviceBackupTime(base::Time backup_time) { // EntityMetadata, or CommitRequestData. // TODO(skym): Call ProcessChanges on SMTP. // TODO(skym): Persist metadata and data. - StoreSpecifics(new_specifics.Pass()); + StoreSpecifics(std::move(new_specifics)); } // Don't call NotifyObservers() because backup time is not part of diff --git a/components/sync_driver/device_info_sync_service.cc b/components/sync_driver/device_info_sync_service.cc index 8005e97..77eaed4 100644 --- a/components/sync_driver/device_info_sync_service.cc +++ b/components/sync_driver/device_info_sync_service.cc @@ -5,6 +5,7 @@ #include "components/sync_driver/device_info_sync_service.h" #include <stddef.h> +#include <utility> #include "base/metrics/histogram_macros.h" #include "base/strings/stringprintf.h" @@ -77,8 +78,8 @@ SyncMergeResult DeviceInfoSyncService::MergeDataAndStartSyncing( DCHECK(!IsSyncing()); - sync_processor_ = sync_processor.Pass(); - error_handler_ = error_handler.Pass(); + sync_processor_ = std::move(sync_processor); + error_handler_ = std::move(error_handler); // Initialization should be completed before this type is enabled // and local device info must be available. @@ -268,7 +269,7 @@ ScopedVector<DeviceInfo> DeviceInfoSyncService::GetAllDeviceInfo() const { list.push_back(CreateDeviceInfo(iter->second)); } - return list.Pass(); + return list; } void DeviceInfoSyncService::AddObserver(Observer* observer) { diff --git a/components/sync_driver/fake_generic_change_processor.cc b/components/sync_driver/fake_generic_change_processor.cc index 599475b..384297d 100644 --- a/components/sync_driver/fake_generic_change_processor.cc +++ b/components/sync_driver/fake_generic_change_processor.cc @@ -4,6 +4,8 @@ #include "components/sync_driver/fake_generic_change_processor.h" +#include <utility> + #include "base/location.h" #include "base/memory/weak_ptr.h" #include "sync/api/syncable_service.h" @@ -67,7 +69,7 @@ bool FakeGenericChangeProcessor::CryptoReadyIfNecessary() { FakeGenericChangeProcessorFactory::FakeGenericChangeProcessorFactory( scoped_ptr<FakeGenericChangeProcessor> processor) - : processor_(processor.Pass()) {} + : processor_(std::move(processor)) {} FakeGenericChangeProcessorFactory::~FakeGenericChangeProcessorFactory() {} @@ -79,7 +81,7 @@ FakeGenericChangeProcessorFactory::CreateGenericChangeProcessor( const base::WeakPtr<syncer::SyncableService>& local_service, const base::WeakPtr<syncer::SyncMergeResult>& merge_result, SyncClient* sync_client) { - return processor_.Pass(); + return std::move(processor_); } } // namespace sync_driver diff --git a/components/sync_driver/generic_change_processor.cc b/components/sync_driver/generic_change_processor.cc index c64aa2f..2df9820 100644 --- a/components/sync_driver/generic_change_processor.cc +++ b/components/sync_driver/generic_change_processor.cc @@ -5,9 +5,9 @@ #include "components/sync_driver/generic_change_processor.h" #include <stddef.h> - #include <algorithm> #include <string> +#include <utility> #include "base/location.h" #include "base/strings/string_number_conversions.h" @@ -118,7 +118,8 @@ GenericChangeProcessor::GenericChangeProcessor( } attachment_service_ = sync_client->GetSyncApiComponentFactory()->CreateAttachmentService( - attachment_store.Pass(), *user_share, store_birthday, type, this); + std::move(attachment_store), *user_share, store_birthday, type, + this); attachment_service_weak_ptr_factory_.reset( new base::WeakPtrFactory<syncer::AttachmentService>( attachment_service_.get())); diff --git a/components/sync_driver/generic_change_processor_factory.cc b/components/sync_driver/generic_change_processor_factory.cc index 14a8359..9ba688f 100644 --- a/components/sync_driver/generic_change_processor_factory.cc +++ b/components/sync_driver/generic_change_processor_factory.cc @@ -24,10 +24,8 @@ GenericChangeProcessorFactory::CreateGenericChangeProcessor( SyncClient* sync_client) { DCHECK(user_share); return make_scoped_ptr(new GenericChangeProcessor( - type, error_handler, local_service, merge_result, - user_share, sync_client, - local_service->GetAttachmentStoreForSync())) - .Pass(); + type, error_handler, local_service, merge_result, user_share, sync_client, + local_service->GetAttachmentStoreForSync())); } } // namespace sync_driver diff --git a/components/sync_driver/generic_change_processor_unittest.cc b/components/sync_driver/generic_change_processor_unittest.cc index 17fd06d..11ad9a3 100644 --- a/components/sync_driver/generic_change_processor_unittest.cc +++ b/components/sync_driver/generic_change_processor_unittest.cc @@ -5,8 +5,8 @@ #include "components/sync_driver/generic_change_processor.h" #include <stddef.h> - #include <string> +#include <utility> #include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" @@ -56,15 +56,14 @@ class MockAttachmentService : public syncer::AttachmentServiceImpl { MockAttachmentService::MockAttachmentService( scoped_ptr<syncer::AttachmentStoreForSync> attachment_store) - : AttachmentServiceImpl(attachment_store.Pass(), + : AttachmentServiceImpl(std::move(attachment_store), scoped_ptr<syncer::AttachmentUploader>( new syncer::FakeAttachmentUploader), scoped_ptr<syncer::AttachmentDownloader>( new syncer::FakeAttachmentDownloader), NULL, base::TimeDelta(), - base::TimeDelta()) { -} + base::TimeDelta()) {} MockAttachmentService::~MockAttachmentService() { } @@ -120,13 +119,13 @@ class MockSyncApiComponentFactory : public SyncApiComponentFactory { syncer::ModelType model_type, syncer::AttachmentService::Delegate* delegate) override { scoped_ptr<MockAttachmentService> attachment_service( - new MockAttachmentService(attachment_store.Pass())); + new MockAttachmentService(std::move(attachment_store))); // GenericChangeProcessor takes ownership of the AttachmentService, but we // need to have a pointer to it so we can see that it was used properly. // Take a pointer and trust that GenericChangeProcessor does not prematurely // destroy it. mock_attachment_service_ = attachment_service.get(); - return attachment_service.Pass(); + return std::move(attachment_service); } MockAttachmentService* GetMockAttachmentService() { diff --git a/components/sync_driver/glue/sync_backend_host_core.cc b/components/sync_driver/glue/sync_backend_host_core.cc index 28e77e0..082e4cc 100644 --- a/components/sync_driver/glue/sync_backend_host_core.cc +++ b/components/sync_driver/glue/sync_backend_host_core.cc @@ -4,6 +4,8 @@ #include "components/sync_driver/glue/sync_backend_host_core.h" +#include <utility> + #include "base/bind.h" #include "base/files/file_util.h" #include "base/location.h" @@ -95,18 +97,18 @@ DoInitializeOptions::DoInitializeOptions( event_handler(event_handler), service_url(service_url), sync_user_agent(sync_user_agent), - http_bridge_factory(http_bridge_factory.Pass()), + http_bridge_factory(std::move(http_bridge_factory)), credentials(credentials), invalidator_client_id(invalidator_client_id), - sync_manager_factory(sync_manager_factory.Pass()), + sync_manager_factory(std::move(sync_manager_factory)), delete_sync_data_folder(delete_sync_data_folder), restored_key_for_bootstrapping(restored_key_for_bootstrapping), restored_keystore_key_for_bootstrapping( restored_keystore_key_for_bootstrapping), - internal_components_factory(internal_components_factory.Pass()), + internal_components_factory(std::move(internal_components_factory)), unrecoverable_error_handler(unrecoverable_error_handler), report_unrecoverable_error_function(report_unrecoverable_error_function), - saved_nigori_state(saved_nigori_state.Pass()), + saved_nigori_state(std::move(saved_nigori_state)), clear_data_option(clear_data_option), invalidation_versions(invalidation_versions) {} @@ -415,7 +417,7 @@ void SyncBackendHostCore::DoOnIncomingInvalidation( } scoped_ptr<syncer::InvalidationInterface> inv_adapter( new InvalidationAdapter(invalidation)); - sync_manager_->OnIncomingInvalidation(type, inv_adapter.Pass()); + sync_manager_->OnIncomingInvalidation(type, std::move(inv_adapter)); if (!invalidation.is_unknown_version()) last_invalidation_versions_[type] = invalidation.version(); } @@ -465,7 +467,7 @@ void SyncBackendHostCore::DoInitialize( args.database_location = sync_data_folder_path_; args.event_handler = options->event_handler; args.service_url = options->service_url; - args.post_factory = options->http_bridge_factory.Pass(); + args.post_factory = std::move(options->http_bridge_factory); args.workers = options->workers; args.extensions_activity = options->extensions_activity.get(); args.change_delegate = options->registrar; // as SyncManager::ChangeDelegate @@ -475,13 +477,13 @@ void SyncBackendHostCore::DoInitialize( args.restored_keystore_key_for_bootstrapping = options->restored_keystore_key_for_bootstrapping; args.internal_components_factory = - options->internal_components_factory.Pass(); + std::move(options->internal_components_factory); args.encryptor = &encryptor_; args.unrecoverable_error_handler = options->unrecoverable_error_handler; args.report_unrecoverable_error_function = options->report_unrecoverable_error_function; args.cancelation_signal = &stop_syncing_signal_; - args.saved_nigori_state = options->saved_nigori_state.Pass(); + args.saved_nigori_state = std::move(options->saved_nigori_state); args.clear_data_option = options->clear_data_option; sync_manager_->Init(&args); } diff --git a/components/sync_driver/glue/sync_backend_host_impl.cc b/components/sync_driver/glue/sync_backend_host_impl.cc index a5e90ff..c222c12 100644 --- a/components/sync_driver/glue/sync_backend_host_impl.cc +++ b/components/sync_driver/glue/sync_backend_host_impl.cc @@ -4,6 +4,8 @@ #include "components/sync_driver/glue/sync_backend_host_impl.h" +#include <utility> + #include "base/command_line.h" #include "base/location.h" #include "base/logging.h" @@ -85,7 +87,7 @@ void SyncBackendHostImpl::Initialize( const HttpPostProviderFactoryGetter& http_post_provider_factory_getter, scoped_ptr<syncer::SyncEncryptionHandler::NigoriState> saved_nigori_state) { registrar_.reset(new browser_sync::SyncBackendRegistrar( - name_, sync_client_, sync_thread.Pass(), ui_thread_, db_thread, + name_, sync_client_, std::move(sync_thread), ui_thread_, db_thread, file_thread)); CHECK(registrar_->sync_thread()); @@ -126,15 +128,14 @@ void SyncBackendHostImpl::Initialize( http_post_provider_factory_getter.Run( core_->GetRequestContextCancelationSignal()), credentials, invalidator_ ? invalidator_->GetInvalidatorClientId() : "", - sync_manager_factory.Pass(), delete_sync_data_folder, + std::move(sync_manager_factory), delete_sync_data_folder, sync_prefs_->GetEncryptionBootstrapToken(), sync_prefs_->GetKeystoreEncryptionBootstrapToken(), scoped_ptr<InternalComponentsFactory>( - new syncer::InternalComponentsFactoryImpl(factory_switches)) - .Pass(), + new syncer::InternalComponentsFactoryImpl(factory_switches)), unrecoverable_error_handler, report_unrecoverable_error_function, - saved_nigori_state.Pass(), clear_data_option, invalidation_versions)); - InitCore(init_opts.Pass()); + std::move(saved_nigori_state), clear_data_option, invalidation_versions)); + InitCore(std::move(init_opts)); } void SyncBackendHostImpl::TriggerRefresh(const syncer::ModelTypeSet& types) { @@ -438,7 +439,7 @@ void SyncBackendHostImpl::DeactivateDirectoryDataType(syncer::ModelType type) { void SyncBackendHostImpl::ActivateNonBlockingDataType( syncer::ModelType type, scoped_ptr<syncer_v2::ActivationContext> activation_context) { - sync_context_proxy_->ConnectTypeToSync(type, activation_context.Pass()); + sync_context_proxy_->ConnectTypeToSync(type, std::move(activation_context)); } void SyncBackendHostImpl::DeactivateNonBlockingDataType( diff --git a/components/sync_driver/glue/sync_backend_host_impl_unittest.cc b/components/sync_driver/glue/sync_backend_host_impl_unittest.cc index d90ff59..0d794aa 100644 --- a/components/sync_driver/glue/sync_backend_host_impl_unittest.cc +++ b/components/sync_driver/glue/sync_backend_host_impl_unittest.cc @@ -5,9 +5,9 @@ #include "components/sync_driver/glue/sync_backend_host_impl.h" #include <stdint.h> - #include <cstddef> #include <map> +#include <utility> #include "base/files/file_util.h" #include "base/files/scoped_temp_dir.h" @@ -234,10 +234,10 @@ class SyncBackendHostTest : public testing::Test { base::ThreadTaskRunnerHandle::Get(), base::ThreadTaskRunnerHandle::Get(), syncer::WeakHandle<syncer::JsEventHandler>(), GURL(std::string()), - std::string(), credentials_, true, fake_manager_factory_.Pass(), + std::string(), credentials_, true, std::move(fake_manager_factory_), MakeWeakHandle(test_unrecoverable_error_handler_.GetWeakPtr()), base::Closure(), http_post_provider_factory_getter, - saved_nigori_state_.Pass()); + std::move(saved_nigori_state_)); base::RunLoop run_loop; base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(FROM_HERE, run_loop.QuitClosure(), diff --git a/components/sync_driver/glue/sync_backend_registrar.cc b/components/sync_driver/glue/sync_backend_registrar.cc index 263224e..0cd87c2 100644 --- a/components/sync_driver/glue/sync_backend_registrar.cc +++ b/components/sync_driver/glue/sync_backend_registrar.cc @@ -5,6 +5,7 @@ #include "components/sync_driver/glue/sync_backend_registrar.h" #include <cstddef> +#include <utility> #include "base/compiler_specific.h" #include "base/logging.h" @@ -30,7 +31,7 @@ SyncBackendRegistrar::SyncBackendRegistrar( DCHECK(ui_thread_->BelongsToCurrentThread()); DCHECK(sync_client_); - sync_thread_ = sync_thread.Pass(); + sync_thread_ = std::move(sync_thread); if (!sync_thread_) { sync_thread_.reset(new base::Thread("Chrome_SyncThread")); base::Thread::Options options; @@ -330,7 +331,7 @@ void SyncBackendRegistrar::RemoveWorker(syncer::ModelSafeGroup group) { } scoped_ptr<base::Thread> SyncBackendRegistrar::ReleaseSyncThread() { - return sync_thread_.Pass(); + return std::move(sync_thread_); } void SyncBackendRegistrar::Shutdown() { diff --git a/components/sync_driver/non_blocking_data_type_controller.cc b/components/sync_driver/non_blocking_data_type_controller.cc index 6760451..4205115c 100644 --- a/components/sync_driver/non_blocking_data_type_controller.cc +++ b/components/sync_driver/non_blocking_data_type_controller.cc @@ -4,6 +4,8 @@ #include "components/sync_driver/non_blocking_data_type_controller.h" +#include <utility> + #include "base/bind.h" #include "base/bind_helpers.h" #include "base/location.h" @@ -88,7 +90,7 @@ void NonBlockingDataTypeController::OnProcessorStarted( if (BelongsToUIThread()) { // Hold on to the activation context until ActivateDataType is called. if (state_ == MODEL_STARTING) { - activation_context_ = activation_context.Pass(); + activation_context_ = std::move(activation_context); } // TODO(stanisc): Figure out if UNRECOVERABLE_ERROR is OK in this case. ConfigureResult result = error.IsSet() ? UNRECOVERABLE_ERROR : OK; @@ -97,7 +99,7 @@ void NonBlockingDataTypeController::OnProcessorStarted( RunOnUIThread( FROM_HERE, base::Bind(&NonBlockingDataTypeController::OnProcessorStarted, this, - error, base::Passed(activation_context.Pass()))); + error, base::Passed(std::move(activation_context)))); } } @@ -119,7 +121,8 @@ void NonBlockingDataTypeController::ActivateDataType( DCHECK(configurer); DCHECK(activation_context_); DCHECK_EQ(RUNNING, state_); - configurer->ActivateNonBlockingDataType(type(), activation_context_.Pass()); + configurer->ActivateNonBlockingDataType(type(), + std::move(activation_context_)); } void NonBlockingDataTypeController::DeactivateDataType( diff --git a/components/sync_driver/non_blocking_data_type_controller_unittest.cc b/components/sync_driver/non_blocking_data_type_controller_unittest.cc index 9d92f44..d098eef 100644 --- a/components/sync_driver/non_blocking_data_type_controller_unittest.cc +++ b/components/sync_driver/non_blocking_data_type_controller_unittest.cc @@ -4,6 +4,8 @@ #include "components/sync_driver/non_blocking_data_type_controller.h" +#include <utility> + #include "base/bind.h" #include "base/callback.h" #include "base/logging.h" @@ -146,7 +148,7 @@ class MockBackendDataTypeConfigurer sync_task_runner_->PostTask( FROM_HERE, base::Bind(&MockSyncBackend::Connect, base::Unretained(backend_), type, - base::Passed(activation_context.Pass()))); + base::Passed(std::move(activation_context)))); } void DeactivateNonBlockingDataType(syncer::ModelType type) override { diff --git a/components/sync_driver/profile_sync_auth_provider.cc b/components/sync_driver/profile_sync_auth_provider.cc index a342871..894a20c 100644 --- a/components/sync_driver/profile_sync_auth_provider.cc +++ b/components/sync_driver/profile_sync_auth_provider.cc @@ -134,5 +134,5 @@ ProfileSyncAuthProvider::CreateProviderForSyncThread() { DCHECK(CalledOnValidThread()); scoped_ptr<syncer::SyncAuthProvider> auth_provider(new SyncThreadProxy( weak_factory_.GetWeakPtr(), base::ThreadTaskRunnerHandle::Get())); - return auth_provider.Pass(); + return auth_provider; } diff --git a/components/sync_driver/profile_sync_auth_provider_unittest.cc b/components/sync_driver/profile_sync_auth_provider_unittest.cc index cb9ea96..0ce1ec8 100644 --- a/components/sync_driver/profile_sync_auth_provider_unittest.cc +++ b/components/sync_driver/profile_sync_auth_provider_unittest.cc @@ -28,7 +28,7 @@ class ProfileSyncAuthProviderTest : public ::testing::Test { token_service_.get(), kAccountId, GaiaConstants::kChromeSyncOAuth2Scope)); auth_provider_backend_ = - auth_provider_frontend_->CreateProviderForSyncThread().Pass(); + auth_provider_frontend_->CreateProviderForSyncThread(); } void RequestTokenFinished(const GoogleServiceAuthError& error, diff --git a/components/sync_driver/shared_change_processor.cc b/components/sync_driver/shared_change_processor.cc index 64cf35a..1854e20 100644 --- a/components/sync_driver/shared_change_processor.cc +++ b/components/sync_driver/shared_change_processor.cc @@ -4,6 +4,8 @@ #include "components/sync_driver/shared_change_processor.h" +#include <utility> + #include "base/thread_task_runner_handle.h" #include "components/sync_driver/generic_change_processor.h" #include "components/sync_driver/generic_change_processor_factory.h" @@ -82,7 +84,7 @@ base::WeakPtr<syncer::SyncableService> SharedChangeProcessor::Connect( scoped_ptr<syncer::AttachmentService> attachment_service = generic_change_processor_->GetAttachmentService(); if (attachment_service) { - local_service->SetAttachmentService(attachment_service.Pass()); + local_service->SetAttachmentService(std::move(attachment_service)); } return local_service; } diff --git a/components/sync_driver/sync_api_component_factory_mock.cc b/components/sync_driver/sync_api_component_factory_mock.cc index f71e1b2..81a3c5b 100644 --- a/components/sync_driver/sync_api_component_factory_mock.cc +++ b/components/sync_driver/sync_api_component_factory_mock.cc @@ -4,6 +4,8 @@ #include "components/sync_driver/sync_api_component_factory_mock.h" +#include <utility> + #include "components/sync_driver/change_processor.h" #include "components/sync_driver/local_device_info_provider_mock.h" #include "components/sync_driver/model_associator.h" @@ -52,10 +54,10 @@ SyncApiComponentFactoryMock::MakeSyncComponents() { scoped_ptr<sync_driver::LocalDeviceInfoProvider> SyncApiComponentFactoryMock::CreateLocalDeviceInfoProvider() { - return local_device_.Pass(); + return std::move(local_device_); } void SyncApiComponentFactoryMock::SetLocalDeviceInfoProvider( scoped_ptr<sync_driver::LocalDeviceInfoProvider> local_device) { - local_device_ = local_device.Pass(); + local_device_ = std::move(local_device); } diff --git a/components/sync_driver/ui_data_type_controller.cc b/components/sync_driver/ui_data_type_controller.cc index f0f92d2..bf4101f 100644 --- a/components/sync_driver/ui_data_type_controller.cc +++ b/components/sync_driver/ui_data_type_controller.cc @@ -4,6 +4,8 @@ #include "components/sync_driver/ui_data_type_controller.h" +#include <utility> + #include "base/location.h" #include "base/logging.h" #include "base/memory/weak_ptr.h" @@ -47,7 +49,7 @@ UIDataTypeController::UIDataTypeController( void UIDataTypeController::SetGenericChangeProcessorFactoryForTest( scoped_ptr<GenericChangeProcessorFactory> factory) { DCHECK_EQ(state_, NOT_RUNNING); - processor_factory_ = factory.Pass(); + processor_factory_ = std::move(factory); } UIDataTypeController::~UIDataTypeController() { diff --git a/components/sync_driver/ui_data_type_controller_unittest.cc b/components/sync_driver/ui_data_type_controller_unittest.cc index 59164fa..577847f 100644 --- a/components/sync_driver/ui_data_type_controller_unittest.cc +++ b/components/sync_driver/ui_data_type_controller_unittest.cc @@ -4,6 +4,8 @@ #include "components/sync_driver/ui_data_type_controller.h" +#include <utility> + #include "base/bind.h" #include "base/location.h" #include "base/memory/scoped_ptr.h" @@ -62,8 +64,8 @@ class SyncUIDataTypeControllerTest : public testing::Test, new FakeGenericChangeProcessor(type_, this)); change_processor_ = p.get(); scoped_ptr<GenericChangeProcessorFactory> f( - new FakeGenericChangeProcessorFactory(p.Pass())); - preference_dtc_->SetGenericChangeProcessorFactoryForTest(f.Pass()); + new FakeGenericChangeProcessorFactory(std::move(p))); + preference_dtc_->SetGenericChangeProcessorFactoryForTest(std::move(f)); EXPECT_CALL(model_load_callback_, Run(_, _)); } diff --git a/components/sync_sessions/favicon_cache.cc b/components/sync_sessions/favicon_cache.cc index 3055a24..6f62971 100644 --- a/components/sync_sessions/favicon_cache.cc +++ b/components/sync_sessions/favicon_cache.cc @@ -4,6 +4,8 @@ #include "components/sync_sessions/favicon_cache.h" +#include <utility> + #include "base/location.h" #include "base/macros.h" #include "base/metrics/histogram.h" @@ -243,9 +245,9 @@ syncer::SyncMergeResult FaviconCache::MergeDataAndStartSyncing( scoped_ptr<syncer::SyncErrorFactory> error_handler) { DCHECK(type == syncer::FAVICON_IMAGES || type == syncer::FAVICON_TRACKING); if (type == syncer::FAVICON_IMAGES) - favicon_images_sync_processor_ = sync_processor.Pass(); + favicon_images_sync_processor_ = std::move(sync_processor); else - favicon_tracking_sync_processor_ = sync_processor.Pass(); + favicon_tracking_sync_processor_ = std::move(sync_processor); syncer::SyncMergeResult merge_result(type); merge_result.set_num_items_before_association(synced_favicons_.size()); diff --git a/components/sync_sessions/revisit/bookmarks_page_revisit_observer.cc b/components/sync_sessions/revisit/bookmarks_page_revisit_observer.cc index ac64731..20b44c9 100644 --- a/components/sync_sessions/revisit/bookmarks_page_revisit_observer.cc +++ b/components/sync_sessions/revisit/bookmarks_page_revisit_observer.cc @@ -5,6 +5,7 @@ #include "components/sync_sessions/revisit/bookmarks_page_revisit_observer.h" #include <algorithm> +#include <utility> #include "base/metrics/histogram_macros.h" #include "base/time/time.h" @@ -16,7 +17,7 @@ namespace sync_sessions { BookmarksPageRevisitObserver::BookmarksPageRevisitObserver( scoped_ptr<BookmarksByUrlProvider> provider) - : provider_(provider.Pass()) {} + : provider_(std::move(provider)) {} BookmarksPageRevisitObserver::~BookmarksPageRevisitObserver() {} diff --git a/components/sync_sessions/revisit/sessions_page_revisit_observer.cc b/components/sync_sessions/revisit/sessions_page_revisit_observer.cc index 8a4c7b3..36a9a6c 100644 --- a/components/sync_sessions/revisit/sessions_page_revisit_observer.cc +++ b/components/sync_sessions/revisit/sessions_page_revisit_observer.cc @@ -20,7 +20,7 @@ namespace sync_sessions { SessionsPageRevisitObserver::SessionsPageRevisitObserver( scoped_ptr<ForeignSessionsProvider> provider) - : provider_(provider.Pass()) {} + : provider_(std::move(provider)) {} SessionsPageRevisitObserver::~SessionsPageRevisitObserver() {} diff --git a/components/sync_sessions/sessions_sync_manager.cc b/components/sync_sessions/sessions_sync_manager.cc index 48ab5ed..0b9eb7e 100644 --- a/components/sync_sessions/sessions_sync_manager.cc +++ b/components/sync_sessions/sessions_sync_manager.cc @@ -5,6 +5,7 @@ #include "components/sync_sessions/sessions_sync_manager.h" #include <algorithm> +#include <utility> #include "base/metrics/field_trial.h" #include "build/build_config.h" @@ -79,11 +80,10 @@ SessionsSyncManager::SessionsSyncManager( local_device_(local_device), local_session_header_node_id_(TabNodePool::kInvalidTabNodeID), stale_session_threshold_days_(kDefaultStaleSessionThresholdDays), - local_event_router_(router.Pass()), + local_event_router_(std::move(router)), page_revisit_broadcaster_(this, sessions_client), sessions_updated_callback_(sessions_updated_callback), - datatype_refresh_callback_(datatype_refresh_callback) { -} + datatype_refresh_callback_(datatype_refresh_callback) {} SessionsSyncManager::~SessionsSyncManager() {} @@ -104,8 +104,8 @@ syncer::SyncMergeResult SessionsSyncManager::MergeDataAndStartSyncing( DCHECK(session_tracker_.Empty()); DCHECK_EQ(0U, local_tab_pool_.Capacity()); - error_handler_ = error_handler.Pass(); - sync_processor_ = sync_processor.Pass(); + error_handler_ = std::move(error_handler); + sync_processor_ = std::move(sync_processor); local_session_header_node_id_ = TabNodePool::kInvalidTabNodeID; @@ -351,12 +351,12 @@ void SessionsSyncManager::AssociateTab(SyncedTabDelegate* const tab, void SessionsSyncManager::RebuildAssociations() { syncer::SyncDataList data(sync_processor_->GetAllSyncData(syncer::SESSIONS)); - scoped_ptr<syncer::SyncErrorFactory> error_handler(error_handler_.Pass()); - scoped_ptr<syncer::SyncChangeProcessor> processor(sync_processor_.Pass()); + scoped_ptr<syncer::SyncErrorFactory> error_handler(std::move(error_handler_)); + scoped_ptr<syncer::SyncChangeProcessor> processor(std::move(sync_processor_)); StopSyncing(syncer::SESSIONS); - MergeDataAndStartSyncing(syncer::SESSIONS, data, processor.Pass(), - error_handler.Pass()); + MergeDataAndStartSyncing(syncer::SESSIONS, data, std::move(processor), + std::move(error_handler)); } bool SessionsSyncManager::IsValidSessionHeader( diff --git a/components/syncable_prefs/pref_model_associator.cc b/components/syncable_prefs/pref_model_associator.cc index a78c973..dc7251f 100644 --- a/components/syncable_prefs/pref_model_associator.cc +++ b/components/syncable_prefs/pref_model_associator.cc @@ -4,6 +4,8 @@ #include "components/syncable_prefs/pref_model_associator.h" +#include <utility> + #include "base/auto_reset.h" #include "base/json/json_reader.h" #include "base/json/json_string_value_serializer.h" @@ -165,8 +167,8 @@ syncer::SyncMergeResult PrefModelAssociator::MergeDataAndStartSyncing( DCHECK(sync_processor.get()); DCHECK(sync_error_factory.get()); syncer::SyncMergeResult merge_result(type); - sync_processor_ = sync_processor.Pass(); - sync_error_factory_ = sync_error_factory.Pass(); + sync_processor_ = std::move(sync_processor); + sync_error_factory_ = std::move(sync_error_factory); syncer::SyncChangeList new_changes; std::set<std::string> remaining_preferences = registered_preferences_; diff --git a/components/syncable_prefs/pref_service_syncable_factory.cc b/components/syncable_prefs/pref_service_syncable_factory.cc index a21c2e7..381c612 100644 --- a/components/syncable_prefs/pref_service_syncable_factory.cc +++ b/components/syncable_prefs/pref_service_syncable_factory.cc @@ -67,7 +67,7 @@ scoped_ptr<PrefServiceSyncable> PrefServiceSyncableFactory::CreateSyncable( pref_model_associator_client_, read_error_callback_, async_)); - return pref_service.Pass(); + return pref_service; } } // namespace syncable_prefs diff --git a/components/syncable_prefs/pref_service_syncable_unittest.cc b/components/syncable_prefs/pref_service_syncable_unittest.cc index cc173d1..6cde739 100644 --- a/components/syncable_prefs/pref_service_syncable_unittest.cc +++ b/components/syncable_prefs/pref_service_syncable_unittest.cc @@ -263,7 +263,7 @@ TEST_F(PrefServiceSyncableTest, ModelAssociationEmptyCloud) { scoped_ptr<base::Value> value(FindValue(kStringPrefName, out)); ASSERT_TRUE(value.get()); EXPECT_TRUE(GetPreferenceValue(kStringPrefName).Equals(value.get())); - value = FindValue(kListPrefName, out).Pass(); + value = FindValue(kListPrefName, out); ASSERT_TRUE(value.get()); EXPECT_TRUE(GetPreferenceValue(kListPrefName).Equals(value.get())); } diff --git a/components/test_runner/test_plugin.cc b/components/test_runner/test_plugin.cc index f26ebe2..f57c5b7 100644 --- a/components/test_runner/test_plugin.cc +++ b/components/test_runner/test_plugin.cc @@ -6,6 +6,7 @@ #include <stddef.h> #include <stdint.h> +#include <utility> #include "base/bind.h" #include "base/logging.h" @@ -132,7 +133,8 @@ blink::WebPluginContainer::TouchEventRequestType ParseTouchEventRequestType( class DeferredDeleteTask : public blink::WebTaskRunner::Task { public: - DeferredDeleteTask(scoped_ptr<TestPlugin> plugin) : plugin_(plugin.Pass()) {} + DeferredDeleteTask(scoped_ptr<TestPlugin> plugin) + : plugin_(std::move(plugin)) {} void run() override {} @@ -305,7 +307,7 @@ void TestPlugin::updateGeometry( DrawSceneSoftware(bitmap->pixels()); texture_mailbox_ = cc::TextureMailbox( bitmap.get(), gfx::Size(rect_.width, rect_.height)); - shared_bitmap_ = bitmap.Pass(); + shared_bitmap_ = std::move(bitmap); } } diff --git a/components/test_runner/test_runner.cc b/components/test_runner/test_runner.cc index e7743fd..ce011c0 100644 --- a/components/test_runner/test_runner.cc +++ b/components/test_runner/test_runner.cc @@ -5,8 +5,8 @@ #include "components/test_runner/test_runner.h" #include <stddef.h> - #include <limits> +#include <utility> #include "base/logging.h" #include "base/macros.h" @@ -3044,7 +3044,7 @@ void TestRunner::CopyImageAtAndCapturePixelsAsyncThen( void TestRunner::GetManifestCallback(scoped_ptr<InvokeCallbackTask> task, const blink::WebURLResponse& response, const std::string& data) { - InvokeCallback(task.Pass()); + InvokeCallback(std::move(task)); } void TestRunner::CapturePixelsCallback(scoped_ptr<InvokeCallbackTask> task, @@ -3088,7 +3088,7 @@ void TestRunner::CapturePixelsCallback(scoped_ptr<InvokeCallbackTask> task, &buffer, context->Global(), isolate); task->SetArguments(3, argv); - InvokeCallback(task.Pass()); + InvokeCallback(std::move(task)); } void TestRunner::DispatchBeforeInstallPromptCallback( @@ -3107,7 +3107,7 @@ void TestRunner::DispatchBeforeInstallPromptCallback( argv[0] = v8::Boolean::New(isolate, canceled); task->SetArguments(1, argv); - InvokeCallback(task.Pass()); + InvokeCallback(std::move(task)); } void TestRunner::GetBluetoothManualChooserEventsCallback( @@ -3129,7 +3129,7 @@ void TestRunner::GetBluetoothManualChooserEventsCallback( // Call the callback. task->SetArguments(1, arg); - InvokeCallback(task.Pass()); + InvokeCallback(std::move(task)); } void TestRunner::LocationChangeDone() { diff --git a/components/test_runner/web_test_interfaces.cc b/components/test_runner/web_test_interfaces.cc index ca8aabd..120b57e 100644 --- a/components/test_runner/web_test_interfaces.cc +++ b/components/test_runner/web_test_interfaces.cc @@ -4,6 +4,8 @@ #include "components/test_runner/web_test_interfaces.h" +#include <utility> + #include "components/test_runner/app_banner_client.h" #include "components/test_runner/mock_web_audio_device.h" #include "components/test_runner/mock_web_media_stream_center.h" @@ -83,7 +85,7 @@ scoped_ptr<blink::WebAppBannerClient> WebTestInterfaces::CreateAppBannerClient() { scoped_ptr<AppBannerClient> client(new AppBannerClient); interfaces_->SetAppBannerClient(client.get()); - return client.Pass(); + return std::move(client); } AppBannerClient* WebTestInterfaces::GetAppBannerClient() { diff --git a/components/translate/content/renderer/data_file_renderer_cld_data_provider.cc b/components/translate/content/renderer/data_file_renderer_cld_data_provider.cc index 6bfb46e..d05f3f1 100644 --- a/components/translate/content/renderer/data_file_renderer_cld_data_provider.cc +++ b/components/translate/content/renderer/data_file_renderer_cld_data_provider.cc @@ -6,7 +6,9 @@ // This code isn't dead, even if it isn't currently being used. Please refer to: // https://www.chromium.org/developers/how-tos/compact-language-detector-cld-data-source-configuration -#include "data_file_renderer_cld_data_provider.h" +#include "components/translate/content/renderer/data_file_renderer_cld_data_provider.h" + +#include <utility> #include "base/files/file.h" #include "base/files/memory_mapped_file.h" @@ -92,7 +94,7 @@ void DataFileRendererCldDataProvider::LoadCldData(base::File file, // mmap the file g_cld_mmap.Get().value = new base::MemoryMappedFile(); - bool initialized = g_cld_mmap.Get().value->Initialize(file.Pass()); + bool initialized = g_cld_mmap.Get().value->Initialize(std::move(file)); if (!initialized) { LOG(ERROR) << "mmap initialization failed"; delete g_cld_mmap.Get().value; diff --git a/components/translate/core/browser/translate_ui_delegate.cc b/components/translate/core/browser/translate_ui_delegate.cc index 3896565..39af5b81 100644 --- a/components/translate/core/browser/translate_ui_delegate.cc +++ b/components/translate/core/browser/translate_ui_delegate.cc @@ -40,7 +40,7 @@ scoped_ptr<icu::Collator> CreateCollator(const std::string& locale) { if (!collator || !U_SUCCESS(error)) return nullptr; collator->setStrength(icu::Collator::PRIMARY); - return collator.Pass(); + return collator; } } // namespace diff --git a/components/undo/bookmark_undo_service.cc b/components/undo/bookmark_undo_service.cc index b6bbeac..cdac524 100644 --- a/components/undo/bookmark_undo_service.cc +++ b/components/undo/bookmark_undo_service.cc @@ -6,6 +6,7 @@ #include <stddef.h> #include <stdint.h> +#include <utility> #include "base/macros.h" #include "components/bookmarks/browser/bookmark_model.h" @@ -126,8 +127,7 @@ BookmarkRemoveOperation::BookmarkRemoveOperation( undo_provider_(undo_provider), parent_node_id_(parent->id()), index_(index), - node_(node.Pass()) { -} + node_(std::move(node)) {} BookmarkRemoveOperation::~BookmarkRemoveOperation() { } @@ -139,7 +139,7 @@ void BookmarkRemoveOperation::Undo() { bookmark_model(), parent_node_id_); DCHECK(parent); - undo_provider_->RestoreRemovedNode(parent, index_, node_.Pass()); + undo_provider_->RestoreRemovedNode(parent, index_, std::move(node_)); } int BookmarkRemoveOperation::GetUndoLabelId() const { @@ -366,7 +366,7 @@ void BookmarkUndoService::BookmarkNodeMoved(BookmarkModel* model, int new_index) { scoped_ptr<UndoOperation> op(new BookmarkMoveOperation( model, old_parent, old_index, new_parent, new_index)); - undo_manager()->AddUndoOperation(op.Pass()); + undo_manager()->AddUndoOperation(std::move(op)); } void BookmarkUndoService::BookmarkNodeAdded(BookmarkModel* model, @@ -374,19 +374,19 @@ void BookmarkUndoService::BookmarkNodeAdded(BookmarkModel* model, int index) { scoped_ptr<UndoOperation> op( new BookmarkAddOperation(model, parent, index)); - undo_manager()->AddUndoOperation(op.Pass()); + undo_manager()->AddUndoOperation(std::move(op)); } void BookmarkUndoService::OnWillChangeBookmarkNode(BookmarkModel* model, const BookmarkNode* node) { scoped_ptr<UndoOperation> op(new BookmarkEditOperation(model, node)); - undo_manager()->AddUndoOperation(op.Pass()); + undo_manager()->AddUndoOperation(std::move(op)); } void BookmarkUndoService::OnWillReorderBookmarkNode(BookmarkModel* model, const BookmarkNode* node) { scoped_ptr<UndoOperation> op(new BookmarkReorderOperation(model, node)); - undo_manager()->AddUndoOperation(op.Pass()); + undo_manager()->AddUndoOperation(std::move(op)); } void BookmarkUndoService::GroupedBookmarkChangesBeginning( @@ -408,6 +408,6 @@ void BookmarkUndoService::OnBookmarkNodeRemoved(BookmarkModel* model, scoped_ptr<BookmarkNode> node) { DCHECK(undo_provider_); scoped_ptr<UndoOperation> op(new BookmarkRemoveOperation( - model, undo_provider_, parent, index, node.Pass())); - undo_manager()->AddUndoOperation(op.Pass()); + model, undo_provider_, parent, index, std::move(node))); + undo_manager()->AddUndoOperation(std::move(op)); } diff --git a/components/undo/undo_manager.cc b/components/undo/undo_manager.cc index 28a8ab2..e27e948 100644 --- a/components/undo/undo_manager.cc +++ b/components/undo/undo_manager.cc @@ -4,6 +4,8 @@ #include "components/undo/undo_manager.h" +#include <utility> + #include "base/auto_reset.h" #include "base/logging.h" #include "components/undo/undo_manager_observer.h" @@ -88,10 +90,10 @@ void UndoManager::AddUndoOperation(scoped_ptr<UndoOperation> operation) { } if (group_actions_count_) { - pending_grouped_action_->AddOperation(operation.Pass()); + pending_grouped_action_->AddOperation(std::move(operation)); } else { UndoGroup* new_action = new UndoGroup(); - new_action->AddOperation(operation.Pass()); + new_action->AddOperation(std::move(operation)); AddUndoGroup(new_action); } } diff --git a/components/update_client/action_update_check.cc b/components/update_client/action_update_check.cc index 1f14229..deb250f 100644 --- a/components/update_client/action_update_check.cc +++ b/components/update_client/action_update_check.cc @@ -5,6 +5,7 @@ #include "components/update_client/action_update_check.h" #include <stddef.h> +#include <utility> #include "base/bind.h" #include "base/bind_helpers.h" @@ -39,10 +40,9 @@ ActionUpdateCheck::ActionUpdateCheck( scoped_ptr<UpdateChecker> update_checker, const base::Version& browser_version, const std::string& extra_request_parameters) - : update_checker_(update_checker.Pass()), + : update_checker_(std::move(update_checker)), browser_version_(browser_version), - extra_request_parameters_(extra_request_parameters) { -} + extra_request_parameters_(extra_request_parameters) {} ActionUpdateCheck::~ActionUpdateCheck() { DCHECK(thread_checker_.CalledOnValidThread()); diff --git a/components/update_client/component_unpacker.cc b/components/update_client/component_unpacker.cc index 78d678e..b525b4e 100644 --- a/components/update_client/component_unpacker.cc +++ b/components/update_client/component_unpacker.cc @@ -70,7 +70,7 @@ scoped_ptr<base::DictionaryValue> ReadManifest( if (!root->IsType(base::Value::TYPE_DICTIONARY)) return scoped_ptr<base::DictionaryValue>(); return scoped_ptr<base::DictionaryValue>( - static_cast<base::DictionaryValue*>(root.release())).Pass(); + static_cast<base::DictionaryValue*>(root.release())); } bool ComponentUnpacker::UnpackInternal() { diff --git a/components/update_client/crx_downloader.cc b/components/update_client/crx_downloader.cc index 6a0b142..84f7210 100644 --- a/components/update_client/crx_downloader.cc +++ b/components/update_client/crx_downloader.cc @@ -4,6 +4,8 @@ #include "components/update_client/crx_downloader.h" +#include <utility> + #include "base/bind.h" #include "base/location.h" #include "base/logging.h" @@ -38,7 +40,7 @@ scoped_ptr<CrxDownloader> CrxDownloader::Create( const scoped_refptr<base::SequencedTaskRunner>& task_runner) { scoped_ptr<CrxDownloader> url_fetcher_downloader( scoped_ptr<CrxDownloader>(new UrlFetcherDownloader( - scoped_ptr<CrxDownloader>().Pass(), context_getter, task_runner))); + scoped_ptr<CrxDownloader>(), context_getter, task_runner))); #if defined(OS_WIN) if (is_background_download) { return scoped_ptr<CrxDownloader>(new BackgroundDownloader( @@ -50,8 +52,7 @@ scoped_ptr<CrxDownloader> CrxDownloader::Create( } CrxDownloader::CrxDownloader(scoped_ptr<CrxDownloader> successor) - : successor_(successor.Pass()) { -} + : successor_(std::move(successor)) {} CrxDownloader::~CrxDownloader() { } diff --git a/components/update_client/update_checker_unittest.cc b/components/update_client/update_checker_unittest.cc index 0bea798..f45eb3d 100644 --- a/components/update_client/update_checker_unittest.cc +++ b/components/update_client/update_checker_unittest.cc @@ -166,7 +166,7 @@ TEST_F(UpdateCheckerTest, UpdateCheckSuccess) { EXPECT_TRUE(post_interceptor_->ExpectRequest( new PartialMatch("updatecheck"), test_file("updatecheck_reply_1.xml"))); - update_checker_ = UpdateChecker::Create(*config_).Pass(); + update_checker_ = UpdateChecker::Create(*config_); CrxUpdateItem item(BuildCrxUpdateItem()); std::vector<CrxUpdateItem*> items_to_check; @@ -212,7 +212,7 @@ TEST_F(UpdateCheckerTest, UpdateCheckError) { EXPECT_TRUE( post_interceptor_->ExpectRequest(new PartialMatch("updatecheck"), 403)); - update_checker_ = UpdateChecker::Create(*config_).Pass(); + update_checker_ = UpdateChecker::Create(*config_); CrxUpdateItem item(BuildCrxUpdateItem()); std::vector<CrxUpdateItem*> items_to_check; diff --git a/components/update_client/update_client.cc b/components/update_client/update_client.cc index 497fedb..fd524e0 100644 --- a/components/update_client/update_client.cc +++ b/components/update_client/update_client.cc @@ -70,7 +70,7 @@ UpdateClientImpl::UpdateClientImpl( CrxDownloader::Factory crx_downloader_factory) : is_stopped_(false), config_(config), - ping_manager_(ping_manager.Pass()), + ping_manager_(std::move(ping_manager)), update_engine_( new UpdateEngine(config, update_checker_factory, @@ -109,7 +109,7 @@ void UpdateClientImpl::Install(const std::string& id, crx_data_callback, callback)); // Install tasks are run concurrently and never queued up. - RunTask(task.Pass()); + RunTask(std::move(task)); } void UpdateClientImpl::Update(const std::vector<std::string>& ids, @@ -125,7 +125,7 @@ void UpdateClientImpl::Update(const std::vector<std::string>& ids, // If no other tasks are running at the moment, run this update task. // Otherwise, queue the task up. if (tasks_.empty()) { - RunTask(task.Pass()); + RunTask(std::move(task)); } else { task_queue_.push(task.release()); } @@ -162,7 +162,7 @@ void UpdateClientImpl::OnTaskComplete( // Pick up a task from the queue if the queue has pending tasks and no other // task is running. if (tasks_.empty() && !task_queue_.empty()) { - RunTask(scoped_ptr<Task>(task_queue_.front()).Pass()); + RunTask(scoped_ptr<Task>(task_queue_.front())); task_queue_.pop(); } } @@ -229,7 +229,7 @@ void UpdateClientImpl::Stop() { scoped_refptr<UpdateClient> UpdateClientFactory( const scoped_refptr<Configurator>& config) { scoped_ptr<PingManager> ping_manager(new PingManager(*config)); - return new UpdateClientImpl(config, ping_manager.Pass(), + return new UpdateClientImpl(config, std::move(ping_manager), &UpdateChecker::Create, &CrxDownloader::Create); } diff --git a/components/update_client/update_client_unittest.cc b/components/update_client/update_client_unittest.cc index d2194c4..06171d68 100644 --- a/components/update_client/update_client_unittest.cc +++ b/components/update_client/update_client_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_path.h" @@ -240,7 +242,7 @@ TEST_F(UpdateClientTest, OneCrxNoUpdate) { } private: - FakeCrxDownloader() : CrxDownloader(scoped_ptr<CrxDownloader>().Pass()) {} + FakeCrxDownloader() : CrxDownloader(scoped_ptr<CrxDownloader>()) {} ~FakeCrxDownloader() override {} void DoStartDownload(const GURL& url) override { EXPECT_TRUE(false); } @@ -255,7 +257,7 @@ TEST_F(UpdateClientTest, OneCrxNoUpdate) { scoped_ptr<PingManager> ping_manager(new FakePingManager(*config())); scoped_refptr<UpdateClient> update_client(new UpdateClientImpl( - config(), ping_manager.Pass(), &FakeUpdateChecker::Create, + config(), std::move(ping_manager), &FakeUpdateChecker::Create, &FakeCrxDownloader::Create)); // Verify that calling Update does not set ondemand. @@ -376,7 +378,7 @@ TEST_F(UpdateClientTest, TwoCrxUpdateNoUpdate) { } private: - FakeCrxDownloader() : CrxDownloader(scoped_ptr<CrxDownloader>().Pass()) {} + FakeCrxDownloader() : CrxDownloader(scoped_ptr<CrxDownloader>()) {} ~FakeCrxDownloader() override {} void DoStartDownload(const GURL& url) override { @@ -426,7 +428,7 @@ TEST_F(UpdateClientTest, TwoCrxUpdateNoUpdate) { scoped_ptr<PingManager> ping_manager(new FakePingManager(*config())); scoped_refptr<UpdateClient> update_client(new UpdateClientImpl( - config(), ping_manager.Pass(), &FakeUpdateChecker::Create, + config(), std::move(ping_manager), &FakeUpdateChecker::Create, &FakeCrxDownloader::Create)); MockObserver observer; @@ -579,7 +581,7 @@ TEST_F(UpdateClientTest, TwoCrxUpdate) { } private: - FakeCrxDownloader() : CrxDownloader(scoped_ptr<CrxDownloader>().Pass()) {} + FakeCrxDownloader() : CrxDownloader(scoped_ptr<CrxDownloader>()) {} ~FakeCrxDownloader() override {} void DoStartDownload(const GURL& url) override { @@ -654,7 +656,7 @@ TEST_F(UpdateClientTest, TwoCrxUpdate) { scoped_ptr<FakePingManager> ping_manager(new FakePingManager(*config())); scoped_refptr<UpdateClient> update_client(new UpdateClientImpl( - config(), ping_manager.Pass(), &FakeUpdateChecker::Create, + config(), std::move(ping_manager), &FakeUpdateChecker::Create, &FakeCrxDownloader::Create)); MockObserver observer; @@ -817,7 +819,7 @@ TEST_F(UpdateClientTest, TwoCrxUpdateDownloadTimeout) { } private: - FakeCrxDownloader() : CrxDownloader(scoped_ptr<CrxDownloader>().Pass()) {} + FakeCrxDownloader() : CrxDownloader(scoped_ptr<CrxDownloader>()) {} ~FakeCrxDownloader() override {} void DoStartDownload(const GURL& url) override { @@ -892,7 +894,7 @@ TEST_F(UpdateClientTest, TwoCrxUpdateDownloadTimeout) { scoped_ptr<FakePingManager> ping_manager(new FakePingManager(*config())); scoped_refptr<UpdateClient> update_client(new UpdateClientImpl( - config(), ping_manager.Pass(), &FakeUpdateChecker::Create, + config(), std::move(ping_manager), &FakeUpdateChecker::Create, &FakeCrxDownloader::Create)); MockObserver observer; @@ -1075,7 +1077,7 @@ TEST_F(UpdateClientTest, OneCrxDiffUpdate) { } private: - FakeCrxDownloader() : CrxDownloader(scoped_ptr<CrxDownloader>().Pass()) {} + FakeCrxDownloader() : CrxDownloader(scoped_ptr<CrxDownloader>()) {} ~FakeCrxDownloader() override {} void DoStartDownload(const GURL& url) override { @@ -1150,7 +1152,7 @@ TEST_F(UpdateClientTest, OneCrxDiffUpdate) { scoped_ptr<FakePingManager> ping_manager(new FakePingManager(*config())); scoped_refptr<UpdateClient> update_client(new UpdateClientImpl( - config(), ping_manager.Pass(), &FakeUpdateChecker::Create, + config(), std::move(ping_manager), &FakeUpdateChecker::Create, &FakeCrxDownloader::Create)); MockObserver observer; @@ -1312,7 +1314,7 @@ TEST_F(UpdateClientTest, OneCrxInstallError) { } private: - FakeCrxDownloader() : CrxDownloader(scoped_ptr<CrxDownloader>().Pass()) {} + FakeCrxDownloader() : CrxDownloader(scoped_ptr<CrxDownloader>()) {} ~FakeCrxDownloader() override {} void DoStartDownload(const GURL& url) override { @@ -1362,7 +1364,7 @@ TEST_F(UpdateClientTest, OneCrxInstallError) { scoped_ptr<PingManager> ping_manager(new FakePingManager(*config())); scoped_refptr<UpdateClient> update_client(new UpdateClientImpl( - config(), ping_manager.Pass(), &FakeUpdateChecker::Create, + config(), std::move(ping_manager), &FakeUpdateChecker::Create, &FakeCrxDownloader::Create)); MockObserver observer; @@ -1531,7 +1533,7 @@ TEST_F(UpdateClientTest, OneCrxDiffUpdateFailsFullUpdateSucceeds) { } private: - FakeCrxDownloader() : CrxDownloader(scoped_ptr<CrxDownloader>().Pass()) {} + FakeCrxDownloader() : CrxDownloader(scoped_ptr<CrxDownloader>()) {} ~FakeCrxDownloader() override {} void DoStartDownload(const GURL& url) override { @@ -1622,7 +1624,7 @@ TEST_F(UpdateClientTest, OneCrxDiffUpdateFailsFullUpdateSucceeds) { scoped_ptr<FakePingManager> ping_manager(new FakePingManager(*config())); scoped_refptr<UpdateClient> update_client(new UpdateClientImpl( - config(), ping_manager.Pass(), &FakeUpdateChecker::Create, + config(), std::move(ping_manager), &FakeUpdateChecker::Create, &FakeCrxDownloader::Create)); MockObserver observer; @@ -1735,7 +1737,7 @@ TEST_F(UpdateClientTest, OneCrxNoUpdateQueuedCall) { } private: - FakeCrxDownloader() : CrxDownloader(scoped_ptr<CrxDownloader>().Pass()) {} + FakeCrxDownloader() : CrxDownloader(scoped_ptr<CrxDownloader>()) {} ~FakeCrxDownloader() override {} void DoStartDownload(const GURL& url) override { EXPECT_TRUE(false); } @@ -1750,7 +1752,7 @@ TEST_F(UpdateClientTest, OneCrxNoUpdateQueuedCall) { scoped_ptr<PingManager> ping_manager(new FakePingManager(*config())); scoped_refptr<UpdateClient> update_client(new UpdateClientImpl( - config(), ping_manager.Pass(), &FakeUpdateChecker::Create, + config(), std::move(ping_manager), &FakeUpdateChecker::Create, &FakeCrxDownloader::Create)); MockObserver observer; @@ -1864,7 +1866,7 @@ TEST_F(UpdateClientTest, OneCrxInstall) { } private: - FakeCrxDownloader() : CrxDownloader(scoped_ptr<CrxDownloader>().Pass()) {} + FakeCrxDownloader() : CrxDownloader(scoped_ptr<CrxDownloader>()) {} ~FakeCrxDownloader() override {} void DoStartDownload(const GURL& url) override { @@ -1918,7 +1920,7 @@ TEST_F(UpdateClientTest, OneCrxInstall) { scoped_ptr<FakePingManager> ping_manager(new FakePingManager(*config())); scoped_refptr<UpdateClient> update_client(new UpdateClientImpl( - config(), ping_manager.Pass(), &FakeUpdateChecker::Create, + config(), std::move(ping_manager), &FakeUpdateChecker::Create, &FakeCrxDownloader::Create)); // Verify that calling Install sets ondemand. @@ -2015,7 +2017,7 @@ TEST_F(UpdateClientTest, ConcurrentInstallSameCRX) { } private: - FakeCrxDownloader() : CrxDownloader(scoped_ptr<CrxDownloader>().Pass()) {} + FakeCrxDownloader() : CrxDownloader(scoped_ptr<CrxDownloader>()) {} ~FakeCrxDownloader() override {} void DoStartDownload(const GURL& url) override { EXPECT_TRUE(false); } @@ -2030,7 +2032,7 @@ TEST_F(UpdateClientTest, ConcurrentInstallSameCRX) { scoped_ptr<FakePingManager> ping_manager(new FakePingManager(*config())); scoped_refptr<UpdateClient> update_client(new UpdateClientImpl( - config(), ping_manager.Pass(), &FakeUpdateChecker::Create, + config(), std::move(ping_manager), &FakeUpdateChecker::Create, &FakeCrxDownloader::Create)); // Verify that calling Install sets ondemand. @@ -2104,7 +2106,7 @@ TEST_F(UpdateClientTest, EmptyIdList) { } private: - FakeCrxDownloader() : CrxDownloader(scoped_ptr<CrxDownloader>().Pass()) {} + FakeCrxDownloader() : CrxDownloader(scoped_ptr<CrxDownloader>()) {} ~FakeCrxDownloader() override {} void DoStartDownload(const GURL& url) override { EXPECT_TRUE(false); } diff --git a/components/update_client/update_engine.cc b/components/update_client/update_engine.cc index e1ae8121..35748f0 100644 --- a/components/update_client/update_engine.cc +++ b/components/update_client/update_engine.cc @@ -91,7 +91,7 @@ void UpdateEngine::Update( CrxUpdateItem update_item; scoped_ptr<ActionUpdateCheck> update_check_action(new ActionUpdateCheck( - (*update_context->update_checker_factory)(*config_).Pass(), + (*update_context->update_checker_factory)(*config_), config_->GetBrowserVersion(), config_->ExtraRequestParams())); update_context->current_action.reset(update_check_action.release()); diff --git a/components/update_client/url_fetcher_downloader.cc b/components/update_client/url_fetcher_downloader.cc index 4edc1c4..acb9eb2 100644 --- a/components/update_client/url_fetcher_downloader.cc +++ b/components/update_client/url_fetcher_downloader.cc @@ -5,6 +5,7 @@ #include "components/update_client/url_fetcher_downloader.h" #include <stdint.h> +#include <utility> #include "base/logging.h" #include "base/sequenced_task_runner.h" @@ -19,12 +20,11 @@ UrlFetcherDownloader::UrlFetcherDownloader( scoped_ptr<CrxDownloader> successor, net::URLRequestContextGetter* context_getter, scoped_refptr<base::SequencedTaskRunner> task_runner) - : CrxDownloader(successor.Pass()), + : CrxDownloader(std::move(successor)), context_getter_(context_getter), task_runner_(task_runner), downloaded_bytes_(-1), - total_bytes_(-1) { -} + total_bytes_(-1) {} UrlFetcherDownloader::~UrlFetcherDownloader() { DCHECK(thread_checker_.CalledOnValidThread()); diff --git a/components/url_matcher/url_matcher.cc b/components/url_matcher/url_matcher.cc index 67fc3f6..5281c9f 100644 --- a/components/url_matcher/url_matcher.cc +++ b/components/url_matcher/url_matcher.cc @@ -6,6 +6,7 @@ #include <algorithm> #include <iterator> +#include <utility> #include "base/logging.h" #include "base/stl_util.h" @@ -742,8 +743,8 @@ URLMatcherConditionSet::URLMatcherConditionSet( scoped_ptr<URLMatcherPortFilter> port_filter) : id_(id), conditions_(conditions), - scheme_filter_(scheme_filter.Pass()), - port_filter_(port_filter.Pass()) {} + scheme_filter_(std::move(scheme_filter)), + port_filter_(std::move(port_filter)) {} URLMatcherConditionSet::URLMatcherConditionSet( ID id, @@ -754,8 +755,8 @@ URLMatcherConditionSet::URLMatcherConditionSet( : id_(id), conditions_(conditions), query_conditions_(query_conditions), - scheme_filter_(scheme_filter.Pass()), - port_filter_(port_filter.Pass()) {} + scheme_filter_(std::move(scheme_filter)), + port_filter_(std::move(port_filter)) {} bool URLMatcherConditionSet::IsMatch( const std::set<StringPattern::ID>& matching_patterns, diff --git a/components/url_matcher/url_matcher_factory.cc b/components/url_matcher/url_matcher_factory.cc index 31d0167..ac5522e 100644 --- a/components/url_matcher/url_matcher_factory.cc +++ b/components/url_matcher/url_matcher_factory.cc @@ -6,6 +6,7 @@ #include <algorithm> #include <cctype> +#include <utility> #include "base/lazy_instance.h" #include "base/logging.h" @@ -159,7 +160,8 @@ URLMatcherFactory::CreateFromURLFilterDictionary( scoped_refptr<URLMatcherConditionSet> url_matcher_condition_set( new URLMatcherConditionSet(id, url_matcher_conditions, - url_matcher_schema_filter.Pass(), url_matcher_port_filter.Pass())); + std::move(url_matcher_schema_filter), + std::move(url_matcher_port_filter))); return url_matcher_condition_set; } diff --git a/components/url_matcher/url_matcher_unittest.cc b/components/url_matcher/url_matcher_unittest.cc index 7219d60..a027a42 100644 --- a/components/url_matcher/url_matcher_unittest.cc +++ b/components/url_matcher/url_matcher_unittest.cc @@ -5,6 +5,7 @@ #include "components/url_matcher/url_matcher.h" #include <stddef.h> +#include <utility> #include "base/macros.h" #include "base/strings/string_util.h" @@ -498,8 +499,9 @@ TEST(URLMatcherConditionSetTest, Matching) { ranges.push_back(URLMatcherPortFilter::CreateRange(80)); scoped_ptr<URLMatcherPortFilter> filter(new URLMatcherPortFilter(ranges)); scoped_refptr<URLMatcherConditionSet> condition_set4( - new URLMatcherConditionSet( - 1, conditions, scoped_ptr<URLMatcherSchemeFilter>(), filter.Pass())); + new URLMatcherConditionSet(1, conditions, + scoped_ptr<URLMatcherSchemeFilter>(), + std::move(filter))); EXPECT_TRUE(condition_set4->IsMatch(matching_patterns, url1)); EXPECT_TRUE(condition_set4->IsMatch(matching_patterns, url3)); EXPECT_FALSE(condition_set4->IsMatch(matching_patterns, url4)); @@ -563,11 +565,9 @@ bool IsQueryMatch( scoped_ptr<URLMatcherPortFilter> port_filter; scoped_refptr<URLMatcherConditionSet> condition_set( - new URLMatcherConditionSet(1, - conditions, - query_conditions, - scheme_filter.Pass(), - port_filter.Pass())); + new URLMatcherConditionSet(1, conditions, query_conditions, + std::move(scheme_filter), + std::move(port_filter))); GURL url("http://www.example.com/foo?" + url_query); diff --git a/components/user_prefs/tracked/interceptable_pref_filter.cc b/components/user_prefs/tracked/interceptable_pref_filter.cc index 180ee7e..cfe081d 100644 --- a/components/user_prefs/tracked/interceptable_pref_filter.cc +++ b/components/user_prefs/tracked/interceptable_pref_filter.cc @@ -4,6 +4,8 @@ #include "components/user_prefs/tracked/interceptable_pref_filter.h" +#include <utility> + #include "base/bind.h" InterceptablePrefFilter::InterceptablePrefFilter() { @@ -16,7 +18,7 @@ void InterceptablePrefFilter::FilterOnLoad( scoped_ptr<base::DictionaryValue> pref_store_contents) { if (filter_on_load_interceptor_.is_null()) { FinalizeFilterOnLoad(post_filter_on_load_callback, - pref_store_contents.Pass(), false); + std::move(pref_store_contents), false); } else { // Note, in practice (in the implementation as it was in May 2014) it would // be okay to pass an unretained |this| pointer below, but in order to avoid @@ -27,7 +29,7 @@ void InterceptablePrefFilter::FilterOnLoad( base::Bind(&InterceptablePrefFilter::FinalizeFilterOnLoad, AsWeakPtr(), post_filter_on_load_callback)); filter_on_load_interceptor_.Run(finalize_filter_on_load, - pref_store_contents.Pass()); + std::move(pref_store_contents)); filter_on_load_interceptor_.Reset(); } } diff --git a/components/user_prefs/tracked/pref_hash_filter.cc b/components/user_prefs/tracked/pref_hash_filter.cc index ac27892..f77aaed 100644 --- a/components/user_prefs/tracked/pref_hash_filter.cc +++ b/components/user_prefs/tracked/pref_hash_filter.cc @@ -5,8 +5,8 @@ #include "components/user_prefs/tracked/pref_hash_filter.h" #include <stdint.h> - #include <algorithm> +#include <utility> #include "base/logging.h" #include "base/macros.h" @@ -54,7 +54,7 @@ PrefHashFilter::PrefHashFilter( TrackedPreferenceValidationDelegate* delegate, size_t reporting_ids_count, bool report_super_mac_validity) - : pref_hash_store_(pref_hash_store.Pass()), + : pref_hash_store_(std::move(pref_hash_store)), on_reset_on_load_(on_reset_on_load), report_super_mac_validity_(report_super_mac_validity) { DCHECK(pref_hash_store_); @@ -86,8 +86,8 @@ PrefHashFilter::PrefHashFilter( } DCHECK(tracked_preference); - bool is_new = tracked_paths_.add(metadata.name, - tracked_preference.Pass()).second; + bool is_new = + tracked_paths_.add(metadata.name, std::move(tracked_preference)).second; DCHECK(is_new); } } @@ -229,5 +229,6 @@ void PrefHashFilter::FinalizeFilterOnLoad( UMA_HISTOGRAM_TIMES("Settings.FilterOnLoadTime", base::TimeTicks::Now() - checkpoint); - post_filter_on_load_callback.Run(pref_store_contents.Pass(), prefs_altered); + post_filter_on_load_callback.Run(std::move(pref_store_contents), + prefs_altered); } diff --git a/components/user_prefs/tracked/pref_hash_filter_unittest.cc b/components/user_prefs/tracked/pref_hash_filter_unittest.cc index dfd3324..9eceefc 100644 --- a/components/user_prefs/tracked/pref_hash_filter_unittest.cc +++ b/components/user_prefs/tracked/pref_hash_filter_unittest.cc @@ -388,7 +388,7 @@ class PrefHashFilterTest new MockPrefHashStore); mock_pref_hash_store_ = temp_mock_pref_hash_store.get(); pref_hash_filter_.reset(new PrefHashFilter( - temp_mock_pref_hash_store.Pass(), configuration, + std::move(temp_mock_pref_hash_store), configuration, base::Bind(&PrefHashFilterTest::RecordReset, base::Unretained(this)), &mock_validation_delegate_, arraysize(kTestTrackedPrefs), true)); } @@ -410,7 +410,7 @@ class PrefHashFilterTest pref_hash_filter_->FilterOnLoad( base::Bind(&PrefHashFilterTest::GetPrefsBack, base::Unretained(this), expect_prefs_modifications), - pref_store_contents_.Pass()); + std::move(pref_store_contents_)); } MockPrefHashStore* mock_pref_hash_store_; @@ -424,7 +424,7 @@ class PrefHashFilterTest void GetPrefsBack(bool expected_schedule_write, scoped_ptr<base::DictionaryValue> prefs, bool schedule_write) { - pref_store_contents_ = prefs.Pass(); + pref_store_contents_ = std::move(prefs); EXPECT_TRUE(pref_store_contents_); EXPECT_EQ(expected_schedule_write, schedule_write); } diff --git a/components/user_prefs/tracked/pref_hash_store_impl.cc b/components/user_prefs/tracked/pref_hash_store_impl.cc index 820c098..125f662 100644 --- a/components/user_prefs/tracked/pref_hash_store_impl.cc +++ b/components/user_prefs/tracked/pref_hash_store_impl.cc @@ -5,6 +5,7 @@ #include "components/user_prefs/tracked/pref_hash_store_impl.h" #include <stddef.h> +#include <utility> #include "base/logging.h" #include "base/macros.h" @@ -74,20 +75,20 @@ PrefHashStoreImpl::~PrefHashStoreImpl() { void PrefHashStoreImpl::set_legacy_hash_store_contents( scoped_ptr<HashStoreContents> legacy_hash_store_contents) { - legacy_hash_store_contents_ = legacy_hash_store_contents.Pass(); + legacy_hash_store_contents_ = std::move(legacy_hash_store_contents); } scoped_ptr<PrefHashStoreTransaction> PrefHashStoreImpl::BeginTransaction( scoped_ptr<HashStoreContents> storage) { return scoped_ptr<PrefHashStoreTransaction>( - new PrefHashStoreTransactionImpl(this, storage.Pass())); + new PrefHashStoreTransactionImpl(this, std::move(storage))); } PrefHashStoreImpl::PrefHashStoreTransactionImpl::PrefHashStoreTransactionImpl( PrefHashStoreImpl* outer, scoped_ptr<HashStoreContents> storage) : outer_(outer), - contents_(storage.Pass()), + contents_(std::move(storage)), super_mac_valid_(false), super_mac_dirty_(false) { if (!outer_->use_super_mac_) diff --git a/components/user_prefs/tracked/segregated_pref_store.cc b/components/user_prefs/tracked/segregated_pref_store.cc index 0d2ef94..177736c 100644 --- a/components/user_prefs/tracked/segregated_pref_store.cc +++ b/components/user_prefs/tracked/segregated_pref_store.cc @@ -4,6 +4,8 @@ #include "components/user_prefs/tracked/segregated_pref_store.h" +#include <utility> + #include "base/logging.h" #include "base/stl_util.h" #include "base/values.h" @@ -85,7 +87,7 @@ bool SegregatedPrefStore::GetValue(const std::string& key, void SegregatedPrefStore::SetValue(const std::string& key, scoped_ptr<base::Value> value, uint32_t flags) { - StoreForKey(key)->SetValue(key, value.Pass(), flags); + StoreForKey(key)->SetValue(key, std::move(value), flags); } void SegregatedPrefStore::RemoveValue(const std::string& key, uint32_t flags) { @@ -105,7 +107,7 @@ void SegregatedPrefStore::ReportValueChanged(const std::string& key, void SegregatedPrefStore::SetValueSilently(const std::string& key, scoped_ptr<base::Value> value, uint32_t flags) { - StoreForKey(key)->SetValueSilently(key, value.Pass(), flags); + StoreForKey(key)->SetValueSilently(key, std::move(value), flags); } bool SegregatedPrefStore::ReadOnly() const { diff --git a/components/user_prefs/tracked/segregated_pref_store_unittest.cc b/components/user_prefs/tracked/segregated_pref_store_unittest.cc index dc458a5..1986758 100644 --- a/components/user_prefs/tracked/segregated_pref_store_unittest.cc +++ b/components/user_prefs/tracked/segregated_pref_store_unittest.cc @@ -6,6 +6,7 @@ #include <set> #include <string> +#include <utility> #include "base/bind.h" #include "base/callback.h" @@ -80,7 +81,7 @@ class SegregatedPrefStoreTest : public testing::Test { protected: scoped_ptr<PersistentPrefStore::ReadErrorDelegate> GetReadErrorDelegate() { EXPECT_TRUE(read_error_delegate_); - return read_error_delegate_.Pass(); + return std::move(read_error_delegate_); } PrefStoreObserverMock observer_; diff --git a/components/user_prefs/tracked/tracked_preferences_migration.cc b/components/user_prefs/tracked/tracked_preferences_migration.cc index edcbae5..eceb5b2 100644 --- a/components/user_prefs/tracked/tracked_preferences_migration.cc +++ b/components/user_prefs/tracked/tracked_preferences_migration.cc @@ -4,6 +4,8 @@ #include "components/user_prefs/tracked/tracked_preferences_migration.h" +#include <utility> + #include "base/bind.h" #include "base/callback.h" #include "base/macros.h" @@ -227,9 +229,9 @@ TrackedPreferencesMigrator::TrackedPreferencesMigrator( register_on_successful_unprotected_store_write_callback), register_on_successful_protected_store_write_callback_( register_on_successful_protected_store_write_callback), - unprotected_pref_hash_store_(unprotected_pref_hash_store.Pass()), - protected_pref_hash_store_(protected_pref_hash_store.Pass()), - legacy_pref_hash_store_(legacy_pref_hash_store.Pass()) { + unprotected_pref_hash_store_(std::move(unprotected_pref_hash_store)), + protected_pref_hash_store_(std::move(protected_pref_hash_store)), + legacy_pref_hash_store_(std::move(legacy_pref_hash_store)) { // The callbacks bound below will own this TrackedPreferencesMigrator by // reference. unprotected_pref_filter->InterceptNextFilterOnLoad( @@ -252,11 +254,11 @@ void TrackedPreferencesMigrator::InterceptFilterOnLoad( switch (id) { case UNPROTECTED_PREF_FILTER: finalize_unprotected_filter_on_load_ = finalize_filter_on_load; - unprotected_prefs_ = prefs.Pass(); + unprotected_prefs_ = std::move(prefs); break; case PROTECTED_PREF_FILTER: finalize_protected_filter_on_load_ = finalize_filter_on_load; - protected_prefs_ = prefs.Pass(); + protected_prefs_ = std::move(prefs); break; } @@ -309,9 +311,9 @@ void TrackedPreferencesMigrator::MigrateIfReady() { } // Hand the processed prefs back to their respective filters. - finalize_unprotected_filter_on_load_.Run(unprotected_prefs_.Pass(), + finalize_unprotected_filter_on_load_.Run(std::move(unprotected_prefs_), unprotected_prefs_altered); - finalize_protected_filter_on_load_.Run(protected_prefs_.Pass(), + finalize_protected_filter_on_load_.Run(std::move(protected_prefs_), protected_prefs_altered); if (unprotected_prefs_need_cleanup) { @@ -356,15 +358,12 @@ void SetupTrackedPreferencesMigration( InterceptablePrefFilter* protected_pref_filter) { scoped_refptr<TrackedPreferencesMigrator> prefs_migrator( new TrackedPreferencesMigrator( - unprotected_pref_names, - protected_pref_names, - unprotected_store_cleaner, - protected_store_cleaner, + unprotected_pref_names, protected_pref_names, + unprotected_store_cleaner, protected_store_cleaner, register_on_successful_unprotected_store_write_callback, register_on_successful_protected_store_write_callback, - unprotected_pref_hash_store.Pass(), - protected_pref_hash_store.Pass(), - legacy_pref_hash_store.Pass(), - unprotected_pref_filter, + std::move(unprotected_pref_hash_store), + std::move(protected_pref_hash_store), + std::move(legacy_pref_hash_store), unprotected_pref_filter, protected_pref_filter)); } diff --git a/components/user_prefs/tracked/tracked_preferences_migration_unittest.cc b/components/user_prefs/tracked/tracked_preferences_migration_unittest.cc index fc134aa..4c837f9 100644 --- a/components/user_prefs/tracked/tracked_preferences_migration_unittest.cc +++ b/components/user_prefs/tracked/tracked_preferences_migration_unittest.cc @@ -6,6 +6,7 @@ #include <set> #include <string> +#include <utility> #include <vector> #include "base/bind.h" @@ -58,7 +59,8 @@ class SimpleInterceptablePrefFilter : public InterceptablePrefFilter { const PostFilterOnLoadCallback& post_filter_on_load_callback, scoped_ptr<base::DictionaryValue> pref_store_contents, bool prefs_altered) override { - post_filter_on_load_callback.Run(pref_store_contents.Pass(), prefs_altered); + post_filter_on_load_callback.Run(std::move(pref_store_contents), + prefs_altered); } }; @@ -276,16 +278,14 @@ class TrackedPreferencesMigrationTest : public testing::Test { case MOCK_UNPROTECTED_PREF_STORE: mock_unprotected_pref_filter_.FilterOnLoad( base::Bind(&TrackedPreferencesMigrationTest::GetPrefsBack, - base::Unretained(this), - MOCK_UNPROTECTED_PREF_STORE), - unprotected_prefs_.Pass()); + base::Unretained(this), MOCK_UNPROTECTED_PREF_STORE), + std::move(unprotected_prefs_)); break; case MOCK_PROTECTED_PREF_STORE: mock_protected_pref_filter_.FilterOnLoad( base::Bind(&TrackedPreferencesMigrationTest::GetPrefsBack, - base::Unretained(this), - MOCK_PROTECTED_PREF_STORE), - protected_prefs_.Pass()); + base::Unretained(this), MOCK_PROTECTED_PREF_STORE), + std::move(protected_prefs_)); break; } } @@ -356,13 +356,13 @@ class TrackedPreferencesMigrationTest : public testing::Test { switch (store_id) { case MOCK_UNPROTECTED_PREF_STORE: EXPECT_FALSE(unprotected_prefs_); - unprotected_prefs_ = prefs.Pass(); + unprotected_prefs_ = std::move(prefs); migration_modified_unprotected_store_ = prefs_altered; unprotected_store_migration_complete_ = true; break; case MOCK_PROTECTED_PREF_STORE: EXPECT_FALSE(protected_prefs_); - protected_prefs_ = prefs.Pass(); + protected_prefs_ = std::move(prefs); migration_modified_protected_store_ = prefs_altered; protected_store_migration_complete_ = true; break; diff --git a/components/variations/service/variations_service.cc b/components/variations/service/variations_service.cc index a300747..3d41ce3 100644 --- a/components/variations/service/variations_service.cc +++ b/components/variations/service/variations_service.cc @@ -6,6 +6,7 @@ #include <stddef.h> #include <stdint.h> +#include <utility> #include "base/build_time.h" #include "base/command_line.h" @@ -276,7 +277,7 @@ VariationsService::VariationsService( PrefService* local_state, metrics::MetricsStateManager* state_manager, const UIStringOverrider& ui_string_overrider) - : client_(client.Pass()), + : client_(std::move(client)), ui_string_overrider_(ui_string_overrider), local_state_(local_state), state_manager_(state_manager), @@ -285,7 +286,7 @@ VariationsService::VariationsService( create_trials_from_seed_called_(false), initial_request_completed_(false), disable_deltas_for_next_request_(false), - resource_request_allowed_notifier_(notifier.Pass()), + resource_request_allowed_notifier_(std::move(notifier)), request_count_(0), weak_ptr_factory_(this) { DCHECK(client_.get()); @@ -493,15 +494,15 @@ scoped_ptr<VariationsService> VariationsService::Create( switches::kVariationsServerURL)) { DVLOG(1) << "Not creating VariationsService in unofficial build without --" << switches::kVariationsServerURL << " specified."; - return result.Pass(); + return result; } #endif result.reset(new VariationsService( - client.Pass(), + std::move(client), make_scoped_ptr(new web_resource::ResourceRequestAllowedNotifier( local_state, disable_network_switch)), local_state, state_manager, ui_string_overrider)); - return result.Pass(); + return result; } // static @@ -509,7 +510,7 @@ scoped_ptr<VariationsService> VariationsService::CreateForTesting( scoped_ptr<VariationsServiceClient> client, PrefService* local_state) { return make_scoped_ptr(new VariationsService( - client.Pass(), + std::move(client), make_scoped_ptr(new web_resource::ResourceRequestAllowedNotifier( local_state, nullptr)), local_state, nullptr, UIStringOverrider())); diff --git a/components/variations/service/variations_service_unittest.cc b/components/variations/service/variations_service_unittest.cc index a0a0220..10dabef 100644 --- a/components/variations/service/variations_service_unittest.cc +++ b/components/variations/service/variations_service_unittest.cc @@ -5,7 +5,7 @@ #include "components/variations/service/variations_service.h" #include <stddef.h> - +#include <utility> #include <vector> #include "base/base64.h" @@ -80,7 +80,7 @@ class TestVariationsService : public VariationsService { scoped_ptr<web_resource::TestRequestAllowedNotifier> test_notifier, PrefService* local_state) : VariationsService(make_scoped_ptr(new TestVariationsServiceClient()), - test_notifier.Pass(), + std::move(test_notifier), local_state, NULL, UIStringOverrider()), @@ -360,7 +360,7 @@ TEST_F(VariationsServiceTest, GetVariationsServerURL) { make_scoped_ptr(new TestVariationsServiceClient()); TestVariationsServiceClient* raw_client = client.get(); VariationsService service( - client.Pass(), + std::move(client), make_scoped_ptr(new web_resource::TestRequestAllowedNotifier(&prefs)), &prefs, NULL, UIStringOverrider()); GURL url = service.GetVariationsServerURL(&prefs, std::string()); @@ -414,7 +414,7 @@ TEST_F(VariationsServiceTest, RequestsInitiallyNotAllowed) { scoped_ptr<web_resource::TestRequestAllowedNotifier> test_notifier = make_scoped_ptr(new web_resource::TestRequestAllowedNotifier(&prefs)); web_resource::TestRequestAllowedNotifier* raw_notifier = test_notifier.get(); - TestVariationsService test_service(test_notifier.Pass(), &prefs); + TestVariationsService test_service(std::move(test_notifier), &prefs); // Force the notifier to initially disallow requests. raw_notifier->SetRequestsAllowedOverride(false); @@ -434,7 +434,7 @@ TEST_F(VariationsServiceTest, RequestsInitiallyAllowed) { scoped_ptr<web_resource::TestRequestAllowedNotifier> test_notifier = make_scoped_ptr(new web_resource::TestRequestAllowedNotifier(&prefs)); web_resource::TestRequestAllowedNotifier* raw_notifier = test_notifier.get(); - TestVariationsService test_service(test_notifier.Pass(), &prefs); + TestVariationsService test_service(std::move(test_notifier), &prefs); raw_notifier->SetRequestsAllowedOverride(true); test_service.StartRepeatedVariationsSeedFetch(); diff --git a/components/variations/variations_seed_processor_unittest.cc b/components/variations/variations_seed_processor_unittest.cc index 8bc5ce6..d2a2959 100644 --- a/components/variations/variations_seed_processor_unittest.cc +++ b/components/variations/variations_seed_processor_unittest.cc @@ -6,8 +6,8 @@ #include <stddef.h> #include <stdint.h> - #include <map> +#include <utility> #include <vector> #include "base/bind.h" @@ -559,7 +559,7 @@ TEST_F(VariationsSeedProcessorTest, FeatureEnabledOrDisableByTrial) { EXPECT_TRUE( CreateTrialFromStudyWithFeatureList(&study, feature_list.get())); - base::FeatureList::SetInstance(feature_list.Pass()); + base::FeatureList::SetInstance(std::move(feature_list)); // |kUnrelatedFeature| should not be affected. EXPECT_FALSE(base::FeatureList::IsEnabled(kUnrelatedFeature)); @@ -696,7 +696,7 @@ TEST_F(VariationsSeedProcessorTest, FeatureAssociationAndForcing) { EXPECT_TRUE( CreateTrialFromStudyWithFeatureList(&study, feature_list.get())); - base::FeatureList::SetInstance(feature_list.Pass()); + base::FeatureList::SetInstance(std::move(feature_list)); // Trial should not be activated initially, but later might get activated // depending on the expected values. diff --git a/components/version_ui/version_handler_helper.cc b/components/version_ui/version_handler_helper.cc index 2a9c2a1..6d049a7 100644 --- a/components/version_ui/version_handler_helper.cc +++ b/components/version_ui/version_handler_helper.cc @@ -4,6 +4,7 @@ #include "components/version_ui/version_handler_helper.h" +#include <utility> #include <vector> #include "base/metrics/field_trial.h" @@ -38,7 +39,7 @@ scoped_ptr<base::Value> GetVariationsList() { variations_list->Append(new base::StringValue(*it)); } - return variations_list.Pass(); + return std::move(variations_list); } } // namespace version_ui diff --git a/components/visitedlink/browser/visitedlink_master.cc b/components/visitedlink/browser/visitedlink_master.cc index c5c6490..4328700 100644 --- a/components/visitedlink/browser/visitedlink_master.cc +++ b/components/visitedlink/browser/visitedlink_master.cc @@ -6,8 +6,8 @@ #include <stdio.h> #include <string.h> - #include <algorithm> +#include <utility> #include "base/bind.h" #include "base/bind_helpers.h" @@ -150,8 +150,8 @@ VisitedLinkMaster::LoadFromFileResult::LoadFromFileResult( int32_t num_entries, int32_t used_count, uint8_t salt[LINK_SALT_LENGTH]) - : file(file.Pass()), - shared_memory(shared_memory.Pass()), + : file(std::move(file)), + shared_memory(std::move(shared_memory)), hash_table(hash_table), num_entries(num_entries), used_count(used_count) { @@ -672,12 +672,9 @@ bool VisitedLinkMaster::LoadApartFromFile( return false; } - *load_from_file_result = new LoadFromFileResult(file_closer.Pass(), - shared_memory.Pass(), - hash_table, - num_entries, - used_count, - salt); + *load_from_file_result = + new LoadFromFileResult(std::move(file_closer), std::move(shared_memory), + hash_table, num_entries, used_count, salt); return true; } @@ -912,7 +909,7 @@ bool VisitedLinkMaster::CreateApartURLTable( *hash_table = reinterpret_cast<Fingerprint*>( static_cast<char*>(sh_mem->memory()) + sizeof(SharedHeader)); - *shared_memory = sh_mem.Pass(); + *shared_memory = std::move(sh_mem); return true; } diff --git a/components/web_modal/web_contents_modal_dialog_manager.cc b/components/web_modal/web_contents_modal_dialog_manager.cc index 46f6af9..e940b07 100644 --- a/components/web_modal/web_contents_modal_dialog_manager.cc +++ b/components/web_modal/web_contents_modal_dialog_manager.cc @@ -4,6 +4,8 @@ #include "components/web_modal/web_contents_modal_dialog_manager.h" +#include <utility> + #include "components/web_modal/web_contents_modal_dialog_manager_delegate.h" #include "content/public/browser/navigation_details.h" #include "content/public/browser/navigation_entry.h" @@ -36,7 +38,7 @@ void WebContentsModalDialogManager::SetDelegate( void WebContentsModalDialogManager::ShowModalDialog(gfx::NativeWindow dialog) { scoped_ptr<SingleWebContentsDialogManager> mgr( CreateNativeWebModalManager(dialog, this)); - ShowDialogWithManager(dialog, mgr.Pass()); + ShowDialogWithManager(dialog, std::move(mgr)); } // TODO(gbillock): Maybe "ShowBubbleWithManager"? @@ -45,7 +47,7 @@ void WebContentsModalDialogManager::ShowDialogWithManager( scoped_ptr<SingleWebContentsDialogManager> manager) { if (delegate_) manager->HostChanged(delegate_->GetWebContentsModalDialogHost()); - child_dialogs_.push_back(new DialogState(dialog, manager.Pass())); + child_dialogs_.push_back(new DialogState(dialog, std::move(manager))); if (child_dialogs_.size() == 1) { BlockWebContentsInteraction(true); diff --git a/components/web_modal/web_contents_modal_dialog_manager_unittest.cc b/components/web_modal/web_contents_modal_dialog_manager_unittest.cc index c103c20..0cb1099 100644 --- a/components/web_modal/web_contents_modal_dialog_manager_unittest.cc +++ b/components/web_modal/web_contents_modal_dialog_manager_unittest.cc @@ -142,8 +142,8 @@ TEST_F(WebContentsModalDialogManagerTest, WebContentsVisible) { NativeManagerTracker tracker; TestNativeWebContentsModalDialogManager* native_manager = new TestNativeWebContentsModalDialogManager(dialog, manager, &tracker); - manager->ShowDialogWithManager(dialog, - scoped_ptr<SingleWebContentsDialogManager>(native_manager).Pass()); + manager->ShowDialogWithManager( + dialog, scoped_ptr<SingleWebContentsDialogManager>(native_manager)); EXPECT_EQ(NativeManagerTracker::SHOWN, tracker.state_); EXPECT_TRUE(manager->IsDialogActive()); @@ -164,8 +164,8 @@ TEST_F(WebContentsModalDialogManagerTest, WebContentsNotVisible) { NativeManagerTracker tracker; TestNativeWebContentsModalDialogManager* native_manager = new TestNativeWebContentsModalDialogManager(dialog, manager, &tracker); - manager->ShowDialogWithManager(dialog, - scoped_ptr<SingleWebContentsDialogManager>(native_manager).Pass()); + manager->ShowDialogWithManager( + dialog, scoped_ptr<SingleWebContentsDialogManager>(native_manager)); EXPECT_EQ(NativeManagerTracker::NOT_SHOWN, tracker.state_); EXPECT_TRUE(manager->IsDialogActive()); @@ -190,12 +190,12 @@ TEST_F(WebContentsModalDialogManagerTest, ShowDialogs) { new TestNativeWebContentsModalDialogManager(dialog2, manager, &tracker2); TestNativeWebContentsModalDialogManager* native_manager3 = new TestNativeWebContentsModalDialogManager(dialog3, manager, &tracker3); - manager->ShowDialogWithManager(dialog1, - scoped_ptr<SingleWebContentsDialogManager>(native_manager1).Pass()); - manager->ShowDialogWithManager(dialog2, - scoped_ptr<SingleWebContentsDialogManager>(native_manager2).Pass()); - manager->ShowDialogWithManager(dialog3, - scoped_ptr<SingleWebContentsDialogManager>(native_manager3).Pass()); + manager->ShowDialogWithManager( + dialog1, scoped_ptr<SingleWebContentsDialogManager>(native_manager1)); + manager->ShowDialogWithManager( + dialog2, scoped_ptr<SingleWebContentsDialogManager>(native_manager2)); + manager->ShowDialogWithManager( + dialog3, scoped_ptr<SingleWebContentsDialogManager>(native_manager3)); EXPECT_TRUE(delegate->web_contents_blocked()); EXPECT_EQ(NativeManagerTracker::SHOWN, tracker1.state_); @@ -214,8 +214,8 @@ TEST_F(WebContentsModalDialogManagerTest, VisibilityObservation) { NativeManagerTracker tracker; TestNativeWebContentsModalDialogManager* native_manager = new TestNativeWebContentsModalDialogManager(dialog, manager, &tracker); - manager->ShowDialogWithManager(dialog, - scoped_ptr<SingleWebContentsDialogManager>(native_manager).Pass()); + manager->ShowDialogWithManager( + dialog, scoped_ptr<SingleWebContentsDialogManager>(native_manager)); EXPECT_TRUE(manager->IsDialogActive()); EXPECT_TRUE(delegate->web_contents_blocked()); @@ -247,10 +247,10 @@ TEST_F(WebContentsModalDialogManagerTest, InterstitialPage) { new TestNativeWebContentsModalDialogManager(dialog1, manager, &tracker1); TestNativeWebContentsModalDialogManager* native_manager2 = new TestNativeWebContentsModalDialogManager(dialog2, manager, &tracker2); - manager->ShowDialogWithManager(dialog1, - scoped_ptr<SingleWebContentsDialogManager>(native_manager1).Pass()); - manager->ShowDialogWithManager(dialog2, - scoped_ptr<SingleWebContentsDialogManager>(native_manager2).Pass()); + manager->ShowDialogWithManager( + dialog1, scoped_ptr<SingleWebContentsDialogManager>(native_manager1)); + manager->ShowDialogWithManager( + dialog2, scoped_ptr<SingleWebContentsDialogManager>(native_manager2)); test_api->DidAttachInterstitialPage(); @@ -283,14 +283,14 @@ TEST_F(WebContentsModalDialogManagerTest, CloseDialogs) { new TestNativeWebContentsModalDialogManager(dialog3, manager, &tracker3); TestNativeWebContentsModalDialogManager* native_manager4 = new TestNativeWebContentsModalDialogManager(dialog4, manager, &tracker4); - manager->ShowDialogWithManager(dialog1, - scoped_ptr<SingleWebContentsDialogManager>(native_manager1).Pass()); - manager->ShowDialogWithManager(dialog2, - scoped_ptr<SingleWebContentsDialogManager>(native_manager2).Pass()); - manager->ShowDialogWithManager(dialog3, - scoped_ptr<SingleWebContentsDialogManager>(native_manager3).Pass()); - manager->ShowDialogWithManager(dialog4, - scoped_ptr<SingleWebContentsDialogManager>(native_manager4).Pass()); + manager->ShowDialogWithManager( + dialog1, scoped_ptr<SingleWebContentsDialogManager>(native_manager1)); + manager->ShowDialogWithManager( + dialog2, scoped_ptr<SingleWebContentsDialogManager>(native_manager2)); + manager->ShowDialogWithManager( + dialog3, scoped_ptr<SingleWebContentsDialogManager>(native_manager3)); + manager->ShowDialogWithManager( + dialog4, scoped_ptr<SingleWebContentsDialogManager>(native_manager4)); native_manager1->Close(); @@ -345,9 +345,8 @@ TEST_F(WebContentsModalDialogManagerTest, CloseAllDialogs) { native_managers[i] = new TestNativeWebContentsModalDialogManager( dialog, manager, &(trackers[i])); - manager->ShowDialogWithManager(dialog, - scoped_ptr<SingleWebContentsDialogManager>( - native_managers[i]).Pass()); + manager->ShowDialogWithManager( + dialog, scoped_ptr<SingleWebContentsDialogManager>(native_managers[i])); } for (int i = 0; i < kWindowCount; i++) diff --git a/components/web_resource/web_resource_service.cc b/components/web_resource/web_resource_service.cc index d7fa9fb..3c6dafa 100644 --- a/components/web_resource/web_resource_service.cc +++ b/components/web_resource/web_resource_service.cc @@ -78,7 +78,7 @@ void WebResourceService::OnURLFetchComplete(const net::URLFetcher* source) { // (on Android in particular) we short-cut the full parsing in the case of // trivially "empty" JSONs. if (data.empty() || data == "{}") { - OnUnpackFinished(make_scoped_ptr(new base::DictionaryValue()).Pass()); + OnUnpackFinished(make_scoped_ptr(new base::DictionaryValue())); } else { parse_json_callback_.Run(data, base::Bind(&WebResourceService::OnUnpackFinished, diff --git a/components/web_view/client_initiated_frame_connection.cc b/components/web_view/client_initiated_frame_connection.cc index 016f354..dbd86ef 100644 --- a/components/web_view/client_initiated_frame_connection.cc +++ b/components/web_view/client_initiated_frame_connection.cc @@ -4,11 +4,13 @@ #include "components/web_view/client_initiated_frame_connection.h" +#include <utility> + namespace web_view { ClientInitiatedFrameConnection::ClientInitiatedFrameConnection( mojom::FrameClientPtr frame_client) - : frame_client_(frame_client.Pass()) {} + : frame_client_(std::move(frame_client)) {} ClientInitiatedFrameConnection::~ClientInitiatedFrameConnection() {} diff --git a/components/web_view/frame.cc b/components/web_view/frame.cc index 37690f3..aa957ba 100644 --- a/components/web_view/frame.cc +++ b/components/web_view/frame.cc @@ -5,8 +5,8 @@ #include "components/web_view/frame.h" #include <stddef.h> - #include <algorithm> +#include <utility> #include "base/auto_reset.h" #include "base/bind.h" @@ -44,7 +44,7 @@ mojom::FrameDataPtr FrameToFrameData(const Frame* frame) { frame_data->client_properties = mojo::Map<mojo::String, mojo::Array<uint8_t>>::From( frame->client_properties()); - return frame_data.Pass(); + return frame_data; } } // namespace @@ -69,7 +69,7 @@ Frame::Frame(FrameTree* tree, app_id_(app_id), parent_(nullptr), window_ownership_(window_ownership), - user_data_(user_data.Pass()), + user_data_(std::move(user_data)), frame_client_(frame_client), loading_(false), progress_(0.f), @@ -113,8 +113,8 @@ void Frame::Init(Frame* parent, const ClientType client_type = frame_request.is_pending() ? ClientType::NEW_CHILD_FRAME : ClientType::EXISTING_FRAME_NEW_APP; - InitClient(client_type, nullptr, window_tree_client.Pass(), - frame_request.Pass(), navigation_start_time); + InitClient(client_type, nullptr, std::move(window_tree_client), + std::move(frame_request), navigation_start_time); tree_->delegate_->DidCreateFrame(this); @@ -171,7 +171,7 @@ void Frame::Find(int32_t request_id, mojom::FindOptionsPtr options, bool wrap_within_frame, const FindCallback& callback) { - frame_client_->Find(request_id, search_text, options.Pass(), + frame_client_->Find(request_id, search_text, std::move(options), wrap_within_frame, callback); } @@ -183,8 +183,8 @@ void Frame::HighlightFindResults(int32_t request_id, const mojo::String& search_text, mojom::FindOptionsPtr options, bool reset) { - frame_client_->HighlightFindResults(request_id, search_text, options.Pass(), - reset); + frame_client_->HighlightFindResults(request_id, search_text, + std::move(options), reset); } void Frame::StopHighlightingFindResults() { @@ -200,7 +200,7 @@ void Frame::InitClient(ClientType client_type, embedded_connection_id_ = kInvalidConnectionId; embed_weak_ptr_factory_.InvalidateWeakPtrs(); window_->Embed( - window_tree_client.Pass(), + std::move(window_tree_client), mus::mojom::WindowTree::ACCESS_POLICY_DEFAULT, base::Bind(&Frame::OnEmbedAck, embed_weak_ptr_factory_.GetWeakPtr())); } @@ -211,7 +211,7 @@ void Frame::InitClient(ClientType client_type, // This frame (and client) was created by an existing FrameClient. There // is no need to send it OnConnect(). frame_binding_.reset( - new mojo::Binding<mojom::Frame>(this, frame_request.Pass())); + new mojo::Binding<mojom::Frame>(this, std::move(frame_request))); frame_client_->OnConnect( nullptr, tree_->change_id(), id_, mojom::WINDOW_CONNECT_TYPE_USE_NEW, mojo::Array<mojom::FrameDataPtr>(), @@ -223,19 +223,19 @@ void Frame::InitClient(ClientType client_type, mojo::Array<mojom::FrameDataPtr> array(frames.size()); for (size_t i = 0; i < frames.size(); ++i) - array[i] = FrameToFrameData(frames[i]).Pass(); + array[i] = FrameToFrameData(frames[i]); mojom::FramePtr frame_ptr; // Don't install an error handler. We allow for the target to only // implement WindowTreeClient. frame_binding_.reset( - new mojo::Binding<mojom::Frame>(this, GetProxy(&frame_ptr).Pass())); + new mojo::Binding<mojom::Frame>(this, GetProxy(&frame_ptr))); frame_client_->OnConnect( - frame_ptr.Pass(), tree_->change_id(), id_, + std::move(frame_ptr), tree_->change_id(), id_, client_type == ClientType::EXISTING_FRAME_SAME_APP ? mojom::WINDOW_CONNECT_TYPE_USE_EXISTING : mojom::WINDOW_CONNECT_TYPE_USE_NEW, - array.Pass(), navigation_start_time.ToInternalValue(), + std::move(array), navigation_start_time.ToInternalValue(), base::Bind(&OnConnectAck, base::Passed(&data_and_binding))); tree_->delegate_->DidStartNavigation(this); @@ -267,20 +267,20 @@ void Frame::ChangeClient(mojom::FrameClient* frame_client, if (client_type == ClientType::EXISTING_FRAME_SAME_APP) { // See comment in InitClient() for details. data_and_binding.reset(new FrameUserDataAndBinding); - data_and_binding->user_data = user_data_.Pass(); - data_and_binding->frame_binding = frame_binding_.Pass(); + data_and_binding->user_data = std::move(user_data_); + data_and_binding->frame_binding = std::move(frame_binding_); } else { loading_ = false; progress_ = 0.f; } - user_data_ = user_data.Pass(); + user_data_ = std::move(user_data); frame_client_ = frame_client; frame_binding_.reset(); app_id_ = app_id; - InitClient(client_type, data_and_binding.Pass(), window_tree_client.Pass(), - nullptr, navigation_start_time); + InitClient(client_type, std::move(data_and_binding), + std::move(window_tree_client), nullptr, navigation_start_time); } void Frame::OnEmbedAck(bool success, mus::ConnectionSpecificId connection_id) { @@ -299,10 +299,10 @@ void Frame::OnWillNavigateAck( DCHECK(waiting_for_on_will_navigate_ack_); DVLOG(2) << "Frame::OnWillNavigateAck id=" << id_; waiting_for_on_will_navigate_ack_ = false; - ChangeClient(frame_client, user_data.Pass(), window_tree_client.Pass(), - app_id, navigation_start_time); + ChangeClient(frame_client, std::move(user_data), + std::move(window_tree_client), app_id, navigation_start_time); if (pending_navigate_.get()) - StartNavigate(pending_navigate_.Pass()); + StartNavigate(std::move(pending_navigate_)); } void Frame::SetWindow(mus::Window* window) { @@ -312,7 +312,7 @@ void Frame::SetWindow(mus::Window* window) { window_->SetLocalProperty(kFrame, this); window_->AddObserver(this); if (pending_navigate_.get()) - StartNavigate(pending_navigate_.Pass()); + StartNavigate(std::move(pending_navigate_)); } void Frame::BuildFrameTree(std::vector<const Frame*>* frames) const { @@ -344,7 +344,7 @@ void Frame::StartNavigate(mojo::URLRequestPtr request) { if (waiting_for_on_will_navigate_ack_) { // We're waiting for OnWillNavigate(). We need to wait until that completes // before attempting any other loads. - pending_navigate_ = request.Pass(); + pending_navigate_ = std::move(request); return; } @@ -353,7 +353,7 @@ void Frame::StartNavigate(mojo::URLRequestPtr request) { // We need a Window to navigate. When we get the Window we'll complete the // navigation. if (!window_) { - pending_navigate_ = request.Pass(); + pending_navigate_ = std::move(request); return; } @@ -366,9 +366,10 @@ void Frame::StartNavigate(mojo::URLRequestPtr request) { base::TimeTicks navigation_start_time = base::TimeTicks::FromInternalValue(request->originating_time_ticks); tree_->delegate_->CanNavigateFrame( - this, request.Pass(), base::Bind(&Frame::OnCanNavigateFrame, - navigate_weak_ptr_factory_.GetWeakPtr(), - requested_url, navigation_start_time)); + this, std::move(request), + base::Bind(&Frame::OnCanNavigateFrame, + navigate_weak_ptr_factory_.GetWeakPtr(), requested_url, + navigation_start_time)); } void Frame::OnCanNavigateFrame( @@ -389,8 +390,8 @@ void Frame::OnCanNavigateFrame( // already // and ends up reusing it). DCHECK(!window_tree_client); - ChangeClient(frame_client, user_data.Pass(), window_tree_client.Pass(), - app_id, navigation_start_time); + ChangeClient(frame_client, std::move(user_data), + std::move(window_tree_client), app_id, navigation_start_time); } else { waiting_for_on_will_navigate_ack_ = true; DCHECK(window_tree_client); @@ -488,7 +489,8 @@ void Frame::PostMessageEventToFrame(uint32_t target_frame_id, !tree_->delegate_->CanPostMessageEventToFrame(this, target, event.get())) return; - target->frame_client_->OnPostMessageEvent(id_, target_frame_id, event.Pass()); + target->frame_client_->OnPostMessageEvent(id_, target_frame_id, + std::move(event)); } void Frame::LoadingStateChanged(bool loading, double progress) { @@ -553,7 +555,7 @@ void Frame::OnCreatedFrame( } Frame* child_frame = tree_->CreateChildFrame( - this, frame_request.Pass(), client.Pass(), frame_id, app_id_, + this, std::move(frame_request), std::move(client), frame_id, app_id_, client_properties.To<ClientPropertyMap>()); child_frame->embedded_connection_id_ = embedded_connection_id_; } @@ -569,12 +571,12 @@ void Frame::RequestNavigate(mojom::NavigationTargetType target_type, return; } if (target_frame != tree_->root()) { - target_frame->StartNavigate(request.Pass()); + target_frame->StartNavigate(std::move(request)); return; } // Else case if |target_frame| == root. Treat at top level request. } - tree_->delegate_->NavigateTopLevel(this, request.Pass()); + tree_->delegate_->NavigateTopLevel(this, std::move(request)); } void Frame::DidNavigateLocally(const mojo::String& url) { diff --git a/components/web_view/frame_apptest.cc b/components/web_view/frame_apptest.cc index 0b8aca9..0c7ce4f 100644 --- a/components/web_view/frame_apptest.cc +++ b/components/web_view/frame_apptest.cc @@ -5,6 +5,7 @@ #include "components/web_view/frame.h" #include <stdint.h> +#include <utility> #include "base/bind.h" #include "base/location.h" @@ -20,7 +21,6 @@ #include "components/mus/public/cpp/window_tree_delegate.h" #include "components/mus/public/cpp/window_tree_host_factory.h" #include "components/mus/public/interfaces/window_tree_host.mojom.h" -#include "components/web_view/frame.h" #include "components/web_view/frame_connection.h" #include "components/web_view/frame_tree.h" #include "components/web_view/frame_tree_delegate.h" @@ -81,7 +81,7 @@ scoped_ptr<FrameConnection> CreateFrameConnection(mojo::ApplicationImpl* app) { mojo::URLRequestPtr request(mojo::URLRequest::New()); request->url = mojo::String::From(app->url()); base::RunLoop run_loop; - frame_connection->Init(app, request.Pass(), + frame_connection->Init(app, std::move(request), base::Bind(&OnGotIdCallback, &run_loop)); run_loop.Run(); return frame_connection; @@ -96,10 +96,10 @@ class TestFrameClient : public mojom::FrameClient { int connect_count() const { return connect_count_; } mojo::Array<mojom::FrameDataPtr> connect_frames() { - return connect_frames_.Pass(); + return std::move(connect_frames_); } - mojo::Array<mojom::FrameDataPtr> adds() { return adds_.Pass(); } + mojo::Array<mojom::FrameDataPtr> adds() { return std::move(adds_); } // Sets a callback to run once OnConnect() is received. void set_on_connect_callback(const base::Closure& closure) { @@ -143,9 +143,9 @@ class TestFrameClient : public mojom::FrameClient { int64_t navigation_start_time_ticks, const OnConnectCallback& callback) override { connect_count_++; - connect_frames_ = frames.Pass(); + connect_frames_ = std::move(frames); if (frame) - server_frame_ = frame.Pass(); + server_frame_ = std::move(frame); callback.Run(); if (!on_connect_callback_.is_null()) on_connect_callback_.Run(); @@ -154,7 +154,7 @@ class TestFrameClient : public mojom::FrameClient { base::TimeTicks::FromInternalValue(navigation_start_time_ticks); } void OnFrameAdded(uint32_t change_id, mojom::FrameDataPtr frame) override { - adds_.push_back(frame.Pass()); + adds_.push_back(std::move(frame)); } void OnFrameRemoved(uint32_t change_id, uint32_t frame_id) override {} void OnFrameClientPropertyChanged(uint32_t frame_id, @@ -253,14 +253,14 @@ class WindowAndFrame : public mus::WindowTreeDelegate { mojom::FrameClientPtr GetFrameClientPtr() { mojom::FrameClientPtr client_ptr; frame_client_binding_.Bind(GetProxy(&client_ptr)); - return client_ptr.Pass(); + return client_ptr; } void Bind(mojo::InterfaceRequest<mojom::FrameClient> request) { ASSERT_FALSE(frame_client_binding_.is_bound()); test_frame_tree_client_.set_on_connect_callback( base::Bind(&WindowAndFrame::OnGotConnect, base::Unretained(this))); - frame_client_binding_.Bind(request.Pass()); + frame_client_binding_.Bind(std::move(request)); } void OnGotConnect() { QuitRunLoopIfNecessary(); } @@ -317,7 +317,7 @@ class FrameTest : public mojo::test::ApplicationTestBase, request->originating_time_ticks = navigation_start_time.ToInternalValue(); window_and_frame->server_frame()->RequestNavigate( mojom::NAVIGATION_TARGET_TYPE_EXISTING_FRAME, - window_and_frame->window()->id(), request.Pass()); + window_and_frame->window()->id(), std::move(request)); return WaitForViewAndFrame(); } @@ -339,9 +339,9 @@ class FrameTest : public mojo::test::ApplicationTestBase, parent->server_frame()->OnCreatedFrame( window_and_frame->GetServerFrameRequest(), window_and_frame->GetFrameClientPtr(), child_frame_window->id(), - client_properties.Pass()); + std::move(client_properties)); frame_tree_delegate()->WaitForCreateFrame(); - return HasFatalFailure() ? nullptr : window_and_frame.Pass(); + return HasFatalFailure() ? nullptr : std::move(window_and_frame); } // Runs a message loop until the data necessary to represent to a client side @@ -350,7 +350,7 @@ class FrameTest : public mojo::test::ApplicationTestBase, DCHECK(!window_and_frame_); window_and_frame_.reset(new WindowAndFrame); window_and_frame_->WaitForViewAndFrame(); - return window_and_frame_.Pass(); + return std::move(window_and_frame_); } private: @@ -394,8 +394,8 @@ class FrameTest : public mojo::test::ApplicationTestBase, mus::Window* frame_root_view = window_manager()->NewWindow(); window_manager()->GetRoot()->AddChild(frame_root_view); frame_tree_.reset(new FrameTree( - 0u, frame_root_view, window_tree_client.Pass(), - frame_tree_delegate_.get(), frame_client, frame_connection.Pass(), + 0u, frame_root_view, std::move(window_tree_client), + frame_tree_delegate_.get(), frame_client, std::move(frame_connection), Frame::ClientPropertyMap(), base::TimeTicks::Now())); root_window_and_frame_ = WaitForViewAndFrame(); } @@ -414,11 +414,11 @@ class FrameTest : public mojo::test::ApplicationTestBase, mojo::InterfaceRequest<mus::mojom::WindowTreeClient> request) override { if (window_and_frame_) { mus::WindowTreeConnection::Create( - window_and_frame_.get(), request.Pass(), + window_and_frame_.get(), std::move(request), mus::WindowTreeConnection::CreateType::DONT_WAIT_FOR_EMBED); } else { mus::WindowTreeConnection::Create( - this, request.Pass(), + this, std::move(request), mus::WindowTreeConnection::CreateType::DONT_WAIT_FOR_EMBED); } } @@ -427,7 +427,7 @@ class FrameTest : public mojo::test::ApplicationTestBase, void Create(mojo::ApplicationConnection* connection, mojo::InterfaceRequest<mojom::FrameClient> request) override { ASSERT_TRUE(window_and_frame_); - window_and_frame_->Bind(request.Pass()); + window_and_frame_->Bind(std::move(request)); } scoped_ptr<TestFrameTreeDelegate> frame_tree_delegate_; @@ -472,7 +472,7 @@ TEST_F(FrameTest, MAYBE_ChildFrameClientConnectData) { EXPECT_EQ(0, child_view_and_frame->test_frame_client()->connect_count()); scoped_ptr<WindowAndFrame> navigated_child_view_and_frame = - NavigateFrame(child_view_and_frame.get()).Pass(); + NavigateFrame(child_view_and_frame.get()); mojo::Array<mojom::FrameDataPtr> frames_in_child = navigated_child_view_and_frame->test_frame_client()->connect_frames(); @@ -493,7 +493,7 @@ TEST_F(FrameTest, OnViewEmbeddedInFrameDisconnected) { ASSERT_TRUE(child_view_and_frame); scoped_ptr<WindowAndFrame> navigated_child_view_and_frame = - NavigateFrame(child_view_and_frame.get()).Pass(); + NavigateFrame(child_view_and_frame.get()); // Delete the WindowTreeConnection for the child, which should trigger // notification. @@ -578,8 +578,7 @@ TEST_F(FrameTest, PassAlongNavigationStartTime) { base::TimeTicks navigation_start_time = base::TimeTicks::FromInternalValue(1); scoped_ptr<WindowAndFrame> navigated_child_view_and_frame = NavigateFrameWithStartTime(child_view_and_frame.get(), - navigation_start_time) - .Pass(); + navigation_start_time); EXPECT_EQ(navigation_start_time, navigated_child_view_and_frame->test_frame_client() ->last_navigation_start_time()); diff --git a/components/web_view/frame_connection.cc b/components/web_view/frame_connection.cc index afb973d..b7f2fd5 100644 --- a/components/web_view/frame_connection.cc +++ b/components/web_view/frame_connection.cc @@ -4,6 +4,8 @@ #include "components/web_view/frame_connection.h" +#include <utility> + #include "base/bind.h" #include "base/callback.h" #include "build/build_config.h" @@ -41,8 +43,8 @@ void OnGotContentHandlerForFrame( } FrameConnection* connection_ptr = connection.get(); callback.Run(connection_ptr->GetContentHandlerID(), - connection_ptr->frame_client(), connection.Pass(), - window_tree_client.Pass()); + connection_ptr->frame_client(), std::move(connection), + std::move(window_tree_client)); } } // namespace @@ -61,7 +63,7 @@ void FrameConnection::CreateConnectionForCanNavigateFrame( const FrameTreeDelegate::CanNavigateFrameCallback& callback) { scoped_ptr<FrameConnection> frame_connection(new FrameConnection); FrameConnection* connection = frame_connection.get(); - connection->Init(app, request.Pass(), + connection->Init(app, std::move(request), base::Bind(&OnGotContentHandlerForFrame, frame->app_id(), callback, base::Passed(&frame_connection))); } @@ -76,7 +78,7 @@ void FrameConnection::Init(mojo::ApplicationImpl* app, resource_provider_interfaces.push_back( resource_provider::ResourceProvider::Name_); filter->filter.insert("mojo:resource_provider", - resource_provider_interfaces.Pass()); + std::move(resource_provider_interfaces)); mojo::Array<mojo::String> network_service_interfaces; network_service_interfaces.push_back(mojo::CookieStore::Name_); @@ -84,35 +86,36 @@ void FrameConnection::Init(mojo::ApplicationImpl* app, network_service_interfaces.push_back(mojo::URLLoaderFactory::Name_); network_service_interfaces.push_back(mojo::WebSocketFactory::Name_); filter->filter.insert("mojo:network_service", - network_service_interfaces.Pass()); + std::move(network_service_interfaces)); mojo::Array<mojo::String> clipboard_interfaces; clipboard_interfaces.push_back(mojo::Clipboard::Name_); - filter->filter.insert("mojo:clipboard", clipboard_interfaces.Pass()); + filter->filter.insert("mojo:clipboard", std::move(clipboard_interfaces)); mojo::Array<mojo::String> tracing_interfaces; tracing_interfaces.push_back(tracing::StartupPerformanceDataCollector::Name_); tracing_interfaces.push_back(tracing::TraceCollector::Name_); - filter->filter.insert("mojo:tracing", tracing_interfaces.Pass()); + filter->filter.insert("mojo:tracing", std::move(tracing_interfaces)); mojo::Array<mojo::String> window_manager_interfaces; window_manager_interfaces.push_back(mus::mojom::Gpu::Name_); window_manager_interfaces.push_back(mus::mojom::WindowTreeHostFactory::Name_); - filter->filter.insert("mojo:mus", window_manager_interfaces.Pass()); + filter->filter.insert("mojo:mus", std::move(window_manager_interfaces)); mojo::Array<mojo::String> test_runner_interfaces; test_runner_interfaces.push_back(LayoutTestRunner::Name_); filter->filter.insert("mojo:web_view_test_runner", - test_runner_interfaces.Pass()); + std::move(test_runner_interfaces)); #if defined(OS_LINUX) && !defined(OS_ANDROID) mojo::Array<mojo::String> font_service_interfaces; font_service_interfaces.push_back(font_service::FontService::Name_); - filter->filter.insert("mojo:font_service", font_service_interfaces.Pass()); + filter->filter.insert("mojo:font_service", + std::move(font_service_interfaces)); #endif - mojo::ApplicationImpl::ConnectParams params(request.Pass()); - params.set_filter(filter.Pass()); + mojo::ApplicationImpl::ConnectParams params(std::move(request)); + params.set_filter(std::move(filter)); application_connection_ = app->ConnectToApplication(¶ms); application_connection_->ConnectToService(&frame_client_); application_connection_->AddContentHandlerIDCallback(on_got_id_callback); @@ -122,7 +125,7 @@ mus::mojom::WindowTreeClientPtr FrameConnection::GetWindowTreeClient() { DCHECK(application_connection_); mus::mojom::WindowTreeClientPtr window_tree_client; application_connection_->ConnectToService(&window_tree_client); - return window_tree_client.Pass(); + return window_tree_client; } uint32_t FrameConnection::GetContentHandlerID() const { diff --git a/components/web_view/frame_devtools_agent.cc b/components/web_view/frame_devtools_agent.cc index 54c11a0..cf4cd25 100644 --- a/components/web_view/frame_devtools_agent.cc +++ b/components/web_view/frame_devtools_agent.cc @@ -5,7 +5,7 @@ #include "components/web_view/frame_devtools_agent.h" #include <string.h> - +#include <utility> #include <vector> #include "base/bind.h" @@ -44,7 +44,9 @@ class FrameDevToolsAgent::FrameDevToolsAgentClient public: FrameDevToolsAgentClient(FrameDevToolsAgent* owner, DevToolsAgentClientPtr forward_client) - : owner_(owner), binding_(this), forward_client_(forward_client.Pass()) { + : owner_(owner), + binding_(this), + forward_client_(std::move(forward_client)) { forward_client_.set_connection_error_handler(base::Bind( &FrameDevToolsAgent::OnForwardClientClosed, base::Unretained(owner_))); if (owner_->forward_agent_) @@ -61,7 +63,7 @@ class FrameDevToolsAgent::FrameDevToolsAgentClient DevToolsAgentClientPtr client; binding_.Bind(&client); - owner_->forward_agent_->SetClient(client.Pass()); + owner_->forward_agent_->SetClient(std::move(client)); } private: @@ -102,7 +104,7 @@ void FrameDevToolsAgent::AttachFrame( DevToolsAgentPtr forward_agent, Frame::ClientPropertyMap* devtools_properties) { RegisterAgentIfNecessary(); - forward_agent_ = forward_agent.Pass(); + forward_agent_ = std::move(forward_agent); StringToVector(id_, &(*devtools_properties)["devtools-id"]); if (client_impl_) { @@ -126,7 +128,7 @@ void FrameDevToolsAgent::RegisterAgentIfNecessary() { DevToolsAgentPtr agent; binding_.Bind(&agent); - devtools_registry->RegisterAgent(id_, agent.Pass()); + devtools_registry->RegisterAgent(id_, std::move(agent)); } void FrameDevToolsAgent::HandlePageNavigateRequest( @@ -152,7 +154,7 @@ void FrameDevToolsAgent::HandlePageNavigateRequest( } void FrameDevToolsAgent::SetClient(DevToolsAgentClientPtr client) { - client_impl_.reset(new FrameDevToolsAgentClient(this, client.Pass())); + client_impl_.reset(new FrameDevToolsAgentClient(this, std::move(client))); } void FrameDevToolsAgent::DispatchProtocolMessage(const String& message) { diff --git a/components/web_view/frame_tree.cc b/components/web_view/frame_tree.cc index 876135d..16612ed 100644 --- a/components/web_view/frame_tree.cc +++ b/components/web_view/frame_tree.cc @@ -4,6 +4,8 @@ #include "components/web_view/frame_tree.h" +#include <utility> + #include "components/web_view/frame_tree_delegate.h" #include "components/web_view/frame_user_data.h" @@ -25,11 +27,11 @@ FrameTree::FrameTree(uint32_t root_app_id, root_app_id, WindowOwnership::DOESNT_OWN_WINDOW, root_client, - user_data.Pass(), + std::move(user_data), client_properties)), progress_(0.f), change_id_(1u) { - root_->Init(nullptr, window_tree_client.Pass(), nullptr, + root_->Init(nullptr, std::move(window_tree_client), nullptr, navigation_start_time); } @@ -49,15 +51,15 @@ Frame* FrameTree::CreateChildFrame( const Frame::ClientPropertyMap& client_properties) { mojom::FrameClient* raw_client = client.get(); scoped_ptr<FrameUserData> user_data = - delegate_->CreateUserDataForNewFrame(client.Pass()); + delegate_->CreateUserDataForNewFrame(std::move(client)); mus::Window* frame_window = root_->window()->GetChildById(frame_id); // |frame_window| may be null if the Window hasn't been created yet. If this // is the case the Window will be connected to the Frame in // Frame::OnTreeChanged. Frame* frame = new Frame(this, frame_window, frame_id, app_id, WindowOwnership::OWNS_WINDOW, raw_client, - user_data.Pass(), client_properties); - frame->Init(parent, nullptr, frame_request.Pass(), base::TimeTicks()); + std::move(user_data), client_properties); + frame->Init(parent, nullptr, std::move(frame_request), base::TimeTicks()); return frame; } diff --git a/components/web_view/local_find_options.cc b/components/web_view/local_find_options.cc index 706af5b..1e0a670 100644 --- a/components/web_view/local_find_options.cc +++ b/components/web_view/local_find_options.cc @@ -12,7 +12,7 @@ TypeConverter<web_view::mojom::FindOptionsPtr, web_view::LocalFindOptions>:: web_view::mojom::FindOptionsPtr output = web_view::mojom::FindOptions::New(); output->forward = input.forward; output->continue_last_find = input.continue_last_find; - return output.Pass(); + return output; } } // namespace mojo diff --git a/components/web_view/navigation_controller.cc b/components/web_view/navigation_controller.cc index 87304fa..d64c0d8 100644 --- a/components/web_view/navigation_controller.cc +++ b/components/web_view/navigation_controller.cc @@ -4,6 +4,8 @@ #include "components/web_view/navigation_controller.h" +#include <utility> + #include "components/web_view/frame.h" #include "components/web_view/navigation_controller_delegate.h" #include "components/web_view/navigation_entry.h" @@ -99,7 +101,7 @@ void NavigationController::GoForward() { void NavigationController::LoadURL(mojo::URLRequestPtr request) { // TODO(erg): This mimics part of NavigationControllerImpl::LoadURL(), minus // all the error checking. - SetPendingEntry(make_scoped_ptr(new NavigationEntry(request.Pass()))); + SetPendingEntry(make_scoped_ptr(new NavigationEntry(std::move(request)))); NavigateToPendingEntry(ReloadType::NO_RELOAD, false); } diff --git a/components/web_view/navigation_entry.cc b/components/web_view/navigation_entry.cc index 24d6db9..c82994a 100644 --- a/components/web_view/navigation_entry.cc +++ b/components/web_view/navigation_entry.cc @@ -4,10 +4,12 @@ #include "components/web_view/navigation_entry.h" +#include <utility> + namespace web_view { NavigationEntry::NavigationEntry(mojo::URLRequestPtr original_request) - : url_request_(original_request.Pass()) { + : url_request_(std::move(original_request)) { if (url_request_.originating_time().is_null()) url_request_.set_originating_time(base::TimeTicks::Now()); } diff --git a/components/web_view/pending_web_view_load.cc b/components/web_view/pending_web_view_load.cc index 503a1b4..a86aa0c 100644 --- a/components/web_view/pending_web_view_load.cc +++ b/components/web_view/pending_web_view_load.cc @@ -4,6 +4,8 @@ #include "components/web_view/pending_web_view_load.h" +#include <utility> + #include "base/bind.h" #include "base/callback.h" #include "components/web_view/frame_connection.h" @@ -22,7 +24,7 @@ void PendingWebViewLoad::Init(mojo::URLRequestPtr request) { navigation_start_time_ = base::TimeTicks::FromInternalValue(request->originating_time_ticks); frame_connection_.reset(new FrameConnection); - frame_connection_->Init(web_view_->app_, request.Pass(), + frame_connection_->Init(web_view_->app_, std::move(request), base::Bind(&PendingWebViewLoad::OnGotContentHandlerID, base::Unretained(this))); } diff --git a/components/web_view/pending_web_view_load.h b/components/web_view/pending_web_view_load.h index ac8415b..9151db4 100644 --- a/components/web_view/pending_web_view_load.h +++ b/components/web_view/pending_web_view_load.h @@ -6,6 +6,7 @@ #define COMPONENTS_WEB_VIEW_PENDING_WEB_VIEW_LOAD_H_ #include <string> +#include <utility> #include "base/macros.h" #include "base/memory/scoped_ptr.h" @@ -28,7 +29,7 @@ class PendingWebViewLoad { void Init(mojo::URLRequestPtr request); scoped_ptr<FrameConnection> frame_connection() { - return frame_connection_.Pass(); + return std::move(frame_connection_); } bool is_content_handler_id_valid() const { diff --git a/components/web_view/public/cpp/web_view.cc b/components/web_view/public/cpp/web_view.cc index e8f581d..1d966b3 100644 --- a/components/web_view/public/cpp/web_view.cc +++ b/components/web_view/public/cpp/web_view.cc @@ -5,6 +5,7 @@ #include "components/web_view/public/cpp/web_view.h" #include <stdint.h> +#include <utility> #include "base/bind.h" #include "components/mus/public/cpp/window.h" @@ -26,15 +27,15 @@ void WebView::Init(mojo::ApplicationImpl* app, mus::Window* window) { mojom::WebViewClientPtr client; mojo::InterfaceRequest<mojom::WebViewClient> client_request = GetProxy(&client); - binding_.Bind(client_request.Pass()); + binding_.Bind(std::move(client_request)); mojom::WebViewFactoryPtr factory; app->ConnectToService("mojo:web_view", &factory); - factory->CreateWebView(client.Pass(), GetProxy(&web_view_)); + factory->CreateWebView(std::move(client), GetProxy(&web_view_)); mus::mojom::WindowTreeClientPtr window_tree_client; web_view_->GetWindowTreeClient(GetProxy(&window_tree_client)); - window->Embed(window_tree_client.Pass(), + window->Embed(std::move(window_tree_client), mus::mojom::WindowTree::ACCESS_POLICY_EMBED_ROOT, base::Bind(&OnEmbed)); } diff --git a/components/web_view/test_frame_tree_delegate.cc b/components/web_view/test_frame_tree_delegate.cc index 8c439b2..90d8fe9 100644 --- a/components/web_view/test_frame_tree_delegate.cc +++ b/components/web_view/test_frame_tree_delegate.cc @@ -4,6 +4,8 @@ #include "components/web_view/test_frame_tree_delegate.h" +#include <utility> + #include "base/run_loop.h" #include "components/web_view/client_initiated_frame_connection.h" #include "components/web_view/frame_connection.h" @@ -51,7 +53,7 @@ void TestFrameTreeDelegate::WaitForFrameDisconnected(Frame* frame) { scoped_ptr<FrameUserData> TestFrameTreeDelegate::CreateUserDataForNewFrame( mojom::FrameClientPtr frame_client) { return make_scoped_ptr( - new ClientInitiatedFrameConnection(frame_client.Pass())); + new ClientInitiatedFrameConnection(std::move(frame_client))); } bool TestFrameTreeDelegate::CanPostMessageEventToFrame( @@ -74,7 +76,7 @@ void TestFrameTreeDelegate::CanNavigateFrame( mojo::URLRequestPtr request, const CanNavigateFrameCallback& callback) { FrameConnection::CreateConnectionForCanNavigateFrame( - app_, target, request.Pass(), callback); + app_, target, std::move(request), callback); } void TestFrameTreeDelegate::DidStartNavigation(Frame* frame) {} diff --git a/components/web_view/test_runner/test_runner_application_delegate.cc b/components/web_view/test_runner/test_runner_application_delegate.cc index b2b2584..b0cf38d 100644 --- a/components/web_view/test_runner/test_runner_application_delegate.cc +++ b/components/web_view/test_runner/test_runner_application_delegate.cc @@ -5,6 +5,7 @@ #include "components/web_view/test_runner/test_runner_application_delegate.h" #include <iostream> +#include <utility> #include "base/bind.h" #include "base/command_line.h" @@ -51,7 +52,7 @@ void TestRunnerApplicationDelegate::LaunchURL(const GURL& test_url) { } mojo::URLRequestPtr request(mojo::URLRequest::New()); request->url = test_url.spec(); - web_view_->web_view()->LoadRequest(request.Pass()); + web_view_->web_view()->LoadRequest(std::move(request)); } void TestRunnerApplicationDelegate::Terminate() { @@ -123,7 +124,7 @@ void TestRunnerApplicationDelegate::OnConnectionLost( void TestRunnerApplicationDelegate::TopLevelNavigateRequest( mojo::URLRequestPtr request) { - web_view_->web_view()->LoadRequest(request.Pass()); + web_view_->web_view()->LoadRequest(std::move(request)); } void TestRunnerApplicationDelegate::TopLevelNavigationStarted( @@ -158,7 +159,7 @@ void TestRunnerApplicationDelegate::TestFinished() { void TestRunnerApplicationDelegate::Create( mojo::ApplicationConnection* connection, mojo::InterfaceRequest<web_view::LayoutTestRunner> request) { - layout_test_runner_.AddBinding(this, request.Pass()); + layout_test_runner_.AddBinding(this, std::move(request)); } } // namespace web_view diff --git a/components/web_view/url_request_cloneable.cc b/components/web_view/url_request_cloneable.cc index c8e7446..a9bf9c6 100644 --- a/components/web_view/url_request_cloneable.cc +++ b/components/web_view/url_request_cloneable.cc @@ -5,6 +5,7 @@ #include "components/web_view/url_request_cloneable.h" #include <stddef.h> +#include <utility> #include "base/logging.h" #include "mojo/common/data_pipe_utils.h" @@ -21,7 +22,7 @@ namespace web_view { URLRequestCloneable::URLRequestCloneable(mojo::URLRequestPtr original_request) : url_(original_request->url), method_(original_request->method), - headers_(original_request->headers.Pass()), + headers_(std::move(original_request->headers)), response_body_buffer_size_(original_request->response_body_buffer_size), auto_follow_redirects_(original_request->auto_follow_redirects), bypass_cache_(original_request->bypass_cache), @@ -31,7 +32,7 @@ URLRequestCloneable::URLRequestCloneable(mojo::URLRequestPtr original_request) original_request->originating_time_ticks)) { // TODO(erg): Maybe we can do some sort of async copy here? for (size_t i = 0; i < original_request->body.size(); ++i) { - mojo::common::BlockingCopyToString(original_request->body[i].Pass(), + mojo::common::BlockingCopyToString(std::move(original_request->body[i]), &body_[i]); } } @@ -68,7 +69,7 @@ mojo::URLRequestPtr URLRequestCloneable::Clone() const { options.element_num_bytes = 1; options.capacity_num_bytes = num_bytes; mojo::DataPipe data_pipe(options); - request->body[i] = data_pipe.consumer_handle.Pass(); + request->body[i] = std::move(data_pipe.consumer_handle); WriteDataRaw(data_pipe.producer_handle.get(), body_[i].data(), &num_bytes, MOJO_WRITE_DATA_FLAG_ALL_OR_NONE); DCHECK_EQ(num_bytes, body_[i].size()); @@ -77,7 +78,7 @@ mojo::URLRequestPtr URLRequestCloneable::Clone() const { request->originating_time_ticks = originating_time_.ToInternalValue(); - return request.Pass(); + return request; } } // namespace web_view diff --git a/components/web_view/web_view_application_delegate.cc b/components/web_view/web_view_application_delegate.cc index 2a4c48e..d66b775 100644 --- a/components/web_view/web_view_application_delegate.cc +++ b/components/web_view/web_view_application_delegate.cc @@ -4,6 +4,8 @@ #include "components/web_view/web_view_application_delegate.h" +#include <utility> + #include "components/web_view/web_view_impl.h" #include "mojo/application/public/cpp/application_connection.h" @@ -26,13 +28,13 @@ bool WebViewApplicationDelegate::ConfigureIncomingConnection( void WebViewApplicationDelegate::CreateWebView( mojom::WebViewClientPtr client, mojo::InterfaceRequest<mojom::WebView> web_view) { - new WebViewImpl(app_, client.Pass(), web_view.Pass()); + new WebViewImpl(app_, std::move(client), std::move(web_view)); } void WebViewApplicationDelegate::Create( mojo::ApplicationConnection* connection, mojo::InterfaceRequest<mojom::WebViewFactory> request) { - factory_bindings_.AddBinding(this, request.Pass()); + factory_bindings_.AddBinding(this, std::move(request)); } } // namespace web_view diff --git a/components/web_view/web_view_apptest.cc b/components/web_view/web_view_apptest.cc index de791f0..d8d7858 100644 --- a/components/web_view/web_view_apptest.cc +++ b/components/web_view/web_view_apptest.cc @@ -5,6 +5,7 @@ #include "components/web_view/public/cpp/web_view.h" #include <stdint.h> +#include <utility> #include "base/base_paths.h" #include "base/files/file_path.h" @@ -83,7 +84,7 @@ class WebViewTest : public mus::WindowServerTestBase, void NavigateTo(const std::string& file) { mojo::URLRequestPtr request(mojo::URLRequest::New()); request->url = GetTestFileURL(file).spec(); - web_view()->LoadRequest(request.Pass()); + web_view()->LoadRequest(std::move(request)); StartNestedRunLoopUntil(LOADING_DONE); } diff --git a/components/web_view/web_view_impl.cc b/components/web_view/web_view_impl.cc index 45063e8..43f0111 100644 --- a/components/web_view/web_view_impl.cc +++ b/components/web_view/web_view_impl.cc @@ -5,6 +5,7 @@ #include "components/web_view/web_view_impl.h" #include <queue> +#include <utility> #include "base/bind.h" #include "base/command_line.h" @@ -43,8 +44,8 @@ WebViewImpl::WebViewImpl(mojo::ApplicationImpl* app, mojom::WebViewClientPtr client, mojo::InterfaceRequest<mojom::WebView> request) : app_(app), - client_(client.Pass()), - binding_(this, request.Pass()), + client_(std::move(client)), + binding_(this, std::move(request)), root_(nullptr), content_(nullptr), find_controller_(this), @@ -80,7 +81,7 @@ void WebViewImpl::OnLoad(const GURL& pending_url) { content_->SetVisible(true); content_->AddObserver(this); - scoped_ptr<PendingWebViewLoad> pending_load(pending_load_.Pass()); + scoped_ptr<PendingWebViewLoad> pending_load(std::move(pending_load_)); scoped_ptr<FrameConnection> frame_connection( pending_load->frame_connection()); mus::mojom::WindowTreeClientPtr window_tree_client = @@ -91,15 +92,15 @@ void WebViewImpl::OnLoad(const GURL& pending_url) { devtools_service::DevToolsAgentPtr forward_agent; frame_connection->application_connection()->ConnectToService( &forward_agent); - devtools_agent_->AttachFrame(forward_agent.Pass(), &client_properties); + devtools_agent_->AttachFrame(std::move(forward_agent), &client_properties); } mojom::FrameClient* frame_client = frame_connection->frame_client(); const uint32_t content_handler_id = frame_connection->GetContentHandlerID(); - frame_tree_.reset(new FrameTree(content_handler_id, content_, - window_tree_client.Pass(), this, frame_client, - frame_connection.Pass(), client_properties, - pending_load->navigation_start_time())); + frame_tree_.reset( + new FrameTree(content_handler_id, content_, std::move(window_tree_client), + this, frame_client, std::move(frame_connection), + client_properties, pending_load->navigation_start_time())); } void WebViewImpl::PreOrderDepthFirstTraverseTree(Frame* node, @@ -113,13 +114,13 @@ void WebViewImpl::PreOrderDepthFirstTraverseTree(Frame* node, // WebViewImpl, WebView implementation: void WebViewImpl::LoadRequest(mojo::URLRequestPtr request) { - navigation_controller_.LoadURL(request.Pass()); + navigation_controller_.LoadURL(std::move(request)); } void WebViewImpl::GetWindowTreeClient( mojo::InterfaceRequest<mus::mojom::WindowTreeClient> window_tree_client) { mus::WindowTreeConnection::Create( - this, window_tree_client.Pass(), + this, std::move(window_tree_client), mus::WindowTreeConnection::CreateType::DONT_WAIT_FOR_EMBED); } @@ -186,7 +187,7 @@ void WebViewImpl::OnWindowDestroyed(mus::Window* window) { scoped_ptr<FrameUserData> WebViewImpl::CreateUserDataForNewFrame( mojom::FrameClientPtr frame_client) { return make_scoped_ptr( - new ClientInitiatedFrameConnection(frame_client.Pass())); + new ClientInitiatedFrameConnection(std::move(frame_client))); } bool WebViewImpl::CanPostMessageEventToFrame(const Frame* source, @@ -204,14 +205,14 @@ void WebViewImpl::TitleChanged(const mojo::String& title) { } void WebViewImpl::NavigateTopLevel(Frame* source, mojo::URLRequestPtr request) { - client_->TopLevelNavigateRequest(request.Pass()); + client_->TopLevelNavigateRequest(std::move(request)); } void WebViewImpl::CanNavigateFrame(Frame* target, mojo::URLRequestPtr request, const CanNavigateFrameCallback& callback) { FrameConnection::CreateConnectionForCanNavigateFrame( - app_, target, request.Pass(), callback); + app_, target, std::move(request), callback); } void WebViewImpl::DidStartNavigation(Frame* frame) {} @@ -252,7 +253,7 @@ void WebViewImpl::OnFindInPageSelectionUpdated(int32_t request_id, void WebViewImpl::HandlePageNavigateRequest(const GURL& url) { mojo::URLRequestPtr request(mojo::URLRequest::New()); request->url = url.spec(); - client_->TopLevelNavigateRequest(request.Pass()); + client_->TopLevelNavigateRequest(std::move(request)); } //////////////////////////////////////////////////////////////////////////////// @@ -260,7 +261,7 @@ void WebViewImpl::HandlePageNavigateRequest(const GURL& url) { void WebViewImpl::OnNavigate(mojo::URLRequestPtr request) { pending_load_.reset(new PendingWebViewLoad(this)); - pending_load_->Init(request.Pass()); + pending_load_->Init(std::move(request)); } void WebViewImpl::OnDidNavigate() { diff --git a/components/webcrypto/algorithms/asymmetric_key_util.cc b/components/webcrypto/algorithms/asymmetric_key_util.cc index 74eb6c4..251c277 100644 --- a/components/webcrypto/algorithms/asymmetric_key_util.cc +++ b/components/webcrypto/algorithms/asymmetric_key_util.cc @@ -6,6 +6,7 @@ #include <openssl/pkcs12.h> #include <stdint.h> +#include <utility> #include "components/webcrypto/algorithms/util.h" #include "components/webcrypto/blink_key_handle.h" @@ -71,7 +72,7 @@ Status CreateWebCryptoPublicKey(crypto::ScopedEVP_PKEY public_key, return status; *key = blink::WebCryptoKey::create( - CreateAsymmetricKeyHandle(public_key.Pass(), spki_data), + CreateAsymmetricKeyHandle(std::move(public_key), spki_data), blink::WebCryptoKeyTypePublic, extractable, algorithm, usages); return Status::Success(); } @@ -89,7 +90,7 @@ Status CreateWebCryptoPrivateKey(crypto::ScopedEVP_PKEY private_key, return status; *key = blink::WebCryptoKey::create( - CreateAsymmetricKeyHandle(private_key.Pass(), pkcs8_data), + CreateAsymmetricKeyHandle(std::move(private_key), pkcs8_data), blink::WebCryptoKeyTypePrivate, extractable, algorithm, usages); return Status::Success(); } diff --git a/components/webcrypto/algorithms/ec.cc b/components/webcrypto/algorithms/ec.cc index 11d4c58..33420ff 100644 --- a/components/webcrypto/algorithms/ec.cc +++ b/components/webcrypto/algorithms/ec.cc @@ -9,6 +9,7 @@ #include <openssl/evp.h> #include <openssl/pkcs12.h> #include <stddef.h> +#include <utility> #include "base/logging.h" #include "base/macros.h" @@ -276,12 +277,12 @@ Status EcAlgorithm::GenerateKey(const blink::WebCryptoAlgorithm& algorithm, // Note that extractable is unconditionally set to true. This is because per // the WebCrypto spec generated public keys are always extractable. - status = CreateWebCryptoPublicKey(public_pkey.Pass(), key_algorithm, true, + status = CreateWebCryptoPublicKey(std::move(public_pkey), key_algorithm, true, public_usages, &public_key); if (status.IsError()) return status; - status = CreateWebCryptoPrivateKey(private_pkey.Pass(), key_algorithm, + status = CreateWebCryptoPrivateKey(std::move(private_pkey), key_algorithm, extractable, private_usages, &private_key); if (status.IsError()) return status; @@ -316,7 +317,7 @@ Status EcAlgorithm::ImportKeyPkcs8(const CryptoData& key_data, if (status.IsError()) return status; - return CreateWebCryptoPrivateKey(private_key.Pass(), + return CreateWebCryptoPrivateKey(std::move(private_key), blink::WebCryptoKeyAlgorithm::createEc( algorithm.id(), params->namedCurve()), extractable, usages, key); @@ -341,7 +342,7 @@ Status EcAlgorithm::ImportKeySpki(const CryptoData& key_data, if (status.IsError()) return status; - return CreateWebCryptoPublicKey(public_key.Pass(), + return CreateWebCryptoPublicKey(std::move(public_key), blink::WebCryptoKeyAlgorithm::createEc( algorithm.id(), params->namedCurve()), extractable, usages, key); @@ -448,10 +449,10 @@ Status EcAlgorithm::ImportKeyJwk(const CryptoData& key_data, // Wrap the EVP_PKEY into a WebCryptoKey if (is_private_key) { - return CreateWebCryptoPrivateKey(pkey.Pass(), key_algorithm, extractable, - usages, key); + return CreateWebCryptoPrivateKey(std::move(pkey), key_algorithm, + extractable, usages, key); } - return CreateWebCryptoPublicKey(pkey.Pass(), key_algorithm, extractable, + return CreateWebCryptoPublicKey(std::move(pkey), key_algorithm, extractable, usages, key); } diff --git a/components/webcrypto/algorithms/rsa.cc b/components/webcrypto/algorithms/rsa.cc index 888b157..36da48b 100644 --- a/components/webcrypto/algorithms/rsa.cc +++ b/components/webcrypto/algorithms/rsa.cc @@ -5,6 +5,7 @@ #include "components/webcrypto/algorithms/rsa.h" #include <openssl/evp.h> +#include <utility> #include "base/logging.h" #include "components/webcrypto/algorithms/asymmetric_key_util.h" @@ -147,7 +148,7 @@ Status CreateWebCryptoRsaPrivateKey( if (status.IsError()) return status; - return CreateWebCryptoPrivateKey(private_key.Pass(), key_algorithm, + return CreateWebCryptoPrivateKey(std::move(private_key), key_algorithm, extractable, usages, key); } @@ -165,8 +166,8 @@ Status CreateWebCryptoRsaPublicKey( if (status.IsError()) return status; - return CreateWebCryptoPublicKey(public_key.Pass(), key_algorithm, extractable, - usages, key); + return CreateWebCryptoPublicKey(std::move(public_key), key_algorithm, + extractable, usages, key); } Status ImportRsaPrivateKey(const blink::WebCryptoAlgorithm& algorithm, @@ -199,7 +200,7 @@ Status ImportRsaPrivateKey(const blink::WebCryptoAlgorithm& algorithm, if (!pkey || !EVP_PKEY_set1_RSA(pkey.get(), rsa.get())) return Status::OperationError(); - return CreateWebCryptoRsaPrivateKey(pkey.Pass(), algorithm.id(), + return CreateWebCryptoRsaPrivateKey(std::move(pkey), algorithm.id(), algorithm.rsaHashedImportParams()->hash(), extractable, usages, key); } @@ -223,7 +224,7 @@ Status ImportRsaPublicKey(const blink::WebCryptoAlgorithm& algorithm, if (!pkey || !EVP_PKEY_set1_RSA(pkey.get(), rsa.get())) return Status::OperationError(); - return CreateWebCryptoRsaPublicKey(pkey.Pass(), algorithm.id(), + return CreateWebCryptoRsaPublicKey(std::move(pkey), algorithm.id(), algorithm.rsaHashedImportParams()->hash(), extractable, usages, key); } @@ -320,13 +321,13 @@ Status RsaHashedAlgorithm::GenerateKey( // Note that extractable is unconditionally set to true. This is because per // the WebCrypto spec generated public keys are always extractable. - status = CreateWebCryptoRsaPublicKey(public_pkey.Pass(), algorithm.id(), + status = CreateWebCryptoRsaPublicKey(std::move(public_pkey), algorithm.id(), params->hash(), true, public_usages, &public_key); if (status.IsError()) return status; - status = CreateWebCryptoRsaPrivateKey(private_pkey.Pass(), algorithm.id(), + status = CreateWebCryptoRsaPrivateKey(std::move(private_pkey), algorithm.id(), params->hash(), extractable, private_usages, &private_key); if (status.IsError()) @@ -365,7 +366,7 @@ Status RsaHashedAlgorithm::ImportKeyPkcs8( // TODO(eroman): Validate the algorithm OID against the webcrypto provided // hash. http://crbug.com/389400 - return CreateWebCryptoRsaPrivateKey(private_key.Pass(), algorithm.id(), + return CreateWebCryptoRsaPrivateKey(std::move(private_key), algorithm.id(), algorithm.rsaHashedImportParams()->hash(), extractable, usages, key); } @@ -385,7 +386,7 @@ Status RsaHashedAlgorithm::ImportKeySpki( // TODO(eroman): Validate the algorithm OID against the webcrypto provided // hash. http://crbug.com/389400 - return CreateWebCryptoRsaPublicKey(public_key.Pass(), algorithm.id(), + return CreateWebCryptoRsaPublicKey(std::move(public_key), algorithm.id(), algorithm.rsaHashedImportParams()->hash(), extractable, usages, key); } diff --git a/components/webcrypto/algorithms/rsa_oaep_unittest.cc b/components/webcrypto/algorithms/rsa_oaep_unittest.cc index de1d66f..05f7e953 100644 --- a/components/webcrypto/algorithms/rsa_oaep_unittest.cc +++ b/components/webcrypto/algorithms/rsa_oaep_unittest.cc @@ -49,7 +49,7 @@ scoped_ptr<base::DictionaryValue> CreatePublicKeyJwkDict() { Base64EncodeUrlSafe(HexStringToBytes(kPublicKeyModulusHex))); jwk->SetString("e", Base64EncodeUrlSafe(HexStringToBytes(kPublicKeyExponentHex))); - return jwk.Pass(); + return jwk; } class WebCryptoRsaOaepTest : public WebCryptoTestBase {}; diff --git a/components/webcrypto/blink_key_handle.cc b/components/webcrypto/blink_key_handle.cc index 6b8c1f4..012c7c0 100644 --- a/components/webcrypto/blink_key_handle.cc +++ b/components/webcrypto/blink_key_handle.cc @@ -4,6 +4,8 @@ #include "components/webcrypto/blink_key_handle.h" +#include <utility> + #include "base/logging.h" #include "base/macros.h" #include "components/webcrypto/crypto_data.h" @@ -63,7 +65,7 @@ class AsymKey : public Key { public: AsymKey(crypto::ScopedEVP_PKEY pkey, const std::vector<uint8_t>& serialized_key_data) - : Key(CryptoData(serialized_key_data)), pkey_(pkey.Pass()) {} + : Key(CryptoData(serialized_key_data)), pkey_(std::move(pkey)) {} AsymKey* AsAsymKey() override { return this; } @@ -105,7 +107,7 @@ blink::WebCryptoKeyHandle* CreateSymmetricKeyHandle( blink::WebCryptoKeyHandle* CreateAsymmetricKeyHandle( crypto::ScopedEVP_PKEY pkey, const std::vector<uint8_t>& serialized_key_data) { - return new AsymKey(pkey.Pass(), serialized_key_data); + return new AsymKey(std::move(pkey), serialized_key_data); } } // namespace webcrypto diff --git a/components/webcrypto/jwk.cc b/components/webcrypto/jwk.cc index f2f7afb..e1e814e3 100644 --- a/components/webcrypto/jwk.cc +++ b/components/webcrypto/jwk.cc @@ -97,7 +97,7 @@ scoped_ptr<base::ListValue> CreateJwkKeyOpsFromWebCryptoUsages( if (usages & kJwkWebCryptoUsageMap[i].webcrypto_usage) jwk_key_ops->AppendString(kJwkWebCryptoUsageMap[i].jwk_key_op); } - return jwk_key_ops.Pass(); + return jwk_key_ops; } // Composes a Web Crypto usage mask from an array of JWK key_ops values. diff --git a/components/webdata/common/web_data_request_manager.cc b/components/webdata/common/web_data_request_manager.cc index 701f8f6..dcaa320 100644 --- a/components/webdata/common/web_data_request_manager.cc +++ b/components/webdata/common/web_data_request_manager.cc @@ -4,6 +4,8 @@ #include "components/webdata/common/web_data_request_manager.h" +#include <utility> + #include "base/bind.h" #include "base/location.h" #include "base/message_loop/message_loop.h" @@ -63,11 +65,11 @@ void WebDataRequest::OnComplete() { } void WebDataRequest::SetResult(scoped_ptr<WDTypedResult> r) { - result_ = r.Pass(); + result_ = std::move(r); } scoped_ptr<WDTypedResult> WebDataRequest::GetResult(){ - return result_.Pass(); + return std::move(result_); } //////////////////////////////////////////////////////////////////////////////// diff --git a/components/webdata/common/web_database_backend.cc b/components/webdata/common/web_database_backend.cc index 2ed1d87..df09d30 100644 --- a/components/webdata/common/web_database_backend.cc +++ b/components/webdata/common/web_database_backend.cc @@ -4,6 +4,8 @@ #include "components/webdata/common/web_database_backend.h" +#include <utility> + #include "base/bind.h" #include "base/location.h" #include "components/webdata/common/web_data_request_manager.h" @@ -75,7 +77,7 @@ void WebDatabaseBackend::DBWriteTaskWrapper( return; ExecuteWriteTask(task); - request_manager_->RequestCompleted(request.Pass()); + request_manager_->RequestCompleted(std::move(request)); } void WebDatabaseBackend::ExecuteWriteTask( @@ -94,8 +96,8 @@ void WebDatabaseBackend::DBReadTaskWrapper( if (request->IsCancelled()) return; - request->SetResult(ExecuteReadTask(task).Pass()); - request_manager_->RequestCompleted(request.Pass()); + request->SetResult(ExecuteReadTask(task)); + request_manager_->RequestCompleted(std::move(request)); } scoped_ptr<WDTypedResult> WebDatabaseBackend::ExecuteReadTask( diff --git a/components/webdata/common/web_database_service.cc b/components/webdata/common/web_database_service.cc index 6fcc9f0..93b0924 100644 --- a/components/webdata/common/web_database_service.cc +++ b/components/webdata/common/web_database_service.cc @@ -5,6 +5,7 @@ #include "components/webdata/common/web_database_service.h" #include <stddef.h> +#include <utility> #include "base/bind.h" #include "base/location.h" @@ -61,7 +62,7 @@ void WebDatabaseService::AddTable(scoped_ptr<WebDatabaseTable> table) { web_db_backend_ = new WebDatabaseBackend( path_, new BackendDelegate(weak_ptr_factory_.GetWeakPtr()), db_thread_); } - web_db_backend_->AddTable(table.Pass()); + web_db_backend_->AddTable(std::move(table)); } void WebDatabaseService::LoadDatabase() { |