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

Side by Side Diff: ppapi/proxy/dispatcher.cc

Issue 7189045: Make o.o.p. proxy handle PPP_Instance versions 0.4 and 0.5. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merged Created 9 years, 5 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/dispatcher.h ('k') | ppapi/proxy/host_dispatcher.h » ('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 #include "ppapi/proxy/dispatcher.h" 5 #include "ppapi/proxy/dispatcher.h"
6 6
7 #include <string.h> // For memset. 7 #include <string.h> // For memset.
8 8
9 #include <map> 9 #include <map>
10 10
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 96
97 typedef std::map<std::string, const InterfaceProxy::Info*> NameToInfo; 97 typedef std::map<std::string, const InterfaceProxy::Info*> NameToInfo;
98 NameToInfo name_to_plugin_info_; 98 NameToInfo name_to_plugin_info_;
99 NameToInfo name_to_browser_info_; 99 NameToInfo name_to_browser_info_;
100 100
101 // Note that there can be multiple interface names mapping to the same ID. 101 // Note that there can be multiple interface names mapping to the same ID.
102 // In this case, the ID will map to one of them. This is temporary while 102 // In this case, the ID will map to one of them. This is temporary while
103 // we're converting to the thunk system, when that is complete, we need to 103 // we're converting to the thunk system, when that is complete, we need to
104 // have a better way of handling multiple interface implemented by one 104 // have a better way of handling multiple interface implemented by one
105 // proxy object. 105 // proxy object.
106 const InterfaceProxy::Info* id_to_plugin_info_[INTERFACE_ID_COUNT];
107 const InterfaceProxy::Info* id_to_browser_info_[INTERFACE_ID_COUNT]; 106 const InterfaceProxy::Info* id_to_browser_info_[INTERFACE_ID_COUNT];
108 }; 107 };
109 108
110 InterfaceList::InterfaceList() { 109 InterfaceList::InterfaceList() {
111 memset(id_to_plugin_info_, 0, sizeof(id_to_plugin_info_));
112 memset(id_to_browser_info_, 0, sizeof(id_to_browser_info_)); 110 memset(id_to_browser_info_, 0, sizeof(id_to_browser_info_));
113 111
114 // PPB (browser) interfaces. 112 // PPB (browser) interfaces.
115 AddPPB(PPB_AudioConfig_Proxy::GetInfo()); 113 AddPPB(PPB_AudioConfig_Proxy::GetInfo());
116 AddPPB(PPB_Audio_Proxy::GetInfo()); 114 AddPPB(PPB_Audio_Proxy::GetInfo());
117 AddPPB(PPB_Broker_Proxy::GetInfo()); 115 AddPPB(PPB_Broker_Proxy::GetInfo());
118 AddPPB(PPB_Buffer_Proxy::GetInfo()); 116 AddPPB(PPB_Buffer_Proxy::GetInfo());
119 AddPPB(PPB_CharSet_Proxy::GetInfo()); 117 AddPPB(PPB_CharSet_Proxy::GetInfo());
120 AddPPB(PPB_Console_Proxy::GetInfo()); 118 AddPPB(PPB_Console_Proxy::GetInfo());
121 AddPPB(PPB_Context3D_Proxy::GetInfo()); 119 AddPPB(PPB_Context3D_Proxy::GetInfo());
(...skipping 28 matching lines...) Expand all
150 AddPPB(PPB_Var_Deprecated_Proxy::GetInfo()); 148 AddPPB(PPB_Var_Deprecated_Proxy::GetInfo());
151 AddPPB(PPB_Var_Proxy::GetInfo()); 149 AddPPB(PPB_Var_Proxy::GetInfo());
152 150
153 #ifdef ENABLE_FLAPPER_HACKS 151 #ifdef ENABLE_FLAPPER_HACKS
154 AddPPB(PPB_Flash_NetConnector_Proxy::GetInfo()); 152 AddPPB(PPB_Flash_NetConnector_Proxy::GetInfo());
155 #endif 153 #endif
156 154
157 // PPP (plugin) interfaces. 155 // PPP (plugin) interfaces.
158 AddPPP(PPP_Graphics3D_Proxy::GetInfo()); 156 AddPPP(PPP_Graphics3D_Proxy::GetInfo());
159 AddPPP(PPP_Instance_Private_Proxy::GetInfo()); 157 AddPPP(PPP_Instance_Private_Proxy::GetInfo());
160 AddPPP(PPP_Instance_Proxy::GetInfo()); 158 AddPPP(PPP_Instance_Proxy::GetInfo0_4());
159 AddPPP(PPP_Instance_Proxy::GetInfo0_5());
161 } 160 }
162 161
163 void InterfaceList::AddPPP(const InterfaceProxy::Info* info) { 162 void InterfaceList::AddPPP(const InterfaceProxy::Info* info) {
164 DCHECK(name_to_plugin_info_.find(info->name) == 163 DCHECK(name_to_plugin_info_.find(info->name) ==
165 name_to_plugin_info_.end()); 164 name_to_plugin_info_.end());
166 DCHECK(info->id >= INTERFACE_ID_NONE && info->id < INTERFACE_ID_COUNT); 165 DCHECK(info->id >= INTERFACE_ID_NONE && info->id < INTERFACE_ID_COUNT);
167 DCHECK(info->id == INTERFACE_ID_NONE || id_to_plugin_info_[info->id] == NULL);
168 166
169 name_to_plugin_info_[info->name] = info; 167 name_to_plugin_info_[info->name] = info;
170 if (info->id != INTERFACE_ID_NONE)
171 id_to_plugin_info_[info->id] = info;
172 } 168 }
173 169
174 void InterfaceList::AddPPB(const InterfaceProxy::Info* info) { 170 void InterfaceList::AddPPB(const InterfaceProxy::Info* info) {
175 DCHECK(name_to_browser_info_.find(info->name) == 171 DCHECK(name_to_browser_info_.find(info->name) ==
176 name_to_browser_info_.end()); 172 name_to_browser_info_.end());
177 DCHECK(info->id >= INTERFACE_ID_NONE && info->id < INTERFACE_ID_COUNT); 173 DCHECK(info->id >= INTERFACE_ID_NONE && info->id < INTERFACE_ID_COUNT);
178 DCHECK(info->id == INTERFACE_ID_NONE || 174 DCHECK(info->id == INTERFACE_ID_NONE ||
179 id_to_browser_info_[info->id] == NULL); 175 id_to_browser_info_[info->id] == NULL);
180 176
181 name_to_browser_info_[std::string(info->name)] = info; 177 name_to_browser_info_[std::string(info->name)] = info;
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 const InterfaceProxy::Info* Dispatcher::GetPPPInterfaceInfo( 234 const InterfaceProxy::Info* Dispatcher::GetPPPInterfaceInfo(
239 const std::string& name) { 235 const std::string& name) {
240 const InterfaceList* list = InterfaceList::GetInstance(); 236 const InterfaceList* list = InterfaceList::GetInstance();
241 InterfaceList::NameToInfo::const_iterator found = 237 InterfaceList::NameToInfo::const_iterator found =
242 list->name_to_plugin_info_.find(name); 238 list->name_to_plugin_info_.find(name);
243 if (found == list->name_to_plugin_info_.end()) 239 if (found == list->name_to_plugin_info_.end())
244 return NULL; 240 return NULL;
245 return found->second; 241 return found->second;
246 } 242 }
247 243
248 // static
249 const InterfaceProxy::Info* Dispatcher::GetPPPInterfaceInfo(InterfaceID id) {
250 if (id <= 0 || id >= INTERFACE_ID_COUNT)
251 return NULL;
252 const InterfaceList* list = InterfaceList::GetInstance();
253 return list->id_to_plugin_info_[id];
254 }
255
256 void Dispatcher::SetSerializationRules( 244 void Dispatcher::SetSerializationRules(
257 VarSerializationRules* var_serialization_rules) { 245 VarSerializationRules* var_serialization_rules) {
258 serialization_rules_.reset(var_serialization_rules); 246 serialization_rules_.reset(var_serialization_rules);
259 } 247 }
260 248
261 const void* Dispatcher::GetLocalInterface(const char* interface_name) { 249 const void* Dispatcher::GetLocalInterface(const char* interface_name) {
262 return local_get_interface_(interface_name); 250 return local_get_interface_(interface_name);
263 } 251 }
264 252
265 base::MessageLoopProxy* Dispatcher::GetIPCMessageLoop() { 253 base::MessageLoopProxy* Dispatcher::GetIPCMessageLoop() {
266 return delegate()->GetIPCMessageLoop(); 254 return delegate()->GetIPCMessageLoop();
267 } 255 }
268 256
269 void Dispatcher::AddIOThreadMessageFilter( 257 void Dispatcher::AddIOThreadMessageFilter(
270 IPC::ChannelProxy::MessageFilter* filter) { 258 IPC::ChannelProxy::MessageFilter* filter) {
271 channel()->AddFilter(filter); 259 channel()->AddFilter(filter);
272 } 260 }
273 261
274 } // namespace proxy 262 } // namespace proxy
275 } // namespace pp 263 } // namespace pp
OLDNEW
« no previous file with comments | « ppapi/proxy/dispatcher.h ('k') | ppapi/proxy/host_dispatcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698