OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2010 The Native Client Authors. All rights reserved. | 2 * Copyright 2010 The Native Client Authors. All rights reserved. |
3 * Use of this source code is governed by a BSD-style license that can | 3 * Use of this source code is governed by a BSD-style license that can |
4 * be found in the LICENSE file. | 4 * be found in the LICENSE file. |
5 */ | 5 */ |
6 | 6 |
7 #include "native_client/src/shared/ppapi_proxy/plugin_var.h" | 7 #include "native_client/src/shared/ppapi_proxy/plugin_var.h" |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <string> | 10 #include <string> |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 StrImpl* str_impl = VarToStrImpl(var); | 110 StrImpl* str_impl = VarToStrImpl(var); |
111 if (str_impl != NULL) { | 111 if (str_impl != NULL) { |
112 DebugPrintf("PluginVar::Release: string('%s')\n", str_impl->str().c_str()); | 112 DebugPrintf("PluginVar::Release: string('%s')\n", str_impl->str().c_str()); |
113 str_impl->Release(); | 113 str_impl->Release(); |
114 if (str_impl->ref_count() == 0) { | 114 if (str_impl->ref_count() == 0) { |
115 delete str_impl; | 115 delete str_impl; |
116 } | 116 } |
117 } | 117 } |
118 } | 118 } |
119 | 119 |
120 PP_Var VarFromUtf8(const char* data, uint32_t len) { | 120 PP_Var VarFromUtf8(PP_Module module_id, const char* data, uint32_t len) { |
| 121 UNREFERENCED_PARAMETER(module_id); |
121 StrImpl* impl = new StrImpl(data, len); | 122 StrImpl* impl = new StrImpl(data, len); |
122 PP_Var result; | 123 PP_Var result; |
123 result.type = PP_VARTYPE_STRING; | 124 result.type = PP_VARTYPE_STRING; |
124 result.value.as_id = reinterpret_cast<int64_t>(impl); | 125 result.value.as_id = reinterpret_cast<int64_t>(impl); |
125 return result; | 126 return result; |
126 } | 127 } |
127 | 128 |
128 const char* VarToUtf8(PP_Var var, uint32_t* len) { | 129 const char* VarToUtf8(PP_Var var, uint32_t* len) { |
129 StrImpl* str_impl = VarToStrImpl(var); | 130 StrImpl* str_impl = VarToStrImpl(var); |
130 if (str_impl == NULL) { | 131 if (str_impl == NULL) { |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 return static_cast<uint64_t>(-1); | 294 return static_cast<uint64_t>(-1); |
294 } else { | 295 } else { |
295 return reinterpret_cast<const ObjImpl*>(object)->id(); | 296 return reinterpret_cast<const ObjImpl*>(object)->id(); |
296 } | 297 } |
297 } | 298 } |
298 | 299 |
299 uint64_t GetVarId(PP_Var var) { | 300 uint64_t GetVarId(PP_Var var) { |
300 return GetObjectId(VarToObjImpl(var)); | 301 return GetObjectId(VarToObjImpl(var)); |
301 } | 302 } |
302 | 303 |
303 PP_Var CreateObject(const PPP_Class* object_class, void* object_data) { | 304 PP_Var CreateObject(PP_Module module_id, |
| 305 const PPP_Class* object_class, |
| 306 void* object_data) { |
| 307 UNREFERENCED_PARAMETER(module_id); |
304 PP_Var result; | 308 PP_Var result; |
305 result.type = PP_VARTYPE_OBJECT; | 309 result.type = PP_VARTYPE_OBJECT; |
306 result.value.as_id = | 310 result.value.as_id = |
307 reinterpret_cast<uint64_t>(new ObjImpl(object_class, object_data)); | 311 reinterpret_cast<uint64_t>(new ObjImpl(object_class, object_data)); |
308 return result; | 312 return result; |
309 } | 313 } |
310 | 314 |
311 } // namespace | 315 } // namespace |
312 | 316 |
313 const PPB_Var* PluginVar::GetInterface() { | 317 const PPB_Var* PluginVar::GetInterface() { |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
394 static_cast<uint32_t>(str.size()), | 398 static_cast<uint32_t>(str.size()), |
395 str.c_str()); | 399 str.c_str()); |
396 } | 400 } |
397 case PP_VARTYPE_OBJECT: | 401 case PP_VARTYPE_OBJECT: |
398 DebugPrintf("PP_Var(object: %"NACL_PRIu64")", GetVarId(var)); | 402 DebugPrintf("PP_Var(object: %"NACL_PRIu64")", GetVarId(var)); |
399 break; | 403 break; |
400 } | 404 } |
401 } | 405 } |
402 | 406 |
403 } // namespace ppapi_proxy | 407 } // namespace ppapi_proxy |
OLD | NEW |