Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1490)

Side by Side Diff: chrome/browser/ui/views/extensions/browser_action_drag_data.cc

Issue 9447084: Refactor Pickle Read methods to use higher performance PickleIterator. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: compile (racing with incoming CLs) Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/views/extensions/browser_action_drag_data.h" 5 #include "chrome/browser/ui/views/extensions/browser_action_drag_data.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/pickle.h" 8 #include "base/pickle.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
11 11
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 #endif 64 #endif
65 65
66 void BrowserActionDragData::WriteToPickle( 66 void BrowserActionDragData::WriteToPickle(
67 Profile* profile, Pickle* pickle) const { 67 Profile* profile, Pickle* pickle) const {
68 pickle->WriteBytes(&profile, sizeof(profile)); 68 pickle->WriteBytes(&profile, sizeof(profile));
69 pickle->WriteString(id_); 69 pickle->WriteString(id_);
70 pickle->WriteSize(index_); 70 pickle->WriteSize(index_);
71 } 71 }
72 72
73 bool BrowserActionDragData::ReadFromPickle(Pickle* pickle) { 73 bool BrowserActionDragData::ReadFromPickle(Pickle* pickle) {
74 void* data_iterator = NULL; 74 PickleIterator data_iterator(*pickle);
75 75
76 const char* tmp; 76 const char* tmp;
77 if (!pickle->ReadBytes(&data_iterator, &tmp, sizeof(profile_))) 77 if (!pickle->ReadBytes(&data_iterator, &tmp, sizeof(profile_)))
78 return false; 78 return false;
79 memcpy(&profile_, tmp, sizeof(profile_)); 79 memcpy(&profile_, tmp, sizeof(profile_));
80 80
81 if (!pickle->ReadString(&data_iterator, &id_)) 81 if (!pickle->ReadString(&data_iterator, &id_))
82 return false; 82 return false;
83 83
84 if (!pickle->ReadSize(&data_iterator, &index_)) 84 if (!pickle->ReadSize(&data_iterator, &index_))
85 return false; 85 return false;
86 86
87 return true; 87 return true;
88 } 88 }
OLDNEW
« no previous file with comments | « chrome/browser/sessions/session_service.cc ('k') | chrome/browser/visitedlink/visitedlink_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698