| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 385 // returned (see ipc_sync_channel.cc). In this case, that means it could | 385 // returned (see ipc_sync_channel.cc). In this case, that means it could |
| 386 // release the object before it is AddRef'ed on the browser side. | 386 // release the object before it is AddRef'ed on the browser side. |
| 387 // To work around this, we post a task here, that will not execute before | 387 // To work around this, we post a task here, that will not execute before |
| 388 // control goes back to the main message loop, that will ensure the sync send | 388 // control goes back to the main message loop, that will ensure the sync send |
| 389 // has returned and the browser side can take its reference before we Release. | 389 // has returned and the browser side can take its reference before we Release. |
| 390 // Note: if the instance is gone by the time the task is executed, then it | 390 // Note: if the instance is gone by the time the task is executed, then it |
| 391 // will Release the objects itself and this Release will be a NOOP (aside of a | 391 // will Release the objects itself and this Release will be a NOOP (aside of a |
| 392 // spurious warning). | 392 // spurious warning). |
| 393 // TODO(piman): See if we can fix the IPC code to enforce strict ordering, and | 393 // TODO(piman): See if we can fix the IPC code to enforce strict ordering, and |
| 394 // then remove this. | 394 // then remove this. |
| 395 MessageLoop::current()->PostNonNestableTask(FROM_HERE, | 395 base::MessageLoop::current()->PostNonNestableTask( |
| 396 FROM_HERE, |
| 396 RunWhileLocked(base::Bind(&PPB_Var_Deprecated_Proxy::DoReleaseObject, | 397 RunWhileLocked(base::Bind(&PPB_Var_Deprecated_Proxy::DoReleaseObject, |
| 397 task_factory_.GetWeakPtr(), | 398 task_factory_.GetWeakPtr(), |
| 398 object_id))); | 399 object_id))); |
| 399 } | 400 } |
| 400 | 401 |
| 401 void PPB_Var_Deprecated_Proxy::OnMsgHasProperty( | 402 void PPB_Var_Deprecated_Proxy::OnMsgHasProperty( |
| 402 SerializedVarReceiveInput var, | 403 SerializedVarReceiveInput var, |
| 403 SerializedVarReceiveInput name, | 404 SerializedVarReceiveInput name, |
| 404 SerializedVarOutParam exception, | 405 SerializedVarOutParam exception, |
| 405 PP_Bool* result) { | 406 PP_Bool* result) { |
| 406 SetAllowPluginReentrancy(); | 407 SetAllowPluginReentrancy(); |
| 407 *result = PP_FromBool(ppb_var_impl_->HasProperty( | 408 *result = PP_FromBool(ppb_var_impl_->HasProperty( |
| 408 var.Get(dispatcher()), | 409 var.Get(dispatcher()), |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 528 } | 529 } |
| 529 | 530 |
| 530 void PPB_Var_Deprecated_Proxy::DoReleaseObject(int64 object_id) { | 531 void PPB_Var_Deprecated_Proxy::DoReleaseObject(int64 object_id) { |
| 531 PP_Var var = { PP_VARTYPE_OBJECT }; | 532 PP_Var var = { PP_VARTYPE_OBJECT }; |
| 532 var.value.as_id = object_id; | 533 var.value.as_id = object_id; |
| 533 ppb_var_impl_->Release(var); | 534 ppb_var_impl_->Release(var); |
| 534 } | 535 } |
| 535 | 536 |
| 536 } // namespace proxy | 537 } // namespace proxy |
| 537 } // namespace ppapi | 538 } // namespace ppapi |
| OLD | NEW |