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 | 15 |
16 namespace pp { | 16 namespace ppapi { |
17 namespace proxy { | 17 namespace proxy { |
18 | 18 |
19 namespace { | 19 namespace { |
20 | 20 |
21 void HandleMessage(PP_Instance instance, PP_Var message_data) { | 21 void HandleMessage(PP_Instance instance, PP_Var message_data) { |
22 HostDispatcher* dispatcher = HostDispatcher::GetForInstance(instance); | 22 HostDispatcher* dispatcher = HostDispatcher::GetForInstance(instance); |
23 if (!dispatcher || (message_data.type == PP_VARTYPE_OBJECT)) { | 23 if (!dispatcher || (message_data.type == PP_VARTYPE_OBJECT)) { |
24 // 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 |
25 // an 'object' var over PPP_Messaging. | 25 // an 'object' var over PPP_Messaging. |
26 NOTREACHED(); | 26 NOTREACHED(); |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 void PPP_Messaging_Proxy::OnMsgHandleMessage( | 77 void PPP_Messaging_Proxy::OnMsgHandleMessage( |
78 PP_Instance instance, SerializedVarReceiveInput message_data) { | 78 PP_Instance instance, SerializedVarReceiveInput message_data) { |
79 PP_Var received_var(message_data.Get(dispatcher())); | 79 PP_Var received_var(message_data.Get(dispatcher())); |
80 // SerializedVarReceiveInput will decrement the reference count, but we want | 80 // SerializedVarReceiveInput will decrement the reference count, but we want |
81 // to give the recipient a reference. | 81 // to give the recipient a reference. |
82 PluginResourceTracker::GetInstance()->var_tracker().AddRefVar(received_var); | 82 PluginResourceTracker::GetInstance()->var_tracker().AddRefVar(received_var); |
83 ppp_messaging_target()->HandleMessage(instance, received_var); | 83 ppp_messaging_target()->HandleMessage(instance, received_var); |
84 } | 84 } |
85 | 85 |
86 } // namespace proxy | 86 } // namespace proxy |
87 } // namespace pp | 87 } // namespace ppapi |
OLD | NEW |