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

Side by Side Diff: chrome/common/common_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: jar feedback 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) 2011 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/common/common_param_traits.h" 5 #include "chrome/common/common_param_traits.h"
6 6
7 #include "ipc/ipc_message.h" 7 #include "ipc/ipc_message.h"
8 #include "ipc/ipc_message_utils.h" 8 #include "ipc/ipc_message_utils.h"
9 9
10 namespace IPC { 10 namespace IPC {
11 11
12 void ParamTraits<ContentSetting>::Write(Message* m, const param_type& p) { 12 void ParamTraits<ContentSetting>::Write(Message* m, const param_type& p) {
13 m->WriteInt(static_cast<int>(p)); 13 m->WriteInt(static_cast<int>(p));
14 } 14 }
15 15
16 bool ParamTraits<ContentSetting>::Read(const Message* m, void** iter, 16 bool ParamTraits<ContentSetting>::Read(const Message* m, PickleReader* iter,
17 param_type* p) { 17 param_type* p) {
18 int type; 18 int type;
19 if (!m->ReadInt(iter, &type)) 19 if (!m->ReadInt(iter, &type))
20 return false; 20 return false;
21 *p = static_cast<param_type>(type); 21 *p = static_cast<param_type>(type);
22 return true; 22 return true;
23 } 23 }
24 24
25 void ParamTraits<ContentSetting>::Log(const param_type& p, std::string* l) { 25 void ParamTraits<ContentSetting>::Log(const param_type& p, std::string* l) {
26 std::string content_setting; 26 std::string content_setting;
(...skipping 17 matching lines...) Expand all
44 content_setting = "UNKNOWN"; 44 content_setting = "UNKNOWN";
45 break; 45 break;
46 } 46 }
47 LogParam(content_setting, l); 47 LogParam(content_setting, l);
48 } 48 }
49 49
50 void ParamTraits<ContentSettingsType>::Write(Message* m, const param_type& p) { 50 void ParamTraits<ContentSettingsType>::Write(Message* m, const param_type& p) {
51 m->WriteInt(static_cast<int>(p)); 51 m->WriteInt(static_cast<int>(p));
52 } 52 }
53 53
54 bool ParamTraits<ContentSettingsType>::Read(const Message* m, void** iter, 54 bool ParamTraits<ContentSettingsType>::Read(const Message* m, PickleReader* iter ,
55 param_type* p) { 55 param_type* p) {
56 int type; 56 int type;
57 if (!m->ReadInt(iter, &type)) 57 if (!m->ReadInt(iter, &type))
58 return false; 58 return false;
59 *p = static_cast<param_type>(type); 59 *p = static_cast<param_type>(type);
60 return true; 60 return true;
61 } 61 }
62 62
63 void ParamTraits<ContentSettingsType>::Log(const param_type& p, 63 void ParamTraits<ContentSettingsType>::Log(const param_type& p,
64 std::string* l) { 64 std::string* l) {
(...skipping 27 matching lines...) Expand all
92 setting_type = "CONTENT_SETTINGS_TYPE_INTENTS"; 92 setting_type = "CONTENT_SETTINGS_TYPE_INTENTS";
93 break; 93 break;
94 default: 94 default:
95 setting_type = "UNKNOWN"; 95 setting_type = "UNKNOWN";
96 break; 96 break;
97 } 97 }
98 LogParam(setting_type, l); 98 LogParam(setting_type, l);
99 } 99 }
100 100
101 } // namespace IPC 101 } // namespace IPC
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698