Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(395)

Side by Side Diff: ppapi/proxy/plugin_dispatcher.h

Issue 46433002: Support using TrackedCallbacks as hints to determine the handling thread of resource reply messages (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: cleanup Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_PLUGIN_DISPATCHER_H_ 5 #ifndef PPAPI_PROXY_PLUGIN_DISPATCHER_H_
6 #define PPAPI_PROXY_PLUGIN_DISPATCHER_H_ 6 #define PPAPI_PROXY_PLUGIN_DISPATCHER_H_
7 7
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 10
(...skipping 22 matching lines...) Expand all
33 struct Preferences; 33 struct Preferences;
34 class Resource; 34 class Resource;
35 35
36 namespace thunk { 36 namespace thunk {
37 class PPB_Instance_API; 37 class PPB_Instance_API;
38 class ResourceCreationAPI; 38 class ResourceCreationAPI;
39 } 39 }
40 40
41 namespace proxy { 41 namespace proxy {
42 42
43 class ResourceMessageReplyParams;
44
45 // Used to keep track of per-instance data. 43 // Used to keep track of per-instance data.
46 struct InstanceData { 44 struct InstanceData {
47 InstanceData(); 45 InstanceData();
48 ~InstanceData(); 46 ~InstanceData();
49 47
50 ViewData view; 48 ViewData view;
51 49
52 // When non-NULL, indicates the callback to execute when mouse lock is lost. 50 // When non-NULL, indicates the callback to execute when mouse lock is lost.
53 scoped_refptr<TrackedCallback> mouse_lock_callback; 51 scoped_refptr<TrackedCallback> mouse_lock_callback;
54 52
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 // resource. Guaranteed non-NULL. 154 // resource. Guaranteed non-NULL.
157 thunk::PPB_Instance_API* GetInstanceAPI(); 155 thunk::PPB_Instance_API* GetInstanceAPI();
158 thunk::ResourceCreationAPI* GetResourceCreationAPI(); 156 thunk::ResourceCreationAPI* GetResourceCreationAPI();
159 157
160 // Returns the Preferences. 158 // Returns the Preferences.
161 const Preferences& preferences() const { return preferences_; } 159 const Preferences& preferences() const { return preferences_; }
162 160
163 uint32 plugin_dispatcher_id() const { return plugin_dispatcher_id_; } 161 uint32 plugin_dispatcher_id() const { return plugin_dispatcher_id_; }
164 bool incognito() const { return incognito_; } 162 bool incognito() const { return incognito_; }
165 163
166 // Dispatches the given resource message to the appropriate resource in the
167 // plugin process. This should be wired to the various channels that messages
168 // come in from various other processes.
169 static void DispatchResourceReply(
170 const ppapi::proxy::ResourceMessageReplyParams& reply_params,
171 const IPC::Message& nested_msg);
172
173 private: 164 private:
174 friend class PluginDispatcherTest; 165 friend class PluginDispatcherTest;
175 166
176 // Notifies all live instances that they're now closed. This is used when 167 // Notifies all live instances that they're now closed. This is used when
177 // a renderer crashes or some other error is received. 168 // a renderer crashes or some other error is received.
178 void ForceFreeAllInstances(); 169 void ForceFreeAllInstances();
179 170
180 // IPC message handlers. 171 // IPC message handlers.
181 void OnMsgResourceReply(
182 const ppapi::proxy::ResourceMessageReplyParams& reply_params,
183 const IPC::Message& nested_msg);
184 void OnMsgSupportsInterface(const std::string& interface_name, bool* result); 172 void OnMsgSupportsInterface(const std::string& interface_name, bool* result);
185 void OnMsgSetPreferences(const Preferences& prefs); 173 void OnMsgSetPreferences(const Preferences& prefs);
186 174
187 // Internal backed for DispatchResourceReply.
188 static void LockedDispatchResourceReply(
189 const ppapi::proxy::ResourceMessageReplyParams& reply_params,
190 const IPC::Message& nested_msg);
191
192 virtual bool SendMessage(IPC::Message* msg); 175 virtual bool SendMessage(IPC::Message* msg);
193 176
194 PluginDelegate* plugin_delegate_; 177 PluginDelegate* plugin_delegate_;
195 178
196 // Contains all the plugin interfaces we've queried. The mapped value will 179 // Contains all the plugin interfaces we've queried. The mapped value will
197 // be the pointer to the interface pointer supplied by the plugin if it's 180 // be the pointer to the interface pointer supplied by the plugin if it's
198 // supported, or NULL if it's not supported. This allows us to cache failures 181 // supported, or NULL if it's not supported. This allows us to cache failures
199 // and not req-query if a plugin doesn't support the interface. 182 // and not req-query if a plugin doesn't support the interface.
200 typedef base::hash_map<std::string, const void*> InterfaceMap; 183 typedef base::hash_map<std::string, const void*> InterfaceMap;
201 InterfaceMap plugin_interfaces_; 184 InterfaceMap plugin_interfaces_;
(...skipping 15 matching lines...) Expand all
217 // A filter for sending messages from threads other than the main thread. 200 // A filter for sending messages from threads other than the main thread.
218 scoped_refptr<IPC::SyncMessageFilter> sync_filter_; 201 scoped_refptr<IPC::SyncMessageFilter> sync_filter_;
219 202
220 DISALLOW_COPY_AND_ASSIGN(PluginDispatcher); 203 DISALLOW_COPY_AND_ASSIGN(PluginDispatcher);
221 }; 204 };
222 205
223 } // namespace proxy 206 } // namespace proxy
224 } // namespace ppapi 207 } // namespace ppapi
225 208
226 #endif // PPAPI_PROXY_PLUGIN_DISPATCHER_H_ 209 #endif // PPAPI_PROXY_PLUGIN_DISPATCHER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698