| 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/ppp_messaging_proxy.h" | 5 #include "ppapi/proxy/ppp_messaging_proxy.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "ppapi/c/ppp_messaging.h" | 9 #include "ppapi/c/ppp_messaging.h" |
| 10 #include "ppapi/proxy/host_dispatcher.h" | 10 #include "ppapi/proxy/host_dispatcher.h" |
| 11 #include "ppapi/proxy/plugin_resource_tracker.h" | 11 #include "ppapi/proxy/plugin_resource_tracker.h" |
| 12 #include "ppapi/proxy/plugin_var_tracker.h" | 12 #include "ppapi/proxy/plugin_var_tracker.h" |
| 13 #include "ppapi/proxy/ppapi_messages.h" | 13 #include "ppapi/proxy/ppapi_messages.h" |
| 14 #include "ppapi/proxy/serialized_var.h" | 14 #include "ppapi/proxy/serialized_var.h" |
| 15 #include "ppapi/shared_impl/ppapi_globals.h" | 15 #include "ppapi/shared_impl/ppapi_globals.h" |
| 16 #include "ppapi/shared_impl/proxy_lock.h" |
| 16 #include "ppapi/shared_impl/var_tracker.h" | 17 #include "ppapi/shared_impl/var_tracker.h" |
| 17 | 18 |
| 18 namespace ppapi { | 19 namespace ppapi { |
| 19 namespace proxy { | 20 namespace proxy { |
| 20 | 21 |
| 21 namespace { | 22 namespace { |
| 22 | 23 |
| 23 void HandleMessage(PP_Instance instance, PP_Var message_data) { | 24 void HandleMessage(PP_Instance instance, PP_Var message_data) { |
| 24 HostDispatcher* dispatcher = HostDispatcher::GetForInstance(instance); | 25 HostDispatcher* dispatcher = HostDispatcher::GetForInstance(instance); |
| 25 if (!dispatcher || (message_data.type == PP_VARTYPE_OBJECT)) { | 26 if (!dispatcher || (message_data.type == PP_VARTYPE_OBJECT)) { |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 IPC_END_MESSAGE_MAP() | 79 IPC_END_MESSAGE_MAP() |
| 79 return handled; | 80 return handled; |
| 80 } | 81 } |
| 81 | 82 |
| 82 void PPP_Messaging_Proxy::OnMsgHandleMessage( | 83 void PPP_Messaging_Proxy::OnMsgHandleMessage( |
| 83 PP_Instance instance, SerializedVarReceiveInput message_data) { | 84 PP_Instance instance, SerializedVarReceiveInput message_data) { |
| 84 PP_Var received_var(message_data.Get(dispatcher())); | 85 PP_Var received_var(message_data.Get(dispatcher())); |
| 85 // SerializedVarReceiveInput will decrement the reference count, but we want | 86 // SerializedVarReceiveInput will decrement the reference count, but we want |
| 86 // to give the recipient a reference. | 87 // to give the recipient a reference. |
| 87 PpapiGlobals::Get()->GetVarTracker()->AddRefVar(received_var); | 88 PpapiGlobals::Get()->GetVarTracker()->AddRefVar(received_var); |
| 88 ppp_messaging_impl_->HandleMessage(instance, received_var); | 89 CallWhileUnlocked(ppp_messaging_impl_->HandleMessage, |
| 90 instance, |
| 91 received_var); |
| 89 } | 92 } |
| 90 | 93 |
| 91 } // namespace proxy | 94 } // namespace proxy |
| 92 } // namespace ppapi | 95 } // namespace ppapi |
| OLD | NEW |