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

Side by Side Diff: ppapi/proxy/serialized_var.cc

Issue 7237039: Remove PPBoolToBool and BoolToPPBool and use PP_FromBool and PP_ToBool instead. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 5 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 "ppapi/proxy/serialized_var.h" 5 #include "ppapi/proxy/serialized_var.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "ipc/ipc_message_utils.h" 8 #include "ipc/ipc_message_utils.h"
9 #include "ppapi/proxy/dispatcher.h" 9 #include "ppapi/proxy/dispatcher.h"
10 #include "ppapi/proxy/interface_proxy.h" 10 #include "ppapi/proxy/interface_proxy.h"
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 DCHECK(var_.type == PP_VARTYPE_STRING || string_value_.empty()); 121 DCHECK(var_.type == PP_VARTYPE_STRING || string_value_.empty());
122 122
123 m->WriteInt(static_cast<int>(var_.type)); 123 m->WriteInt(static_cast<int>(var_.type));
124 switch (var_.type) { 124 switch (var_.type) {
125 case PP_VARTYPE_UNDEFINED: 125 case PP_VARTYPE_UNDEFINED:
126 case PP_VARTYPE_NULL: 126 case PP_VARTYPE_NULL:
127 // These don't need any data associated with them other than the type we 127 // These don't need any data associated with them other than the type we
128 // just serialized. 128 // just serialized.
129 break; 129 break;
130 case PP_VARTYPE_BOOL: 130 case PP_VARTYPE_BOOL:
131 m->WriteBool(PPBoolToBool(var_.value.as_bool)); 131 m->WriteBool(PP_ToBool(var_.value.as_bool));
132 break; 132 break;
133 case PP_VARTYPE_INT32: 133 case PP_VARTYPE_INT32:
134 m->WriteInt(var_.value.as_int); 134 m->WriteInt(var_.value.as_int);
135 break; 135 break;
136 case PP_VARTYPE_DOUBLE: 136 case PP_VARTYPE_DOUBLE:
137 IPC::ParamTraits<double>::Write(m, var_.value.as_double); 137 IPC::ParamTraits<double>::Write(m, var_.value.as_double);
138 break; 138 break;
139 case PP_VARTYPE_STRING: 139 case PP_VARTYPE_STRING:
140 // TODO(brettw) in the case of an invalid string ID, it would be nice 140 // TODO(brettw) in the case of an invalid string ID, it would be nice
141 // to send something to the other side such that a 0 ID would be 141 // to send something to the other side such that a 0 ID would be
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 switch (type) { 178 switch (type) {
179 case PP_VARTYPE_UNDEFINED: 179 case PP_VARTYPE_UNDEFINED:
180 case PP_VARTYPE_NULL: 180 case PP_VARTYPE_NULL:
181 // These don't have any data associated with them other than the type we 181 // These don't have any data associated with them other than the type we
182 // just serialized. 182 // just serialized.
183 success = true; 183 success = true;
184 break; 184 break;
185 case PP_VARTYPE_BOOL: { 185 case PP_VARTYPE_BOOL: {
186 bool bool_value; 186 bool bool_value;
187 success = m->ReadBool(iter, &bool_value); 187 success = m->ReadBool(iter, &bool_value);
188 var_.value.as_bool = BoolToPPBool(bool_value); 188 var_.value.as_bool = PP_FromBool(bool_value);
189 break; 189 break;
190 } 190 }
191 case PP_VARTYPE_INT32: 191 case PP_VARTYPE_INT32:
192 success = m->ReadInt(iter, &var_.value.as_int); 192 success = m->ReadInt(iter, &var_.value.as_int);
193 break; 193 break;
194 case PP_VARTYPE_DOUBLE: 194 case PP_VARTYPE_DOUBLE:
195 success = IPC::ParamTraits<double>::Read(m, iter, &var_.value.as_double); 195 success = IPC::ParamTraits<double>::Read(m, iter, &var_.value.as_double);
196 break; 196 break;
197 case PP_VARTYPE_STRING: 197 case PP_VARTYPE_STRING:
198 success = m->ReadString(iter, &string_value_); 198 success = m->ReadString(iter, &string_value_);
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
527 *inner_->GetStringPtr() = str; 527 *inner_->GetStringPtr() = str;
528 } 528 }
529 529
530 SerializedVarTestReader::SerializedVarTestReader(const SerializedVar& var) 530 SerializedVarTestReader::SerializedVarTestReader(const SerializedVar& var)
531 : SerializedVar(var) { 531 : SerializedVar(var) {
532 } 532 }
533 533
534 } // namespace proxy 534 } // namespace proxy
535 } // namespace pp 535 } // namespace pp
536 536
OLDNEW
« ppapi/cpp/dev/font_dev.h ('K') | « ppapi/proxy/ppb_var_deprecated_proxy.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698