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 #ifndef PPAPI_PROXY_DISPATCHER_H_ | 5 #ifndef PPAPI_PROXY_DISPATCHER_H_ |
6 #define PPAPI_PROXY_DISPATCHER_H_ | 6 #define PPAPI_PROXY_DISPATCHER_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/callback.h" | 12 #include "base/callback.h" |
13 #include "base/tracked_objects.h" | 13 #include "base/tracked_objects.h" |
14 #include "ipc/ipc_channel_proxy.h" | 14 #include "ipc/ipc_channel_proxy.h" |
15 #include "ppapi/c/pp_instance.h" | 15 #include "ppapi/c/pp_instance.h" |
16 #include "ppapi/c/pp_module.h" | 16 #include "ppapi/c/pp_module.h" |
17 #include "ppapi/proxy/callback_tracker.h" | |
18 #include "ppapi/proxy/proxy_channel.h" | 17 #include "ppapi/proxy/proxy_channel.h" |
19 #include "ppapi/proxy/interface_id.h" | 18 #include "ppapi/proxy/interface_id.h" |
20 #include "ppapi/proxy/interface_list.h" | 19 #include "ppapi/proxy/interface_list.h" |
21 #include "ppapi/proxy/interface_proxy.h" | 20 #include "ppapi/proxy/interface_proxy.h" |
22 #include "ppapi/proxy/plugin_var_tracker.h" | 21 #include "ppapi/proxy/plugin_var_tracker.h" |
23 | 22 |
24 namespace ppapi { | 23 namespace ppapi { |
25 | 24 |
26 class WebKitForwarding; | 25 class WebKitForwarding; |
27 | 26 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 void AddIOThreadMessageFilter(IPC::ChannelProxy::MessageFilter* filter); | 75 void AddIOThreadMessageFilter(IPC::ChannelProxy::MessageFilter* filter); |
77 | 76 |
78 // TODO(brettw): What is this comment referring to? | 77 // TODO(brettw): What is this comment referring to? |
79 // Called if the remote side is declaring to us which interfaces it supports | 78 // Called if the remote side is declaring to us which interfaces it supports |
80 // so we don't have to query for each one. We'll pre-create proxies for | 79 // so we don't have to query for each one. We'll pre-create proxies for |
81 // each of the given interfaces. | 80 // each of the given interfaces. |
82 | 81 |
83 // IPC::Channel::Listener implementation. | 82 // IPC::Channel::Listener implementation. |
84 virtual bool OnMessageReceived(const IPC::Message& msg); | 83 virtual bool OnMessageReceived(const IPC::Message& msg); |
85 | 84 |
86 CallbackTracker& callback_tracker() { | |
87 return callback_tracker_; | |
88 } | |
89 | |
90 GetInterfaceFunc local_get_interface() const { return local_get_interface_; } | 85 GetInterfaceFunc local_get_interface() const { return local_get_interface_; } |
91 | 86 |
92 protected: | 87 protected: |
93 Dispatcher(base::ProcessHandle remote_process_handle, | 88 Dispatcher(base::ProcessHandle remote_process_handle, |
94 GetInterfaceFunc local_get_interface); | 89 GetInterfaceFunc local_get_interface); |
95 | 90 |
96 // Setter for the derived classes to set the appropriate var serialization. | 91 // Setter for the derived classes to set the appropriate var serialization. |
97 // Takes ownership of the given pointer, which must be on the heap. | 92 // Takes ownership of the given pointer, which must be on the heap. |
98 void SetSerializationRules(VarSerializationRules* var_serialization_rules); | 93 void SetSerializationRules(VarSerializationRules* var_serialization_rules); |
99 | 94 |
100 // Called when an invalid message is received from the remote site. The | 95 // Called when an invalid message is received from the remote site. The |
101 // default implementation does nothing, derived classes can override. | 96 // default implementation does nothing, derived classes can override. |
102 virtual void OnInvalidMessageReceived(); | 97 virtual void OnInvalidMessageReceived(); |
103 | 98 |
104 bool disallow_trusted_interfaces() const { | 99 bool disallow_trusted_interfaces() const { |
105 return disallow_trusted_interfaces_; | 100 return disallow_trusted_interfaces_; |
106 } | 101 } |
107 | 102 |
108 private: | 103 private: |
109 friend class HostDispatcherTest; | 104 friend class HostDispatcherTest; |
110 friend class PluginDispatcherTest; | 105 friend class PluginDispatcherTest; |
111 | 106 |
112 // Lists all lazily-created interface proxies. | 107 // Lists all lazily-created interface proxies. |
113 scoped_ptr<InterfaceProxy> proxies_[INTERFACE_ID_COUNT]; | 108 scoped_ptr<InterfaceProxy> proxies_[INTERFACE_ID_COUNT]; |
114 | 109 |
115 bool disallow_trusted_interfaces_; | 110 bool disallow_trusted_interfaces_; |
116 | 111 |
117 GetInterfaceFunc local_get_interface_; | 112 GetInterfaceFunc local_get_interface_; |
118 | 113 |
119 CallbackTracker callback_tracker_; | |
120 | |
121 scoped_ptr<VarSerializationRules> serialization_rules_; | 114 scoped_ptr<VarSerializationRules> serialization_rules_; |
122 | 115 |
123 DISALLOW_COPY_AND_ASSIGN(Dispatcher); | 116 DISALLOW_COPY_AND_ASSIGN(Dispatcher); |
124 }; | 117 }; |
125 | 118 |
126 } // namespace proxy | 119 } // namespace proxy |
127 } // namespace ppapi | 120 } // namespace ppapi |
128 | 121 |
129 #endif // PPAPI_PROXY_DISPATCHER_H_ | 122 #endif // PPAPI_PROXY_DISPATCHER_H_ |
OLD | NEW |