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" | |
11 #include "base/task.h" | |
10 #include "ppapi/c/dev/ppb_var_deprecated.h" | 12 #include "ppapi/c/dev/ppb_var_deprecated.h" |
11 #include "ppapi/c/pp_var.h" | 13 #include "ppapi/c/pp_var.h" |
12 #include "ppapi/c/ppb_core.h" | 14 #include "ppapi/c/ppb_core.h" |
13 #include "ppapi/proxy/host_dispatcher.h" | 15 #include "ppapi/proxy/host_dispatcher.h" |
14 #include "ppapi/proxy/plugin_dispatcher.h" | 16 #include "ppapi/proxy/plugin_dispatcher.h" |
15 #include "ppapi/proxy/plugin_var_tracker.h" | 17 #include "ppapi/proxy/plugin_var_tracker.h" |
16 #include "ppapi/proxy/ppapi_messages.h" | 18 #include "ppapi/proxy/ppapi_messages.h" |
17 #include "ppapi/proxy/ppp_class_proxy.h" | 19 #include "ppapi/proxy/ppp_class_proxy.h" |
18 #include "ppapi/proxy/serialized_var.h" | 20 #include "ppapi/proxy/serialized_var.h" |
19 | 21 |
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
289 InterfaceProxy* CreateVarDeprecatedProxy(Dispatcher* dispatcher, | 291 InterfaceProxy* CreateVarDeprecatedProxy(Dispatcher* dispatcher, |
290 const void* target_interface) { | 292 const void* target_interface) { |
291 return new PPB_Var_Deprecated_Proxy(dispatcher, target_interface); | 293 return new PPB_Var_Deprecated_Proxy(dispatcher, target_interface); |
292 } | 294 } |
293 | 295 |
294 } // namespace | 296 } // namespace |
295 | 297 |
296 PPB_Var_Deprecated_Proxy::PPB_Var_Deprecated_Proxy( | 298 PPB_Var_Deprecated_Proxy::PPB_Var_Deprecated_Proxy( |
297 Dispatcher* dispatcher, | 299 Dispatcher* dispatcher, |
298 const void* target_interface) | 300 const void* target_interface) |
299 : InterfaceProxy(dispatcher, target_interface) { | 301 : InterfaceProxy(dispatcher, target_interface), |
302 task_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) { | |
300 } | 303 } |
301 | 304 |
302 PPB_Var_Deprecated_Proxy::~PPB_Var_Deprecated_Proxy() { | 305 PPB_Var_Deprecated_Proxy::~PPB_Var_Deprecated_Proxy() { |
303 } | 306 } |
304 | 307 |
305 // static | 308 // static |
306 const InterfaceProxy::Info* PPB_Var_Deprecated_Proxy::GetInfo() { | 309 const InterfaceProxy::Info* PPB_Var_Deprecated_Proxy::GetInfo() { |
307 static const Info info = { | 310 static const Info info = { |
308 &var_deprecated_interface, | 311 &var_deprecated_interface, |
309 PPB_VAR_DEPRECATED_INTERFACE, | 312 PPB_VAR_DEPRECATED_INTERFACE, |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
354 | 357 |
355 void PPB_Var_Deprecated_Proxy::OnMsgAddRefObject(int64 object_id, | 358 void PPB_Var_Deprecated_Proxy::OnMsgAddRefObject(int64 object_id, |
356 int* /* unused */) { | 359 int* /* unused */) { |
357 PP_Var var; | 360 PP_Var var; |
358 var.type = PP_VARTYPE_OBJECT; | 361 var.type = PP_VARTYPE_OBJECT; |
359 var.value.as_id = object_id; | 362 var.value.as_id = object_id; |
360 ppb_var_target()->AddRef(var); | 363 ppb_var_target()->AddRef(var); |
361 } | 364 } |
362 | 365 |
363 void PPB_Var_Deprecated_Proxy::OnMsgReleaseObject(int64 object_id) { | 366 void PPB_Var_Deprecated_Proxy::OnMsgReleaseObject(int64 object_id) { |
364 PP_Var var; | 367 MessageLoop::current()->PostNonNestableTask(FROM_HERE, |
brettw
2011/04/22 01:05:04
Can you add a very long comment here about why thi
piman
2011/04/22 02:28:11
Done.
| |
365 var.type = PP_VARTYPE_OBJECT; | 368 task_factory_.NewRunnableMethod( |
366 var.value.as_id = object_id; | 369 &PPB_Var_Deprecated_Proxy::DoReleaseObject, object_id)); |
367 ppb_var_target()->Release(var); | |
368 } | 370 } |
369 | 371 |
370 void PPB_Var_Deprecated_Proxy::OnMsgHasProperty( | 372 void PPB_Var_Deprecated_Proxy::OnMsgHasProperty( |
371 SerializedVarReceiveInput var, | 373 SerializedVarReceiveInput var, |
372 SerializedVarReceiveInput name, | 374 SerializedVarReceiveInput name, |
373 SerializedVarOutParam exception, | 375 SerializedVarOutParam exception, |
374 PP_Bool* result) { | 376 PP_Bool* result) { |
375 SetAllowPluginReentrancy(); | 377 SetAllowPluginReentrancy(); |
376 *result = BoolToPPBool(ppb_var_target()->HasProperty( | 378 *result = BoolToPPBool(ppb_var_target()->HasProperty( |
377 var.Get(dispatcher()), | 379 var.Get(dispatcher()), |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
485 ppb_var_target(), dispatcher(), instance, ppp_class, class_data)); | 487 ppb_var_target(), dispatcher(), instance, ppp_class, class_data)); |
486 } | 488 } |
487 | 489 |
488 void PPB_Var_Deprecated_Proxy::SetAllowPluginReentrancy() { | 490 void PPB_Var_Deprecated_Proxy::SetAllowPluginReentrancy() { |
489 if (dispatcher()->IsPlugin()) | 491 if (dispatcher()->IsPlugin()) |
490 NOTREACHED(); | 492 NOTREACHED(); |
491 else | 493 else |
492 static_cast<HostDispatcher*>(dispatcher())->set_allow_plugin_reentrancy(); | 494 static_cast<HostDispatcher*>(dispatcher())->set_allow_plugin_reentrancy(); |
493 } | 495 } |
494 | 496 |
497 void PPB_Var_Deprecated_Proxy::DoReleaseObject(int64 object_id) { | |
498 PP_Var var; | |
499 var.type = PP_VARTYPE_OBJECT; | |
500 var.value.as_id = object_id; | |
501 ppb_var_target()->Release(var); | |
502 } | |
503 | |
495 } // namespace proxy | 504 } // namespace proxy |
496 } // namespace pp | 505 } // namespace pp |
OLD | NEW |