summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authormdm@chromium.org <mdm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-14 22:10:42 +0000
committermdm@chromium.org <mdm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-14 22:10:42 +0000
commitd80c3146f251a0ebb49963a0567438eecb807339 (patch)
tree572825453c8ebad1ec0122cde985bb31033a8a9c /chrome
parente8bd9ed74f4e0221aeb655b9c0b420f19ed74b2c (diff)
downloadchromium_src-d80c3146f251a0ebb49963a0567438eecb807339.zip
chromium_src-d80c3146f251a0ebb49963a0567438eecb807339.tar.gz
chromium_src-d80c3146f251a0ebb49963a0567438eecb807339.tar.bz2
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
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/ui/views/extensions/browser_action_drag_data.cc6
-rw-r--r--chrome/browser/ui/views/extensions/browser_action_drag_data_unittest.cc4
2 files changed, 6 insertions, 4 deletions
diff --git a/chrome/browser/ui/views/extensions/browser_action_drag_data.cc b/chrome/browser/ui/views/extensions/browser_action_drag_data.cc
index 5af5222..845391f 100644
--- a/chrome/browser/ui/views/extensions/browser_action_drag_data.cc
+++ b/chrome/browser/ui/views/extensions/browser_action_drag_data.cc
@@ -67,7 +67,7 @@ void BrowserActionDragData::WriteToPickle(
Profile* profile, Pickle* pickle) const {
pickle->WriteBytes(&profile, sizeof(profile));
pickle->WriteString(id_);
- pickle->WriteSize(index_);
+ pickle->WriteUInt64(index_);
}
bool BrowserActionDragData::ReadFromPickle(Pickle* pickle) {
@@ -81,8 +81,10 @@ bool BrowserActionDragData::ReadFromPickle(Pickle* pickle) {
if (!pickle->ReadString(&data_iterator, &id_))
return false;
- if (!pickle->ReadSize(&data_iterator, &index_))
+ uint64 index;
+ if (!pickle->ReadUInt64(&data_iterator, &index))
return false;
+ index_ = static_cast<size_t>(index);
return true;
}
diff --git a/chrome/browser/ui/views/extensions/browser_action_drag_data_unittest.cc b/chrome/browser/ui/views/extensions/browser_action_drag_data_unittest.cc
index 7e57cee..d324c4f 100644
--- a/chrome/browser/ui/views/extensions/browser_action_drag_data_unittest.cc
+++ b/chrome/browser/ui/views/extensions/browser_action_drag_data_unittest.cc
@@ -1,4 +1,4 @@
-// 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
// found in the LICENSE file.
@@ -42,7 +42,7 @@ TEST_F(BrowserActionDragDataTest, BrowserActionDragDataFormat) {
Pickle pickle;
pickle.WriteBytes(&profile_ptr, sizeof(&profile));
pickle.WriteString(extension_id);
- pickle.WriteInt(42);
+ pickle.WriteUInt64(42);
ui::OSExchangeData data;
data.SetPickledData(BrowserActionDragData::GetBrowserActionCustomFormat(),