| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 * Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 3 * Use of this source code is governed by a BSD-style license that can be | 3 * Use of this source code is governed by a BSD-style license that can be |
| 4 * found in the LICENSE file. | 4 * found in the LICENSE file. |
| 5 */ | 5 */ |
| 6 | 6 |
| 7 #include "native_client/src/shared/ppapi_proxy/object_serialize.h" | 7 #include "native_client/src/shared/ppapi_proxy/object_serialize.h" |
| 8 | 8 |
| 9 #include <limits> | 9 #include <limits> |
| 10 #include <stdio.h> | 10 #include <stdio.h> |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 // Set the rest of SerializedFixed to 0, in case the following serialization | 190 // Set the rest of SerializedFixed to 0, in case the following serialization |
| 191 // leaves some of it unchanged. | 191 // leaves some of it unchanged. |
| 192 s->u.int32_value = 0; | 192 s->u.int32_value = 0; |
| 193 | 193 |
| 194 switch (vars[i].type) { | 194 switch (vars[i].type) { |
| 195 case PP_VARTYPE_UNDEFINED: | 195 case PP_VARTYPE_UNDEFINED: |
| 196 case PP_VARTYPE_NULL: | 196 case PP_VARTYPE_NULL: |
| 197 element_size = sizeof(SerializedFixed); | 197 element_size = sizeof(SerializedFixed); |
| 198 break; | 198 break; |
| 199 case PP_VARTYPE_BOOL: | 199 case PP_VARTYPE_BOOL: |
| 200 s->u.boolean_value = static_cast<bool> | 200 s->u.boolean_value = PP_ToBool(vars[i].value.as_bool); |
| 201 (PP_TRUE == vars[i].value.as_bool); | |
| 202 element_size = sizeof(SerializedFixed); | 201 element_size = sizeof(SerializedFixed); |
| 203 break; | 202 break; |
| 204 case PP_VARTYPE_INT32: | 203 case PP_VARTYPE_INT32: |
| 205 s->u.int32_value = vars[i].value.as_int; | 204 s->u.int32_value = vars[i].value.as_int; |
| 206 element_size = sizeof(SerializedFixed); | 205 element_size = sizeof(SerializedFixed); |
| 207 break; | 206 break; |
| 208 case PP_VARTYPE_DOUBLE: { | 207 case PP_VARTYPE_DOUBLE: { |
| 209 SerializedDouble* sd = reinterpret_cast<SerializedDouble*>(p); | 208 SerializedDouble* sd = reinterpret_cast<SerializedDouble*>(p); |
| 210 sd->double_value = vars[i].value.as_double; | 209 sd->double_value = vars[i].value.as_double; |
| 211 element_size = sizeof(SerializedDouble); | 210 element_size = sizeof(SerializedDouble); |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 403 return false; | 402 return false; |
| 404 } | 403 } |
| 405 SerializedFixed* s = reinterpret_cast<SerializedFixed*>(p); | 404 SerializedFixed* s = reinterpret_cast<SerializedFixed*>(p); |
| 406 | 405 |
| 407 vars[i].type = element_type; | 406 vars[i].type = element_type; |
| 408 switch (element_type) { | 407 switch (element_type) { |
| 409 case PP_VARTYPE_UNDEFINED: | 408 case PP_VARTYPE_UNDEFINED: |
| 410 case PP_VARTYPE_NULL: | 409 case PP_VARTYPE_NULL: |
| 411 break; | 410 break; |
| 412 case PP_VARTYPE_BOOL: | 411 case PP_VARTYPE_BOOL: |
| 413 vars[i].value.as_bool = static_cast<PP_Bool>(s->u.boolean_value); | 412 vars[i].value.as_bool = PP_FromBool(s->u.boolean_value); |
| 414 break; | 413 break; |
| 415 case PP_VARTYPE_INT32: | 414 case PP_VARTYPE_INT32: |
| 416 vars[i].value.as_int = s->u.int32_value; | 415 vars[i].value.as_int = s->u.int32_value; |
| 417 break; | 416 break; |
| 418 case PP_VARTYPE_DOUBLE: { | 417 case PP_VARTYPE_DOUBLE: { |
| 419 SerializedDouble* sd = reinterpret_cast<SerializedDouble*>(p); | 418 SerializedDouble* sd = reinterpret_cast<SerializedDouble*>(p); |
| 420 vars[i].value.as_double = sd->double_value; | 419 vars[i].value.as_double = sd->double_value; |
| 421 break; | 420 break; |
| 422 } | 421 } |
| 423 case PP_VARTYPE_STRING: | 422 case PP_VARTYPE_STRING: |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 514 return false; | 513 return false; |
| 515 } | 514 } |
| 516 // Read the serialized PP_Vars into the allocated memory. | 515 // Read the serialized PP_Vars into the allocated memory. |
| 517 if (!DeserializePpVar(bytes, length, vars, argc)) { | 516 if (!DeserializePpVar(bytes, length, vars, argc)) { |
| 518 return false; | 517 return false; |
| 519 } | 518 } |
| 520 return true; | 519 return true; |
| 521 } | 520 } |
| 522 | 521 |
| 523 } // namespace ppapi_proxy | 522 } // namespace ppapi_proxy |
| OLD | NEW |