Change most uses of Pickle to base::Pickle There should be no behavior change. TBR=jschuh (IPC messages) Review URL: https://codereview.chromium.org/1154283003 Cr-Commit-Position: refs/heads/master@{#332552} # # Limited patch for Slackware, only addressing native_backend_kwallet_x # diff --git a/chrome/browser/password_manager/native_backend_kwallet_x.cc b/chrome/browser/password_manager/native_backend_kwallet_x.cc index 85ac9c7..12536ed 100644 --- a/chrome/browser/password_manager/native_backend_kwallet_x.cc +++ b/chrome/browser/password_manager/native_backend_kwallet_x.cc @@ -67,8 +67,8 @@ bool CheckSerializedValue(const uint8_t* byte_array, size_t length, const std::string& realm) { - const Pickle::Header* header = - reinterpret_cast(byte_array); + const base::Pickle::Header* header = + reinterpret_cast(byte_array); if (length < sizeof(*header) || header->payload_size > length - sizeof(*header)) { LOG(WARNING) << "Invalid KWallet entry detected (realm: " << realm << ")"; @@ -79,7 +79,7 @@ // Convenience function to read a GURL from a Pickle. Assumes the URL has // been written as a UTF-8 string. Returns true on success. -bool ReadGURL(PickleIterator* iter, bool warn_only, GURL* url) { +bool ReadGURL(base::PickleIterator* iter, bool warn_only, GURL* url) { std::string url_string; if (!iter->ReadString(&url_string)) { if (!warn_only) @@ -113,12 +113,12 @@ // as either size when reading old pickles that fail to deserialize using the // native size. Returns true on success. bool DeserializeValueSize(const std::string& signon_realm, - const PickleIterator& init_iter, + const base::PickleIterator& init_iter, int version, bool size_32, bool warn_only, ScopedVector* forms) { - PickleIterator iter = init_iter; + base::PickleIterator iter = init_iter; size_t count = 0; if (size_32) { @@ -235,7 +235,7 @@ // Serializes a list of PasswordForms to be stored in the wallet. void SerializeValue(const std::vector& forms, - Pickle* pickle) { + base::Pickle* pickle) { pickle->WriteInt(kPickleVersion); pickle->WriteSizeT(forms.size()); for (autofill::PasswordForm* form : forms) { @@ -637,7 +637,7 @@ } // Can't we all just agree on whether bytes are signed or not? Please? - Pickle pickle(reinterpret_cast(bytes), length); + base::Pickle pickle(reinterpret_cast(bytes), length); *forms = DeserializeValue(signon_realm, pickle); } @@ -719,7 +719,7 @@ continue; // Can't we all just agree on whether bytes are signed or not? Please? - Pickle pickle(reinterpret_cast(bytes), length); + base::Pickle pickle(reinterpret_cast(bytes), length); AppendSecondToFirst(forms, DeserializeValue(signon_realm, pickle)); } return true; @@ -756,7 +756,7 @@ return ret == 0; } - Pickle value; + base::Pickle value; SerializeValue(forms, &value); dbus::MethodCall method_call(kKWalletInterface, "writeEntry"); @@ -856,7 +856,7 @@ continue; // Can't we all just agree on whether bytes are signed or not? Please? - Pickle pickle(reinterpret_cast(bytes), length); + base::Pickle pickle(reinterpret_cast(bytes), length); ScopedVector all_forms = DeserializeValue(signon_realm, pickle); @@ -888,8 +888,8 @@ // static ScopedVector NativeBackendKWallet::DeserializeValue( const std::string& signon_realm, - const Pickle& pickle) { - PickleIterator iter(pickle); + const base::Pickle& pickle) { + base::PickleIterator iter(pickle); int version = -1; if (!iter.ReadInt(&version) || diff --git a/chrome/browser/password_manager/native_backend_kwallet_x_unittest.cc b/chrome/browser/password_manager/native_backend_kwallet_x_unittest.cc index 297a765..9c3a37c 100644 --- a/chrome/browser/password_manager/native_backend_kwallet_x_unittest.cc +++ b/chrome/browser/password_manager/native_backend_kwallet_x_unittest.cc @@ -605,7 +605,8 @@ EXPECT_EQ(sorted_expected[i].first, entries[i]); TestKWallet::Blob value; EXPECT_TRUE(wallet_.readEntry(folder, entries[i], &value)); - Pickle pickle(reinterpret_cast(value.data()), value.size()); + base::Pickle pickle(reinterpret_cast(value.data()), + value.size()); ScopedVector forms = NativeBackendKWalletStub::DeserializeValue(entries[i], pickle); const std::vector& expect = sorted_expected[i].second; @@ -930,14 +931,14 @@ class NativeBackendKWalletPickleTest : public NativeBackendKWalletTestBase { protected: - void CreateVersion6Pickle(const PasswordForm& form, Pickle* pickle); - void CreateVersion5Pickle(const PasswordForm& form, Pickle* pickle); - void CreateVersion3Pickle(const PasswordForm& form, Pickle* pickle); - void CreateVersion2Pickle(const PasswordForm& form, Pickle* pickle); - void CreateVersion1Pickle(const PasswordForm& form, Pickle* pickle); + void CreateVersion6Pickle(const PasswordForm& form, base::Pickle* pickle); + void CreateVersion5Pickle(const PasswordForm& form, base::Pickle* pickle); + void CreateVersion3Pickle(const PasswordForm& form, base::Pickle* pickle); + void CreateVersion2Pickle(const PasswordForm& form, base::Pickle* pickle); + void CreateVersion1Pickle(const PasswordForm& form, base::Pickle* pickle); void CreateVersion0Pickle(bool size_32, const PasswordForm& form, - Pickle* pickle); + base::Pickle* pickle); void CheckVersion6Pickle(); void CheckVersion5Pickle(); void CheckVersion3Pickle(); @@ -953,12 +954,12 @@ void CreatePickle(bool size_32, bool date_created_internal, const PasswordForm& form, - Pickle* pickle); + base::Pickle* pickle); }; void NativeBackendKWalletPickleTest::CreateVersion6Pickle( const PasswordForm& form, - Pickle* pickle) { + base::Pickle* pickle) { pickle->WriteInt(6); CreatePickle(false, true, form, pickle); pickle->WriteInt(form.type); @@ -974,7 +975,7 @@ void NativeBackendKWalletPickleTest::CreateVersion5Pickle( const PasswordForm& form, - Pickle* pickle) { + base::Pickle* pickle) { pickle->WriteInt(5); CreatePickle(false, true, form, pickle); pickle->WriteInt(form.type); @@ -988,7 +989,8 @@ } void NativeBackendKWalletPickleTest::CreateVersion3Pickle( - const PasswordForm& form, Pickle* pickle) { + const PasswordForm& form, + base::Pickle* pickle) { pickle->WriteInt(3); CreatePickle(false, false, form, pickle); pickle->WriteInt(form.type); @@ -998,7 +1000,8 @@ } void NativeBackendKWalletPickleTest::CreateVersion2Pickle( - const PasswordForm& form, Pickle* pickle) { + const PasswordForm& form, + base::Pickle* pickle) { pickle->WriteInt(2); CreatePickle(false, false, form, pickle); pickle->WriteInt(form.type); @@ -1007,13 +1010,16 @@ } void NativeBackendKWalletPickleTest::CreateVersion1Pickle( - const PasswordForm& form, Pickle* pickle) { + const PasswordForm& form, + base::Pickle* pickle) { pickle->WriteInt(1); CreatePickle(false, false, form, pickle); } void NativeBackendKWalletPickleTest::CreateVersion0Pickle( - bool size_32, const PasswordForm& form, Pickle* pickle) { + bool size_32, + const PasswordForm& form, + base::Pickle* pickle) { pickle->WriteInt(0); CreatePickle(size_32, false, form, pickle); } @@ -1021,7 +1027,7 @@ void NativeBackendKWalletPickleTest::CreatePickle(bool size_32, bool date_created_internal, const PasswordForm& form, - Pickle* pickle) { + base::Pickle* pickle) { if (size_32) pickle->WriteUInt32(1); // Size of form list. 32 bits. else @@ -1044,7 +1050,7 @@ } void NativeBackendKWalletPickleTest::CheckVersion6Pickle() { - Pickle pickle; + base::Pickle pickle; PasswordForm form = form_google_; form.generation_upload_status = PasswordForm::NEGATIVE_SIGNAL_SENT; CreateVersion6Pickle(form, &pickle); @@ -1059,7 +1065,7 @@ } void NativeBackendKWalletPickleTest::CheckVersion5Pickle() { - Pickle pickle; + base::Pickle pickle; PasswordForm form = form_google_; CreateVersion5Pickle(form, &pickle); @@ -1072,7 +1078,7 @@ } void NativeBackendKWalletPickleTest::CheckVersion3Pickle() { - Pickle pickle; + base::Pickle pickle; PasswordForm form = form_google_; // Remove the fields which were not present in version #3. form.display_name.clear(); @@ -1090,7 +1096,7 @@ } void NativeBackendKWalletPickleTest::CheckVersion2Pickle() { - Pickle pickle; + base::Pickle pickle; PasswordForm form = old_form_google_; form.times_used = form_google_.times_used; form.type = form_google_.type; @@ -1107,7 +1113,7 @@ // Make sure that we can still read version 1 pickles. void NativeBackendKWalletPickleTest::CheckVersion1Pickle() { - Pickle pickle; + base::Pickle pickle; PasswordForm form = form_google_; CreateVersion1Pickle(form, &pickle); @@ -1123,7 +1129,7 @@ void NativeBackendKWalletPickleTest::CheckVersion0Pickle( bool size_32, PasswordForm::Scheme scheme) { - Pickle pickle; + base::Pickle pickle; PasswordForm form = old_form_google_; form.scheme = scheme; CreateVersion0Pickle(size_32, form, &pickle);