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