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