0

Global conversion of Pass()→std::move(): CrOS edition

(╯^□^)╯︵ ❄☃❄

BUG=557422
R=avi@chromium.org
TBR=jam@chromium.org

Review URL: https://codereview.chromium.org/1552863003

Cr-Commit-Position: refs/heads/master@{#367249}
This commit is contained in:
dcheng
2015-12-31 08:11:45 -08:00
committed by Commit bot
parent 49d16ffa11
commit cf738a94eb
24 changed files with 113 additions and 129 deletions

@ -414,8 +414,7 @@ void DownloadItemNotification::UpdateNotificationData(
UpdateNotificationIcon();
std::vector<message_center::ButtonInfo> notification_actions;
scoped_ptr<std::vector<DownloadCommands::Command>> actions(
GetExtraActions().Pass());
scoped_ptr<std::vector<DownloadCommands::Command>> actions(GetExtraActions());
button_actions_.reset(new std::vector<DownloadCommands::Command>);
for (auto it = actions->begin(); it != actions->end(); it++) {
@ -643,7 +642,7 @@ DownloadItemNotification::GetExtraActions() const {
actions->push_back(DownloadCommands::DISCARD);
actions->push_back(DownloadCommands::KEEP);
}
return actions.Pass();
return actions;
}
switch (item_->GetState()) {
@ -667,7 +666,7 @@ DownloadItemNotification::GetExtraActions() const {
case content::DownloadItem::MAX_DOWNLOAD_STATE:
NOTREACHED();
}
return actions.Pass();
return actions;
}
base::string16 DownloadItemNotification::GetTitle() const {

@ -5,6 +5,7 @@
#include "chrome/browser/download/notification/download_item_notification.h"
#include <stddef.h>
#include <utility>
#include "base/macros.h"
#include "base/message_loop/message_loop.h"
@ -74,8 +75,8 @@ class DownloadItemNotificationTest : public testing::Test {
profile_ = profile_manager_->CreateTestingProfile("test-user");
scoped_ptr<NotificationUIManager> ui_manager(new StubNotificationUIManager);
TestingBrowserProcess::GetGlobal()->
SetNotificationUIManager(ui_manager.Pass());
TestingBrowserProcess::GetGlobal()->SetNotificationUIManager(
std::move(ui_manager));
download_notification_manager_.reset(
new DownloadNotificationManagerForProfile(profile_, nullptr));

@ -3,6 +3,7 @@
// found in the LICENSE file.
#include <stddef.h>
#include <utility>
#include "base/command_line.h"
#include "base/macros.h"
@ -338,7 +339,7 @@ class DownloadNotificationTest : public DownloadNotificationTestBase {
test_delegate->GetDownloadIdReceiverCallback().Run(
content::DownloadItem::kInvalidId + 1);
DownloadServiceFactory::GetForBrowserContext(profile)
->SetDownloadManagerDelegateForTesting(test_delegate.Pass());
->SetDownloadManagerDelegateForTesting(std::move(test_delegate));
DownloadNotificationTestBase::SetUpOnMainThread();
}
@ -359,7 +360,8 @@ class DownloadNotificationTest : public DownloadNotificationTestBase {
incognito_test_delegate.reset(
new TestChromeDownloadManagerDelegate(incognito_profile));
DownloadServiceFactory::GetForBrowserContext(incognito_profile)
->SetDownloadManagerDelegateForTesting(incognito_test_delegate.Pass());
->SetDownloadManagerDelegateForTesting(
std::move(incognito_test_delegate));
}
TestChromeDownloadManagerDelegate* GetIncognitoDownloadManagerDelegate()

@ -5,10 +5,10 @@
#include "chrome/browser/metrics/perf/perf_provider_chromeos.h"
#include <stddef.h>
#include <algorithm>
#include <map>
#include <string>
#include <utility>
#include "base/bind.h"
#include "base/callback.h"
@ -592,7 +592,7 @@ void PerfProvider::DoPeriodicCollection() {
scoped_ptr<SampledProfile> sampled_profile(new SampledProfile);
sampled_profile->set_trigger_event(SampledProfile::PERIODIC_COLLECTION);
CollectIfNecessary(sampled_profile.Pass());
CollectIfNecessary(std::move(sampled_profile));
}
void PerfProvider::CollectPerfDataAfterResume(
@ -604,7 +604,7 @@ void PerfProvider::CollectPerfDataAfterResume(
sampled_profile->set_suspend_duration_ms(sleep_duration.InMilliseconds());
sampled_profile->set_ms_after_resume(time_after_resume.InMilliseconds());
CollectIfNecessary(sampled_profile.Pass());
CollectIfNecessary(std::move(sampled_profile));
}
void PerfProvider::CollectPerfDataAfterSessionRestore(
@ -616,7 +616,7 @@ void PerfProvider::CollectPerfDataAfterSessionRestore(
sampled_profile->set_ms_after_restore(time_after_restore.InMilliseconds());
sampled_profile->set_num_tabs_restored(num_tabs_restored);
CollectIfNecessary(sampled_profile.Pass());
CollectIfNecessary(std::move(sampled_profile));
last_session_restore_collection_time_ = base::TimeTicks::Now();
}

@ -5,8 +5,8 @@
#include "chrome/browser/metrics/perf/perf_provider_chromeos.h"
#include <stdint.h>
#include <string>
#include <utility>
#include <vector>
#include "base/macros.h"
@ -115,7 +115,7 @@ class TestIncognitoObserver : public WindowedIncognitoObserver {
bool incognito_launched) {
scoped_ptr<TestIncognitoObserver> observer(new TestIncognitoObserver);
observer->set_incognito_launched(incognito_launched);
return observer.Pass();
return std::move(observer);
}
private:
@ -203,9 +203,7 @@ TEST_F(PerfProviderTest, NoPerfData) {
perf_provider_->ParseOutputProtoIfValid(
TestIncognitoObserver::CreateWithIncognitoLaunched(false),
sampled_profile.Pass(),
kPerfSuccess,
std::vector<uint8_t>(),
std::move(sampled_profile), kPerfSuccess, std::vector<uint8_t>(),
std::vector<uint8_t>());
std::vector<SampledProfile> stored_profiles;
@ -218,10 +216,8 @@ TEST_F(PerfProviderTest, PerfDataProtoOnly) {
perf_provider_->ParseOutputProtoIfValid(
TestIncognitoObserver::CreateWithIncognitoLaunched(false),
sampled_profile.Pass(),
kPerfSuccess,
SerializeMessageToVector(perf_data_proto_),
std::vector<uint8_t>());
std::move(sampled_profile), kPerfSuccess,
SerializeMessageToVector(perf_data_proto_), std::vector<uint8_t>());
std::vector<SampledProfile> stored_profiles;
EXPECT_TRUE(perf_provider_->GetSampledProfiles(&stored_profiles));
@ -243,9 +239,7 @@ TEST_F(PerfProviderTest, PerfStatProtoOnly) {
perf_provider_->ParseOutputProtoIfValid(
TestIncognitoObserver::CreateWithIncognitoLaunched(false),
sampled_profile.Pass(),
kPerfSuccess,
std::vector<uint8_t>(),
std::move(sampled_profile), kPerfSuccess, std::vector<uint8_t>(),
SerializeMessageToVector(perf_stat_proto_));
std::vector<SampledProfile> stored_profiles;
@ -268,8 +262,7 @@ TEST_F(PerfProviderTest, BothPerfDataProtoAndPerfStatProto) {
perf_provider_->ParseOutputProtoIfValid(
TestIncognitoObserver::CreateWithIncognitoLaunched(false),
sampled_profile.Pass(),
kPerfSuccess,
std::move(sampled_profile), kPerfSuccess,
SerializeMessageToVector(perf_data_proto_),
SerializeMessageToVector(perf_stat_proto_));
@ -284,10 +277,8 @@ TEST_F(PerfProviderTest, InvalidPerfOutputResult) {
perf_provider_->ParseOutputProtoIfValid(
TestIncognitoObserver::CreateWithIncognitoLaunched(false),
sampled_profile.Pass(),
kPerfFailure,
SerializeMessageToVector(perf_data_proto_),
std::vector<uint8_t>());
std::move(sampled_profile), kPerfFailure,
SerializeMessageToVector(perf_data_proto_), std::vector<uint8_t>());
// Should not have been stored.
std::vector<SampledProfile> stored_profiles;
@ -302,19 +293,15 @@ TEST_F(PerfProviderTest, MultipleCalls) {
perf_provider_->ParseOutputProtoIfValid(
TestIncognitoObserver::CreateWithIncognitoLaunched(false),
sampled_profile.Pass(),
kPerfSuccess,
SerializeMessageToVector(perf_data_proto_),
std::vector<uint8_t>());
std::move(sampled_profile), kPerfSuccess,
SerializeMessageToVector(perf_data_proto_), std::vector<uint8_t>());
sampled_profile.reset(new SampledProfile);
sampled_profile->set_trigger_event(SampledProfile::RESTORE_SESSION);
sampled_profile->set_ms_after_restore(3000);
perf_provider_->ParseOutputProtoIfValid(
TestIncognitoObserver::CreateWithIncognitoLaunched(false),
sampled_profile.Pass(),
kPerfSuccess,
std::vector<uint8_t>(),
std::move(sampled_profile), kPerfSuccess, std::vector<uint8_t>(),
SerializeMessageToVector(perf_stat_proto_));
sampled_profile.reset(new SampledProfile);
@ -323,18 +310,14 @@ TEST_F(PerfProviderTest, MultipleCalls) {
sampled_profile->set_ms_after_resume(1500);
perf_provider_->ParseOutputProtoIfValid(
TestIncognitoObserver::CreateWithIncognitoLaunched(false),
sampled_profile.Pass(),
kPerfSuccess,
SerializeMessageToVector(perf_data_proto_),
std::vector<uint8_t>());
std::move(sampled_profile), kPerfSuccess,
SerializeMessageToVector(perf_data_proto_), std::vector<uint8_t>());
sampled_profile.reset(new SampledProfile);
sampled_profile->set_trigger_event(SampledProfile::PERIODIC_COLLECTION);
perf_provider_->ParseOutputProtoIfValid(
TestIncognitoObserver::CreateWithIncognitoLaunched(false),
sampled_profile.Pass(),
kPerfSuccess,
std::vector<uint8_t>(),
std::move(sampled_profile), kPerfSuccess, std::vector<uint8_t>(),
SerializeMessageToVector(perf_stat_proto_));
std::vector<SampledProfile> stored_profiles;
@ -385,10 +368,8 @@ TEST_F(PerfProviderTest, IncognitoWindowOpened) {
perf_provider_->ParseOutputProtoIfValid(
TestIncognitoObserver::CreateWithIncognitoLaunched(false),
sampled_profile.Pass(),
kPerfSuccess,
SerializeMessageToVector(perf_data_proto_),
std::vector<uint8_t>());
std::move(sampled_profile), kPerfSuccess,
SerializeMessageToVector(perf_data_proto_), std::vector<uint8_t>());
std::vector<SampledProfile> stored_profiles1;
EXPECT_TRUE(perf_provider_->GetSampledProfiles(&stored_profiles1));
@ -407,9 +388,7 @@ TEST_F(PerfProviderTest, IncognitoWindowOpened) {
sampled_profile->set_ms_after_restore(3000);
perf_provider_->ParseOutputProtoIfValid(
TestIncognitoObserver::CreateWithIncognitoLaunched(false),
sampled_profile.Pass(),
kPerfSuccess,
std::vector<uint8_t>(),
std::move(sampled_profile), kPerfSuccess, std::vector<uint8_t>(),
SerializeMessageToVector(perf_stat_proto_));
std::vector<SampledProfile> stored_profiles2;
@ -430,10 +409,8 @@ TEST_F(PerfProviderTest, IncognitoWindowOpened) {
// An incognito window opens.
perf_provider_->ParseOutputProtoIfValid(
TestIncognitoObserver::CreateWithIncognitoLaunched(true),
sampled_profile.Pass(),
kPerfSuccess,
SerializeMessageToVector(perf_data_proto_),
std::vector<uint8_t>());
std::move(sampled_profile), kPerfSuccess,
SerializeMessageToVector(perf_data_proto_), std::vector<uint8_t>());
std::vector<SampledProfile> stored_profiles_empty;
EXPECT_FALSE(perf_provider_->GetSampledProfiles(&stored_profiles_empty));
@ -443,9 +420,7 @@ TEST_F(PerfProviderTest, IncognitoWindowOpened) {
// Incognito window is still open.
perf_provider_->ParseOutputProtoIfValid(
TestIncognitoObserver::CreateWithIncognitoLaunched(true),
sampled_profile.Pass(),
kPerfSuccess,
std::vector<uint8_t>(),
std::move(sampled_profile), kPerfSuccess, std::vector<uint8_t>(),
SerializeMessageToVector(perf_stat_proto_));
EXPECT_FALSE(perf_provider_->GetSampledProfiles(&stored_profiles_empty));
@ -457,10 +432,8 @@ TEST_F(PerfProviderTest, IncognitoWindowOpened) {
// Incognito window closes.
perf_provider_->ParseOutputProtoIfValid(
TestIncognitoObserver::CreateWithIncognitoLaunched(false),
sampled_profile.Pass(),
kPerfSuccess,
SerializeMessageToVector(perf_data_proto_),
std::vector<uint8_t>());
std::move(sampled_profile), kPerfSuccess,
SerializeMessageToVector(perf_data_proto_), std::vector<uint8_t>());
std::vector<SampledProfile> stored_profiles3;
EXPECT_TRUE(perf_provider_->GetSampledProfiles(&stored_profiles3));

@ -4,6 +4,8 @@
#include "chrome/browser/net/nss_context.h"
#include <utility>
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
#include "base/supports_user_data.h"
@ -28,7 +30,7 @@ class NSSCertDatabaseChromeOSManager : public base::SupportsUserData::Data {
base::Bind(&NSSCertDatabaseChromeOSManager::DidGetPrivateSlot,
weak_ptr_factory_.GetWeakPtr())));
if (private_slot)
DidGetPrivateSlot(private_slot.Pass());
DidGetPrivateSlot(std::move(private_slot));
}
~NSSCertDatabaseChromeOSManager() override {
@ -53,7 +55,7 @@ class NSSCertDatabaseChromeOSManager : public base::SupportsUserData::Data {
DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
nss_cert_database_.reset(new net::NSSCertDatabaseChromeOS(
crypto::GetPublicSlotForChromeOSUser(username_hash_),
private_slot.Pass()));
std::move(private_slot)));
ReadyCallbackList callback_list;
callback_list.swap(ready_callback_list_);
@ -99,7 +101,7 @@ void CallWithNSSCertDatabase(
void SetSystemSlot(crypto::ScopedPK11Slot system_slot,
net::NSSCertDatabaseChromeOS* db) {
db->SetSystemSlot(system_slot.Pass());
db->SetSystemSlot(std::move(system_slot));
}
void SetSystemSlotOfDBForResourceContext(content::ResourceContext* context,
@ -142,5 +144,5 @@ void EnableNSSSystemKeySlotForResourceContext(
base::Bind(&SetSystemSlotOfDBForResourceContext, context);
crypto::ScopedPK11Slot system_slot = crypto::GetSystemNSSKeySlot(callback);
if (system_slot)
callback.Run(system_slot.Pass());
callback.Run(std::move(system_slot));
}

@ -6,6 +6,7 @@
#include <limits.h>
#include <stddef.h>
#include <utility>
#include "base/bind.h"
#include "base/macros.h"
@ -802,12 +803,12 @@ scoped_ptr<ConfigurationPolicyHandlerList> BuildHandlerList(
// http://crbug.com/346229
handlers->AddHandler(
make_scoped_ptr(new LegacyPoliciesDeprecatingPolicyHandler(
power_management_idle_legacy_policies.Pass(),
std::move(power_management_idle_legacy_policies),
make_scoped_ptr(
new PowerManagementIdleSettingsPolicyHandler(chrome_schema)))));
handlers->AddHandler(
make_scoped_ptr(new LegacyPoliciesDeprecatingPolicyHandler(
screen_lock_legacy_policies.Pass(),
std::move(screen_lock_legacy_policies),
make_scoped_ptr(new ScreenLockDelayPolicyHandler(chrome_schema)))));
handlers->AddHandler(
make_scoped_ptr(new ExternalDataPolicyHandler(key::kUserAvatarImage)));

@ -4,9 +4,9 @@
#include <stddef.h>
#include <stdint.h>
#include <algorithm>
#include <string>
#include <utility>
#include <vector>
#include "ash/display/display_manager.h"
@ -713,7 +713,7 @@ class PolicyTest : public InProcessBrowserTest {
// is tied to the test instead.
chrome_screenshot_grabber->screenshot_grabber()->AddObserver(&observer_);
ash::Shell::GetInstance()->accelerator_controller()->SetScreenshotDelegate(
chrome_screenshot_grabber.Pass());
std::move(chrome_screenshot_grabber));
SetScreenshotPolicy(enabled);
ash::Shell::GetInstance()->accelerator_controller()->PerformActionIfEnabled(

@ -4,6 +4,8 @@
#include "chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.h"
#include <utility>
#include "build/build_config.h"
#include "chrome/browser/autocomplete/in_memory_url_index_factory.h"
#include "chrome/browser/autocomplete/shortcuts_backend_factory.h"
@ -263,12 +265,12 @@ EnsureBrowserContextKeyedServiceFactoriesBuilt() {
new extensions::NetworkingPrivateVerifyDelegateFactoryImpl);
extensions::NetworkingPrivateDelegateFactory::GetInstance()
->SetVerifyDelegateFactory(
networking_private_verify_delegate_factory.Pass());
std::move(networking_private_verify_delegate_factory));
scoped_ptr<extensions::NetworkingPrivateUIDelegateFactoryImpl>
networking_private_ui_delegate_factory(
new extensions::NetworkingPrivateUIDelegateFactoryImpl);
extensions::NetworkingPrivateDelegateFactory::GetInstance()
->SetUIDelegateFactory(networking_private_ui_delegate_factory.Pass());
->SetUIDelegateFactory(std::move(networking_private_ui_delegate_factory));
#endif
#endif
#if !defined(OS_ANDROID)

@ -513,7 +513,7 @@ void ProfileIOData::InitializeOnUIThread(Profile* profile) {
scoped_ptr<policy::PolicyCertVerifier> verifier =
policy::PolicyCertServiceFactory::CreateForProfile(profile);
policy_cert_verifier_ = verifier.get();
cert_verifier_ = verifier.Pass();
cert_verifier_ = std::move(verifier);
#endif
// The URLBlacklistManager has to be created on the UI thread to register
// observers of |pref_service|, and it also has to clean up on
@ -1097,7 +1097,7 @@ void ProfileIOData::Init(
if (use_system_key_slot_)
EnableNSSSystemKeySlotForResourceContext(resource_context_.get());
certificate_provider_ = profile_params_->certificate_provider.Pass();
certificate_provider_ = std::move(profile_params_->certificate_provider);
#endif
if (g_cert_verifier_for_testing) {
@ -1109,7 +1109,7 @@ void ProfileIOData::Init(
// The private slot won't be ready by this point. It shouldn't be necessary
// for cert trust purposes anyway.
scoped_refptr<net::CertVerifyProc> verify_proc(
new chromeos::CertVerifyProcChromeOS(public_slot.Pass()));
new chromeos::CertVerifyProcChromeOS(std::move(public_slot)));
if (policy_cert_verifier_) {
DCHECK_EQ(policy_cert_verifier_, cert_verifier_.get());
policy_cert_verifier_->InitializeOnIOThread(verify_proc);

@ -145,7 +145,7 @@ void EasyUnlockServiceRegular::OnRemoteDevicesLoaded(
dict->SetString("permitRecord.id", b64_public_key);
dict->SetString("permitRecord.type", "license");
dict->SetString("permitRecord.data", b64_public_key);
device_list->Append(dict.Pass());
device_list->Append(std::move(dict));
}
// TODO(tengs): Rename this function after the easy_unlock app is replaced.

@ -2,10 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <stddef.h>
#include "chrome/browser/signin/easy_unlock_service.h"
#include <stddef.h>
#include <map>
#include <string>
#include <utility>
#include "base/macros.h"
#include "base/memory/scoped_ptr.h"
@ -15,7 +17,6 @@
#include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h"
#include "chrome/browser/chromeos/profiles/profile_helper.h"
#include "chrome/browser/signin/easy_unlock_app_manager.h"
#include "chrome/browser/signin/easy_unlock_service.h"
#include "chrome/browser/signin/easy_unlock_service_factory.h"
#include "chrome/browser/signin/easy_unlock_service_regular.h"
#include "chrome/browser/signin/signin_manager_factory.h"
@ -145,7 +146,7 @@ class TestAppManagerFactory {
return scoped_ptr<TestAppManager>();
scoped_ptr<TestAppManager> app_manager(new TestAppManager());
mapping_[context] = app_manager.get();
return app_manager.Pass();
return app_manager;
}
// Finds a TestAppManager created for |context|. Returns NULL if no
@ -187,8 +188,8 @@ scoped_ptr<KeyedService> CreateEasyUnlockServiceForTest(
scoped_ptr<EasyUnlockServiceRegular> service(
new EasyUnlockServiceRegular(Profile::FromBrowserContext(context)));
service->Initialize(app_manager.Pass());
return service.Pass();
service->Initialize(std::move(app_manager));
return std::move(service);
}
class EasyUnlockServiceTest : public testing::Test {

@ -57,7 +57,7 @@ TEST_F(FileBrowserHandlerManifestTest, GetHandlersRequiresPermission) {
std::move(extensions::ListBuilder().Append("fileBrowserHandler")));
extensions::ExtensionBuilder bad_app_builder;
bad_app_builder.SetManifest(bad_manifest_value.Pass());
bad_app_builder.SetManifest(std::move(bad_manifest_value));
scoped_refptr<extensions::Extension> bad_app(bad_app_builder.Build());
EXPECT_FALSE(FileBrowserHandler::GetHandlers(bad_app.get()));

@ -36,7 +36,7 @@ scoped_ptr<KeyedService> BuildSigninManagerFake(
scoped_ptr<SigninManagerBase> signin(
new SigninManagerBase(signin_client, account_tracker_service));
signin->Initialize(NULL);
return signin.Pass();
return std::move(signin);
#else
scoped_ptr<FakeSigninManager> manager(new FakeSigninManager(
signin_client, ProfileOAuth2TokenServiceFactory::GetForProfile(profile),

@ -6,6 +6,7 @@
#include <stddef.h>
#include <stdint.h>
#include <utility>
#include "base/location.h"
#include "base/macros.h"
@ -153,7 +154,7 @@ TEST_F(DesktopCaptureDeviceAuraTest, StartAndStop) {
capture_params.requested_format.frame_size.SetSize(640, 480);
capture_params.requested_format.frame_rate = kFrameRate;
capture_params.requested_format.pixel_format = media::PIXEL_FORMAT_I420;
capture_device->AllocateAndStart(capture_params, client.Pass());
capture_device->AllocateAndStart(capture_params, std::move(client));
capture_device->StopAndDeAllocate();
}

@ -6,6 +6,7 @@
#include <stddef.h>
#include <string.h>
#include <utility>
#include "base/bind.h"
#include "base/logging.h"
@ -79,9 +80,8 @@ VaapiJpegDecodeAccelerator::DecodeRequest::DecodeRequest(
scoped_ptr<base::SharedMemory> shm,
const scoped_refptr<media::VideoFrame>& video_frame)
: bitstream_buffer(bitstream_buffer),
shm(shm.Pass()),
video_frame(video_frame) {
}
shm(std::move(shm)),
video_frame(video_frame) {}
VaapiJpegDecodeAccelerator::DecodeRequest::~DecodeRequest() {
}
@ -299,7 +299,7 @@ void VaapiJpegDecodeAccelerator::Decode(
}
scoped_ptr<DecodeRequest> request(
new DecodeRequest(bitstream_buffer, shm.Pass(), video_frame));
new DecodeRequest(bitstream_buffer, std::move(shm), video_frame));
decoder_task_runner_->PostTask(
FROM_HERE, base::Bind(&VaapiJpegDecodeAccelerator::DecodeTask,

@ -5,6 +5,7 @@
#include "content/common/gpu/media/vaapi_video_encode_accelerator.h"
#include <string.h>
#include <utility>
#include "base/bind.h"
#include "base/callback.h"
@ -102,7 +103,7 @@ struct VaapiVideoEncodeAccelerator::BitstreamBufferRef {
BitstreamBufferRef(int32_t id,
scoped_ptr<base::SharedMemory> shm,
size_t size)
: id(id), shm(shm.Pass()), size(size) {}
: id(id), shm(std::move(shm)), size(size) {}
const int32_t id;
const scoped_ptr<base::SharedMemory> shm;
const size_t size;
@ -676,7 +677,7 @@ void VaapiVideoEncodeAccelerator::UseOutputBitstreamBuffer(
}
scoped_ptr<BitstreamBufferRef> buffer_ref(
new BitstreamBufferRef(buffer.id(), shm.Pass(), buffer.size()));
new BitstreamBufferRef(buffer.id(), std::move(shm), buffer.size()));
encoder_thread_task_runner_->PostTask(
FROM_HERE,

@ -22,12 +22,7 @@
#include <algorithm>
#include <deque>
#include <map>
// Include gtest.h out of order because <X11/X.h> #define's Bool & None, which
// gtest uses as struct names (inside a namespace). This means that
// #include'ing gtest after anything that pulls in X.h fails to compile.
// This is http://code.google.com/p/googletest/issues/detail?id=371
#include "testing/gtest/include/gtest/gtest.h"
#include <utility>
#include "base/at_exit.h"
#include "base/bind.h"
@ -56,6 +51,7 @@
#include "content/common/gpu/media/video_accelerator_unittest_helpers.h"
#include "content/public/common/content_switches.h"
#include "media/filters/h264_parser.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/gfx/codec/png_codec.h"
#include "ui/gl/gl_image.h"
@ -517,7 +513,7 @@ GLRenderingVDAClient::CreateFakeVDA() {
frame_size_,
base::Bind(&DoNothingReturnTrue)));
}
return decoder.Pass();
return decoder;
}
scoped_ptr<media::VideoDecodeAccelerator>
@ -530,7 +526,7 @@ GLRenderingVDAClient::CreateDXVAVDA() {
base::Bind(&DoNothingReturnTrue),
rendering_helper_->GetGLContext().get()));
#endif
return decoder.Pass();
return decoder;
}
scoped_ptr<media::VideoDecodeAccelerator>
@ -547,7 +543,7 @@ GLRenderingVDAClient::CreateV4L2VDA() {
base::ThreadTaskRunnerHandle::Get()));
}
#endif
return decoder.Pass();
return decoder;
}
scoped_ptr<media::VideoDecodeAccelerator>
@ -564,7 +560,7 @@ GLRenderingVDAClient::CreateV4L2SliceVDA() {
base::ThreadTaskRunnerHandle::Get()));
}
#endif
return decoder.Pass();
return decoder;
}
scoped_ptr<media::VideoDecodeAccelerator>
@ -575,7 +571,7 @@ GLRenderingVDAClient::CreateVaapiVDA() {
base::Bind(&DoNothingReturnTrue),
base::Bind(&GLRenderingVDAClient::BindImage, base::Unretained(this))));
#endif
return decoder.Pass();
return decoder;
}
void GLRenderingVDAClient::BindImage(uint32_t client_texture_id,
@ -599,7 +595,7 @@ void GLRenderingVDAClient::CreateAndStartDecoder() {
for (size_t i = 0; i < arraysize(decoders); ++i) {
if (!decoders[i])
continue;
decoder_ = decoders[i].Pass();
decoder_ = std::move(decoders[i]);
weak_decoder_factory_.reset(
new base::WeakPtrFactory<VideoDecodeAccelerator>(decoder_.get()));
if (decoder_->Initialize(profile_, client)) {

@ -5,10 +5,10 @@
#include <inttypes.h>
#include <stddef.h>
#include <stdint.h>
#include <algorithm>
#include <queue>
#include <string>
#include <utility>
#include "base/at_exit.h"
#include "base/bind.h"
@ -310,7 +310,8 @@ static void CreateAlignedInputStreamFile(const gfx::Size& coded_size,
}
}
}
LOG_ASSERT(test_stream->mapped_aligned_in_file.Initialize(dest_file.Pass()));
LOG_ASSERT(
test_stream->mapped_aligned_in_file.Initialize(std::move(dest_file)));
// Assert that memory mapped of file starts at 64 byte boundary. So each
// plane of frames also start at 64 byte boundary.
@ -398,7 +399,7 @@ class VideoEncodeAcceleratorTestEnvironment : public ::testing::Environment {
bool run_at_fps,
bool needs_encode_latency,
bool verify_all_output)
: test_stream_data_(data.Pass()),
: test_stream_data_(std::move(data)),
log_path_(log_path),
run_at_fps_(run_at_fps),
needs_encode_latency_(needs_encode_latency),
@ -605,7 +606,7 @@ scoped_ptr<StreamValidator> StreamValidator::Create(
LOG(FATAL) << "Unsupported profile: " << profile;
}
return validator.Pass();
return validator;
}
class VideoFrameQualityValidator {
@ -1048,7 +1049,7 @@ scoped_ptr<media::VideoEncodeAccelerator> VEAClient::CreateFakeVEA() {
scoped_refptr<base::SingleThreadTaskRunner>(
base::ThreadTaskRunnerHandle::Get())));
}
return encoder.Pass();
return encoder;
}
scoped_ptr<media::VideoEncodeAccelerator> VEAClient::CreateV4L2VEA() {
@ -1059,7 +1060,7 @@ scoped_ptr<media::VideoEncodeAccelerator> VEAClient::CreateV4L2VEA() {
if (device)
encoder.reset(new V4L2VideoEncodeAccelerator(device));
#endif
return encoder.Pass();
return encoder;
}
scoped_ptr<media::VideoEncodeAccelerator> VEAClient::CreateVaapiVEA() {
@ -1067,7 +1068,7 @@ scoped_ptr<media::VideoEncodeAccelerator> VEAClient::CreateVaapiVEA() {
#if defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY)
encoder.reset(new VaapiVideoEncodeAccelerator());
#endif
return encoder.Pass();
return encoder;
}
void VEAClient::CreateEncoder() {
@ -1086,7 +1087,7 @@ void VEAClient::CreateEncoder() {
for (size_t i = 0; i < arraysize(encoders); ++i) {
if (!encoders[i])
continue;
encoder_ = encoders[i].Pass();
encoder_ = std::move(encoders[i]);
SetState(CS_ENCODER_SET);
if (encoder_->Initialize(kInputFormat,
test_stream_->visible_size,
@ -1779,7 +1780,7 @@ int main(int argc, char** argv) {
reinterpret_cast<content::VideoEncodeAcceleratorTestEnvironment*>(
testing::AddGlobalTestEnvironment(
new content::VideoEncodeAcceleratorTestEnvironment(
test_stream_data.Pass(), log_path, run_at_fps,
std::move(test_stream_data), log_path, run_at_fps,
needs_encode_latency, verify_all_output)));
return RUN_ALL_TESTS();

@ -3,7 +3,6 @@
// found in the LICENSE file.
#include "crypto/nss_util.h"
#include "crypto/nss_util_internal.h"
#include <nss.h>
#include <pk11pub.h>
@ -12,6 +11,9 @@
#include <prinit.h>
#include <prtime.h>
#include <secmod.h>
#include <utility>
#include "crypto/nss_util_internal.h"
#if defined(OS_OPENBSD)
#include <sys/mount.h>
@ -215,7 +217,7 @@ void CrashOnNSSInitFailure() {
class ChromeOSUserData {
public:
explicit ChromeOSUserData(ScopedPK11Slot public_slot)
: public_slot_(public_slot.Pass()),
: public_slot_(std::move(public_slot)),
private_slot_initialization_started_(false) {}
~ChromeOSUserData() {
if (public_slot_) {
@ -241,7 +243,7 @@ class ChromeOSUserData {
void SetPrivateSlot(ScopedPK11Slot private_slot) {
DCHECK(!private_slot_);
private_slot_ = private_slot.Pass();
private_slot_ = std::move(private_slot);
SlotReadyCallbackList callback_list;
callback_list.swap(tpm_ready_callback_list_);
@ -422,7 +424,7 @@ class NSSInitSingleton {
<< ", got tpm slot: " << !!tpm_args->tpm_slot;
chaps_module_ = tpm_args->chaps_module;
tpm_slot_ = tpm_args->tpm_slot.Pass();
tpm_slot_ = std::move(tpm_args->tpm_slot);
if (!chaps_module_ && test_system_slot_) {
// chromeos_unittests try to test the TPM initialization process. If we
// have a test DB open, pretend that it is the TPM slot.
@ -500,7 +502,7 @@ class NSSInitSingleton {
"%s %s", kUserNSSDatabaseName, username_hash.c_str());
ScopedPK11Slot public_slot(OpenPersistentNSSDBForPath(db_name, path));
chromeos_user_map_[username_hash] =
new ChromeOSUserData(public_slot.Pass());
new ChromeOSUserData(std::move(public_slot));
return true;
}
@ -553,7 +555,7 @@ class NSSInitSingleton {
DVLOG(2) << "Got tpm slot for " << username_hash << " "
<< !!tpm_args->tpm_slot;
chromeos_user_map_[username_hash]->SetPrivateSlot(
tpm_args->tpm_slot.Pass());
std::move(tpm_args->tpm_slot));
}
void InitializePrivateSoftwareSlotForChromeOSUser(
@ -615,7 +617,7 @@ class NSSInitSingleton {
// Ensure that a previous value of test_system_slot_ is not overwritten.
// Unsetting, i.e. setting a NULL, however is allowed.
DCHECK(!slot || !test_system_slot_);
test_system_slot_ = slot.Pass();
test_system_slot_ = std::move(slot);
if (test_system_slot_) {
tpm_slot_.reset(PK11_ReferenceSlot(test_system_slot_.get()));
RunAndClearTPMReadyCallbackList();
@ -944,7 +946,7 @@ ScopedPK11Slot GetSystemNSSKeySlot(
}
void SetSystemKeySlotForTesting(ScopedPK11Slot slot) {
g_nss_singleton.Get().SetSystemKeySlotForTesting(slot.Pass());
g_nss_singleton.Get().SetSystemKeySlotForTesting(std::move(slot));
}
void EnableTPMTokenForNSS() {

@ -272,7 +272,7 @@ void HidServiceLinux::ValidateFdOnBlockingThread(
fd.CheckValidity();
if (fd.is_valid()) {
params->device_file = base::File(fd.TakeValue());
FinishOpen(params.Pass());
FinishOpen(std::move(params));
} else {
HID_LOG(EVENT) << "Permission broker denied access to '"
<< params->device_info->device_node() << "'.";

@ -6,8 +6,8 @@
#include <cert.h>
#include <pk11pub.h>
#include <algorithm>
#include <utility>
#include "base/bind.h"
#include "base/callback.h"
@ -21,7 +21,7 @@ namespace net {
NSSCertDatabaseChromeOS::NSSCertDatabaseChromeOS(
crypto::ScopedPK11Slot public_slot,
crypto::ScopedPK11Slot private_slot)
: NSSCertDatabase(public_slot.Pass(), private_slot.Pass()) {
: NSSCertDatabase(std::move(public_slot), std::move(private_slot)) {
// By default, don't use a system slot. Only if explicitly set by
// SetSystemSlot, the system slot will be used.
profile_filter_.Init(GetPublicSlot(),
@ -33,7 +33,7 @@ NSSCertDatabaseChromeOS::~NSSCertDatabaseChromeOS() {}
void NSSCertDatabaseChromeOS::SetSystemSlot(
crypto::ScopedPK11Slot system_slot) {
system_slot_ = system_slot.Pass();
system_slot_ = std::move(system_slot);
profile_filter_.Init(GetPublicSlot(), GetPrivateSlot(), GetSystemSlot());
}

@ -4,6 +4,8 @@
#include "net/cert/nss_profile_filter_chromeos.h"
#include <utility>
#include "base/strings/string_piece.h"
#include "base/strings/stringprintf.h"
#include "net/cert/x509_certificate.h"
@ -71,11 +73,11 @@ void NSSProfileFilterChromeOS::Init(crypto::ScopedPK11Slot public_slot,
// not release its reference, and the receiving object won't free
// its copy.
if (public_slot_.get() != public_slot.get())
public_slot_ = public_slot.Pass();
public_slot_ = std::move(public_slot);
if (private_slot_.get() != private_slot.get())
private_slot_ = private_slot.Pass();
private_slot_ = std::move(private_slot);
if (system_slot_.get() != system_slot.get())
system_slot_ = system_slot.Pass();
system_slot_ = std::move(system_slot);
}
bool NSSProfileFilterChromeOS::IsModuleAllowed(PK11SlotInfo* slot) const {

@ -7,6 +7,7 @@
#include <cert.h>
#include <pk11pub.h>
#include <secmod.h>
#include <utility>
#include "crypto/nss_util_internal.h"
#include "crypto/scoped_nss_types.h"
@ -75,8 +76,7 @@ class NSSProfileFilterChromeOSTest : public testing::Test {
ASSERT_TRUE(private_slot_1.get());
profile_filter_1_.Init(
crypto::GetPublicSlotForChromeOSUser(user_1_.username_hash()),
private_slot_1.Pass(),
get_system_slot());
std::move(private_slot_1), get_system_slot());
profile_filter_1_copy_ = profile_filter_1_;
@ -86,7 +86,7 @@ class NSSProfileFilterChromeOSTest : public testing::Test {
ASSERT_TRUE(private_slot_2.get());
profile_filter_2_.Init(
crypto::GetPublicSlotForChromeOSUser(user_2_.username_hash()),
private_slot_2.Pass(),
std::move(private_slot_2),
crypto::ScopedPK11Slot() /* no system slot */);
certs_ = CreateCertificateListFromFile(GetTestCertsDirectory(),