| 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/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBVar_CreateObjectDeprecated, | 336 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBVar_CreateObjectDeprecated, |
| 337 OnMsgCreateObjectDeprecated) | 337 OnMsgCreateObjectDeprecated) |
| 338 IPC_MESSAGE_UNHANDLED(handled = false) | 338 IPC_MESSAGE_UNHANDLED(handled = false) |
| 339 IPC_END_MESSAGE_MAP() | 339 IPC_END_MESSAGE_MAP() |
| 340 // TODO(brettw) handle bad messages! | 340 // TODO(brettw) handle bad messages! |
| 341 return handled; | 341 return handled; |
| 342 } | 342 } |
| 343 | 343 |
| 344 void PPB_Var_Deprecated_Proxy::OnMsgAddRefObject(int64 object_id, | 344 void PPB_Var_Deprecated_Proxy::OnMsgAddRefObject(int64 object_id, |
| 345 int* /* unused */) { | 345 int* /* unused */) { |
| 346 PP_Var var; | 346 PP_Var var = { PP_VARTYPE_OBJECT }; |
| 347 var.type = PP_VARTYPE_OBJECT; | |
| 348 var.value.as_id = object_id; | 347 var.value.as_id = object_id; |
| 349 ppb_var_impl_->AddRef(var); | 348 ppb_var_impl_->AddRef(var); |
| 350 } | 349 } |
| 351 | 350 |
| 352 void PPB_Var_Deprecated_Proxy::OnMsgReleaseObject(int64 object_id) { | 351 void PPB_Var_Deprecated_Proxy::OnMsgReleaseObject(int64 object_id) { |
| 353 // Ok, so this is super subtle. | 352 // Ok, so this is super subtle. |
| 354 // When the browser side sends a sync IPC message that returns a var, and the | 353 // When the browser side sends a sync IPC message that returns a var, and the |
| 355 // plugin wants to give ownership of that var to the browser, dropping all | 354 // plugin wants to give ownership of that var to the browser, dropping all |
| 356 // references, it may call ReleaseObject right after returning the result. | 355 // references, it may call ReleaseObject right after returning the result. |
| 357 // However, the IPC system doesn't enforce strict ordering of messages in that | 356 // However, the IPC system doesn't enforce strict ordering of messages in that |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 497 } | 496 } |
| 498 | 497 |
| 499 void PPB_Var_Deprecated_Proxy::SetAllowPluginReentrancy() { | 498 void PPB_Var_Deprecated_Proxy::SetAllowPluginReentrancy() { |
| 500 if (dispatcher()->IsPlugin()) | 499 if (dispatcher()->IsPlugin()) |
| 501 NOTREACHED(); | 500 NOTREACHED(); |
| 502 else | 501 else |
| 503 static_cast<HostDispatcher*>(dispatcher())->set_allow_plugin_reentrancy(); | 502 static_cast<HostDispatcher*>(dispatcher())->set_allow_plugin_reentrancy(); |
| 504 } | 503 } |
| 505 | 504 |
| 506 void PPB_Var_Deprecated_Proxy::DoReleaseObject(int64 object_id) { | 505 void PPB_Var_Deprecated_Proxy::DoReleaseObject(int64 object_id) { |
| 507 PP_Var var; | 506 PP_Var var = { PP_VARTYPE_OBJECT }; |
| 508 var.type = PP_VARTYPE_OBJECT; | |
| 509 var.value.as_id = object_id; | 507 var.value.as_id = object_id; |
| 510 ppb_var_impl_->Release(var); | 508 ppb_var_impl_->Release(var); |
| 511 } | 509 } |
| 512 | 510 |
| 513 } // namespace proxy | 511 } // namespace proxy |
| 514 } // namespace ppapi | 512 } // namespace ppapi |
| OLD | NEW |