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