| OLD | NEW |
| 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/ppb_var_deprecated_proxy.h" | 5 #include "ppapi/proxy/ppb_var_deprecated_proxy.h" |
| 6 | 6 |
| 7 #include <stdlib.h> // For malloc | 7 #include <stdlib.h> // For malloc |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 return false; | 87 return false; |
| 88 | 88 |
| 89 ReceiveSerializedException se(dispatcher, exception); | 89 ReceiveSerializedException se(dispatcher, exception); |
| 90 PP_Bool result = PP_FALSE; | 90 PP_Bool result = PP_FALSE; |
| 91 if (!se.IsThrown()) { | 91 if (!se.IsThrown()) { |
| 92 dispatcher->Send(new PpapiHostMsg_PPBVar_HasProperty( | 92 dispatcher->Send(new PpapiHostMsg_PPBVar_HasProperty( |
| 93 INTERFACE_ID_PPB_VAR_DEPRECATED, | 93 INTERFACE_ID_PPB_VAR_DEPRECATED, |
| 94 SerializedVarSendInput(dispatcher, var), | 94 SerializedVarSendInput(dispatcher, var), |
| 95 SerializedVarSendInput(dispatcher, name), &se, &result)); | 95 SerializedVarSendInput(dispatcher, name), &se, &result)); |
| 96 } | 96 } |
| 97 return PPBoolToBool(result); | 97 return PP_ToBool(result); |
| 98 } | 98 } |
| 99 | 99 |
| 100 bool HasMethod(PP_Var var, | 100 bool HasMethod(PP_Var var, |
| 101 PP_Var name, | 101 PP_Var name, |
| 102 PP_Var* exception) { | 102 PP_Var* exception) { |
| 103 Dispatcher* dispatcher = CheckExceptionAndGetDispatcher(var, exception); | 103 Dispatcher* dispatcher = CheckExceptionAndGetDispatcher(var, exception); |
| 104 if (!dispatcher) | 104 if (!dispatcher) |
| 105 return false; | 105 return false; |
| 106 | 106 |
| 107 ReceiveSerializedException se(dispatcher, exception); | 107 ReceiveSerializedException se(dispatcher, exception); |
| 108 PP_Bool result = PP_FALSE; | 108 PP_Bool result = PP_FALSE; |
| 109 if (!se.IsThrown()) { | 109 if (!se.IsThrown()) { |
| 110 dispatcher->Send(new PpapiHostMsg_PPBVar_HasMethodDeprecated( | 110 dispatcher->Send(new PpapiHostMsg_PPBVar_HasMethodDeprecated( |
| 111 INTERFACE_ID_PPB_VAR_DEPRECATED, | 111 INTERFACE_ID_PPB_VAR_DEPRECATED, |
| 112 SerializedVarSendInput(dispatcher, var), | 112 SerializedVarSendInput(dispatcher, var), |
| 113 SerializedVarSendInput(dispatcher, name), &se, &result)); | 113 SerializedVarSendInput(dispatcher, name), &se, &result)); |
| 114 } | 114 } |
| 115 return PPBoolToBool(result); | 115 return PP_ToBool(result); |
| 116 } | 116 } |
| 117 | 117 |
| 118 PP_Var GetProperty(PP_Var var, | 118 PP_Var GetProperty(PP_Var var, |
| 119 PP_Var name, | 119 PP_Var name, |
| 120 PP_Var* exception) { | 120 PP_Var* exception) { |
| 121 Dispatcher* dispatcher = CheckExceptionAndGetDispatcher(var, exception); | 121 Dispatcher* dispatcher = CheckExceptionAndGetDispatcher(var, exception); |
| 122 if (!dispatcher) | 122 if (!dispatcher) |
| 123 return PP_MakeUndefined(); | 123 return PP_MakeUndefined(); |
| 124 | 124 |
| 125 ReceiveSerializedException se(dispatcher, exception); | 125 ReceiveSerializedException se(dispatcher, exception); |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 return false; | 244 return false; |
| 245 | 245 |
| 246 PP_Bool result = PP_FALSE; | 246 PP_Bool result = PP_FALSE; |
| 247 int64 class_int = static_cast<int64>(reinterpret_cast<intptr_t>(ppp_class)); | 247 int64 class_int = static_cast<int64>(reinterpret_cast<intptr_t>(ppp_class)); |
| 248 int64 class_data_int = 0; | 248 int64 class_data_int = 0; |
| 249 dispatcher->Send(new PpapiHostMsg_PPBVar_IsInstanceOfDeprecated( | 249 dispatcher->Send(new PpapiHostMsg_PPBVar_IsInstanceOfDeprecated( |
| 250 INTERFACE_ID_PPB_VAR_DEPRECATED, SerializedVarSendInput(dispatcher, var), | 250 INTERFACE_ID_PPB_VAR_DEPRECATED, SerializedVarSendInput(dispatcher, var), |
| 251 class_int, &class_data_int, &result)); | 251 class_int, &class_data_int, &result)); |
| 252 *ppp_class_data = | 252 *ppp_class_data = |
| 253 reinterpret_cast<void*>(static_cast<intptr_t>(class_data_int)); | 253 reinterpret_cast<void*>(static_cast<intptr_t>(class_data_int)); |
| 254 return PPBoolToBool(result); | 254 return PP_ToBool(result); |
| 255 } | 255 } |
| 256 | 256 |
| 257 PP_Var CreateObject(PP_Instance instance, | 257 PP_Var CreateObject(PP_Instance instance, |
| 258 const PPP_Class_Deprecated* ppp_class, | 258 const PPP_Class_Deprecated* ppp_class, |
| 259 void* ppp_class_data) { | 259 void* ppp_class_data) { |
| 260 Dispatcher* dispatcher = PluginDispatcher::GetForInstance(instance); | 260 Dispatcher* dispatcher = PluginDispatcher::GetForInstance(instance); |
| 261 if (!dispatcher) | 261 if (!dispatcher) |
| 262 return PP_MakeUndefined(); | 262 return PP_MakeUndefined(); |
| 263 | 263 |
| 264 ReceiveSerializedVarReturnValue result; | 264 ReceiveSerializedVarReturnValue result; |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 386 task_factory_.NewRunnableMethod( | 386 task_factory_.NewRunnableMethod( |
| 387 &PPB_Var_Deprecated_Proxy::DoReleaseObject, object_id)); | 387 &PPB_Var_Deprecated_Proxy::DoReleaseObject, object_id)); |
| 388 } | 388 } |
| 389 | 389 |
| 390 void PPB_Var_Deprecated_Proxy::OnMsgHasProperty( | 390 void PPB_Var_Deprecated_Proxy::OnMsgHasProperty( |
| 391 SerializedVarReceiveInput var, | 391 SerializedVarReceiveInput var, |
| 392 SerializedVarReceiveInput name, | 392 SerializedVarReceiveInput name, |
| 393 SerializedVarOutParam exception, | 393 SerializedVarOutParam exception, |
| 394 PP_Bool* result) { | 394 PP_Bool* result) { |
| 395 SetAllowPluginReentrancy(); | 395 SetAllowPluginReentrancy(); |
| 396 *result = BoolToPPBool(ppb_var_target()->HasProperty( | 396 *result = PP_FromBool(ppb_var_target()->HasProperty( |
| 397 var.Get(dispatcher()), | 397 var.Get(dispatcher()), |
| 398 name.Get(dispatcher()), | 398 name.Get(dispatcher()), |
| 399 exception.OutParam(dispatcher()))); | 399 exception.OutParam(dispatcher()))); |
| 400 } | 400 } |
| 401 | 401 |
| 402 void PPB_Var_Deprecated_Proxy::OnMsgHasMethodDeprecated( | 402 void PPB_Var_Deprecated_Proxy::OnMsgHasMethodDeprecated( |
| 403 SerializedVarReceiveInput var, | 403 SerializedVarReceiveInput var, |
| 404 SerializedVarReceiveInput name, | 404 SerializedVarReceiveInput name, |
| 405 SerializedVarOutParam exception, | 405 SerializedVarOutParam exception, |
| 406 PP_Bool* result) { | 406 PP_Bool* result) { |
| 407 SetAllowPluginReentrancy(); | 407 SetAllowPluginReentrancy(); |
| 408 *result = BoolToPPBool(ppb_var_target()->HasMethod( | 408 *result = PP_FromBool(ppb_var_target()->HasMethod( |
| 409 var.Get(dispatcher()), | 409 var.Get(dispatcher()), |
| 410 name.Get(dispatcher()), | 410 name.Get(dispatcher()), |
| 411 exception.OutParam(dispatcher()))); | 411 exception.OutParam(dispatcher()))); |
| 412 } | 412 } |
| 413 | 413 |
| 414 void PPB_Var_Deprecated_Proxy::OnMsgGetProperty( | 414 void PPB_Var_Deprecated_Proxy::OnMsgGetProperty( |
| 415 SerializedVarReceiveInput var, | 415 SerializedVarReceiveInput var, |
| 416 SerializedVarReceiveInput name, | 416 SerializedVarReceiveInput name, |
| 417 SerializedVarOutParam exception, | 417 SerializedVarOutParam exception, |
| 418 SerializedVarReturnValue result) { | 418 SerializedVarReturnValue result) { |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 514 | 514 |
| 515 void PPB_Var_Deprecated_Proxy::DoReleaseObject(int64 object_id) { | 515 void PPB_Var_Deprecated_Proxy::DoReleaseObject(int64 object_id) { |
| 516 PP_Var var; | 516 PP_Var var; |
| 517 var.type = PP_VARTYPE_OBJECT; | 517 var.type = PP_VARTYPE_OBJECT; |
| 518 var.value.as_id = object_id; | 518 var.value.as_id = object_id; |
| 519 ppb_var_target()->Release(var); | 519 ppb_var_target()->Release(var); |
| 520 } | 520 } |
| 521 | 521 |
| 522 } // namespace proxy | 522 } // namespace proxy |
| 523 } // namespace pp | 523 } // namespace pp |
| OLD | NEW |