| Index: base/pickle.cc
|
| diff --git a/base/pickle.cc b/base/pickle.cc
|
| index d461f413dfd2e68a6e97c9f15d5d97dc68faacb3..6eb207faac60a31f55370c0c4f438526d6b206e1 100644
|
| --- a/base/pickle.cc
|
| +++ b/base/pickle.cc
|
| @@ -152,15 +152,15 @@ bool PickleIterator::ReadString(std::string* result) {
|
| return true;
|
| }
|
|
|
| -bool PickleIterator::ReadWString(std::wstring* result) {
|
| +bool PickleIterator::ReadStringPiece(base::StringPiece* result) {
|
| int len;
|
| if (!ReadInt(&len))
|
| return false;
|
| - const char* read_from = GetReadPointerAndAdvance(len, sizeof(wchar_t));
|
| + const char* read_from = GetReadPointerAndAdvance(len);
|
| if (!read_from)
|
| return false;
|
|
|
| - result->assign(reinterpret_cast<const wchar_t*>(read_from), len);
|
| + *result = base::StringPiece(read_from, len);
|
| return true;
|
| }
|
|
|
| @@ -176,6 +176,19 @@ bool PickleIterator::ReadString16(string16* result) {
|
| return true;
|
| }
|
|
|
| +bool PickleIterator::ReadStringPiece16(base::StringPiece16* result) {
|
| + int len;
|
| + if (!ReadInt(&len))
|
| + return false;
|
| + const char* read_from = GetReadPointerAndAdvance(len, sizeof(char16));
|
| + if (!read_from)
|
| + return false;
|
| +
|
| + *result = base::StringPiece16(reinterpret_cast<const char16*>(read_from),
|
| + len);
|
| + return true;
|
| +}
|
| +
|
| bool PickleIterator::ReadData(const char** data, int* length) {
|
| *length = 0;
|
| *data = 0;
|
| @@ -271,22 +284,14 @@ Pickle& Pickle::operator=(const Pickle& other) {
|
| return *this;
|
| }
|
|
|
| -bool Pickle::WriteString(const std::string& value) {
|
| +bool Pickle::WriteString(const base::StringPiece& value) {
|
| if (!WriteInt(static_cast<int>(value.size())))
|
| return false;
|
|
|
| return WriteBytes(value.data(), static_cast<int>(value.size()));
|
| }
|
|
|
| -bool Pickle::WriteWString(const std::wstring& value) {
|
| - if (!WriteInt(static_cast<int>(value.size())))
|
| - return false;
|
| -
|
| - return WriteBytes(value.data(),
|
| - static_cast<int>(value.size() * sizeof(wchar_t)));
|
| -}
|
| -
|
| -bool Pickle::WriteString16(const string16& value) {
|
| +bool Pickle::WriteString16(const base::StringPiece16& value) {
|
| if (!WriteInt(static_cast<int>(value.size())))
|
| return false;
|
|
|
|
|