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

Side by Side Diff: content/public/common/webkit_param_traits.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
« no previous file with comments | « content/public/common/webkit_param_traits.h ('k') | content/renderer/gpu/input_event_filter.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // NOTE: New trait definitions that will be used by Chrome Frame must be placed 5 // NOTE: New trait definitions that will be used by Chrome Frame must be placed
6 // in common_param_traits2.cc. 6 // in common_param_traits2.cc.
7 7
8 #include "content/public/common/webkit_param_traits.h" 8 #include "content/public/common/webkit_param_traits.h"
9 9
10 #include "base/string_number_conversions.h" 10 #include "base/string_number_conversions.h"
11 #include "content/public/common/common_param_traits.h" 11 #include "content/public/common/common_param_traits.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 WriteParam(m, p.connect_end); 50 WriteParam(m, p.connect_end);
51 WriteParam(m, p.ssl_start); 51 WriteParam(m, p.ssl_start);
52 WriteParam(m, p.ssl_end); 52 WriteParam(m, p.ssl_end);
53 WriteParam(m, p.send_start); 53 WriteParam(m, p.send_start);
54 WriteParam(m, p.send_end); 54 WriteParam(m, p.send_end);
55 WriteParam(m, p.receive_headers_start); 55 WriteParam(m, p.receive_headers_start);
56 WriteParam(m, p.receive_headers_end); 56 WriteParam(m, p.receive_headers_end);
57 } 57 }
58 58
59 bool ParamTraits<webkit_glue::ResourceLoadTimingInfo>::Read( 59 bool ParamTraits<webkit_glue::ResourceLoadTimingInfo>::Read(
60 const Message* m, void** iter, param_type* r) { 60 const Message* m, PickleIterator* iter, param_type* r) {
61 bool is_null; 61 bool is_null;
62 if (!ReadParam(m, iter, &is_null)) 62 if (!ReadParam(m, iter, &is_null))
63 return false; 63 return false;
64 if (is_null) 64 if (is_null)
65 return true; 65 return true;
66 66
67 return 67 return
68 ReadParam(m, iter, &r->base_ticks) && 68 ReadParam(m, iter, &r->base_ticks) &&
69 ReadParam(m, iter, &r->base_time) && 69 ReadParam(m, iter, &r->base_time) &&
70 ReadParam(m, iter, &r->proxy_start) && 70 ReadParam(m, iter, &r->proxy_start) &&
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 WriteParam(m, p->http_status_code); 121 WriteParam(m, p->http_status_code);
122 WriteParam(m, p->http_status_text); 122 WriteParam(m, p->http_status_text);
123 WriteParam(m, p->request_headers); 123 WriteParam(m, p->request_headers);
124 WriteParam(m, p->response_headers); 124 WriteParam(m, p->response_headers);
125 WriteParam(m, p->request_headers_text); 125 WriteParam(m, p->request_headers_text);
126 WriteParam(m, p->response_headers_text); 126 WriteParam(m, p->response_headers_text);
127 } 127 }
128 } 128 }
129 129
130 bool ParamTraits<scoped_refptr<webkit_glue::ResourceDevToolsInfo> >::Read( 130 bool ParamTraits<scoped_refptr<webkit_glue::ResourceDevToolsInfo> >::Read(
131 const Message* m, void** iter, param_type* r) { 131 const Message* m, PickleIterator* iter, param_type* r) {
132 bool has_object; 132 bool has_object;
133 if (!ReadParam(m, iter, &has_object)) 133 if (!ReadParam(m, iter, &has_object))
134 return false; 134 return false;
135 if (!has_object) 135 if (!has_object)
136 return true; 136 return true;
137 *r = new webkit_glue::ResourceDevToolsInfo(); 137 *r = new webkit_glue::ResourceDevToolsInfo();
138 return 138 return
139 ReadParam(m, iter, &(*r)->http_status_code) && 139 ReadParam(m, iter, &(*r)->http_status_code) &&
140 ReadParam(m, iter, &(*r)->http_status_text) && 140 ReadParam(m, iter, &(*r)->http_status_text) &&
141 ReadParam(m, iter, &(*r)->request_headers) && 141 ReadParam(m, iter, &(*r)->request_headers) &&
(...skipping 28 matching lines...) Expand all
170 // This is the routing id used to connect NPObjectProxy in the other 170 // This is the routing id used to connect NPObjectProxy in the other
171 // process with NPObjectStub in this process or to identify the raw 171 // process with NPObjectStub in this process or to identify the raw
172 // npobject pointer to be used in the callee process. 172 // npobject pointer to be used in the callee process.
173 WriteParam(m, p.npobject_routing_id); 173 WriteParam(m, p.npobject_routing_id);
174 } else { 174 } else {
175 DCHECK(p.type == NPVARIANT_PARAM_VOID || p.type == NPVARIANT_PARAM_NULL); 175 DCHECK(p.type == NPVARIANT_PARAM_VOID || p.type == NPVARIANT_PARAM_NULL);
176 } 176 }
177 } 177 }
178 178
179 bool ParamTraits<NPVariant_Param>::Read(const Message* m, 179 bool ParamTraits<NPVariant_Param>::Read(const Message* m,
180 void** iter, 180 PickleIterator* iter,
181 param_type* r) { 181 param_type* r) {
182 int type; 182 int type;
183 if (!ReadParam(m, iter, &type)) 183 if (!ReadParam(m, iter, &type))
184 return false; 184 return false;
185 185
186 bool result = false; 186 bool result = false;
187 r->type = static_cast<NPVariant_ParamEnum>(type); 187 r->type = static_cast<NPVariant_ParamEnum>(type);
188 if (r->type == NPVARIANT_PARAM_BOOL) { 188 if (r->type == NPVARIANT_PARAM_BOOL) {
189 result = ReadParam(m, iter, &r->bool_value); 189 result = ReadParam(m, iter, &r->bool_value);
190 } else if (r->type == NPVARIANT_PARAM_INT) { 190 } else if (r->type == NPVARIANT_PARAM_INT) {
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 l->append("<none>"); 223 l->append("<none>");
224 } 224 }
225 l->append(")"); 225 l->append(")");
226 } 226 }
227 227
228 void ParamTraits<NPIdentifier_Param>::Write(Message* m, const param_type& p) { 228 void ParamTraits<NPIdentifier_Param>::Write(Message* m, const param_type& p) {
229 webkit_glue::SerializeNPIdentifier(p.identifier, m); 229 webkit_glue::SerializeNPIdentifier(p.identifier, m);
230 } 230 }
231 231
232 bool ParamTraits<NPIdentifier_Param>::Read(const Message* m, 232 bool ParamTraits<NPIdentifier_Param>::Read(const Message* m,
233 void** iter, 233 PickleIterator* iter,
234 param_type* r) { 234 param_type* r) {
235 return webkit_glue::DeserializeNPIdentifier(*m, iter, &r->identifier); 235 return webkit_glue::DeserializeNPIdentifier(iter, &r->identifier);
236 } 236 }
237 237
238 void ParamTraits<NPIdentifier_Param>::Log(const param_type& p, std::string* l) { 238 void ParamTraits<NPIdentifier_Param>::Log(const param_type& p, std::string* l) {
239 if (WebKit::WebBindings::identifierIsString(p.identifier)) { 239 if (WebKit::WebBindings::identifierIsString(p.identifier)) {
240 NPUTF8* str = WebKit::WebBindings::utf8FromIdentifier(p.identifier); 240 NPUTF8* str = WebKit::WebBindings::utf8FromIdentifier(p.identifier);
241 l->append(str); 241 l->append(str);
242 webkit::npapi::PluginHost::Singleton()->host_functions()->memfree(str); 242 webkit::npapi::PluginHost::Singleton()->host_functions()->memfree(str);
243 } else { 243 } else {
244 l->append(base::IntToString( 244 l->append(base::IntToString(
245 WebKit::WebBindings::intFromIdentifier(p.identifier))); 245 WebKit::WebBindings::intFromIdentifier(p.identifier)));
246 } 246 }
247 } 247 }
248 248
249 void ParamTraits<webkit::WebPluginMimeType>::Write(Message* m, 249 void ParamTraits<webkit::WebPluginMimeType>::Write(Message* m,
250 const param_type& p) { 250 const param_type& p) {
251 WriteParam(m, p.mime_type); 251 WriteParam(m, p.mime_type);
252 WriteParam(m, p.file_extensions); 252 WriteParam(m, p.file_extensions);
253 WriteParam(m, p.description); 253 WriteParam(m, p.description);
254 WriteParam(m, p.additional_param_names); 254 WriteParam(m, p.additional_param_names);
255 WriteParam(m, p.additional_param_values); 255 WriteParam(m, p.additional_param_values);
256 } 256 }
257 257
258 bool ParamTraits<webkit::WebPluginMimeType>::Read(const Message* m, 258 bool ParamTraits<webkit::WebPluginMimeType>::Read(const Message* m,
259 void** iter, 259 PickleIterator* iter,
260 param_type* p) { 260 param_type* p) {
261 return 261 return
262 ReadParam(m, iter, &p->mime_type) && 262 ReadParam(m, iter, &p->mime_type) &&
263 ReadParam(m, iter, &p->file_extensions) && 263 ReadParam(m, iter, &p->file_extensions) &&
264 ReadParam(m, iter, &p->description) && 264 ReadParam(m, iter, &p->description) &&
265 ReadParam(m, iter, &p->additional_param_names) && 265 ReadParam(m, iter, &p->additional_param_names) &&
266 ReadParam(m, iter, &p->additional_param_values); 266 ReadParam(m, iter, &p->additional_param_values);
267 } 267 }
268 268
269 void ParamTraits<webkit::WebPluginMimeType>::Log( 269 void ParamTraits<webkit::WebPluginMimeType>::Log(
(...skipping 11 matching lines...) Expand all
281 const param_type& p) { 281 const param_type& p) {
282 WriteParam(m, p.name); 282 WriteParam(m, p.name);
283 WriteParam(m, p.path); 283 WriteParam(m, p.path);
284 WriteParam(m, p.version); 284 WriteParam(m, p.version);
285 WriteParam(m, p.desc); 285 WriteParam(m, p.desc);
286 WriteParam(m, p.mime_types); 286 WriteParam(m, p.mime_types);
287 WriteParam(m, p.type); 287 WriteParam(m, p.type);
288 } 288 }
289 289
290 bool ParamTraits<webkit::WebPluginInfo>::Read(const Message* m, 290 bool ParamTraits<webkit::WebPluginInfo>::Read(const Message* m,
291 void** iter, 291 PickleIterator* iter,
292 param_type* p) { 292 param_type* p) {
293 return 293 return
294 ReadParam(m, iter, &p->name) && 294 ReadParam(m, iter, &p->name) &&
295 ReadParam(m, iter, &p->path) && 295 ReadParam(m, iter, &p->path) &&
296 ReadParam(m, iter, &p->version) && 296 ReadParam(m, iter, &p->version) &&
297 ReadParam(m, iter, &p->desc) && 297 ReadParam(m, iter, &p->desc) &&
298 ReadParam(m, iter, &p->mime_types) && 298 ReadParam(m, iter, &p->mime_types) &&
299 ReadParam(m, iter, &p->type); 299 ReadParam(m, iter, &p->type);
300 } 300 }
301 void ParamTraits<webkit::WebPluginInfo>::Log(const param_type& p, 301 void ParamTraits<webkit::WebPluginInfo>::Log(const param_type& p,
(...skipping 19 matching lines...) Expand all
321 WriteParam(m, p.password_element); 321 WriteParam(m, p.password_element);
322 WriteParam(m, p.password_value); 322 WriteParam(m, p.password_value);
323 WriteParam(m, p.old_password_element); 323 WriteParam(m, p.old_password_element);
324 WriteParam(m, p.old_password_value); 324 WriteParam(m, p.old_password_value);
325 WriteParam(m, p.ssl_valid); 325 WriteParam(m, p.ssl_valid);
326 WriteParam(m, p.preferred); 326 WriteParam(m, p.preferred);
327 WriteParam(m, p.blacklisted_by_user); 327 WriteParam(m, p.blacklisted_by_user);
328 } 328 }
329 329
330 bool ParamTraits<webkit::forms::PasswordForm>::Read(const Message* m, 330 bool ParamTraits<webkit::forms::PasswordForm>::Read(const Message* m,
331 void** iter, 331 PickleIterator* iter,
332 param_type* p) { 332 param_type* p) {
333 return 333 return
334 ReadParam(m, iter, &p->signon_realm) && 334 ReadParam(m, iter, &p->signon_realm) &&
335 ReadParam(m, iter, &p->origin) && 335 ReadParam(m, iter, &p->origin) &&
336 ReadParam(m, iter, &p->action) && 336 ReadParam(m, iter, &p->action) &&
337 ReadParam(m, iter, &p->submit_element) && 337 ReadParam(m, iter, &p->submit_element) &&
338 ReadParam(m, iter, &p->username_element) && 338 ReadParam(m, iter, &p->username_element) &&
339 ReadParam(m, iter, &p->username_value) && 339 ReadParam(m, iter, &p->username_value) &&
340 ReadParam(m, iter, &p->password_element) && 340 ReadParam(m, iter, &p->password_element) &&
341 ReadParam(m, iter, &p->password_value) && 341 ReadParam(m, iter, &p->password_value) &&
342 ReadParam(m, iter, &p->old_password_element) && 342 ReadParam(m, iter, &p->old_password_element) &&
343 ReadParam(m, iter, &p->old_password_value) && 343 ReadParam(m, iter, &p->old_password_value) &&
344 ReadParam(m, iter, &p->ssl_valid) && 344 ReadParam(m, iter, &p->ssl_valid) &&
345 ReadParam(m, iter, &p->preferred) && 345 ReadParam(m, iter, &p->preferred) &&
346 ReadParam(m, iter, &p->blacklisted_by_user); 346 ReadParam(m, iter, &p->blacklisted_by_user);
347 } 347 }
348 void ParamTraits<webkit::forms::PasswordForm>::Log(const param_type& p, 348 void ParamTraits<webkit::forms::PasswordForm>::Log(const param_type& p,
349 std::string* l) { 349 std::string* l) {
350 l->append("<PasswordForm>"); 350 l->append("<PasswordForm>");
351 } 351 }
352 352
353 } // namespace IPC 353 } // namespace IPC
OLDNEW
« no previous file with comments | « content/public/common/webkit_param_traits.h ('k') | content/renderer/gpu/input_event_filter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698