Commit d80c3146 authored by mdm@chromium.org's avatar mdm@chromium.org

Avoid using Pickle::WriteSize(), which writes an architecture-dependent amount

of data, in drag action pickles. (The goal is to remove that method entirely.
Uses that never persist or send pickles over the network are [probably] safe,
but having the method around is waiting for accidental misuses.)
Review URL: https://chromiumcodereview.appspot.com/9702013

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@126761 0039d316-1c4b-4281-b951-d872f2087c98
parent e8bd9ed7
...@@ -67,7 +67,7 @@ void BrowserActionDragData::WriteToPickle( ...@@ -67,7 +67,7 @@ void BrowserActionDragData::WriteToPickle(
Profile* profile, Pickle* pickle) const { Profile* profile, Pickle* pickle) const {
pickle->WriteBytes(&profile, sizeof(profile)); pickle->WriteBytes(&profile, sizeof(profile));
pickle->WriteString(id_); pickle->WriteString(id_);
pickle->WriteSize(index_); pickle->WriteUInt64(index_);
} }
bool BrowserActionDragData::ReadFromPickle(Pickle* pickle) { bool BrowserActionDragData::ReadFromPickle(Pickle* pickle) {
...@@ -81,8 +81,10 @@ bool BrowserActionDragData::ReadFromPickle(Pickle* pickle) { ...@@ -81,8 +81,10 @@ bool BrowserActionDragData::ReadFromPickle(Pickle* pickle) {
if (!pickle->ReadString(&data_iterator, &id_)) if (!pickle->ReadString(&data_iterator, &id_))
return false; return false;
if (!pickle->ReadSize(&data_iterator, &index_)) uint64 index;
if (!pickle->ReadUInt64(&data_iterator, &index))
return false; return false;
index_ = static_cast<size_t>(index);
return true; return true;
} }
// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
...@@ -42,7 +42,7 @@ TEST_F(BrowserActionDragDataTest, BrowserActionDragDataFormat) { ...@@ -42,7 +42,7 @@ TEST_F(BrowserActionDragDataTest, BrowserActionDragDataFormat) {
Pickle pickle; Pickle pickle;
pickle.WriteBytes(&profile_ptr, sizeof(&profile)); pickle.WriteBytes(&profile_ptr, sizeof(&profile));
pickle.WriteString(extension_id); pickle.WriteString(extension_id);
pickle.WriteInt(42); pickle.WriteUInt64(42);
ui::OSExchangeData data; ui::OSExchangeData data;
data.SetPickledData(BrowserActionDragData::GetBrowserActionCustomFormat(), data.SetPickledData(BrowserActionDragData::GetBrowserActionCustomFormat(),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment