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

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

Issue 7844018: Revert 100748 - This patch tries to remove most of the manual registration for Pepper interfaces,... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 3 months 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
« no previous file with comments | « ppapi/proxy/interface_proxy.cc ('k') | ppapi/proxy/plugin_dispatcher.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_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 <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 // The plugin side maintains a mapping from PP_Instance to Dispatcher so 81 // The plugin side maintains a mapping from PP_Instance to Dispatcher so
82 // that we can send the messages to the right channel if there are multiple 82 // that we can send the messages to the right channel if there are multiple
83 // renderers sharing the same plugin. This mapping is maintained by 83 // renderers sharing the same plugin. This mapping is maintained by
84 // DidCreateInstance/DidDestroyInstance. 84 // DidCreateInstance/DidDestroyInstance.
85 static PluginDispatcher* GetForInstance(PP_Instance instance); 85 static PluginDispatcher* GetForInstance(PP_Instance instance);
86 86
87 // Same as GetForInstance but retrieves the instance from the given resource 87 // Same as GetForInstance but retrieves the instance from the given resource
88 // object as a convenience. Returns NULL on failure. 88 // object as a convenience. Returns NULL on failure.
89 static PluginDispatcher* GetForResource(const Resource* resource); 89 static PluginDispatcher* GetForResource(const Resource* resource);
90 90
91 // Implements the GetInterface function for the plugin to call to retrieve 91 static const void* GetInterfaceFromDispatcher(
92 // a browser interface. 92 const char* dispatcher_interface);
93 static const void* GetBrowserInterface(const char* interface);
94
95 const void* GetPluginInterface(const std::string& interface_name);
96 93
97 // You must call this function before anything else. Returns true on success. 94 // You must call this function before anything else. Returns true on success.
98 // The delegate pointer must outlive this class, ownership is not 95 // The delegate pointer must outlive this class, ownership is not
99 // transferred. 96 // transferred.
100 bool InitPluginWithChannel(PluginDelegate* delegate, 97 bool InitPluginWithChannel(PluginDelegate* delegate,
101 const IPC::ChannelHandle& channel_handle, 98 const IPC::ChannelHandle& channel_handle,
102 bool is_client); 99 bool is_client);
103 100
104 // Dispatcher overrides. 101 // Dispatcher overrides.
105 virtual bool IsPlugin() const; 102 virtual bool IsPlugin() const;
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 // Notifies all live instances that they're now closed. This is used when 142 // Notifies all live instances that they're now closed. This is used when
146 // a renderer crashes or some other error is received. 143 // a renderer crashes or some other error is received.
147 void ForceFreeAllInstances(); 144 void ForceFreeAllInstances();
148 145
149 // IPC message handlers. 146 // IPC message handlers.
150 void OnMsgSupportsInterface(const std::string& interface_name, bool* result); 147 void OnMsgSupportsInterface(const std::string& interface_name, bool* result);
151 void OnMsgSetPreferences(const Preferences& prefs); 148 void OnMsgSetPreferences(const Preferences& prefs);
152 149
153 PluginDelegate* plugin_delegate_; 150 PluginDelegate* plugin_delegate_;
154 151
155 // Contains all the plugin interfaces we've queried. The mapped value will 152 // All target proxies currently created. These are ones that receive
156 // be the pointer to the interface pointer supplied by the plugin if it's 153 // messages.
157 // supported, or NULL if it's not supported. This allows us to cache failures 154 scoped_ptr<InterfaceProxy> target_proxies_[INTERFACE_ID_COUNT];
158 // and not req-query if a plugin doesn't support the interface. 155
159 typedef base::hash_map<std::string, const void*> InterfaceMap; 156 // Function proxies created for "new-style" FunctionGroups.
160 InterfaceMap plugin_interfaces_; 157 // TODO(brettw) this is in progress. It should be merged with the target
158 // proxies so there is one list to consult.
159 scoped_ptr<FunctionGroupBase> function_proxies_[INTERFACE_ID_COUNT];
161 160
162 typedef base::hash_map<PP_Instance, InstanceData> InstanceDataMap; 161 typedef base::hash_map<PP_Instance, InstanceData> InstanceDataMap;
163 InstanceDataMap instance_map_; 162 InstanceDataMap instance_map_;
164 163
165 // The preferences sent from the host. We only want to set this once, which 164 // The preferences sent from the host. We only want to set this once, which
166 // is what the received_preferences_ indicates. See OnMsgSetPreferences. 165 // is what the received_preferences_ indicates. See OnMsgSetPreferences.
167 bool received_preferences_; 166 bool received_preferences_;
168 Preferences preferences_; 167 Preferences preferences_;
169 168
170 uint32 plugin_dispatcher_id_; 169 uint32 plugin_dispatcher_id_;
171 170
172 DISALLOW_COPY_AND_ASSIGN(PluginDispatcher); 171 DISALLOW_COPY_AND_ASSIGN(PluginDispatcher);
173 }; 172 };
174 173
175 } // namespace proxy 174 } // namespace proxy
176 } // namespace ppapi 175 } // namespace ppapi
177 176
178 #endif // PPAPI_PROXY_PLUGIN_DISPATCHER_H_ 177 #endif // PPAPI_PROXY_PLUGIN_DISPATCHER_H_
OLDNEW
« no previous file with comments | « ppapi/proxy/interface_proxy.cc ('k') | ppapi/proxy/plugin_dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698