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" |
| 16 #include "ppapi/shared_impl/var_tracker.h" |
15 | 17 |
16 namespace ppapi { | 18 namespace ppapi { |
17 namespace proxy { | 19 namespace proxy { |
18 | 20 |
19 namespace { | 21 namespace { |
20 | 22 |
21 void HandleMessage(PP_Instance instance, PP_Var message_data) { | 23 void HandleMessage(PP_Instance instance, PP_Var message_data) { |
22 HostDispatcher* dispatcher = HostDispatcher::GetForInstance(instance); | 24 HostDispatcher* dispatcher = HostDispatcher::GetForInstance(instance); |
23 if (!dispatcher || (message_data.type == PP_VARTYPE_OBJECT)) { | 25 if (!dispatcher || (message_data.type == PP_VARTYPE_OBJECT)) { |
24 // The dispatcher should always be valid, and the browser should never send | 26 // The dispatcher should always be valid, and the browser should never send |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 IPC_MESSAGE_UNHANDLED(handled = false) | 77 IPC_MESSAGE_UNHANDLED(handled = false) |
76 IPC_END_MESSAGE_MAP() | 78 IPC_END_MESSAGE_MAP() |
77 return handled; | 79 return handled; |
78 } | 80 } |
79 | 81 |
80 void PPP_Messaging_Proxy::OnMsgHandleMessage( | 82 void PPP_Messaging_Proxy::OnMsgHandleMessage( |
81 PP_Instance instance, SerializedVarReceiveInput message_data) { | 83 PP_Instance instance, SerializedVarReceiveInput message_data) { |
82 PP_Var received_var(message_data.Get(dispatcher())); | 84 PP_Var received_var(message_data.Get(dispatcher())); |
83 // SerializedVarReceiveInput will decrement the reference count, but we want | 85 // SerializedVarReceiveInput will decrement the reference count, but we want |
84 // to give the recipient a reference. | 86 // to give the recipient a reference. |
85 PluginResourceTracker::GetInstance()->var_tracker().AddRefVar(received_var); | 87 PpapiGlobals::Get()->GetVarTracker()->AddRefVar(received_var); |
86 ppp_messaging_impl_->HandleMessage(instance, received_var); | 88 ppp_messaging_impl_->HandleMessage(instance, received_var); |
87 } | 89 } |
88 | 90 |
89 } // namespace proxy | 91 } // namespace proxy |
90 } // namespace ppapi | 92 } // namespace ppapi |
OLD | NEW |