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

Side by Side Diff: chrome/browser/importer/profile_import_process_messages.h

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) 2012 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 // Multiply-included message file, no traditonal include guard. 5 // Multiply-included message file, no traditonal include guard.
6 #include <string> 6 #include <string>
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/string16.h" 10 #include "base/string16.h"
(...skipping 17 matching lines...) Expand all
28 template <> 28 template <>
29 struct ParamTraits<importer::SourceProfile> { 29 struct ParamTraits<importer::SourceProfile> {
30 typedef importer::SourceProfile param_type; 30 typedef importer::SourceProfile param_type;
31 static void Write(Message* m, const param_type& p) { 31 static void Write(Message* m, const param_type& p) {
32 WriteParam(m, p.importer_name); 32 WriteParam(m, p.importer_name);
33 WriteParam(m, static_cast<int>(p.importer_type)); 33 WriteParam(m, static_cast<int>(p.importer_type));
34 WriteParam(m, p.source_path); 34 WriteParam(m, p.source_path);
35 WriteParam(m, p.app_path); 35 WriteParam(m, p.app_path);
36 WriteParam(m, static_cast<int>(p.services_supported)); 36 WriteParam(m, static_cast<int>(p.services_supported));
37 } 37 }
38 static bool Read(const Message* m, void** iter, param_type* p) { 38 static bool Read(const Message* m, PickleIterator* iter, param_type* p) {
39 if (!ReadParam(m, iter, &p->importer_name)) 39 if (!ReadParam(m, iter, &p->importer_name))
40 return false; 40 return false;
41 41
42 int importer_type = 0; 42 int importer_type = 0;
43 if (!ReadParam(m, iter, &importer_type)) 43 if (!ReadParam(m, iter, &importer_type))
44 return false; 44 return false;
45 p->importer_type = static_cast<importer::ImporterType>(importer_type); 45 p->importer_type = static_cast<importer::ImporterType>(importer_type);
46 46
47 if (!ReadParam(m, iter, &p->source_path) || 47 if (!ReadParam(m, iter, &p->source_path) ||
48 !ReadParam(m, iter, &p->app_path)) 48 !ReadParam(m, iter, &p->app_path))
(...skipping 27 matching lines...) Expand all
76 typedef history::URLRow param_type; 76 typedef history::URLRow param_type;
77 static void Write(Message* m, const param_type& p) { 77 static void Write(Message* m, const param_type& p) {
78 WriteParam(m, p.id()); 78 WriteParam(m, p.id());
79 WriteParam(m, p.url()); 79 WriteParam(m, p.url());
80 WriteParam(m, p.title()); 80 WriteParam(m, p.title());
81 WriteParam(m, p.visit_count()); 81 WriteParam(m, p.visit_count());
82 WriteParam(m, p.typed_count()); 82 WriteParam(m, p.typed_count());
83 WriteParam(m, p.last_visit()); 83 WriteParam(m, p.last_visit());
84 WriteParam(m, p.hidden()); 84 WriteParam(m, p.hidden());
85 } 85 }
86 static bool Read(const Message* m, void** iter, param_type* p) { 86 static bool Read(const Message* m, PickleIterator* iter, param_type* p) {
87 history::URLID id; 87 history::URLID id;
88 GURL url; 88 GURL url;
89 string16 title; 89 string16 title;
90 int visit_count, typed_count; 90 int visit_count, typed_count;
91 base::Time last_visit; 91 base::Time last_visit;
92 bool hidden; 92 bool hidden;
93 if (!ReadParam(m, iter, &id) || 93 if (!ReadParam(m, iter, &id) ||
94 !ReadParam(m, iter, &url) || 94 !ReadParam(m, iter, &url) ||
95 !ReadParam(m, iter, &title) || 95 !ReadParam(m, iter, &title) ||
96 !ReadParam(m, iter, &visit_count) || 96 !ReadParam(m, iter, &visit_count) ||
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 struct ParamTraits<ProfileWriter::BookmarkEntry> { 130 struct ParamTraits<ProfileWriter::BookmarkEntry> {
131 typedef ProfileWriter::BookmarkEntry param_type; 131 typedef ProfileWriter::BookmarkEntry param_type;
132 static void Write(Message* m, const param_type& p) { 132 static void Write(Message* m, const param_type& p) {
133 WriteParam(m, p.in_toolbar); 133 WriteParam(m, p.in_toolbar);
134 WriteParam(m, p.is_folder); 134 WriteParam(m, p.is_folder);
135 WriteParam(m, p.url); 135 WriteParam(m, p.url);
136 WriteParam(m, p.path); 136 WriteParam(m, p.path);
137 WriteParam(m, p.title); 137 WriteParam(m, p.title);
138 WriteParam(m, p.creation_time); 138 WriteParam(m, p.creation_time);
139 } 139 }
140 static bool Read(const Message* m, void** iter, param_type* p) { 140 static bool Read(const Message* m, PickleIterator* iter, param_type* p) {
141 return 141 return
142 (ReadParam(m, iter, &p->in_toolbar)) && 142 (ReadParam(m, iter, &p->in_toolbar)) &&
143 (ReadParam(m, iter, &p->is_folder)) && 143 (ReadParam(m, iter, &p->is_folder)) &&
144 (ReadParam(m, iter, &p->url)) && 144 (ReadParam(m, iter, &p->url)) &&
145 (ReadParam(m, iter, &p->path)) && 145 (ReadParam(m, iter, &p->path)) &&
146 (ReadParam(m, iter, &p->title)) && 146 (ReadParam(m, iter, &p->title)) &&
147 (ReadParam(m, iter, &p->creation_time)); 147 (ReadParam(m, iter, &p->creation_time));
148 } 148 }
149 static void Log(const param_type& p, std::string* l) { 149 static void Log(const param_type& p, std::string* l) {
150 l->append("("); 150 l->append("(");
(...skipping 14 matching lines...) Expand all
165 165
166 // Traits for history::ImportedFaviconUsage. 166 // Traits for history::ImportedFaviconUsage.
167 template <> 167 template <>
168 struct ParamTraits<history::ImportedFaviconUsage> { 168 struct ParamTraits<history::ImportedFaviconUsage> {
169 typedef history::ImportedFaviconUsage param_type; 169 typedef history::ImportedFaviconUsage param_type;
170 static void Write(Message* m, const param_type& p) { 170 static void Write(Message* m, const param_type& p) {
171 WriteParam(m, p.favicon_url); 171 WriteParam(m, p.favicon_url);
172 WriteParam(m, p.png_data); 172 WriteParam(m, p.png_data);
173 WriteParam(m, p.urls); 173 WriteParam(m, p.urls);
174 } 174 }
175 static bool Read(const Message* m, void** iter, param_type* p) { 175 static bool Read(const Message* m, PickleIterator* iter, param_type* p) {
176 return 176 return
177 ReadParam(m, iter, &p->favicon_url) && 177 ReadParam(m, iter, &p->favicon_url) &&
178 ReadParam(m, iter, &p->png_data) && 178 ReadParam(m, iter, &p->png_data) &&
179 ReadParam(m, iter, &p->urls); 179 ReadParam(m, iter, &p->urls);
180 } 180 }
181 static void Log(const param_type& p, std::string* l) { 181 static void Log(const param_type& p, std::string* l) {
182 l->append("("); 182 l->append("(");
183 LogParam(p.favicon_url, l); 183 LogParam(p.favicon_url, l);
184 l->append(", "); 184 l->append(", ");
185 LogParam(p.png_data, l); 185 LogParam(p.png_data, l);
186 l->append(", "); 186 l->append(", ");
187 LogParam(p.urls, l); 187 LogParam(p.urls, l);
188 l->append(")"); 188 l->append(")");
189 } 189 }
190 }; // ParamTraits<history::ImportedFaviconUsage 190 }; // ParamTraits<history::ImportedFaviconUsage
191 191
192 // Traits for TemplateURLRef 192 // Traits for TemplateURLRef
193 template <> 193 template <>
194 struct ParamTraits<TemplateURLRef> { 194 struct ParamTraits<TemplateURLRef> {
195 typedef TemplateURLRef param_type; 195 typedef TemplateURLRef param_type;
196 static void Write(Message* m, const param_type& p) { 196 static void Write(Message* m, const param_type& p) {
197 WriteParam(m, p.url()); 197 WriteParam(m, p.url());
198 WriteParam(m, p.index_offset()); 198 WriteParam(m, p.index_offset());
199 WriteParam(m, p.page_offset()); 199 WriteParam(m, p.page_offset());
200 } 200 }
201 static bool Read(const Message* m, void** iter, param_type* p) { 201 static bool Read(const Message* m, PickleIterator* iter, param_type* p) {
202 std::string url; 202 std::string url;
203 int index_offset; 203 int index_offset;
204 int page_offset; 204 int page_offset;
205 if (!ReadParam(m, iter, &url) || 205 if (!ReadParam(m, iter, &url) ||
206 !ReadParam(m, iter, &index_offset) || 206 !ReadParam(m, iter, &index_offset) ||
207 !ReadParam(m, iter, &page_offset)) 207 !ReadParam(m, iter, &page_offset))
208 return false; 208 return false;
209 *p = TemplateURLRef(url, index_offset, page_offset); 209 *p = TemplateURLRef(url, index_offset, page_offset);
210 return true; 210 return true;
211 } 211 }
212 static void Log(const param_type& p, std::string* l) { 212 static void Log(const param_type& p, std::string* l) {
213 l->append("<TemplateURLRef>"); 213 l->append("<TemplateURLRef>");
214 } 214 }
215 }; 215 };
216 216
217 // Traits for TemplateURL::ImageRef 217 // Traits for TemplateURL::ImageRef
218 template <> 218 template <>
219 struct ParamTraits<TemplateURL::ImageRef> { 219 struct ParamTraits<TemplateURL::ImageRef> {
220 typedef TemplateURL::ImageRef param_type; 220 typedef TemplateURL::ImageRef param_type;
221 static void Write(Message* m, const param_type& p) { 221 static void Write(Message* m, const param_type& p) {
222 WriteParam(m, p.type); 222 WriteParam(m, p.type);
223 WriteParam(m, p.width); 223 WriteParam(m, p.width);
224 WriteParam(m, p.height); 224 WriteParam(m, p.height);
225 WriteParam(m, p.url); 225 WriteParam(m, p.url);
226 } 226 }
227 static bool Read(const Message* m, void** iter, param_type* p) { 227 static bool Read(const Message* m, PickleIterator* iter, param_type* p) {
228 std::string type; 228 std::string type;
229 int width; 229 int width;
230 int height; 230 int height;
231 GURL url; 231 GURL url;
232 if (!ReadParam(m, iter, &type) || 232 if (!ReadParam(m, iter, &type) ||
233 !ReadParam(m, iter, &width) || 233 !ReadParam(m, iter, &width) ||
234 !ReadParam(m, iter, &height) || 234 !ReadParam(m, iter, &height) ||
235 !ReadParam(m, iter, &url)) 235 !ReadParam(m, iter, &url))
236 return false; 236 return false;
237 *p = TemplateURL::ImageRef(type, width, height, url); // here in 237 *p = TemplateURL::ImageRef(type, width, height, url); // here in
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 WriteParam(m, iter->url); 271 WriteParam(m, iter->url);
272 } 272 }
273 273
274 WriteParam(m, p.languages()); 274 WriteParam(m, p.languages());
275 WriteParam(m, p.input_encodings()); 275 WriteParam(m, p.input_encodings());
276 WriteParam(m, p.date_created()); 276 WriteParam(m, p.date_created());
277 WriteParam(m, p.last_modified()); 277 WriteParam(m, p.last_modified());
278 WriteParam(m, p.usage_count()); 278 WriteParam(m, p.usage_count());
279 WriteParam(m, p.prepopulate_id()); 279 WriteParam(m, p.prepopulate_id());
280 } 280 }
281 static bool Read(const Message* m, void** iter, param_type* p) { 281 static bool Read(const Message* m, PickleIterator* iter, param_type* p) {
282 string16 short_name; 282 string16 short_name;
283 string16 description; 283 string16 description;
284 bool includes_suggestions_url; 284 bool includes_suggestions_url;
285 TemplateURLRef suggestions_url; 285 TemplateURLRef suggestions_url;
286 TemplateURLRef url; 286 TemplateURLRef url;
287 GURL originating_url; 287 GURL originating_url;
288 string16 keyword; 288 string16 keyword;
289 bool autogenerate_keyword; 289 bool autogenerate_keyword;
290 bool show_in_default_list; 290 bool show_in_default_list;
291 bool safe_for_autoreplace; 291 bool safe_for_autoreplace;
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
430 IPC_MESSAGE_CONTROL1(ProfileImportProcessHostMsg_NotifyFaviconsImportGroup, 430 IPC_MESSAGE_CONTROL1(ProfileImportProcessHostMsg_NotifyFaviconsImportGroup,
431 std::vector<history::ImportedFaviconUsage>) 431 std::vector<history::ImportedFaviconUsage>)
432 432
433 IPC_MESSAGE_CONTROL1(ProfileImportProcessHostMsg_NotifyPasswordFormReady, 433 IPC_MESSAGE_CONTROL1(ProfileImportProcessHostMsg_NotifyPasswordFormReady,
434 webkit::forms::PasswordForm) 434 webkit::forms::PasswordForm)
435 435
436 IPC_MESSAGE_CONTROL3(ProfileImportProcessHostMsg_NotifyKeywordsReady, 436 IPC_MESSAGE_CONTROL3(ProfileImportProcessHostMsg_NotifyKeywordsReady,
437 std::vector<TemplateURL>, 437 std::vector<TemplateURL>,
438 int, /* default keyword index */ 438 int, /* default keyword index */
439 bool /* unique on host and path */) 439 bool /* unique on host and path */)
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_tabs_module.cc ('k') | chrome/browser/password_manager/native_backend_kwallet_x.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698