diff options
author | dcheng <dcheng@chromium.org> | 2015-12-26 13:16:23 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-12-26 21:17:11 +0000 |
commit | 51606358c63e4005e53c8894463029b57d16751c (patch) | |
tree | 9097a0481effe003a1f5d7df7ba66f21b10c3d4e /components | |
parent | f63a125013805bf3dd72f90ec33f4d0aa0606660 (diff) | |
download | chromium_src-51606358c63e4005e53c8894463029b57d16751c.zip chromium_src-51606358c63e4005e53c8894463029b57d16751c.tar.gz chromium_src-51606358c63e4005e53c8894463029b57d16751c.tar.bz2 |
Convert Pass()→std::move() in //components/[a-m]*
BUG=557422
R=avi@chromium.org
TBR=jochen@chromium.org
Review URL: https://codereview.chromium.org/1548193002
Cr-Commit-Position: refs/heads/master@{#366906}
Diffstat (limited to 'components')
269 files changed, 1296 insertions, 1100 deletions
diff --git a/components/app_modal/javascript_dialog_manager.cc b/components/app_modal/javascript_dialog_manager.cc index ac2c7eb..2b6ec64 100644 --- a/components/app_modal/javascript_dialog_manager.cc +++ b/components/app_modal/javascript_dialog_manager.cc @@ -4,6 +4,8 @@ #include "components/app_modal/javascript_dialog_manager.h" +#include <utility> + #include "base/bind.h" #include "base/i18n/rtl.h" #include "base/macros.h" @@ -59,12 +61,12 @@ JavaScriptDialogManager* JavaScriptDialogManager::GetInstance() { void JavaScriptDialogManager::SetNativeDialogFactory( scoped_ptr<JavaScriptNativeDialogFactory> factory) { - native_dialog_factory_ = factory.Pass(); + native_dialog_factory_ = std::move(factory); } void JavaScriptDialogManager::SetExtensionsClient( scoped_ptr<JavaScriptDialogExtensionsClient> extensions_client) { - extensions_client_ = extensions_client.Pass(); + extensions_client_ = std::move(extensions_client); } //////////////////////////////////////////////////////////////////////////////// diff --git a/components/audio_modem/audio_recorder_impl.cc b/components/audio_modem/audio_recorder_impl.cc index 154037e..8d1b2c5 100644 --- a/components/audio_modem/audio_recorder_impl.cc +++ b/components/audio_modem/audio_recorder_impl.cc @@ -5,6 +5,7 @@ #include "components/audio_modem/audio_recorder_impl.h" #include <algorithm> +#include <utility> #include <vector> #include "base/bind.h" @@ -42,7 +43,7 @@ void ProcessSamples( scoped_ptr<media::AudioBus> bus, const AudioRecorderImpl::RecordedSamplesCallback& callback) { std::string samples; - AudioBusToString(bus.Pass(), &samples); + AudioBusToString(std::move(bus), &samples); content::BrowserThread::PostTask( content::BrowserThread::UI, FROM_HERE, base::Bind(callback, samples)); } @@ -177,7 +178,7 @@ void AudioRecorderImpl::OnData(media::AudioInputStream* stream, // Buffer full, send it for processing. if (buffer_->frames() == buffer_frame_index_) { - ProcessSamples(buffer_.Pass(), decode_callback_); + ProcessSamples(std::move(buffer_), decode_callback_); buffer_ = media::AudioBus::Create(source->channels(), total_buffer_frames_); buffer_frame_index_ = 0; diff --git a/components/autofill/content/browser/content_autofill_driver.cc b/components/autofill/content/browser/content_autofill_driver.cc index 788ab1d..65ed75a 100644 --- a/components/autofill/content/browser/content_autofill_driver.cc +++ b/components/autofill/content/browser/content_autofill_driver.cc @@ -4,6 +4,8 @@ #include "components/autofill/content/browser/content_autofill_driver.h" +#include <utility> + #include "base/command_line.h" #include "base/threading/sequenced_worker_pool.h" #include "components/autofill/content/common/autofill_messages.h" @@ -202,7 +204,7 @@ void ContentAutofillDriver::DidNavigateFrame( void ContentAutofillDriver::SetAutofillManager( scoped_ptr<AutofillManager> manager) { - autofill_manager_ = manager.Pass(); + autofill_manager_ = std::move(manager); autofill_manager_->SetExternalDelegate(&autofill_external_delegate_); } diff --git a/components/autofill/content/browser/content_autofill_driver_unittest.cc b/components/autofill/content/browser/content_autofill_driver_unittest.cc index d06cfd8..633908f 100644 --- a/components/autofill/content/browser/content_autofill_driver_unittest.cc +++ b/components/autofill/content/browser/content_autofill_driver_unittest.cc @@ -2,15 +2,16 @@ // 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/autofill/content/browser/content_autofill_driver.h" +#include <stdint.h> #include <algorithm> +#include <utility> #include <vector> #include "base/command_line.h" #include "base/memory/scoped_ptr.h" #include "base/strings/utf_string_conversions.h" -#include "components/autofill/content/browser/content_autofill_driver.h" #include "components/autofill/content/common/autofill_messages.h" #include "components/autofill/core/browser/autofill_external_delegate.h" #include "components/autofill/core/browser/autofill_manager.h" @@ -54,7 +55,7 @@ class TestContentAutofillDriver : public ContentAutofillDriver { : ContentAutofillDriver(rfh, client, kAppLocale, kDownloadState) { scoped_ptr<AutofillManager> autofill_manager( new MockAutofillManager(this, client)); - SetAutofillManager(autofill_manager.Pass()); + SetAutofillManager(std::move(autofill_manager)); } ~TestContentAutofillDriver() override {} diff --git a/components/autofill/content/browser/risk/fingerprint.cc b/components/autofill/content/browser/risk/fingerprint.cc index b4e4f70..dacbd5f 100644 --- a/components/autofill/content/browser/risk/fingerprint.cc +++ b/components/autofill/content/browser/risk/fingerprint.cc @@ -12,6 +12,8 @@ #include "components/autofill/content/browser/risk/fingerprint.h" +#include <utility> + #include "base/bind.h" #include "base/callback.h" #include "base/cpu.h" @@ -422,7 +424,7 @@ void FingerprintDataLoader::FillFingerprint() { metadata->set_obfuscated_gaia_id(obfuscated_gaia_id_); metadata->set_fingerprinter_version(kFingerprinterVersion); - callback_.Run(fingerprint.Pass()); + callback_.Run(std::move(fingerprint)); } } // namespace diff --git a/components/autofill/content/browser/wallet/full_wallet.cc b/components/autofill/content/browser/wallet/full_wallet.cc index acd9c46..43e901a 100644 --- a/components/autofill/content/browser/wallet/full_wallet.cc +++ b/components/autofill/content/browser/wallet/full_wallet.cc @@ -5,6 +5,7 @@ #include "components/autofill/content/browser/wallet/full_wallet.h" #include <stddef.h> +#include <utility> #include "base/logging.h" #include "base/strings/string_number_conversions.h" @@ -35,8 +36,8 @@ FullWallet::FullWallet(int expiration_month, expiration_year_(expiration_year), iin_(iin), encrypted_rest_(encrypted_rest), - billing_address_(billing_address.Pass()), - shipping_address_(shipping_address.Pass()) { + billing_address_(std::move(billing_address)), + shipping_address_(std::move(shipping_address)) { DCHECK(billing_address_.get()); } @@ -59,10 +60,10 @@ scoped_ptr<FullWallet> expiration_month, expiration_year, std::string(), // no iin -- clear text pan/cvn are set below. std::string(), // no encrypted_rest -- clear text pan/cvn are set below. - billing_address.Pass(), shipping_address.Pass())); + std::move(billing_address), std::move(shipping_address))); wallet->pan_ = pan; wallet->cvn_ = cvn; - return wallet.Pass(); + return wallet; } base::string16 FullWallet::GetInfo(const std::string& app_locale, diff --git a/components/autofill/content/browser/wallet/payments_client_unittest.cc b/components/autofill/content/browser/wallet/payments_client_unittest.cc index 31951d5..de4cbd6 100644 --- a/components/autofill/content/browser/wallet/payments_client_unittest.cc +++ b/components/autofill/content/browser/wallet/payments_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/command_line.h" #include "base/macros.h" #include "base/thread_task_runner_handle.h" @@ -59,7 +61,7 @@ class PaymentsClientTest : public testing::Test, public PaymentsClientDelegate { const base::string16& context_token, scoped_ptr<base::DictionaryValue> legal_message) override { result_ = result; - legal_message_ = legal_message.Pass(); + legal_message_ = std::move(legal_message); } void OnDidUploadCard(AutofillClient::PaymentsRpcResult result) override { diff --git a/components/autofill/content/browser/wallet/wallet_address.cc b/components/autofill/content/browser/wallet/wallet_address.cc index a754a1a..239dfb9 100644 --- a/components/autofill/content/browser/wallet/wallet_address.cc +++ b/components/autofill/content/browser/wallet/wallet_address.cc @@ -268,7 +268,7 @@ scoped_ptr<Address> Address::CreateDisplayAddress( language_code)); address->set_is_complete_address(address_state == kFullAddress); - return address.Pass(); + return address; } scoped_ptr<base::DictionaryValue> Address::ToDictionaryWithID() const { @@ -279,7 +279,7 @@ scoped_ptr<base::DictionaryValue> Address::ToDictionaryWithID() const { dict->SetString("phone_number", phone_number_); dict->Set("postal_address", ToDictionaryWithoutID().release()); - return dict.Pass(); + return dict; } scoped_ptr<base::DictionaryValue> Address::ToDictionaryWithoutID() const { @@ -299,7 +299,7 @@ scoped_ptr<base::DictionaryValue> Address::ToDictionaryWithoutID() const { dict->SetString("sorting_code", sorting_code_); dict->SetString("language_code", language_code_); - return dict.Pass(); + return dict; } base::string16 Address::DisplayName() const { diff --git a/components/autofill/content/browser/wallet/wallet_test_util.cc b/components/autofill/content/browser/wallet/wallet_test_util.cc index 2243662..287dfe7 100644 --- a/components/autofill/content/browser/wallet/wallet_test_util.cc +++ b/components/autofill/content/browser/wallet/wallet_test_util.cc @@ -56,7 +56,7 @@ scoped_ptr<Address> GetTestAddress() { scoped_ptr<Address> GetTestMinimalAddress() { scoped_ptr<Address> address = GetTestAddress(); address->set_is_complete_address(false); - return address.Pass(); + return address; } scoped_ptr<FullWallet> GetTestFullWallet() { @@ -66,7 +66,7 @@ scoped_ptr<FullWallet> GetTestFullWallet() { std::vector<uint8_t> one_time_pad; base::HexStringToBytes("5F04A8704183", &one_time_pad); wallet->set_one_time_pad(one_time_pad); - return wallet.Pass(); + return wallet; } scoped_ptr<FullWallet> GetTestFullWalletInstrumentOnly() { @@ -76,7 +76,7 @@ scoped_ptr<FullWallet> GetTestFullWalletInstrumentOnly() { std::vector<uint8_t> one_time_pad; base::HexStringToBytes("5F04A8704183", &one_time_pad); wallet->set_one_time_pad(one_time_pad); - return wallet.Pass(); + return wallet; } scoped_ptr<Address> GetTestSaveableAddress() { @@ -112,7 +112,7 @@ scoped_ptr<Address> GetTestShippingAddress() { scoped_ptr<Address> GetTestNonDefaultShippingAddress() { scoped_ptr<Address> address = GetTestShippingAddress(); address->set_object_id("address_id"); - return address.Pass(); + return address; } } // namespace wallet diff --git a/components/autofill/content/renderer/password_autofill_agent.cc b/components/autofill/content/renderer/password_autofill_agent.cc index 5297c0a..fee7e97 100644 --- a/components/autofill/content/renderer/password_autofill_agent.cc +++ b/components/autofill/content/renderer/password_autofill_agent.cc @@ -5,6 +5,7 @@ #include "components/autofill/content/renderer/password_autofill_agent.h" #include <stddef.h> +#include <utility> #include "base/bind.h" #include "base/command_line.h" @@ -750,7 +751,7 @@ void PasswordAutofillAgent::UpdateStateForTextChange( password_form = CreatePasswordFormFromWebForm( element.form(), &nonscript_modified_values_, &form_predictions_); } - ProvisionallySavePassword(password_form.Pass(), RESTRICTION_NONE); + ProvisionallySavePassword(std::move(password_form), RESTRICTION_NONE); PasswordToLoginMap::iterator iter = password_to_username_.find(element); if (iter != password_to_username_.end()) { @@ -1134,7 +1135,7 @@ void PasswordAutofillAgent::WillSendSubmitEvent( // already have been updated in TextDidChangeInTextField. scoped_ptr<PasswordForm> password_form = CreatePasswordFormFromWebForm( form, &nonscript_modified_values_, &form_predictions_); - ProvisionallySavePassword(password_form.Pass(), + ProvisionallySavePassword(std::move(password_form), RESTRICTION_NON_EMPTY_PASSWORD); } @@ -1496,7 +1497,7 @@ void PasswordAutofillAgent::ProvisionallySavePassword( password_form->new_password_value.empty())) { return; } - provisionally_saved_form_ = password_form.Pass(); + provisionally_saved_form_ = std::move(password_form); } bool PasswordAutofillAgent::ProvisionallySavedPasswordIsValid() { diff --git a/components/autofill/content/renderer/password_form_conversion_utils.cc b/components/autofill/content/renderer/password_form_conversion_utils.cc index 4366f75..aa2198e 100644 --- a/components/autofill/content/renderer/password_form_conversion_utils.cc +++ b/components/autofill/content/renderer/password_form_conversion_utils.cc @@ -607,7 +607,7 @@ scoped_ptr<PasswordForm> CreatePasswordFormFromWebForm( nonscript_modified_values, form_predictions)) return scoped_ptr<PasswordForm>(); - return password_form.Pass(); + return password_form; } scoped_ptr<PasswordForm> CreatePasswordFormFromUnownedInputElements( @@ -634,7 +634,7 @@ scoped_ptr<PasswordForm> CreatePasswordFormFromUnownedInputElements( // No actual action on the form, so use the the origin as the action. password_form->action = password_form->origin; - return password_form.Pass(); + return password_form; } bool HasAutocompleteAttributeValue(const blink::WebInputElement& element, diff --git a/components/autofill/core/browser/address_field.cc b/components/autofill/core/browser/address_field.cc index bf96dc2..3bd5987 100644 --- a/components/autofill/core/browser/address_field.cc +++ b/components/autofill/core/browser/address_field.cc @@ -5,6 +5,7 @@ #include "components/autofill/core/browser/address_field.h" #include <stddef.h> +#include <utility> #include "base/logging.h" #include "base/memory/scoped_ptr.h" @@ -105,7 +106,7 @@ scoped_ptr<FormField> AddressField::Parse(AutofillScanner* scanner) { if (has_trailing_non_labeled_fields) scanner->RewindTo(begin_trailing_non_labeled_fields); - return address_field.Pass(); + return std::move(address_field); } scanner->RewindTo(saved_cursor); diff --git a/components/autofill/core/browser/address_i18n.cc b/components/autofill/core/browser/address_i18n.cc index ca74fc5..67be69b 100644 --- a/components/autofill/core/browser/address_i18n.cc +++ b/components/autofill/core/browser/address_i18n.cc @@ -52,7 +52,7 @@ scoped_ptr<AddressData> CreateAddressData( base::UTF16ToUTF8( get_info.Run(AutofillType(ADDRESS_HOME_STREET_ADDRESS))), "\n", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); - return address_data.Pass(); + return address_data; } scoped_ptr< ::i18n::addressinput::AddressData> @@ -61,7 +61,7 @@ scoped_ptr< ::i18n::addressinput::AddressData> scoped_ptr< ::i18n::addressinput::AddressData> address_data = i18n::CreateAddressData(base::Bind(&GetInfoHelper, profile, app_locale)); address_data->language_code = profile.language_code(); - return address_data.Pass(); + return address_data; } ServerFieldType TypeForField(AddressField address_field, bool billing) { diff --git a/components/autofill/core/browser/autofill_manager.cc b/components/autofill/core/browser/autofill_manager.cc index fa77803..c0bcd67 100644 --- a/components/autofill/core/browser/autofill_manager.cc +++ b/components/autofill/core/browser/autofill_manager.cc @@ -850,7 +850,7 @@ void AutofillManager::OnDidGetUploadDetails( client_->ConfirmSaveCreditCardToCloud( base::Bind(&AutofillManager::OnUserDidAcceptUpload, weak_ptr_factory_.GetWeakPtr()), - legal_message.Pass()); + std::move(legal_message)); client_->LoadRiskData(base::Bind(&AutofillManager::OnDidGetUploadRiskData, weak_ptr_factory_.GetWeakPtr())); AutofillMetrics::LogCardUploadDecisionMetric( @@ -1541,7 +1541,7 @@ void AutofillManager::ParseForms(const std::vector<FormData>& forms) { // Ownership is transferred to |form_structures_| which maintains it until // the manager is Reset() or destroyed. It is safe to use references below // as long as receivers don't take ownership. - form_structures_.push_back(form_structure.Pass()); + form_structures_.push_back(std::move(form_structure)); if (form_structures_.back()->ShouldBeCrowdsourced()) queryable_forms.push_back(form_structures_.back()); diff --git a/components/autofill/core/browser/credit_card_field.cc b/components/autofill/core/browser/credit_card_field.cc index 3b24ec3..3ac65c0 100644 --- a/components/autofill/core/browser/credit_card_field.cc +++ b/components/autofill/core/browser/credit_card_field.cc @@ -5,6 +5,7 @@ #include "components/autofill/core/browser/credit_card_field.h" #include <stddef.h> +#include <utility> #include "base/memory/scoped_ptr.h" #include "base/stl_util.h" @@ -180,7 +181,7 @@ scoped_ptr<FormField> CreditCardField::Parse(AutofillScanner* scanner) { // For that case, allow only just the cardholder name field. The remaining // CC fields will be picked up in a following CreditCardField. if (credit_card_field->cardholder_) - return credit_card_field.Pass(); + return std::move(credit_card_field); // On some pages, the user selects a card type using radio buttons // (e.g. test page Apple Store Billing.html). We can't handle that yet, @@ -195,7 +196,7 @@ scoped_ptr<FormField> CreditCardField::Parse(AutofillScanner* scanner) { (credit_card_field->expiration_month_ && credit_card_field->expiration_year_)); if (has_cc_number_or_verification && has_date_or_mm_yy) - return credit_card_field.Pass(); + return std::move(credit_card_field); scanner->RewindTo(saved_cursor); return nullptr; diff --git a/components/autofill/core/browser/name_field.cc b/components/autofill/core/browser/name_field.cc index 27cba7b7..9e5a09e 100644 --- a/components/autofill/core/browser/name_field.cc +++ b/components/autofill/core/browser/name_field.cc @@ -122,7 +122,7 @@ scoped_ptr<FirstLastNameField> FirstLastNameField::ParseSpecificName( v->last_name_ = next; } - return v.Pass(); + return v; } scanner->Rewind(); @@ -185,7 +185,7 @@ scoped_ptr<FirstLastNameField> FirstLastNameField::ParseComponentNames( // Consider the match to be successful if we detected both first and last name // fields. if (v->first_name_ && v->last_name_) - return v.Pass(); + return v; scanner->Rewind(); return NULL; diff --git a/components/autofill/core/browser/payments/payments_client.cc b/components/autofill/core/browser/payments/payments_client.cc index 2101865..c938fb1 100644 --- a/components/autofill/core/browser/payments/payments_client.cc +++ b/components/autofill/core/browser/payments/payments_client.cc @@ -4,6 +4,8 @@ #include "components/autofill/core/browser/payments/payments_client.h" +#include <utility> + #include "base/command_line.h" #include "base/json/json_reader.h" #include "base/json/json_writer.h" @@ -133,7 +135,7 @@ scoped_ptr<base::DictionaryValue> BuildAddressDictionary( if (!address_line3.empty()) address_lines->AppendString(address_line3); if (!address_lines->empty()) - postal_address->Set("address_line", address_lines.Pass()); + postal_address->Set("address_line", std::move(address_lines)); const base::string16 city = profile.GetInfo(AutofillType(ADDRESS_HOME_CITY), app_locale); @@ -154,7 +156,7 @@ scoped_ptr<base::DictionaryValue> BuildAddressDictionary( if (!country_code.empty()) postal_address->SetString("country_name_code", country_code); - address->Set("postal_address", postal_address.Pass()); + address->Set("postal_address", std::move(postal_address)); const base::string16 phone_number = profile.GetInfo(AutofillType(PHONE_HOME_WHOLE_NUMBER), app_locale); @@ -237,7 +239,7 @@ class GetUploadDetailsRequest : public PaymentsRequest { base::DictionaryValue request_dict; scoped_ptr<base::DictionaryValue> context(new base::DictionaryValue()); context->SetString("language_code", app_locale_); - request_dict.Set("context", context.Pass()); + request_dict.Set("context", std::move(context)); std::string request_content; base::JSONWriter::Write(request_dict, &request_content); @@ -259,7 +261,7 @@ class GetUploadDetailsRequest : public PaymentsRequest { void RespondToDelegate(PaymentsClientDelegate* delegate, AutofillClient::PaymentsRpcResult result) override { delegate->OnDidGetUploadDetails(result, context_token_, - legal_message_.Pass()); + std::move(legal_message_)); } private: @@ -290,7 +292,7 @@ class UploadCardRequest : public PaymentsRequest { const std::string& app_locale = request_details_.app_locale; scoped_ptr<base::DictionaryValue> context(new base::DictionaryValue()); context->SetString("language_code", app_locale); - request_dict.Set("context", context.Pass()); + request_dict.Set("context", std::move(context)); request_dict.SetString("cardholder_name", request_details_.card.GetInfo( @@ -300,7 +302,7 @@ class UploadCardRequest : public PaymentsRequest { for (const AutofillProfile& profile : request_details_.profiles) { addresses->Append(BuildAddressDictionary(profile, app_locale)); } - request_dict.Set("address", addresses.Pass()); + request_dict.Set("address", std::move(addresses)); request_dict.SetString("context_token", request_details_.context_token); @@ -383,7 +385,7 @@ void PaymentsClient::UploadCard( void PaymentsClient::IssueRequest(scoped_ptr<PaymentsRequest> request, bool authenticate) { - request_ = request.Pass(); + request_ = std::move(request); has_retried_authorization_ = false; InitializeUrlFetcher(); @@ -424,7 +426,7 @@ void PaymentsClient::OnURLFetchComplete(const net::URLFetcher* source) { // |url_fetcher_|, which is aliased to |source|, might continue to be used in // this method, but should be freed once control leaves the method. - scoped_ptr<net::URLFetcher> scoped_url_fetcher(url_fetcher_.Pass()); + scoped_ptr<net::URLFetcher> scoped_url_fetcher(std::move(url_fetcher_)); scoped_ptr<base::DictionaryValue> response_dict; int response_code = source->GetResponseCode(); std::string data; @@ -443,7 +445,7 @@ void PaymentsClient::OnURLFetchComplete(const net::URLFetcher* source) { response_dict.reset( static_cast<base::DictionaryValue*>(message_value.release())); response_dict->GetString("error.code", &error_code); - request_->ParseResponse(response_dict.Pass()); + request_->ParseResponse(std::move(response_dict)); } if (base::LowerCaseEqualsASCII(error_code, "internal")) diff --git a/components/autofill/core/browser/personal_data_manager.cc b/components/autofill/core/browser/personal_data_manager.cc index bca5e2a..4193de5 100644 --- a/components/autofill/core/browser/personal_data_manager.cc +++ b/components/autofill/core/browser/personal_data_manager.cc @@ -5,8 +5,8 @@ #include "components/autofill/core/browser/personal_data_manager.h" #include <stddef.h> - #include <algorithm> +#include <utility> #include "base/i18n/case_conversion.h" #include "base/i18n/timezone.h" @@ -488,7 +488,7 @@ bool PersonalDataManager::ImportFormData( // We always save imported profiles. SaveImportedProfile(*imported_profile); } - *imported_credit_card = local_imported_credit_card.Pass(); + *imported_credit_card = std::move(local_imported_credit_card); if (imported_profile.get() || *imported_credit_card || merged_credit_card) return true; diff --git a/components/autofill/core/browser/phone_field.cc b/components/autofill/core/browser/phone_field.cc index 05e5704..3770c9e 100644 --- a/components/autofill/core/browser/phone_field.cc +++ b/components/autofill/core/browser/phone_field.cc @@ -5,6 +5,7 @@ #include "components/autofill/core/browser/phone_field.h" #include <string.h> +#include <utility> #include "base/logging.h" #include "base/macros.h" @@ -195,7 +196,7 @@ scoped_ptr<FormField> PhoneField::Parse(AutofillScanner* scanner) { kPhoneExtensionRe, &phone_field->parsed_phone_fields_[FIELD_EXTENSION]); - return phone_field.Pass(); + return std::move(phone_field); } bool PhoneField::ClassifyField(ServerFieldTypeMap* map) const { diff --git a/components/autofill/core/browser/phone_number_i18n.cc b/components/autofill/core/browser/phone_number_i18n.cc index 46f99a5..87f276c 100644 --- a/components/autofill/core/browser/phone_number_i18n.cc +++ b/components/autofill/core/browser/phone_number_i18n.cc @@ -4,6 +4,8 @@ #include "components/autofill/core/browser/phone_number_i18n.h" +#include <utility> + #include "base/logging.h" #include "base/strings/string_number_conversions.h" #include "base/strings/string_util.h" @@ -248,7 +250,7 @@ PhoneObject::PhoneObject(const base::string16& number, // The phone number was successfully parsed, so store the parsed version. // The formatted and normalized versions will be set on the first call to // the coresponding methods. - i18n_number_ = i18n_number.Pass(); + i18n_number_ = std::move(i18n_number); } else { // Parsing failed. Store passed phone "as is" into |whole_number_|. whole_number_ = number; diff --git a/components/autofill/core/browser/test_autofill_client.h b/components/autofill/core/browser/test_autofill_client.h index 8bba3eb..9941c02 100644 --- a/components/autofill/core/browser/test_autofill_client.h +++ b/components/autofill/core/browser/test_autofill_client.h @@ -5,6 +5,8 @@ #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_TEST_AUTOFILL_CLIENT_H_ #define COMPONENTS_AUTOFILL_CORE_BROWSER_TEST_AUTOFILL_CLIENT_H_ +#include <utility> + #include "base/compiler_specific.h" #include "base/i18n/rtl.h" #include "base/macros.h" @@ -67,7 +69,7 @@ class TestAutofillClient : public AutofillClient { is_context_secure_ = is_context_secure; }; - void SetPrefs(scoped_ptr<PrefService> prefs) { prefs_ = prefs.Pass(); } + void SetPrefs(scoped_ptr<PrefService> prefs) { prefs_ = std::move(prefs); } rappor::TestRapporService* test_rappor_service() { return rappor_service_.get(); diff --git a/components/autofill/core/browser/webdata/autocomplete_syncable_service.cc b/components/autofill/core/browser/webdata/autocomplete_syncable_service.cc index 9f41f96..ac8f216 100644 --- a/components/autofill/core/browser/webdata/autocomplete_syncable_service.cc +++ b/components/autofill/core/browser/webdata/autocomplete_syncable_service.cc @@ -5,6 +5,7 @@ #include "components/autofill/core/browser/webdata/autocomplete_syncable_service.h" #include <stdint.h> +#include <utility> #include "base/location.h" #include "base/logging.h" @@ -108,7 +109,7 @@ syncer::SyncMergeResult AutocompleteSyncableService::MergeDataAndStartSyncing( DCHECK(error_handler); syncer::SyncMergeResult merge_result(type); - error_handler_ = error_handler.Pass(); + error_handler_ = std::move(error_handler); std::vector<AutofillEntry> entries; if (!LoadAutofillData(&entries)) { merge_result.set_error(error_handler_->CreateAndUploadError( @@ -123,7 +124,7 @@ syncer::SyncMergeResult AutocompleteSyncableService::MergeDataAndStartSyncing( std::make_pair(syncer::SyncChange::ACTION_ADD, it); } - sync_processor_ = sync_processor.Pass(); + sync_processor_ = std::move(sync_processor); std::vector<AutofillEntry> new_synced_entries; // Go through and check for all the entries that sync already knows about. diff --git a/components/autofill/core/browser/webdata/autofill_profile_syncable_service.cc b/components/autofill/core/browser/webdata/autofill_profile_syncable_service.cc index e6fccfe..43227f9 100644 --- a/components/autofill/core/browser/webdata/autofill_profile_syncable_service.cc +++ b/components/autofill/core/browser/webdata/autofill_profile_syncable_service.cc @@ -5,6 +5,7 @@ #include "components/autofill/core/browser/webdata/autofill_profile_syncable_service.h" #include <stddef.h> +#include <utility> #include "base/guid.h" #include "base/location.h" @@ -97,7 +98,7 @@ AutofillProfileSyncableService::MergeDataAndStartSyncing( DVLOG(1) << "Associating Autofill: MergeDataAndStartSyncing"; syncer::SyncMergeResult merge_result(type); - sync_error_factory_ = sync_error_factory.Pass(); + sync_error_factory_ = std::move(sync_error_factory); if (!LoadAutofillData(&profiles_.get())) { merge_result.set_error(sync_error_factory_->CreateAndUploadError( FROM_HERE, "Could not get the autofill data from WebDatabase.")); @@ -116,7 +117,7 @@ AutofillProfileSyncableService::MergeDataAndStartSyncing( } } - sync_processor_ = sync_processor.Pass(); + sync_processor_ = std::move(sync_processor); GUIDToProfileMap remaining_profiles; CreateGUIDToProfileMap(profiles_.get(), &remaining_profiles); diff --git a/components/autofill/core/browser/webdata/autofill_profile_syncable_service_unittest.cc b/components/autofill/core/browser/webdata/autofill_profile_syncable_service_unittest.cc index 2fb3bd6..e218103 100644 --- a/components/autofill/core/browser/webdata/autofill_profile_syncable_service_unittest.cc +++ b/components/autofill/core/browser/webdata/autofill_profile_syncable_service_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/autofill/core/browser/webdata/autofill_profile_syncable_service.h" + #include <stddef.h> +#include <utility> #include "base/location.h" #include "base/message_loop/message_loop.h" #include "base/strings/utf_string_conversions.h" #include "components/autofill/core/browser/autofill_profile.h" #include "components/autofill/core/browser/webdata/autofill_change.h" -#include "components/autofill/core/browser/webdata/autofill_profile_syncable_service.h" #include "sync/api/sync_error_factory.h" #include "sync/api/sync_error_factory_mock.h" #include "sync/protocol/sync.pb.h" @@ -162,7 +164,7 @@ scoped_ptr<AutofillProfile> ConstructCompleteProfile() { profile->SetRawInfo(ADDRESS_HOME_DEPENDENT_LOCALITY, ASCIIToUTF16("Santa Clara")); profile->set_language_code("en"); - return profile.Pass(); + return profile; } // Returns SyncData with all Autofill profile fields set. Contains identical @@ -238,9 +240,7 @@ class AutofillProfileSyncableServiceTest : public testing::Test { // Takes ownership of sync_processor_. autofill_syncable_service_.MergeDataAndStartSyncing( - syncer::AUTOFILL_PROFILE, - data_list, - sync_processor_.Pass(), + syncer::AUTOFILL_PROFILE, data_list, std::move(sync_processor_), scoped_ptr<syncer::SyncErrorFactory>( new syncer::SyncErrorFactoryMock())); } diff --git a/components/autofill/core/browser/webdata/autofill_table.cc b/components/autofill/core/browser/webdata/autofill_table.cc index 381b5b6..0a5a51d 100644 --- a/components/autofill/core/browser/webdata/autofill_table.cc +++ b/components/autofill/core/browser/webdata/autofill_table.cc @@ -121,7 +121,7 @@ scoped_ptr<AutofillProfile> AutofillProfileFromStatement( profile->set_origin(s.ColumnString(index++)); profile->set_language_code(s.ColumnString(index++)); - return profile.Pass(); + return profile; } void BindEncryptedCardToColumn(sql::Statement* s, @@ -184,7 +184,7 @@ scoped_ptr<CreditCard> CreditCardFromStatement(const sql::Statement& s) { credit_card->set_modification_date(Time::FromTimeT(s.ColumnInt64(index++))); credit_card->set_origin(s.ColumnString(index++)); - return credit_card.Pass(); + return credit_card; } bool AddAutofillProfileNamesToProfile(sql::Connection* db, diff --git a/components/autofill/core/browser/webdata/autofill_wallet_metadata_syncable_service.cc b/components/autofill/core/browser/webdata/autofill_wallet_metadata_syncable_service.cc index 11e47dd..d69c9e5 100644 --- a/components/autofill/core/browser/webdata/autofill_wallet_metadata_syncable_service.cc +++ b/components/autofill/core/browser/webdata/autofill_wallet_metadata_syncable_service.cc @@ -5,6 +5,7 @@ #include "components/autofill/core/browser/webdata/autofill_wallet_metadata_syncable_service.h" #include <stddef.h> +#include <utility> #include "base/base64.h" #include "base/bind.h" @@ -217,8 +218,8 @@ AutofillWalletMetadataSyncableService::MergeDataAndStartSyncing( DCHECK(!sync_error_factory_); DCHECK_EQ(syncer::AUTOFILL_WALLET_METADATA, 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); cache_ = initial_sync_data; diff --git a/components/autofill/core/browser/webdata/autofill_wallet_metadata_syncable_service_unittest.cc b/components/autofill/core/browser/webdata/autofill_wallet_metadata_syncable_service_unittest.cc index 596d061..2106e0f 100644 --- a/components/autofill/core/browser/webdata/autofill_wallet_metadata_syncable_service_unittest.cc +++ b/components/autofill/core/browser/webdata/autofill_wallet_metadata_syncable_service_unittest.cc @@ -6,7 +6,7 @@ #include <stddef.h> #include <stdint.h> - +#include <utility> #include <vector> #include "base/base64.h" @@ -243,7 +243,7 @@ void MergeMetadata(MockService* local, MockService* remote) { remote->GetAllSyncData(syncer::AUTOFILL_WALLET_METADATA), scoped_ptr<syncer::SyncChangeProcessor>( new syncer::SyncChangeProcessorWrapperForTest(remote)), - errors.Pass()) + std::move(errors)) .error() .IsSet()); } diff --git a/components/autofill/core/browser/webdata/autofill_wallet_syncable_service.cc b/components/autofill/core/browser/webdata/autofill_wallet_syncable_service.cc index 4b55c28..56d54b1 100644 --- a/components/autofill/core/browser/webdata/autofill_wallet_syncable_service.cc +++ b/components/autofill/core/browser/webdata/autofill_wallet_syncable_service.cc @@ -5,8 +5,8 @@ #include "components/autofill/core/browser/webdata/autofill_wallet_syncable_service.h" #include <stddef.h> - #include <set> +#include <utility> #include "base/logging.h" #include "base/strings/string_util.h" @@ -196,7 +196,7 @@ AutofillWalletSyncableService::MergeDataAndStartSyncing( scoped_ptr<syncer::SyncChangeProcessor> sync_processor, scoped_ptr<syncer::SyncErrorFactory> sync_error_factory) { DCHECK(thread_checker_.CalledOnValidThread()); - sync_processor_ = sync_processor.Pass(); + sync_processor_ = std::move(sync_processor); return SetSyncData(initial_sync_data); } diff --git a/components/autofill/core/common/autofill_regexes.cc b/components/autofill/core/common/autofill_regexes.cc index 7bc8ed0..91db50e07 100644 --- a/components/autofill/core/common/autofill_regexes.cc +++ b/components/autofill/core/common/autofill_regexes.cc @@ -4,6 +4,8 @@ #include "components/autofill/core/common/autofill_regexes.h" +#include <utility> + #include "base/containers/scoped_ptr_hash_map.h" #include "base/logging.h" #include "base/macros.h" @@ -55,7 +57,7 @@ icu::RegexMatcher* AutofillRegexes::GetMatcher(const base::string16& pattern) { new icu::RegexMatcher(icu_pattern, UREGEX_CASE_INSENSITIVE, status)); DCHECK(U_SUCCESS(status)); - auto result = matchers_.add(pattern, matcher.Pass()); + auto result = matchers_.add(pattern, std::move(matcher)); DCHECK(result.second); it = result.first; } diff --git a/components/bitmap_uploader/bitmap_uploader.cc b/components/bitmap_uploader/bitmap_uploader.cc index a6c828d..5f7f0c5 100644 --- a/components/bitmap_uploader/bitmap_uploader.cc +++ b/components/bitmap_uploader/bitmap_uploader.cc @@ -5,6 +5,7 @@ #include "components/bitmap_uploader/bitmap_uploader.h" #include <stddef.h> +#include <utility> #include "base/bind.h" #include "base/callback.h" @@ -57,7 +58,7 @@ void BitmapUploader::Init(mojo::Shell* shell) { mojo::ServiceProviderPtr gpu_service_provider; mojo::URLRequestPtr request2(mojo::URLRequest::New()); request2->url = mojo::String::From("mojo:mus"); - shell->ConnectToApplication(request2.Pass(), + shell->ConnectToApplication(std::move(request2), mojo::GetProxy(&gpu_service_provider), nullptr, mojo::CreatePermissiveCapabilityFilter(), base::Bind(&OnGotContentHandlerID)); @@ -88,7 +89,7 @@ void BitmapUploader::SetBitmap(int width, Format format) { width_ = width; height_ = height; - bitmap_ = data.Pass(); + bitmap_ = std::move(data); format_ = format; if (surface_) Upload(); @@ -103,7 +104,7 @@ void BitmapUploader::Upload() { mus::mojom::CompositorFrameMetadataPtr meta = mus::mojom::CompositorFrameMetadata::New(); meta->device_scale_factor = 1.0f; - frame->metadata = meta.Pass(); + frame->metadata = std::move(meta); frame->resources.resize(0u); @@ -147,7 +148,7 @@ void BitmapUploader::Upload() { mailbox_holder->texture_target = GL_TEXTURE_2D; mailbox_holder->sync_token = mus::mojom::SyncToken::From<gpu::SyncToken>(sync_token); - resource->mailbox_holder = mailbox_holder.Pass(); + resource->mailbox_holder = std::move(mailbox_holder); resource->is_repeated = false; resource->is_software = false; @@ -191,9 +192,9 @@ void BitmapUploader::Upload() { texture_state->vertex_opacity.push_back(1.f); texture_state->y_flipped = false; - frame->resources.push_back(resource.Pass()); - quad->texture_quad_state = texture_state.Pass(); - pass->quads.push_back(quad.Pass()); + frame->resources.push_back(std::move(resource)); + quad->texture_quad_state = std::move(texture_state); + pass->quads.push_back(std::move(quad)); } if (color_ != g_transparent_color) { @@ -211,14 +212,14 @@ void BitmapUploader::Upload() { color_state->color->rgba = color_; color_state->force_anti_aliasing_off = false; - quad->solid_color_quad_state = color_state.Pass(); - pass->quads.push_back(quad.Pass()); + quad->solid_color_quad_state = std::move(color_state); + pass->quads.push_back(std::move(quad)); } - frame->passes.push_back(pass.Pass()); + frame->passes.push_back(std::move(pass)); // TODO(rjkroege, fsamuel): We should throttle frames. - surface_->SubmitCompositorFrame(frame.Pass(), mojo::Closure()); + surface_->SubmitCompositorFrame(std::move(frame), mojo::Closure()); } uint32_t BitmapUploader::BindTextureForSize(const mojo::Size size) { @@ -250,7 +251,7 @@ void BitmapUploader::ReturnResources( MojoGLES2MakeCurrent(gles2_context_); // TODO(jamesr): Recycle. for (size_t i = 0; i < resources.size(); ++i) { - mus::mojom::ReturnedResourcePtr resource = resources[i].Pass(); + mus::mojom::ReturnedResourcePtr resource = std::move(resources[i]); DCHECK_EQ(1, resource->count); glWaitSyncTokenCHROMIUM( resource->sync_token.To<gpu::SyncToken>().GetConstData()); diff --git a/components/bookmarks/browser/bookmark_model.cc b/components/bookmarks/browser/bookmark_model.cc index 8452b11..3f9f459 100644 --- a/components/bookmarks/browser/bookmark_model.cc +++ b/components/bookmarks/browser/bookmark_model.cc @@ -6,6 +6,7 @@ #include <algorithm> #include <functional> +#include <utility> #include "base/bind.h" #include "base/bind_helpers.h" @@ -918,7 +919,7 @@ void BookmarkModel::RemoveAndDeleteNode(BookmarkNode* delete_me) { observers_, BookmarkNodeRemoved(this, parent, index, node.get(), removed_urls)); - undo_delegate()->OnBookmarkNodeRemoved(this, parent, index, node.Pass()); + undo_delegate()->OnBookmarkNodeRemoved(this, parent, index, std::move(node)); } void BookmarkModel::RemoveNodeFromInternalMaps(BookmarkNode* node) { diff --git a/components/bookmarks/browser/bookmark_model_unittest.cc b/components/bookmarks/browser/bookmark_model_unittest.cc index dee1d94..d9e724a 100644 --- a/components/bookmarks/browser/bookmark_model_unittest.cc +++ b/components/bookmarks/browser/bookmark_model_unittest.cc @@ -6,9 +6,9 @@ #include <stddef.h> #include <stdint.h> - #include <set> #include <string> +#include <utility> #include "base/base_paths.h" #include "base/command_line.h" @@ -426,7 +426,7 @@ class BookmarkModelTest : public testing::Test, BookmarkPermanentNode* extra_node = new BookmarkPermanentNode(100); BookmarkPermanentNodeList extra_nodes; extra_nodes.push_back(extra_node); - client_.SetExtraNodesToLoad(extra_nodes.Pass()); + client_.SetExtraNodesToLoad(std::move(extra_nodes)); model_->RemoveObserver(this); model_ = client_.CreateModel(); diff --git a/components/bookmarks/browser/bookmark_storage.cc b/components/bookmarks/browser/bookmark_storage.cc index 921e3f3..f1c8380 100644 --- a/components/bookmarks/browser/bookmark_storage.cc +++ b/components/bookmarks/browser/bookmark_storage.cc @@ -5,8 +5,8 @@ #include "components/bookmarks/browser/bookmark_storage.h" #include <stddef.h> - #include <algorithm> +#include <utility> #include "base/bind.h" #include "base/compiler_specific.h" @@ -214,7 +214,7 @@ void BookmarkStorage::OnLoadFinished(scoped_ptr<BookmarkLoadDetails> details) { if (!model_) return; - model_->DoneLoading(details.Pass()); + model_->DoneLoading(std::move(details)); } bool BookmarkStorage::SaveNow() { @@ -228,7 +228,7 @@ bool BookmarkStorage::SaveNow() { scoped_ptr<std::string> data(new std::string); if (!SerializeData(data.get())) return false; - writer_.WriteNow(data.Pass()); + writer_.WriteNow(std::move(data)); return true; } diff --git a/components/bookmarks/browser/bookmark_utils_unittest.cc b/components/bookmarks/browser/bookmark_utils_unittest.cc index eaeb42b..29225d4 100644 --- a/components/bookmarks/browser/bookmark_utils_unittest.cc +++ b/components/bookmarks/browser/bookmark_utils_unittest.cc @@ -5,7 +5,7 @@ #include "components/bookmarks/browser/bookmark_utils.h" #include <stddef.h> - +#include <utility> #include <vector> #include "base/macros.h" @@ -429,7 +429,7 @@ TEST_F(BookmarkUtilsTest, PasteNonEditableNodes) { BookmarkPermanentNode* extra_node = new BookmarkPermanentNode(100); BookmarkPermanentNodeList extra_nodes; extra_nodes.push_back(extra_node); - client.SetExtraNodesToLoad(extra_nodes.Pass()); + client.SetExtraNodesToLoad(std::move(extra_nodes)); scoped_ptr<BookmarkModel> model(client.CreateModel()); const BookmarkNode* node = model->AddURL(model->other_node(), @@ -583,7 +583,7 @@ TEST_F(BookmarkUtilsTest, RemoveAllBookmarks) { BookmarkPermanentNode* extra_node = new BookmarkPermanentNode(100); BookmarkPermanentNodeList extra_nodes; extra_nodes.push_back(extra_node); - client.SetExtraNodesToLoad(extra_nodes.Pass()); + client.SetExtraNodesToLoad(std::move(extra_nodes)); scoped_ptr<BookmarkModel> model(client.CreateModel()); EXPECT_TRUE(model->bookmark_bar_node()->empty()); diff --git a/components/bookmarks/managed/managed_bookmark_service.cc b/components/bookmarks/managed/managed_bookmark_service.cc index 27370b61..066df72 100644 --- a/components/bookmarks/managed/managed_bookmark_service.cc +++ b/components/bookmarks/managed/managed_bookmark_service.cc @@ -6,6 +6,7 @@ #include <stdint.h> #include <stdlib.h> +#include <utility> #include <vector> #include "base/bind.h" @@ -31,8 +32,8 @@ class BookmarkPermanentNodeLoader { BookmarkPermanentNodeLoader(scoped_ptr<BookmarkPermanentNode> node, scoped_ptr<base::ListValue> initial_bookmarks, int title_id) - : node_(node.Pass()), - initial_bookmarks_(initial_bookmarks.Pass()), + : node_(std::move(node)), + initial_bookmarks_(std::move(initial_bookmarks)), title_id_(title_id) { DCHECK(node_); } @@ -48,7 +49,7 @@ class BookmarkPermanentNodeLoader { node_.get(), initial_bookmarks_.get(), node_->id() + 1); node_->set_visible(!node_->empty()); node_->SetTitle(l10n_util::GetStringUTF16(title_id_)); - return node_.Pass(); + return std::move(node_); } private: @@ -68,7 +69,7 @@ BookmarkPermanentNodeList LoadExtraNodes( BookmarkPermanentNodeList extra_nodes; for (const auto& loader : loaders) extra_nodes.push_back(loader->Load(next_node_id).release()); - return extra_nodes.Pass(); + return extra_nodes; } } // namespace @@ -114,10 +115,11 @@ LoadExtraCallback ManagedBookmarkService::GetLoadExtraNodesCallback() { ScopedVector<BookmarkPermanentNodeLoader> loaders; loaders.push_back(new BookmarkPermanentNodeLoader( - managed.Pass(), managed_bookmarks_tracker_->GetInitialManagedBookmarks(), + std::move(managed), + managed_bookmarks_tracker_->GetInitialManagedBookmarks(), IDS_BOOKMARK_BAR_MANAGED_FOLDER_DEFAULT_NAME)); loaders.push_back(new BookmarkPermanentNodeLoader( - supervised.Pass(), + std::move(supervised), supervised_bookmarks_tracker_->GetInitialManagedBookmarks(), IDS_BOOKMARK_BAR_SUPERVISED_FOLDER_DEFAULT_NAME)); diff --git a/components/bookmarks/managed/managed_bookmarks_tracker_unittest.cc b/components/bookmarks/managed/managed_bookmarks_tracker_unittest.cc index 07b1238..3ce78c3 100644 --- a/components/bookmarks/managed/managed_bookmarks_tracker_unittest.cc +++ b/components/bookmarks/managed/managed_bookmarks_tracker_unittest.cc @@ -4,6 +4,8 @@ #include "components/bookmarks/managed/managed_bookmarks_tracker.h" +#include <utility> + #include "base/bind.h" #include "base/files/file_path.h" #include "base/memory/scoped_ptr.h" @@ -61,7 +63,7 @@ class ManagedBookmarksTrackerTest : public testing::Test { BookmarkPermanentNodeList extra_nodes; extra_nodes.push_back(managed_node); - client_.SetExtraNodesToLoad(extra_nodes.Pass()); + client_.SetExtraNodesToLoad(std::move(extra_nodes)); model_.reset(new BookmarkModel(&client_)); model_->AddObserver(&observer_); diff --git a/components/bookmarks/test/test_bookmark_client.cc b/components/bookmarks/test/test_bookmark_client.cc index 145ad57..89ca479 100644 --- a/components/bookmarks/test/test_bookmark_client.cc +++ b/components/bookmarks/test/test_bookmark_client.cc @@ -5,6 +5,7 @@ #include "components/bookmarks/test/test_bookmark_client.h" #include <stddef.h> +#include <utility> #include "base/bind.h" #include "base/bind_helpers.h" @@ -24,13 +25,13 @@ scoped_ptr<BookmarkModel> TestBookmarkClient::CreateModel() { scoped_ptr<BookmarkLoadDetails> details = bookmark_model->CreateLoadDetails(std::string()); details->LoadExtraNodes(); - bookmark_model->DoneLoading(details.Pass()); - return bookmark_model.Pass(); + bookmark_model->DoneLoading(std::move(details)); + return bookmark_model; } void TestBookmarkClient::SetExtraNodesToLoad( BookmarkPermanentNodeList extra_nodes) { - extra_nodes_to_load_ = extra_nodes.Pass(); + extra_nodes_to_load_ = std::move(extra_nodes); // Keep a copy in |extra_nodes_| for the acessor. extra_nodes_ = extra_nodes_to_load_.get(); } @@ -87,7 +88,7 @@ bool TestBookmarkClient::CanBeEditedByUser(const BookmarkNode* node) { BookmarkPermanentNodeList TestBookmarkClient::LoadExtraNodes( BookmarkPermanentNodeList extra_nodes, int64_t* next_id) { - return extra_nodes.Pass(); + return extra_nodes; } } // namespace bookmarks diff --git a/components/browser_sync/browser/profile_sync_components_factory_impl.cc b/components/browser_sync/browser/profile_sync_components_factory_impl.cc index a67bd90..f8074d9 100644 --- a/components/browser_sync/browser/profile_sync_components_factory_impl.cc +++ b/components/browser_sync/browser/profile_sync_components_factory_impl.cc @@ -4,6 +4,8 @@ #include "components/browser_sync/browser/profile_sync_components_factory_impl.h" +#include <utility> + #include "base/command_line.h" #include "base/memory/ref_counted.h" #include "base/prefs/pref_service.h" @@ -350,10 +352,10 @@ ProfileSyncComponentsFactoryImpl::CreateAttachmentService( const base::TimeDelta max_backoff_delay = base::TimeDelta::FromHours(4); scoped_ptr<syncer::AttachmentService> attachment_service( new syncer::AttachmentServiceImpl( - attachment_store.Pass(), attachment_uploader.Pass(), - attachment_downloader.Pass(), delegate, initial_backoff_delay, + std::move(attachment_store), std::move(attachment_uploader), + std::move(attachment_downloader), delegate, initial_backoff_delay, max_backoff_delay)); - return attachment_service.Pass(); + return attachment_service; } sync_driver::SyncApiComponentFactory::SyncComponents diff --git a/components/browser_sync/browser/profile_sync_service.cc b/components/browser_sync/browser/profile_sync_service.cc index 312d617..4dd43af 100644 --- a/components/browser_sync/browser/profile_sync_service.cc +++ b/components/browser_sync/browser/profile_sync_service.cc @@ -5,9 +5,9 @@ #include "components/browser_sync/browser/profile_sync_service.h" #include <stddef.h> - #include <cstddef> #include <map> +#include <utility> #include <vector> #include "base/bind.h" @@ -284,7 +284,7 @@ void ProfileSyncService::Initialize() { browser_sync::SyncStoppedReporter::ResultCallback())); sessions_sync_manager_.reset(new SessionsSyncManager( sync_client_->GetSyncSessionsClient(), &sync_prefs_, local_device_.get(), - router.Pass(), + std::move(router), base::Bind(&ProfileSyncService::NotifyForeignSessionUpdated, weak_factory_.GetWeakPtr()), base::Bind(&ProfileSyncService::TriggerRefresh, @@ -549,14 +549,14 @@ void ProfileSyncService::InitializeBackend(bool delete_stale_data) { network_time_update_callback_); backend_->Initialize( - this, sync_thread_.Pass(), db_thread_, file_thread_, GetJsEventHandler(), - sync_service_url_, local_device_->GetSyncUserAgent(), credentials, - delete_stale_data, scoped_ptr<syncer::SyncManagerFactory>( - new syncer::SyncManagerFactory(GetManagerType())) - .Pass(), + this, std::move(sync_thread_), db_thread_, file_thread_, + GetJsEventHandler(), sync_service_url_, local_device_->GetSyncUserAgent(), + credentials, delete_stale_data, + scoped_ptr<syncer::SyncManagerFactory>( + new syncer::SyncManagerFactory(GetManagerType())), MakeWeakHandle(weak_factory_.GetWeakPtr()), base::Bind(browser_sync::ChromeReportUnrecoverableError, channel_), - http_post_provider_factory_getter, saved_nigori_state_.Pass()); + http_post_provider_factory_getter, std::move(saved_nigori_state_)); } bool ProfileSyncService::IsEncryptedDatatypeEnabled() const { @@ -1437,7 +1437,7 @@ void ProfileSyncService::BeginConfigureCatchUpBeforeClear() { DCHECK(data_type_manager_); DCHECK(!saved_nigori_state_); saved_nigori_state_ = - sync_prefs_.GetSavedNigoriStateForPassphraseEncryptionTransition().Pass(); + sync_prefs_.GetSavedNigoriStateForPassphraseEncryptionTransition(); const syncer::ModelTypeSet types = GetActiveDataTypes(); catch_up_configure_in_progress_ = true; data_type_manager_->Configure(types, syncer::CONFIGURE_REASON_CATCH_UP); @@ -2398,7 +2398,7 @@ void GetAllNodesRequestHelper::OnReceivedNodesForTypes( } if (awaiting_types_.Empty()) { - callback_.Run(result_accumulator_.Pass()); + callback_.Run(std::move(result_accumulator_)); callback_.Reset(); } } @@ -2421,7 +2421,7 @@ void ProfileSyncService::GetAllNodes( type_vector.push_back(it.Get()); empty_results.push_back(new base::ListValue()); } - helper->OnReceivedNodesForTypes(type_vector, empty_results.Pass()); + helper->OnReceivedNodesForTypes(type_vector, std::move(empty_results)); } else { backend_->GetAllNodesForTypes( all_types, @@ -2578,7 +2578,7 @@ ProfileSyncService::GetSyncTokenStatus() const { void ProfileSyncService::OverrideNetworkResourcesForTest( scoped_ptr<syncer::NetworkResources> network_resources) { - network_resources_ = network_resources.Pass(); + network_resources_ = std::move(network_resources); } bool ProfileSyncService::HasSyncingBackend() const { diff --git a/components/browser_sync/browser/profile_sync_service_unittest.cc b/components/browser_sync/browser/profile_sync_service_unittest.cc index a5a6a3d..e13b9ec 100644 --- a/components/browser_sync/browser/profile_sync_service_unittest.cc +++ b/components/browser_sync/browser/profile_sync_service_unittest.cc @@ -105,7 +105,7 @@ class TestSyncClient : public sync_driver::FakeSyncClient { : sync_driver::FakeSyncClient(), callback_(callback), pref_service_(pref_service), - component_factory_(component_factory.Pass()) {} + component_factory_(std::move(component_factory)) {} ~TestSyncClient() override {} private: @@ -191,11 +191,11 @@ class SyncBackendHostMockCollectDeleteDirParam : public SyncBackendHostMock { override { delete_dir_param_->push_back(delete_sync_data_folder); SyncBackendHostMock::Initialize( - frontend, sync_thread.Pass(), db_thread, file_thread, event_handler, + frontend, std::move(sync_thread), db_thread, file_thread, event_handler, service_url, sync_user_agent, credentials, delete_sync_data_folder, - sync_manager_factory.Pass(), unrecoverable_error_handler, + std::move(sync_manager_factory), unrecoverable_error_handler, report_unrecoverable_error_function, http_post_provider_factory_getter, - saved_nigori_state.Pass()); + std::move(saved_nigori_state)); } private: @@ -311,7 +311,7 @@ class ProfileSyncServiceTest : public ::testing::Test { new SyncApiComponentFactoryMock()); components_factory_ = components_factory.get(); scoped_ptr<sync_driver::SyncClient> sync_client(new TestSyncClient( - components_factory.Pass(), &pref_service_, + std::move(components_factory), &pref_service_, base::Bind(&ProfileSyncServiceTest::ClearBrowsingDataCallback, base::Unretained(this)))); diff --git a/components/bubble/bubble_controller.cc b/components/bubble/bubble_controller.cc index 511c225..8deeaa7 100644 --- a/components/bubble/bubble_controller.cc +++ b/components/bubble/bubble_controller.cc @@ -4,13 +4,15 @@ #include "components/bubble/bubble_controller.h" +#include <utility> + #include "components/bubble/bubble_delegate.h" #include "components/bubble/bubble_manager.h" #include "components/bubble/bubble_ui.h" BubbleController::BubbleController(BubbleManager* manager, scoped_ptr<BubbleDelegate> delegate) - : manager_(manager), delegate_(delegate.Pass()) { + : manager_(manager), delegate_(std::move(delegate)) { DCHECK(manager_); DCHECK(delegate_); } diff --git a/components/bubble/bubble_manager.cc b/components/bubble/bubble_manager.cc index 173a5ac..36902a3 100644 --- a/components/bubble/bubble_manager.cc +++ b/components/bubble/bubble_manager.cc @@ -4,6 +4,7 @@ #include "components/bubble/bubble_manager.h" +#include <utility> #include <vector> #include "components/bubble/bubble_controller.h" @@ -21,14 +22,14 @@ BubbleReference BubbleManager::ShowBubble(scoped_ptr<BubbleDelegate> bubble) { DCHECK(bubble); scoped_ptr<BubbleController> controller( - new BubbleController(this, bubble.Pass())); + new BubbleController(this, std::move(bubble))); BubbleReference bubble_ref = controller->AsWeakPtr(); switch (manager_state_) { case SHOW_BUBBLES: controller->Show(); - controllers_.push_back(controller.Pass()); + controllers_.push_back(std::move(controller)); break; case NO_MORE_BUBBLES: FOR_EACH_OBSERVER(BubbleManagerObserver, observers_, diff --git a/components/bubble/bubble_manager_mocks.h b/components/bubble/bubble_manager_mocks.h index 1712ba7..d181b4f 100644 --- a/components/bubble/bubble_manager_mocks.h +++ b/components/bubble/bubble_manager_mocks.h @@ -5,6 +5,8 @@ #ifndef COMPONENTS_BUBBLE_BUBBLE_MANAGER_MOCKS_H_ #define COMPONENTS_BUBBLE_BUBBLE_MANAGER_MOCKS_H_ +#include <utility> + #include "base/macros.h" #include "components/bubble/bubble_delegate.h" #include "components/bubble/bubble_reference.h" @@ -42,7 +44,9 @@ class MockBubbleDelegate : public BubbleDelegate { MOCK_METHOD0(DidClose, void()); // A scoped_ptr can't be returned in MOCK_METHOD. - scoped_ptr<BubbleUi> BuildBubbleUi() override { return bubble_ui_.Pass(); } + scoped_ptr<BubbleUi> BuildBubbleUi() override { + return std::move(bubble_ui_); + } MOCK_METHOD1(UpdateBubbleUi, bool(BubbleUi*)); diff --git a/components/bubble/bubble_manager_unittest.cc b/components/bubble/bubble_manager_unittest.cc index f118cad..4811fe6 100644 --- a/components/bubble/bubble_manager_unittest.cc +++ b/components/bubble/bubble_manager_unittest.cc @@ -4,6 +4,8 @@ #include "components/bubble/bubble_manager.h" +#include <utility> + #include "base/macros.h" #include "components/bubble/bubble_controller.h" #include "components/bubble/bubble_manager_mocks.h" @@ -22,7 +24,7 @@ class ChainShowBubbleDelegate : public MockBubbleDelegate { scoped_ptr<BubbleDelegate> delegate, BubbleReference* chained_bubble) : manager_(manager), - delegate_(delegate.Pass()), + delegate_(std::move(delegate)), chained_bubble_(chained_bubble), closed_(false) { EXPECT_CALL(*this, ShouldClose(testing::_)).WillOnce(testing::Return(true)); @@ -32,7 +34,7 @@ class ChainShowBubbleDelegate : public MockBubbleDelegate { void DidClose() override { MockBubbleDelegate::DidClose(); - BubbleReference ref = manager_->ShowBubble(delegate_.Pass()); + BubbleReference ref = manager_->ShowBubble(std::move(delegate_)); if (chained_bubble_) *chained_bubble_ = ref; closed_ = true; @@ -116,7 +118,7 @@ TEST_F(BubbleManagerTest, ManagerShowsBubbleUi) { EXPECT_CALL(*bubble_ui, Close()); EXPECT_CALL(*bubble_ui, UpdateAnchorPosition()).Times(0); - manager_->ShowBubble(delegate.Pass()); + manager_->ShowBubble(std::move(delegate)); } TEST_F(BubbleManagerTest, ManagerUpdatesBubbleUiAnchor) { @@ -128,7 +130,7 @@ TEST_F(BubbleManagerTest, ManagerUpdatesBubbleUiAnchor) { EXPECT_CALL(*bubble_ui, Close()); EXPECT_CALL(*bubble_ui, UpdateAnchorPosition()); - manager_->ShowBubble(delegate.Pass()); + manager_->ShowBubble(std::move(delegate)); manager_->UpdateAllBubbleAnchors(); } @@ -317,7 +319,7 @@ TEST_F(BubbleManagerTest, BubblesDoNotChainOnDestroy) { EXPECT_CALL(*chained_delegate, DidClose()).Times(0); manager_->ShowBubble(make_scoped_ptr(new ChainShowBubbleDelegate( - manager_.get(), chained_delegate.Pass(), nullptr))); + manager_.get(), std::move(chained_delegate), nullptr))); manager_.reset(); } @@ -346,7 +348,7 @@ TEST_F(BubbleManagerTest, BubbleCloseChainCloseClose) { manager_->ShowBubble(MockBubbleDelegate::Default()); BubbleReference closing_bubble_ref = - manager_->ShowBubble(closing_bubble.Pass()); + manager_->ShowBubble(std::move(closing_bubble)); EXPECT_TRUE(other_bubble_ref); EXPECT_TRUE(closing_bubble_ref); @@ -369,7 +371,7 @@ TEST_F(BubbleManagerTest, BubbleCloseChainCloseNoClose) { manager_->ShowBubble(MockBubbleDelegate::Stubborn()); BubbleReference closing_bubble_ref = - manager_->ShowBubble(closing_bubble.Pass()); + manager_->ShowBubble(std::move(closing_bubble)); EXPECT_TRUE(other_bubble_ref); EXPECT_TRUE(closing_bubble_ref); @@ -393,7 +395,7 @@ TEST_F(BubbleManagerTest, BubbleCloseChainNoCloseNoClose) { manager_->ShowBubble(MockBubbleDelegate::Default()); BubbleReference closing_bubble_ref = - manager_->ShowBubble(closing_bubble.Pass()); + manager_->ShowBubble(std::move(closing_bubble)); EXPECT_TRUE(other_bubble_ref); EXPECT_TRUE(closing_bubble_ref); diff --git a/components/certificate_reporting/error_reporter.cc b/components/certificate_reporting/error_reporter.cc index 877d272..6cfa629 100644 --- a/components/certificate_reporting/error_reporter.cc +++ b/components/certificate_reporting/error_reporter.cc @@ -5,8 +5,8 @@ #include "components/certificate_reporting/error_reporter.h" #include <stddef.h> - #include <set> +#include <utility> #include "base/logging.h" #include "components/certificate_reporting/encrypted_cert_logger.pb.h" @@ -121,7 +121,7 @@ ErrorReporter::ErrorReporter( const uint8_t server_public_key[/* 32 */], const uint32_t server_public_key_version, scoped_ptr<net::CertificateReportSender> certificate_report_sender) - : certificate_report_sender_(certificate_report_sender.Pass()), + : certificate_report_sender_(std::move(certificate_report_sender)), upload_url_(upload_url), server_public_key_(server_public_key), server_public_key_version_(server_public_key_version) { diff --git a/components/certificate_transparency/log_proof_fetcher_unittest.cc b/components/certificate_transparency/log_proof_fetcher_unittest.cc index 3d4383e..7782f7f 100644 --- a/components/certificate_transparency/log_proof_fetcher_unittest.cc +++ b/components/certificate_transparency/log_proof_fetcher_unittest.cc @@ -5,6 +5,7 @@ #include "components/certificate_transparency/log_proof_fetcher.h" #include <string> +#include <utility> #include "base/macros.h" #include "base/strings/stringprintf.h" @@ -184,7 +185,7 @@ class LogProofFetcherTest : public ::testing::Test { handler_ = handler.get(); net::URLRequestFilter::GetInstance()->AddHostnameInterceptor( - kLogSchema, kLogHost, handler.Pass()); + kLogSchema, kLogHost, std::move(handler)); fetcher_.reset(new LogProofFetcher(&context_)); } diff --git a/components/clipboard/clipboard_application_delegate.cc b/components/clipboard/clipboard_application_delegate.cc index 53eff35..b259855 100644 --- a/components/clipboard/clipboard_application_delegate.cc +++ b/components/clipboard/clipboard_application_delegate.cc @@ -4,6 +4,8 @@ #include "components/clipboard/clipboard_application_delegate.h" +#include <utility> + #include "components/clipboard/clipboard_standalone_impl.h" #include "mojo/application/public/cpp/application_connection.h" @@ -28,7 +30,7 @@ void ClipboardApplicationDelegate::Create( mojo::InterfaceRequest<mojo::Clipboard> request) { // TODO(erg): Write native implementations of the clipboard. For now, we // just build a clipboard which doesn't interact with the system. - new clipboard::ClipboardStandaloneImpl(request.Pass()); + new clipboard::ClipboardStandaloneImpl(std::move(request)); } } // namespace clipboard diff --git a/components/clipboard/clipboard_apptest.cc b/components/clipboard/clipboard_apptest.cc index 6f7f217..814dd38 100644 --- a/components/clipboard/clipboard_apptest.cc +++ b/components/clipboard/clipboard_apptest.cc @@ -3,6 +3,7 @@ // found in the LICENSE file. #include <stdint.h> +#include <utility> #include "base/bind.h" #include "base/macros.h" @@ -95,7 +96,7 @@ class ClipboardAppTest : public mojo::test::ApplicationTestBase { Map<String, Array<uint8_t>> mime_data; mime_data[Clipboard::MIME_TYPE_TEXT] = Array<uint8_t>::From(data); clipboard_->WriteClipboardData(Clipboard::TYPE_COPY_PASTE, - mime_data.Pass()); + std::move(mime_data)); } protected: @@ -130,7 +131,8 @@ TEST_F(ClipboardAppTest, CanSetMultipleDataTypesAtOnce) { mime_data[Clipboard::MIME_TYPE_HTML] = Array<uint8_t>::From(std::string(kHtmlData)); - clipboard_->WriteClipboardData(Clipboard::TYPE_COPY_PASTE, mime_data.Pass()); + clipboard_->WriteClipboardData(Clipboard::TYPE_COPY_PASTE, + std::move(mime_data)); EXPECT_EQ(1ul, GetSequenceNumber()); @@ -150,7 +152,8 @@ TEST_F(ClipboardAppTest, CanClearClipboardWithZeroArray) { EXPECT_EQ(kPlainTextData, data); Map<String, Array<uint8_t>> mime_data; - clipboard_->WriteClipboardData(Clipboard::TYPE_COPY_PASTE, mime_data.Pass()); + clipboard_->WriteClipboardData(Clipboard::TYPE_COPY_PASTE, + std::move(mime_data)); EXPECT_EQ(2ul, GetSequenceNumber()); EXPECT_FALSE(GetDataOfType(Clipboard::MIME_TYPE_TEXT, &data)); diff --git a/components/clipboard/clipboard_standalone_impl.cc b/components/clipboard/clipboard_standalone_impl.cc index 97afe3d..1a852f7 100644 --- a/components/clipboard/clipboard_standalone_impl.cc +++ b/components/clipboard/clipboard_standalone_impl.cc @@ -5,6 +5,7 @@ #include "components/clipboard/clipboard_standalone_impl.h" #include <string.h> +#include <utility> #include "base/macros.h" #include "mojo/public/cpp/bindings/array.h" @@ -30,10 +31,12 @@ class ClipboardStandaloneImpl::ClipboardData { for (auto it = data_types_.begin(); it != data_types_.end(); ++it, ++i) types[i] = it.GetKey(); - return types.Pass(); + return types; } - void SetData(Map<String, Array<uint8_t>> data) { data_types_ = data.Pass(); } + void SetData(Map<String, Array<uint8_t>> data) { + data_types_ = std::move(data); + } void GetData(const String& mime_type, Array<uint8_t>* data) const { auto it = data_types_.find(mime_type); @@ -49,7 +52,7 @@ class ClipboardStandaloneImpl::ClipboardData { ClipboardStandaloneImpl::ClipboardStandaloneImpl( mojo::InterfaceRequest<mojo::Clipboard> request) - : binding_(this, request.Pass()) { + : binding_(this, std::move(request)) { for (int i = 0; i < kNumClipboards; ++i) { sequence_number_[i] = 0; clipboard_state_[i].reset(new ClipboardData); @@ -68,7 +71,7 @@ void ClipboardStandaloneImpl::GetSequenceNumber( void ClipboardStandaloneImpl::GetAvailableMimeTypes( Clipboard::Type clipboard_type, const mojo::Callback<void(Array<String>)>& callback) { - callback.Run(clipboard_state_[clipboard_type]->GetMimeTypes().Pass()); + callback.Run(clipboard_state_[clipboard_type]->GetMimeTypes()); } void ClipboardStandaloneImpl::ReadMimeType( @@ -77,14 +80,14 @@ void ClipboardStandaloneImpl::ReadMimeType( const mojo::Callback<void(Array<uint8_t>)>& callback) { Array<uint8_t> mime_data; clipboard_state_[clipboard_type]->GetData(mime_type, &mime_data); - callback.Run(mime_data.Pass()); + callback.Run(std::move(mime_data)); } void ClipboardStandaloneImpl::WriteClipboardData( Clipboard::Type clipboard_type, Map<String, Array<uint8_t>> data) { sequence_number_[clipboard_type]++; - clipboard_state_[clipboard_type]->SetData(data.Pass()); + clipboard_state_[clipboard_type]->SetData(std::move(data)); } } // namespace clipboard diff --git a/components/cloud_devices/common/cloud_device_description.cc b/components/cloud_devices/common/cloud_device_description.cc index d24ef0c..b69e2c4 100644 --- a/components/cloud_devices/common/cloud_device_description.cc +++ b/components/cloud_devices/common/cloud_device_description.cc @@ -4,6 +4,8 @@ #include "components/cloud_devices/common/cloud_device_description.h" +#include <utility> + #include "base/json/json_reader.h" #include "base/json/json_writer.h" #include "base/logging.h" @@ -29,7 +31,7 @@ bool CloudDeviceDescription::InitFromDictionary( if (!root) return false; Reset(); - root_ = root.Pass(); + root_ = std::move(root); std::string version; root_->GetString(json::kVersion, &version); return version == json::kVersion10; diff --git a/components/component_updater/default_component_installer.cc b/components/component_updater/default_component_installer.cc index b757c0d..9e3f34a 100644 --- a/components/component_updater/default_component_installer.cc +++ b/components/component_updater/default_component_installer.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/component_updater/default_component_installer.h" + +#include <utility> + #include "base/bind.h" #include "base/bind_helpers.h" #include "base/files/file_enumerator.h" @@ -15,7 +19,6 @@ #include "base/version.h" // TODO(ddorwin): Find a better place for ReadManifest. #include "components/component_updater/component_updater_service.h" -#include "components/component_updater/default_component_installer.h" #include "components/update_client/component_unpacker.h" #include "components/update_client/utils.h" @@ -38,7 +41,7 @@ DefaultComponentInstaller::DefaultComponentInstaller( scoped_ptr<ComponentInstallerTraits> installer_traits) : current_version_(kNullVersion), main_task_runner_(base::ThreadTaskRunnerHandle::Get()) { - installer_traits_ = installer_traits.Pass(); + installer_traits_ = std::move(installer_traits); } DefaultComponentInstaller::~DefaultComponentInstaller() { @@ -186,12 +189,12 @@ void DefaultComponentInstaller::StartRegistration(ComponentUpdateService* cus) { latest_path = path; latest_version = version; - latest_manifest = manifest.Pass(); + latest_manifest = std::move(manifest); } if (latest_manifest) { current_version_ = latest_version; - current_manifest_ = latest_manifest.Pass(); + current_manifest_ = std::move(latest_manifest); // TODO(ddorwin): Remove these members and pass them directly to // FinishRegistration(). base::ReadFileToString(latest_path.AppendASCII("manifest.fingerprint"), @@ -262,13 +265,13 @@ void DefaultComponentInstaller::FinishRegistration( scoped_ptr<base::DictionaryValue> manifest_copy( current_manifest_->DeepCopy()); - ComponentReady(manifest_copy.Pass()); + ComponentReady(std::move(manifest_copy)); } void DefaultComponentInstaller::ComponentReady( scoped_ptr<base::DictionaryValue> manifest) { - installer_traits_->ComponentReady( - current_version_, GetInstallDirectory(), manifest.Pass()); + installer_traits_->ComponentReady(current_version_, GetInstallDirectory(), + std::move(manifest)); } } // namespace component_updater diff --git a/components/content_settings/core/browser/content_settings_binary_value_map.cc b/components/content_settings/core/browser/content_settings_binary_value_map.cc index 088a941..97a9b26 100644 --- a/components/content_settings/core/browser/content_settings_binary_value_map.cc +++ b/components/content_settings/core/browser/content_settings_binary_value_map.cc @@ -4,6 +4,8 @@ #include "components/content_settings/core/browser/content_settings_binary_value_map.h" +#include <utility> + #include "base/synchronization/lock.h" #include "components/content_settings/core/browser/content_settings_rule.h" #include "components/content_settings/core/common/content_settings.h" @@ -16,7 +18,7 @@ class RuleIteratorBinary : public RuleIterator { public: explicit RuleIteratorBinary(bool is_enabled, scoped_ptr<base::AutoLock> auto_lock) - : is_done_(is_enabled), auto_lock_(auto_lock.Pass()) {} + : is_done_(is_enabled), auto_lock_(std::move(auto_lock)) {} bool HasNext() const override { return !is_done_; } @@ -45,7 +47,7 @@ scoped_ptr<RuleIterator> BinaryValueMap::GetRuleIterator( scoped_ptr<base::AutoLock> auto_lock) const { if (resource_identifier.empty()) { return scoped_ptr<RuleIterator>(new RuleIteratorBinary( - IsContentSettingEnabled(content_type), auto_lock.Pass())); + IsContentSettingEnabled(content_type), std::move(auto_lock))); } return scoped_ptr<RuleIterator>(new EmptyRuleIterator()); } diff --git a/components/content_settings/core/browser/content_settings_default_provider.cc b/components/content_settings/core/browser/content_settings_default_provider.cc index 9a7c447..8bae69f 100644 --- a/components/content_settings/core/browser/content_settings_default_provider.cc +++ b/components/content_settings/core/browser/content_settings_default_provider.cc @@ -351,7 +351,7 @@ void DefaultProvider::OnPreferenceChanged(const std::string& name) { scoped_ptr<base::Value> DefaultProvider::ReadFromPref( ContentSettingsType content_type) { int int_value = prefs_->GetInteger(GetPrefName(content_type)); - return ContentSettingToValue(IntToContentSetting(int_value)).Pass(); + return ContentSettingToValue(IntToContentSetting(int_value)); } void DefaultProvider::DiscardObsoletePreferences() { diff --git a/components/content_settings/core/browser/content_settings_pref_provider.cc b/components/content_settings/core/browser/content_settings_pref_provider.cc index 3b9b84d..681b50f 100644 --- a/components/content_settings/core/browser/content_settings_pref_provider.cc +++ b/components/content_settings/core/browser/content_settings_pref_provider.cc @@ -187,7 +187,7 @@ ContentSettingsPref* PrefProvider::GetPref(ContentSettingsType type) const { } void PrefProvider::SetClockForTesting(scoped_ptr<base::Clock> clock) { - clock_ = clock.Pass(); + clock_ = std::move(clock); } void PrefProvider::Notify( diff --git a/components/content_settings/core/browser/content_settings_registry.cc b/components/content_settings/core/browser/content_settings_registry.cc index 2cf4fe9..c16c783 100644 --- a/components/content_settings/core/browser/content_settings_registry.cc +++ b/components/content_settings/core/browser/content_settings_registry.cc @@ -4,6 +4,8 @@ #include "components/content_settings/core/browser/content_settings_registry.h" +#include <utility> + #include "base/macros.h" #include "base/memory/scoped_ptr.h" #include "base/stl_util.h" @@ -297,7 +299,7 @@ void ContentSettingsRegistry::Register( new base::FundamentalValue(static_cast<int>(initial_default_value))); const WebsiteSettingsInfo* website_settings_info = website_settings_registry_->Register( - type, name, default_value.Pass(), sync_status, + type, name, std::move(default_value), sync_status, WebsiteSettingsInfo::NOT_LOSSY, scoping_type); DCHECK(!ContainsKey(content_settings_info_, type)); content_settings_info_[type] = make_scoped_ptr( diff --git a/components/content_settings/core/browser/host_content_settings_map.cc b/components/content_settings/core/browser/host_content_settings_map.cc index 885dc65..fd9cbbf 100644 --- a/components/content_settings/core/browser/host_content_settings_map.cc +++ b/components/content_settings/core/browser/host_content_settings_map.cc @@ -251,7 +251,7 @@ void HostContentSettingsMap::SetDefaultContentSetting( } SetWebsiteSettingCustomScope(ContentSettingsPattern::Wildcard(), ContentSettingsPattern::Wildcard(), content_type, - std::string(), value.Pass()); + std::string(), std::move(value)); } void HostContentSettingsMap::SetWebsiteSettingDefaultScope( @@ -407,7 +407,7 @@ void HostContentSettingsMap::SetContentSetting( value.reset(new base::FundamentalValue(setting)); } SetWebsiteSettingCustomScope(primary_pattern, secondary_pattern, content_type, - resource_identifier, value.Pass()); + resource_identifier, std::move(value)); } ContentSetting HostContentSettingsMap::GetContentSettingAndMaybeUpdateLastUsage( @@ -489,7 +489,7 @@ void HostContentSettingsMap::SetPrefClockForTesting( scoped_ptr<base::Clock> clock) { UsedContentSettingsProviders(); - GetPrefProvider()->SetClockForTesting(clock.Pass()); + GetPrefProvider()->SetClockForTesting(std::move(clock)); } void HostContentSettingsMap::ClearSettingsForOneType( @@ -685,7 +685,7 @@ scoped_ptr<base::Value> HostContentSettingsMap::GetWebsiteSettingInternal( if (value) { if (info) info->source = kProviderNamesSourceMap[provider->first].provider_source; - return value.Pass(); + return value; } } @@ -729,7 +729,7 @@ HostContentSettingsMap::GetContentSettingValueAndPatterns( rule_iterator.get(), primary_url, secondary_url, primary_pattern, secondary_pattern); if (value && include_incognito) - value = CoerceSettingInheritedToIncognito(content_type, value.Pass()); + value = CoerceSettingInheritedToIncognito(content_type, std::move(value)); return value; } diff --git a/components/content_settings/core/browser/website_settings_info.cc b/components/content_settings/core/browser/website_settings_info.cc index d39bf58..0543f072 100644 --- a/components/content_settings/core/browser/website_settings_info.cc +++ b/components/content_settings/core/browser/website_settings_info.cc @@ -4,6 +4,8 @@ #include "components/content_settings/core/browser/website_settings_info.h" +#include <utility> + #include "base/logging.h" #include "base/prefs/pref_registry.h" #include "base/strings/string_util.h" @@ -36,7 +38,7 @@ WebsiteSettingsInfo::WebsiteSettingsInfo( name_(name), pref_name_(GetPrefName(name, kPrefPrefix)), default_value_pref_name_(GetPrefName(name, kDefaultPrefPrefix)), - initial_default_value_(initial_default_value.Pass()), + initial_default_value_(std::move(initial_default_value)), sync_status_(sync_status), lossy_status_(lossy_status), scoping_type_(scoping_type) { diff --git a/components/content_settings/core/browser/website_settings_registry.cc b/components/content_settings/core/browser/website_settings_registry.cc index 9b022e8..fa31cfd 100644 --- a/components/content_settings/core/browser/website_settings_registry.cc +++ b/components/content_settings/core/browser/website_settings_registry.cc @@ -4,6 +4,8 @@ #include "components/content_settings/core/browser/website_settings_registry.h" +#include <utility> + #include "base/logging.h" #include "components/content_settings/core/common/content_settings.h" @@ -57,7 +59,7 @@ const WebsiteSettingsInfo* WebsiteSettingsRegistry::Register( WebsiteSettingsInfo::LossyStatus lossy_status, WebsiteSettingsInfo::ScopingType scoping_type) { WebsiteSettingsInfo* info = - new WebsiteSettingsInfo(type, name, initial_default_value.Pass(), + new WebsiteSettingsInfo(type, name, std::move(initial_default_value), sync_status, lossy_status, scoping_type); website_settings_info_[info->type()] = make_scoped_ptr(info); return info; diff --git a/components/contextual_search/browser/contextual_search_js_api_service_impl.cc b/components/contextual_search/browser/contextual_search_js_api_service_impl.cc index 5aea483..f0e1e09 100644 --- a/components/contextual_search/browser/contextual_search_js_api_service_impl.cc +++ b/components/contextual_search/browser/contextual_search_js_api_service_impl.cc @@ -4,6 +4,8 @@ #include "components/contextual_search/browser/contextual_search_js_api_service_impl.h" +#include <utility> + #include "components/contextual_search/browser/contextual_search_ui_handle.h" namespace contextual_search { @@ -11,7 +13,7 @@ namespace contextual_search { ContextualSearchJsApiServiceImpl::ContextualSearchJsApiServiceImpl( ContextualSearchUIHandle* contextual_search_ui_handle, mojo::InterfaceRequest<ContextualSearchJsApiService> request) - : binding_(this, request.Pass()), + : binding_(this, std::move(request)), contextual_search_ui_handle_(contextual_search_ui_handle) {} ContextualSearchJsApiServiceImpl::~ContextualSearchJsApiServiceImpl() {} @@ -28,7 +30,7 @@ void CreateContextualSearchJsApiService( mojo::InterfaceRequest<ContextualSearchJsApiService> request) { // This is strongly bound and owned by the pipe. new ContextualSearchJsApiServiceImpl(contextual_search_ui_handle, - request.Pass()); + std::move(request)); } } // namespace contextual_search diff --git a/components/contextual_search/renderer/overlay_js_render_frame_observer.cc b/components/contextual_search/renderer/overlay_js_render_frame_observer.cc index 087daad..a0b9fc8 100644 --- a/components/contextual_search/renderer/overlay_js_render_frame_observer.cc +++ b/components/contextual_search/renderer/overlay_js_render_frame_observer.cc @@ -4,6 +4,8 @@ #include "components/contextual_search/renderer/overlay_js_render_frame_observer.h" +#include <utility> + #include "base/bind.h" #include "components/contextual_search/renderer/contextual_search_wrapper.h" #include "components/contextual_search/renderer/overlay_page_notifier_service_impl.h" @@ -34,7 +36,7 @@ void OverlayJsRenderFrameObserver::RegisterMojoService() { void OverlayJsRenderFrameObserver::CreateOverlayPageNotifierService( mojo::InterfaceRequest<OverlayPageNotifierService> request) { // This is strongly bound to and owned by the pipe. - new OverlayPageNotifierServiceImpl(this, request.Pass()); + new OverlayPageNotifierServiceImpl(this, std::move(request)); } void OverlayJsRenderFrameObserver::SetIsContextualSearchOverlay() { diff --git a/components/contextual_search/renderer/overlay_page_notifier_service_impl.cc b/components/contextual_search/renderer/overlay_page_notifier_service_impl.cc index 1acb809..e314c2f 100644 --- a/components/contextual_search/renderer/overlay_page_notifier_service_impl.cc +++ b/components/contextual_search/renderer/overlay_page_notifier_service_impl.cc @@ -4,6 +4,8 @@ #include "components/contextual_search/renderer/overlay_page_notifier_service_impl.h" +#include <utility> + #include "components/contextual_search/renderer/overlay_js_render_frame_observer.h" namespace contextual_search { @@ -11,7 +13,7 @@ namespace contextual_search { OverlayPageNotifierServiceImpl::OverlayPageNotifierServiceImpl( OverlayJsRenderFrameObserver* observer, mojo::InterfaceRequest<OverlayPageNotifierService> request) - : binding_(this, request.Pass()), overlay_js_observer_(observer) {} + : binding_(this, std::move(request)), overlay_js_observer_(observer) {} OverlayPageNotifierServiceImpl::~OverlayPageNotifierServiceImpl() {} diff --git a/components/copresence/copresence_manager_impl.cc b/components/copresence/copresence_manager_impl.cc index e02211c..88664c6 100644 --- a/components/copresence/copresence_manager_impl.cc +++ b/components/copresence/copresence_manager_impl.cc @@ -5,6 +5,7 @@ #include "components/copresence/copresence_manager_impl.h" #include <map> +#include <utility> #include <vector> #include "base/bind.h" @@ -115,8 +116,8 @@ void CopresenceManagerImpl::ExecuteReportRequest( // We'll need to modify the ReportRequest, so we make our own copy to send. scoped_ptr<ReportRequest> request_copy(new ReportRequest(request)); - rpc_handler_->SendReportRequest( - request_copy.Pass(), app_id, auth_token, callback); + rpc_handler_->SendReportRequest(std::move(request_copy), app_id, auth_token, + callback); } diff --git a/components/copresence/handlers/audio/audio_directive_handler_impl.cc b/components/copresence/handlers/audio/audio_directive_handler_impl.cc index dd36e8d..6d4438a 100644 --- a/components/copresence/handlers/audio/audio_directive_handler_impl.cc +++ b/components/copresence/handlers/audio/audio_directive_handler_impl.cc @@ -5,8 +5,8 @@ #include "components/copresence/handlers/audio/audio_directive_handler_impl.h" #include <stddef.h> - #include <algorithm> +#include <utility> #include <vector> #include "base/bind.h" @@ -66,8 +66,8 @@ AudioDirectiveHandlerImpl::AudioDirectiveHandlerImpl( scoped_ptr<base::Timer> timer, const scoped_refptr<TickClockRefCounted>& clock) : update_directives_callback_(update_directives_callback), - audio_modem_(audio_modem.Pass()), - audio_event_timer_(timer.Pass()), + audio_modem_(std::move(audio_modem)), + audio_event_timer_(std::move(timer)), clock_(clock) {} AudioDirectiveHandlerImpl::~AudioDirectiveHandlerImpl() {} diff --git a/components/copresence/handlers/audio/audio_directive_list.cc b/components/copresence/handlers/audio/audio_directive_list.cc index decbc6b..fbe6237 100644 --- a/components/copresence/handlers/audio/audio_directive_list.cc +++ b/components/copresence/handlers/audio/audio_directive_list.cc @@ -62,7 +62,7 @@ scoped_ptr<AudioDirective> AudioDirectiveList::GetActiveDirective() { if (active_directives_.empty() || active_directives_.front().end_time < clock_->NowTicks()) { active_directives_.clear(); - return scoped_ptr<AudioDirective>().Pass(); + return scoped_ptr<AudioDirective>(); } return make_scoped_ptr(new AudioDirective(active_directives_.front())); diff --git a/components/copresence/handlers/audio/tick_clock_ref_counted.cc b/components/copresence/handlers/audio/tick_clock_ref_counted.cc index eb84125..402fa88 100644 --- a/components/copresence/handlers/audio/tick_clock_ref_counted.cc +++ b/components/copresence/handlers/audio/tick_clock_ref_counted.cc @@ -4,12 +4,14 @@ #include "components/copresence/handlers/audio/tick_clock_ref_counted.h" +#include <utility> + #include "base/time/tick_clock.h" namespace copresence { TickClockRefCounted::TickClockRefCounted(scoped_ptr<base::TickClock> clock) - : clock_(clock.Pass()) {} + : clock_(std::move(clock)) {} TickClockRefCounted::TickClockRefCounted(base::TickClock* clock) : clock_(make_scoped_ptr(clock)) {} diff --git a/components/copresence/handlers/directive_handler_impl.cc b/components/copresence/handlers/directive_handler_impl.cc index 854a5c9..9ad01ae 100644 --- a/components/copresence/handlers/directive_handler_impl.cc +++ b/components/copresence/handlers/directive_handler_impl.cc @@ -4,6 +4,8 @@ #include "components/copresence/handlers/directive_handler_impl.h" +#include <utility> + #include "base/bind.h" #include "base/guid.h" #include "base/logging.h" @@ -32,8 +34,7 @@ DirectiveHandlerImpl::DirectiveHandlerImpl( DirectiveHandlerImpl::DirectiveHandlerImpl( scoped_ptr<AudioDirectiveHandler> audio_handler) - : audio_handler_(audio_handler.Pass()), - is_started_(false) {} + : audio_handler_(std::move(audio_handler)), is_started_(false) {} DirectiveHandlerImpl::~DirectiveHandlerImpl() {} diff --git a/components/copresence/rpc/rpc_handler.cc b/components/copresence/rpc/rpc_handler.cc index 5d6f9db..d3ce789 100644 --- a/components/copresence/rpc/rpc_handler.cc +++ b/components/copresence/rpc/rpc_handler.cc @@ -6,18 +6,18 @@ #include <stddef.h> #include <stdint.h> +#include <utility> #include "base/bind.h" #include "base/command_line.h" #include "base/logging.h" #include "base/strings/string_util.h" #include "base/strings/stringprintf.h" -#include "build/build_config.h" - // TODO(ckehoe): time.h includes windows.h, which #defines DeviceCapabilities // to DeviceCapabilitiesW. This breaks the pb.h headers below. For now, // we fix this with an #undef. #include "base/time/time.h" +#include "build/build_config.h" #if defined(OS_WIN) #undef DeviceCapabilities #endif @@ -137,7 +137,7 @@ scoped_ptr<DeviceState> GetDeviceCapabilities(const ReportRequest& request) { audible->add_instruction_type(TRANSMIT); audible->add_instruction_type(RECEIVE); - return state.Pass(); + return state; } // TODO(ckehoe): We're keeping this code in a separate function for now @@ -244,7 +244,7 @@ void RpcHandler::SendReportRequest(scoped_ptr<ReportRequest> request, // We're not registered, or registration is in progress. if (queue_request) { pending_requests_queue_.push_back(new PendingRequest( - request.Pass(), app_id, authenticated, status_callback)); + std::move(request), app_id, authenticated, status_callback)); return; } @@ -282,7 +282,7 @@ void RpcHandler::ReportTokens(const std::vector<AudioToken>& tokens) { AddTokenToRequest(token, request.get()); } - ReportOnAllDevices(request.Pass()); + ReportOnAllDevices(std::move(request)); } @@ -292,7 +292,7 @@ RpcHandler::PendingRequest::PendingRequest(scoped_ptr<ReportRequest> report, const std::string& app_id, bool authenticated, const StatusCallback& callback) - : report(report.Pass()), + : report(std::move(report)), app_id(app_id), authenticated(authenticated), callback(callback) {} @@ -364,8 +364,7 @@ void RpcHandler::ProcessQueuedRequests(const bool authenticated) { } else { if (request->authenticated) DCHECK(!auth_token_.empty()); - SendReportRequest(request->report.Pass(), - request->app_id, + SendReportRequest(std::move(request->report), request->app_id, request->authenticated ? auth_token_ : std::string(), request->callback); } @@ -379,7 +378,7 @@ void RpcHandler::ProcessQueuedRequests(const bool authenticated) { // Only keep the requests that weren't processed. // All the pointers in the queue are now spoken for. pending_requests_queue_.weak_clear(); - pending_requests_queue_ = still_pending_requests.Pass(); + pending_requests_queue_ = std::move(still_pending_requests); } void RpcHandler::ReportOnAllDevices(scoped_ptr<ReportRequest> request) { diff --git a/components/copresence/rpc/rpc_handler_unittest.cc b/components/copresence/rpc/rpc_handler_unittest.cc index dabb4a2..c515ffa 100644 --- a/components/copresence/rpc/rpc_handler_unittest.cc +++ b/components/copresence/rpc/rpc_handler_unittest.cc @@ -6,6 +6,7 @@ #include <map> #include <string> +#include <utility> #include <vector> #include "base/bind.h" @@ -123,8 +124,8 @@ class RpcHandlerTest : public testing::Test, public CopresenceDelegate { void SendReport(scoped_ptr<ReportRequest> request, const std::string& app_id, const std::string& auth_token) { - rpc_handler_.SendReportRequest( - request.Pass(), app_id, auth_token, StatusCallback()); + rpc_handler_.SendReportRequest(std::move(request), app_id, auth_token, + StatusCallback()); } void SendReportResponse(int status_code, @@ -320,7 +321,7 @@ TEST_F(RpcHandlerTest, ReportResponseHandler) { // Fail on HTTP status != 200. scoped_ptr<ReportResponse> response(new ReportResponse); status_ = SUCCESS; - SendReportResponse(net::HTTP_BAD_REQUEST, response.Pass()); + SendReportResponse(net::HTTP_BAD_REQUEST, std::move(response)); EXPECT_EQ(FAIL, status_); // Construct a test ReportResponse. @@ -337,7 +338,7 @@ TEST_F(RpcHandlerTest, ReportResponseHandler) { // Check processing. status_ = FAIL; - SendReportResponse(net::HTTP_OK, response.Pass()); + SendReportResponse(net::HTTP_OK, std::move(response)); EXPECT_EQ(SUCCESS, status_); EXPECT_TRUE(TokenIsInvalid("bad token")); EXPECT_THAT(directive_handler_.added_directives(), diff --git a/components/copresence/timed_map.h b/components/copresence/timed_map.h index 2fdf870..18685b1 100644 --- a/components/copresence/timed_map.h +++ b/components/copresence/timed_map.h @@ -67,7 +67,7 @@ class TimedMap { } void set_clock_for_testing(scoped_ptr<base::TickClock> clock) { - clock_ = clock.Pass(); + clock_ = std::move(clock); } private: diff --git a/components/data_reduction_proxy/content/browser/content_lofi_decider_unittest.cc b/components/data_reduction_proxy/content/browser/content_lofi_decider_unittest.cc index 35daf59..ff42dec 100644 --- a/components/data_reduction_proxy/content/browser/content_lofi_decider_unittest.cc +++ b/components/data_reduction_proxy/content/browser/content_lofi_decider_unittest.cc @@ -5,8 +5,8 @@ #include "components/data_reduction_proxy/content/browser/content_lofi_decider.h" #include <stddef.h> - #include <string> +#include <utility> #include "base/command_line.h" #include "base/macros.h" @@ -91,7 +91,7 @@ class ContentLoFiDeciderTest : public testing::Test { data_reduction_proxy_lofi_decider( new data_reduction_proxy::ContentLoFiDecider()); test_context_->io_data()->set_lofi_decider( - data_reduction_proxy_lofi_decider.Pass()); + std::move(data_reduction_proxy_lofi_decider)); } scoped_ptr<net::URLRequest> CreateRequest(bool is_using_lofi) { @@ -106,7 +106,7 @@ class ContentLoFiDeciderTest : public testing::Test { false, // is_async is_using_lofi); - return request.Pass(); + return request; } void NotifyBeforeSendProxyHeaders(net::HttpRequestHeaders* headers, diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_bypass_protocol_unittest.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_bypass_protocol_unittest.cc index c57a0b4..7d378f7 100644 --- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_bypass_protocol_unittest.cc +++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_bypass_protocol_unittest.cc @@ -77,7 +77,7 @@ class DataReductionProxyProtocolTest : public testing::Test { DataReductionProxyProtocolTest() : http_user_agent_settings_("", "") { simple_interceptor_.reset(new SimpleURLRequestInterceptor()); net::URLRequestFilter::GetInstance()->AddHostnameInterceptor( - "http", "www.google.com", simple_interceptor_.Pass()); + "http", "www.google.com", std::move(simple_interceptor_)); } ~DataReductionProxyProtocolTest() override { @@ -99,7 +99,7 @@ class DataReductionProxyProtocolTest : public testing::Test { // Create a context with delayed initialization. context_.reset(new TestURLRequestContext(true)); - proxy_service_ = proxy_service.Pass(); + proxy_service_ = std::move(proxy_service); context_->set_client_socket_factory(&mock_socket_factory_); context_->set_proxy_service(proxy_service_.get()); network_delegate_.reset(new net::TestNetworkDelegate()); @@ -118,7 +118,7 @@ class DataReductionProxyProtocolTest : public testing::Test { scoped_ptr<net::URLRequestJobFactoryImpl> job_factory_impl( new net::URLRequestJobFactoryImpl()); job_factory_.reset(new net::URLRequestInterceptingJobFactory( - job_factory_impl.Pass(), make_scoped_ptr(interceptor))); + std::move(job_factory_impl), make_scoped_ptr(interceptor))); context_->set_job_factory(job_factory_.get()); context_->Init(); diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_bypass_stats_unittest.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_bypass_stats_unittest.cc index a72da2c..100756e 100644 --- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_bypass_stats_unittest.cc +++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_bypass_stats_unittest.cc @@ -96,7 +96,7 @@ class DataReductionProxyBypassStatsTest : public testing::Test { test_context_->RunUntilIdle(); EXPECT_TRUE(fake_request->response_headers() != NULL); - return fake_request.Pass(); + return fake_request; } bool IsUnreachable() const { diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_compression_stats.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_compression_stats.cc index ba5ac6f..38662322 100644 --- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_compression_stats.cc +++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_compression_stats.cc @@ -5,6 +5,7 @@ #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_compression_stats.h" #include <string> +#include <utility> #include <vector> #include "base/bind.h" @@ -495,7 +496,7 @@ void DataReductionProxyCompressionStats::InitInt64Pref(const char* pref) { void DataReductionProxyCompressionStats::InitListPref(const char* pref) { scoped_ptr<base::ListValue> pref_value = scoped_ptr<base::ListValue>( pref_service_->GetList(pref)->DeepCopy()); - list_pref_map_.add(pref, pref_value.Pass()); + list_pref_map_.add(pref, std::move(pref_value)); } int64_t DataReductionProxyCompressionStats::GetInt64(const char* pref_path) { @@ -1160,7 +1161,7 @@ void DataReductionProxyCompressionStats::PersistDataUsage() { PerSiteDataUsage* per_site_usage = connection_usage->add_site_usage(); per_site_usage->CopyFrom(*(i->second)); } - service_->StoreCurrentDataUsageBucket(data_usage_bucket.Pass()); + service_->StoreCurrentDataUsageBucket(std::move(data_usage_bucket)); } data_usage_map_is_dirty_ = false; @@ -1206,7 +1207,7 @@ void DataReductionProxyCompressionStats::GetHistoricalDataUsageImpl( // Force the last bucket to be for the current interval. scoped_ptr<DataUsageBucket> data_usage_bucket(new DataUsageBucket()); data_usage_bucket->set_last_updated_timestamp(now.ToInternalValue()); - service_->StoreCurrentDataUsageBucket(data_usage_bucket.Pass()); + service_->StoreCurrentDataUsageBucket(std::move(data_usage_bucket)); } service_->LoadHistoricalDataUsage(get_data_usage_callback); diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_compression_stats_unittest.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_compression_stats_unittest.cc index c098ad4..30ea6d1 100644 --- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_compression_stats_unittest.cc +++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_compression_stats_unittest.cc @@ -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 "components/data_reduction_proxy/core/browser/data_reduction_proxy_compression_stats.h" + #include <stddef.h> #include <stdint.h> - #include <string> +#include <utility> #include "base/command_line.h" #include "base/memory/ref_counted.h" @@ -18,7 +20,6 @@ #include "base/test/histogram_tester.h" #include "base/time/time.h" #include "base/values.h" -#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_compression_stats.h" #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_prefs.h" #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_test_utils.h" #include "components/data_reduction_proxy/core/common/data_reduction_proxy_pref_names.h" @@ -47,7 +48,7 @@ class DataUsageLoadVerifier { public: DataUsageLoadVerifier( scoped_ptr<std::vector<data_reduction_proxy::DataUsageBucket>> expected) { - expected_ = expected.Pass(); + expected_ = std::move(expected); } void OnLoadDataUsage( @@ -1084,7 +1085,7 @@ TEST_F(DataReductionProxyCompressionStatsTest, RecordDataUsageSingleSite) { site_usage->set_data_used(1000); site_usage->set_original_size(1250); - DataUsageLoadVerifier verifier(expected_data_usage.Pass()); + DataUsageLoadVerifier verifier(std::move(expected_data_usage)); GetHistoricalDataUsage(base::Bind(&DataUsageLoadVerifier::OnLoadDataUsage, base::Unretained(&verifier)), @@ -1106,14 +1107,14 @@ TEST_F(DataReductionProxyCompressionStatsTest, DisableDataUsageRecording) { auto expected_data_usage1 = make_scoped_ptr(new std::vector<data_reduction_proxy::DataUsageBucket>( kNumExpectedBuckets)); - DataUsageLoadVerifier verifier1(expected_data_usage1.Pass()); + DataUsageLoadVerifier verifier1(std::move(expected_data_usage1)); LoadHistoricalDataUsage(base::Bind(&DataUsageLoadVerifier::OnLoadDataUsage, base::Unretained(&verifier1))); // Public API must return an empty array. auto expected_data_usage2 = make_scoped_ptr(new std::vector<data_reduction_proxy::DataUsageBucket>()); - DataUsageLoadVerifier verifier2(expected_data_usage2.Pass()); + DataUsageLoadVerifier verifier2(std::move(expected_data_usage2)); GetHistoricalDataUsage(base::Bind(&DataUsageLoadVerifier::OnLoadDataUsage, base::Unretained(&verifier2)), now); @@ -1150,7 +1151,7 @@ TEST_F(DataReductionProxyCompressionStatsTest, RecordDataUsageMultipleSites) { site_usage->set_data_used(1002); site_usage->set_original_size(1252); - DataUsageLoadVerifier verifier(expected_data_usage.Pass()); + DataUsageLoadVerifier verifier(std::move(expected_data_usage)); GetHistoricalDataUsage(base::Bind(&DataUsageLoadVerifier::OnLoadDataUsage, base::Unretained(&verifier)), @@ -1188,7 +1189,7 @@ TEST_F(DataReductionProxyCompressionStatsTest, site_usage->set_data_used(1001); site_usage->set_original_size(1251); - DataUsageLoadVerifier verifier(expected_data_usage.Pass()); + DataUsageLoadVerifier verifier(std::move(expected_data_usage)); GetHistoricalDataUsage(base::Bind(&DataUsageLoadVerifier::OnLoadDataUsage, base::Unretained(&verifier)), @@ -1219,7 +1220,7 @@ TEST_F(DataReductionProxyCompressionStatsTest, site_usage->set_data_used(1000); site_usage->set_original_size(1250); - DataUsageLoadVerifier verifier(expected_data_usage.Pass()); + DataUsageLoadVerifier verifier(std::move(expected_data_usage)); GetHistoricalDataUsage(base::Bind(&DataUsageLoadVerifier::OnLoadDataUsage, base::Unretained(&verifier)), @@ -1244,7 +1245,7 @@ TEST_F(DataReductionProxyCompressionStatsTest, DeleteHistoricalDataUsage) { auto expected_data_usage = make_scoped_ptr(new std::vector<data_reduction_proxy::DataUsageBucket>( kNumExpectedBuckets)); - DataUsageLoadVerifier verifier(expected_data_usage.Pass()); + DataUsageLoadVerifier verifier(std::move(expected_data_usage)); GetHistoricalDataUsage(base::Bind(&DataUsageLoadVerifier::OnLoadDataUsage, base::Unretained(&verifier)), @@ -1281,7 +1282,7 @@ TEST_F(DataReductionProxyCompressionStatsTest, DeleteBrowsingHistory) { site_usage->set_hostname("www.bar.com"); site_usage->set_data_used(900); site_usage->set_original_size(1100); - DataUsageLoadVerifier verifier1(expected_data_usage.Pass()); + DataUsageLoadVerifier verifier1(std::move(expected_data_usage)); LoadHistoricalDataUsage(base::Bind(&DataUsageLoadVerifier::OnLoadDataUsage, base::Unretained(&verifier1))); @@ -1294,7 +1295,7 @@ TEST_F(DataReductionProxyCompressionStatsTest, DeleteBrowsingHistory) { expected_data_usage = make_scoped_ptr(new std::vector<data_reduction_proxy::DataUsageBucket>( kNumExpectedBuckets)); - DataUsageLoadVerifier verifier2(expected_data_usage.Pass()); + DataUsageLoadVerifier verifier2(std::move(expected_data_usage)); LoadHistoricalDataUsage(base::Bind(&DataUsageLoadVerifier::OnLoadDataUsage, base::Unretained(&verifier2))); base::RunLoop().RunUntilIdle(); diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_config.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_config.cc index d5b1e29..4661367 100644 --- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_config.cc +++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_config.cc @@ -5,7 +5,7 @@ #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_config.h" #include <stddef.h> - +#include <utility> #include <vector> #include "base/bind.h" @@ -234,7 +234,7 @@ DataReductionProxyConfig::DataReductionProxyConfig( : secure_proxy_allowed_(params::ShouldUseSecureProxyByDefault()), unreachable_(false), enabled_by_user_(false), - config_values_(config_values.Pass()), + config_values_(std::move(config_values)), net_log_(net_log), configurator_(configurator), event_creator_(event_creator), diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_config_service_client.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_config_service_client.cc index fb8560c..f65c0af 100644 --- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_config_service_client.cc +++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_config_service_client.cc @@ -5,6 +5,7 @@ #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_config_service_client.h" #include <string> +#include <utility> #include <vector> #include "base/base64.h" @@ -121,7 +122,7 @@ DataReductionProxyConfigServiceClient::DataReductionProxyConfigServiceClient( DataReductionProxyEventCreator* event_creator, net::NetLog* net_log, ConfigStorer config_storer) - : params_(params.Pass()), + : params_(std::move(params)), request_options_(request_options), config_values_(config_values), config_(config), @@ -292,7 +293,7 @@ void DataReductionProxyConfigServiceClient::RetrieveRemoteConfig() { return; } - fetcher_ = fetcher.Pass(); + fetcher_ = std::move(fetcher); fetcher_->Start(); } @@ -320,7 +321,7 @@ DataReductionProxyConfigServiceClient::GetURLFetcherForConfig( static const int kMaxRetries = 5; fetcher->SetMaxRetriesOn5xx(kMaxRetries); fetcher->SetAutomaticallyRetryOnNetworkChanges(kMaxRetries); - return fetcher.Pass(); + return fetcher; } void DataReductionProxyConfigServiceClient::HandleResponse( diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_config_test_utils.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_config_test_utils.cc index a30553a..548f773 100644 --- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_config_test_utils.cc +++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_config_test_utils.cc @@ -5,6 +5,7 @@ #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_config_test_utils.h" #include <stddef.h> +#include <utility> #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_mutable_config_values.h" #include "components/data_reduction_proxy/core/common/data_reduction_proxy_params_test_utils.h" @@ -29,12 +30,10 @@ TestDataReductionProxyConfig::TestDataReductionProxyConfig( DataReductionProxyEventCreator* event_creator) : TestDataReductionProxyConfig( make_scoped_ptr(new TestDataReductionProxyParams(params_flags, - params_definitions)) - .Pass(), + params_definitions)), net_log, configurator, - event_creator) { -} + event_creator) {} TestDataReductionProxyConfig::TestDataReductionProxyConfig( scoped_ptr<DataReductionProxyConfigValues> config_values, @@ -42,7 +41,7 @@ TestDataReductionProxyConfig::TestDataReductionProxyConfig( DataReductionProxyConfigurator* configurator, DataReductionProxyEventCreator* event_creator) : DataReductionProxyConfig(net_log, - config_values.Pass(), + std::move(config_values), configurator, event_creator), network_quality_prohibitively_slow_(false) { @@ -69,15 +68,11 @@ void TestDataReductionProxyConfig::EnableQuic(bool enable) { } void TestDataReductionProxyConfig::ResetParamFlagsForTest(int flags) { - config_values_ = - make_scoped_ptr( - new TestDataReductionProxyParams( - flags, - TestDataReductionProxyParams::HAS_EVERYTHING & - ~TestDataReductionProxyParams::HAS_SSL_ORIGIN & - ~TestDataReductionProxyParams::HAS_DEV_ORIGIN & - ~TestDataReductionProxyParams::HAS_DEV_FALLBACK_ORIGIN)) - .Pass(); + config_values_ = make_scoped_ptr(new TestDataReductionProxyParams( + flags, TestDataReductionProxyParams::HAS_EVERYTHING & + ~TestDataReductionProxyParams::HAS_SSL_ORIGIN & + ~TestDataReductionProxyParams::HAS_DEV_ORIGIN & + ~TestDataReductionProxyParams::HAS_DEV_FALLBACK_ORIGIN)); } TestDataReductionProxyParams* TestDataReductionProxyConfig::test_params() { @@ -109,11 +104,10 @@ MockDataReductionProxyConfig::MockDataReductionProxyConfig( net::NetLog* net_log, DataReductionProxyConfigurator* configurator, DataReductionProxyEventCreator* event_creator) - : TestDataReductionProxyConfig(config_values.Pass(), + : TestDataReductionProxyConfig(std::move(config_values), net_log, configurator, - event_creator) { -} + event_creator) {} MockDataReductionProxyConfig::~MockDataReductionProxyConfig() { } diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_config_unittest.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_config_unittest.cc index d11ba29..ea4d8c8 100644 --- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_config_unittest.cc +++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_config_unittest.cc @@ -6,8 +6,8 @@ #include <stddef.h> #include <stdint.h> - #include <map> +#include <utility> #include <vector> #include "base/command_line.h" @@ -130,8 +130,8 @@ class DataReductionProxyConfigTest : public testing::Test { scoped_ptr<DataReductionProxyParams> params) { params->EnableQuic(false); return make_scoped_ptr(new DataReductionProxyConfig( - test_context_->net_log(), params.Pass(), test_context_->configurator(), - test_context_->event_creator())); + test_context_->net_log(), std::move(params), + test_context_->configurator(), test_context_->event_creator())); } MockDataReductionProxyConfig* config() { @@ -475,7 +475,8 @@ TEST_F(DataReductionProxyConfigTest, AreProxiesBypassed) { ~TestDataReductionProxyParams::HAS_DEV_FALLBACK_ORIGIN; scoped_ptr<TestDataReductionProxyParams> params( new TestDataReductionProxyParams(flags, has_definitions)); - scoped_ptr<DataReductionProxyConfig> config = BuildConfig(params.Pass()); + scoped_ptr<DataReductionProxyConfig> config = + BuildConfig(std::move(params)); net::ProxyRetryInfoMap retry_map; net::ProxyRetryInfo retry_info; @@ -523,7 +524,7 @@ TEST_F(DataReductionProxyConfigTest, AreProxiesBypassedRetryDelay) { ~TestDataReductionProxyParams::HAS_DEV_FALLBACK_ORIGIN; scoped_ptr<TestDataReductionProxyParams> params( new TestDataReductionProxyParams(flags, has_definitions)); - scoped_ptr<DataReductionProxyConfig> config = BuildConfig(params.Pass()); + scoped_ptr<DataReductionProxyConfig> config = BuildConfig(std::move(params)); net::ProxyRetryInfoMap retry_map; net::ProxyRetryInfo retry_info; @@ -669,7 +670,7 @@ TEST_F(DataReductionProxyConfigTest, IsDataReductionProxyWithParams) { new TestDataReductionProxyParams(flags, has_definitions)); DataReductionProxyTypeInfo proxy_type_info; scoped_ptr<DataReductionProxyConfig> config(new DataReductionProxyConfig( - net_log(), params.Pass(), configurator(), event_creator())); + net_log(), std::move(params), configurator(), event_creator())); EXPECT_EQ( tests[i].expected_result, config->IsDataReductionProxy(tests[i].host_port_pair, &proxy_type_info)) @@ -766,7 +767,7 @@ TEST_F(DataReductionProxyConfigTest, IsDataReductionProxyWithMutableConfig) { DataReductionProxyMutableConfigValues::CreateFromParams(params()); config_values->UpdateValues(proxies_for_http); scoped_ptr<DataReductionProxyConfig> config(new DataReductionProxyConfig( - net_log(), config_values.Pass(), configurator(), event_creator())); + net_log(), std::move(config_values), configurator(), event_creator())); for (size_t i = 0; i < arraysize(tests); ++i) { DataReductionProxyTypeInfo proxy_type_info; EXPECT_EQ(tests[i].expected_result, diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_experiments_stats.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_experiments_stats.cc index 9abb177..099f088 100644 --- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_experiments_stats.cc +++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_experiments_stats.cc @@ -4,6 +4,8 @@ #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_experiments_stats.h" +#include <utility> + #include "base/logging.h" #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_config_retrieval_params.h" #include "components/data_reduction_proxy/core/common/data_reduction_proxy_pref_names.h" @@ -23,7 +25,7 @@ DataReductionProxyExperimentsStats::~DataReductionProxyExperimentsStats() { void DataReductionProxyExperimentsStats::InitializeOnUIThread(scoped_ptr< DataReductionProxyConfigRetrievalParams> config_retrieval_params) { DCHECK(!initialized_); - config_retrieval_params_ = config_retrieval_params.Pass(); + config_retrieval_params_ = std::move(config_retrieval_params); // This method may be called from the UI thread, but should be checked on the // IO thread. diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_experiments_stats_unittest.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_experiments_stats_unittest.cc index b4515a1..3270be9 100644 --- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_experiments_stats_unittest.cc +++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_experiments_stats_unittest.cc @@ -5,8 +5,8 @@ #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_experiments_stats.h" #include <stdint.h> - #include <map> +#include <utility> #include "base/metrics/field_trial.h" #include "base/prefs/pref_service.h" @@ -127,7 +127,7 @@ TEST_F(DataReductionProxyExperimentsStatsTest, CheckConfigHistograms) { new DataReductionProxyExperimentsStats( base::Bind(&DataReductionProxyExperimentsStatsTest::SetPrefValue, base::Unretained(this)))); - experiments_stats->InitializeOnUIThread(config_params.Pass()); + experiments_stats->InitializeOnUIThread(std::move(config_params)); for (const auto& test_case : test_cases) { base::HistogramTester histogram_tester; experiments_stats->RecordBytes( diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_interceptor_unittest.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_interceptor_unittest.cc index b4b0552..1dd1475 100644 --- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_interceptor_unittest.cc +++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_interceptor_unittest.cc @@ -5,6 +5,7 @@ #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_interceptor.h" #include <string> +#include <utility> #include <vector> #include "base/files/file_path.h" @@ -126,7 +127,7 @@ class DataReductionProxyInterceptorTest : public testing::Test { } void Init(scoped_ptr<net::URLRequestJobFactory> factory) { - job_factory_ = factory.Pass(); + job_factory_ = std::move(factory); default_context_->set_job_factory(job_factory_.get()); default_context_->Init(); } @@ -146,16 +147,16 @@ TEST_F(DataReductionProxyInterceptorTest, TestJobFactoryChaining) { CountingURLRequestInterceptor* interceptor2 = new CountingURLRequestInterceptor(); scoped_ptr<net::URLRequestJobFactory> factory2( - new net::URLRequestInterceptingJobFactory( - impl.Pass(), make_scoped_ptr(interceptor2))); + new net::URLRequestInterceptingJobFactory(std::move(impl), + make_scoped_ptr(interceptor2))); CountingURLRequestInterceptor* interceptor1 = new CountingURLRequestInterceptor(); scoped_ptr<net::URLRequestJobFactory> factory1( - new net::URLRequestInterceptingJobFactory( - factory2.Pass(), make_scoped_ptr(interceptor1))); + new net::URLRequestInterceptingJobFactory(std::move(factory2), + make_scoped_ptr(interceptor1))); - Init(factory1.Pass()); + Init(std::move(factory1)); net::TestDelegate d; scoped_ptr<net::URLRequest> req(default_context_->CreateRequest( @@ -218,7 +219,7 @@ class DataReductionProxyInterceptorWithServerTest : public testing::Test { scoped_ptr<net::URLRequestJobFactoryImpl> job_factory_impl( new net::URLRequestJobFactoryImpl()); job_factory_.reset(new net::URLRequestInterceptingJobFactory( - job_factory_impl.Pass(), + std::move(job_factory_impl), test_context_->io_data()->CreateInterceptor())); context_.set_job_factory(job_factory_.get()); context_.Init(); @@ -304,7 +305,7 @@ class DataReductionProxyInterceptorEndToEndTest : public testing::Test { context_.CreateRequest(url, net::IDLE, &delegate_)); request->Start(); drp_test_context_->RunUntilIdle(); - return request.Pass(); + return request; } const net::TestDelegate& delegate() const { diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_io_data.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_io_data.cc index e648c2e..31879ec 100644 --- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_io_data.cc +++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_io_data.cc @@ -4,6 +4,8 @@ #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_io_data.h" +#include <utility> + #include "base/bind.h" #include "base/macros.h" #include "base/memory/weak_ptr.h" @@ -72,7 +74,7 @@ BasicHTTPURLRequestContextGetter::GetURLRequestContext() { net::URLRequestContextBuilder builder; builder.set_proxy_service(net::ProxyService::CreateDirect()); builder.SetSpdyAndQuicEnabled(false, false); - url_request_context_ = builder.Build().Pass(); + url_request_context_ = builder.Build(); } return url_request_context_.get(); @@ -119,12 +121,12 @@ DataReductionProxyIOData::DataReductionProxyIOData( scoped_ptr<DataReductionProxyMutableConfigValues> mutable_config = DataReductionProxyMutableConfigValues::CreateFromParams(params.get()); raw_mutable_config = mutable_config.get(); - config_.reset(new DataReductionProxyConfig(net_log, mutable_config.Pass(), - configurator_.get(), - event_creator_.get())); + config_.reset(new DataReductionProxyConfig( + net_log, std::move(mutable_config), configurator_.get(), + event_creator_.get())); } else { config_.reset(new DataReductionProxyConfig( - net_log, params.Pass(), configurator_.get(), event_creator_.get())); + net_log, std::move(params), configurator_.get(), event_creator_.get())); } // It is safe to use base::Unretained here, since it gets executed @@ -141,7 +143,7 @@ DataReductionProxyIOData::DataReductionProxyIOData( // synchronously on the IO thread, and |this| outlives the caller (since the // caller is owned by |this|. config_client_.reset(new DataReductionProxyConfigServiceClient( - params.Pass(), GetBackoffPolicy(), request_options_.get(), + std::move(params), GetBackoffPolicy(), request_options_.get(), raw_mutable_config, config_.get(), event_creator_.get(), net_log_, base::Bind(&DataReductionProxyIOData::StoreSerializedConfig, base::Unretained(this)))); @@ -224,12 +226,12 @@ DataReductionProxyIOData::CreateNetworkDelegate( DCHECK(io_task_runner_->BelongsToCurrentThread()); scoped_ptr<DataReductionProxyNetworkDelegate> network_delegate( new DataReductionProxyNetworkDelegate( - wrapped_network_delegate.Pass(), config_.get(), + std::move(wrapped_network_delegate), config_.get(), request_options_.get(), configurator_.get(), experiments_stats_.get(), net_log_, event_creator_.get())); if (track_proxy_bypass_statistics) network_delegate->InitIODataAndUMA(this, bypass_stats_.get()); - return network_delegate.Pass(); + return network_delegate; } // TODO(kundaji): Rename this method to something more descriptive. diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_io_data.h b/components/data_reduction_proxy/core/browser/data_reduction_proxy_io_data.h index 75213a3..2d96ea2 100644 --- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_io_data.h +++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_io_data.h @@ -6,8 +6,8 @@ #define COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_DATA_REDUCTION_PROXY_IO_DATA_H_ #include <stdint.h> - #include <string> +#include <utility> #include "base/gtest_prod_util.h" #include "base/macros.h" @@ -167,13 +167,13 @@ class DataReductionProxyIOData : public DataReductionProxyEventStorageDelegate { void set_debug_ui_service( scoped_ptr<DataReductionProxyDebugUIService> ui_service) const { - debug_ui_service_= ui_service.Pass(); + debug_ui_service_ = std::move(ui_service); } LoFiDecider* lofi_decider() const { return lofi_decider_.get(); } void set_lofi_decider(scoped_ptr<LoFiDecider> lofi_decider) const { - lofi_decider_ = lofi_decider.Pass(); + lofi_decider_ = std::move(lofi_decider); } private: diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_mutable_config_values.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_mutable_config_values.cc index 3699d4e..835f672 100644 --- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_mutable_config_values.cc +++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_mutable_config_values.cc @@ -20,7 +20,7 @@ DataReductionProxyMutableConfigValues::CreateFromParams( config_values->allowed_ = params->allowed(); config_values->fallback_allowed_ = params->fallback_allowed(); config_values->secure_proxy_check_url_ = params->secure_proxy_check_url(); - return config_values.Pass(); + return config_values; } DataReductionProxyMutableConfigValues::DataReductionProxyMutableConfigValues() diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_network_delegate.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_network_delegate.cc index b564fa9..f998339 100644 --- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_network_delegate.cc +++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_network_delegate.cc @@ -4,6 +4,8 @@ #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_network_delegate.h" +#include <utility> + #include "base/bind.h" #include "base/bind_helpers.h" #include "base/metrics/histogram_macros.h" @@ -101,7 +103,7 @@ DataReductionProxyNetworkDelegate::DataReductionProxyNetworkDelegate( DataReductionProxyExperimentsStats* experiments_stats, net::NetLog* net_log, DataReductionProxyEventCreator* event_creator) - : LayeredNetworkDelegate(network_delegate.Pass()), + : LayeredNetworkDelegate(std::move(network_delegate)), total_received_bytes_(0), total_original_received_bytes_(0), data_reduction_proxy_config_(config), diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_network_delegate_unittest.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_network_delegate_unittest.cc index e07efe7..440053c9 100644 --- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_network_delegate_unittest.cc +++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_network_delegate_unittest.cc @@ -6,8 +6,8 @@ #include <stddef.h> #include <stdint.h> - #include <string> +#include <utility> #include "base/command_line.h" #include "base/macros.h" @@ -141,7 +141,7 @@ class DataReductionProxyNetworkDelegateTest : public testing::Test { scoped_ptr<TestLoFiDecider> lofi_decider(new TestLoFiDecider()); lofi_decider_ = lofi_decider.get(); - io_data()->set_lofi_decider(lofi_decider.Pass()); + io_data()->set_lofi_decider(std::move(lofi_decider)); } const net::ProxyConfig& GetProxyConfig() const { return config_; } @@ -206,7 +206,7 @@ class DataReductionProxyNetworkDelegateTest : public testing::Test { if (!response_headers.empty()) EXPECT_TRUE(request->response_headers() != NULL); - return request.Pass(); + return request; } void set_network_delegate(net::NetworkDelegate* delegate) { diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_service.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_service.cc index 768c1af..e7174f8 100644 --- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_service.cc +++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_service.cc @@ -4,6 +4,8 @@ #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_service.h" +#include <utility> + #include "base/bind.h" #include "base/files/file_path.h" #include "base/location.h" @@ -35,7 +37,7 @@ DataReductionProxyService::DataReductionProxyService( : url_request_context_getter_(request_context_getter), settings_(settings), prefs_(prefs), - db_data_owner_(new DBDataOwner(store.Pass())), + db_data_owner_(new DBDataOwner(std::move(store))), io_task_runner_(io_task_runner), db_task_runner_(db_task_runner), initialized_(false), @@ -113,27 +115,27 @@ void DataReductionProxyService::UpdateContentLengths( void DataReductionProxyService::AddEvent(scoped_ptr<base::Value> event) { DCHECK(CalledOnValidThread()); - event_store_->AddEvent(event.Pass()); + event_store_->AddEvent(std::move(event)); } void DataReductionProxyService::AddEnabledEvent(scoped_ptr<base::Value> event, bool enabled) { DCHECK(CalledOnValidThread()); - event_store_->AddEnabledEvent(event.Pass(), enabled); + event_store_->AddEnabledEvent(std::move(event), enabled); } void DataReductionProxyService::AddEventAndSecureProxyCheckState( scoped_ptr<base::Value> event, SecureProxyCheckState state) { DCHECK(CalledOnValidThread()); - event_store_->AddEventAndSecureProxyCheckState(event.Pass(), state); + event_store_->AddEventAndSecureProxyCheckState(std::move(event), state); } void DataReductionProxyService::AddAndSetLastBypassEvent( scoped_ptr<base::Value> event, int64_t expiration_ticks) { DCHECK(CalledOnValidThread()); - event_store_->AddAndSetLastBypassEvent(event.Pass(), expiration_ticks); + event_store_->AddAndSetLastBypassEvent(std::move(event), expiration_ticks); } void DataReductionProxyService::SetUnreachable(bool unreachable) { diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_settings.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_settings.cc index 9eddf3c..9c5e4b4 100644 --- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_settings.cc +++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_settings.cc @@ -4,6 +4,8 @@ #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_settings.h" +#include <utility> + #include "base/bind.h" #include "base/command_line.h" #include "base/metrics/histogram_macros.h" @@ -90,7 +92,7 @@ void DataReductionProxySettings::InitDataReductionProxySettings( data_reduction_proxy_enabled_pref_name; prefs_ = prefs; config_ = io_data->config(); - data_reduction_proxy_service_ = data_reduction_proxy_service.Pass(); + data_reduction_proxy_service_ = std::move(data_reduction_proxy_service); data_reduction_proxy_service_->AddObserver(this); InitPrefMembers(); UpdateConfigValues(); diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_test_utils.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_test_utils.cc index 7598236..8e187a6 100644 --- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_test_utils.cc +++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_test_utils.cc @@ -5,6 +5,7 @@ #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_test_utils.h" #include <map> +#include <utility> #include "base/macros.h" #include "base/prefs/pref_registry_simple.h" @@ -102,7 +103,7 @@ TestDataReductionProxyConfigServiceClient:: DataReductionProxyEventCreator* event_creator, net::NetLog* net_log, ConfigStorer config_storer) - : DataReductionProxyConfigServiceClient(params.Pass(), + : DataReductionProxyConfigServiceClient(std::move(params), kTestBackoffPolicy, request_options, config_values, @@ -111,8 +112,7 @@ TestDataReductionProxyConfigServiceClient:: net_log, config_storer), tick_clock_(base::Time::UnixEpoch()), - test_backoff_entry_(&kTestBackoffPolicy, &tick_clock_) { -} + test_backoff_entry_(&kTestBackoffPolicy, &tick_clock_) {} TestDataReductionProxyConfigServiceClient:: ~TestDataReductionProxyConfigServiceClient() { @@ -199,12 +199,12 @@ TestDataReductionProxyIOData::TestDataReductionProxyIOData( : DataReductionProxyIOData(), service_set_(false) { io_task_runner_ = task_runner; ui_task_runner_ = task_runner; - config_ = config.Pass(); - event_creator_ = event_creator.Pass(); - request_options_ = request_options.Pass(); - configurator_ = configurator.Pass(); - config_client_ = config_client.Pass(); - experiments_stats_ = experiments_stats.Pass(); + config_ = std::move(config); + event_creator_ = std::move(event_creator); + request_options_ = std::move(request_options); + configurator_ = std::move(configurator); + config_client_ = std::move(config_client); + experiments_stats_ = std::move(experiments_stats); net_log_ = net_log; bypass_stats_.reset(new DataReductionProxyBypassStats( config_.get(), base::Bind(&DataReductionProxyIOData::SetUnreachable, @@ -373,7 +373,7 @@ DataReductionProxyTestContext::Builder::Build() { test_request_context->set_client_socket_factory(mock_socket_factory_); test_request_context->Init(); request_context_getter = new net::TestURLRequestContextGetter( - task_runner, test_request_context.Pass()); + task_runner, std::move(test_request_context)); } scoped_ptr<TestDataReductionProxyEventStorageDelegate> storage_delegate( @@ -402,15 +402,17 @@ DataReductionProxyTestContext::Builder::Build() { DataReductionProxyMutableConfigValues::CreateFromParams(params.get()); raw_mutable_config = mutable_config.get(); config.reset(new TestDataReductionProxyConfig( - mutable_config.Pass(), net_log.get(), configurator.get(), + std::move(mutable_config), net_log.get(), configurator.get(), event_creator.get())); } else if (use_mock_config_) { test_context_flags |= USE_MOCK_CONFIG; config.reset(new MockDataReductionProxyConfig( - params.Pass(), net_log.get(), configurator.get(), event_creator.get())); + std::move(params), net_log.get(), configurator.get(), + event_creator.get())); } else { config.reset(new TestDataReductionProxyConfig( - params.Pass(), net_log.get(), configurator.get(), event_creator.get())); + std::move(params), net_log.get(), configurator.get(), + event_creator.get())); } scoped_ptr<DataReductionProxyRequestOptions> request_options; @@ -426,13 +428,13 @@ DataReductionProxyTestContext::Builder::Build() { if (use_test_config_client_) { test_context_flags |= USE_TEST_CONFIG_CLIENT; config_client.reset(new TestDataReductionProxyConfigServiceClient( - params.Pass(), request_options.get(), raw_mutable_config, config.get(), - event_creator.get(), net_log.get(), + std::move(params), request_options.get(), raw_mutable_config, + config.get(), event_creator.get(), net_log.get(), base::Bind(&TestConfigStorer::StoreSerializedConfig, base::Unretained(config_storer.get())))); } else if (use_config_client_) { config_client.reset(new DataReductionProxyConfigServiceClient( - params.Pass(), GetBackoffPolicy(), request_options.get(), + std::move(params), GetBackoffPolicy(), request_options.get(), raw_mutable_config, config.get(), event_creator.get(), net_log.get(), base::Bind(&TestConfigStorer::StoreSerializedConfig, base::Unretained(config_storer.get())))); @@ -458,22 +460,23 @@ DataReductionProxyTestContext::Builder::Build() { &PrefService::SetInt64, base::Unretained(pref_service.get())))); scoped_ptr<TestDataReductionProxyIOData> io_data( new TestDataReductionProxyIOData( - task_runner, config.Pass(), event_creator.Pass(), - request_options.Pass(), configurator.Pass(), config_client.Pass(), - experiments_stats.Pass(), net_log.get(), true /* enabled */)); + task_runner, std::move(config), std::move(event_creator), + std::move(request_options), std::move(configurator), + std::move(config_client), std::move(experiments_stats), net_log.get(), + true /* enabled */)); io_data->SetSimpleURLRequestContextGetter(request_context_getter); scoped_ptr<DataReductionProxyTestContext> test_context( new DataReductionProxyTestContext( - task_runner, pref_service.Pass(), net_log.Pass(), - request_context_getter, mock_socket_factory_, io_data.Pass(), - settings.Pass(), storage_delegate.Pass(), config_storer.Pass(), - raw_params, test_context_flags)); + task_runner, std::move(pref_service), std::move(net_log), + request_context_getter, mock_socket_factory_, std::move(io_data), + std::move(settings), std::move(storage_delegate), + std::move(config_storer), raw_params, test_context_flags)); if (!skip_settings_initialization_) test_context->InitSettingsWithoutCheck(); - return test_context.Pass(); + return test_context; } DataReductionProxyTestContext::DataReductionProxyTestContext( @@ -490,16 +493,15 @@ DataReductionProxyTestContext::DataReductionProxyTestContext( unsigned int test_context_flags) : test_context_flags_(test_context_flags), task_runner_(task_runner), - simple_pref_service_(simple_pref_service.Pass()), - net_log_(net_log.Pass()), + simple_pref_service_(std::move(simple_pref_service)), + net_log_(std::move(net_log)), request_context_getter_(request_context_getter), mock_socket_factory_(mock_socket_factory), - io_data_(io_data.Pass()), - settings_(settings.Pass()), - storage_delegate_(storage_delegate.Pass()), - config_storer_(config_storer.Pass()), - params_(params) { -} + io_data_(std::move(io_data)), + settings_(std::move(settings)), + storage_delegate_(std::move(storage_delegate)), + config_storer_(std::move(config_storer)), + params_(params) {} DataReductionProxyTestContext::~DataReductionProxyTestContext() { DestroySettings(); @@ -592,7 +594,7 @@ void DataReductionProxyTestContext::AttachToURLRequestContext( make_scoped_ptr(new net::URLRequestInterceptingJobFactory( scoped_ptr<net::URLRequestJobFactory>( new net::URLRequestJobFactoryImpl()), - io_data()->CreateInterceptor().Pass()))); + io_data()->CreateInterceptor()))); } void DataReductionProxyTestContext:: diff --git a/components/data_reduction_proxy/core/browser/db_data_owner.cc b/components/data_reduction_proxy/core/browser/db_data_owner.cc index ef91620..8e29c20 100644 --- a/components/data_reduction_proxy/core/browser/db_data_owner.cc +++ b/components/data_reduction_proxy/core/browser/db_data_owner.cc @@ -4,6 +4,8 @@ #include "components/data_reduction_proxy/core/browser/db_data_owner.h" +#include <utility> + #include "base/logging.h" #include "base/threading/sequenced_worker_pool.h" #include "components/data_reduction_proxy/core/browser/data_store.h" @@ -13,7 +15,7 @@ namespace data_reduction_proxy { DBDataOwner::DBDataOwner(scoped_ptr<DataStore> store) - : store_(store.Pass()), + : store_(std::move(store)), data_usage_(new DataUsageStore(store_.get())), weak_factory_(this) { sequence_checker_.DetachFromSequence(); diff --git a/components/data_reduction_proxy/core/common/data_reduction_proxy_event_creator.cc b/components/data_reduction_proxy/core/common/data_reduction_proxy_event_creator.cc index 4f46c62..f7d418b 100644 --- a/components/data_reduction_proxy/core/common/data_reduction_proxy_event_creator.cc +++ b/components/data_reduction_proxy/core/common/data_reduction_proxy_event_creator.cc @@ -4,6 +4,8 @@ #include "components/data_reduction_proxy/core/common/data_reduction_proxy_event_creator.h" +#include <utility> + #include "base/bind.h" #include "base/strings/string_number_conversions.h" #include "base/time/time.h" @@ -53,10 +55,10 @@ scoped_ptr<base::Value> EnableDataReductionProxyCallback( for (const auto& proxy : proxies_for_https) https_proxy_list->AppendString(proxy.ToURI()); - dict->Set("http_proxy_list", http_proxy_list.Pass()); - dict->Set("https_proxy_list", https_proxy_list.Pass()); + dict->Set("http_proxy_list", std::move(http_proxy_list)); + dict->Set("https_proxy_list", std::move(https_proxy_list)); - return dict.Pass(); + return std::move(dict); } // A callback which creates a base::Value containing information about disabling @@ -65,7 +67,7 @@ scoped_ptr<base::Value> DisableDataReductionProxyCallback( net::NetLogCaptureMode /* capture_mode */) { scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); dict->SetBoolean("enabled", false); - return dict.Pass(); + return std::move(dict); } // A callback which creates a base::Value containing information about bypassing @@ -86,7 +88,7 @@ scoped_ptr<base::Value> UrlBypassActionCallback( dict->SetString("bypass_duration_seconds", base::Int64ToString(bypass_seconds)); dict->SetString("expiration", base::Int64ToString(expiration_ticks)); - return dict.Pass(); + return std::move(dict); } // A callback which creates a base::Value containing information about bypassing @@ -107,7 +109,7 @@ scoped_ptr<base::Value> UrlBypassTypeCallback( dict->SetString("bypass_duration_seconds", base::Int64ToString(bypass_seconds)); dict->SetString("expiration", base::Int64ToString(expiration_ticks)); - return dict.Pass(); + return std::move(dict); } // A callback that creates a base::Value containing information about a proxy @@ -119,7 +121,7 @@ scoped_ptr<base::Value> FallbackCallback( scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); dict->SetString("proxy", proxy_url); dict->SetInteger("net_error", net_error); - return dict.Pass(); + return std::move(dict); } // A callback which creates a base::Value containing information about @@ -133,7 +135,7 @@ scoped_ptr<base::Value> EndCanaryRequestCallback( dict->SetInteger("net_error", net_error); dict->SetInteger("http_response_code", http_response_code); dict->SetBoolean("check_succeeded", succeeded); - return dict.Pass(); + return std::move(dict); } // A callback that creates a base::Value containing information about @@ -153,11 +155,11 @@ scoped_ptr<base::Value> EndConfigRequestCallback( dict->SetInteger("net_error", net_error); dict->SetInteger("http_response_code", http_response_code); dict->SetInteger("failure_count", failure_count); - dict->Set("http_proxy_list_in_config", http_proxy_list.Pass()); + dict->Set("http_proxy_list_in_config", std::move(http_proxy_list)); dict->SetString("refresh_duration", base::Int64ToString(refresh_duration_minutes) + " minutes"); dict->SetString("expiration", base::Int64ToString(expiration_ticks)); - return dict.Pass(); + return std::move(dict); } } // namespace @@ -306,7 +308,7 @@ void DataReductionProxyEventCreator::PostEvent( scoped_ptr<base::Value> event = BuildDataReductionProxyEvent( type, net::NetLog::Source(), net::NetLog::PHASE_NONE, callback); if (event) - storage_delegate_->AddEvent(event.Pass()); + storage_delegate_->AddEvent(std::move(event)); if (net_log) net_log->AddGlobalEntry(type, callback); @@ -320,7 +322,7 @@ void DataReductionProxyEventCreator::PostEnabledEvent( scoped_ptr<base::Value> event = BuildDataReductionProxyEvent( type, net::NetLog::Source(), net::NetLog::PHASE_NONE, callback); if (event) - storage_delegate_->AddEnabledEvent(event.Pass(), enabled); + storage_delegate_->AddEnabledEvent(std::move(event), enabled); if (net_log) net_log->AddGlobalEntry(type, callback); @@ -335,7 +337,8 @@ void DataReductionProxyEventCreator::PostBoundNetLogBypassEvent( scoped_ptr<base::Value> event = BuildDataReductionProxyEvent(type, net_log.source(), phase, callback); if (event) - storage_delegate_->AddAndSetLastBypassEvent(event.Pass(), expiration_ticks); + storage_delegate_->AddAndSetLastBypassEvent(std::move(event), + expiration_ticks); net_log.AddEntry(type, phase, callback); } @@ -348,7 +351,8 @@ void DataReductionProxyEventCreator::PostBoundNetLogSecureProxyCheckEvent( scoped_ptr<base::Value> event( BuildDataReductionProxyEvent(type, net_log.source(), phase, callback)); if (event) - storage_delegate_->AddEventAndSecureProxyCheckState(event.Pass(), state); + storage_delegate_->AddEventAndSecureProxyCheckState(std::move(event), + state); net_log.AddEntry(type, phase, callback); } @@ -360,7 +364,7 @@ void DataReductionProxyEventCreator::PostBoundNetLogConfigRequestEvent( scoped_ptr<base::Value> event( BuildDataReductionProxyEvent(type, net_log.source(), phase, callback)); if (event) { - storage_delegate_->AddEvent(event.Pass()); + storage_delegate_->AddEvent(std::move(event)); net_log.AddEntry(type, phase, callback); } } diff --git a/components/data_reduction_proxy/core/common/data_reduction_proxy_event_storage_delegate_test_utils.cc b/components/data_reduction_proxy/core/common/data_reduction_proxy_event_storage_delegate_test_utils.cc index 2d8dfb6..5b836d3 100644 --- a/components/data_reduction_proxy/core/common/data_reduction_proxy_event_storage_delegate_test_utils.cc +++ b/components/data_reduction_proxy/core/common/data_reduction_proxy_event_storage_delegate_test_utils.cc @@ -4,6 +4,8 @@ #include "components/data_reduction_proxy/core/common/data_reduction_proxy_event_storage_delegate_test_utils.h" +#include <utility> + #include "base/memory/scoped_ptr.h" #include "base/values.h" #include "components/data_reduction_proxy/core/common/data_reduction_proxy_event_storage_delegate.h" @@ -27,28 +29,28 @@ void TestDataReductionProxyEventStorageDelegate::SetStorageDelegate( void TestDataReductionProxyEventStorageDelegate::AddEvent( scoped_ptr<base::Value> event) { if (delegate_) - delegate_->AddEvent(event.Pass()); + delegate_->AddEvent(std::move(event)); } void TestDataReductionProxyEventStorageDelegate::AddEnabledEvent( scoped_ptr<base::Value> event, bool enabled) { if (delegate_) - delegate_->AddEnabledEvent(event.Pass(), enabled); + delegate_->AddEnabledEvent(std::move(event), enabled); } void TestDataReductionProxyEventStorageDelegate::AddAndSetLastBypassEvent( scoped_ptr<base::Value> event, int64_t expiration_ticks) { if (delegate_) - delegate_->AddAndSetLastBypassEvent(event.Pass(), expiration_ticks); + delegate_->AddAndSetLastBypassEvent(std::move(event), expiration_ticks); } void TestDataReductionProxyEventStorageDelegate:: AddEventAndSecureProxyCheckState(scoped_ptr<base::Value> event, SecureProxyCheckState state) { if (delegate_) - delegate_->AddEventAndSecureProxyCheckState(event.Pass(), state); + delegate_->AddEventAndSecureProxyCheckState(std::move(event), state); } } // namespace data_reduction_proxy diff --git a/components/data_reduction_proxy/core/common/data_reduction_proxy_event_store.cc b/components/data_reduction_proxy/core/common/data_reduction_proxy_event_store.cc index a02f5da..b3f8cd8 100644 --- a/components/data_reduction_proxy/core/common/data_reduction_proxy_event_store.cc +++ b/components/data_reduction_proxy/core/common/data_reduction_proxy_event_store.cc @@ -6,7 +6,7 @@ #include <stddef.h> #include <stdint.h> - +#include <utility> #include <vector> #include "base/json/json_writer.h" @@ -80,7 +80,7 @@ void DataReductionProxyEventStore::AddConstants( kDataReductionProxyBypassEventTypeTable[i].constant); } - constants_dict->Set("dataReductionProxyBypassEventType", dict.Pass()); + constants_dict->Set("dataReductionProxyBypassEventType", std::move(dict)); dict.reset(new base::DictionaryValue()); for (size_t i = 0; i < arraysize(kDataReductionProxyBypassActionTypeTable); @@ -89,7 +89,7 @@ void DataReductionProxyEventStore::AddConstants( kDataReductionProxyBypassActionTypeTable[i].constant); } - constants_dict->Set("dataReductionProxyBypassActionType", dict.Pass()); + constants_dict->Set("dataReductionProxyBypassActionType", std::move(dict)); } DataReductionProxyEventStore::DataReductionProxyEventStore() @@ -169,7 +169,7 @@ void DataReductionProxyEventStore::AddEnabledEvent( current_configuration_.reset(event->DeepCopy()); else current_configuration_.reset(); - AddEvent(event.Pass()); + AddEvent(std::move(event)); } void DataReductionProxyEventStore::AddEventAndSecureProxyCheckState( @@ -177,7 +177,7 @@ void DataReductionProxyEventStore::AddEventAndSecureProxyCheckState( SecureProxyCheckState state) { DCHECK(thread_checker_.CalledOnValidThread()); secure_proxy_check_state_ = state; - AddEvent(event.Pass()); + AddEvent(std::move(event)); } void DataReductionProxyEventStore::AddAndSetLastBypassEvent( @@ -186,7 +186,7 @@ void DataReductionProxyEventStore::AddAndSetLastBypassEvent( DCHECK(thread_checker_.CalledOnValidThread()); last_bypass_event_.reset(event->DeepCopy()); expiration_ticks_ = expiration_ticks; - AddEvent(event.Pass()); + AddEvent(std::move(event)); } std::string DataReductionProxyEventStore::GetHttpProxyList() const { diff --git a/components/data_reduction_proxy/core/common/data_reduction_proxy_event_store_unittest.cc b/components/data_reduction_proxy/core/common/data_reduction_proxy_event_store_unittest.cc index 7214458..c8766f9 100644 --- a/components/data_reduction_proxy/core/common/data_reduction_proxy_event_store_unittest.cc +++ b/components/data_reduction_proxy/core/common/data_reduction_proxy_event_store_unittest.cc @@ -5,8 +5,8 @@ #include "components/data_reduction_proxy/core/common/data_reduction_proxy_event_store.h" #include <stddef.h> - #include <string> +#include <utility> #include <vector> #include "base/bind.h" @@ -260,10 +260,10 @@ TEST_F(DataReductionProxyEventStoreTest, TestFeedbackLastBypassEventFullURL) { bypass_params->SetString("url", "http://www.foo.com/bar?baz=1234"); sanitized_event->SetString("url", "http://www.foo.com/bar"); - bypass_event->Set("params", bypass_params.Pass()); + bypass_event->Set("params", std::move(bypass_params)); std::string sanitized_output; base::JSONWriter::Write(*sanitized_event.get(), &sanitized_output); - event_store()->AddAndSetLastBypassEvent(bypass_event.Pass(), 0); + event_store()->AddAndSetLastBypassEvent(std::move(bypass_event), 0); EXPECT_EQ(sanitized_output, event_store()->SanitizedLastBypassEvent()); } @@ -290,10 +290,10 @@ TEST_F(DataReductionProxyEventStoreTest, TestFeedbackLastBypassEventHostOnly) { bypass_params->SetString("url", "http://www.foo.com/bar?baz=1234"); sanitized_event->SetString("url", "www.foo.com"); - bypass_event->Set("params", bypass_params.Pass()); + bypass_event->Set("params", std::move(bypass_params)); std::string sanitized_output; base::JSONWriter::Write(*sanitized_event.get(), &sanitized_output); - event_store()->AddAndSetLastBypassEvent(bypass_event.Pass(), 0); + event_store()->AddAndSetLastBypassEvent(std::move(bypass_event), 0); EXPECT_EQ(sanitized_output, event_store()->SanitizedLastBypassEvent()); } diff --git a/components/data_usage/core/data_use_aggregator.cc b/components/data_usage/core/data_use_aggregator.cc index 0bd13dd..82d0ceb 100644 --- a/components/data_usage/core/data_use_aggregator.cc +++ b/components/data_usage/core/data_use_aggregator.cc @@ -4,6 +4,8 @@ #include "components/data_usage/core/data_use_aggregator.h" +#include <utility> + #include "base/bind.h" #include "base/callback.h" #include "build/build_config.h" @@ -20,8 +22,8 @@ namespace data_usage { DataUseAggregator::DataUseAggregator(scoped_ptr<DataUseAnnotator> annotator, scoped_ptr<DataUseAmortizer> amortizer) - : annotator_(annotator.Pass()), - amortizer_(amortizer.Pass()), + : annotator_(std::move(annotator)), + amortizer_(std::move(amortizer)), connection_type_(net::NetworkChangeNotifier::GetConnectionType()), weak_ptr_factory_(this) { #if defined(OS_ANDROID) @@ -58,7 +60,7 @@ void DataUseAggregator::ReportDataUse(net::URLRequest* request, connection_type_, mcc_mnc_, tx_bytes, rx_bytes)); if (!annotator_) { - PassDataUseToAmortizer(data_use.Pass()); + PassDataUseToAmortizer(std::move(data_use)); return; } @@ -69,7 +71,7 @@ void DataUseAggregator::ReportDataUse(net::URLRequest* request, annotation_callback_ = base::Bind(&DataUseAggregator::PassDataUseToAmortizer, GetWeakPtr()); } - annotator_->Annotate(request, data_use.Pass(), annotation_callback_); + annotator_->Annotate(request, std::move(data_use), annotation_callback_); } void DataUseAggregator::ReportOffTheRecordDataUse(int64_t tx_bytes, @@ -106,7 +108,7 @@ void DataUseAggregator::PassDataUseToAmortizer(scoped_ptr<DataUse> data_use) { DCHECK(data_use); if (!amortizer_) { - OnAmortizationComplete(data_use.Pass()); + OnAmortizationComplete(std::move(data_use)); return; } @@ -117,7 +119,7 @@ void DataUseAggregator::PassDataUseToAmortizer(scoped_ptr<DataUse> data_use) { amortization_callback_ = base::Bind(&DataUseAggregator::OnAmortizationComplete, GetWeakPtr()); } - amortizer_->AmortizeDataUse(data_use.Pass(), amortization_callback_); + amortizer_->AmortizeDataUse(std::move(data_use), amortization_callback_); } void DataUseAggregator::OnAmortizationComplete( diff --git a/components/data_usage/core/data_use_aggregator_unittest.cc b/components/data_usage/core/data_use_aggregator_unittest.cc index 6431304..ea63757 100644 --- a/components/data_usage/core/data_use_aggregator_unittest.cc +++ b/components/data_usage/core/data_use_aggregator_unittest.cc @@ -6,9 +6,9 @@ #include <stddef.h> #include <stdint.h> - #include <map> #include <string> +#include <utility> #include <vector> #include "base/callback.h" @@ -43,7 +43,7 @@ class TestDataUseAggregator : public DataUseAggregator { public: TestDataUseAggregator(scoped_ptr<DataUseAnnotator> annotator, scoped_ptr<DataUseAmortizer> amortizer) - : DataUseAggregator(annotator.Pass(), amortizer.Pass()) {} + : DataUseAggregator(std::move(annotator), std::move(amortizer)) {} ~TestDataUseAggregator() override {} @@ -95,7 +95,7 @@ class FakeDataUseAnnotator : public DataUseAnnotator { scoped_ptr<DataUse> data_use, const base::Callback<void(scoped_ptr<DataUse>)>& callback) override { data_use->tab_id = tab_id_; - callback.Run(data_use.Pass()); + callback.Run(std::move(data_use)); } void set_tab_id(int32_t tab_id) { tab_id_ = tab_id; } @@ -116,7 +116,7 @@ class DoublingAmortizer : public DataUseAmortizer { const AmortizationCompleteCallback& callback) override { data_use->tx_bytes *= 2; data_use->rx_bytes *= 2; - callback.Run(data_use.Pass()); + callback.Run(std::move(data_use)); } void OnExtraBytes(int64_t extra_tx_bytes, int64_t extra_rx_bytes) override {} @@ -247,7 +247,7 @@ class DataUseAggregatorTest : public testing::Test { // Initialize testing objects. FakeDataUseAnnotator* fake_data_use_annotator = annotator.get(); data_use_aggregator_.reset( - new TestDataUseAggregator(annotator.Pass(), amortizer.Pass())); + new TestDataUseAggregator(std::move(annotator), std::move(amortizer))); test_observer_.reset(new TestObserver(data_use_aggregator_.get())); test_network_change_notifier_.reset( new TestNetworkChangeNotifier(data_use_aggregator_.get())); @@ -289,7 +289,7 @@ class DataUseAggregatorTest : public testing::Test { request->Start(); loop_.RunUntilIdle(); - return request.Pass(); + return request; } ReportingNetworkDelegate* reporting_network_delegate() { @@ -339,7 +339,7 @@ TEST_F(DataUseAggregatorTest, ReportDataUse) { scoped_ptr<DataUseAmortizer> amortizer( test_case.use_amortizer ? new DoublingAmortizer() : nullptr); - Initialize(annotator.Pass(), amortizer.Pass()); + Initialize(std::move(annotator), std::move(amortizer)); const int32_t kFooTabId = 10; const net::NetworkChangeNotifier::ConnectionType kFooConnectionType = diff --git a/components/devtools_http_handler/devtools_http_handler.cc b/components/devtools_http_handler/devtools_http_handler.cc index 9df0c65..9c61964 100644 --- a/components/devtools_http_handler/devtools_http_handler.cc +++ b/components/devtools_http_handler/devtools_http_handler.cc @@ -127,10 +127,9 @@ ServerWrapper::ServerWrapper(base::WeakPtr<DevToolsHttpHandler> handler, const base::FilePath& frontend_dir, bool bundles_resources) : handler_(handler), - server_(new net::HttpServer(socket.Pass(), this)), + server_(new net::HttpServer(std::move(socket), this)), frontend_dir_(frontend_dir), - bundles_resources_(bundles_resources) { -} + bundles_resources_(bundles_resources) {} int ServerWrapper::GetLocalAddress(net::IPEndPoint* address) { return server_->GetLocalAddress(address); @@ -199,7 +198,7 @@ void ServerStartedOnUI( DCHECK_CURRENTLY_ON(BrowserThread::UI); if (handler && thread && server_wrapper) { handler->ServerStarted(thread, server_wrapper, socket_factory, - ip_address.Pass()); + std::move(ip_address)); } else { TerminateOnUI(thread, server_wrapper, socket_factory); } @@ -218,7 +217,7 @@ void StartServerOnHandlerThread( server_socket_factory->CreateForHttpServer(); scoped_ptr<net::IPEndPoint> ip_address(new net::IPEndPoint); if (server_socket) { - server_wrapper = new ServerWrapper(handler, server_socket.Pass(), + server_wrapper = new ServerWrapper(handler, std::move(server_socket), frontend_dir, bundles_resources); if (!output_directory.empty()) server_wrapper->WriteActivePortToUserProfile(output_directory); diff --git a/components/devtools_http_handler/devtools_http_handler_unittest.cc b/components/devtools_http_handler/devtools_http_handler_unittest.cc index 5d73ce4..2189bb7 100644 --- a/components/devtools_http_handler/devtools_http_handler_unittest.cc +++ b/components/devtools_http_handler/devtools_http_handler_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/devtools_http_handler/devtools_http_handler.h" + #include <stdint.h> +#include <utility> #include "base/files/file_util.h" #include "base/files/scoped_temp_dir.h" @@ -12,7 +15,6 @@ #include "base/strings/string_number_conversions.h" #include "base/thread_task_runner_handle.h" #include "base/values.h" -#include "components/devtools_http_handler/devtools_http_handler.h" #include "components/devtools_http_handler/devtools_http_handler_delegate.h" #include "content/public/test/test_browser_thread_bundle.h" #include "content/public/test/test_utils.h" @@ -128,14 +130,9 @@ TEST_F(DevToolsHttpHandlerTest, TestStartStop) { scoped_ptr<DevToolsHttpHandler::ServerSocketFactory> factory( new DummyServerSocketFactory(run_loop.QuitClosure(), run_loop_2.QuitClosure())); - scoped_ptr<DevToolsHttpHandler> devtools_http_handler( - new DevToolsHttpHandler(factory.Pass(), - std::string(), - new DummyDelegate(), - base::FilePath(), - base::FilePath(), - std::string(), - std::string())); + scoped_ptr<DevToolsHttpHandler> devtools_http_handler(new DevToolsHttpHandler( + std::move(factory), std::string(), new DummyDelegate(), base::FilePath(), + base::FilePath(), std::string(), std::string())); // Our dummy socket factory will post a quit message once the server will // become ready. run_loop.Run(); @@ -149,14 +146,9 @@ TEST_F(DevToolsHttpHandlerTest, TestServerSocketFailed) { scoped_ptr<DevToolsHttpHandler::ServerSocketFactory> factory( new FailingServerSocketFactory(run_loop.QuitClosure(), run_loop_2.QuitClosure())); - scoped_ptr<DevToolsHttpHandler> devtools_http_handler( - new DevToolsHttpHandler(factory.Pass(), - std::string(), - new DummyDelegate(), - base::FilePath(), - base::FilePath(), - std::string(), - std::string())); + scoped_ptr<DevToolsHttpHandler> devtools_http_handler(new DevToolsHttpHandler( + std::move(factory), std::string(), new DummyDelegate(), base::FilePath(), + base::FilePath(), std::string(), std::string())); // Our dummy socket factory will post a quit message once the server will // become ready. run_loop.Run(); @@ -177,14 +169,9 @@ TEST_F(DevToolsHttpHandlerTest, TestDevToolsActivePort) { scoped_ptr<DevToolsHttpHandler::ServerSocketFactory> factory( new DummyServerSocketFactory(run_loop.QuitClosure(), run_loop_2.QuitClosure())); - scoped_ptr<DevToolsHttpHandler> devtools_http_handler( - new DevToolsHttpHandler(factory.Pass(), - std::string(), - new DummyDelegate(), - temp_dir.path(), - base::FilePath(), - std::string(), - std::string())); + scoped_ptr<DevToolsHttpHandler> devtools_http_handler(new DevToolsHttpHandler( + std::move(factory), std::string(), new DummyDelegate(), temp_dir.path(), + base::FilePath(), std::string(), std::string())); // Our dummy socket factory will post a quit message once the server will // become ready. run_loop.Run(); diff --git a/components/dom_distiller/content/browser/distillable_page_utils_browsertest.cc b/components/dom_distiller/content/browser/distillable_page_utils_browsertest.cc index 17daae1..4ec50f7 100644 --- a/components/dom_distiller/content/browser/distillable_page_utils_browsertest.cc +++ b/components/dom_distiller/content/browser/distillable_page_utils_browsertest.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/dom_distiller/content/browser/distillable_page_utils.h" + +#include <utility> + #include "base/bind.h" #include "base/path_service.h" #include "base/run_loop.h" #include "build/build_config.h" -#include "components/dom_distiller/content/browser/distillable_page_utils.h" #include "components/dom_distiller/content/browser/distiller_javascript_utils.h" #include "components/dom_distiller/core/distillable_page_detector.h" #include "components/dom_distiller/core/page_features.h" @@ -139,7 +142,7 @@ IN_PROC_BROWSER_TEST_F(DomDistillerDistillablePageUtilsTest, stump->set_weight(1); stump->set_split(-1); scoped_ptr<DistillablePageDetector> detector( - new DistillablePageDetector(proto.Pass())); + new DistillablePageDetector(std::move(proto))); EXPECT_DOUBLE_EQ(0.5, detector->GetThreshold()); // The first value of the first feature is either 0 or 1. Since the stump's // split is -1, the stump weight will be applied to any set of derived @@ -163,7 +166,7 @@ IN_PROC_BROWSER_TEST_F(DomDistillerDistillablePageUtilsTest, stump->set_weight(-1); stump->set_split(-1); scoped_ptr<DistillablePageDetector> detector( - new DistillablePageDetector(proto.Pass())); + new DistillablePageDetector(std::move(proto))); EXPECT_DOUBLE_EQ(-0.5, detector->GetThreshold()); // The first value of the first feature is either 0 or 1. Since the stump's // split is -1, the stump weight will be applied to any set of derived diff --git a/components/dom_distiller/content/browser/distiller_javascript_service_impl.cc b/components/dom_distiller/content/browser/distiller_javascript_service_impl.cc index 6bc55b9..11e3841 100644 --- a/components/dom_distiller/content/browser/distiller_javascript_service_impl.cc +++ b/components/dom_distiller/content/browser/distiller_javascript_service_impl.cc @@ -3,6 +3,9 @@ // found in the LICENSE file. #include "components/dom_distiller/content/browser/distiller_javascript_service_impl.h" + +#include <utility> + #include "components/dom_distiller/content/browser/distiller_ui_handle.h" #include "components/dom_distiller/core/feedback_reporter.h" #include "content/public/browser/user_metrics.h" @@ -14,7 +17,7 @@ DistillerJavaScriptServiceImpl::DistillerJavaScriptServiceImpl( content::RenderFrameHost* render_frame_host, DistillerUIHandle* distiller_ui_handle, mojo::InterfaceRequest<DistillerJavaScriptService> request) - : binding_(this, request.Pass()), + : binding_(this, std::move(request)), render_frame_host_(render_frame_host), distiller_ui_handle_(distiller_ui_handle) {} @@ -65,7 +68,7 @@ void CreateDistillerJavaScriptService( mojo::InterfaceRequest<DistillerJavaScriptService> request) { // This is strongly bound and owned by the pipe. new DistillerJavaScriptServiceImpl(render_frame_host, distiller_ui_handle, - request.Pass()); + std::move(request)); } } // namespace dom_distiller diff --git a/components/dom_distiller/content/browser/distiller_page_web_contents.cc b/components/dom_distiller/content/browser/distiller_page_web_contents.cc index 117e01f..a1fc869 100644 --- a/components/dom_distiller/content/browser/distiller_page_web_contents.cc +++ b/components/dom_distiller/content/browser/distiller_page_web_contents.cc @@ -4,6 +4,8 @@ #include "components/dom_distiller/content/browser/distiller_page_web_contents.h" +#include <utility> + #include "base/callback.h" #include "base/memory/scoped_ptr.h" #include "base/metrics/histogram.h" @@ -52,7 +54,7 @@ DistillerPageWebContentsFactory::CreateDistillerPageWithHandle( scoped_ptr<SourcePageHandleWebContents>( static_cast<SourcePageHandleWebContents*>(handle.release())); return scoped_ptr<DistillerPage>(new DistillerPageWebContents( - browser_context_, gfx::Size(), web_contents_handle.Pass())); + browser_context_, gfx::Size(), std::move(web_contents_handle))); } DistillerPageWebContents::DistillerPageWebContents( @@ -65,7 +67,7 @@ DistillerPageWebContents::DistillerPageWebContents( render_view_size_(render_view_size), weak_factory_(this) { if (optional_web_contents_handle) { - source_page_handle_ = optional_web_contents_handle.Pass(); + source_page_handle_ = std::move(optional_web_contents_handle); if (render_view_size.IsEmpty()) render_view_size_ = source_page_handle_->web_contents()->GetContainerBounds().size(); diff --git a/components/dom_distiller/content/browser/distiller_page_web_contents_browsertest.cc b/components/dom_distiller/content/browser/distiller_page_web_contents_browsertest.cc index cd8fb4a..78ba075 100644 --- a/components/dom_distiller/content/browser/distiller_page_web_contents_browsertest.cc +++ b/components/dom_distiller/content/browser/distiller_page_web_contents_browsertest.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/dom_distiller/content/browser/distiller_page_web_contents.h" + +#include <utility> + #include "base/memory/weak_ptr.h" #include "base/path_service.h" #include "base/run_loop.h" @@ -9,7 +13,6 @@ #include "base/values.h" #include "build/build_config.h" #include "components/dom_distiller/content/browser/distiller_javascript_utils.h" -#include "components/dom_distiller/content/browser/distiller_page_web_contents.h" #include "components/dom_distiller/content/browser/web_contents_main_frame_observer.h" #include "components/dom_distiller/core/distiller_page.h" #include "components/dom_distiller/core/proto/distilled_article.pb.h" @@ -103,7 +106,7 @@ class DistillerPageWebContentsTest : public ContentBrowserTest { base::Closure quit_closure, scoped_ptr<proto::DomDistillerResult> distiller_result, bool distillation_successful) { - distiller_result_ = distiller_result.Pass(); + distiller_result_ = std::move(distiller_result); quit_closure.Run(); } @@ -158,8 +161,9 @@ class TestDistillerPageWebContents : public DistillerPageWebContents { const gfx::Size& render_view_size, scoped_ptr<SourcePageHandleWebContents> optional_web_contents_handle, bool expect_new_web_contents) - : DistillerPageWebContents(browser_context, render_view_size, - optional_web_contents_handle.Pass()), + : DistillerPageWebContents(browser_context, + render_view_size, + std::move(optional_web_contents_handle)), expect_new_web_contents_(expect_new_web_contents), new_web_contents_created_(false) {} @@ -358,8 +362,7 @@ void DistillerPageWebContentsTest::RunUseCurrentWebContentsTest( TestDistillerPageWebContents distiller_page( shell()->web_contents()->GetBrowserContext(), shell()->web_contents()->GetContainerBounds().size(), - source_page_handle.Pass(), - expect_new_web_contents); + std::move(source_page_handle), expect_new_web_contents); distiller_page_ = &distiller_page; base::RunLoop run_loop; @@ -393,12 +396,10 @@ IN_PROC_BROWSER_TEST_F(DistillerPageWebContentsTest, scoped_ptr<SourcePageHandleWebContents> source_page_handle( new SourcePageHandleWebContents(current_web_contents, false)); - TestDistillerPageWebContents* distiller_page( - new TestDistillerPageWebContents( - current_web_contents->GetBrowserContext(), - current_web_contents->GetContainerBounds().size(), - source_page_handle.Pass(), - false)); + TestDistillerPageWebContents* distiller_page(new TestDistillerPageWebContents( + current_web_contents->GetBrowserContext(), + current_web_contents->GetContainerBounds().size(), + std::move(source_page_handle), false)); distiller_page_ = distiller_page; base::RunLoop run_loop; diff --git a/components/dom_distiller/content/browser/dom_distiller_viewer_source.cc b/components/dom_distiller/content/browser/dom_distiller_viewer_source.cc index 252f9b0..3ce7d16 100644 --- a/components/dom_distiller/content/browser/dom_distiller_viewer_source.cc +++ b/components/dom_distiller/content/browser/dom_distiller_viewer_source.cc @@ -5,6 +5,7 @@ #include "components/dom_distiller/content/browser/dom_distiller_viewer_source.h" #include <string> +#include <utility> #include <vector> #include "base/memory/ref_counted_memory.h" @@ -171,8 +172,7 @@ DomDistillerViewerSource::DomDistillerViewerSource( scoped_ptr<DistillerUIHandle> ui_handle) : scheme_(scheme), dom_distiller_service_(dom_distiller_service), - distiller_ui_handle_(ui_handle.Pass()) { -} + distiller_ui_handle_(std::move(ui_handle)) {} DomDistillerViewerSource::~DomDistillerViewerSource() { } @@ -250,7 +250,7 @@ void DomDistillerViewerSource::StartDataRequest( // the |RequestViewerHandle|, so passing ownership to it, to ensure the // request is not cancelled. The |RequestViewerHandle| will delete itself // after receiving the callback. - request_viewer_handle->TakeViewerHandle(viewer_handle.Pass()); + request_viewer_handle->TakeViewerHandle(std::move(viewer_handle)); } else { request_viewer_handle->FlagAsErrorPage(); } diff --git a/components/dom_distiller/content/renderer/distiller_js_render_frame_observer.cc b/components/dom_distiller/content/renderer/distiller_js_render_frame_observer.cc index 27bf175..a9109f7 100644 --- a/components/dom_distiller/content/renderer/distiller_js_render_frame_observer.cc +++ b/components/dom_distiller/content/renderer/distiller_js_render_frame_observer.cc @@ -4,6 +4,8 @@ #include "components/dom_distiller/content/renderer/distiller_js_render_frame_observer.h" +#include <utility> + #include "base/bind.h" #include "components/dom_distiller/content/common/distiller_page_notifier_service.mojom.h" #include "components/dom_distiller/content/renderer/distiller_page_notifier_service_impl.h" @@ -57,7 +59,7 @@ void DistillerJsRenderFrameObserver::RegisterMojoService() { void DistillerJsRenderFrameObserver::CreateDistillerPageNotifierService( mojo::InterfaceRequest<DistillerPageNotifierService> request) { // This is strongly bound to and owned by the pipe. - new DistillerPageNotifierServiceImpl(this, request.Pass()); + new DistillerPageNotifierServiceImpl(this, std::move(request)); } void DistillerJsRenderFrameObserver::SetIsDistillerPage() { diff --git a/components/dom_distiller/content/renderer/distiller_page_notifier_service_impl.cc b/components/dom_distiller/content/renderer/distiller_page_notifier_service_impl.cc index 7ff1e72..8337624 100644 --- a/components/dom_distiller/content/renderer/distiller_page_notifier_service_impl.cc +++ b/components/dom_distiller/content/renderer/distiller_page_notifier_service_impl.cc @@ -4,6 +4,8 @@ #include "components/dom_distiller/content/renderer/distiller_page_notifier_service_impl.h" +#include <utility> + #include "components/dom_distiller/content/renderer/distiller_js_render_frame_observer.h" #include "components/dom_distiller/content/renderer/distiller_native_javascript.h" @@ -12,8 +14,7 @@ namespace dom_distiller { DistillerPageNotifierServiceImpl::DistillerPageNotifierServiceImpl( DistillerJsRenderFrameObserver* observer, mojo::InterfaceRequest<DistillerPageNotifierService> request) - : binding_(this, request.Pass()), - distiller_js_observer_(observer) {} + : binding_(this, std::move(request)), distiller_js_observer_(observer) {} void DistillerPageNotifierServiceImpl::NotifyIsDistillerPage() { // TODO(mdjones): Send some form of unique ID so this call knows diff --git a/components/dom_distiller/core/article_attachments_data.cc b/components/dom_distiller/core/article_attachments_data.cc index 256bfad..67e3f22 100644 --- a/components/dom_distiller/core/article_attachments_data.cc +++ b/components/dom_distiller/core/article_attachments_data.cc @@ -28,7 +28,7 @@ scoped_ptr<ArticleAttachmentsData> ArticleAttachmentsData::GetFromAttachmentMap( iter->second.GetData(); data->distilled_article_.ParseFromArray(attachment_bytes->front(), attachment_bytes->size()); - return data.Pass(); + return data; } void ArticleAttachmentsData::CreateSyncAttachments( diff --git a/components/dom_distiller/core/distillable_page_detector.cc b/components/dom_distiller/core/distillable_page_detector.cc index 1b695c5..c3a333e 100644 --- a/components/dom_distiller/core/distillable_page_detector.cc +++ b/components/dom_distiller/core/distillable_page_detector.cc @@ -5,6 +5,7 @@ #include "components/dom_distiller/core/distillable_page_detector.h" #include <stddef.h> +#include <utility> #include "base/logging.h" #include "grit/components_resources.h" @@ -21,7 +22,7 @@ const DistillablePageDetector* DistillablePageDetector::GetDefault() { .as_string(); scoped_ptr<AdaBoostProto> proto(new AdaBoostProto); CHECK(proto->ParseFromString(serialized_proto)); - detector = new DistillablePageDetector(proto.Pass()); + detector = new DistillablePageDetector(std::move(proto)); } return detector; } @@ -35,14 +36,14 @@ const DistillablePageDetector* DistillablePageDetector::GetNewModel() { .as_string(); scoped_ptr<AdaBoostProto> proto(new AdaBoostProto); CHECK(proto->ParseFromString(serialized_proto)); - detector = new DistillablePageDetector(proto.Pass()); + detector = new DistillablePageDetector(std::move(proto)); } return detector; } DistillablePageDetector::DistillablePageDetector( scoped_ptr<AdaBoostProto> proto) - : proto_(proto.Pass()), threshold_(0.0) { + : proto_(std::move(proto)), threshold_(0.0) { CHECK(proto_->num_stumps() == proto_->stump_size()); for (int i = 0; i < proto_->num_stumps(); ++i) { const StumpProto& stump = proto_->stump(i); diff --git a/components/dom_distiller/core/distilled_content_store_unittest.cc b/components/dom_distiller/core/distilled_content_store_unittest.cc index b4b7a3d..648ab42 100644 --- a/components/dom_distiller/core/distilled_content_store_unittest.cc +++ b/components/dom_distiller/core/distilled_content_store_unittest.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/dom_distiller/core/distilled_content_store.h" + +#include <utility> + #include "base/bind.h" #include "base/message_loop/message_loop.h" #include "base/run_loop.h" #include "components/dom_distiller/core/article_entry.h" -#include "components/dom_distiller/core/distilled_content_store.h" #include "components/dom_distiller/core/proto/distilled_article.pb.h" #include "testing/gtest/include/gtest/gtest.h" @@ -52,7 +55,7 @@ class InMemoryContentStoreTest : public testing::Test { public: void OnLoadCallback(bool success, scoped_ptr<DistilledArticleProto> proto) { load_success_ = success; - loaded_proto_ = proto.Pass(); + loaded_proto_ = std::move(proto); } void OnSaveCallback(bool success) { save_success_ = success; } diff --git a/components/dom_distiller/core/distiller.cc b/components/dom_distiller/core/distiller.cc index 5be079e..20cae55 100644 --- a/components/dom_distiller/core/distiller.cc +++ b/components/dom_distiller/core/distiller.cc @@ -5,6 +5,7 @@ #include "components/dom_distiller/core/distiller.h" #include <map> +#include <utility> #include <vector> #include "base/auto_reset.h" @@ -31,9 +32,8 @@ namespace dom_distiller { DistillerFactoryImpl::DistillerFactoryImpl( scoped_ptr<DistillerURLFetcherFactory> distiller_url_fetcher_factory, const dom_distiller::proto::DomDistillerOptions& dom_distiller_options) - : distiller_url_fetcher_factory_(distiller_url_fetcher_factory.Pass()), - dom_distiller_options_(dom_distiller_options) { -} + : distiller_url_fetcher_factory_(std::move(distiller_url_fetcher_factory)), + dom_distiller_options_(dom_distiller_options) {} DistillerFactoryImpl::~DistillerFactoryImpl() {} @@ -42,7 +42,7 @@ scoped_ptr<Distiller> DistillerFactoryImpl::CreateDistillerForUrl( // This default implementation has the same behavior for all URLs. scoped_ptr<DistillerImpl> distiller(new DistillerImpl( *distiller_url_fetcher_factory_, dom_distiller_options_)); - return distiller.Pass(); + return std::move(distiller); } DistillerImpl::DistilledPageData::DistilledPageData() {} @@ -103,7 +103,7 @@ void DistillerImpl::DistillPage(const GURL& url, const DistillationFinishedCallback& finished_cb, const DistillationUpdateCallback& update_cb) { DCHECK(AreAllPagesFinished()); - distiller_page_ = distiller_page.Pass(); + distiller_page_ = std::move(distiller_page); finished_cb_ = finished_cb; update_cb_ = update_cb; @@ -378,7 +378,7 @@ void DistillerImpl::RunDistillerCallbackIfDone() { base::AutoReset<bool> dont_delete_this_in_callback(&destruction_allowed_, false); - finished_cb_.Run(article_proto.Pass()); + finished_cb_.Run(std::move(article_proto)); finished_cb_.Reset(); } } diff --git a/components/dom_distiller/core/distiller_unittest.cc b/components/dom_distiller/core/distiller_unittest.cc index 22b76f0..f6b9997 100644 --- a/components/dom_distiller/core/distiller_unittest.cc +++ b/components/dom_distiller/core/distiller_unittest.cc @@ -2,11 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include <stddef.h> +#include "components/dom_distiller/core/distiller.h" +#include <stddef.h> #include <algorithm> #include <map> #include <string> +#include <utility> #include <vector> #include "base/bind.h" @@ -20,7 +22,6 @@ #include "base/thread_task_runner_handle.h" #include "base/values.h" #include "components/dom_distiller/core/article_distillation_update.h" -#include "components/dom_distiller/core/distiller.h" #include "components/dom_distiller/core/distiller_page.h" #include "components/dom_distiller/core/fake_distiller_page.h" #include "components/dom_distiller/core/proto/distilled_article.pb.h" @@ -177,7 +178,7 @@ scoped_ptr<MultipageDistillerData> CreateMultipageDistillerDataWithoutImages( prev_page_url); result->distilled_values.push_back(distilled_value.release()); } - return result.Pass(); + return result; } void VerifyArticleProtoMatchesMultipageData( @@ -275,7 +276,7 @@ class DistillerTest : public testing::Test { ~DistillerTest() override {} void OnDistillArticleDone(scoped_ptr<DistilledArticleProto> proto) { - article_proto_ = proto.Pass(); + article_proto_ = std::move(proto); } void OnDistillArticleUpdate(const ArticleDistillationUpdate& article_update) { @@ -284,8 +285,7 @@ class DistillerTest : public testing::Test { void DistillPage(const std::string& url, scoped_ptr<DistillerPage> distiller_page) { - distiller_->DistillPage(GURL(url), - distiller_page.Pass(), + distiller_->DistillPage(GURL(url), std::move(distiller_page), base::Bind(&DistillerTest::OnDistillArticleDone, base::Unretained(this)), base::Bind(&DistillerTest::OnDistillArticleUpdate, @@ -309,7 +309,7 @@ scoped_ptr<DistillerPage> CreateMockDistillerPage(const base::Value* result, MockDistillerPage* distiller_page = new MockDistillerPage(); EXPECT_CALL(*distiller_page, DistillPageImpl(url, _)) .WillOnce(DistillerPageOnDistillationDone(distiller_page, url, result)); - return scoped_ptr<DistillerPage>(distiller_page).Pass(); + return scoped_ptr<DistillerPage>(distiller_page); } scoped_ptr<DistillerPage> CreateMockDistillerPageWithPendingJSCallback( @@ -318,7 +318,7 @@ scoped_ptr<DistillerPage> CreateMockDistillerPageWithPendingJSCallback( MockDistillerPage* distiller_page = new MockDistillerPage(); *distiller_page_ptr = distiller_page; EXPECT_CALL(*distiller_page, DistillPageImpl(url, _)); - return scoped_ptr<DistillerPage>(distiller_page).Pass(); + return scoped_ptr<DistillerPage>(distiller_page); } scoped_ptr<DistillerPage> CreateMockDistillerPages( @@ -337,7 +337,7 @@ scoped_ptr<DistillerPage> CreateMockDistillerPages( distiller_page, url, distiller_data->distilled_values[page])); } } - return scoped_ptr<DistillerPage>(distiller_page).Pass(); + return scoped_ptr<DistillerPage>(distiller_page); } TEST_F(DistillerTest, DistillPage) { @@ -346,7 +346,7 @@ TEST_F(DistillerTest, DistillPage) { CreateDistilledValueReturnedFromJS(kTitle, kContent, vector<int>(), ""); distiller_.reset( new DistillerImpl(url_fetcher_factory_, DomDistillerOptions())); - DistillPage(kURL, CreateMockDistillerPage(result.get(), GURL(kURL)).Pass()); + DistillPage(kURL, CreateMockDistillerPage(result.get(), GURL(kURL))); base::MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(kTitle, article_proto_->title()); ASSERT_EQ(article_proto_->pages_size(), 1); @@ -363,7 +363,7 @@ TEST_F(DistillerTest, DistillPageWithDebugInfo) { dom_distiller::proto::json::DomDistillerResult::WriteToValue(dd_result); distiller_.reset( new DistillerImpl(url_fetcher_factory_, DomDistillerOptions())); - DistillPage(kURL, CreateMockDistillerPage(result.get(), GURL(kURL)).Pass()); + DistillPage(kURL, CreateMockDistillerPage(result.get(), GURL(kURL))); base::MessageLoop::current()->RunUntilIdle(); const DistilledPageProto& first_page = article_proto_->pages(0); EXPECT_EQ(kDebugLog, first_page.debug_info().log()); @@ -390,7 +390,7 @@ TEST_F(DistillerTest, DistillPageWithTimingInfo) { dom_distiller::proto::json::DomDistillerResult::WriteToValue(dd_result); distiller_.reset( new DistillerImpl(url_fetcher_factory_, DomDistillerOptions())); - DistillPage(kURL, CreateMockDistillerPage(result.get(), GURL(kURL)).Pass()); + DistillPage(kURL, CreateMockDistillerPage(result.get(), GURL(kURL))); base::MessageLoop::current()->RunUntilIdle(); const DistilledPageProto& first_page = article_proto_->pages(0); std::map<std::string, double> timings; @@ -418,7 +418,7 @@ TEST_F(DistillerTest, DistillPageWithImages) { CreateDistilledValueReturnedFromJS(kTitle, kContent, image_indices, ""); distiller_.reset( new DistillerImpl(url_fetcher_factory_, DomDistillerOptions())); - DistillPage(kURL, CreateMockDistillerPage(result.get(), GURL(kURL)).Pass()); + DistillPage(kURL, CreateMockDistillerPage(result.get(), GURL(kURL))); base::MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(kTitle, article_proto_->title()); ASSERT_EQ(article_proto_->pages_size(), 1); @@ -455,9 +455,8 @@ TEST_F(DistillerTest, DistillMultiplePages) { distiller_.reset( new DistillerImpl(url_fetcher_factory_, DomDistillerOptions())); - DistillPage( - distiller_data->page_urls[0], - CreateMockDistillerPages(distiller_data.get(), kNumPages, 0).Pass()); + DistillPage(distiller_data->page_urls[0], + CreateMockDistillerPages(distiller_data.get(), kNumPages, 0)); base::MessageLoop::current()->RunUntilIdle(); VerifyArticleProtoMatchesMultipageData( article_proto_.get(), distiller_data.get(), kNumPages, kNumPages); @@ -471,7 +470,7 @@ TEST_F(DistillerTest, DistillLinkLoop) { CreateDistilledValueReturnedFromJS(kTitle, kContent, vector<int>(), kURL); distiller_.reset( new DistillerImpl(url_fetcher_factory_, DomDistillerOptions())); - DistillPage(kURL, CreateMockDistillerPage(result.get(), GURL(kURL)).Pass()); + DistillPage(kURL, CreateMockDistillerPage(result.get(), GURL(kURL))); base::MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(kTitle, article_proto_->title()); EXPECT_EQ(article_proto_->pages_size(), 1); @@ -502,9 +501,9 @@ TEST_F(DistillerTest, CheckMaxPageLimitExtraPage) { distiller_->SetMaxNumPagesInArticle(kMaxPagesInArticle); - DistillPage(distiller_data->page_urls[0], - CreateMockDistillerPages( - distiller_data.get(), kMaxPagesInArticle, 0).Pass()); + DistillPage( + distiller_data->page_urls[0], + CreateMockDistillerPages(distiller_data.get(), kMaxPagesInArticle, 0)); base::MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(kTitle, article_proto_->title()); EXPECT_EQ(kMaxPagesInArticle, @@ -523,9 +522,9 @@ TEST_F(DistillerTest, CheckMaxPageLimitExactLimit) { // Check if distilling an article with exactly the page limit works. distiller_->SetMaxNumPagesInArticle(kMaxPagesInArticle); - DistillPage(distiller_data->page_urls[0], - CreateMockDistillerPages( - distiller_data.get(), kMaxPagesInArticle, 0).Pass()); + DistillPage( + distiller_data->page_urls[0], + CreateMockDistillerPages(distiller_data.get(), kMaxPagesInArticle, 0)); base::MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(kTitle, article_proto_->title()); EXPECT_EQ(kMaxPagesInArticle, @@ -538,8 +537,7 @@ TEST_F(DistillerTest, SinglePageDistillationFailure) { scoped_ptr<base::Value> null_value = base::Value::CreateNullValue(); distiller_.reset( new DistillerImpl(url_fetcher_factory_, DomDistillerOptions())); - DistillPage(kURL, - CreateMockDistillerPage(null_value.get(), GURL(kURL)).Pass()); + DistillPage(kURL, CreateMockDistillerPage(null_value.get(), GURL(kURL))); base::MessageLoop::current()->RunUntilIdle(); EXPECT_EQ("", article_proto_->title()); EXPECT_EQ(0, article_proto_->pages_size()); @@ -562,9 +560,9 @@ TEST_F(DistillerTest, MultiplePagesDistillationFailure) { // Expect only calls till the failed page number. distiller_.reset( new DistillerImpl(url_fetcher_factory_, DomDistillerOptions())); - DistillPage(distiller_data->page_urls[0], - CreateMockDistillerPages( - distiller_data.get(), failed_page_num + 1, 0).Pass()); + DistillPage( + distiller_data->page_urls[0], + CreateMockDistillerPages(distiller_data.get(), failed_page_num + 1, 0)); base::MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(kTitle, article_proto_->title()); VerifyArticleProtoMatchesMultipageData( @@ -583,8 +581,8 @@ TEST_F(DistillerTest, DistillPreviousPage) { distiller_.reset( new DistillerImpl(url_fetcher_factory_, DomDistillerOptions())); DistillPage(distiller_data->page_urls[start_page_num], - CreateMockDistillerPages( - distiller_data.get(), kNumPages, start_page_num).Pass()); + CreateMockDistillerPages(distiller_data.get(), kNumPages, + start_page_num)); base::MessageLoop::current()->RunUntilIdle(); VerifyArticleProtoMatchesMultipageData( article_proto_.get(), distiller_data.get(), kNumPages, kNumPages); @@ -602,8 +600,8 @@ TEST_F(DistillerTest, IncrementalUpdates) { distiller_.reset( new DistillerImpl(url_fetcher_factory_, DomDistillerOptions())); DistillPage(distiller_data->page_urls[start_page_num], - CreateMockDistillerPages( - distiller_data.get(), kNumPages, start_page_num).Pass()); + CreateMockDistillerPages(distiller_data.get(), kNumPages, + start_page_num)); base::MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(kTitle, article_proto_->title()); ASSERT_EQ(kNumPages, static_cast<size_t>(article_proto_->pages_size())); @@ -623,8 +621,8 @@ TEST_F(DistillerTest, IncrementalUpdatesDoNotDeleteFinalArticle) { distiller_.reset( new DistillerImpl(url_fetcher_factory_, DomDistillerOptions())); DistillPage(distiller_data->page_urls[start_page_num], - CreateMockDistillerPages( - distiller_data.get(), kNumPages, start_page_num).Pass()); + CreateMockDistillerPages(distiller_data.get(), kNumPages, + start_page_num)); base::MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(kNumPages, in_sequence_updates_.size()); @@ -646,8 +644,8 @@ TEST_F(DistillerTest, DeletingArticleDoesNotInterfereWithUpdates) { distiller_.reset( new DistillerImpl(url_fetcher_factory_, DomDistillerOptions())); DistillPage(distiller_data->page_urls[start_page_num], - CreateMockDistillerPages( - distiller_data.get(), kNumPages, start_page_num).Pass()); + CreateMockDistillerPages(distiller_data.get(), kNumPages, + start_page_num)); base::MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(kNumPages, in_sequence_updates_.size()); EXPECT_EQ(kTitle, article_proto_->title()); @@ -671,8 +669,7 @@ TEST_F(DistillerTest, CancelWithDelayedImageFetchCallback) { .WillOnce(Return(delayed_fetcher)); distiller_.reset( new DistillerImpl(mock_url_fetcher_factory, DomDistillerOptions())); - DistillPage( - kURL, CreateMockDistillerPage(distilled_value.get(), GURL(kURL)).Pass()); + DistillPage(kURL, CreateMockDistillerPage(distilled_value.get(), GURL(kURL))); base::MessageLoop::current()->RunUntilIdle(); // Post callback from the url fetcher and then delete the distiller. diff --git a/components/dom_distiller/core/dom_distiller_request_view_base.cc b/components/dom_distiller/core/dom_distiller_request_view_base.cc index ceb2868..3cec2bb 100644 --- a/components/dom_distiller/core/dom_distiller_request_view_base.cc +++ b/components/dom_distiller/core/dom_distiller_request_view_base.cc @@ -6,6 +6,7 @@ #include <sstream> #include <string> +#include <utility> #include <vector> #include "base/memory/scoped_ptr.h" @@ -114,7 +115,7 @@ void DomDistillerRequestViewBase::OnChangeFontScaling(float scaling) { void DomDistillerRequestViewBase::TakeViewerHandle( scoped_ptr<ViewerHandle> viewer_handle) { - viewer_handle_ = viewer_handle.Pass(); + viewer_handle_ = std::move(viewer_handle); // Getting the viewer handle means this is not an error page, send // the viewer JavaScript and show the loading indicator. SendCommonJavaScript(); diff --git a/components/dom_distiller/core/dom_distiller_service.cc b/components/dom_distiller/core/dom_distiller_service.cc index 80c2e9f..47d4f06 100644 --- a/components/dom_distiller/core/dom_distiller_service.cc +++ b/components/dom_distiller/core/dom_distiller_service.cc @@ -4,6 +4,8 @@ #include "components/dom_distiller/core/dom_distiller_service.h" +#include <utility> + #include "base/guid.h" #include "base/location.h" #include "base/message_loop/message_loop.h" @@ -44,12 +46,11 @@ DomDistillerService::DomDistillerService( scoped_ptr<DistillerFactory> distiller_factory, scoped_ptr<DistillerPageFactory> distiller_page_factory, scoped_ptr<DistilledPagePrefs> distilled_page_prefs) - : store_(store.Pass()), + : store_(std::move(store)), content_store_(new InMemoryContentStore(kDefaultMaxNumCachedEntries)), - distiller_factory_(distiller_factory.Pass()), - distiller_page_factory_(distiller_page_factory.Pass()), - distilled_page_prefs_(distilled_page_prefs.Pass()) { -} + distiller_factory_(std::move(distiller_factory)), + distiller_page_factory_(std::move(distiller_page_factory)), + distilled_page_prefs_(std::move(distilled_page_prefs)) {} DomDistillerService::~DomDistillerService() { } @@ -60,14 +61,14 @@ syncer::SyncableService* DomDistillerService::GetSyncableService() const { scoped_ptr<DistillerPage> DomDistillerService::CreateDefaultDistillerPage( const gfx::Size& render_view_size) { - return distiller_page_factory_->CreateDistillerPage(render_view_size).Pass(); + return distiller_page_factory_->CreateDistillerPage(render_view_size); } scoped_ptr<DistillerPage> DomDistillerService::CreateDefaultDistillerPageWithHandle( scoped_ptr<SourcePageHandle> handle) { - return distiller_page_factory_->CreateDistillerPageWithHandle(handle.Pass()) - .Pass(); + return distiller_page_factory_->CreateDistillerPageWithHandle( + std::move(handle)); } const std::string DomDistillerService::AddToList( @@ -104,7 +105,7 @@ const std::string DomDistillerService::AddToList( task_tracker->AddSaveCallback(base::Bind( &DomDistillerService::AddDistilledPageToList, base::Unretained(this))); task_tracker->StartDistiller(distiller_factory_.get(), - distiller_page.Pass()); + std::move(distiller_page)); task_tracker->StartBlobFetcher(); } @@ -141,7 +142,7 @@ scoped_ptr<ArticleEntry> DomDistillerService::RemoveEntry( } if (store_->RemoveEntry(*entry)) { - return entry.Pass(); + return entry; } return scoped_ptr<ArticleEntry>(); } @@ -160,11 +161,11 @@ scoped_ptr<ViewerHandle> DomDistillerService::ViewEntry( scoped_ptr<ViewerHandle> viewer_handle = task_tracker->AddViewer(delegate); if (was_created) { task_tracker->StartDistiller(distiller_factory_.get(), - distiller_page.Pass()); + std::move(distiller_page)); task_tracker->StartBlobFetcher(); } - return viewer_handle.Pass(); + return viewer_handle; } scoped_ptr<ViewerHandle> DomDistillerService::ViewUrl( @@ -181,11 +182,11 @@ scoped_ptr<ViewerHandle> DomDistillerService::ViewUrl( // If a distiller is already running for one URL, don't start another. if (was_created) { task_tracker->StartDistiller(distiller_factory_.get(), - distiller_page.Pass()); + std::move(distiller_page)); task_tracker->StartBlobFetcher(); } - return viewer_handle.Pass(); + return viewer_handle; } bool DomDistillerService::GetOrCreateTaskTrackerForUrl( diff --git a/components/dom_distiller/core/dom_distiller_service_unittest.cc b/components/dom_distiller/core/dom_distiller_service_unittest.cc index 868b398..de66458 100644 --- a/components/dom_distiller/core/dom_distiller_service_unittest.cc +++ b/components/dom_distiller/core/dom_distiller_service_unittest.cc @@ -4,6 +4,8 @@ #include "components/dom_distiller/core/dom_distiller_service.h" +#include <utility> + #include "base/bind.h" #include "base/callback.h" #include "base/containers/hash_tables.h" @@ -59,7 +61,7 @@ DomDistillerService::ArticleAvailableCallback ArticleCallback( void RunDistillerCallback(FakeDistiller* distiller, scoped_ptr<DistilledArticleProto> proto) { - distiller->RunDistillerCallback(proto.Pass()); + distiller->RunDistillerCallback(std::move(proto)); base::RunLoop().RunUntilIdle(); } @@ -67,12 +69,11 @@ scoped_ptr<DistilledArticleProto> CreateArticleWithURL(const std::string& url) { scoped_ptr<DistilledArticleProto> proto(new DistilledArticleProto); DistilledPageProto* page = proto->add_pages(); page->set_url(url); - return proto.Pass(); + return proto; } scoped_ptr<DistilledArticleProto> CreateDefaultArticle() { - return CreateArticleWithURL("http://www.example.com/default_article_page1") - .Pass(); + return CreateArticleWithURL("http://www.example.com/default_article_page1"); } } // namespace @@ -136,7 +137,7 @@ TEST_F(DomDistillerServiceTest, TestViewEntry) { scoped_ptr<DistilledArticleProto> proto = CreateDefaultArticle(); EXPECT_CALL(viewer_delegate, OnArticleReady(proto.get())); - RunDistillerCallback(distiller, proto.Pass()); + RunDistillerCallback(distiller, std::move(proto)); } TEST_F(DomDistillerServiceTest, TestViewUrl) { @@ -155,7 +156,7 @@ TEST_F(DomDistillerServiceTest, TestViewUrl) { scoped_ptr<DistilledArticleProto> proto = CreateDefaultArticle(); EXPECT_CALL(viewer_delegate, OnArticleReady(proto.get())); - RunDistillerCallback(distiller, proto.Pass()); + RunDistillerCallback(distiller, std::move(proto)); } TEST_F(DomDistillerServiceTest, TestMultipleViewUrl) { @@ -183,7 +184,7 @@ TEST_F(DomDistillerServiceTest, TestMultipleViewUrl) { scoped_ptr<DistilledArticleProto> proto = CreateDefaultArticle(); EXPECT_CALL(viewer_delegate, OnArticleReady(proto.get())); - RunDistillerCallback(distiller, proto.Pass()); + RunDistillerCallback(distiller, std::move(proto)); ASSERT_FALSE(distiller2->GetArticleCallback().is_null()); EXPECT_EQ(url2, distiller2->GetUrl()); @@ -191,7 +192,7 @@ TEST_F(DomDistillerServiceTest, TestMultipleViewUrl) { scoped_ptr<DistilledArticleProto> proto2 = CreateDefaultArticle(); EXPECT_CALL(viewer_delegate2, OnArticleReady(proto2.get())); - RunDistillerCallback(distiller2, proto2.Pass()); + RunDistillerCallback(distiller2, std::move(proto2)); } TEST_F(DomDistillerServiceTest, TestViewUrlCancelled) { @@ -233,7 +234,7 @@ TEST_F(DomDistillerServiceTest, TestViewUrlDoesNotAddEntry) { scoped_ptr<DistilledArticleProto> proto = CreateArticleWithURL(url.spec()); EXPECT_CALL(viewer_delegate, OnArticleReady(proto.get())); - RunDistillerCallback(distiller, proto.Pass()); + RunDistillerCallback(distiller, std::move(proto)); base::RunLoop().RunUntilIdle(); // The entry should not be added to the store. EXPECT_EQ(0u, store_->GetEntries().size()); @@ -249,16 +250,15 @@ TEST_F(DomDistillerServiceTest, TestAddAndRemoveEntry) { MockArticleAvailableCallback article_cb; EXPECT_CALL(article_cb, DistillationCompleted(true)); - std::string entry_id = - service_->AddToList(url, - service_->CreateDefaultDistillerPage(gfx::Size()).Pass(), - ArticleCallback(&article_cb)); + std::string entry_id = service_->AddToList( + url, service_->CreateDefaultDistillerPage(gfx::Size()), + ArticleCallback(&article_cb)); ASSERT_FALSE(distiller->GetArticleCallback().is_null()); EXPECT_EQ(url, distiller->GetUrl()); scoped_ptr<DistilledArticleProto> proto = CreateArticleWithURL(url.spec()); - RunDistillerCallback(distiller, proto.Pass()); + RunDistillerCallback(distiller, std::move(proto)); ArticleEntry entry; EXPECT_TRUE(store_->GetEntryByUrl(url, &entry)); @@ -281,10 +281,9 @@ TEST_F(DomDistillerServiceTest, TestCancellation) { EXPECT_CALL(article_cb, DistillationCompleted(false)); GURL url("http://www.example.com/p1"); - std::string entry_id = - service_->AddToList(url, - service_->CreateDefaultDistillerPage(gfx::Size()).Pass(), - ArticleCallback(&article_cb)); + std::string entry_id = service_->AddToList( + url, service_->CreateDefaultDistillerPage(gfx::Size()), + ArticleCallback(&article_cb)); // Remove entry will cause the |article_cb| to be called with false value. service_->RemoveEntry(entry_id); @@ -305,8 +304,7 @@ TEST_F(DomDistillerServiceTest, TestMultipleObservers) { DomDistillerService::ArticleAvailableCallback article_cb; GURL url("http://www.example.com/p1"); std::string entry_id = service_->AddToList( - url, service_->CreateDefaultDistillerPage(gfx::Size()).Pass(), - article_cb); + url, service_->CreateDefaultDistillerPage(gfx::Size()), article_cb); // Distillation should notify all observers that article is added. std::vector<DomDistillerObserver::ArticleUpdate> expected_updates; @@ -321,7 +319,7 @@ TEST_F(DomDistillerServiceTest, TestMultipleObservers) { } scoped_ptr<DistilledArticleProto> proto = CreateDefaultArticle(); - RunDistillerCallback(distiller, proto.Pass()); + RunDistillerCallback(distiller, std::move(proto)); // Remove should notify all observers that article is removed. update.update_type = DomDistillerObserver::ArticleUpdate::REMOVE; @@ -345,31 +343,28 @@ TEST_F(DomDistillerServiceTest, TestMultipleCallbacks) { MockArticleAvailableCallback article_cb[kClientsCount]; // Adding a URL and then distilling calls all clients. GURL url("http://www.example.com/p1"); - const std::string entry_id = - service_->AddToList(url, - service_->CreateDefaultDistillerPage(gfx::Size()).Pass(), - ArticleCallback(&article_cb[0])); + const std::string entry_id = service_->AddToList( + url, service_->CreateDefaultDistillerPage(gfx::Size()), + ArticleCallback(&article_cb[0])); EXPECT_CALL(article_cb[0], DistillationCompleted(true)); for (int i = 1; i < kClientsCount; ++i) { EXPECT_EQ(entry_id, service_->AddToList( - url, - service_->CreateDefaultDistillerPage(gfx::Size()).Pass(), + url, service_->CreateDefaultDistillerPage(gfx::Size()), ArticleCallback(&article_cb[i]))); EXPECT_CALL(article_cb[i], DistillationCompleted(true)); } scoped_ptr<DistilledArticleProto> proto = CreateArticleWithURL(url.spec()); - RunDistillerCallback(distiller, proto.Pass()); + RunDistillerCallback(distiller, std::move(proto)); // Add the same url again, all callbacks should be called with true. for (int i = 0; i < kClientsCount; ++i) { EXPECT_CALL(article_cb[i], DistillationCompleted(true)); EXPECT_EQ(entry_id, service_->AddToList( - url, - service_->CreateDefaultDistillerPage(gfx::Size()).Pass(), + url, service_->CreateDefaultDistillerPage(gfx::Size()), ArticleCallback(&article_cb[i]))); } @@ -386,16 +381,15 @@ TEST_F(DomDistillerServiceTest, TestMultipleCallbacksOnRemove) { // Adding a URL and remove the entry before distillation. Callback should be // called with false. GURL url("http://www.example.com/p1"); - const std::string entry_id = - service_->AddToList(url, - service_->CreateDefaultDistillerPage(gfx::Size()).Pass(), - ArticleCallback(&article_cb[0])); + const std::string entry_id = service_->AddToList( + url, service_->CreateDefaultDistillerPage(gfx::Size()), + ArticleCallback(&article_cb[0])); EXPECT_CALL(article_cb[0], DistillationCompleted(false)); for (int i = 1; i < kClientsCount; ++i) { EXPECT_EQ(entry_id, service_->AddToList( - url, service_->CreateDefaultDistillerPage(gfx::Size()).Pass(), + url, service_->CreateDefaultDistillerPage(gfx::Size()), ArticleCallback(&article_cb[i]))); EXPECT_CALL(article_cb[i], DistillationCompleted(false)); } @@ -421,7 +415,7 @@ TEST_F(DomDistillerServiceTest, TestMultiplePageArticle) { EXPECT_CALL(article_cb, DistillationCompleted(true)); std::string entry_id = service_->AddToList( - pages_url[0], service_->CreateDefaultDistillerPage(gfx::Size()).Pass(), + pages_url[0], service_->CreateDefaultDistillerPage(gfx::Size()), ArticleCallback(&article_cb)); ArticleEntry entry; @@ -436,7 +430,7 @@ TEST_F(DomDistillerServiceTest, TestMultiplePageArticle) { distilled_page->set_url(pages_url[page_num].spec()); } - RunDistillerCallback(distiller, proto.Pass()); + RunDistillerCallback(distiller, std::move(proto)); EXPECT_TRUE(store_->GetEntryByUrl(pages_url[0], &entry)); EXPECT_EQ(kPageCount, entry.pages_size()); @@ -469,15 +463,14 @@ TEST_F(DomDistillerServiceTest, TestHasEntry) { EXPECT_CALL(article_cb, DistillationCompleted(true)); std::string entry_id = service_->AddToList( - url, - service_->CreateDefaultDistillerPage(gfx::Size()).Pass(), + url, service_->CreateDefaultDistillerPage(gfx::Size()), ArticleCallback(&article_cb)); ASSERT_FALSE(distiller->GetArticleCallback().is_null()); EXPECT_EQ(url, distiller->GetUrl()); scoped_ptr<DistilledArticleProto> proto = CreateArticleWithURL(url.spec()); - RunDistillerCallback(distiller, proto.Pass()); + RunDistillerCallback(distiller, std::move(proto)); // Check that HasEntry returns true for the article just added. EXPECT_TRUE(service_->HasEntry(entry_id)); @@ -501,15 +494,14 @@ TEST_F(DomDistillerServiceTest, TestGetUrlForOnePageEntry) { EXPECT_CALL(article_cb, DistillationCompleted(true)); std::string entry_id = service_->AddToList( - url, - service_->CreateDefaultDistillerPage(gfx::Size()).Pass(), + url, service_->CreateDefaultDistillerPage(gfx::Size()), ArticleCallback(&article_cb)); ASSERT_FALSE(distiller->GetArticleCallback().is_null()); EXPECT_EQ(url, distiller->GetUrl()); scoped_ptr<DistilledArticleProto> proto = CreateArticleWithURL(url.spec()); - RunDistillerCallback(distiller, proto.Pass()); + RunDistillerCallback(distiller, std::move(proto)); // Check if retrieved URL is same as given URL. GURL retrieved_url(service_->GetUrlForEntry(entry_id)); @@ -540,8 +532,7 @@ TEST_F(DomDistillerServiceTest, TestGetUrlForMultiPageEntry) { EXPECT_CALL(article_cb, DistillationCompleted(true)); std::string entry_id = service_->AddToList( - pages_url[0], - service_->CreateDefaultDistillerPage(gfx::Size()).Pass(), + pages_url[0], service_->CreateDefaultDistillerPage(gfx::Size()), ArticleCallback(&article_cb)); ArticleEntry entry; @@ -556,7 +547,7 @@ TEST_F(DomDistillerServiceTest, TestGetUrlForMultiPageEntry) { distilled_page->set_url(pages_url[page_num].spec()); } - RunDistillerCallback(distiller, proto.Pass()); + RunDistillerCallback(distiller, std::move(proto)); EXPECT_TRUE(store_->GetEntryByUrl(pages_url[0], &entry)); // Check if retrieved URL is same as given URL for the first page. diff --git a/components/dom_distiller/core/dom_distiller_store.cc b/components/dom_distiller/core/dom_distiller_store.cc index 4a4cd1e..2ed0ff5 100644 --- a/components/dom_distiller/core/dom_distiller_store.cc +++ b/components/dom_distiller/core/dom_distiller_store.cc @@ -5,6 +5,7 @@ #include "components/dom_distiller/core/dom_distiller_store.h" #include <stddef.h> +#include <utility> #include "base/bind.h" #include "base/location.h" @@ -38,9 +39,9 @@ const char kDatabaseUMAClientName[] = "DomDistillerStore"; namespace dom_distiller { DomDistillerStore::DomDistillerStore( - scoped_ptr<ProtoDatabase<ArticleEntry> > database, + scoped_ptr<ProtoDatabase<ArticleEntry>> database, const base::FilePath& database_dir) - : database_(database.Pass()), + : database_(std::move(database)), database_loaded_(false), attachment_store_(syncer::AttachmentStore::CreateInMemoryStore()), weak_ptr_factory_(this) { @@ -50,10 +51,10 @@ DomDistillerStore::DomDistillerStore( } DomDistillerStore::DomDistillerStore( - scoped_ptr<ProtoDatabase<ArticleEntry> > database, + scoped_ptr<ProtoDatabase<ArticleEntry>> database, const std::vector<ArticleEntry>& initial_data, const base::FilePath& database_dir) - : database_(database.Pass()), + : database_(std::move(database)), database_loaded_(false), attachment_store_(syncer::AttachmentStore::CreateInMemoryStore()), model_(initial_data), @@ -438,7 +439,8 @@ bool DomDistillerStore::ApplyChangesToDatabase( entries_to_save->push_back(std::make_pair(entry.entry_id(), entry)); } } - database_->UpdateEntries(entries_to_save.Pass(), keys_to_remove.Pass(), + database_->UpdateEntries(std::move(entries_to_save), + std::move(keys_to_remove), base::Bind(&DomDistillerStore::OnDatabaseSave, weak_ptr_factory_.GetWeakPtr())); return true; diff --git a/components/dom_distiller/core/dom_distiller_store_unittest.cc b/components/dom_distiller/core/dom_distiller_store_unittest.cc index addc721..c962aa4 100644 --- a/components/dom_distiller/core/dom_distiller_store_unittest.cc +++ b/components/dom_distiller/core/dom_distiller_store_unittest.cc @@ -5,6 +5,7 @@ #include "components/dom_distiller/core/dom_distiller_store.h" #include <stdint.h> +#include <utility> #include "base/bind.h" #include "base/files/file_util.h" @@ -522,9 +523,8 @@ TEST_F(DomDistillerStoreTest, TestSyncMergeWithSecondDomDistillerStore) { FakeSyncErrorFactory* other_error_factory = new FakeSyncErrorFactory(); store_->MergeDataAndStartSyncing( - kDomDistillerModelType, - SyncDataFromEntryMap(other_db_model), - owned_other_store.Pass(), + kDomDistillerModelType, SyncDataFromEntryMap(other_db_model), + std::move(owned_other_store), make_scoped_ptr<SyncErrorFactory>(other_error_factory)); EXPECT_TRUE(AreEntriesEqual(store_->GetEntries(), expected_model)); diff --git a/components/dom_distiller/core/fake_distiller.cc b/components/dom_distiller/core/fake_distiller.cc index 85aee15..315490a 100644 --- a/components/dom_distiller/core/fake_distiller.cc +++ b/components/dom_distiller/core/fake_distiller.cc @@ -4,6 +4,8 @@ #include "components/dom_distiller/core/fake_distiller.h" +#include <utility> + #include "base/auto_reset.h" #include "base/bind.h" #include "base/callback_helpers.h" @@ -52,7 +54,7 @@ void FakeDistiller::DistillPage( if (execute_callback_) { scoped_ptr<DistilledArticleProto> proto(new DistilledArticleProto); proto->add_pages()->set_url(url_.spec()); - PostDistillerCallback(proto.Pass()); + PostDistillerCallback(std::move(proto)); } } @@ -61,7 +63,7 @@ void FakeDistiller::RunDistillerCallback( ASSERT_FALSE(execute_callback_) << "Cannot explicitly run the distiller " "callback for a fake distiller created " "with automatic callback execution."; - PostDistillerCallback(proto.Pass()); + PostDistillerCallback(std::move(proto)); } void FakeDistiller::RunDistillerUpdateCallback( @@ -83,7 +85,7 @@ void FakeDistiller::RunDistillerCallbackInternal( base::AutoReset<bool> dont_delete_this_in_callback(&destruction_allowed_, false); - article_callback_.Run(proto.Pass()); + article_callback_.Run(std::move(proto)); article_callback_.Reset(); } diff --git a/components/dom_distiller/core/task_tracker.cc b/components/dom_distiller/core/task_tracker.cc index cfcd909..abb4565 100644 --- a/components/dom_distiller/core/task_tracker.cc +++ b/components/dom_distiller/core/task_tracker.cc @@ -5,6 +5,7 @@ #include "components/dom_distiller/core/task_tracker.h" #include <stddef.h> +#include <utility> #include "base/auto_reset.h" #include "base/location.h" @@ -55,8 +56,7 @@ void TaskTracker::StartDistiller(DistillerFactory* factory, DCHECK(url.is_valid()); distiller_ = factory->CreateDistillerForUrl(url); - distiller_->DistillPage(url, - distiller_page.Pass(), + distiller_->DistillPage(url, std::move(distiller_page), base::Bind(&TaskTracker::OnDistillerFinished, weak_ptr_factory_.GetWeakPtr()), base::Bind(&TaskTracker::OnArticleDistillationUpdated, @@ -145,7 +145,7 @@ void TaskTracker::OnDistillerFinished( return; } - DistilledArticleReady(distilled_article.Pass()); + DistilledArticleReady(std::move(distilled_article)); if (content_ready_) { AddDistilledContentToStore(*distilled_article_); } @@ -172,7 +172,7 @@ void TaskTracker::OnBlobFetched( return; } - DistilledArticleReady(distilled_article.Pass()); + DistilledArticleReady(std::move(distilled_article)); ContentSourceFinished(); } @@ -200,7 +200,7 @@ void TaskTracker::DistilledArticleReady( content_ready_ = true; - distilled_article_ = distilled_article.Pass(); + distilled_article_ = std::move(distilled_article); entry_.set_title(distilled_article_->title()); entry_.clear_pages(); for (int i = 0; i < distilled_article_->pages_size(); ++i) { diff --git a/components/dom_distiller/core/task_tracker_unittest.cc b/components/dom_distiller/core/task_tracker_unittest.cc index d673553f..bb5adce 100644 --- a/components/dom_distiller/core/task_tracker_unittest.cc +++ b/components/dom_distiller/core/task_tracker_unittest.cc @@ -4,6 +4,8 @@ #include "components/dom_distiller/core/task_tracker.h" +#include <utility> + #include "base/run_loop.h" #include "components/dom_distiller/core/article_distillation_update.h" #include "components/dom_distiller/core/article_entry.h" @@ -152,8 +154,7 @@ TEST_F(DomDistillerTaskTrackerTest, TestViewerNotifiedOnDistillationComplete) { EXPECT_CALL(viewer_delegate, OnArticleReady(_)); - task_tracker.StartDistiller(&distiller_factory, - scoped_ptr<DistillerPage>().Pass()); + task_tracker.StartDistiller(&distiller_factory, scoped_ptr<DistillerPage>()); base::RunLoop().RunUntilIdle(); EXPECT_FALSE(cancel_callback.Cancelled()); @@ -175,8 +176,7 @@ TEST_F(DomDistillerTaskTrackerTest, TestDistillerFails) { EXPECT_CALL(viewer_delegate, OnArticleReady(_)); - task_tracker.StartDistiller(&distiller_factory, - scoped_ptr<DistillerPage>().Pass()); + task_tracker.StartDistiller(&distiller_factory, scoped_ptr<DistillerPage>()); distiller->RunDistillerCallback( scoped_ptr<DistilledArticleProto>(new DistilledArticleProto)); base::RunLoop().RunUntilIdle(); @@ -201,8 +201,7 @@ TEST_F(DomDistillerTaskTrackerTest, EXPECT_CALL(save_callback, Save(_, _, _)); - task_tracker.StartDistiller(&distiller_factory, - scoped_ptr<DistillerPage>().Pass()); + task_tracker.StartDistiller(&distiller_factory, scoped_ptr<DistillerPage>()); base::RunLoop().RunUntilIdle(); EXPECT_TRUE(cancel_callback.Cancelled()); @@ -275,8 +274,7 @@ TEST_F(DomDistillerTaskTrackerTest, TestBlobFetcherFinishesFirst) { EXPECT_CALL(*distiller, Die()) .WillOnce(testing::Assign(&distiller_destroyed, true)); - task_tracker.StartDistiller(&distiller_factory, - scoped_ptr<DistillerPage>().Pass()); + task_tracker.StartDistiller(&distiller_factory, scoped_ptr<DistillerPage>()); task_tracker.StartBlobFetcher(); base::RunLoop().RunUntilIdle(); @@ -309,8 +307,7 @@ TEST_F(DomDistillerTaskTrackerTest, TestBlobFetcherWithoutBlob) { base::RunLoop().RunUntilIdle(); task_tracker.StartBlobFetcher(); - task_tracker.StartDistiller(&distiller_factory, - scoped_ptr<DistillerPage>().Pass()); + task_tracker.StartDistiller(&distiller_factory, scoped_ptr<DistillerPage>()); // OnArticleReady shouldn't be called until distillation finishes (i.e. the // blob fetcher shouldn't return distilled content). @@ -318,7 +315,7 @@ TEST_F(DomDistillerTaskTrackerTest, TestBlobFetcherWithoutBlob) { base::RunLoop().RunUntilIdle(); EXPECT_CALL(viewer_delegate, OnArticleReady(_)); - distiller->RunDistillerCallback(distilled_article.Pass()); + distiller->RunDistillerCallback(std::move(distilled_article)); base::RunLoop().RunUntilIdle(); EXPECT_FALSE(cancel_callback.Cancelled()); @@ -344,8 +341,7 @@ TEST_F(DomDistillerTaskTrackerTest, TestDistillerFailsFirst) { EXPECT_CALL(content_store, LoadContent(_, _)) .WillOnce(testing::SaveArg<1>(&content_store_load_callback)); - task_tracker.StartDistiller(&distiller_factory, - scoped_ptr<DistillerPage>().Pass()); + task_tracker.StartDistiller(&distiller_factory, scoped_ptr<DistillerPage>()); task_tracker.StartBlobFetcher(); EXPECT_CALL(viewer_delegate, OnArticleReady(_)).Times(0); @@ -386,8 +382,7 @@ TEST_F(DomDistillerTaskTrackerTest, ContentIsSaved) { EXPECT_CALL(content_store, SaveContent(_, _, _)) .WillOnce(testing::SaveArg<1>(&stored_distilled_article)); - task_tracker.StartDistiller(&distiller_factory, - scoped_ptr<DistillerPage>().Pass()); + task_tracker.StartDistiller(&distiller_factory, scoped_ptr<DistillerPage>()); EXPECT_CALL(viewer_delegate, OnArticleReady(_)); distiller->RunDistillerCallback(scoped_ptr<DistilledArticleProto>( diff --git a/components/dom_distiller/core/viewer.cc b/components/dom_distiller/core/viewer.cc index 9d603b8..f0ebdc93 100644 --- a/components/dom_distiller/core/viewer.cc +++ b/components/dom_distiller/core/viewer.cc @@ -292,12 +292,12 @@ scoped_ptr<ViewerHandle> CreateViewRequest( return dom_distiller_service->ViewEntry( view_request_delegate, dom_distiller_service->CreateDefaultDistillerPage(render_view_size), - entry_id).Pass(); + entry_id); } else if (has_valid_url) { return dom_distiller_service->ViewUrl( view_request_delegate, dom_distiller_service->CreateDefaultDistillerPage(render_view_size), - requested_url).Pass(); + requested_url); } // It is invalid to not specify a query param for |kEntryIdKey| or |kUrlKey|. diff --git a/components/dom_distiller/standalone/content_extractor_browsertest.cc b/components/dom_distiller/standalone/content_extractor_browsertest.cc index c81ea20..1636bc6 100644 --- a/components/dom_distiller/standalone/content_extractor_browsertest.cc +++ b/components/dom_distiller/standalone/content_extractor_browsertest.cc @@ -3,8 +3,8 @@ // found in the LICENSE file. #include <stddef.h> - #include <sstream> +#include <utility> #include "base/command_line.h" #include "base/files/scoped_temp_dir.h" @@ -58,10 +58,10 @@ class TestDistillerFactoryImpl : public DistillerFactory { scoped_ptr<DistillerURLFetcherFactory> distiller_url_fetcher_factory, const dom_distiller::proto::DomDistillerOptions& dom_distiller_options, const FileToUrlMap& file_to_url_map) - : distiller_url_fetcher_factory_(distiller_url_fetcher_factory.Pass()), + : distiller_url_fetcher_factory_( + std::move(distiller_url_fetcher_factory)), dom_distiller_options_(dom_distiller_options), - file_to_url_map_(file_to_url_map) { - } + file_to_url_map_(file_to_url_map) {} ~TestDistillerFactoryImpl() override {} @@ -74,7 +74,7 @@ class TestDistillerFactoryImpl : public DistillerFactory { } scoped_ptr<DistillerImpl> distiller(new DistillerImpl( *distiller_url_fetcher_factory_, options)); - return distiller.Pass(); + return std::move(distiller); } private: @@ -134,7 +134,7 @@ scoped_ptr<DomDistillerService> CreateDomDistillerService( new leveldb_proto::ProtoDatabaseImpl<ArticleEntry>( background_task_runner)); scoped_ptr<DomDistillerStore> dom_distiller_store( - new DomDistillerStore(db.Pass(), db_path)); + new DomDistillerStore(std::move(db), db_path)); scoped_ptr<DistillerPageFactory> distiller_page_factory( new DistillerPageWebContentsFactory(context)); @@ -163,10 +163,8 @@ scoped_ptr<DomDistillerService> CreateDomDistillerService( kPaginationAlgo)); } - scoped_ptr<DistillerFactory> distiller_factory( - new TestDistillerFactoryImpl(distiller_url_fetcher_factory.Pass(), - options, - file_to_url_map)); + scoped_ptr<DistillerFactory> distiller_factory(new TestDistillerFactoryImpl( + std::move(distiller_url_fetcher_factory), options, file_to_url_map)); // Setting up PrefService for DistilledPagePrefs. user_prefs::TestingPrefServiceSyncable* pref_service = @@ -174,9 +172,8 @@ scoped_ptr<DomDistillerService> CreateDomDistillerService( DistilledPagePrefs::RegisterProfilePrefs(pref_service->registry()); return scoped_ptr<DomDistillerService>(new DomDistillerService( - dom_distiller_store.Pass(), - distiller_factory.Pass(), - distiller_page_factory.Pass(), + std::move(dom_distiller_store), std::move(distiller_factory), + std::move(distiller_page_factory), scoped_ptr<DistilledPagePrefs>(new DistilledPagePrefs(pref_service)))); } @@ -295,7 +292,7 @@ class ContentExtractionRequest : public ViewRequestDelegate { ADD_FAILURE() << "No valid url provided"; } - return requests.Pass(); + return requests; } private: diff --git a/components/domain_reliability/beacon.cc b/components/domain_reliability/beacon.cc index 1742158..fb176cb 100644 --- a/components/domain_reliability/beacon.cc +++ b/components/domain_reliability/beacon.cc @@ -4,6 +4,8 @@ #include "components/domain_reliability/beacon.h" +#include <utility> + #include "base/values.h" #include "components/domain_reliability/util.h" #include "net/base/net_errors.h" @@ -47,7 +49,7 @@ scoped_ptr<Value> DomainReliabilityBeacon::ToValue( bool network_changed = last_network_change_time > start_time; beacon_value->SetBoolean("network_changed", network_changed); beacon_value->SetDouble("sample_rate", sample_rate); - return beacon_value.Pass(); + return std::move(beacon_value); } } // namespace domain_reliability diff --git a/components/domain_reliability/config.cc b/components/domain_reliability/config.cc index dc47345..c5715e0 100644 --- a/components/domain_reliability/config.cc +++ b/components/domain_reliability/config.cc @@ -10,6 +10,7 @@ #include "components/domain_reliability/config.h" #include <stdint.h> +#include <utility> #include "base/json/json_reader.h" #include "base/json/json_value_converter.h" @@ -57,7 +58,7 @@ scoped_ptr<const DomainReliabilityConfig> DomainReliabilityConfig::FromJSON( // If we can parse and convert the JSON into a valid config, return that. if (value && converter.Convert(*value, config.get()) && config->IsValid()) - return config.Pass(); + return std::move(config); return scoped_ptr<const DomainReliabilityConfig>(); } diff --git a/components/domain_reliability/config_unittest.cc b/components/domain_reliability/config_unittest.cc index ca4904c..8af3258 100644 --- a/components/domain_reliability/config_unittest.cc +++ b/components/domain_reliability/config_unittest.cc @@ -29,7 +29,7 @@ scoped_ptr<DomainReliabilityConfig> MakeSampleConfig() { config->path_prefixes.push_back(new std::string("/css/")); config->path_prefixes.push_back(new std::string("/js/")); EXPECT_TRUE(config->IsValid()); - return config.Pass(); + return config; } class DomainReliabilityConfigTest : public testing::Test { }; diff --git a/components/domain_reliability/context.cc b/components/domain_reliability/context.cc index 0615259..3dc324d 100644 --- a/components/domain_reliability/context.cc +++ b/components/domain_reliability/context.cc @@ -5,6 +5,7 @@ #include "components/domain_reliability/context.h" #include <algorithm> +#include <utility> #include "base/bind.h" #include "base/json/json_writer.h" @@ -48,7 +49,7 @@ DomainReliabilityContext::DomainReliabilityContext( DomainReliabilityDispatcher* dispatcher, DomainReliabilityUploader* uploader, scoped_ptr<const DomainReliabilityConfig> config) - : config_(config.Pass()), + : config_(std::move(config)), time_(time), upload_reporter_string_(upload_reporter_string), scheduler_(time, @@ -60,8 +61,7 @@ DomainReliabilityContext::DomainReliabilityContext( uploader_(uploader), uploading_beacons_size_(0), last_network_change_time_(last_network_change_time), - weak_factory_(this) { -} + weak_factory_(this) {} DomainReliabilityContext::~DomainReliabilityContext() { ClearBeacons(); @@ -216,7 +216,7 @@ scoped_ptr<const Value> DomainReliabilityContext::CreateReport( report_value->Set("entries", beacons_value.release()); *max_upload_depth_out = max_upload_depth; - return report_value.Pass(); + return std::move(report_value); } void DomainReliabilityContext::MarkUpload() { diff --git a/components/domain_reliability/context_manager.cc b/components/domain_reliability/context_manager.cc index 4328f66..98fe6a9 100644 --- a/components/domain_reliability/context_manager.cc +++ b/components/domain_reliability/context_manager.cc @@ -4,6 +4,8 @@ #include "components/domain_reliability/context_manager.h" +#include <utility> + namespace domain_reliability { DomainReliabilityContextManager::DomainReliabilityContextManager( @@ -21,7 +23,7 @@ void DomainReliabilityContextManager::RouteBeacon( if (!context) return; - context->OnBeacon(beacon.Pass()); + context->OnBeacon(std::move(beacon)); } void DomainReliabilityContextManager::ClearBeaconsInAllContexts() { @@ -39,7 +41,7 @@ DomainReliabilityContext* DomainReliabilityContextManager::AddContextForConfig( std::string domain = wildcard_prefix + config->origin.host(); scoped_ptr<DomainReliabilityContext> context = - context_factory_->CreateContextForConfig(config.Pass()); + context_factory_->CreateContextForConfig(std::move(config)); DomainReliabilityContext** entry = &contexts_[domain]; if (*entry) delete *entry; @@ -57,7 +59,7 @@ scoped_ptr<base::Value> DomainReliabilityContextManager::GetWebUIData() const { scoped_ptr<base::ListValue> contexts_value(new base::ListValue()); for (const auto& context_entry : contexts_) contexts_value->Append(context_entry.second->GetWebUIData().release()); - return contexts_value.Pass(); + return std::move(contexts_value); } DomainReliabilityContext* DomainReliabilityContextManager::GetContextForHost( diff --git a/components/domain_reliability/context_unittest.cc b/components/domain_reliability/context_unittest.cc index 6789e10..3c83b35 100644 --- a/components/domain_reliability/context_unittest.cc +++ b/components/domain_reliability/context_unittest.cc @@ -5,9 +5,9 @@ #include "components/domain_reliability/context.h" #include <stddef.h> - #include <map> #include <string> +#include <utility> #include "base/bind.h" #include "base/json/json_reader.h" @@ -48,7 +48,7 @@ scoped_ptr<DomainReliabilityBeacon> MakeCustomizedBeacon( beacon->start_time = time->NowTicks() - beacon->elapsed; beacon->upload_depth = 0; beacon->sample_rate = 1.0; - return beacon.Pass(); + return beacon; } scoped_ptr<DomainReliabilityBeacon> MakeBeacon(MockableTime* time) { @@ -105,13 +105,8 @@ class DomainReliabilityContextTest : public testing::Test { void InitContext(scoped_ptr<const DomainReliabilityConfig> config) { context_.reset(new DomainReliabilityContext( - &time_, - params_, - upload_reporter_string_, - &last_network_change_time_, - &dispatcher_, - &uploader_, - config.Pass())); + &time_, params_, upload_reporter_string_, &last_network_change_time_, + &dispatcher_, &uploader_, std::move(config))); } TimeDelta min_delay() const { return params_.minimum_upload_delay; } @@ -196,7 +191,7 @@ TEST_F(DomainReliabilityContextTest, MaxNestedBeaconSchedules) { GURL url("http://example/always_report"); scoped_ptr<DomainReliabilityBeacon> beacon = MakeBeacon(&time_); beacon->upload_depth = DomainReliabilityContext::kMaxUploadDepthToSchedule; - context_->OnBeacon(beacon.Pass()); + context_->OnBeacon(std::move(beacon)); BeaconVector beacons; context_->GetQueuedBeaconsForTesting(&beacons); @@ -212,7 +207,7 @@ TEST_F(DomainReliabilityContextTest, OverlyNestedBeaconDoesNotSchedule) { scoped_ptr<DomainReliabilityBeacon> beacon = MakeBeacon(&time_); beacon->upload_depth = DomainReliabilityContext::kMaxUploadDepthToSchedule + 1; - context_->OnBeacon(beacon.Pass()); + context_->OnBeacon(std::move(beacon)); BeaconVector beacons; context_->GetQueuedBeaconsForTesting(&beacons); @@ -229,7 +224,7 @@ TEST_F(DomainReliabilityContextTest, scoped_ptr<DomainReliabilityBeacon> beacon = MakeBeacon(&time_); beacon->upload_depth = DomainReliabilityContext::kMaxUploadDepthToSchedule + 1; - context_->OnBeacon(beacon.Pass()); + context_->OnBeacon(std::move(beacon)); BeaconVector beacons; context_->GetQueuedBeaconsForTesting(&beacons); @@ -242,7 +237,7 @@ TEST_F(DomainReliabilityContextTest, // doesn't schedule until the deadline. beacon = MakeBeacon(&time_); beacon->upload_depth = DomainReliabilityContext::kMaxUploadDepthToSchedule; - context_->OnBeacon(beacon.Pass()); + context_->OnBeacon(std::move(beacon)); context_->GetQueuedBeaconsForTesting(&beacons); EXPECT_EQ(2u, beacons.size()); @@ -417,7 +412,7 @@ TEST_F(DomainReliabilityContextTest, TEST_F(DomainReliabilityContextTest, ZeroSampleRate) { scoped_ptr<DomainReliabilityConfig> config(MakeTestConfig()); config->failure_sample_rate = 0.0; - InitContext(config.Pass()); + InitContext(std::move(config)); BeaconVector beacons; for (int i = 0; i < 100; i++) { @@ -429,7 +424,7 @@ TEST_F(DomainReliabilityContextTest, ZeroSampleRate) { TEST_F(DomainReliabilityContextTest, FractionalSampleRate) { scoped_ptr<DomainReliabilityConfig> config(MakeTestConfig()); config->failure_sample_rate = 0.5; - InitContext(config.Pass()); + InitContext(std::move(config)); BeaconVector beacons; do { @@ -459,7 +454,7 @@ TEST_F(DomainReliabilityContextTest, FailureSampleOnly) { scoped_ptr<DomainReliabilityConfig> config(MakeTestConfig()); config->success_sample_rate = 0.0; config->failure_sample_rate = 1.0; - InitContext(config.Pass()); + InitContext(std::move(config)); BeaconVector beacons; @@ -470,7 +465,7 @@ TEST_F(DomainReliabilityContextTest, FailureSampleOnly) { scoped_ptr<DomainReliabilityBeacon> beacon(MakeBeacon(&time_)); beacon->status = "ok"; beacon->chrome_error = net::OK; - context_->OnBeacon(beacon.Pass()); + context_->OnBeacon(std::move(beacon)); context_->GetQueuedBeaconsForTesting(&beacons); EXPECT_EQ(1u, beacons.size()); } @@ -479,7 +474,7 @@ TEST_F(DomainReliabilityContextTest, SuccessSampleOnly) { scoped_ptr<DomainReliabilityConfig> config(MakeTestConfig()); config->success_sample_rate = 1.0; config->failure_sample_rate = 0.0; - InitContext(config.Pass()); + InitContext(std::move(config)); BeaconVector beacons; @@ -490,7 +485,7 @@ TEST_F(DomainReliabilityContextTest, SuccessSampleOnly) { scoped_ptr<DomainReliabilityBeacon> beacon(MakeBeacon(&time_)); beacon->status = "ok"; beacon->chrome_error = net::OK; - context_->OnBeacon(beacon.Pass()); + context_->OnBeacon(std::move(beacon)); context_->GetQueuedBeaconsForTesting(&beacons); EXPECT_EQ(1u, beacons.size()); } @@ -499,7 +494,7 @@ TEST_F(DomainReliabilityContextTest, SampleAllBeacons) { scoped_ptr<DomainReliabilityConfig> config(MakeTestConfig()); config->success_sample_rate = 1.0; config->failure_sample_rate = 1.0; - InitContext(config.Pass()); + InitContext(std::move(config)); BeaconVector beacons; @@ -510,7 +505,7 @@ TEST_F(DomainReliabilityContextTest, SampleAllBeacons) { scoped_ptr<DomainReliabilityBeacon> beacon(MakeBeacon(&time_)); beacon->status = "ok"; beacon->chrome_error = net::OK; - context_->OnBeacon(beacon.Pass()); + context_->OnBeacon(std::move(beacon)); context_->GetQueuedBeaconsForTesting(&beacons); EXPECT_EQ(2u, beacons.size()); } @@ -519,7 +514,7 @@ TEST_F(DomainReliabilityContextTest, SampleNoBeacons) { scoped_ptr<DomainReliabilityConfig> config(MakeTestConfig()); config->success_sample_rate = 0.0; config->failure_sample_rate = 0.0; - InitContext(config.Pass()); + InitContext(std::move(config)); BeaconVector beacons; @@ -530,7 +525,7 @@ TEST_F(DomainReliabilityContextTest, SampleNoBeacons) { scoped_ptr<DomainReliabilityBeacon> beacon(MakeBeacon(&time_)); beacon->status = "ok"; beacon->chrome_error = net::OK; - context_->OnBeacon(beacon.Pass()); + context_->OnBeacon(std::move(beacon)); context_->GetQueuedBeaconsForTesting(&beacons); EXPECT_EQ(0u, beacons.size()); } diff --git a/components/domain_reliability/dispatcher.cc b/components/domain_reliability/dispatcher.cc index 6b631c2d..5d0ed1e 100644 --- a/components/domain_reliability/dispatcher.cc +++ b/components/domain_reliability/dispatcher.cc @@ -4,6 +4,8 @@ #include "components/domain_reliability/dispatcher.h" +#include <utility> + #include "base/bind.h" #include "base/callback.h" #include "base/message_loop/message_loop.h" @@ -32,7 +34,7 @@ DomainReliabilityDispatcher::Task::Task(const base::Closure& closure, base::TimeDelta min_delay, base::TimeDelta max_delay) : closure(closure), - timer(timer.Pass()), + timer(std::move(timer)), min_delay(min_delay), max_delay(max_delay), eligible(false) {} diff --git a/components/domain_reliability/google_configs.cc b/components/domain_reliability/google_configs.cc index 7a4457f..6582a08 100644 --- a/components/domain_reliability/google_configs.cc +++ b/components/domain_reliability/google_configs.cc @@ -521,7 +521,7 @@ CreateGoogleConfig(const GoogleConfigParams& params, bool is_www) { config->success_sample_rate = 0.05; config->failure_sample_rate = 1.00; config->path_prefixes.clear(); - return config.Pass(); + return config; } } // namespace diff --git a/components/domain_reliability/monitor.cc b/components/domain_reliability/monitor.cc index e4f1cb9..b6337ef 100644 --- a/components/domain_reliability/monitor.cc +++ b/components/domain_reliability/monitor.cc @@ -4,6 +4,8 @@ #include "components/domain_reliability/monitor.h" +#include <utility> + #include "base/command_line.h" #include "base/logging.h" #include "base/profiler/scoped_tracker.h" @@ -63,7 +65,7 @@ scoped_ptr<DomainReliabilityBeacon> CreateBeaconFromAttempt( beacon->server_ip = attempt.endpoint.ToString(); else beacon->server_ip = ""; - return beacon.Pass(); + return beacon; } } // namespace @@ -92,7 +94,7 @@ DomainReliabilityMonitor::DomainReliabilityMonitor( const scoped_refptr<base::SingleThreadTaskRunner>& pref_thread, const scoped_refptr<base::SingleThreadTaskRunner>& network_thread, scoped_ptr<MockableTime> time) - : time_(time.Pass()), + : time_(std::move(time)), upload_reporter_string_(upload_reporter_string), scheduler_params_( DomainReliabilityScheduler::Params::GetFromFieldTrialsOrDefaults()), @@ -162,7 +164,7 @@ void DomainReliabilityMonitor::AddBakedInConfigs() { << json; continue; } - context_manager_.AddContextForConfig(config.Pass()); + context_manager_.AddContextForConfig(std::move(config)); } std::vector<DomainReliabilityConfig*> google_configs; @@ -231,14 +233,14 @@ scoped_ptr<base::Value> DomainReliabilityMonitor::GetWebUIData() const { scoped_ptr<base::DictionaryValue> data_value(new base::DictionaryValue()); data_value->Set("contexts", context_manager_.GetWebUIData()); - return data_value.Pass(); + return std::move(data_value); } DomainReliabilityContext* DomainReliabilityMonitor::AddContextForTesting( scoped_ptr<const DomainReliabilityConfig> config) { DCHECK(OnNetworkThread()); - return context_manager_.AddContextForConfig(config.Pass()); + return context_manager_.AddContextForConfig(std::move(config)); } scoped_ptr<DomainReliabilityContext> @@ -249,13 +251,9 @@ DomainReliabilityMonitor::CreateContextForConfig( DCHECK(config->IsValid()); return make_scoped_ptr(new DomainReliabilityContext( - time_.get(), - scheduler_params_, - upload_reporter_string_, - &last_network_change_time_, - &dispatcher_, - uploader_.get(), - config.Pass())); + time_.get(), scheduler_params_, upload_reporter_string_, + &last_network_change_time_, &dispatcher_, uploader_.get(), + std::move(config))); } DomainReliabilityMonitor::RequestInfo::RequestInfo() {} @@ -339,7 +337,7 @@ void DomainReliabilityMonitor::OnRequestLegComplete( scoped_ptr<DomainReliabilityBeacon> beacon = CreateBeaconFromAttempt(beacon_template, attempt); if (beacon) - context_manager_.RouteBeacon(beacon.Pass()); + context_manager_.RouteBeacon(std::move(beacon)); } if (url_request_attempt_is_duplicate) @@ -348,7 +346,7 @@ void DomainReliabilityMonitor::OnRequestLegComplete( scoped_ptr<DomainReliabilityBeacon> beacon = CreateBeaconFromAttempt(beacon_template, url_request_attempt); if (beacon) - context_manager_.RouteBeacon(beacon.Pass()); + context_manager_.RouteBeacon(std::move(beacon)); } base::WeakPtr<DomainReliabilityMonitor> diff --git a/components/domain_reliability/monitor_unittest.cc b/components/domain_reliability/monitor_unittest.cc index 56b0f58..27eaea0 100644 --- a/components/domain_reliability/monitor_unittest.cc +++ b/components/domain_reliability/monitor_unittest.cc @@ -5,9 +5,9 @@ #include "components/domain_reliability/monitor.h" #include <stddef.h> - #include <map> #include <string> +#include <utility> #include <vector> #include "base/bind.h" @@ -95,7 +95,7 @@ class DomainReliabilityMonitorTest : public testing::Test { scoped_ptr<DomainReliabilityConfig> config( MakeTestConfigWithOrigin(origin)); config->include_subdomains = wildcard; - return monitor_.AddContextForTesting(config.Pass()); + return monitor_.AddContextForTesting(std::move(config)); } scoped_refptr<base::TestSimpleTaskRunner> pref_task_runner_; @@ -207,7 +207,7 @@ TEST_F(DomainReliabilityMonitorTest, scoped_ptr<DomainReliabilityConfig> config = MakeTestConfig(); config->success_sample_rate = 1.0; DomainReliabilityContext* context = - monitor_.AddContextForTesting(config.Pass()); + monitor_.AddContextForTesting(std::move(config)); RequestInfo request = MakeRequestInfo(); request.url = GURL("http://example/"); diff --git a/components/domain_reliability/scheduler.cc b/components/domain_reliability/scheduler.cc index 44d5cfb..79ed191 100644 --- a/components/domain_reliability/scheduler.cc +++ b/components/domain_reliability/scheduler.cc @@ -5,8 +5,8 @@ #include "components/domain_reliability/scheduler.h" #include <stdint.h> - #include <algorithm> +#include <utility> #include "base/metrics/field_trial.h" #include "base/strings/string_number_conversions.h" @@ -180,7 +180,7 @@ scoped_ptr<base::Value> DomainReliabilityScheduler::GetWebUIData() const { last->SetInteger("collector_index", static_cast<int>(last_upload_collector_index_)); last->SetBoolean("success", last_upload_success_); - data->Set("last_upload", last.Pass()); + data->Set("last_upload", std::move(last)); } scoped_ptr<base::ListValue> collectors_value(new base::ListValue()); @@ -192,9 +192,9 @@ scoped_ptr<base::Value> DomainReliabilityScheduler::GetWebUIData() const { // Using release instead of Pass because Pass can't implicitly upcast. collectors_value->Append(value.release()); } - data->Set("collectors", collectors_value.Pass()); + data->Set("collectors", std::move(collectors_value)); - return data.Pass(); + return std::move(data); } void DomainReliabilityScheduler::MakeDeterministicForTesting() { diff --git a/components/domain_reliability/service.cc b/components/domain_reliability/service.cc index 4253f45..1d44453 100644 --- a/components/domain_reliability/service.cc +++ b/components/domain_reliability/service.cc @@ -52,7 +52,7 @@ class DomainReliabilityServiceImpl : public DomainReliabilityService { monitor_ = monitor->MakeWeakPtr(); network_task_runner_ = network_task_runner; - return monitor.Pass(); + return monitor; } void ClearBrowsingData(DomainReliabilityClearMode clear_mode, diff --git a/components/drive/change_list_loader.cc b/components/drive/change_list_loader.cc index 12e7741..b7b5bd6 100644 --- a/components/drive/change_list_loader.cc +++ b/components/drive/change_list_loader.cc @@ -5,8 +5,8 @@ #include "components/drive/change_list_loader.h" #include <stddef.h> - #include <set> +#include <utility> #include "base/callback.h" #include "base/callback_helpers.h" @@ -93,7 +93,7 @@ class FullFeedFetcher : public ChangeListLoader::FeedFetcher { // Note: The fetcher is managed by ChangeListLoader, and the instance // will be deleted in the callback. Do not touch the fields after this // invocation. - callback.Run(FILE_ERROR_OK, change_lists_.Pass()); + callback.Run(FILE_ERROR_OK, std::move(change_lists_)); } JobScheduler* scheduler_; @@ -152,7 +152,7 @@ class DeltaFeedFetcher : public ChangeListLoader::FeedFetcher { // Note: The fetcher is managed by ChangeListLoader, and the instance // will be deleted in the callback. Do not touch the fields after this // invocation. - callback.Run(FILE_ERROR_OK, change_lists_.Pass()); + callback.Run(FILE_ERROR_OK, std::move(change_lists_)); } JobScheduler* scheduler_; diff --git a/components/drive/change_list_processor.cc b/components/drive/change_list_processor.cc index f41c0e8..f425320 100644 --- a/components/drive/change_list_processor.cc +++ b/components/drive/change_list_processor.cc @@ -5,6 +5,7 @@ #include "components/drive/change_list_processor.h" #include <stddef.h> +#include <utility> #include "base/metrics/histogram.h" #include "base/strings/string_number_conversions.h" @@ -180,7 +181,8 @@ FileError ChangeListProcessor::Apply( } } - FileError error = ApplyEntryMap(largest_changestamp, about_resource.Pass()); + FileError error = + ApplyEntryMap(largest_changestamp, std::move(about_resource)); if (error != FILE_ERROR_OK) { DLOG(ERROR) << "ApplyEntryMap failed: " << FileErrorToString(error); return error; diff --git a/components/drive/directory_loader.cc b/components/drive/directory_loader.cc index 7e82b66..ad42626 100644 --- a/components/drive/directory_loader.cc +++ b/components/drive/directory_loader.cc @@ -5,6 +5,7 @@ #include "components/drive/directory_loader.h" #include <stddef.h> +#include <utility> #include "base/callback.h" #include "base/callback_helpers.h" @@ -482,7 +483,7 @@ void DirectoryLoader::SendEntries(const std::string& local_id, entries_to_send->push_back(entry); } } - callback_state->entries_callback.Run(entries_to_send.Pass()); + callback_state->entries_callback.Run(std::move(entries_to_send)); } } diff --git a/components/drive/drive_uploader.cc b/components/drive/drive_uploader.cc index 5cc2ebf..9e53e79 100644 --- a/components/drive/drive_uploader.cc +++ b/components/drive/drive_uploader.cc @@ -5,6 +5,7 @@ #include "components/drive/drive_uploader.h" #include <algorithm> +#include <utility> #include "base/bind.h" #include "base/callback.h" @@ -71,7 +72,7 @@ class DriveUploader::RefCountedBatchRequest public: RefCountedBatchRequest( scoped_ptr<BatchRequestConfiguratorInterface> configurator) - : configurator_(configurator.Pass()) {} + : configurator_(std::move(configurator)) {} // Gets pointer of BatchRequestConfiguratorInterface owned by the instance. BatchRequestConfiguratorInterface* configurator() const { @@ -201,7 +202,7 @@ CancelCallback DriveUploader::UploadNewFile( void DriveUploader::StartBatchProcessing() { DCHECK(current_batch_request_ == nullptr); current_batch_request_ = - new RefCountedBatchRequest(drive_service_->StartBatchRequest().Pass()); + new RefCountedBatchRequest(drive_service_->StartBatchRequest()); } void DriveUploader::StopBatchProcessing() { @@ -244,10 +245,9 @@ CancelCallback DriveUploader::ResumeUploadFile( local_file_path, content_type, callback, progress_callback)); upload_file_info->upload_location = upload_location; - return StartUploadFile( - upload_file_info.Pass(), - base::Bind(&DriveUploader::StartGetUploadStatus, - weak_ptr_factory_.GetWeakPtr())); + return StartUploadFile(std::move(upload_file_info), + base::Bind(&DriveUploader::StartGetUploadStatus, + weak_ptr_factory_.GetWeakPtr())); } CancelCallback DriveUploader::StartUploadFile( @@ -277,16 +277,16 @@ void DriveUploader::StartUploadFileAfterGetFileSize( DCHECK(thread_checker_.CalledOnValidThread()); if (!get_file_size_result) { - UploadFailed(upload_file_info.Pass(), HTTP_NOT_FOUND); + UploadFailed(std::move(upload_file_info), HTTP_NOT_FOUND); return; } DCHECK_GE(upload_file_info->content_length, 0); if (upload_file_info->cancelled) { - UploadFailed(upload_file_info.Pass(), DRIVE_CANCELLED); + UploadFailed(std::move(upload_file_info), DRIVE_CANCELLED); return; } - start_initiate_upload_callback.Run(upload_file_info.Pass()); + start_initiate_upload_callback.Run(std::move(upload_file_info)); } void DriveUploader::CallUploadServiceAPINewFile( @@ -372,13 +372,13 @@ void DriveUploader::OnUploadLocationReceived( if (code != HTTP_SUCCESS) { if (code == HTTP_PRECONDITION) code = HTTP_CONFLICT; // ETag mismatch. - UploadFailed(upload_file_info.Pass(), code); + UploadFailed(std::move(upload_file_info), code); return; } upload_file_info->upload_location = upload_location; upload_file_info->next_start_position = 0; - UploadNextChunk(upload_file_info.Pass()); + UploadNextChunk(std::move(upload_file_info)); } void DriveUploader::StartGetUploadStatus( @@ -404,7 +404,7 @@ void DriveUploader::UploadNextChunk( upload_file_info->content_length); if (upload_file_info->cancelled) { - UploadFailed(upload_file_info.Pass(), DRIVE_CANCELLED); + UploadFailed(std::move(upload_file_info), DRIVE_CANCELLED); return; } @@ -451,14 +451,14 @@ void DriveUploader::OnUploadRangeResponseReceived( << upload_file_info->file_path.value() << "]"; // Done uploading. - upload_file_info->completion_callback.Run( - HTTP_SUCCESS, GURL(), entry.Pass()); + upload_file_info->completion_callback.Run(HTTP_SUCCESS, GURL(), + std::move(entry)); return; } // ETag mismatch. if (response.code == HTTP_PRECONDITION) { - UploadFailed(upload_file_info.Pass(), HTTP_CONFLICT); + UploadFailed(std::move(upload_file_info), HTTP_CONFLICT); return; } @@ -471,9 +471,9 @@ void DriveUploader::OnUploadRangeResponseReceived( << "UploadNextChunk http code=" << response.code << ", start_position_received=" << response.start_position_received << ", end_position_received=" << response.end_position_received; - UploadFailed( - upload_file_info.Pass(), - response.code == HTTP_FORBIDDEN ? DRIVE_NO_SPACE : response.code); + UploadFailed(std::move(upload_file_info), response.code == HTTP_FORBIDDEN + ? DRIVE_NO_SPACE + : response.code); return; } @@ -482,7 +482,7 @@ void DriveUploader::OnUploadRangeResponseReceived( << " for [" << upload_file_info->file_path.value() << "]"; upload_file_info->next_start_position = response.end_position_received; - UploadNextChunk(upload_file_info.Pass()); + UploadNextChunk(std::move(upload_file_info)); } void DriveUploader::OnUploadProgress(const ProgressCallback& callback, @@ -521,7 +521,7 @@ void DriveUploader::OnMultipartUploadComplete( << upload_file_info->file_path.value() << "]"; // Done uploading. upload_file_info->completion_callback.Run( - HTTP_SUCCESS, upload_file_info->upload_location, entry.Pass()); + HTTP_SUCCESS, upload_file_info->upload_location, std::move(entry)); } else { DVLOG(1) << "Upload failed " << upload_file_info->DebugString(); if (error == HTTP_PRECONDITION) diff --git a/components/drive/fake_file_system.cc b/components/drive/fake_file_system.cc index 6fceb9c..a14c91a 100644 --- a/components/drive/fake_file_system.cc +++ b/components/drive/fake_file_system.cc @@ -5,6 +5,7 @@ #include "components/drive/fake_file_system.h" #include <stddef.h> +#include <utility> #include "base/bind.h" #include "base/bind_helpers.h" @@ -320,12 +321,12 @@ void FakeFileSystem::GetFileContentAfterGetFileResource( } if (base::PathExists(cache_path)) { // Cache file is found. - initialized_callback.Run(FILE_ERROR_OK, cache_path, entry.Pass()); + initialized_callback.Run(FILE_ERROR_OK, cache_path, std::move(entry)); completion_callback.Run(FILE_ERROR_OK); return; } - initialized_callback.Run(FILE_ERROR_OK, base::FilePath(), entry.Pass()); + initialized_callback.Run(FILE_ERROR_OK, base::FilePath(), std::move(entry)); drive_service_->DownloadFile( cache_path, gdata_entry->file_id(), @@ -362,7 +363,7 @@ void FakeFileSystem::GetResourceEntryAfterGetAboutResource( root->mutable_file_info()->set_is_directory(true); root->set_resource_id(about_resource->root_folder_id()); root->set_title(util::kDriveMyDriveRootDirName); - callback.Run(error, root.Pass()); + callback.Run(error, std::move(root)); } void FakeFileSystem::GetResourceEntryAfterGetParentEntryInfo( @@ -410,7 +411,7 @@ void FakeFileSystem::GetResourceEntryAfterGetFileList( if (entry->base_name() == base_name.AsUTF8Unsafe()) { // Found the target entry. - callback.Run(FILE_ERROR_OK, entry.Pass()); + callback.Run(FILE_ERROR_OK, std::move(entry)); return; } } diff --git a/components/drive/file_system.cc b/components/drive/file_system.cc index 17682a7..c42da59 100644 --- a/components/drive/file_system.cc +++ b/components/drive/file_system.cc @@ -5,6 +5,7 @@ #include "components/drive/file_system.h" #include <stddef.h> +#include <utility> #include "base/bind.h" #include "base/files/file_util.h" @@ -93,7 +94,7 @@ void RunGetResourceEntryCallback(const GetResourceEntryCallback& callback, if (error != FILE_ERROR_OK) entry.reset(); - callback.Run(error, entry.Pass()); + callback.Run(error, std::move(entry)); } // Used to implement Pin(). @@ -230,7 +231,7 @@ void FilterHostedDocuments(const ReadDirectoryEntriesCallback& callback, } entries.swap(filtered); } - callback.Run(entries.Pass()); + callback.Run(std::move(entries)); } // Adapter for using FileOperationCallback as google_apis::EntryActionCallback. diff --git a/components/drive/file_system/download_operation.cc b/components/drive/file_system/download_operation.cc index 33add71..0c490138 100644 --- a/components/drive/file_system/download_operation.cc +++ b/components/drive/file_system/download_operation.cc @@ -5,6 +5,7 @@ #include "components/drive/file_system/download_operation.h" #include <stdint.h> +#include <utility> #include "base/callback_helpers.h" #include "base/files/file_path.h" @@ -260,15 +261,14 @@ FileError UpdateLocalStateForDownloadFile( class DownloadOperation::DownloadParams { public: - DownloadParams( - const GetFileContentInitializedCallback initialized_callback, - const google_apis::GetContentCallback get_content_callback, - const GetFileCallback completion_callback, - scoped_ptr<ResourceEntry> entry) + DownloadParams(const GetFileContentInitializedCallback initialized_callback, + const google_apis::GetContentCallback get_content_callback, + const GetFileCallback completion_callback, + scoped_ptr<ResourceEntry> entry) : initialized_callback_(initialized_callback), get_content_callback_(get_content_callback), completion_callback_(completion_callback), - entry_(entry.Pass()), + entry_(std::move(entry)), was_cancelled_(false), weak_ptr_factory_(this) { DCHECK(!completion_callback_.is_null()); @@ -284,7 +284,7 @@ class DownloadOperation::DownloadParams { initialized_callback_.Run(FILE_ERROR_OK, cache_file_path, make_scoped_ptr(new ResourceEntry(*entry_))); } - completion_callback_.Run(FILE_ERROR_OK, cache_file_path, entry_.Pass()); + completion_callback_.Run(FILE_ERROR_OK, cache_file_path, std::move(entry_)); } void OnStartDownloading(const base::Closure& cancel_download_closure) { @@ -305,7 +305,7 @@ class DownloadOperation::DownloadParams { void OnDownloadCompleted(const base::FilePath& cache_file_path, scoped_ptr<ResourceEntry> entry) const { - completion_callback_.Run(FILE_ERROR_OK, cache_file_path, entry.Pass()); + completion_callback_.Run(FILE_ERROR_OK, cache_file_path, std::move(entry)); } const google_apis::GetContentCallback& get_content_callback() const { @@ -532,7 +532,7 @@ void DownloadOperation::EnsureFileDownloadedAfterUpdateLocalState( FileChange::CHANGE_TYPE_ADD_OR_UPDATE); // Storing to cache changes the "offline available" status, hence notify. delegate_->OnFileChangedByOperation(changed_files); - params->OnDownloadCompleted(*cache_file_path, entry_after_update.Pass()); + params->OnDownloadCompleted(*cache_file_path, std::move(entry_after_update)); } void DownloadOperation::CancelJob(JobID job_id) { diff --git a/components/drive/file_system/get_file_for_saving_operation.cc b/components/drive/file_system/get_file_for_saving_operation.cc index 30aefd6..567e79f 100644 --- a/components/drive/file_system/get_file_for_saving_operation.cc +++ b/components/drive/file_system/get_file_for_saving_operation.cc @@ -4,6 +4,8 @@ #include "components/drive/file_system/get_file_for_saving_operation.h" +#include <utility> + #include "base/bind.h" #include "base/bind_helpers.h" #include "base/callback_helpers.h" @@ -181,7 +183,7 @@ void GetFileForSavingOperation::GetFileForSavingAfterWatch( return; } - callback.Run(FILE_ERROR_OK, cache_path, entry.Pass()); + callback.Run(FILE_ERROR_OK, cache_path, std::move(entry)); } void GetFileForSavingOperation::OnWriteEvent( diff --git a/components/drive/file_system/search_operation.cc b/components/drive/file_system/search_operation.cc index 5131f0e..31e8437 100644 --- a/components/drive/file_system/search_operation.cc +++ b/components/drive/file_system/search_operation.cc @@ -5,8 +5,8 @@ #include "components/drive/file_system/search_operation.h" #include <stddef.h> - #include <string> +#include <utility> #include <vector> #include "base/bind.h" @@ -137,7 +137,7 @@ void SearchOperation::SearchAfterGetFileList( if (file_list->items().empty()) { // Short cut. If the resource entry is empty, we don't need to refresh // the resource metadata. - callback.Run(FILE_ERROR_OK, next_url, result.Pass()); + callback.Run(FILE_ERROR_OK, next_url, std::move(result)); return; } @@ -175,7 +175,7 @@ void SearchOperation::SearchAfterResolveSearchResult( return; } - callback.Run(error, next_link, result.Pass()); + callback.Run(error, next_link, std::move(result)); } } // namespace file_system diff --git a/components/drive/job_scheduler.cc b/components/drive/job_scheduler.cc index 2c183da..036d3c8 100644 --- a/components/drive/job_scheduler.cc +++ b/components/drive/job_scheduler.cc @@ -5,8 +5,8 @@ #include "components/drive/job_scheduler.h" #include <stddef.h> - #include <algorithm> +#include <utility> #include "base/files/file_util.h" #include "base/metrics/histogram.h" @@ -936,7 +936,7 @@ void JobScheduler::OnGetFileListJobDone( DCHECK(!callback.is_null()); if (OnJobDone(job_id, error)) - callback.Run(error, file_list.Pass()); + callback.Run(error, std::move(file_list)); } void JobScheduler::OnGetChangeListJobDone( @@ -948,7 +948,7 @@ void JobScheduler::OnGetChangeListJobDone( DCHECK(!callback.is_null()); if (OnJobDone(job_id, error)) - callback.Run(error, change_list.Pass()); + callback.Run(error, std::move(change_list)); } void JobScheduler::OnGetFileResourceJobDone( @@ -960,7 +960,7 @@ void JobScheduler::OnGetFileResourceJobDone( DCHECK(!callback.is_null()); if (OnJobDone(job_id, error)) - callback.Run(error, entry.Pass()); + callback.Run(error, std::move(entry)); } void JobScheduler::OnGetAboutResourceJobDone( @@ -972,7 +972,7 @@ void JobScheduler::OnGetAboutResourceJobDone( DCHECK(!callback.is_null()); if (OnJobDone(job_id, error)) - callback.Run(error, about_resource.Pass()); + callback.Run(error, std::move(about_resource)); } void JobScheduler::OnGetShareUrlJobDone( @@ -996,7 +996,7 @@ void JobScheduler::OnGetAppListJobDone( DCHECK(!callback.is_null()); if (OnJobDone(job_id, error)) - callback.Run(error, app_list.Pass()); + callback.Run(error, std::move(app_list)); } void JobScheduler::OnEntryActionJobDone( @@ -1056,7 +1056,7 @@ void JobScheduler::OnUploadCompletionJobDone( } if (OnJobDone(job_id, error)) - callback.Run(error, entry.Pass()); + callback.Run(error, std::move(entry)); } void JobScheduler::OnResumeUploadFileDone( @@ -1079,7 +1079,7 @@ void JobScheduler::OnResumeUploadFileDone( } if (OnJobDone(job_id, error)) - callback.Run(error, entry.Pass()); + callback.Run(error, std::move(entry)); } void JobScheduler::UpdateProgress(JobID job_id, diff --git a/components/drive/resource_metadata_storage.cc b/components/drive/resource_metadata_storage.cc index fc4ec5d..92ff21f 100644 --- a/components/drive/resource_metadata_storage.cc +++ b/components/drive/resource_metadata_storage.cc @@ -5,9 +5,9 @@ #include "components/drive/resource_metadata_storage.h" #include <stddef.h> - #include <map> #include <set> +#include <utility> #include "base/bind.h" #include "base/containers/hash_tables.h" @@ -192,7 +192,7 @@ void RecordCheckValidityFailure(CheckValidityFailureReason reason) { } // namespace ResourceMetadataStorage::Iterator::Iterator(scoped_ptr<leveldb::Iterator> it) - : it_(it.Pass()) { + : it_(std::move(it)) { base::ThreadRestrictions::AssertIOAllowed(); DCHECK(it_); @@ -823,7 +823,7 @@ ResourceMetadataStorage::GetIterator() { scoped_ptr<leveldb::Iterator> it( resource_map_->NewIterator(leveldb::ReadOptions())); - return make_scoped_ptr(new Iterator(it.Pass())); + return make_scoped_ptr(new Iterator(std::move(it))); } FileError ResourceMetadataStorage::GetChild(const std::string& parent_id, diff --git a/components/drive/search_metadata.cc b/components/drive/search_metadata.cc index 1e316f0..5af854e6 100644 --- a/components/drive/search_metadata.cc +++ b/components/drive/search_metadata.cc @@ -6,6 +6,7 @@ #include <algorithm> #include <queue> +#include <utility> #include "base/bind.h" #include "base/i18n/string_search.h" @@ -230,7 +231,7 @@ void RunSearchMetadataCallback(const SearchMetadataCallback& callback, FileError error) { if (error != FILE_ERROR_OK) results.reset(); - callback.Run(error, results.Pass()); + callback.Run(error, std::move(results)); UMA_HISTOGRAM_TIMES("Drive.SearchMetadataTime", base::TimeTicks::Now() - start_time); diff --git a/components/drive/service/fake_drive_service.cc b/components/drive/service/fake_drive_service.cc index 9978ef4..9943df2 100644 --- a/components/drive/service/fake_drive_service.cc +++ b/components/drive/service/fake_drive_service.cc @@ -5,8 +5,8 @@ #include "components/drive/service/fake_drive_service.h" #include <stddef.h> - #include <string> +#include <utility> #include "base/files/file_util.h" #include "base/json/json_string_value_serializer.h" @@ -121,7 +121,7 @@ void FileListCallbackAdapter(const FileListCallback& callback, scoped_ptr<ChangeList> change_list) { scoped_ptr<FileList> file_list; if (!change_list) { - callback.Run(error, file_list.Pass()); + callback.Run(error, std::move(file_list)); return; } @@ -132,7 +132,7 @@ void FileListCallbackAdapter(const FileListCallback& callback, if (entry.file()) file_list->mutable_items()->push_back(new FileResource(*entry.file())); } - callback.Run(error, file_list.Pass()); + callback.Run(error, std::move(file_list)); } bool UserHasWriteAccess(google_apis::drive::PermissionRole user_permission) { @@ -150,7 +150,7 @@ bool UserHasWriteAccess(google_apis::drive::PermissionRole user_permission) { void CallFileResouceCallback(const FileResourceCallback& callback, const UploadRangeResponse& response, scoped_ptr<FileResource> entry) { - callback.Run(response.code, entry.Pass()); + callback.Run(response.code, std::move(entry)); } struct CallResumeUpload { @@ -1782,7 +1782,7 @@ void FakeDriveService::GetChangeListInternal( change_list->set_next_link(next_url); } - *change_list->mutable_items() = entries.Pass(); + *change_list->mutable_items() = std::move(entries); if (load_counter) *load_counter += 1; diff --git a/components/drive/service/fake_drive_service_unittest.cc b/components/drive/service/fake_drive_service_unittest.cc index df5bc59..71bb00d 100644 --- a/components/drive/service/fake_drive_service_unittest.cc +++ b/components/drive/service/fake_drive_service_unittest.cc @@ -66,7 +66,7 @@ class FakeDriveServiceTest : public testing::Test { fake_service_.GetFileResource( resource_id, test_util::CreateCopyResultCallback(&error, &entry)); base::RunLoop().RunUntilIdle(); - return entry.Pass(); + return entry; } // Returns true if the resource identified by |resource_id| exists. diff --git a/components/enhanced_bookmarks/bookmark_server_cluster_service.cc b/components/enhanced_bookmarks/bookmark_server_cluster_service.cc index 486b1af..cf34176 100644 --- a/components/enhanced_bookmarks/bookmark_server_cluster_service.cc +++ b/components/enhanced_bookmarks/bookmark_server_cluster_service.cc @@ -340,7 +340,7 @@ scoped_ptr<base::DictionaryValue> BookmarkServerClusterService::Serialize( data->Set(kPrefServiceDataKey, all_clusters.release()); data->SetString(kAuthIdKey, auth_id); - return data.Pass(); + return data; } // static diff --git a/components/enhanced_bookmarks/bookmark_server_service.cc b/components/enhanced_bookmarks/bookmark_server_service.cc index 23c85b1..283daee 100644 --- a/components/enhanced_bookmarks/bookmark_server_service.cc +++ b/components/enhanced_bookmarks/bookmark_server_service.cc @@ -4,6 +4,8 @@ #include "components/enhanced_bookmarks/bookmark_server_service.h" +#include <utility> + #include "base/auto_reset.h" #include "components/enhanced_bookmarks/enhanced_bookmark_model.h" #include "components/signin/core/browser/profile_oauth2_token_service.h" @@ -134,7 +136,7 @@ void BookmarkServerService::OnGetTokenFailure( // net::URLFetcherDelegate methods. // void BookmarkServerService::OnURLFetchComplete(const net::URLFetcher* source) { - scoped_ptr<net::URLFetcher> url_fetcher(url_fetcher_.Pass()); + scoped_ptr<net::URLFetcher> url_fetcher(std::move(url_fetcher_)); std::string response; bool should_notify = true; diff --git a/components/enhanced_bookmarks/image_record.cc b/components/enhanced_bookmarks/image_record.cc index 2e380f0..96cc443 100644 --- a/components/enhanced_bookmarks/image_record.cc +++ b/components/enhanced_bookmarks/image_record.cc @@ -4,19 +4,17 @@ #include "components/enhanced_bookmarks/image_record.h" +#include <utility> + namespace enhanced_bookmarks { ImageRecord::ImageRecord(scoped_ptr<gfx::Image> image, const GURL& url, SkColor dominant_color) - : image(image.Pass()), - url(url), - dominant_color(dominant_color) { -} + : image(std::move(image)), url(url), dominant_color(dominant_color) {} ImageRecord::ImageRecord(scoped_ptr<gfx::Image> image, const GURL& url) - : ImageRecord(image.Pass(), url, SK_ColorBLACK) { -} + : ImageRecord(std::move(image), url, SK_ColorBLACK) {} ImageRecord::ImageRecord() : ImageRecord(scoped_ptr<gfx::Image>(new gfx::Image()), GURL()) { diff --git a/components/error_page/renderer/net_error_helper_core.cc b/components/error_page/renderer/net_error_helper_core.cc index 1c0b0ec..56381ff 100644 --- a/components/error_page/renderer/net_error_helper_core.cc +++ b/components/error_page/renderer/net_error_helper_core.cc @@ -5,9 +5,9 @@ #include "components/error_page/renderer/net_error_helper_core.h" #include <stddef.h> - #include <set> #include <string> +#include <utility> #include <vector> #include "base/bind.h" @@ -229,7 +229,7 @@ std::string CreateFixUrlRequestBody( scoped_ptr<base::DictionaryValue> params(new base::DictionaryValue()); params->SetString("urlQuery", PrepareUrlForUpload(error.unreachableURL)); return CreateRequestBody("linkdoctor.fixurl.fixurl", error_param, - correction_params, params.Pass()); + correction_params, std::move(params)); } std::string CreateClickTrackingUrlRequestBody( @@ -254,7 +254,7 @@ std::string CreateClickTrackingUrlRequestBody( params->SetString("fingerprint", response.fingerprint); return CreateRequestBody("linkdoctor.fixurl.clicktracking", error_param, - correction_params, params.Pass()); + correction_params, std::move(params)); } base::string16 FormatURLForDisplay(const GURL& url, bool is_rtl, @@ -278,7 +278,7 @@ scoped_ptr<NavigationCorrectionResponse> ParseNavigationCorrectionResponse( base::JSONValueConverter<NavigationCorrectionResponse> converter; if (!parsed || !converter.Convert(*parsed, response.get())) response.reset(); - return response.Pass(); + return response; } void LogCorrectionTypeShown(int type_id) { @@ -361,7 +361,7 @@ scoped_ptr<ErrorPageParams> CreateErrorPageParams( if (params->override_suggestions->empty() && !params->search_url.is_valid()) params.reset(); - return params.Pass(); + return params; } void ReportAutoReloadSuccess(const blink::WebURLError& error, size_t count) { @@ -851,10 +851,8 @@ void NetErrorHelperCore::OnNavigationCorrectionsFetched( delegate_->GenerateLocalizedErrorPage( pending_error_page_info_->error, pending_error_page_info_->was_failed_post, - can_show_network_diagnostics_dialog_, - GetOfflinePageStatus(), - params.Pass(), - &pending_error_page_info_->reload_button_in_page, + can_show_network_diagnostics_dialog_, GetOfflinePageStatus(), + std::move(params), &pending_error_page_info_->reload_button_in_page, &pending_error_page_info_->show_saved_copy_button_in_page, &pending_error_page_info_->show_cached_copy_button_in_page, &pending_error_page_info_->show_offline_pages_button_in_page, diff --git a/components/favicon/core/favicon_service.cc b/components/favicon/core/favicon_service.cc index f19e47c..698aa2f 100644 --- a/components/favicon/core/favicon_service.cc +++ b/components/favicon/core/favicon_service.cc @@ -5,8 +5,8 @@ #include "components/favicon/core/favicon_service.h" #include <stddef.h> - #include <cmath> +#include <utility> #include "base/hash.h" #include "base/single_thread_task_runner.h" @@ -52,9 +52,8 @@ std::vector<int> GetPixelSizesForFaviconScales(int size_in_dip) { FaviconService::FaviconService(scoped_ptr<FaviconClient> favicon_client, history::HistoryService* history_service) - : favicon_client_(favicon_client.Pass()), - history_service_(history_service) { -} + : favicon_client_(std::move(favicon_client)), + history_service_(history_service) {} FaviconService::~FaviconService() { } diff --git a/components/feedback/feedback_common.cc b/components/feedback/feedback_common.cc index e3e2748..d685551 100644 --- a/components/feedback/feedback_common.cc +++ b/components/feedback/feedback_common.cc @@ -2,7 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "feedback_common.h" +#include "components/feedback/feedback_common.h" + +#include <utility> #include "base/strings/string_util.h" #include "components/feedback/proto/common.pb.h" @@ -89,7 +91,7 @@ void AddAttachment(userfeedback::ExtensionSubmit* feedback_data, FeedbackCommon::AttachedFile::AttachedFile(const std::string& filename, scoped_ptr<std::string> data) - : name(filename), data(data.Pass()) {} + : name(filename), data(std::move(data)) {} FeedbackCommon::AttachedFile::~AttachedFile() {} @@ -130,7 +132,7 @@ void FeedbackCommon::CompressFile(const base::FilePath& filename, void FeedbackCommon::AddFile(const std::string& filename, scoped_ptr<std::string> data) { base::AutoLock lock(attachments_lock_); - attachments_.push_back(new AttachedFile(filename, data.Pass())); + attachments_.push_back(new AttachedFile(filename, std::move(data))); } void FeedbackCommon::AddLog(const std::string& name, const std::string& value) { @@ -143,7 +145,7 @@ void FeedbackCommon::AddLogs(scoped_ptr<SystemLogsMap> logs) { if (logs_) { logs_->insert(logs->begin(), logs->end()); } else { - logs_ = logs.Pass(); + logs_ = std::move(logs); } } diff --git a/components/feedback/feedback_common.h b/components/feedback/feedback_common.h index f084155..4cc1998 100644 --- a/components/feedback/feedback_common.h +++ b/components/feedback/feedback_common.h @@ -7,9 +7,9 @@ #include <stddef.h> #include <stdint.h> - #include <map> #include <string> +#include <utility> #include "base/files/file_util.h" #include "base/memory/ref_counted.h" @@ -89,7 +89,7 @@ class FeedbackCommon : public base::RefCountedThreadSafe<FeedbackCommon> { void set_user_email(const std::string& user_email) { user_email_ = user_email; } - void set_image(scoped_ptr<std::string> image) { image_ = image.Pass(); } + void set_image(scoped_ptr<std::string> image) { image_ = std::move(image); } void set_product_id(int32_t product_id) { product_id_ = product_id; } void set_user_agent(const std::string& user_agent) { user_agent_ = user_agent; diff --git a/components/feedback/feedback_data.cc b/components/feedback/feedback_data.cc index 5c424d9..d898edf 100644 --- a/components/feedback/feedback_data.cc +++ b/components/feedback/feedback_data.cc @@ -4,6 +4,8 @@ #include "components/feedback/feedback_data.h" +#include <utility> + #include "base/bind.h" #include "base/files/file_util.h" #include "base/json/json_string_value_serializer.h" @@ -60,7 +62,7 @@ void FeedbackData::SetAndCompressSystemInfo( if (sys_info.get()) { ++pending_op_count_; - AddLogs(sys_info.Pass()); + AddLogs(std::move(sys_info)); BrowserThread::PostBlockingPoolTaskAndReply( FROM_HERE, base::Bind(&FeedbackCommon::CompressLogs, this), @@ -115,7 +117,7 @@ void FeedbackData::OnGetTraceData( scoped_ptr<std::string> data(new std::string); data->swap(trace_data->data()); - AddFile(kTraceFilename, data.Pass()); + AddFile(kTraceFilename, std::move(data)); set_category_tag(kPerformanceCategoryTag); --pending_op_count_; diff --git a/components/feedback/feedback_data_unittest.cc b/components/feedback/feedback_data_unittest.cc index e10bc2f..074a31c 100644 --- a/components/feedback/feedback_data_unittest.cc +++ b/components/feedback/feedback_data_unittest.cc @@ -5,6 +5,7 @@ #include "components/feedback/feedback_data.h" #include <set> +#include <utility> #include "base/memory/scoped_ptr.h" #include "base/message_loop/message_loop.h" @@ -43,7 +44,7 @@ scoped_ptr<KeyedService> CreateFeedbackUploaderService( content::BrowserContext* context) { scoped_ptr<MockUploader> uploader(new MockUploader(context)); EXPECT_CALL(*uploader, DispatchReport(testing::_)).Times(1); - return uploader.Pass(); + return std::move(uploader); } scoped_ptr<std::string> MakeScoped(const char* str) { @@ -101,9 +102,9 @@ class FeedbackDataTest : public testing::Test { }; TEST_F(FeedbackDataTest, ReportSending) { - data_->SetAndCompressHistograms(MakeScoped(kHistograms).Pass()); - data_->set_image(MakeScoped(kImageData).Pass()); - data_->AttachAndCompressFileData(MakeScoped(kFileData).Pass()); + data_->SetAndCompressHistograms(MakeScoped(kHistograms)); + data_->set_image(MakeScoped(kImageData)); + data_->AttachAndCompressFileData(MakeScoped(kFileData)); Send(); RunMessageLoop(); EXPECT_TRUE(data_->IsDataComplete()); diff --git a/components/filesystem/directory_impl.cc b/components/filesystem/directory_impl.cc index 3d63f0e..d61c2fe 100644 --- a/components/filesystem/directory_impl.cc +++ b/components/filesystem/directory_impl.cc @@ -4,6 +4,8 @@ #include "components/filesystem/directory_impl.h" +#include <utility> + #include "base/files/file.h" #include "base/files/file_enumerator.h" #include "base/files/file_util.h" @@ -19,10 +21,9 @@ namespace filesystem { DirectoryImpl::DirectoryImpl(mojo::InterfaceRequest<Directory> request, base::FilePath directory_path, scoped_ptr<base::ScopedTempDir> temp_dir) - : binding_(this, request.Pass()), + : binding_(this, std::move(request)), directory_path_(directory_path), - temp_dir_(temp_dir.Pass()) { -} + temp_dir_(std::move(temp_dir)) {} DirectoryImpl::~DirectoryImpl() { } @@ -39,10 +40,10 @@ void DirectoryImpl::Read(const ReadCallback& callback) { entry->type = info.IsDirectory() ? FS_FILE_TYPE_DIRECTORY : FS_FILE_TYPE_REGULAR_FILE; entry->name = info.GetName().AsUTF8Unsafe(); - entries.push_back(entry.Pass()); + entries.push_back(std::move(entry)); } - callback.Run(FILE_ERROR_OK, entries.Pass()); + callback.Run(FILE_ERROR_OK, std::move(entries)); } // TODO(erg): Consider adding an implementation of Stat()/Touch() to the @@ -87,7 +88,7 @@ void DirectoryImpl::OpenFile(const mojo::String& raw_path, } if (file.is_pending()) { - new FileImpl(file.Pass(), base_file.Pass()); + new FileImpl(std::move(file), std::move(base_file)); } callback.Run(FILE_ERROR_OK); } @@ -123,7 +124,7 @@ void DirectoryImpl::OpenDirectory(const mojo::String& raw_path, } if (directory.is_pending()) - new DirectoryImpl(directory.Pass(), path, + new DirectoryImpl(std::move(directory), path, scoped_ptr<base::ScopedTempDir>()); callback.Run(FILE_ERROR_OK); } diff --git a/components/filesystem/file_impl.cc b/components/filesystem/file_impl.cc index cd4634e..9ba2c45 100644 --- a/components/filesystem/file_impl.cc +++ b/components/filesystem/file_impl.cc @@ -7,6 +7,7 @@ #include <stddef.h> #include <stdint.h> #include <limits> +#include <utility> #include "base/files/file_path.h" #include "base/files/scoped_file.h" @@ -28,12 +29,12 @@ const size_t kMaxReadSize = 1 * 1024 * 1024; // 1 MB. FileImpl::FileImpl(mojo::InterfaceRequest<File> request, const base::FilePath& path, uint32_t flags) - : binding_(this, request.Pass()), file_(path, flags) { + : binding_(this, std::move(request)), file_(path, flags) { DCHECK(file_.IsValid()); } FileImpl::FileImpl(mojo::InterfaceRequest<File> request, base::File file) - : binding_(this, request.Pass()), file_(file.Pass()) { + : binding_(this, std::move(request)), file_(std::move(file)) { DCHECK(file_.IsValid()); } @@ -87,7 +88,7 @@ void FileImpl::Read(uint32_t num_bytes_to_read, DCHECK_LE(static_cast<size_t>(num_bytes_read), num_bytes_to_read); bytes_read.resize(static_cast<size_t>(num_bytes_read)); - callback.Run(FILE_ERROR_OK, bytes_read.Pass()); + callback.Run(FILE_ERROR_OK, std::move(bytes_read)); } // TODO(vtl): Move the implementation to a thread pool. @@ -182,7 +183,7 @@ void FileImpl::Stat(const StatCallback& callback) { return; } - callback.Run(FILE_ERROR_OK, MakeFileInformation(info).Pass()); + callback.Run(FILE_ERROR_OK, MakeFileInformation(info)); } void FileImpl::Truncate(int64_t size, const TruncateCallback& callback) { @@ -259,7 +260,7 @@ void FileImpl::Dup(mojo::InterfaceRequest<File> file, } if (file.is_pending()) - new FileImpl(file.Pass(), new_file.Pass()); + new FileImpl(std::move(file), std::move(new_file)); callback.Run(FILE_ERROR_OK); } @@ -308,7 +309,7 @@ void FileImpl::AsHandle(const AsHandleCallback& callback) { return; } - callback.Run(FILE_ERROR_OK, ScopedHandle(mojo::Handle(mojo_handle)).Pass()); + callback.Run(FILE_ERROR_OK, ScopedHandle(mojo::Handle(mojo_handle))); } } // namespace filesystem diff --git a/components/filesystem/file_impl_unittest.cc b/components/filesystem/file_impl_unittest.cc index ad634c2..e56a3bf 100644 --- a/components/filesystem/file_impl_unittest.cc +++ b/components/filesystem/file_impl_unittest.cc @@ -4,7 +4,7 @@ #include <stddef.h> #include <stdint.h> - +#include <utility> #include <vector> #include "base/files/file.h" @@ -369,7 +369,7 @@ TEST_F(FileImplTest, StatTouch) { t->now = false; const int64_t kPartyTime1 = 1234567890; // Party like it's 2009-02-13. t->seconds = kPartyTime1; - file->Touch(t.Pass(), nullptr, Capture(&error)); + file->Touch(std::move(t), nullptr, Capture(&error)); ASSERT_TRUE(file.WaitForIncomingResponse()); EXPECT_EQ(FILE_ERROR_OK, error); @@ -388,7 +388,7 @@ TEST_F(FileImplTest, StatTouch) { t->now = false; const int64_t kPartyTime2 = 1425059525; // No time like the present. t->seconds = kPartyTime2; - file->Touch(nullptr, t.Pass(), Capture(&error)); + file->Touch(nullptr, std::move(t), Capture(&error)); ASSERT_TRUE(file.WaitForIncomingResponse()); EXPECT_EQ(FILE_ERROR_OK, error); diff --git a/components/filesystem/file_system_app.cc b/components/filesystem/file_system_app.cc index be7bd18..65401fe 100644 --- a/components/filesystem/file_system_app.cc +++ b/components/filesystem/file_system_app.cc @@ -4,6 +4,8 @@ #include "components/filesystem/file_system_app.h" +#include <utility> + #include "base/bind.h" #include "base/logging.h" #include "mojo/application/public/cpp/application_connection.h" @@ -32,7 +34,7 @@ void FileSystemApp::RegisterDirectoryToClient(DirectoryImpl* directory, base::Bind(&FileSystemApp::OnDirectoryConnectionError, base::Unretained(this), directory)); - client_mapping_.emplace_back(directory, client.Pass()); + client_mapping_.emplace_back(directory, std::move(client)); } bool FileSystemApp::OnShellConnectionError() { @@ -56,7 +58,7 @@ bool FileSystemApp::OnShellConnectionError() { // |InterfaceFactory<Files>| implementation: void FileSystemApp::Create(mojo::ApplicationConnection* connection, mojo::InterfaceRequest<FileSystem> request) { - new FileSystemImpl(this, connection, request.Pass()); + new FileSystemImpl(this, connection, std::move(request)); } void FileSystemApp::OnDirectoryConnectionError(DirectoryImpl* directory) { @@ -78,21 +80,17 @@ void FileSystemApp::OnDirectoryConnectionError(DirectoryImpl* directory) { FileSystemApp::Client::Client(DirectoryImpl* directory, FileSystemClientPtr fs_client) - : directory_(directory), - fs_client_(fs_client.Pass()) { -} + : directory_(directory), fs_client_(std::move(fs_client)) {} FileSystemApp::Client::Client(Client&& rhs) - : directory_(rhs.directory_), - fs_client_(rhs.fs_client_.Pass()) { -} + : directory_(rhs.directory_), fs_client_(std::move(rhs.fs_client_)) {} FileSystemApp::Client::~Client() {} FileSystemApp::Client& FileSystemApp::Client::operator=( FileSystemApp::Client&& rhs) { directory_ = rhs.directory_; - fs_client_ = rhs.fs_client_.Pass(); + fs_client_ = std::move(rhs.fs_client_); return *this; } diff --git a/components/filesystem/file_system_impl.cc b/components/filesystem/file_system_impl.cc index d18b650..6ccf5cb 100644 --- a/components/filesystem/file_system_impl.cc +++ b/components/filesystem/file_system_impl.cc @@ -5,6 +5,7 @@ #include "components/filesystem/file_system_impl.h" #include <stddef.h> +#include <utility> #include "base/command_line.h" #include "base/files/file_path.h" @@ -49,8 +50,7 @@ FileSystemImpl::FileSystemImpl(FileSystemApp* app, mojo::InterfaceRequest<FileSystem> request) : app_(app), remote_application_url_(connection->GetRemoteApplicationURL()), - binding_(this, request.Pass()) { -} + binding_(this, std::move(request)) {} FileSystemImpl::~FileSystemImpl() { } @@ -88,8 +88,8 @@ void FileSystemImpl::OpenFileSystem(const mojo::String& file_system, if (!path.empty()) { DirectoryImpl* dir_impl = - new DirectoryImpl(directory.Pass(), path, temp_dir.Pass()); - app_->RegisterDirectoryToClient(dir_impl, client.Pass()); + new DirectoryImpl(std::move(directory), path, std::move(temp_dir)); + app_->RegisterDirectoryToClient(dir_impl, std::move(client)); callback.Run(FILE_ERROR_OK); } else { callback.Run(FILE_ERROR_FAILED); diff --git a/components/filesystem/files_test_base.cc b/components/filesystem/files_test_base.cc index 3ed9a61..28e36fa 100644 --- a/components/filesystem/files_test_base.cc +++ b/components/filesystem/files_test_base.cc @@ -4,6 +4,8 @@ #include "components/filesystem/files_test_base.h" +#include <utility> + #include "components/filesystem/public/interfaces/directory.mojom.h" #include "components/filesystem/public/interfaces/types.mojom.h" #include "mojo/application/public/cpp/application_impl.h" @@ -30,7 +32,7 @@ void FilesTestBase::GetTemporaryRoot(DirectoryPtr* directory) { binding_.Bind(GetProxy(&client)); FileError error = FILE_ERROR_FAILED; - files()->OpenFileSystem("temp", GetProxy(directory), client.Pass(), + files()->OpenFileSystem("temp", GetProxy(directory), std::move(client), mojo::Capture(&error)); ASSERT_TRUE(files().WaitForIncomingResponse()); ASSERT_EQ(FILE_ERROR_OK, error); diff --git a/components/filesystem/util.cc b/components/filesystem/util.cc index d2e7772..c1c9e36 100644 --- a/components/filesystem/util.cc +++ b/components/filesystem/util.cc @@ -141,7 +141,7 @@ FileInformationPtr MakeFileInformation(const base::File::Info& info) { file_info->mtime = info.last_modified.ToDoubleT(); file_info->ctime = info.creation_time.ToDoubleT(); - return file_info.Pass(); + return file_info; } FileError ValidatePath(const mojo::String& raw_path, diff --git a/components/font_service/font_service_app.cc b/components/font_service/font_service_app.cc index 1101185..275db7f 100644 --- a/components/font_service/font_service_app.cc +++ b/components/font_service/font_service_app.cc @@ -4,6 +4,8 @@ #include "components/font_service/font_service_app.h" +#include <utility> + #include "base/files/file.h" #include "base/files/file_path.h" #include "mojo/application/public/cpp/application_connection.h" @@ -45,7 +47,7 @@ mojo::ScopedHandle GetHandleForPath(const base::FilePath& path) { return mojo::ScopedHandle(); } - return mojo::ScopedHandle(mojo::Handle(mojo_handle)).Pass(); + return mojo::ScopedHandle(mojo::Handle(mojo_handle)); } } // namespace @@ -68,7 +70,7 @@ bool FontServiceApp::ConfigureIncomingConnection( void FontServiceApp::Create(mojo::ApplicationConnection* connection, mojo::InterfaceRequest<FontService> request) { - bindings_.AddBinding(this, request.Pass()); + bindings_.AddBinding(this, std::move(request)); } void FontServiceApp::MatchFamilyName(const mojo::String& family_name, @@ -97,7 +99,7 @@ void FontServiceApp::MatchFamilyName(const mojo::String& family_name, identity->ttc_index = result_identity.fTTCIndex; identity->str_representation = result_identity.fString.c_str(); - callback.Run(identity.Pass(), result_family.c_str(), + callback.Run(std::move(identity), result_family.c_str(), static_cast<TypefaceStyle>(result_style)); } @@ -105,11 +107,10 @@ void FontServiceApp::OpenStream(uint32_t id_number, const OpenStreamCallback& callback) { mojo::ScopedHandle handle; if (id_number < static_cast<uint32_t>(paths_.count())) { - handle = - GetHandleForPath(base::FilePath(paths_[id_number]->c_str())).Pass(); + handle = GetHandleForPath(base::FilePath(paths_[id_number]->c_str())); } - callback.Run(handle.Pass()); + callback.Run(std::move(handle)); } int FontServiceApp::FindOrAddPath(const SkString& path) { diff --git a/components/font_service/public/cpp/font_loader.cc b/components/font_service/public/cpp/font_loader.cc index 0e063aa..2b21232 100644 --- a/components/font_service/public/cpp/font_loader.cc +++ b/components/font_service/public/cpp/font_loader.cc @@ -4,6 +4,8 @@ #include "components/font_service/public/cpp/font_loader.h" +#include <utility> + #include "base/bind.h" #include "base/trace_event/trace_event.h" #include "components/font_service/public/cpp/font_service_thread.h" @@ -21,19 +23,20 @@ FontLoader::FontLoader(mojo::Shell* shell) { mojo::URLRequestPtr request(mojo::URLRequest::New()); request->url = mojo::String::From("mojo:font_service"); FontServicePtr font_service; - shell->ConnectToApplication(request.Pass(), GetProxy(&font_service_provider), - nullptr, mojo::CreatePermissiveCapabilityFilter(), + shell->ConnectToApplication(std::move(request), + GetProxy(&font_service_provider), nullptr, + mojo::CreatePermissiveCapabilityFilter(), base::Bind(&OnGotContentHandlerID)); mojo::ConnectToService(font_service_provider.get(), &font_service); - thread_ = new internal::FontServiceThread(font_service.Pass()); + thread_ = new internal::FontServiceThread(std::move(font_service)); } FontLoader::FontLoader(mojo::ApplicationImpl* application_impl) { FontServicePtr font_service; application_impl->ConnectToService("mojo:font_service", &font_service); - thread_ = new internal::FontServiceThread(font_service.Pass()); + thread_ = new internal::FontServiceThread(std::move(font_service)); } FontLoader::~FontLoader() {} diff --git a/components/font_service/public/cpp/font_service_thread.cc b/components/font_service/public/cpp/font_service_thread.cc index ca2ab05..d5c3618 100644 --- a/components/font_service/public/cpp/font_service_thread.cc +++ b/components/font_service/public/cpp/font_service_thread.cc @@ -4,6 +4,8 @@ #include "components/font_service/public/cpp/font_service_thread.h" +#include <utility> + #include "base/bind.h" #include "base/files/file.h" #include "base/synchronization/waitable_event.h" @@ -20,7 +22,7 @@ const char kFontThreadName[] = "Font_Proxy_Thread"; FontServiceThread::FontServiceThread(FontServicePtr font_service) : base::Thread(kFontThreadName), - font_service_info_(font_service.PassInterface().Pass()) { + font_service_info_(font_service.PassInterface()) { base::Thread::Options options; options.message_pump_factory = base::Bind(&mojo::common::MessagePumpMojo::Create); @@ -70,7 +72,7 @@ scoped_refptr<MappedFontFile> FontServiceThread::OpenStream( // Converts the file to out internal type. scoped_refptr<MappedFontFile> mapped_font_file = new MappedFontFile(identity.fID); - if (!mapped_font_file->Initialize(stream_file.Pass())) + if (!mapped_font_file->Initialize(std::move(stream_file))) return nullptr; return mapped_font_file; @@ -140,14 +142,14 @@ void FontServiceThread::OnOpenStreamComplete(base::WaitableEvent* done_event, MojoPlatformHandle platform_handle; CHECK(MojoExtractPlatformHandle(handle.release().value(), &platform_handle) == MOJO_RESULT_OK); - *output_file = base::File(platform_handle).Pass(); + *output_file = base::File(platform_handle); } done_event->Signal(); } void FontServiceThread::Init() { - font_service_.Bind(font_service_info_.Pass()); + font_service_.Bind(std::move(font_service_info_)); } void FontServiceThread::CleanUp() { diff --git a/components/font_service/public/cpp/mapped_font_file.cc b/components/font_service/public/cpp/mapped_font_file.cc index 98deaaf..940c107 100644 --- a/components/font_service/public/cpp/mapped_font_file.cc +++ b/components/font_service/public/cpp/mapped_font_file.cc @@ -4,6 +4,8 @@ #include "components/font_service/public/cpp/mapped_font_file.h" +#include <utility> + #include "base/files/file_util.h" #include "base/threading/thread_restrictions.h" #include "skia/ext/refptr.h" @@ -19,7 +21,7 @@ MappedFontFile::MappedFontFile(uint32_t font_id) bool MappedFontFile::Initialize(base::File file) { base::ThreadRestrictions::ScopedAllowIO allow_mmap; - return mapped_font_file_.Initialize(file.Pass()); + return mapped_font_file_.Initialize(std::move(file)); } SkMemoryStream* MappedFontFile::CreateMemoryStream() { diff --git a/components/gcm_driver/crypto/gcm_key_store.cc b/components/gcm_driver/crypto/gcm_key_store.cc index 888b294..346208d 100644 --- a/components/gcm_driver/crypto/gcm_key_store.cc +++ b/components/gcm_driver/crypto/gcm_key_store.cc @@ -118,7 +118,7 @@ void GCMKeyStore::CreateKeysAfterInitialize(const std::string& app_id, entries_to_save->push_back(std::make_pair(app_id, encryption_data)); database_->UpdateEntries( - entries_to_save.Pass(), keys_to_remove.Pass(), + std::move(entries_to_save), std::move(keys_to_remove), base::Bind(&GCMKeyStore::DidStoreKeys, weak_factory_.GetWeakPtr(), app_id, *pair, auth_secret, callback)); } @@ -165,7 +165,7 @@ void GCMKeyStore::DeleteKeysAfterInitialize(const std::string& app_id, new std::vector<std::string>(1, app_id)); database_->UpdateEntries( - entries_to_save.Pass(), keys_to_remove.Pass(), + std::move(entries_to_save), std::move(keys_to_remove), base::Bind(&GCMKeyStore::DidDeleteKeys, weak_factory_.GetWeakPtr(), app_id, callback)); } diff --git a/components/gcm_driver/gcm_account_mapper.cc b/components/gcm_driver/gcm_account_mapper.cc index 8730950..e764cb2 100644 --- a/components/gcm_driver/gcm_account_mapper.cc +++ b/components/gcm_driver/gcm_account_mapper.cc @@ -4,6 +4,8 @@ #include "components/gcm_driver/gcm_account_mapper.h" +#include <utility> + #include "base/bind.h" #include "base/guid.h" #include "base/time/clock.h" @@ -385,7 +387,7 @@ GCMAccountMapper::FindMappingByMessageId(const std::string& message_id) { } void GCMAccountMapper::SetClockForTesting(scoped_ptr<base::Clock> clock) { - clock_ = clock.Pass(); + clock_ = std::move(clock); } } // namespace gcm diff --git a/components/gcm_driver/gcm_account_mapper_unittest.cc b/components/gcm_driver/gcm_account_mapper_unittest.cc index 7b76b36..4f8f4fa 100644 --- a/components/gcm_driver/gcm_account_mapper_unittest.cc +++ b/components/gcm_driver/gcm_account_mapper_unittest.cc @@ -4,6 +4,8 @@ #include "components/gcm_driver/gcm_account_mapper.h" +#include <utility> + #include "base/bind.h" #include "base/test/simple_test_clock.h" #include "base/time/time.h" @@ -293,7 +295,7 @@ void GCMAccountMapperTest::Restart() { account_mapper_.reset(new GCMAccountMapper(&gcm_driver_)); scoped_ptr<base::SimpleTestClock> clock(new base::SimpleTestClock); clock_ = clock.get(); - account_mapper_->SetClockForTesting(clock.Pass()); + account_mapper_->SetClockForTesting(std::move(clock)); } void GCMAccountMapperTest::Initialize( diff --git a/components/gcm_driver/gcm_account_tracker_unittest.cc b/components/gcm_driver/gcm_account_tracker_unittest.cc index fb3f3e9..0677fbc 100644 --- a/components/gcm_driver/gcm_account_tracker_unittest.cc +++ b/components/gcm_driver/gcm_account_tracker_unittest.cc @@ -6,6 +6,7 @@ #include <map> #include <string> +#include <utility> #include "base/macros.h" #include "base/memory/scoped_ptr.h" @@ -202,7 +203,8 @@ GCMAccountTrackerTest::GCMAccountTrackerTest() { fake_identity_provider_.get(), new net::TestURLRequestContextGetter(message_loop_.task_runner()))); - tracker_.reset(new GCMAccountTracker(gaia_account_tracker.Pass(), &driver_)); + tracker_.reset( + new GCMAccountTracker(std::move(gaia_account_tracker), &driver_)); } GCMAccountTrackerTest::~GCMAccountTrackerTest() { diff --git a/components/gcm_driver/gcm_client_impl.cc b/components/gcm_driver/gcm_client_impl.cc index 0679f56..efd69e2 100644 --- a/components/gcm_driver/gcm_client_impl.cc +++ b/components/gcm_driver/gcm_client_impl.cc @@ -5,6 +5,7 @@ #include "components/gcm_driver/gcm_client_impl.h" #include <stddef.h> +#include <utility> #include "base/bind.h" #include "base/files/file_path.h" @@ -295,7 +296,7 @@ void GCMClientImpl::CheckinInfo::Reset() { } GCMClientImpl::GCMClientImpl(scoped_ptr<GCMInternalsBuilder> internals_builder) - : internals_builder_(internals_builder.Pass()), + : internals_builder_(std::move(internals_builder)), state_(UNINITIALIZED), delegate_(NULL), start_mode_(DELAYED_START), @@ -304,8 +305,7 @@ GCMClientImpl::GCMClientImpl(scoped_ptr<GCMInternalsBuilder> internals_builder) url_request_context_getter_(NULL), periodic_checkin_ptr_factory_(this), destroying_gcm_store_ptr_factory_(this), - weak_ptr_factory_(this) { -} + weak_ptr_factory_(this) {} GCMClientImpl::~GCMClientImpl() { } @@ -332,7 +332,7 @@ void GCMClientImpl::Initialize( chrome_build_info_ = chrome_build_info; gcm_store_.reset( - new GCMStoreImpl(path, blocking_task_runner, encryptor.Pass())); + new GCMStoreImpl(path, blocking_task_runner, std::move(encryptor))); delegate_ = delegate; @@ -436,7 +436,7 @@ void GCMClientImpl::OnLoadCompleted(scoped_ptr<GCMStore::LoadResult> result) { instance_id_data_[iter->first] = std::make_pair(instance_id, extra_data); } - load_result_ = result.Pass(); + load_result_ = std::move(result); state_ = LOADED; // Don't initiate the GCM connection when GCM is in delayed start mode and @@ -493,11 +493,8 @@ void GCMClientImpl::InitializeMCSClient() { &recorder_); connection_factory_->SetConnectionListener(this); mcs_client_ = internals_builder_->BuildMCSClient( - chrome_build_info_.version, - clock_.get(), - connection_factory_.get(), - gcm_store_.get(), - &recorder_).Pass(); + chrome_build_info_.version, clock_.get(), connection_factory_.get(), + gcm_store_.get(), &recorder_); mcs_client_->Initialize( base::Bind(&GCMClientImpl::OnMCSError, weak_ptr_factory_.GetWeakPtr()), @@ -505,7 +502,7 @@ void GCMClientImpl::InitializeMCSClient() { weak_ptr_factory_.GetWeakPtr()), base::Bind(&GCMClientImpl::OnMessageSentToMCS, weak_ptr_factory_.GetWeakPtr()), - load_result_.Pass()); + std::move(load_result_)); } void GCMClientImpl::OnFirstTimeDeviceCheckinCompleted( @@ -634,7 +631,7 @@ void GCMClientImpl::SetLastTokenFetchTime(const base::Time& time) { void GCMClientImpl::UpdateHeartbeatTimer(scoped_ptr<base::Timer> timer) { DCHECK(mcs_client_); - mcs_client_->UpdateHeartbeatTimer(timer.Pass()); + mcs_client_->UpdateHeartbeatTimer(std::move(timer)); } void GCMClientImpl::AddInstanceIDData(const std::string& app_id, @@ -926,7 +923,7 @@ void GCMClientImpl::Register( scoped_ptr<RegistrationRequest> registration_request(new RegistrationRequest( gservices_settings_.GetRegistrationURL(), request_info, - request_handler.Pass(), GetGCMBackoffPolicy(), + std::move(request_handler), GetGCMBackoffPolicy(), base::Bind(&GCMClientImpl::OnRegisterCompleted, weak_ptr_factory_.GetWeakPtr(), registration_info), kMaxRegistrationRetries, url_request_context_getter_, &recorder_, @@ -1067,7 +1064,7 @@ void GCMClientImpl::Unregister( scoped_ptr<UnregistrationRequest> unregistration_request( new UnregistrationRequest( gservices_settings_.GetRegistrationURL(), request_info, - request_handler.Pass(), GetGCMBackoffPolicy(), + std::move(request_handler), GetGCMBackoffPolicy(), base::Bind(&GCMClientImpl::OnUnregisterCompleted, weak_ptr_factory_.GetWeakPtr(), registration_info), kMaxUnregistrationRetries, url_request_context_getter_, &recorder_, diff --git a/components/gcm_driver/gcm_desktop_utils.cc b/components/gcm_driver/gcm_desktop_utils.cc index 63ff1d9..7e112af 100644 --- a/components/gcm_driver/gcm_desktop_utils.cc +++ b/components/gcm_driver/gcm_desktop_utils.cc @@ -4,6 +4,8 @@ #include "components/gcm_driver/gcm_desktop_utils.h" +#include <utility> + #include "base/command_line.h" #include "base/sequenced_task_runner.h" #include "base/threading/sequenced_worker_pool.h" @@ -90,17 +92,10 @@ scoped_ptr<GCMDriver> CreateGCMDriverDesktop( const scoped_refptr<base::SequencedTaskRunner>& ui_task_runner, const scoped_refptr<base::SequencedTaskRunner>& io_task_runner, const scoped_refptr<base::SequencedTaskRunner>& blocking_task_runner) { - return scoped_ptr<GCMDriver>(new GCMDriverDesktop( - gcm_client_factory.Pass(), - GetChromeBuildInfo(channel), - GetChannelStatusRequestUrl(channel), - GetUserAgent(channel), - prefs, - store_path, - request_context, - ui_task_runner, - io_task_runner, + std::move(gcm_client_factory), GetChromeBuildInfo(channel), + GetChannelStatusRequestUrl(channel), GetUserAgent(channel), prefs, + store_path, request_context, ui_task_runner, io_task_runner, blocking_task_runner)); } diff --git a/components/gcm_driver/gcm_driver_desktop_unittest.cc b/components/gcm_driver/gcm_driver_desktop_unittest.cc index 7a8b602..d33b9bc 100644 --- a/components/gcm_driver/gcm_driver_desktop_unittest.cc +++ b/components/gcm_driver/gcm_driver_desktop_unittest.cc @@ -236,9 +236,8 @@ void GCMDriverTest::CreateDriver() { new net::TestURLRequestContextGetter(io_thread_.task_runner()); // TODO(johnme): Need equivalent test coverage of GCMDriverAndroid. driver_.reset(new GCMDriverDesktop( - scoped_ptr<GCMClientFactory>( - new FakeGCMClientFactory(base::ThreadTaskRunnerHandle::Get(), - io_thread_.task_runner())).Pass(), + scoped_ptr<GCMClientFactory>(new FakeGCMClientFactory( + base::ThreadTaskRunnerHandle::Get(), io_thread_.task_runner())), GCMClient::ChromeBuildInfo(), "http://channel.status.request.url", "user-agent-string", &prefs_, temp_dir_.path(), request_context, base::ThreadTaskRunnerHandle::Get(), io_thread_.task_runner(), diff --git a/components/gcm_driver/gcm_profile_service.cc b/components/gcm_driver/gcm_profile_service.cc index df9d457..5ca79db 100644 --- a/components/gcm_driver/gcm_profile_service.cc +++ b/components/gcm_driver/gcm_profile_service.cc @@ -4,6 +4,7 @@ #include "components/gcm_driver/gcm_profile_service.h" +#include <utility> #include <vector> #include "base/logging.h" @@ -111,7 +112,7 @@ void GCMProfileService::IdentityObserver::StartAccountTracker( new gaia::AccountTracker(identity_provider_, request_context)); gcm_account_tracker_.reset( - new GCMAccountTracker(gaia_account_tracker.Pass(), driver_)); + new GCMAccountTracker(std::move(gaia_account_tracker), driver_)); gcm_account_tracker_->Start(); } @@ -146,8 +147,8 @@ GCMProfileService::GCMProfileService( const scoped_refptr<base::SequencedTaskRunner>& io_task_runner, scoped_refptr<base::SequencedTaskRunner>& blocking_task_runner) : request_context_(request_context), - profile_identity_provider_(identity_provider.Pass()) { - driver_ = CreateGCMDriverDesktop(gcm_client_factory.Pass(), prefs, + profile_identity_provider_(std::move(identity_provider)) { + driver_ = CreateGCMDriverDesktop(std::move(gcm_client_factory), prefs, path.Append(gcm_driver::kGCMStoreDirname), request_context_, channel, ui_task_runner, io_task_runner, blocking_task_runner); diff --git a/components/gcm_driver/registration_info.cc b/components/gcm_driver/registration_info.cc index 92baab3..38c11de 100644 --- a/components/gcm_driver/registration_info.cc +++ b/components/gcm_driver/registration_info.cc @@ -35,7 +35,7 @@ scoped_ptr<RegistrationInfo> RegistrationInfo::BuildFromString( registration_id)) { registration.reset(); } - return registration.Pass(); + return registration; } RegistrationInfo::RegistrationInfo() { diff --git a/components/google/core/browser/google_url_tracker.cc b/components/google/core/browser/google_url_tracker.cc index 76bffc7..0b3e0b3 100644 --- a/components/google/core/browser/google_url_tracker.cc +++ b/components/google/core/browser/google_url_tracker.cc @@ -4,6 +4,8 @@ #include "components/google/core/browser/google_url_tracker.h" +#include <utility> + #include "base/bind.h" #include "base/command_line.h" #include "base/location.h" @@ -29,10 +31,10 @@ const char GoogleURLTracker::kSearchDomainCheckURL[] = GoogleURLTracker::GoogleURLTracker(scoped_ptr<GoogleURLTrackerClient> client, Mode mode) - : client_(client.Pass()), - google_url_(mode == UNIT_TEST_MODE ? - kDefaultGoogleHomepage : - client_->GetPrefs()->GetString(prefs::kLastKnownGoogleURL)), + : client_(std::move(client)), + google_url_(mode == UNIT_TEST_MODE ? kDefaultGoogleHomepage + : client_->GetPrefs()->GetString( + prefs::kLastKnownGoogleURL)), fetcher_id_(0), in_startup_sleep_(true), already_fetched_(false), diff --git a/components/google/core/browser/google_url_tracker_unittest.cc b/components/google/core/browser/google_url_tracker_unittest.cc index be75f3a..e63d36d 100644 --- a/components/google/core/browser/google_url_tracker_unittest.cc +++ b/components/google/core/browser/google_url_tracker_unittest.cc @@ -5,6 +5,7 @@ #include "components/google/core/browser/google_url_tracker.h" #include <string> +#include <utility> #include "base/macros.h" #include "base/memory/scoped_ptr.h" @@ -157,7 +158,7 @@ void GoogleURLTrackerTest::SetUp() { client_ = new TestGoogleURLTrackerClient(&prefs_); scoped_ptr<GoogleURLTrackerClient> client(client_); google_url_tracker_.reset(new GoogleURLTracker( - client.Pass(), GoogleURLTracker::UNIT_TEST_MODE)); + std::move(client), GoogleURLTracker::UNIT_TEST_MODE)); } void GoogleURLTrackerTest::TearDown() { diff --git a/components/guest_view/browser/guest_view_base.cc b/components/guest_view/browser/guest_view_base.cc index 46bdb14..ff69424 100644 --- a/components/guest_view/browser/guest_view_base.cc +++ b/components/guest_view/browser/guest_view_base.cc @@ -4,6 +4,8 @@ #include "components/guest_view/browser/guest_view_base.h" +#include <utility> + #include "base/lazy_instance.h" #include "base/macros.h" #include "base/strings/utf_string_conversions.h" @@ -256,7 +258,7 @@ void GuestViewBase::DispatchOnResizeEvent(const gfx::Size& old_size, args->SetInteger(kOldHeight, old_size.height()); args->SetInteger(kNewWidth, new_size.width()); args->SetInteger(kNewHeight, new_size.height()); - DispatchEventToGuestProxy(new GuestViewEvent(kEventResize, args.Pass())); + DispatchEventToGuestProxy(new GuestViewEvent(kEventResize, std::move(args))); } gfx::Size GuestViewBase::GetDefaultSize() const { diff --git a/components/guest_view/browser/guest_view_event.cc b/components/guest_view/browser/guest_view_event.cc index a88d62f..f564753 100644 --- a/components/guest_view/browser/guest_view_event.cc +++ b/components/guest_view/browser/guest_view_event.cc @@ -4,6 +4,8 @@ #include "components/guest_view/browser/guest_view_event.h" +#include <utility> + #include "components/guest_view/browser/guest_view_base.h" #include "components/guest_view/browser/guest_view_manager.h" @@ -11,16 +13,14 @@ namespace guest_view { GuestViewEvent::GuestViewEvent(const std::string& name, scoped_ptr<base::DictionaryValue> args) - : name_(name), - args_(args.Pass()) { -} + : name_(name), args_(std::move(args)) {} GuestViewEvent::~GuestViewEvent() { } void GuestViewEvent::Dispatch(GuestViewBase* guest, int instance_id) { - GuestViewManager::FromBrowserContext(guest->browser_context())-> - DispatchEvent(name_, args_.Pass(), guest, instance_id); + GuestViewManager::FromBrowserContext(guest->browser_context()) + ->DispatchEvent(name_, std::move(args_), guest, instance_id); delete this; } diff --git a/components/guest_view/browser/guest_view_manager.cc b/components/guest_view/browser/guest_view_manager.cc index c93f953..0a8afb0 100644 --- a/components/guest_view/browser/guest_view_manager.cc +++ b/components/guest_view/browser/guest_view_manager.cc @@ -5,6 +5,7 @@ #include "components/guest_view/browser/guest_view_manager.h" #include <tuple> +#include <utility> #include "base/macros.h" #include "base/strings/stringprintf.h" @@ -69,9 +70,8 @@ GuestViewManager::GuestViewManager( : current_instance_id_(0), last_instance_id_removed_(0), context_(context), - delegate_(delegate.Pass()), - weak_ptr_factory_(this) { -} + delegate_(std::move(delegate)), + weak_ptr_factory_(this) {} GuestViewManager::~GuestViewManager() {} @@ -83,9 +83,9 @@ GuestViewManager* GuestViewManager::CreateWithDelegate( if (!guest_manager) { if (factory_) { guest_manager = - factory_->CreateGuestViewManager(context, delegate.Pass()); + factory_->CreateGuestViewManager(context, std::move(delegate)); } else { - guest_manager = new GuestViewManager(context, delegate.Pass()); + guest_manager = new GuestViewManager(context, std::move(delegate)); } context->SetUserData(kGuestViewManagerKeyName, guest_manager); } @@ -391,7 +391,7 @@ void GuestViewManager::DispatchEvent(const std::string& event_name, int instance_id) { // TODO(fsamuel): GuestViewManager should probably do something more useful // here like log an error if the event could not be dispatched. - delegate_->DispatchEvent(event_name, args.Pass(), guest, instance_id); + delegate_->DispatchEvent(event_name, std::move(args), guest, instance_id); } content::WebContents* GuestViewManager::GetGuestByInstanceID( diff --git a/components/guest_view/browser/guest_view_manager_unittest.cc b/components/guest_view/browser/guest_view_manager_unittest.cc index f03bc65..50689e7 100644 --- a/components/guest_view/browser/guest_view_manager_unittest.cc +++ b/components/guest_view/browser/guest_view_manager_unittest.cc @@ -2,8 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "base/macros.h" #include "components/guest_view/browser/guest_view_manager.h" + +#include <utility> + +#include "base/macros.h" #include "components/guest_view/browser/guest_view_manager_delegate.h" #include "components/guest_view/browser/test_guest_view_manager.h" #include "content/public/test/test_browser_context.h" @@ -41,7 +44,7 @@ TEST_F(GuestViewManagerTest, AddRemove) { scoped_ptr<GuestViewManagerDelegate> delegate( new GuestViewManagerDelegate()); scoped_ptr<TestGuestViewManager> manager( - new TestGuestViewManager(&browser_context, delegate.Pass())); + new TestGuestViewManager(&browser_context, std::move(delegate))); scoped_ptr<WebContents> web_contents1(CreateWebContents()); scoped_ptr<WebContents> web_contents2(CreateWebContents()); diff --git a/components/guest_view/browser/test_guest_view_manager.cc b/components/guest_view/browser/test_guest_view_manager.cc index eff75a1c..e088bae 100644 --- a/components/guest_view/browser/test_guest_view_manager.cc +++ b/components/guest_view/browser/test_guest_view_manager.cc @@ -4,6 +4,8 @@ #include "components/guest_view/browser/test_guest_view_manager.h" +#include <utility> + #include "base/memory/scoped_ptr.h" #include "components/guest_view/browser/guest_view_manager_delegate.h" @@ -12,13 +14,12 @@ namespace guest_view { TestGuestViewManager::TestGuestViewManager( content::BrowserContext* context, scoped_ptr<GuestViewManagerDelegate> delegate) - : GuestViewManager(context, delegate.Pass()), + : GuestViewManager(context, std::move(delegate)), num_embedder_processes_destroyed_(0), num_guests_created_(0), expected_num_guests_created_(0), num_views_garbage_collected_(0), - waiting_for_guests_created_(false) { -} + waiting_for_guests_created_(false) {} TestGuestViewManager::~TestGuestViewManager() { } @@ -148,7 +149,7 @@ GuestViewManager* TestGuestViewManagerFactory::CreateGuestViewManager( scoped_ptr<GuestViewManagerDelegate> delegate) { if (!test_guest_view_manager_) { test_guest_view_manager_ = - new TestGuestViewManager(context, delegate.Pass()); + new TestGuestViewManager(context, std::move(delegate)); } return test_guest_view_manager_; } diff --git a/components/guest_view/renderer/guest_view_request.cc b/components/guest_view/renderer/guest_view_request.cc index 2a4fd31..45edac4 100644 --- a/components/guest_view/renderer/guest_view_request.cc +++ b/components/guest_view/renderer/guest_view_request.cc @@ -4,6 +4,8 @@ #include "components/guest_view/renderer/guest_view_request.h" +#include <utility> + #include "components/guest_view/common/guest_view_messages.h" #include "components/guest_view/renderer/guest_view_container.h" #include "content/public/renderer/render_frame.h" @@ -53,8 +55,7 @@ GuestViewAttachRequest::GuestViewAttachRequest( v8::Isolate* isolate) : GuestViewRequest(container, callback, isolate), guest_instance_id_(guest_instance_id), - params_(params.Pass()) { -} + params_(std::move(params)) {} GuestViewAttachRequest::~GuestViewAttachRequest() { } @@ -105,7 +106,7 @@ void GuestViewAttachRequest::HandleResponse(const IPC::Message& message) { // Call the AttachGuest API's callback with the guest proxy as the first // parameter. - ExecuteCallbackIfAvailable(argc, argv.Pass()); + ExecuteCallbackIfAvailable(argc, std::move(argv)); } GuestViewDetachRequest::GuestViewDetachRequest( diff --git a/components/guest_view/renderer/iframe_guest_view_request.cc b/components/guest_view/renderer/iframe_guest_view_request.cc index f20e6760..a1555a0 100644 --- a/components/guest_view/renderer/iframe_guest_view_request.cc +++ b/components/guest_view/renderer/iframe_guest_view_request.cc @@ -4,6 +4,8 @@ #include "components/guest_view/renderer/iframe_guest_view_request.h" +#include <utility> + #include "components/guest_view/common/guest_view_messages.h" #include "components/guest_view/renderer/guest_view_container.h" #include "content/public/renderer/render_frame.h" @@ -20,8 +22,7 @@ GuestViewAttachIframeRequest::GuestViewAttachIframeRequest( : GuestViewRequest(container, callback, isolate), render_frame_routing_id_(render_frame_routing_id), guest_instance_id_(guest_instance_id), - params_(params.Pass()) { -} + params_(std::move(params)) {} GuestViewAttachIframeRequest::~GuestViewAttachIframeRequest() { } diff --git a/components/history/content/browser/content_visit_delegate.cc b/components/history/content/browser/content_visit_delegate.cc index cb8ba50..b6137ea 100644 --- a/components/history/content/browser/content_visit_delegate.cc +++ b/components/history/content/browser/content_visit_delegate.cc @@ -4,6 +4,8 @@ #include "components/history/content/browser/content_visit_delegate.h" +#include <utility> + #include "base/logging.h" #include "base/macros.h" #include "base/memory/ref_counted.h" @@ -118,7 +120,7 @@ void ContentVisitDelegate::RebuildTable( const scoped_refptr<URLEnumerator>& enumerator) { DCHECK(history_service_); scoped_ptr<HistoryDBTask> task(new IterateUrlsDBTask(enumerator)); - history_service_->ScheduleDBTask(task.Pass(), &task_tracker_); + history_service_->ScheduleDBTask(std::move(task), &task_tracker_); } } // namespace history diff --git a/components/history/core/browser/delete_directive_handler.cc b/components/history/core/browser/delete_directive_handler.cc index cfd4f47..eadf1a6 100644 --- a/components/history/core/browser/delete_directive_handler.cc +++ b/components/history/core/browser/delete_directive_handler.cc @@ -5,6 +5,7 @@ #include "components/history/core/browser/delete_directive_handler.h" #include <stddef.h> +#include <utility> #include "base/json/json_writer.h" #include "base/rand_util.h" @@ -296,7 +297,7 @@ void DeleteDirectiveHandler::Start( const syncer::SyncDataList& initial_sync_data, scoped_ptr<syncer::SyncChangeProcessor> sync_processor) { DCHECK(thread_checker_.CalledOnValidThread()); - sync_processor_ = sync_processor.Pass(); + sync_processor_ = std::move(sync_processor); if (!initial_sync_data.empty()) { // Drop processed delete directives during startup. history_service->ScheduleDBTask( diff --git a/components/history/core/browser/history_backend.cc b/components/history/core/browser/history_backend.cc index b77dc55..bfbbf2c8 100644 --- a/components/history/core/browser/history_backend.cc +++ b/components/history/core/browser/history_backend.cc @@ -9,6 +9,7 @@ #include <list> #include <map> #include <set> +#include <utility> #include <vector> #include "base/bind.h" @@ -152,7 +153,9 @@ QueuedHistoryDBTask::QueuedHistoryDBTask( scoped_ptr<HistoryDBTask> task, scoped_refptr<base::SingleThreadTaskRunner> origin_loop, const base::CancelableTaskTracker::IsCanceledCallback& is_canceled) - : task_(task.Pass()), origin_loop_(origin_loop), is_canceled_(is_canceled) { + : task_(std::move(task)), + origin_loop_(origin_loop), + is_canceled_(is_canceled) { DCHECK(task_); DCHECK(origin_loop_); DCHECK(!is_canceled_.is_null()); @@ -208,9 +211,8 @@ HistoryBackend::HistoryBackend( recent_redirects_(kMaxRedirectCount), backend_destroy_message_loop_(nullptr), segment_queried_(false), - backend_client_(backend_client.Pass()), - task_runner_(task_runner) { -} + backend_client_(std::move(backend_client)), + task_runner_(task_runner) {} HistoryBackend::~HistoryBackend() { DCHECK(!scheduled_commit_) << "Deleting without cleanup"; @@ -680,7 +682,7 @@ void HistoryBackend::InitImpl( { scoped_ptr<InMemoryHistoryBackend> mem_backend(new InMemoryHistoryBackend); if (mem_backend->Init(history_name)) - delegate_->SetInMemoryBackend(mem_backend.Pass()); + delegate_->SetInMemoryBackend(std::move(mem_backend)); } db_->BeginExclusiveMode(); // Must be after the mem backend read the data. @@ -2536,7 +2538,7 @@ void HistoryBackend::ProcessDBTask( const base::CancelableTaskTracker::IsCanceledCallback& is_canceled) { bool scheduled = !queued_history_db_tasks_.empty(); queued_history_db_tasks_.push_back( - new QueuedHistoryDBTask(task.Pass(), origin_loop, is_canceled)); + new QueuedHistoryDBTask(std::move(task), origin_loop, is_canceled)); if (!scheduled) ProcessDBTaskImpl(); } diff --git a/components/history/core/browser/history_backend_unittest.cc b/components/history/core/browser/history_backend_unittest.cc index aad2fc5..13bcad8 100644 --- a/components/history/core/browser/history_backend_unittest.cc +++ b/components/history/core/browser/history_backend_unittest.cc @@ -291,7 +291,7 @@ class HistoryBackendTestBase : public testing::Test { void HistoryBackendTestDelegate::SetInMemoryBackend( scoped_ptr<InMemoryHistoryBackend> backend) { - test_->SetInMemoryBackend(backend.Pass()); + test_->SetInMemoryBackend(std::move(backend)); } void HistoryBackendTestDelegate::NotifyFaviconsChanged( diff --git a/components/history/core/browser/history_model_worker.cc b/components/history/core/browser/history_model_worker.cc index 76f4200..ac819ff 100644 --- a/components/history/core/browser/history_model_worker.cc +++ b/components/history/core/browser/history_model_worker.cc @@ -4,6 +4,8 @@ #include "components/history/core/browser/history_model_worker.h" +#include <utility> + #include "base/memory/ref_counted.h" #include "base/message_loop/message_loop.h" #include "base/synchronization/waitable_event.h" @@ -70,7 +72,7 @@ void PostWorkerTask( syncer::SyncerError* error) { if (history_service.get()) { scoped_ptr<history::HistoryDBTask> task(new WorkerTask(work, done, error)); - history_service->ScheduleDBTask(task.Pass(), cancelable_tracker); + history_service->ScheduleDBTask(std::move(task), cancelable_tracker); } else { *error = syncer::CANNOT_DO_WORK; done->Signal(); diff --git a/components/history/core/browser/history_service.cc b/components/history/core/browser/history_service.cc index 6b4651d..288c011 100644 --- a/components/history/core/browser/history_service.cc +++ b/components/history/core/browser/history_service.cc @@ -18,6 +18,8 @@ #include "components/history/core/browser/history_service.h" +#include <utility> + #include "base/bind_helpers.h" #include "base/callback.h" #include "base/command_line.h" @@ -191,11 +193,10 @@ HistoryService::HistoryService() HistoryService::HistoryService(scoped_ptr<HistoryClient> history_client, scoped_ptr<VisitDelegate> visit_delegate) : thread_(new base::Thread(kHistoryThreadName)), - history_client_(history_client.Pass()), - visit_delegate_(visit_delegate.Pass()), + history_client_(std::move(history_client)), + visit_delegate_(std::move(visit_delegate)), backend_loaded_(false), - weak_ptr_factory_(this) { -} + weak_ptr_factory_(this) {} HistoryService::~HistoryService() { DCHECK(thread_checker_.CalledOnValidThread()); @@ -967,7 +968,7 @@ syncer::SyncMergeResult HistoryService::MergeDataAndStartSyncing( DCHECK(thread_checker_.CalledOnValidThread()); DCHECK_EQ(type, syncer::HISTORY_DELETE_DIRECTIVES); delete_directive_handler_.Start(this, initial_sync_data, - sync_processor.Pass()); + std::move(sync_processor)); return syncer::SyncMergeResult(type); } diff --git a/components/history/core/browser/thumbnail_database.cc b/components/history/core/browser/thumbnail_database.cc index fb891b76..c295bb4 100644 --- a/components/history/core/browser/thumbnail_database.cc +++ b/components/history/core/browser/thumbnail_database.cc @@ -6,9 +6,9 @@ #include <stddef.h> #include <stdint.h> - #include <algorithm> #include <string> +#include <utility> #include "base/bind.h" #include "base/debug/alias.h" @@ -302,7 +302,7 @@ void RecoverDatabaseOrRaze(sql::Connection* db, const base::FilePath& db_path) { // creating the recover virtual table for corrupt.meta. The table // may not exist, or the database may be too far gone. Either // way, unclear how to resolve. - sql::Recovery::Rollback(recovery.Pass()); + sql::Recovery::Rollback(std::move(recovery)); RecordRecoveryEvent(RECOVERY_EVENT_FAILED_META_VERSION); return; } @@ -314,14 +314,14 @@ void RecoverDatabaseOrRaze(sql::Connection* db, const base::FilePath& db_path) { // the code simple. http://crbug.com/327485 for numbers. DCHECK_LE(kDeprecatedVersionNumber, 6); if (version <= 6) { - sql::Recovery::Unrecoverable(recovery.Pass()); + sql::Recovery::Unrecoverable(std::move(recovery)); RecordRecoveryEvent(RECOVERY_EVENT_DEPRECATED); return; } // Earlier versions have been handled or deprecated. if (version < 7) { - sql::Recovery::Unrecoverable(recovery.Pass()); + sql::Recovery::Unrecoverable(std::move(recovery)); RecordRecoveryEvent(RECOVERY_EVENT_FAILED_META_WRONG_VERSION); return; } @@ -330,7 +330,7 @@ void RecoverDatabaseOrRaze(sql::Connection* db, const base::FilePath& db_path) { sql::MetaTable recover_meta_table; if (!recover_meta_table.Init(recovery->db(), kCurrentVersionNumber, kCompatibleVersionNumber)) { - sql::Recovery::Rollback(recovery.Pass()); + sql::Recovery::Rollback(std::move(recovery)); RecordRecoveryEvent(RECOVERY_EVENT_FAILED_META_INIT); return; } @@ -347,25 +347,25 @@ void RecoverDatabaseOrRaze(sql::Connection* db, const base::FilePath& db_path) { // could be opened as in-memory. If the temp database had a // filesystem problem and the temp filesystem differs from the // main database, then that could fix it. - sql::Recovery::Rollback(recovery.Pass()); + sql::Recovery::Rollback(std::move(recovery)); RecordRecoveryEvent(RECOVERY_EVENT_FAILED_INIT); return; } if (!recovery->AutoRecoverTable("favicons", 0, &favicons_rows_recovered)) { - sql::Recovery::Rollback(recovery.Pass()); + sql::Recovery::Rollback(std::move(recovery)); RecordRecoveryEvent(RECOVERY_EVENT_FAILED_AUTORECOVER_FAVICONS); return; } if (!recovery->AutoRecoverTable("favicon_bitmaps", 0, &favicon_bitmaps_rows_recovered)) { - sql::Recovery::Rollback(recovery.Pass()); + sql::Recovery::Rollback(std::move(recovery)); RecordRecoveryEvent(RECOVERY_EVENT_FAILED_AUTORECOVER_FAVICON_BITMAPS); return; } if (!recovery->AutoRecoverTable("icon_mapping", 0, &icon_mapping_rows_recovered)) { - sql::Recovery::Rollback(recovery.Pass()); + sql::Recovery::Rollback(std::move(recovery)); RecordRecoveryEvent(RECOVERY_EVENT_FAILED_AUTORECOVER_ICON_MAPPING); return; } @@ -380,7 +380,7 @@ void RecoverDatabaseOrRaze(sql::Connection* db, const base::FilePath& db_path) { // and sequence the statements, as it is basically a form of garbage // collection. - if (!sql::Recovery::Recovered(recovery.Pass())) { + if (!sql::Recovery::Recovered(std::move(recovery))) { RecordRecoveryEvent(RECOVERY_EVENT_FAILED_COMMIT); return; } diff --git a/components/history/core/browser/thumbnail_database_unittest.cc b/components/history/core/browser/thumbnail_database_unittest.cc index 8c71f0e..4f6b7c3 100644 --- a/components/history/core/browser/thumbnail_database_unittest.cc +++ b/components/history/core/browser/thumbnail_database_unittest.cc @@ -166,7 +166,7 @@ class ThumbnailDatabaseTest : public testing::Test { EXPECT_EQ(sql::INIT_OK, db->Init(file_name_)); db->BeginTransaction(); - return db.Pass(); + return db; } protected: diff --git a/components/history/core/browser/top_sites_database.cc b/components/history/core/browser/top_sites_database.cc index 3ebccb9..faa61fc 100644 --- a/components/history/core/browser/top_sites_database.cc +++ b/components/history/core/browser/top_sites_database.cc @@ -6,6 +6,7 @@ #include <stddef.h> #include <stdint.h> +#include <utility> #include "base/files/file_util.h" #include "base/memory/ref_counted.h" @@ -228,7 +229,7 @@ void RecoverDatabaseOrRaze(sql::Connection* db, const base::FilePath& db_path) { // TODO(shess): Prior histograms indicate all failures are in creating the // recover virtual table for corrupt.meta. The table may not exist, or the // database may be too far gone. Either way, unclear how to resolve. - sql::Recovery::Rollback(recovery.Pass()); + sql::Recovery::Rollback(std::move(recovery)); RecordRecoveryEvent(RECOVERY_EVENT_FAILED_META_VERSION); return; } @@ -237,7 +238,7 @@ void RecoverDatabaseOrRaze(sql::Connection* db, const base::FilePath& db_path) { // that the regular deprecation path cannot. The effect of this code will be // to raze the database. if (version <= kDeprecatedVersionNumber) { - sql::Recovery::Unrecoverable(recovery.Pass()); + sql::Recovery::Unrecoverable(std::move(recovery)); RecordRecoveryEvent(RECOVERY_EVENT_DEPRECATED); return; } @@ -247,7 +248,7 @@ void RecoverDatabaseOrRaze(sql::Connection* db, const base::FilePath& db_path) { // infrequent enough. if (version != 2 && version != 3) { RecordRecoveryEvent(RECOVERY_EVENT_FAILED_META_WRONG_VERSION); - sql::Recovery::Rollback(recovery.Pass()); + sql::Recovery::Rollback(std::move(recovery)); return; } @@ -255,7 +256,7 @@ void RecoverDatabaseOrRaze(sql::Connection* db, const base::FilePath& db_path) { sql::MetaTable recover_meta_table; if (!recover_meta_table.Init(recovery->db(), kVersionNumber, kVersionNumber)) { - sql::Recovery::Rollback(recovery.Pass()); + sql::Recovery::Rollback(std::move(recovery)); RecordRecoveryEvent(RECOVERY_EVENT_FAILED_META_INIT); return; } @@ -271,7 +272,7 @@ void RecoverDatabaseOrRaze(sql::Connection* db, const base::FilePath& db_path) { // opened as in-memory. If the temp database had a filesystem problem and // the temp filesystem differs from the main database, then that could fix // it. - sql::Recovery::Rollback(recovery.Pass()); + sql::Recovery::Rollback(std::move(recovery)); RecordRecoveryEvent(RECOVERY_EVENT_FAILED_SCHEMA_INIT); return; } @@ -279,7 +280,7 @@ void RecoverDatabaseOrRaze(sql::Connection* db, const base::FilePath& db_path) { // The |1| is because v2 [thumbnails] has one less column than v3 did. In the // v2 case the column will get default values. if (!recovery->AutoRecoverTable("thumbnails", 1, &thumbnails_recovered)) { - sql::Recovery::Rollback(recovery.Pass()); + sql::Recovery::Rollback(std::move(recovery)); RecordRecoveryEvent(RECOVERY_EVENT_FAILED_AUTORECOVER_THUMBNAILS); return; } @@ -287,7 +288,7 @@ void RecoverDatabaseOrRaze(sql::Connection* db, const base::FilePath& db_path) { // TODO(shess): Inline this? FixThumbnailsTable(recovery->db()); - if (!sql::Recovery::Recovered(recovery.Pass())) { + if (!sql::Recovery::Recovered(std::move(recovery))) { // TODO(shess): Very unclear what this failure would actually mean, and what // should be done. Add histograms to Recovered() implementation to get some // insight. diff --git a/components/history/core/browser/top_sites_impl.cc b/components/history/core/browser/top_sites_impl.cc index a0233a4..9e3391e 100644 --- a/components/history/core/browser/top_sites_impl.cc +++ b/components/history/core/browser/top_sites_impl.cc @@ -5,9 +5,9 @@ #include "components/history/core/browser/top_sites_impl.h" #include <stdint.h> - #include <algorithm> #include <set> +#include <utility> #include "base/bind.h" #include "base/bind_helpers.h" @@ -334,7 +334,7 @@ void TopSitesImpl::AddBlacklistedURL(const GURL& url) { { DictionaryPrefUpdate update(pref_service_, kMostVisitedURLsBlacklist); base::DictionaryValue* blacklist = update.Get(); - blacklist->SetWithoutPathExpansion(GetURLHash(url), dummy.Pass()); + blacklist->SetWithoutPathExpansion(GetURLHash(url), std::move(dummy)); } ResetThreadSafeCache(); diff --git a/components/history/core/browser/typed_url_syncable_service.cc b/components/history/core/browser/typed_url_syncable_service.cc index ffe3fe2..820f30a 100644 --- a/components/history/core/browser/typed_url_syncable_service.cc +++ b/components/history/core/browser/typed_url_syncable_service.cc @@ -5,6 +5,7 @@ #include "components/history/core/browser/typed_url_syncable_service.h" #include <stddef.h> +#include <utility> #include "base/auto_reset.h" #include "base/logging.h" @@ -87,8 +88,8 @@ syncer::SyncMergeResult TypedUrlSyncableService::MergeDataAndStartSyncing( DCHECK_EQ(type, syncer::TYPED_URLS); syncer::SyncMergeResult merge_result(type); - sync_processor_ = sync_processor.Pass(); - sync_error_handler_ = error_handler.Pass(); + sync_processor_ = std::move(sync_processor); + sync_error_handler_ = std::move(error_handler); ClearErrorStats(); diff --git a/components/history/core/browser/web_history_service.cc b/components/history/core/browser/web_history_service.cc index b830faf..392db72 100644 --- a/components/history/core/browser/web_history_service.cc +++ b/components/history/core/browser/web_history_service.cc @@ -319,7 +319,7 @@ scoped_ptr<base::DictionaryValue> WebHistoryService::ReadResponse( else DLOG(WARNING) << "Non-JSON response received from history server."; } - return result.Pass(); + return result; } scoped_ptr<WebHistoryService::Request> WebHistoryService::QueryHistory( @@ -333,7 +333,7 @@ scoped_ptr<WebHistoryService::Request> WebHistoryService::QueryHistory( GURL url = GetQueryUrl(text_query, options, server_version_info_); scoped_ptr<Request> request(CreateRequest(url, completion_callback)); request->Start(); - return request.Pass(); + return request; } void WebHistoryService::ExpireHistory( diff --git a/components/html_viewer/ax_provider_apptest.cc b/components/html_viewer/ax_provider_apptest.cc index 588fad6..a8cd4e2 100644 --- a/components/html_viewer/ax_provider_apptest.cc +++ b/components/html_viewer/ax_provider_apptest.cc @@ -4,6 +4,7 @@ #include <stddef.h> #include <stdint.h> +#include <utility> #include "base/bind.h" #include "base/command_line.h" @@ -90,23 +91,23 @@ TEST_F(AXProviderTest, HelloWorld) { mus::mojom::WindowTreeClientPtr tree_client; connection->ConnectToService(&tree_client); mus::Window* embed_window = window_manager()->NewWindow(); - embed_window->Embed(tree_client.Pass()); + embed_window->Embed(std::move(tree_client)); TestFrame frame; web_view::mojom::FramePtr frame_ptr; mojo::Binding<web_view::mojom::Frame> frame_binding(&frame); - frame_binding.Bind(GetProxy(&frame_ptr).Pass()); + frame_binding.Bind(GetProxy(&frame_ptr)); mojo::Array<web_view::mojom::FrameDataPtr> array(1u); - array[0] = web_view::mojom::FrameData::New().Pass(); + array[0] = web_view::mojom::FrameData::New(); array[0]->frame_id = embed_window->id(); array[0]->parent_id = 0u; web_view::mojom::FrameClientPtr frame_client; connection->ConnectToService(&frame_client); frame_client->OnConnect( - frame_ptr.Pass(), 1u, embed_window->id(), - web_view::mojom::WINDOW_CONNECT_TYPE_USE_NEW, array.Pass(), + std::move(frame_ptr), 1u, embed_window->id(), + web_view::mojom::WINDOW_CONNECT_TYPE_USE_NEW, std::move(array), base::TimeTicks::Now().ToInternalValue(), base::Closure()); // Connect to the AxProvider of the HTML document and get the AxTree. @@ -114,9 +115,9 @@ TEST_F(AXProviderTest, HelloWorld) { connection->ConnectToService(&ax_provider); Array<AxNodePtr> ax_tree; ax_provider->GetTree([&ax_tree](Array<AxNodePtr> tree) { - ax_tree = tree.Pass(); - EXPECT_TRUE(QuitRunLoop()); - }); + ax_tree = std::move(tree); + EXPECT_TRUE(QuitRunLoop()); + }); ASSERT_TRUE(DoRunLoopWithTimeout()); EXPECT_TRUE(AxTreeContainsText(ax_tree, "Hello ")); diff --git a/components/html_viewer/ax_provider_impl.cc b/components/html_viewer/ax_provider_impl.cc index 8ef9ae7..84091c0 100644 --- a/components/html_viewer/ax_provider_impl.cc +++ b/components/html_viewer/ax_provider_impl.cc @@ -4,6 +4,8 @@ #include "components/html_viewer/ax_provider_impl.h" +#include <utility> + #include "components/html_viewer/blink_basic_type_converters.h" #include "third_party/WebKit/public/platform/WebURL.h" #include "third_party/WebKit/public/web/WebAXObject.h" @@ -20,12 +22,9 @@ using mojo::String; namespace html_viewer { -AxProviderImpl::AxProviderImpl( - WebView* web_view, - mojo::InterfaceRequest<mojo::AxProvider> request) - : web_view_(web_view), - binding_(this, request.Pass()) { -} +AxProviderImpl::AxProviderImpl(WebView* web_view, + mojo::InterfaceRequest<mojo::AxProvider> request) + : web_view_(web_view), binding_(this, std::move(request)) {} AxProviderImpl::~AxProviderImpl() { } @@ -37,7 +36,7 @@ void AxProviderImpl::GetTree( Array<AxNodePtr> result; Populate(web_view_->accessibilityObject(), 0, 0, &result); - callback.Run(result.Pass()); + callback.Run(std::move(result)); } int AxProviderImpl::Populate(const WebAXObject& ax_object, @@ -49,7 +48,7 @@ int AxProviderImpl::Populate(const WebAXObject& ax_object, if (ax_node.is_null()) return 0; - result->push_back(ax_node.Pass()); + result->push_back(std::move(ax_node)); unsigned num_children = ax_object.childCount(); next_sibling_id = 0; @@ -70,7 +69,7 @@ AxNodePtr AxProviderImpl::ConvertAxNode(const WebAXObject& ax_object, int next_sibling_id) { AxNodePtr result; if (!const_cast<WebAXObject&>(ax_object).updateLayoutAndCheckValidity()) - return result.Pass(); + return result; result = mojo::AxNode::New(); result->id = static_cast<int>(ax_object.axID()); @@ -89,7 +88,7 @@ AxNodePtr AxProviderImpl::ConvertAxNode(const WebAXObject& ax_object, } } - return result.Pass(); + return result; } } // namespace html_viewer diff --git a/components/html_viewer/ax_provider_impl_unittest.cc b/components/html_viewer/ax_provider_impl_unittest.cc index 5dca745..2d60f1e 100644 --- a/components/html_viewer/ax_provider_impl_unittest.cc +++ b/components/html_viewer/ax_provider_impl_unittest.cc @@ -6,6 +6,7 @@ #include <stddef.h> #include <stdint.h> +#include <utility> #include "base/bind.h" #include "base/message_loop/message_loop.h" @@ -75,7 +76,7 @@ class AxProviderImplTest : public testing::Test { }; struct NodeCatcher { - void OnNodes(Array<AxNodePtr> nodes) { this->nodes = nodes.Pass(); } + void OnNodes(Array<AxNodePtr> nodes) { this->nodes = std::move(nodes); } Array<AxNodePtr> nodes; }; @@ -99,7 +100,7 @@ AxNodePtr CreateNode(int id, node->text = mojo::AxText::New(); node->text->content = text; } - return node.Pass(); + return node; } } // namespace diff --git a/components/html_viewer/blink_basic_type_converters.cc b/components/html_viewer/blink_basic_type_converters.cc index b72946d..8d5c329 100644 --- a/components/html_viewer/blink_basic_type_converters.cc +++ b/components/html_viewer/blink_basic_type_converters.cc @@ -41,7 +41,7 @@ RectPtr TypeConverter<RectPtr, WebRect>::Convert(const WebRect& input) { result->y = input.y; result->width = input.width; result->height = input.height; - return result.Pass(); + return result; }; // static @@ -54,7 +54,7 @@ Array<uint8_t> TypeConverter<Array<uint8_t>, WebString>::Convert( static_assert(sizeof(uint8_t) == sizeof(char), "uint8_t must be the same size as an unsigned char"); memcpy(&result.front(), utf8.data(), utf8.size()); - return result.Pass(); + return result; } } // namespace mojo diff --git a/components/html_viewer/blink_basic_type_converters.h b/components/html_viewer/blink_basic_type_converters.h index 8dedb986a..bae9a78 100644 --- a/components/html_viewer/blink_basic_type_converters.h +++ b/components/html_viewer/blink_basic_type_converters.h @@ -5,12 +5,12 @@ #ifndef COMPONENTS_HTML_VIEWER_BLINK_BASIC_TYPE_CONVERTERS_H_ #define COMPONENTS_HTML_VIEWER_BLINK_BASIC_TYPE_CONVERTERS_H_ -#include "mojo/public/cpp/bindings/type_converter.h" - #include <stddef.h> #include <stdint.h> +#include <utility> #include "mojo/public/cpp/bindings/array.h" +#include "mojo/public/cpp/bindings/type_converter.h" #include "third_party/WebKit/public/platform/WebVector.h" #include "ui/mojo/geometry/geometry.mojom.h" @@ -50,7 +50,7 @@ struct TypeConverter<Array<T>, blink::WebVector<U> > { Array<T> array(vector.size()); for (size_t i = 0; i < vector.size(); ++i) array[i] = TypeConverter<T, U>::Convert(vector[i]); - return array.Pass(); + return std::move(array); } }; diff --git a/components/html_viewer/blink_platform_impl.cc b/components/html_viewer/blink_platform_impl.cc index 19604d2..d8d7812 100644 --- a/components/html_viewer/blink_platform_impl.cc +++ b/components/html_viewer/blink_platform_impl.cc @@ -5,6 +5,7 @@ #include "components/html_viewer/blink_platform_impl.h" #include <cmath> +#include <utility> #include "base/command_line.h" #include "base/macros.h" @@ -84,11 +85,11 @@ BlinkPlatformImpl::BlinkPlatformImpl( mojo::CookieStorePtr cookie_store; connection->ConnectToService(&cookie_store); - cookie_jar_.reset(new WebCookieJarImpl(cookie_store.Pass())); + cookie_jar_.reset(new WebCookieJarImpl(std::move(cookie_store))); mojo::ClipboardPtr clipboard; app->ConnectToService("mojo:clipboard", &clipboard); - clipboard_.reset(new WebClipboardImpl(clipboard.Pass())); + clipboard_.reset(new WebClipboardImpl(std::move(clipboard))); } } diff --git a/components/html_viewer/blink_url_request_type_converters.cc b/components/html_viewer/blink_url_request_type_converters.cc index 1fe0c7c..141964d 100644 --- a/components/html_viewer/blink_url_request_type_converters.cc +++ b/components/html_viewer/blink_url_request_type_converters.cc @@ -5,6 +5,7 @@ #include "components/html_viewer/blink_url_request_type_converters.h" #include <stdint.h> +#include <utility> #include "base/strings/string_util.h" #include "mojo/public/cpp/system/data_pipe.h" @@ -31,7 +32,7 @@ class HeaderFlattener : public blink::WebHTTPHeaderVisitor { HttpHeaderPtr header = HttpHeader::New(); header->name = name_latin1; header->value = value_latin1; - buffer_.push_back(header.Pass()); + buffer_.push_back(std::move(header)); } Array<HttpHeaderPtr> GetBuffer() { @@ -41,10 +42,10 @@ class HeaderFlattener : public blink::WebHTTPHeaderVisitor { HttpHeaderPtr header = HttpHeader::New(); header->name = "Accept"; header->value = "*/*"; - buffer_.push_back(header.Pass()); + buffer_.push_back(std::move(header)); has_accept_header_ = true; } - return buffer_.Pass(); + return std::move(buffer_); } private: @@ -72,8 +73,7 @@ void AddRequestBody(URLRequest* url_request, options.element_num_bytes = 1; options.capacity_num_bytes = num_bytes; DataPipe data_pipe(options); - url_request->body.push_back( - data_pipe.consumer_handle.Pass()); + url_request->body.push_back(std::move(data_pipe.consumer_handle)); WriteDataRaw(data_pipe.producer_handle.get(), element.data.data(), &num_bytes, @@ -102,11 +102,11 @@ URLRequestPtr TypeConverter<URLRequestPtr, blink::WebURLRequest>::Convert( HeaderFlattener flattener; request.visitHTTPHeaderFields(&flattener); - url_request->headers = flattener.GetBuffer().Pass(); + url_request->headers = flattener.GetBuffer(); AddRequestBody(url_request.get(), request); - return url_request.Pass(); + return url_request; } } // namespace mojo diff --git a/components/html_viewer/content_handler_impl.cc b/components/html_viewer/content_handler_impl.cc index 2fdcdbf..fc97032 100644 --- a/components/html_viewer/content_handler_impl.cc +++ b/components/html_viewer/content_handler_impl.cc @@ -4,6 +4,8 @@ #include "components/html_viewer/content_handler_impl.h" +#include <utility> + #include "components/html_viewer/html_document_application_delegate.h" namespace html_viewer { @@ -14,9 +16,8 @@ ContentHandlerImpl::ContentHandlerImpl( mojo::InterfaceRequest<mojo::ContentHandler> request) : global_state_(global_state), app_(app), - binding_(this, request.Pass()), - app_refcount_(app_->app_lifetime_helper()->CreateAppRefCount()) { -} + binding_(this, std::move(request)), + app_refcount_(app_->app_lifetime_helper()->CreateAppRefCount()) {} ContentHandlerImpl::~ContentHandlerImpl() { } @@ -27,7 +28,7 @@ void ContentHandlerImpl::StartApplication( const mojo::Callback<void()>& destruct_callback) { // HTMLDocumentApplicationDelegate deletes itself. new HTMLDocumentApplicationDelegate( - request.Pass(), response.Pass(), global_state_, + std::move(request), std::move(response), global_state_, app_->app_lifetime_helper()->CreateAppRefCount(), destruct_callback); } diff --git a/components/html_viewer/devtools_agent_impl.cc b/components/html_viewer/devtools_agent_impl.cc index a547062..2cf2e89 100644 --- a/components/html_viewer/devtools_agent_impl.cc +++ b/components/html_viewer/devtools_agent_impl.cc @@ -4,6 +4,8 @@ #include "components/html_viewer/devtools_agent_impl.h" +#include <utility> + #include "base/bind.h" #include "base/logging.h" #include "third_party/WebKit/public/platform/WebString.h" @@ -33,7 +35,7 @@ DevToolsAgentImpl::~DevToolsAgentImpl() { void DevToolsAgentImpl::BindToRequest( mojo::InterfaceRequest<DevToolsAgent> request) { - binding_.Bind(request.Pass()); + binding_.Bind(std::move(request)); } void DevToolsAgentImpl::SetClient( @@ -41,7 +43,7 @@ void DevToolsAgentImpl::SetClient( if (client_) frame_->devToolsAgent()->detach(); - client_ = client.Pass(); + client_ = std::move(client); client_.set_connection_error_handler(base::Bind( &DevToolsAgentImpl::OnConnectionError, base::Unretained(this))); diff --git a/components/html_viewer/discardable_memory_allocator.cc b/components/html_viewer/discardable_memory_allocator.cc index 45fdec6..8e97144 100644 --- a/components/html_viewer/discardable_memory_allocator.cc +++ b/components/html_viewer/discardable_memory_allocator.cc @@ -5,6 +5,7 @@ #include "components/html_viewer/discardable_memory_allocator.h" #include <stdint.h> +#include <utility> #include "base/macros.h" #include "base/memory/discardable_memory.h" @@ -127,7 +128,7 @@ DiscardableMemoryAllocator::AllocateLockedDiscardableMemory(size_t size) { it = live_unlocked_chunks_.erase(it); } - return chunk.Pass(); + return std::move(chunk); } std::list<DiscardableMemoryAllocator::DiscardableMemoryChunkImpl*>::iterator diff --git a/components/html_viewer/document_resource_waiter.cc b/components/html_viewer/document_resource_waiter.cc index 7dbab7a..a9c3a0f 100644 --- a/components/html_viewer/document_resource_waiter.cc +++ b/components/html_viewer/document_resource_waiter.cc @@ -4,6 +4,8 @@ #include "components/html_viewer/document_resource_waiter.h" +#include <utility> + #include "components/html_viewer/global_state.h" #include "components/html_viewer/html_document.h" #include "components/html_viewer/html_frame_tree_manager.h" @@ -18,7 +20,7 @@ DocumentResourceWaiter::DocumentResourceWaiter(GlobalState* global_state, HTMLDocument* document) : global_state_(global_state), document_(document), - response_(response.Pass()), + response_(std::move(response)), root_(nullptr), change_id_(0u), window_id_(0u), @@ -44,9 +46,9 @@ void DocumentResourceWaiter::Release( WindowConnectType* window_connect_type, OnConnectCallback* on_connect_callback) { DCHECK(is_ready_); - *frame_client_request = frame_client_request_.Pass(); - *frame = frame_.Pass(); - *frame_data = frame_data_.Pass(); + *frame_client_request = std::move(frame_client_request_); + *frame = std::move(frame_); + *frame_data = std::move(frame_data_); *change_id = change_id_; *window_id = window_id_; *window_connect_type = window_connect_type_; @@ -54,7 +56,7 @@ void DocumentResourceWaiter::Release( } mojo::URLResponsePtr DocumentResourceWaiter::ReleaseURLResponse() { - return response_.Pass(); + return std::move(response_); } void DocumentResourceWaiter::SetRoot(mus::Window* root) { @@ -70,7 +72,7 @@ void DocumentResourceWaiter::Bind( DVLOG(1) << "Request for FrameClient after already supplied one"; return; } - frame_client_binding_.Bind(request.Pass()); + frame_client_binding_.Bind(std::move(request)); } void DocumentResourceWaiter::UpdateIsReady() { @@ -133,8 +135,8 @@ void DocumentResourceWaiter::OnConnect( change_id_ = change_id; window_id_ = window_id; window_connect_type_ = window_connect_type; - frame_ = frame.Pass(); - frame_data_ = frame_data.Pass(); + frame_ = std::move(frame); + frame_data_ = std::move(frame_data); navigation_start_time_ = base::TimeTicks::FromInternalValue(navigation_start_time_ticks); on_connect_callback_ = callback; diff --git a/components/html_viewer/global_state.cc b/components/html_viewer/global_state.cc index 9d78811..5b4999e 100644 --- a/components/html_viewer/global_state.cc +++ b/components/html_viewer/global_state.cc @@ -5,8 +5,8 @@ #include "components/html_viewer/global_state.h" #include <stddef.h> - #include <string> +#include <utility> #include "base/bind.h" #include "base/command_line.h" @@ -163,7 +163,7 @@ void GlobalState::InitIfNecessary(const gfx::Size& screen_size_in_pixels, ui::RegisterPathProvider(); base::File pak_file_2 = pak_file.Duplicate(); ui::ResourceBundle::InitSharedInstanceWithPakFileRegion( - pak_file_2.Pass(), base::MemoryMappedFile::Region::kWholeFile); + std::move(pak_file_2), base::MemoryMappedFile::Region::kWholeFile); } mojo::InitLogging(); @@ -175,7 +175,7 @@ void GlobalState::InitIfNecessary(const gfx::Size& screen_size_in_pixels, // TODO(sky): why is this always using 100? ui::ResourceBundle::GetSharedInstance().AddDataPackFromFile( - pak_file.Pass(), ui::SCALE_FACTOR_100P); + std::move(pak_file), ui::SCALE_FACTOR_100P); compositor_thread_.Start(); @@ -198,7 +198,7 @@ const mus::mojom::GpuInfo* GlobalState::GetGpuInfo() { void GlobalState::GetGpuInfoCallback(mus::mojom::GpuInfoPtr gpu_info) { CHECK(gpu_info); - gpu_info_ = gpu_info.Pass(); + gpu_info_ = std::move(gpu_info); gpu_service_.reset(); } diff --git a/components/html_viewer/html_document.cc b/components/html_viewer/html_document.cc index f9742b0..b515444 100644 --- a/components/html_viewer/html_document.cc +++ b/components/html_viewer/html_document.cc @@ -4,6 +4,8 @@ #include "components/html_viewer/html_document.h" +#include <utility> + #include "base/command_line.h" #include "base/macros.h" #include "base/memory/scoped_ptr.h" @@ -86,7 +88,7 @@ HTMLDocument::TransferableState::~TransferableState() {} void HTMLDocument::TransferableState::Move(TransferableState* other) { owns_window_tree_connection = other->owns_window_tree_connection; root = other->root; - window_tree_delegate_impl = other->window_tree_delegate_impl.Pass(); + window_tree_delegate_impl = std::move(other->window_tree_delegate_impl); other->root = nullptr; other->owns_window_tree_connection = false; @@ -114,7 +116,7 @@ HTMLDocument::HTMLDocument(mojo::ApplicationImpl* html_document_app, connection->AddService<TestHTMLViewer>(this); resource_waiter_.reset( - new DocumentResourceWaiter(global_state_, response.Pass(), this)); + new DocumentResourceWaiter(global_state_, std::move(response), this)); } void HTMLDocument::Destroy() { @@ -161,13 +163,12 @@ void HTMLDocument::Load() { } scoped_ptr<WebURLRequestExtraData> extra_data(new WebURLRequestExtraData); - extra_data->synthetic_response = - resource_waiter_->ReleaseURLResponse().Pass(); + extra_data->synthetic_response = resource_waiter_->ReleaseURLResponse(); base::TimeTicks navigation_start_time = resource_waiter_->navigation_start_time(); frame_ = HTMLFrameTreeManager::CreateFrameAndAttachToTree( - global_state_, window, resource_waiter_.Pass(), this); + global_state_, window, std::move(resource_waiter_), this); // If the frame wasn't created we can destroy ourself. if (!frame_) { @@ -177,7 +178,8 @@ void HTMLDocument::Load() { if (devtools_agent_request_.is_pending()) { if (frame_->devtools_agent()) { - frame_->devtools_agent()->BindToRequest(devtools_agent_request_.Pass()); + frame_->devtools_agent()->BindToRequest( + std::move(devtools_agent_request_)); } else { devtools_agent_request_ = mojo::InterfaceRequest<devtools_service::DevToolsAgent>(); @@ -213,19 +215,19 @@ void HTMLDocument::OnConnectionLost(mus::WindowTreeConnection* connection) { void HTMLDocument::OnFrameDidFinishLoad() { TRACE_EVENT0("html_viewer", "HTMLDocument::OnFrameDidFinishLoad"); did_finish_local_frame_load_ = true; - scoped_ptr<BeforeLoadCache> before_load_cache = before_load_cache_.Pass(); + scoped_ptr<BeforeLoadCache> before_load_cache = std::move(before_load_cache_); if (!before_load_cache) return; // Bind any pending AxProvider and TestHTMLViewer interface requests. for (auto it : before_load_cache->ax_provider_requests) { ax_providers_.insert(new AxProviderImpl( - frame_->frame_tree_manager()->GetWebView(), it->Pass())); + frame_->frame_tree_manager()->GetWebView(), std::move(*it))); } for (auto it : before_load_cache->test_interface_requests) { CHECK(IsTestInterfaceEnabled()); test_html_viewers_.push_back(new TestHTMLViewerImpl( - frame_->web_frame()->toWebLocalFrame(), it->Pass())); + frame_->web_frame()->toWebLocalFrame(), std::move(*it))); } } @@ -275,11 +277,11 @@ void HTMLDocument::Create(mojo::ApplicationConnection* connection, if (!did_finish_local_frame_load_) { // Cache AxProvider interface requests until the document finishes loading. auto cached_request = new mojo::InterfaceRequest<AxProvider>(); - *cached_request = request.Pass(); + *cached_request = std::move(request); GetBeforeLoadCache()->ax_provider_requests.insert(cached_request); } else { ax_providers_.insert( - new AxProviderImpl(frame_->web_view(), request.Pass())); + new AxProviderImpl(frame_->web_view(), std::move(request))); } } @@ -288,11 +290,11 @@ void HTMLDocument::Create(mojo::ApplicationConnection* connection, CHECK(IsTestInterfaceEnabled()); if (!did_finish_local_frame_load_) { auto cached_request = new mojo::InterfaceRequest<TestHTMLViewer>(); - *cached_request = request.Pass(); + *cached_request = std::move(request); GetBeforeLoadCache()->test_interface_requests.insert(cached_request); } else { test_html_viewers_.push_back(new TestHTMLViewerImpl( - frame_->web_frame()->toWebLocalFrame(), request.Pass())); + frame_->web_frame()->toWebLocalFrame(), std::move(request))); } } @@ -303,7 +305,7 @@ void HTMLDocument::Create( DVLOG(1) << "Request for FrameClient after one already vended."; return; } - resource_waiter_->Bind(request.Pass()); + resource_waiter_->Bind(std::move(request)); } void HTMLDocument::Create( @@ -311,9 +313,9 @@ void HTMLDocument::Create( mojo::InterfaceRequest<devtools_service::DevToolsAgent> request) { if (frame_) { if (frame_->devtools_agent()) - frame_->devtools_agent()->BindToRequest(request.Pass()); + frame_->devtools_agent()->BindToRequest(std::move(request)); } else { - devtools_agent_request_ = request.Pass(); + devtools_agent_request_ = std::move(request); } } @@ -325,7 +327,7 @@ void HTMLDocument::Create( new WindowTreeDelegateImpl(this)); transferable_state_.owns_window_tree_connection = true; mus::WindowTreeConnection::Create( - transferable_state_.window_tree_delegate_impl.get(), request.Pass(), + transferable_state_.window_tree_delegate_impl.get(), std::move(request), mus::WindowTreeConnection::CreateType::DONT_WAIT_FOR_EMBED); } diff --git a/components/html_viewer/html_document_application_delegate.cc b/components/html_viewer/html_document_application_delegate.cc index d102ca1..79c2834 100644 --- a/components/html_viewer/html_document_application_delegate.cc +++ b/components/html_viewer/html_document_application_delegate.cc @@ -4,6 +4,8 @@ #include "components/html_viewer/html_document_application_delegate.h" +#include <utility> + #include "base/bind.h" #include "base/macros.h" #include "components/html_viewer/global_state.h" @@ -28,7 +30,7 @@ class HTMLDocumentApplicationDelegate::ServiceConnectorQueue requests_.swap(requests); for (Request* request : requests) { connection->GetLocalServiceProvider()->ConnectToService( - request->interface_name, request->handle.Pass()); + request->interface_name, std::move(request->handle)); } } @@ -44,8 +46,8 @@ class HTMLDocumentApplicationDelegate::ServiceConnectorQueue mojo::ScopedMessagePipeHandle handle) override { scoped_ptr<Request> request(new Request); request->interface_name = interface_name; - request->handle = handle.Pass(); - requests_.push_back(request.Pass()); + request->handle = std::move(handle); + requests_.push_back(std::move(request)); } ScopedVector<Request> requests_; @@ -60,12 +62,12 @@ HTMLDocumentApplicationDelegate::HTMLDocumentApplicationDelegate( scoped_ptr<mojo::AppRefCount> parent_app_refcount, const mojo::Callback<void()>& destruct_callback) : app_(this, - request.Pass(), + std::move(request), base::Bind(&HTMLDocumentApplicationDelegate::OnTerminate, base::Unretained(this))), - parent_app_refcount_(parent_app_refcount.Pass()), + parent_app_refcount_(std::move(parent_app_refcount)), url_(response->url), - initial_response_(response.Pass()), + initial_response_(std::move(response)), global_state_(global_state), html_factory_(this), destruct_callback_(destruct_callback), @@ -99,7 +101,7 @@ bool HTMLDocumentApplicationDelegate::ConfigureIncomingConnection( mojo::ApplicationConnection* connection) { if (initial_response_) { OnResponseReceived(nullptr, mojo::URLLoaderPtr(), connection, nullptr, - initial_response_.Pass()); + std::move(initial_response_)); } else if (url_ == "about:blank") { // This is a little unfortunate. At the browser side, when starting a new // app for "about:blank", the application manager uses @@ -113,7 +115,7 @@ bool HTMLDocumentApplicationDelegate::ConfigureIncomingConnection( response->status_code = 200; response->mime_type = "text/html"; OnResponseReceived(nullptr, mojo::URLLoaderPtr(), connection, nullptr, - response.Pass()); + std::move(response)); } else { // HTMLDocument provides services, but is created asynchronously. Queue up // requests until the HTMLDocument is created. @@ -136,7 +138,7 @@ bool HTMLDocumentApplicationDelegate::ConfigureIncomingConnection( scoped_ptr<mojo::AppRefCount> app_retainer( app_.app_lifetime_helper()->CreateAppRefCount()); raw_loader->Start( - request.Pass(), + std::move(request), base::Bind(&HTMLDocumentApplicationDelegate::OnResponseReceived, weak_factory_.GetWeakPtr(), base::Passed(&app_retainer), base::Passed(&loader), connection, @@ -160,7 +162,7 @@ void HTMLDocumentApplicationDelegate::OnResponseReceived( // HTMLDocument is destroyed when the hosting view is destroyed, or // explicitly from our destructor. HTMLDocument* document = new HTMLDocument( - &app_, connection, response.Pass(), global_state_, + &app_, connection, std::move(response), global_state_, base::Bind(&HTMLDocumentApplicationDelegate::OnHTMLDocumentDeleted2, base::Unretained(this)), html_factory_); diff --git a/components/html_viewer/html_frame.cc b/components/html_viewer/html_frame.cc index ca3ac28..3365852 100644 --- a/components/html_viewer/html_frame.cc +++ b/components/html_viewer/html_frame.cc @@ -5,9 +5,9 @@ #include "components/html_viewer/html_frame.h" #include <stddef.h> - #include <algorithm> #include <limits> +#include <utility> #include "base/bind.h" #include "base/single_thread_task_runner.h" @@ -355,8 +355,9 @@ blink::WebFrame* HTMLFrame::createChildFrame( child_frame->frame_client_binding_.reset( new mojo::Binding<web_view::mojom::FrameClient>( child_frame, mojo::GetProxy(&client_ptr))); - server_->OnCreatedFrame(GetProxy(&(child_frame->server_)), client_ptr.Pass(), - child_window->id(), client_properties.Pass()); + server_->OnCreatedFrame(GetProxy(&(child_frame->server_)), + std::move(client_ptr), child_window->id(), + std::move(client_properties)); return child_frame->web_frame_; } @@ -405,7 +406,7 @@ blink::WebNavigationPolicy HTMLFrame::decidePolicyForNavigation( base::TimeTicks::Now().ToInternalValue(); server_->RequestNavigate( WebNavigationPolicyToNavigationTarget(info.defaultPolicy), id_, - url_request.Pass()); + std::move(url_request)); // TODO(yzshen): crbug.com/532556 If the server side drops the request, // this frame will be in permenant-loading state. We should send a @@ -540,11 +541,11 @@ void HTMLFrame::Bind( web_view::mojom::FramePtr frame, mojo::InterfaceRequest<web_view::mojom::FrameClient> frame_client_request) { DCHECK(IsLocal()); - server_ = frame.Pass(); + server_ = std::move(frame); server_.set_connection_error_handler( base::Bind(&HTMLFrame::Close, base::Unretained(this))); frame_client_binding_.reset(new mojo::Binding<web_view::mojom::FrameClient>( - this, frame_client_request.Pass())); + this, std::move(frame_client_request))); } void HTMLFrame::SetValueFromClientProperty(const std::string& name, @@ -820,7 +821,8 @@ void HTMLFrame::OnConnect( void HTMLFrame::OnFrameAdded(uint32_t change_id, web_view::mojom::FrameDataPtr frame_data) { - frame_tree_manager_->ProcessOnFrameAdded(this, change_id, frame_data.Pass()); + frame_tree_manager_->ProcessOnFrameAdded(this, change_id, + std::move(frame_data)); } void HTMLFrame::OnFrameRemoved(uint32_t change_id, uint32_t frame_id) { @@ -830,8 +832,8 @@ void HTMLFrame::OnFrameRemoved(uint32_t change_id, uint32_t frame_id) { void HTMLFrame::OnFrameClientPropertyChanged(uint32_t frame_id, const mojo::String& name, mojo::Array<uint8_t> new_value) { - frame_tree_manager_->ProcessOnFrameClientPropertyChanged(this, frame_id, name, - new_value.Pass()); + frame_tree_manager_->ProcessOnFrameClientPropertyChanged( + this, frame_id, name, std::move(new_value)); } void HTMLFrame::OnPostMessageEvent(uint32_t source_frame_id, @@ -997,7 +999,7 @@ void HTMLFrame::postMessageEvent(blink::WebLocalFrame* source_web_frame, event->target_origin = mojo::String::From(target_origin.toString()); source_frame->server_->PostMessageEventToFrame(target_frame->id_, - event.Pass()); + std::move(event)); } void HTMLFrame::initializeChildFrame(const blink::WebRect& frame_rect, @@ -1017,7 +1019,7 @@ void HTMLFrame::navigate(const blink::WebURLRequest& request, mojo::URLRequestPtr url_request = mojo::URLRequest::From(request); GetServerFrame()->RequestNavigate( web_view::mojom::NAVIGATION_TARGET_TYPE_EXISTING_FRAME, id_, - url_request.Pass()); + std::move(url_request)); } void HTMLFrame::reload(bool ignore_cache, bool is_client_redirect) { diff --git a/components/html_viewer/html_frame_apptest.cc b/components/html_viewer/html_frame_apptest.cc index 6b611d6..f887ef3 100644 --- a/components/html_viewer/html_frame_apptest.cc +++ b/components/html_viewer/html_frame_apptest.cc @@ -4,6 +4,7 @@ #include <stddef.h> #include <stdint.h> +#include <utility> #include "base/auto_reset.h" #include "base/bind.h" @@ -82,7 +83,7 @@ scoped_ptr<base::Value> ExecuteScript(ApplicationConnection* connection, }); if (!WindowServerTestBase::DoRunLoopWithTimeout()) ADD_FAILURE() << "Timed out waiting for execute to complete"; - return result.Pass(); + return result; } // FrameTreeDelegate that can block waiting for navigation to start. @@ -215,7 +216,7 @@ class HTMLFrameTest : public WindowServerTestBase { mojo::URLRequestPtr BuildRequestForURL(const std::string& url_string) { mojo::URLRequestPtr request(mojo::URLRequest::New()); request->url = mojo::String::From(AddPortToString(url_string)); - return request.Pass(); + return request; } FrameConnection* InitFrameTree(mus::Window* view, @@ -234,8 +235,8 @@ class HTMLFrameTest : public WindowServerTestBase { FrameClient* frame_client = frame_connection->frame_client(); WindowTreeClientPtr tree_client = frame_connection->GetWindowTreeClient(); frame_tree_.reset(new FrameTree( - result->GetContentHandlerID(), view, tree_client.Pass(), - frame_tree_delegate_.get(), frame_client, frame_connection.Pass(), + result->GetContentHandlerID(), view, std::move(tree_client), + frame_tree_delegate_.get(), frame_client, std::move(frame_connection), Frame::ClientPropertyMap(), base::TimeTicks::Now())); frame_tree_delegate_->set_frame_tree(frame_tree_.get()); return result; diff --git a/components/html_viewer/html_frame_properties.cc b/components/html_viewer/html_frame_properties.cc index c176aac..d9e2707 100644 --- a/components/html_viewer/html_frame_properties.cc +++ b/components/html_viewer/html_frame_properties.cc @@ -5,6 +5,7 @@ #include "components/html_viewer/html_frame_properties.h" #include <stddef.h> +#include <utility> #include "base/logging.h" #include "base/pickle.h" @@ -28,7 +29,7 @@ namespace { mojo::Array<uint8_t> IntToClientPropertyArray(int value) { mojo::Array<uint8_t> value_array(sizeof(value)); memcpy(&(value_array.front()), &value, sizeof(value)); - return value_array.Pass(); + return value_array; } bool IntFromClientPropertyArray(const mojo::Array<uint8_t>& value_array, @@ -60,7 +61,7 @@ blink::WebString FrameNameFromClientProperty( mojo::Array<uint8_t> FrameTreeScopeToClientProperty( blink::WebTreeScopeType scope_type) { - return IntToClientPropertyArray(static_cast<int>(scope_type)).Pass(); + return IntToClientPropertyArray(static_cast<int>(scope_type)); } bool FrameTreeScopeFromClientProperty(const mojo::Array<uint8_t>& new_data, @@ -78,7 +79,7 @@ bool FrameTreeScopeFromClientProperty(const mojo::Array<uint8_t>& new_data, mojo::Array<uint8_t> FrameSandboxFlagsToClientProperty( blink::WebSandboxFlags flags) { - return IntToClientPropertyArray(static_cast<int>(flags)).Pass(); + return IntToClientPropertyArray(static_cast<int>(flags)); } bool FrameSandboxFlagsFromClientProperty(const mojo::Array<uint8_t>& new_data, @@ -111,7 +112,7 @@ mojo::Array<uint8_t> FrameOriginToClientProperty(blink::WebFrame* frame) { pickle.WriteUInt16(origin.port()); mojo::Array<uint8_t> origin_array(pickle.size()); memcpy(&(origin_array.front()), pickle.data(), pickle.size()); - return origin_array.Pass(); + return origin_array; } url::Origin FrameOriginFromClientProperty(const mojo::Array<uint8_t>& data) { @@ -150,7 +151,7 @@ void AddToClientPropertiesIfValid( mojo::Array<uint8_t> value, mojo::Map<mojo::String, mojo::Array<uint8_t>>* client_properties) { if (!value.is_null()) - (*client_properties)[name] = value.Pass(); + (*client_properties)[name] = std::move(value); } mojo::Array<uint8_t> GetValueFromClientProperties( @@ -158,7 +159,7 @@ mojo::Array<uint8_t> GetValueFromClientProperties( const mojo::Map<mojo::String, mojo::Array<uint8_t>>& properties) { auto iter = properties.find(name); return iter == properties.end() ? mojo::Array<uint8_t>() - : iter.GetValue().Clone().Pass(); + : iter.GetValue().Clone(); } } // namespace html_viewer diff --git a/components/html_viewer/html_frame_tree_manager.cc b/components/html_viewer/html_frame_tree_manager.cc index 1bf2228..58d7122 100644 --- a/components/html_viewer/html_frame_tree_manager.cc +++ b/components/html_viewer/html_frame_tree_manager.cc @@ -5,8 +5,8 @@ #include "components/html_viewer/html_frame_tree_manager.h" #include <stddef.h> - #include <algorithm> +#include <utility> #include "base/command_line.h" #include "base/logging.h" @@ -154,7 +154,7 @@ HTMLFrame* HTMLFrameTreeManager::CreateFrameAndAttachToTree( HTMLFrame* frame = frame_tree->root_->FindFrame(window_id); DCHECK(frame); - frame->Bind(server_frame.Pass(), frame_client_request.Pass()); + frame->Bind(std::move(server_frame), std::move(frame_client_request)); return frame; } @@ -379,7 +379,7 @@ void HTMLFrameTreeManager::ProcessOnFrameClientPropertyChanged( HTMLFrame* frame = root_->FindFrame(frame_id); if (frame) - frame->SetValueFromClientProperty(name, new_data.Pass()); + frame->SetValueFromClientProperty(name, std::move(new_data)); } HTMLFrame* HTMLFrameTreeManager::FindNewLocalFrame() { diff --git a/components/html_viewer/html_viewer.cc b/components/html_viewer/html_viewer.cc index a454592..8d541d5 100644 --- a/components/html_viewer/html_viewer.cc +++ b/components/html_viewer/html_viewer.cc @@ -4,6 +4,8 @@ #include "components/html_viewer/html_viewer.h" +#include <utility> + #include "components/html_viewer/content_handler_impl.h" #include "components/html_viewer/global_state.h" #include "mojo/application/public/cpp/application_connection.h" @@ -30,7 +32,7 @@ bool HTMLViewer::ConfigureIncomingConnection( void HTMLViewer::Create( mojo::ApplicationConnection* connection, mojo::InterfaceRequest<mojo::ContentHandler> request) { - new ContentHandlerImpl(global_state_.get(), app_, request.Pass()); + new ContentHandlerImpl(global_state_.get(), app_, std::move(request)); } } // namespace html_viewer diff --git a/components/html_viewer/html_widget.cc b/components/html_viewer/html_widget.cc index e13dc4c..21ac280 100644 --- a/components/html_viewer/html_widget.cc +++ b/components/html_viewer/html_widget.cc @@ -5,6 +5,7 @@ #include "components/html_viewer/html_widget.h" #include <stdint.h> +#include <utility> #include "base/command_line.h" #include "components/html_viewer/blink_settings.h" @@ -39,7 +40,7 @@ void InitializeWebLayerTreeView(WebLayerTreeViewImpl* web_layer_tree_view, DCHECK(window); mus::mojom::GpuPtr gpu_service; app->ConnectToService("mojo:mus", &gpu_service); - web_layer_tree_view->Initialize(gpu_service.Pass(), window, widget); + web_layer_tree_view->Initialize(std::move(gpu_service), window, widget); } void UpdateWebViewSizeFromViewSize(mus::Window* window, diff --git a/components/html_viewer/ime_controller.cc b/components/html_viewer/ime_controller.cc index da6e7b1..d438284d 100644 --- a/components/html_viewer/ime_controller.cc +++ b/components/html_viewer/ime_controller.cc @@ -4,6 +4,8 @@ #include "components/html_viewer/ime_controller.h" +#include <utility> + #include "components/html_viewer/blink_text_input_type_converters.h" #include "components/mus/public/cpp/window.h" #include "mojo/converters/blink/blink_input_events_type_converters.h" @@ -65,9 +67,9 @@ void ImeController::UpdateTextInputState(bool show_ime) { state->composition_start = new_info.compositionStart; state->composition_end = new_info.compositionEnd; if (show_ime) - window_->SetImeVisibility(true, state.Pass()); + window_->SetImeVisibility(true, std::move(state)); else - window_->SetTextInputState(state.Pass()); + window_->SetTextInputState(std::move(state)); } } diff --git a/components/html_viewer/layout_test_content_handler_impl.cc b/components/html_viewer/layout_test_content_handler_impl.cc index a66ce4b..163474c 100644 --- a/components/html_viewer/layout_test_content_handler_impl.cc +++ b/components/html_viewer/layout_test_content_handler_impl.cc @@ -4,6 +4,8 @@ #include "components/html_viewer/layout_test_content_handler_impl.h" +#include <utility> + #include "base/bind.h" #include "base/macros.h" #include "components/html_viewer/global_state.h" @@ -50,7 +52,7 @@ LayoutTestContentHandlerImpl::LayoutTestContentHandlerImpl( mojo::InterfaceRequest<mojo::ContentHandler> request, test_runner::WebTestInterfaces* test_interfaces, WebTestDelegateImpl* test_delegate) - : ContentHandlerImpl(global_state, app, request.Pass()), + : ContentHandlerImpl(global_state, app, std::move(request)), test_interfaces_(test_interfaces), test_delegate_(test_delegate), web_widget_proxy_(nullptr), @@ -69,9 +71,8 @@ void LayoutTestContentHandlerImpl::StartApplication( // HTMLDocumentApplicationDelegate deletes itself. HTMLDocumentApplicationDelegate* delegate = new HTMLDocumentApplicationDelegate( - request.Pass(), response.Pass(), global_state(), - app()->app_lifetime_helper()->CreateAppRefCount(), - destruct_callback); + std::move(request), std::move(response), global_state(), + app()->app_lifetime_helper()->CreateAppRefCount(), destruct_callback); delegate->set_html_factory(this); } diff --git a/components/html_viewer/layout_test_html_viewer.cc b/components/html_viewer/layout_test_html_viewer.cc index 459e301..d9a808e 100644 --- a/components/html_viewer/layout_test_html_viewer.cc +++ b/components/html_viewer/layout_test_html_viewer.cc @@ -4,6 +4,8 @@ #include "components/html_viewer/layout_test_html_viewer.h" +#include <utility> + #include "components/html_viewer/global_state.h" #include "components/html_viewer/layout_test_content_handler_impl.h" #include "components/test_runner/web_test_interfaces.h" @@ -44,9 +46,8 @@ void LayoutTestHTMLViewer::TestFinished() { void LayoutTestHTMLViewer::Create( mojo::ApplicationConnection* connection, mojo::InterfaceRequest<mojo::ContentHandler> request) { - new LayoutTestContentHandlerImpl(global_state(), app(), request.Pass(), - test_interfaces_.get(), - &test_delegate_); + new LayoutTestContentHandlerImpl(global_state(), app(), std::move(request), + test_interfaces_.get(), &test_delegate_); } } // namespace html_viewer diff --git a/components/html_viewer/media_factory.cc b/components/html_viewer/media_factory.cc index 27002ec..613ac61 100644 --- a/components/html_viewer/media_factory.cc +++ b/components/html_viewer/media_factory.cc @@ -5,6 +5,7 @@ #include "components/html_viewer/media_factory.h" #include <stdint.h> +#include <utility> #include "base/bind.h" #include "base/command_line.h" @@ -112,9 +113,9 @@ blink::WebMediaPlayer* MediaFactory::CreateMediaPlayer( url_index_.reset(new media::UrlIndex(frame)); } - return new media::WebMediaPlayerImpl(frame, client, encrypted_client, - delegate, media_renderer_factory.Pass(), - GetCdmFactory(), url_index_, params); + return new media::WebMediaPlayerImpl( + frame, client, encrypted_client, delegate, + std::move(media_renderer_factory), GetCdmFactory(), url_index_, params); #endif // defined(OS_ANDROID) } @@ -132,8 +133,8 @@ media::interfaces::ServiceFactory* MediaFactory::GetMediaServiceFactory() { mojo::ServiceProviderPtr service_provider; mojo::URLRequestPtr request(mojo::URLRequest::New()); request->url = mojo::String::From("mojo:media"); - shell_->ConnectToApplication(request.Pass(), GetProxy(&service_provider), - nullptr, nullptr, + shell_->ConnectToApplication(std::move(request), + GetProxy(&service_provider), nullptr, nullptr, base::Bind(&OnGotContentHandlerID)); mojo::ConnectToService(service_provider.get(), &media_service_factory_); } diff --git a/components/html_viewer/mock_web_blob_registry_impl.cc b/components/html_viewer/mock_web_blob_registry_impl.cc index b62eb9c..2ef3989 100644 --- a/components/html_viewer/mock_web_blob_registry_impl.cc +++ b/components/html_viewer/mock_web_blob_registry_impl.cc @@ -4,6 +4,8 @@ #include "components/html_viewer/mock_web_blob_registry_impl.h" +#include <utility> + #include "third_party/WebKit/public/platform/WebBlobData.h" #include "third_party/WebKit/public/platform/WebString.h" #include "third_party/WebKit/public/platform/WebURL.h" @@ -34,7 +36,7 @@ void MockWebBlobRegistryImpl::registerBlobData(const WebString& uuid, data.itemAt(i, *item); items->push_back(item.release()); } - blob_data_items_map_.set(uuid_str, items.Pass()); + blob_data_items_map_.set(uuid_str, std::move(items)); } void MockWebBlobRegistryImpl::addBlobDataRef(const WebString& uuid) { diff --git a/components/html_viewer/replicated_frame_state.cc b/components/html_viewer/replicated_frame_state.cc index c514ad2..e5bdff3 100644 --- a/components/html_viewer/replicated_frame_state.cc +++ b/components/html_viewer/replicated_frame_state.cc @@ -36,16 +36,14 @@ void SetReplicatedFrameStateFromClientProperties( void ClientPropertiesFromReplicatedFrameState( const ReplicatedFrameState& state, mojo::Map<mojo::String, mojo::Array<uint8_t>>* properties) { - AddToClientPropertiesIfValid(kPropertyFrameName, - FrameNameToClientProperty(state.name).Pass(), - properties); AddToClientPropertiesIfValid( - kPropertyFrameTreeScope, - FrameTreeScopeToClientProperty(state.tree_scope).Pass(), properties); + kPropertyFrameName, FrameNameToClientProperty(state.name), properties); + AddToClientPropertiesIfValid(kPropertyFrameTreeScope, + FrameTreeScopeToClientProperty(state.tree_scope), + properties); AddToClientPropertiesIfValid( kPropertyFrameSandboxFlags, - FrameSandboxFlagsToClientProperty(state.sandbox_flags).Pass(), - properties); + FrameSandboxFlagsToClientProperty(state.sandbox_flags), properties); } } // namespace html_viewer diff --git a/components/html_viewer/stats_collection_controller.cc b/components/html_viewer/stats_collection_controller.cc index 24cdd39..9205027 100644 --- a/components/html_viewer/stats_collection_controller.cc +++ b/components/html_viewer/stats_collection_controller.cc @@ -4,6 +4,8 @@ #include "components/html_viewer/stats_collection_controller.h" +#include <utility> + #include "base/command_line.h" #include "base/memory/scoped_ptr.h" #include "base/metrics/histogram.h" @@ -89,12 +91,13 @@ tracing::StartupPerformanceDataCollectorPtr StatsCollectionController::Install( connection->ConnectToService(&collector_for_caller); gin::Handle<StatsCollectionController> controller = gin::CreateHandle( - isolate, new StatsCollectionController(collector_for_controller.Pass())); + isolate, + new StatsCollectionController(std::move(collector_for_controller))); DCHECK(!controller.IsEmpty()); v8::Local<v8::Object> global = context->Global(); global->Set(gin::StringToV8(isolate, "statsCollectionController"), controller.ToV8()); - return collector_for_caller.Pass(); + return collector_for_caller; } // static @@ -109,12 +112,12 @@ StatsCollectionController::ConnectToDataCollector(mojo::ApplicationImpl* app) { tracing::StartupPerformanceDataCollectorPtr collector; app->ConnectToService("mojo:tracing", &collector); - return collector.Pass(); + return collector; } StatsCollectionController::StatsCollectionController( tracing::StartupPerformanceDataCollectorPtr collector) - : startup_performance_data_collector_(collector.Pass()) {} + : startup_performance_data_collector_(std::move(collector)) {} StatsCollectionController::~StatsCollectionController() {} diff --git a/components/html_viewer/test_html_viewer_impl.cc b/components/html_viewer/test_html_viewer_impl.cc index a0af8f7..010e56d 100644 --- a/components/html_viewer/test_html_viewer_impl.cc +++ b/components/html_viewer/test_html_viewer_impl.cc @@ -4,6 +4,8 @@ #include "components/html_viewer/test_html_viewer_impl.h" +#include <utility> + #include "base/json/json_writer.h" #include "base/macros.h" #include "base/stl_util.h" @@ -65,7 +67,7 @@ class TestHTMLViewerImpl::ExecutionCallbackImpl TestHTMLViewerImpl::TestHTMLViewerImpl( blink::WebLocalFrame* web_frame, mojo::InterfaceRequest<TestHTMLViewer> request) - : web_frame_(web_frame), binding_(this, request.Pass()) {} + : web_frame_(web_frame), binding_(this, std::move(request)) {} TestHTMLViewerImpl::~TestHTMLViewerImpl() { STLDeleteElements(&callbacks_); diff --git a/components/html_viewer/web_clipboard_impl.cc b/components/html_viewer/web_clipboard_impl.cc index cf04b7e..33053cf 100644 --- a/components/html_viewer/web_clipboard_impl.cc +++ b/components/html_viewer/web_clipboard_impl.cc @@ -5,6 +5,7 @@ #include "components/html_viewer/web_clipboard_impl.h" #include <stddef.h> +#include <utility> #include "base/bind.h" #include "components/html_viewer/blink_basic_type_converters.h" @@ -57,8 +58,7 @@ const char kMimeTypeWebkitSmartPaste[] = "chromium/x-webkit-paste"; } // namespace WebClipboardImpl::WebClipboardImpl(mojo::ClipboardPtr clipboard) - : clipboard_(clipboard.Pass()) { -} + : clipboard_(std::move(clipboard)) {} WebClipboardImpl::~WebClipboardImpl() { } @@ -176,7 +176,7 @@ void WebClipboardImpl::writePlainText(const blink::WebString& plain_text) { Map<String, Array<uint8_t>> data; data[Clipboard::MIME_TYPE_TEXT] = Array<uint8_t>::From(plain_text); - clipboard_->WriteClipboardData(Clipboard::TYPE_COPY_PASTE, data.Pass()); + clipboard_->WriteClipboardData(Clipboard::TYPE_COPY_PASTE, std::move(data)); } void WebClipboardImpl::writeHTML(const blink::WebString& html_text, @@ -191,7 +191,7 @@ void WebClipboardImpl::writeHTML(const blink::WebString& html_text, if (writeSmartPaste) data[kMimeTypeWebkitSmartPaste] = Array<uint8_t>::From(blink::WebString()); - clipboard_->WriteClipboardData(Clipboard::TYPE_COPY_PASTE, data.Pass()); + clipboard_->WriteClipboardData(Clipboard::TYPE_COPY_PASTE, std::move(data)); } Clipboard::Type WebClipboardImpl::ConvertBufferType(Buffer buffer) { diff --git a/components/html_viewer/web_cookie_jar_impl.cc b/components/html_viewer/web_cookie_jar_impl.cc index c59bfd2..ec04b6c 100644 --- a/components/html_viewer/web_cookie_jar_impl.cc +++ b/components/html_viewer/web_cookie_jar_impl.cc @@ -4,6 +4,8 @@ #include "components/html_viewer/web_cookie_jar_impl.h" +#include <utility> + #include "base/bind.h" #include "third_party/WebKit/public/platform/WebURL.h" @@ -23,8 +25,7 @@ void CopyString(String* output, const String& input) { } // namespace WebCookieJarImpl::WebCookieJarImpl(mojo::CookieStorePtr store) - : store_(store.Pass()) { -} + : store_(std::move(store)) {} WebCookieJarImpl::~WebCookieJarImpl() { } diff --git a/components/html_viewer/web_layer_tree_view_impl.cc b/components/html_viewer/web_layer_tree_view_impl.cc index c223b4e..90e8103 100644 --- a/components/html_viewer/web_layer_tree_view_impl.cc +++ b/components/html_viewer/web_layer_tree_view_impl.cc @@ -5,6 +5,7 @@ #include "components/html_viewer/web_layer_tree_view_impl.h" #include <stddef.h> +#include <utility> #include "base/thread_task_runner_handle.h" #include "cc/blink/web_layer_impl.h" @@ -122,7 +123,7 @@ void WebLayerTreeViewImpl::ApplyViewportDeltas( void WebLayerTreeViewImpl::RequestNewOutputSurface() { if (output_surface_.get()) - layer_tree_host_->SetOutputSurface(output_surface_.Pass()); + layer_tree_host_->SetOutputSurface(std::move(output_surface_)); } void WebLayerTreeViewImpl::DidFailToInitializeOutputSurface() { diff --git a/components/html_viewer/web_socket_handle_impl.cc b/components/html_viewer/web_socket_handle_impl.cc index 155dad2..f311aa8 100644 --- a/components/html_viewer/web_socket_handle_impl.cc +++ b/components/html_viewer/web_socket_handle_impl.cc @@ -4,6 +4,7 @@ #include "components/html_viewer/web_socket_handle_impl.h" +#include <utility> #include <vector> #include "base/bind.h" @@ -76,7 +77,7 @@ class WebSocketClientImpl : public mojo::WebSocketClient { WebSocketClientImpl(WebSocketHandleImpl* handle, blink::WebSocketHandleClient* client, mojo::InterfaceRequest<mojo::WebSocketClient> request) - : handle_(handle), client_(client), binding_(this, request.Pass()) {} + : handle_(handle), client_(client), binding_(this, std::move(request)) {} ~WebSocketClientImpl() override {} private: @@ -86,7 +87,7 @@ class WebSocketClientImpl : public mojo::WebSocketClient { mojo::ScopedDataPipeConsumerHandle receive_stream) override { blink::WebSocketHandleClient* client = client_; WebSocketHandleImpl* handle = handle_; - receive_stream_ = receive_stream.Pass(); + receive_stream_ = std::move(receive_stream); read_queue_.reset(new WebSocketReadQueue(receive_stream_.get())); client->didConnect(handle, selected_subprotocol.To<WebString>(), @@ -167,19 +168,19 @@ void WebSocketHandleImpl::connect(const WebURL& url, // |client_|? mojo::WebSocketClientPtr client_ptr; mojo::MessagePipe pipe; - client_ptr.Bind( - mojo::InterfacePtrInfo<mojo::WebSocketClient>(pipe.handle0.Pass(), 0u)); + client_ptr.Bind(mojo::InterfacePtrInfo<mojo::WebSocketClient>( + std::move(pipe.handle0), 0u)); mojo::InterfaceRequest<mojo::WebSocketClient> request; - request.Bind(pipe.handle1.Pass()); - client_.reset(new WebSocketClientImpl(this, client, request.Pass())); + request.Bind(std::move(pipe.handle1)); + client_.reset(new WebSocketClientImpl(this, client, std::move(request))); mojo::DataPipe data_pipe; - send_stream_ = data_pipe.producer_handle.Pass(); + send_stream_ = std::move(data_pipe.producer_handle); write_queue_.reset(new mojo::WebSocketWriteQueue(send_stream_.get())); - web_socket_->Connect(url.string().utf8(), - mojo::Array<String>::From(protocols), - origin.toString().utf8(), - data_pipe.consumer_handle.Pass(), client_ptr.Pass()); + web_socket_->Connect( + url.string().utf8(), mojo::Array<String>::From(protocols), + origin.toString().utf8(), std::move(data_pipe.consumer_handle), + std::move(client_ptr)); } void WebSocketHandleImpl::send(bool fin, diff --git a/components/html_viewer/web_test_delegate_impl.cc b/components/html_viewer/web_test_delegate_impl.cc index 0be84de..3111c09 100644 --- a/components/html_viewer/web_test_delegate_impl.cc +++ b/components/html_viewer/web_test_delegate_impl.cc @@ -5,6 +5,7 @@ #include "components/html_viewer/web_test_delegate_impl.h" #include <iostream> +#include <utility> #include "base/time/time.h" #include "cc/layers/texture_layer.h" @@ -26,7 +27,7 @@ namespace { class InvokeTaskHelper : public blink::WebTaskRunner::Task { public: InvokeTaskHelper(scoped_ptr<test_runner::WebTask> task) - : task_(task.Pass()) {} + : task_(std::move(task)) {} // WebThread::Task implementation: void run() override { task_->run(); } diff --git a/components/html_viewer/web_url_loader_impl.cc b/components/html_viewer/web_url_loader_impl.cc index ac6bd85..f54e227 100644 --- a/components/html_viewer/web_url_loader_impl.cc +++ b/components/html_viewer/web_url_loader_impl.cc @@ -6,6 +6,7 @@ #include <stddef.h> #include <stdint.h> +#include <utility> #include "base/bind.h" #include "base/logging.h" @@ -97,9 +98,9 @@ void WebURLLoaderImpl::loadSynchronously( mojo::URLRequestPtr url_request = mojo::URLRequest::From(request); url_request->auto_follow_redirects = true; URLResponsePtr url_response; - url_loader_->Start(url_request.Pass(), + url_loader_->Start(std::move(url_request), [&url_response](URLResponsePtr url_response_result) { - url_response = url_response_result.Pass(); + url_response = std::move(url_response_result); }); url_loader_.WaitForIncomingResponse(); if (url_response->error) { @@ -111,7 +112,7 @@ void WebURLLoaderImpl::loadSynchronously( response = ToWebURLResponse(url_response); std::string body; - mojo::common::BlockingCopyToString(url_response->body.Pass(), &body); + mojo::common::BlockingCopyToString(std::move(url_response->body), &body); data.assign(body.data(), body.length()); } @@ -148,7 +149,7 @@ void WebURLLoaderImpl::loadAsynchronously(const blink::WebURLRequest& request, } } - url_loader_->Start(url_request.Pass(), + url_loader_->Start(std::move(url_request), base::Bind(&WebURLLoaderImpl::OnReceivedResponse, weak_factory_.GetWeakPtr(), request)); } @@ -179,9 +180,9 @@ void WebURLLoaderImpl::OnReceivedResponse(const blink::WebURLRequest& request, url_ = GURL(url_response->url); if (url_response->error) { - OnReceivedError(url_response.Pass()); + OnReceivedError(std::move(url_response)); } else if (url_response->redirect_url) { - OnReceivedRedirect(request, url_response.Pass()); + OnReceivedRedirect(request, std::move(url_response)); } else { base::WeakPtr<WebURLLoaderImpl> self(weak_factory_.GetWeakPtr()); client_->didReceiveResponse(this, ToWebURLResponse(url_response)); @@ -191,7 +192,7 @@ void WebURLLoaderImpl::OnReceivedResponse(const blink::WebURLRequest& request, return; // Start streaming data - response_body_stream_ = url_response->body.Pass(); + response_body_stream_ = std::move(url_response->body); ReadMore(); } } diff --git a/components/infobars/core/infobar.cc b/components/infobars/core/infobar.cc index cd8aac4..ed2c5f0 100644 --- a/components/infobars/core/infobar.cc +++ b/components/infobars/core/infobar.cc @@ -5,6 +5,7 @@ #include "components/infobars/core/infobar.h" #include <cmath> +#include <utility> #include "base/logging.h" #include "build/build_config.h" @@ -17,7 +18,7 @@ namespace infobars { InfoBar::InfoBar(scoped_ptr<InfoBarDelegate> delegate) : owner_(NULL), - delegate_(delegate.Pass()), + delegate_(std::move(delegate)), container_(NULL), animation_(this), arrow_height_(0), diff --git a/components/infobars/core/infobar_manager.cc b/components/infobars/core/infobar_manager.cc index c93f05e..eb6fc47 100644 --- a/components/infobars/core/infobar_manager.cc +++ b/components/infobars/core/infobar_manager.cc @@ -4,6 +4,8 @@ #include "components/infobars/core/infobar_manager.h" +#include <utility> + #include "base/command_line.h" #include "components/infobars/core/infobar.h" #include "components/infobars/core/infobars_switches.h" @@ -68,7 +70,7 @@ InfoBar* InfoBarManager::ReplaceInfoBar(InfoBar* old_infobar, scoped_ptr<InfoBar> new_infobar) { DCHECK(old_infobar); if (!infobars_enabled_) - return AddInfoBar(new_infobar.Pass()); // Deletes the infobar. + return AddInfoBar(std::move(new_infobar)); // Deletes the infobar. DCHECK(new_infobar); InfoBars::iterator i(std::find(infobars_.begin(), infobars_.end(), diff --git a/components/invalidation/impl/gcm_invalidation_bridge.cc b/components/invalidation/impl/gcm_invalidation_bridge.cc index f601f7a..84c2187 100644 --- a/components/invalidation/impl/gcm_invalidation_bridge.cc +++ b/components/invalidation/impl/gcm_invalidation_bridge.cc @@ -177,7 +177,7 @@ GCMInvalidationBridge::CreateDelegate() { DCHECK(CalledOnValidThread()); scoped_ptr<syncer::GCMNetworkChannelDelegate> core(new Core( weak_factory_.GetWeakPtr(), base::ThreadTaskRunnerHandle::Get())); - return core.Pass(); + return core; } void GCMInvalidationBridge::CoreInitializationDone( diff --git a/components/invalidation/impl/gcm_network_channel.cc b/components/invalidation/impl/gcm_network_channel.cc index 14cfe7d..3960b60 100644 --- a/components/invalidation/impl/gcm_network_channel.cc +++ b/components/invalidation/impl/gcm_network_channel.cc @@ -4,6 +4,8 @@ #include "components/invalidation/impl/gcm_network_channel.h" +#include <utility> + #include "base/base64url.h" #include "base/i18n/time_formatting.h" #include "base/location.h" @@ -112,7 +114,7 @@ GCMNetworkChannel::GCMNetworkChannel( scoped_refptr<net::URLRequestContextGetter> request_context_getter, scoped_ptr<GCMNetworkChannelDelegate> delegate) : request_context_getter_(request_context_getter), - delegate_(delegate.Pass()), + delegate_(std::move(delegate)), register_backoff_entry_(new net::BackoffEntry(&kRegisterBackoffPolicy)), gcm_channel_online_(false), http_channel_online_(false), @@ -234,7 +236,7 @@ void GCMNetworkChannel::OnURLFetchComplete(const net::URLFetcher* source) { DCHECK(CalledOnValidThread()); DCHECK_EQ(fetcher_.get(), source); // Free fetcher at the end of function. - scoped_ptr<net::URLFetcher> fetcher = fetcher_.Pass(); + scoped_ptr<net::URLFetcher> fetcher = std::move(fetcher_); net::URLRequestStatus status = fetcher->GetStatus(); diagnostic_info_.last_post_response_code_ = @@ -420,7 +422,7 @@ GCMNetworkChannelDiagnostic::CollectDebugData() const { status->SetInteger("GCMNetworkChannel.SentMessages", sent_messages_count_); status->SetInteger("GCMNetworkChannel.ReceivedMessages", parent_->GetReceivedMessagesCount()); - return status.Pass(); + return status; } std::string GCMNetworkChannelDiagnostic::GCMClientResultToString( diff --git a/components/invalidation/impl/gcm_network_channel_unittest.cc b/components/invalidation/impl/gcm_network_channel_unittest.cc index 83a19a1..02d5ab6 100644 --- a/components/invalidation/impl/gcm_network_channel_unittest.cc +++ b/components/invalidation/impl/gcm_network_channel_unittest.cc @@ -2,13 +2,16 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "components/invalidation/impl/gcm_network_channel.h" + +#include <utility> + #include "base/base64url.h" #include "base/run_loop.h" #include "base/strings/string_split.h" #include "base/strings/string_util.h" #include "base/thread_task_runner_handle.h" #include "build/build_config.h" -#include "components/invalidation/impl/gcm_network_channel.h" #include "google_apis/gaia/google_service_auth_error.h" #include "net/url_request/test_url_fetcher_factory.h" #include "net/url_request/url_request_test_util.h" @@ -83,7 +86,7 @@ class TestGCMNetworkChannel : public GCMNetworkChannel { TestGCMNetworkChannel( scoped_refptr<net::URLRequestContextGetter> request_context_getter, scoped_ptr<GCMNetworkChannelDelegate> delegate) - : GCMNetworkChannel(request_context_getter, delegate.Pass()) { + : GCMNetworkChannel(request_context_getter, std::move(delegate)) { ResetRegisterBackoffEntryForTest(&kTestBackoffPolicy); } @@ -139,8 +142,7 @@ class GCMNetworkChannelTest delegate_ = new TestGCMNetworkChannelDelegate(); scoped_ptr<GCMNetworkChannelDelegate> delegate(delegate_); gcm_network_channel_.reset(new TestGCMNetworkChannel( - request_context_getter_, - delegate.Pass())); + request_context_getter_, std::move(delegate))); gcm_network_channel_->AddObserver(this); gcm_network_channel_->SetMessageReceiver( invalidation::NewPermanentCallback( diff --git a/components/invalidation/impl/invalidation_notifier.cc b/components/invalidation/impl/invalidation_notifier.cc index 247bbbf..13d84fe 100644 --- a/components/invalidation/impl/invalidation_notifier.cc +++ b/components/invalidation/impl/invalidation_notifier.cc @@ -4,6 +4,8 @@ #include "components/invalidation/impl/invalidation_notifier.h" +#include <utility> + #include "base/bind.h" #include "base/logging.h" #include "base/metrics/histogram.h" @@ -31,8 +33,7 @@ InvalidationNotifier::InvalidationNotifier( client_info_(client_info), invalidator_client_id_(invalidator_client_id), invalidation_bootstrap_data_(invalidation_bootstrap_data), - invalidation_listener_(network_channel.Pass()) { -} + invalidation_listener_(std::move(network_channel)) {} InvalidationNotifier::~InvalidationNotifier() { DCHECK(CalledOnValidThread()); diff --git a/components/invalidation/impl/invalidation_notifier_unittest.cc b/components/invalidation/impl/invalidation_notifier_unittest.cc index 58b7d14..493691c 100644 --- a/components/invalidation/impl/invalidation_notifier_unittest.cc +++ b/components/invalidation/impl/invalidation_notifier_unittest.cc @@ -4,6 +4,8 @@ #include "components/invalidation/impl/invalidation_notifier.h" +#include <utility> + #include "base/memory/scoped_ptr.h" #include "base/thread_task_runner_handle.h" #include "components/invalidation/impl/fake_invalidation_handler.h" @@ -38,9 +40,9 @@ class InvalidationNotifierTestDelegate { scoped_ptr<notifier::PushClient> push_client( new notifier::FakePushClient()); scoped_ptr<SyncNetworkChannel> network_channel( - new PushClientChannel(push_client.Pass())); + new PushClientChannel(std::move(push_client))); invalidator_.reset(new InvalidationNotifier( - network_channel.Pass(), invalidator_client_id, + std::move(network_channel), invalidator_client_id, UnackedInvalidationsMap(), initial_state, invalidation_state_tracker, base::ThreadTaskRunnerHandle::Get(), "fake_client_info")); } diff --git a/components/invalidation/impl/invalidator_storage.cc b/components/invalidation/impl/invalidator_storage.cc index c9486a6..6710854 100644 --- a/components/invalidation/impl/invalidator_storage.cc +++ b/components/invalidation/impl/invalidator_storage.cc @@ -48,7 +48,7 @@ scoped_ptr<base::ListValue> UnackedInvalidationStorageMapToValue( it != map.end(); ++it) { value->Append(it->second.ToValue().release()); } - return value.Pass(); + return value; } } // namespace diff --git a/components/invalidation/impl/non_blocking_invalidator.cc b/components/invalidation/impl/non_blocking_invalidator.cc index 63af50c..11894bc 100644 --- a/components/invalidation/impl/non_blocking_invalidator.cc +++ b/components/invalidation/impl/non_blocking_invalidator.cc @@ -5,6 +5,7 @@ #include "components/invalidation/impl/non_blocking_invalidator.h" #include <cstddef> +#include <utility> #include "base/location.h" #include "base/logging.h" @@ -160,8 +161,7 @@ void NonBlockingInvalidator::Core::Initialize( scoped_ptr<SyncNetworkChannel> network_channel = initialize_options.network_channel_creator.Run(); invalidation_notifier_.reset(new InvalidationNotifier( - network_channel.Pass(), - initialize_options.invalidator_client_id, + std::move(network_channel), initialize_options.invalidator_client_id, initialize_options.saved_invalidations, initialize_options.invalidation_bootstrap_data, initialize_options.invalidation_state_tracker, diff --git a/components/invalidation/impl/p2p_invalidation_service.cc b/components/invalidation/impl/p2p_invalidation_service.cc index 953f63f..21bb245 100644 --- a/components/invalidation/impl/p2p_invalidation_service.cc +++ b/components/invalidation/impl/p2p_invalidation_service.cc @@ -4,6 +4,8 @@ #include "components/invalidation/impl/p2p_invalidation_service.h" +#include <utility> + #include "base/command_line.h" #include "components/invalidation/impl/invalidation_service_util.h" #include "components/invalidation/impl/p2p_invalidator.h" @@ -22,7 +24,7 @@ P2PInvalidationService::P2PInvalidationService( scoped_ptr<IdentityProvider> identity_provider, const scoped_refptr<net::URLRequestContextGetter>& request_context, syncer::P2PNotificationTarget notification_target) - : identity_provider_(identity_provider.Pass()) { + : identity_provider_(std::move(identity_provider)) { notifier::NotifierOptions notifier_options = ParseNotifierOptions(*base::CommandLine::ForCurrentProcess()); notifier_options.request_context_getter = request_context; diff --git a/components/invalidation/impl/p2p_invalidator.cc b/components/invalidation/impl/p2p_invalidator.cc index 4f39cbd..2c2ce2f 100644 --- a/components/invalidation/impl/p2p_invalidator.cc +++ b/components/invalidation/impl/p2p_invalidator.cc @@ -6,6 +6,7 @@ #include <algorithm> #include <iterator> +#include <utility> #include "base/json/json_reader.h" #include "base/json/json_writer.h" @@ -138,7 +139,7 @@ bool P2PNotificationData::ResetFromString(const std::string& str) { P2PInvalidator::P2PInvalidator(scoped_ptr<notifier::PushClient> push_client, const std::string& invalidator_client_id, P2PNotificationTarget send_notification_target) - : push_client_(push_client.Pass()), + : push_client_(std::move(push_client)), invalidator_client_id_(invalidator_client_id), logged_in_(false), notifications_enabled_(false), diff --git a/components/invalidation/impl/profile_invalidation_provider.cc b/components/invalidation/impl/profile_invalidation_provider.cc index a8342b51f..3b1c72a 100644 --- a/components/invalidation/impl/profile_invalidation_provider.cc +++ b/components/invalidation/impl/profile_invalidation_provider.cc @@ -4,6 +4,8 @@ #include "components/invalidation/impl/profile_invalidation_provider.h" +#include <utility> + #include "components/invalidation/impl/invalidation_prefs.h" #include "components/invalidation/public/invalidation_service.h" #include "components/pref_registry/pref_registry_syncable.h" @@ -12,8 +14,7 @@ namespace invalidation { ProfileInvalidationProvider::ProfileInvalidationProvider( scoped_ptr<InvalidationService> invalidation_service) - : invalidation_service_(invalidation_service.Pass()) { -} + : invalidation_service_(std::move(invalidation_service)) {} ProfileInvalidationProvider::~ProfileInvalidationProvider() { } diff --git a/components/invalidation/impl/push_client_channel.cc b/components/invalidation/impl/push_client_channel.cc index 98e1183..05fca0a 100644 --- a/components/invalidation/impl/push_client_channel.cc +++ b/components/invalidation/impl/push_client_channel.cc @@ -4,6 +4,8 @@ #include "components/invalidation/impl/push_client_channel.h" +#include <utility> + #include "base/stl_util.h" #include "build/build_config.h" #include "components/invalidation/impl/notifier_reason_util.h" @@ -22,7 +24,7 @@ const char kChannelName[] = "tango_raw"; PushClientChannel::PushClientChannel( scoped_ptr<notifier::PushClient> push_client) - : push_client_(push_client.Pass()), + : push_client_(std::move(push_client)), scheduling_hash_(0), sent_messages_count_(0) { push_client_->AddObserver(this); @@ -159,7 +161,7 @@ scoped_ptr<base::DictionaryValue> PushClientChannel::CollectDebugData() const { status->SetInteger("PushClientChannel.SentMessages", sent_messages_count_); status->SetInteger("PushClientChannel.ReceivedMessages", SyncNetworkChannel::GetReceivedMessagesCount()); - return status.Pass(); + return status; } } // namespace syncer diff --git a/components/invalidation/impl/sync_invalidation_listener.cc b/components/invalidation/impl/sync_invalidation_listener.cc index ae91218..922d87b 100644 --- a/components/invalidation/impl/sync_invalidation_listener.cc +++ b/components/invalidation/impl/sync_invalidation_listener.cc @@ -4,6 +4,7 @@ #include "components/invalidation/impl/sync_invalidation_listener.h" +#include <utility> #include <vector> #include "base/bind.h" @@ -33,7 +34,7 @@ SyncInvalidationListener::Delegate::~Delegate() {} SyncInvalidationListener::SyncInvalidationListener( scoped_ptr<SyncNetworkChannel> network_channel) - : sync_network_channel_(network_channel.Pass()), + : sync_network_channel_(std::move(network_channel)), sync_system_resources_(sync_network_channel_.get(), this), delegate_(NULL), ticl_state_(DEFAULT_INVALIDATION_ERROR), @@ -396,7 +397,7 @@ SyncInvalidationListener::CollectDebugData() const { } return_value->Set("SyncInvalidationListener.UnackedInvalidationsMap", unacked_map.release()); - return return_value.Pass(); + return return_value; } void SyncInvalidationListener::StopForTest() { diff --git a/components/invalidation/impl/sync_system_resources.cc b/components/invalidation/impl/sync_system_resources.cc index 52fbda8..5c26ca3 100644 --- a/components/invalidation/impl/sync_system_resources.cc +++ b/components/invalidation/impl/sync_system_resources.cc @@ -7,6 +7,7 @@ #include <cstdlib> #include <cstring> #include <string> +#include <utility> #include "base/bind.h" #include "base/location.h" @@ -169,14 +170,14 @@ scoped_ptr<SyncNetworkChannel> SyncNetworkChannel::CreatePushClientChannel( scoped_ptr<notifier::PushClient> push_client( notifier::PushClient::CreateDefaultOnIOThread(notifier_options)); return scoped_ptr<SyncNetworkChannel>( - new PushClientChannel(push_client.Pass())); + new PushClientChannel(std::move(push_client))); } scoped_ptr<SyncNetworkChannel> SyncNetworkChannel::CreateGCMNetworkChannel( scoped_refptr<net::URLRequestContextGetter> request_context_getter, scoped_ptr<GCMNetworkChannelDelegate> delegate) { - return scoped_ptr<SyncNetworkChannel>(new GCMNetworkChannel( - request_context_getter, delegate.Pass())); + return scoped_ptr<SyncNetworkChannel>( + new GCMNetworkChannel(request_context_getter, std::move(delegate))); } void SyncNetworkChannel::NotifyNetworkStatusChange(bool online) { diff --git a/components/invalidation/impl/ticl_invalidation_service.cc b/components/invalidation/impl/ticl_invalidation_service.cc index e4e8825..f310f8c 100644 --- a/components/invalidation/impl/ticl_invalidation_service.cc +++ b/components/invalidation/impl/ticl_invalidation_service.cc @@ -5,6 +5,7 @@ #include "components/invalidation/impl/ticl_invalidation_service.h" #include <stddef.h> +#include <utility> #include "base/command_line.h" #include "base/macros.h" @@ -62,8 +63,8 @@ TiclInvalidationService::TiclInvalidationService( const scoped_refptr<net::URLRequestContextGetter>& request_context) : OAuth2TokenService::Consumer("ticl_invalidation"), user_agent_(user_agent), - identity_provider_(identity_provider.Pass()), - settings_provider_(settings_provider.Pass()), + identity_provider_(std::move(identity_provider)), + settings_provider_(std::move(settings_provider)), invalidator_registrar_(new syncer::InvalidatorRegistrar()), request_access_token_backoff_(&kRequestAccessTokenBackoffPolicy), network_channel_type_(GCM_NETWORK_CHANNEL), @@ -86,7 +87,7 @@ TiclInvalidationService::~TiclInvalidationService() { void TiclInvalidationService::Init( scoped_ptr<syncer::InvalidationStateTracker> invalidation_state_tracker) { DCHECK(CalledOnValidThread()); - invalidation_state_tracker_ = invalidation_state_tracker.Pass(); + invalidation_state_tracker_ = std::move(invalidation_state_tracker); if (invalidation_state_tracker_->GetInvalidatorClientId().empty()) { invalidation_state_tracker_->ClearAndSetNewClientId( @@ -109,7 +110,7 @@ void TiclInvalidationService::InitForTest( // Here we perform the equivalent of Init() and StartInvalidator(), but with // some minor changes to account for the fact that we're injecting the // invalidator. - invalidation_state_tracker_ = invalidation_state_tracker.Pass(); + invalidation_state_tracker_ = std::move(invalidation_state_tracker); invalidator_.reset(invalidator); invalidator_->RegisterHandler(this); @@ -383,8 +384,7 @@ void TiclInvalidationService::StartInvalidator( gcm_driver_, identity_provider_.get())); network_channel_creator = syncer::NonBlockingInvalidator::MakeGCMNetworkChannelCreator( - request_context_, - gcm_invalidation_bridge_->CreateDelegate().Pass()); + request_context_, gcm_invalidation_bridge_->CreateDelegate()); break; } default: { diff --git a/components/invalidation/impl/unacked_invalidation_set.cc b/components/invalidation/impl/unacked_invalidation_set.cc index 1011291..add5ffd 100644 --- a/components/invalidation/impl/unacked_invalidation_set.cc +++ b/components/invalidation/impl/unacked_invalidation_set.cc @@ -137,7 +137,7 @@ scoped_ptr<base::DictionaryValue> UnackedInvalidationSet::ToValue() const { } value->Set(kInvalidationListKey, list_value.release()); - return value.Pass(); + return value; } bool UnackedInvalidationSet::ResetFromValue( diff --git a/components/invalidation/public/ack_handle.cc b/components/invalidation/public/ack_handle.cc index 7720d04..44e7b67 100644 --- a/components/invalidation/public/ack_handle.cc +++ b/components/invalidation/public/ack_handle.cc @@ -39,7 +39,7 @@ scoped_ptr<base::DictionaryValue> AckHandle::ToValue() const { value->SetString("state", state_); value->SetString("timestamp", base::Int64ToString(timestamp_.ToInternalValue())); - return value.Pass(); + return value; } bool AckHandle::ResetFromValue(const base::DictionaryValue& value) { diff --git a/components/invalidation/public/invalidation.cc b/components/invalidation/public/invalidation.cc index edf23ce..9e518e6 100644 --- a/components/invalidation/public/invalidation.cc +++ b/components/invalidation/public/invalidation.cc @@ -153,7 +153,7 @@ scoped_ptr<base::DictionaryValue> Invalidation::ToValue() const { value->SetString(kVersionKey, base::Int64ToString(version_)); value->SetString(kPayloadKey, payload_); } - return value.Pass(); + return value; } std::string Invalidation::ToString() const { diff --git a/components/invalidation/public/invalidation_util.cc b/components/invalidation/public/invalidation_util.cc index 0c5ac15..7f8334c 100644 --- a/components/invalidation/public/invalidation_util.cc +++ b/components/invalidation/public/invalidation_util.cc @@ -45,7 +45,7 @@ scoped_ptr<base::DictionaryValue> ObjectIdToValue( scoped_ptr<base::DictionaryValue> value(new base::DictionaryValue()); value->SetInteger("source", object_id.source()); value->SetString("name", object_id.name()); - return value.Pass(); + return value; } bool ObjectIdFromValue(const base::DictionaryValue& value, diff --git a/components/invalidation/public/object_id_invalidation_map.cc b/components/invalidation/public/object_id_invalidation_map.cc index caea888..336964f 100644 --- a/components/invalidation/public/object_id_invalidation_map.cc +++ b/components/invalidation/public/object_id_invalidation_map.cc @@ -90,7 +90,7 @@ scoped_ptr<base::ListValue> ObjectIdInvalidationMap::ToValue() const { value->Append(it2->ToValue().release()); } } - return value.Pass(); + return value; } bool ObjectIdInvalidationMap::ResetFromValue(const base::ListValue& value) { diff --git a/components/invalidation/public/single_object_invalidation_set.cc b/components/invalidation/public/single_object_invalidation_set.cc index a261486..6fa26c8 100644 --- a/components/invalidation/public/single_object_invalidation_set.cc +++ b/components/invalidation/public/single_object_invalidation_set.cc @@ -91,7 +91,7 @@ scoped_ptr<base::ListValue> SingleObjectInvalidationSet::ToValue() const { it != invalidations_.end(); ++it) { value->Append(it->ToValue().release()); } - return value.Pass(); + return value; } bool SingleObjectInvalidationSet::ResetFromValue( diff --git a/components/keyed_service/core/keyed_service_factory.cc b/components/keyed_service/core/keyed_service_factory.cc index efc61f9..401efa2 100644 --- a/components/keyed_service/core/keyed_service_factory.cc +++ b/components/keyed_service/core/keyed_service_factory.cc @@ -4,6 +4,8 @@ #include "components/keyed_service/core/keyed_service_factory.h" +#include <utility> + #include "base/logging.h" #include "base/stl_util.h" #include "base/trace_event/trace_event.h" @@ -89,7 +91,7 @@ KeyedService* KeyedServiceFactory::GetServiceForContext( service = BuildServiceInstanceFor(context); } - Associate(context, service.Pass()); + Associate(context, std::move(service)); return mapping_[context]; } diff --git a/components/leveldb_proto/proto_database_impl.h b/components/leveldb_proto/proto_database_impl.h index ec90c6a..44dc519 100644 --- a/components/leveldb_proto/proto_database_impl.h +++ b/components/leveldb_proto/proto_database_impl.h @@ -6,6 +6,7 @@ #define COMPONENTS_LEVELDB_PROTO_PROTO_DATABASE_IMPL_H_ #include <string> +#include <utility> #include <vector> #include "base/bind.h" @@ -90,7 +91,7 @@ template <typename T> void RunLoadCallback(const typename ProtoDatabase<T>::LoadCallback& callback, const bool* success, scoped_ptr<std::vector<T>> entries) { - callback.Run(*success, entries.Pass()); + callback.Run(*success, std::move(entries)); } template <typename T> diff --git a/components/leveldb_proto/proto_database_impl_unittest.cc b/components/leveldb_proto/proto_database_impl_unittest.cc index 3cf45f5..059ec04 100644 --- a/components/leveldb_proto/proto_database_impl_unittest.cc +++ b/components/leveldb_proto/proto_database_impl_unittest.cc @@ -5,8 +5,8 @@ #include "components/leveldb_proto/proto_database_impl.h" #include <stddef.h> - #include <map> +#include <utility> #include "base/bind.h" #include "base/files/file_util.h" @@ -242,7 +242,7 @@ TEST_F(ProtoDatabaseImplTest, TestDBSaveSuccess) { EXPECT_CALL(*mock_db, Save(_, _)).WillOnce(VerifyUpdateEntries(model)); EXPECT_CALL(caller, SaveCallback(true)); db_->UpdateEntries( - entries.Pass(), keys_to_remove.Pass(), + std::move(entries), std::move(keys_to_remove), base::Bind(&MockDatabaseCaller::SaveCallback, base::Unretained(&caller))); base::RunLoop().RunUntilIdle(); @@ -266,7 +266,7 @@ TEST_F(ProtoDatabaseImplTest, TestDBSaveFailure) { EXPECT_CALL(*mock_db, Save(_, _)).WillOnce(Return(false)); EXPECT_CALL(caller, SaveCallback(false)); db_->UpdateEntries( - entries.Pass(), keys_to_remove.Pass(), + std::move(entries), std::move(keys_to_remove), base::Bind(&MockDatabaseCaller::SaveCallback, base::Unretained(&caller))); base::RunLoop().RunUntilIdle(); @@ -298,7 +298,7 @@ TEST_F(ProtoDatabaseImplTest, TestDBRemoveSuccess) { EXPECT_CALL(*mock_db, Save(_, keys_copy)).WillOnce(Return(true)); EXPECT_CALL(caller, SaveCallback(true)); db_->UpdateEntries( - entries.Pass(), keys_to_remove.Pass(), + std::move(entries), std::move(keys_to_remove), base::Bind(&MockDatabaseCaller::SaveCallback, base::Unretained(&caller))); base::RunLoop().RunUntilIdle(); @@ -322,7 +322,7 @@ TEST_F(ProtoDatabaseImplTest, TestDBRemoveFailure) { EXPECT_CALL(*mock_db, Save(_, _)).WillOnce(Return(false)); EXPECT_CALL(caller, SaveCallback(false)); db_->UpdateEntries( - entries.Pass(), keys_to_remove.Pass(), + std::move(entries), std::move(keys_to_remove), base::Bind(&MockDatabaseCaller::SaveCallback, base::Unretained(&caller))); base::RunLoop().RunUntilIdle(); diff --git a/components/leveldb_proto/testing/fake_db.h b/components/leveldb_proto/testing/fake_db.h index 2a58f52..3552377 100644 --- a/components/leveldb_proto/testing/fake_db.h +++ b/components/leveldb_proto/testing/fake_db.h @@ -6,6 +6,7 @@ #define COMPONENTS_LEVELDB_PROTO_TESTING_FAKE_DB_H_ #include <string> +#include <utility> #include <vector> #include "base/bind.h" @@ -138,7 +139,7 @@ void FakeDB<T>::RunLoadCallback( const typename ProtoDatabase<T>::LoadCallback& callback, scoped_ptr<typename std::vector<T>> entries, bool success) { - callback.Run(success, entries.Pass()); + callback.Run(success, std::move(entries)); } // static diff --git a/components/message_port/web_message_port_channel_impl.cc b/components/message_port/web_message_port_channel_impl.cc index ec952b2..8a85173e 100644 --- a/components/message_port/web_message_port_channel_impl.cc +++ b/components/message_port/web_message_port_channel_impl.cc @@ -6,6 +6,7 @@ #include <stddef.h> #include <stdint.h> +#include <utility> #include "base/bind.h" #include "base/logging.h" @@ -32,13 +33,14 @@ void WebMessagePortChannelImpl::CreatePair( return; } - *channel1 = new WebMessagePortChannelImpl(pipe1.Pass());; - *channel2 = new WebMessagePortChannelImpl(pipe2.Pass()); + *channel1 = new WebMessagePortChannelImpl(std::move(pipe1)); + ; + *channel2 = new WebMessagePortChannelImpl(std::move(pipe2)); } WebMessagePortChannelImpl::WebMessagePortChannelImpl( mojo::ScopedMessagePipeHandle pipe) - : client_(nullptr), pipe_(pipe.Pass()) { + : client_(nullptr), pipe_(std::move(pipe)) { WaitForNextMessage(); } @@ -111,7 +113,7 @@ bool WebMessagePortChannelImpl::tryGetMessage( for (size_t i = 0; i < handles.size(); ++i) { mojo::MessagePipeHandle mph(handles[i]); mojo::ScopedMessagePipeHandle handle(mph); - ports[i] = new WebMessagePortChannelImpl(handle.Pass()); + ports[i] = new WebMessagePortChannelImpl(std::move(handle)); } channels = ports; return true; diff --git a/components/metrics/daily_event.cc b/components/metrics/daily_event.cc index 86899c7..0f9b68a 100644 --- a/components/metrics/daily_event.cc +++ b/components/metrics/daily_event.cc @@ -4,6 +4,8 @@ #include "components/metrics/daily_event.h" +#include <utility> + #include "base/i18n/time_formatting.h" #include "base/metrics/histogram.h" #include "base/prefs/pref_registry_simple.h" @@ -58,7 +60,7 @@ void DailyEvent::RegisterPref(PrefRegistrySimple* registry, void DailyEvent::AddObserver(scoped_ptr<DailyEvent::Observer> observer) { DVLOG(2) << "DailyEvent observer added."; DCHECK(last_fired_.is_null()); - observers_.push_back(observer.Pass()); + observers_.push_back(std::move(observer)); } void DailyEvent::CheckInterval() { diff --git a/components/metrics/metrics_log_manager.cc b/components/metrics/metrics_log_manager.cc index a1cbac1..661dacf 100644 --- a/components/metrics/metrics_log_manager.cc +++ b/components/metrics/metrics_log_manager.cc @@ -5,6 +5,7 @@ #include "components/metrics/metrics_log_manager.h" #include <algorithm> +#include <utility> #include "base/strings/string_util.h" #include "components/metrics/metrics_log.h" @@ -54,7 +55,7 @@ MetricsLogManager::~MetricsLogManager() {} void MetricsLogManager::BeginLoggingWithLog(scoped_ptr<MetricsLog> log) { DCHECK(!current_log_); - current_log_ = log.Pass(); + current_log_ = std::move(log); } void MetricsLogManager::FinishCurrentLog() { diff --git a/components/metrics/metrics_service.cc b/components/metrics/metrics_service.cc index 4498689..50545b3 100644 --- a/components/metrics/metrics_service.cc +++ b/components/metrics/metrics_service.cc @@ -124,9 +124,9 @@ #include "components/metrics/metrics_service.h" -#include <algorithm> - #include <stddef.h> +#include <algorithm> +#include <utility> #include "base/bind.h" #include "base/callback.h" @@ -881,7 +881,7 @@ bool MetricsService::PrepareInitialStabilityLog() { return false; log_manager_.PauseCurrentLog(); - log_manager_.BeginLoggingWithLog(initial_stability_log.Pass()); + log_manager_.BeginLoggingWithLog(std::move(initial_stability_log)); // Note: Some stability providers may record stability stats via histograms, // so this call has to be after BeginLoggingWithLog(). @@ -913,7 +913,7 @@ void MetricsService::PrepareInitialMetricsLog() { // Histograms only get written to the current log, so make the new log current // before writing them. log_manager_.PauseCurrentLog(); - log_manager_.BeginLoggingWithLog(initial_metrics_log_.Pass()); + log_manager_.BeginLoggingWithLog(std::move(initial_metrics_log_)); // Note: Some stability providers may record stability stats via histograms, // so this call has to be after BeginLoggingWithLog(). @@ -1057,7 +1057,7 @@ void MetricsService::GetCurrentSyntheticFieldTrialsForTesting( void MetricsService::RegisterMetricsProvider( scoped_ptr<MetricsProvider> provider) { DCHECK_EQ(INITIALIZED, state_); - metrics_providers_.push_back(provider.Pass()); + metrics_providers_.push_back(std::move(provider)); } void MetricsService::CheckForClonedInstall( diff --git a/components/metrics/metrics_state_manager.cc b/components/metrics/metrics_state_manager.cc index 918e636..b7e224c 100644 --- a/components/metrics/metrics_state_manager.cc +++ b/components/metrics/metrics_state_manager.cc @@ -193,7 +193,7 @@ scoped_ptr<MetricsStateManager> MetricsStateManager::Create( store_client_info, retrieve_client_info)); } - return result.Pass(); + return result; } // static @@ -247,7 +247,7 @@ scoped_ptr<ClientInfo> MetricsStateManager::LoadClientInfoAndMaybeMigrate() { // retrieval failed. DCHECK(!client_info || base::IsValidGUID(client_info->client_id)); - return client_info.Pass(); + return client_info; } int MetricsStateManager::GetLowEntropySource() { diff --git a/components/metrics/metrics_state_manager_unittest.cc b/components/metrics/metrics_state_manager_unittest.cc index f8ab8da..609b298 100644 --- a/components/metrics/metrics_state_manager_unittest.cc +++ b/components/metrics/metrics_state_manager_unittest.cc @@ -8,6 +8,7 @@ #include <stddef.h> #include <stdint.h> #include <string> +#include <utility> #include "base/bind.h" #include "base/command_line.h" @@ -37,7 +38,7 @@ class MetricsStateManagerTest : public testing::Test { base::Bind(&MetricsStateManagerTest::MockStoreClientInfoBackup, base::Unretained(this)), base::Bind(&MetricsStateManagerTest::LoadFakeClientInfoBackup, - base::Unretained(this))).Pass(); + base::Unretained(this))); } // Sets metrics reporting as enabled for testing. @@ -89,7 +90,7 @@ class MetricsStateManagerTest : public testing::Test { fake_client_info_backup_->installation_date; backup_copy->reporting_enabled_date = fake_client_info_backup_->reporting_enabled_date; - return backup_copy.Pass(); + return backup_copy; } bool is_metrics_reporting_enabled_; @@ -253,7 +254,7 @@ TEST_F(MetricsStateManagerTest, ForceClientIdCreation) { EXPECT_EQ(prefs_.GetInt64(prefs::kMetricsReportingEnabledTimestamp), stored_client_info_backup_->reporting_enabled_date); - previous_client_info = stored_client_info_backup_.Pass(); + previous_client_info = std::move(stored_client_info_backup_); } EnableMetricsReporting(); @@ -353,7 +354,7 @@ TEST_F(MetricsStateManagerTest, ForceClientIdCreation) { test_begin_time); EXPECT_TRUE(stored_client_info_backup_); - previous_client_info = stored_client_info_backup_.Pass(); + previous_client_info = std::move(stored_client_info_backup_); } prefs_.SetBoolean(prefs::kMetricsResetIds, true); diff --git a/components/metrics/profiler/tracking_synchronizer.cc b/components/metrics/profiler/tracking_synchronizer.cc index dd7e35d..67c8361 100644 --- a/components/metrics/profiler/tracking_synchronizer.cc +++ b/components/metrics/profiler/tracking_synchronizer.cc @@ -5,6 +5,7 @@ #include "components/metrics/profiler/tracking_synchronizer.h" #include <stddef.h> +#include <utility> #include "base/bind.h" #include "base/callback.h" @@ -182,7 +183,7 @@ TrackingSynchronizer::TrackingSynchronizer( scoped_ptr<base::TickClock> clock, const TrackingSynchronizerDelegateFactory& delegate_factory) : last_used_sequence_number_(kNeverUsableSequenceNumber), - clock_(clock.Pass()) { + clock_(std::move(clock)) { DCHECK(!g_tracking_synchronizer); g_tracking_synchronizer = this; phase_start_times_.push_back(clock_->NowTicks()); diff --git a/components/metrics/profiler/tracking_synchronizer_unittest.cc b/components/metrics/profiler/tracking_synchronizer_unittest.cc index 054fc9b..10e7a27 100644 --- a/components/metrics/profiler/tracking_synchronizer_unittest.cc +++ b/components/metrics/profiler/tracking_synchronizer_unittest.cc @@ -2,12 +2,15 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "components/metrics/profiler/tracking_synchronizer.h" + +#include <utility> + #include "base/bind.h" #include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/test/simple_test_tick_clock.h" #include "base/tracked_objects.h" -#include "components/metrics/profiler/tracking_synchronizer.h" #include "components/metrics/profiler/tracking_synchronizer_delegate.h" #include "components/metrics/profiler/tracking_synchronizer_observer.h" #include "testing/gtest/include/gtest/gtest.h" @@ -102,7 +105,8 @@ class TestObserver : public TrackingSynchronizerObserver { class TestTrackingSynchronizer : public TrackingSynchronizer { public: explicit TestTrackingSynchronizer(scoped_ptr<base::TickClock> clock) - : TrackingSynchronizer(clock.Pass(), base::Bind(&TestDelegate::Create)) {} + : TrackingSynchronizer(std::move(clock), + base::Bind(&TestDelegate::Create)) {} using TrackingSynchronizer::RegisterPhaseCompletion; using TrackingSynchronizer::SendData; diff --git a/components/metrics/serialization/serialization_utils.cc b/components/metrics/serialization/serialization_utils.cc index 97a6e0f..0038b4b 100644 --- a/components/metrics/serialization/serialization_utils.cc +++ b/components/metrics/serialization/serialization_utils.cc @@ -7,8 +7,8 @@ #include <errno.h> #include <stdint.h> #include <sys/file.h> - #include <string> +#include <utility> #include <vector> #include "base/files/file_path.h" @@ -161,7 +161,7 @@ void SerializationUtils::ReadAndTruncateMetricsFromFile( scoped_ptr<MetricSample> sample = ParseSample(message); if (sample) - metrics->push_back(sample.Pass()); + metrics->push_back(std::move(sample)); } result = ftruncate(fd.get(), 0); diff --git a/components/metrics_services_manager/metrics_services_manager.cc b/components/metrics_services_manager/metrics_services_manager.cc index a0a44e0..1dc5005 100644 --- a/components/metrics_services_manager/metrics_services_manager.cc +++ b/components/metrics_services_manager/metrics_services_manager.cc @@ -4,6 +4,8 @@ #include "components/metrics_services_manager/metrics_services_manager.h" +#include <utility> + #include "base/logging.h" #include "components/metrics/metrics_service.h" #include "components/metrics/metrics_service_client.h" @@ -16,7 +18,7 @@ namespace metrics_services_manager { MetricsServicesManager::MetricsServicesManager( scoped_ptr<MetricsServicesManagerClient> client) - : client_(client.Pass()), may_upload_(false), may_record_(false) { + : client_(std::move(client)), may_upload_(false), may_record_(false) { DCHECK(client_); } diff --git a/components/mus/gles2/command_buffer_driver.cc b/components/mus/gles2/command_buffer_driver.cc index f0ea148..78444d1 100644 --- a/components/mus/gles2/command_buffer_driver.cc +++ b/components/mus/gles2/command_buffer_driver.cc @@ -5,6 +5,7 @@ #include "components/mus/gles2/command_buffer_driver.h" #include <stddef.h> +#include <utility> #include "base/atomic_sequence_num.h" #include "base/bind.h" @@ -61,8 +62,8 @@ bool CommandBufferDriver::Initialize( loss_observer, mojo::ScopedSharedBufferHandle shared_state, mojo::Array<int32_t> attribs) { - loss_observer_ = mojo::MakeProxy(loss_observer.Pass()); - return DoInitialize(shared_state.Pass(), attribs.Pass()); + loss_observer_ = mojo::MakeProxy(std::move(loss_observer)); + return DoInitialize(std::move(shared_state), std::move(attribs)); } bool CommandBufferDriver::MakeCurrent() { diff --git a/components/mus/public/cpp/lib/window_tree_client_impl.cc b/components/mus/public/cpp/lib/window_tree_client_impl.cc index c6fd719..aa72171e 100644 --- a/components/mus/public/cpp/lib/window_tree_client_impl.cc +++ b/components/mus/public/cpp/lib/window_tree_client_impl.cc @@ -5,6 +5,7 @@ #include "components/mus/public/cpp/lib/window_tree_client_impl.h" #include <stddef.h> +#include <utility> #include "base/bind.h" #include "components/mus/common/util.h" @@ -703,7 +704,7 @@ void WindowTreeClientImpl::GetWindowManagerInternal( mojo::AssociatedInterfaceRequest<WindowManagerInternal> internal) { window_manager_internal_.reset( new mojo::AssociatedBinding<mojom::WindowManagerInternal>( - this, internal.Pass())); + this, std::move(internal))); } void WindowTreeClientImpl::RequestClose(uint32_t window_id) { diff --git a/components/mus/ws/window_tree_impl.cc b/components/mus/ws/window_tree_impl.cc index 9f4f9cf..f80dfcb 100644 --- a/components/mus/ws/window_tree_impl.cc +++ b/components/mus/ws/window_tree_impl.cc @@ -5,6 +5,7 @@ #include "components/mus/ws/window_tree_impl.h" #include <stddef.h> +#include <utility> #include "base/bind.h" #include "base/macros.h" @@ -968,7 +969,7 @@ void WindowTreeImpl::GetWindowManagerInternalClient( return; window_manager_internal_client_binding_.reset( new mojo::AssociatedBinding<mojom::WindowManagerInternalClient>( - this, internal.Pass())); + this, std::move(internal))); window_manager_internal_ = connection_manager_->GetClientConnection(this) ->GetWindowManagerInternal(); |