| OLD | NEW |
| 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 #include "ppapi/proxy/interface_list.h" | 5 #include "ppapi/proxy/interface_list.h" |
| 6 | 6 |
| 7 #include "base/memory/singleton.h" | 7 #include "base/memory/singleton.h" |
| 8 #include "ppapi/c/dev/ppb_audio_input_dev.h" | 8 #include "ppapi/c/dev/ppb_audio_input_dev.h" |
| 9 #include "ppapi/c/dev/ppb_buffer_dev.h" | 9 #include "ppapi/c/dev/ppb_buffer_dev.h" |
| 10 #include "ppapi/c/dev/ppb_char_set_dev.h" | 10 #include "ppapi/c/dev/ppb_char_set_dev.h" |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 #define PROXIED_API(api_name) \ | 164 #define PROXIED_API(api_name) \ |
| 165 AddProxy(PROXY_API_ID(api_name), &PROXY_FACTORY_NAME(api_name)); | 165 AddProxy(PROXY_API_ID(api_name), &PROXY_FACTORY_NAME(api_name)); |
| 166 | 166 |
| 167 // Register each proxied interface by calling AddPPB for each supported | 167 // Register each proxied interface by calling AddPPB for each supported |
| 168 // interface. | 168 // interface. |
| 169 #define PROXIED_IFACE(api_name, iface_str, iface_struct) \ | 169 #define PROXIED_IFACE(api_name, iface_str, iface_struct) \ |
| 170 AddPPB(iface_str, PROXY_API_ID(api_name), \ | 170 AddPPB(iface_str, PROXY_API_ID(api_name), \ |
| 171 INTERFACE_THUNK_NAME(iface_struct)()); | 171 INTERFACE_THUNK_NAME(iface_struct)()); |
| 172 | 172 |
| 173 #include "ppapi/thunk/interfaces_ppb_public_stable.h" | 173 #include "ppapi/thunk/interfaces_ppb_public_stable.h" |
| 174 #if !defined(OS_NACL) |
| 174 #include "ppapi/thunk/interfaces_ppb_public_dev.h" | 175 #include "ppapi/thunk/interfaces_ppb_public_dev.h" |
| 175 #include "ppapi/thunk/interfaces_ppb_private.h" | 176 #include "ppapi/thunk/interfaces_ppb_private.h" |
| 177 #endif |
| 176 | 178 |
| 177 #undef PROXIED_API | 179 #undef PROXIED_API |
| 178 #undef PROXIED_IFACE | 180 #undef PROXIED_IFACE |
| 179 | 181 |
| 180 // Manually add some special proxies. Some of these don't have interfaces | 182 // Manually add some special proxies. Some of these don't have interfaces |
| 181 // that they support, so aren't covered by the macros above, but have proxies | 183 // that they support, so aren't covered by the macros above, but have proxies |
| 182 // for message routing. Others have different implementations between the | 184 // for message routing. Others have different implementations between the |
| 183 // proxy and the impl and there's no obvious message routing. | 185 // proxy and the impl and there's no obvious message routing. |
| 184 AddProxy(API_ID_RESOURCE_CREATION, &ResourceCreationProxy::Create); | 186 AddProxy(API_ID_RESOURCE_CREATION, &ResourceCreationProxy::Create); |
| 185 AddProxy(API_ID_PPP_CLASS, &PPP_Class_Proxy::Create); | 187 AddProxy(API_ID_PPP_CLASS, &PPP_Class_Proxy::Create); |
| 186 AddPPB(PPB_CORE_INTERFACE_1_0, API_ID_PPB_CORE, | 188 AddPPB(PPB_CORE_INTERFACE_1_0, API_ID_PPB_CORE, |
| 187 PPB_Core_Proxy::GetPPB_Core_Interface()); | 189 PPB_Core_Proxy::GetPPB_Core_Interface()); |
| 188 AddPPB(PPB_MESSAGELOOP_DEV_INTERFACE_0_1, API_ID_NONE, | 190 AddPPB(PPB_MESSAGELOOP_DEV_INTERFACE_0_1, API_ID_NONE, |
| 189 PPB_MessageLoop_Proxy::GetInterface()); | 191 PPB_MessageLoop_Proxy::GetInterface()); |
| 192 #if !defined(OS_NACL) |
| 190 AddPPB(PPB_OPENGLES2_INTERFACE_1_0, API_ID_NONE, | 193 AddPPB(PPB_OPENGLES2_INTERFACE_1_0, API_ID_NONE, |
| 191 PPB_OpenGLES2_Shared::GetInterface()); | 194 PPB_OpenGLES2_Shared::GetInterface()); |
| 192 AddPPB(PPB_OPENGLES2_INSTANCEDARRAYS_DEV_INTERFACE_1_0, API_ID_NONE, | 195 AddPPB(PPB_OPENGLES2_INSTANCEDARRAYS_DEV_INTERFACE_1_0, API_ID_NONE, |
| 193 PPB_OpenGLES2_Shared::GetInstancedArraysInterface()); | 196 PPB_OpenGLES2_Shared::GetInstancedArraysInterface()); |
| 194 AddPPB(PPB_OPENGLES2_FRAMEBUFFERBLIT_DEV_INTERFACE_1_0, API_ID_NONE, | 197 AddPPB(PPB_OPENGLES2_FRAMEBUFFERBLIT_DEV_INTERFACE_1_0, API_ID_NONE, |
| 195 PPB_OpenGLES2_Shared::GetFramebufferBlitInterface()); | 198 PPB_OpenGLES2_Shared::GetFramebufferBlitInterface()); |
| 196 AddPPB(PPB_OPENGLES2_FRAMEBUFFERMULTISAMPLE_DEV_INTERFACE_1_0, API_ID_NONE, | 199 AddPPB(PPB_OPENGLES2_FRAMEBUFFERMULTISAMPLE_DEV_INTERFACE_1_0, API_ID_NONE, |
| 197 PPB_OpenGLES2_Shared::GetFramebufferMultisampleInterface()); | 200 PPB_OpenGLES2_Shared::GetFramebufferMultisampleInterface()); |
| 198 AddPPB(PPB_OPENGLES2_CHROMIUMENABLEFEATURE_DEV_INTERFACE_1_0, API_ID_NONE, | 201 AddPPB(PPB_OPENGLES2_CHROMIUMENABLEFEATURE_DEV_INTERFACE_1_0, API_ID_NONE, |
| 199 PPB_OpenGLES2_Shared::GetChromiumEnableFeatureInterface()); | 202 PPB_OpenGLES2_Shared::GetChromiumEnableFeatureInterface()); |
| 200 AddPPB(PPB_OPENGLES2_CHROMIUMMAPSUB_DEV_INTERFACE_1_0, API_ID_NONE, | 203 AddPPB(PPB_OPENGLES2_CHROMIUMMAPSUB_DEV_INTERFACE_1_0, API_ID_NONE, |
| 201 PPB_OpenGLES2_Shared::GetChromiumMapSubInterface()); | 204 PPB_OpenGLES2_Shared::GetChromiumMapSubInterface()); |
| 202 AddPPB(PPB_OPENGLES2_QUERY_DEV_INTERFACE_1_0, API_ID_NONE, | 205 AddPPB(PPB_OPENGLES2_QUERY_DEV_INTERFACE_1_0, API_ID_NONE, |
| 203 PPB_OpenGLES2_Shared::GetQueryInterface()); | 206 PPB_OpenGLES2_Shared::GetQueryInterface()); |
| 207 #endif |
| 204 AddPPB(PPB_VAR_ARRAY_BUFFER_INTERFACE_1_0, API_ID_NONE, | 208 AddPPB(PPB_VAR_ARRAY_BUFFER_INTERFACE_1_0, API_ID_NONE, |
| 205 PPB_Var_Shared::GetVarArrayBufferInterface1_0()); | 209 PPB_Var_Shared::GetVarArrayBufferInterface1_0()); |
| 206 AddPPB(PPB_VAR_INTERFACE_1_1, API_ID_NONE, | 210 AddPPB(PPB_VAR_INTERFACE_1_1, API_ID_NONE, |
| 207 PPB_Var_Shared::GetVarInterface1_1()); | 211 PPB_Var_Shared::GetVarInterface1_1()); |
| 208 AddPPB(PPB_VAR_INTERFACE_1_0, API_ID_NONE, | 212 AddPPB(PPB_VAR_INTERFACE_1_0, API_ID_NONE, |
| 209 PPB_Var_Shared::GetVarInterface1_0()); | 213 PPB_Var_Shared::GetVarInterface1_0()); |
| 210 | 214 |
| 215 #if !defined(OS_NACL) |
| 211 AddFlashInterfaces(); | 216 AddFlashInterfaces(); |
| 212 | 217 |
| 213 // PPB (browser) interfaces. | 218 // PPB (browser) interfaces. |
| 214 // Do not add more stuff here, they should be added to interface_list*.h | 219 // Do not add more stuff here, they should be added to interface_list*.h |
| 215 // TODO(brettw) remove these. | 220 // TODO(brettw) remove these. |
| 216 AddPPB(PPB_Instance_Proxy::GetInfoPrivate()); | 221 AddPPB(PPB_Instance_Proxy::GetInfoPrivate()); |
| 217 AddPPB(PPB_PDF_Proxy::GetInfo()); | 222 AddPPB(PPB_PDF_Proxy::GetInfo()); |
| 218 AddPPB(PPB_Testing_Proxy::GetInfo()); | 223 AddPPB(PPB_Testing_Proxy::GetInfo()); |
| 219 AddPPB(PPB_URLLoader_Proxy::GetTrustedInfo()); | 224 AddPPB(PPB_URLLoader_Proxy::GetTrustedInfo()); |
| 220 AddPPB(PPB_Var_Deprecated_Proxy::GetInfo()); | 225 AddPPB(PPB_Var_Deprecated_Proxy::GetInfo()); |
| 226 #endif |
| 221 | 227 |
| 222 // PPP (plugin) interfaces. | 228 // PPP (plugin) interfaces. |
| 223 // TODO(brettw) move these to interface_list*.h | 229 // TODO(brettw) move these to interface_list*.h |
| 224 AddProxy(API_ID_PPP_INSTANCE, &ProxyFactory<PPP_Instance_Proxy>); | 230 AddProxy(API_ID_PPP_INSTANCE, &ProxyFactory<PPP_Instance_Proxy>); |
| 225 AddPPP(PPP_INSTANCE_INTERFACE_1_1, API_ID_PPP_INSTANCE, | 231 AddPPP(PPP_INSTANCE_INTERFACE_1_1, API_ID_PPP_INSTANCE, |
| 226 PPP_Instance_Proxy::GetInstanceInterface()); | 232 PPP_Instance_Proxy::GetInstanceInterface()); |
| 227 AddProxy(API_ID_PPP_PRINTING, &ProxyFactory<PPP_Printing_Proxy>); | 233 AddProxy(API_ID_PPP_PRINTING, &ProxyFactory<PPP_Printing_Proxy>); |
| 228 AddPPP(PPP_PRINTING_DEV_INTERFACE, API_ID_PPP_PRINTING, | 234 AddPPP(PPP_PRINTING_DEV_INTERFACE, API_ID_PPP_PRINTING, |
| 229 PPP_Printing_Proxy::GetProxyInterface()); | 235 PPP_Printing_Proxy::GetProxyInterface()); |
| 230 AddProxy(API_ID_PPP_TEXT_INPUT, &ProxyFactory<PPP_TextInput_Proxy>); | 236 AddProxy(API_ID_PPP_TEXT_INPUT, &ProxyFactory<PPP_TextInput_Proxy>); |
| 231 AddPPP(PPP_TEXTINPUT_DEV_INTERFACE, API_ID_PPP_TEXT_INPUT, | 237 AddPPP(PPP_TEXTINPUT_DEV_INTERFACE, API_ID_PPP_TEXT_INPUT, |
| 232 PPP_TextInput_Proxy::GetProxyInterface()); | 238 PPP_TextInput_Proxy::GetProxyInterface()); |
| 233 | 239 |
| 234 // Old-style GetInfo PPP interfaces. | 240 // Old-style GetInfo PPP interfaces. |
| 235 // Do not add more stuff here, they should be added to interface_list*.h | 241 // Do not add more stuff here, they should be added to interface_list*.h |
| 236 // TODO(brettw) remove these. | 242 // TODO(brettw) remove these. |
| 237 AddPPP(PPP_Graphics3D_Proxy::GetInfo()); | |
| 238 AddPPP(PPP_InputEvent_Proxy::GetInfo()); | 243 AddPPP(PPP_InputEvent_Proxy::GetInfo()); |
| 239 AddPPP(PPP_Instance_Private_Proxy::GetInfo()); | |
| 240 AddPPP(PPP_Messaging_Proxy::GetInfo()); | 244 AddPPP(PPP_Messaging_Proxy::GetInfo()); |
| 241 AddPPP(PPP_MouseLock_Proxy::GetInfo()); | 245 AddPPP(PPP_MouseLock_Proxy::GetInfo()); |
| 246 #if !defined(OS_NACL) |
| 247 AddPPP(PPP_Graphics3D_Proxy::GetInfo()); |
| 248 AddPPP(PPP_Instance_Private_Proxy::GetInfo()); |
| 242 AddPPP(PPP_VideoCapture_Proxy::GetInfo()); | 249 AddPPP(PPP_VideoCapture_Proxy::GetInfo()); |
| 243 AddPPP(PPP_VideoDecoder_Proxy::GetInfo()); | 250 AddPPP(PPP_VideoDecoder_Proxy::GetInfo()); |
| 251 #endif |
| 244 } | 252 } |
| 245 | 253 |
| 246 InterfaceList::~InterfaceList() { | 254 InterfaceList::~InterfaceList() { |
| 247 } | 255 } |
| 248 | 256 |
| 249 // static | 257 // static |
| 250 InterfaceList* InterfaceList::GetInstance() { | 258 InterfaceList* InterfaceList::GetInstance() { |
| 251 return Singleton<InterfaceList>::get(); | 259 return Singleton<InterfaceList>::get(); |
| 252 } | 260 } |
| 253 | 261 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 284 } | 292 } |
| 285 | 293 |
| 286 const void* InterfaceList::GetInterfaceForPPP(const std::string& name) const { | 294 const void* InterfaceList::GetInterfaceForPPP(const std::string& name) const { |
| 287 NameToInterfaceInfoMap::const_iterator found = | 295 NameToInterfaceInfoMap::const_iterator found = |
| 288 name_to_plugin_info_.find(name); | 296 name_to_plugin_info_.find(name); |
| 289 if (found == name_to_plugin_info_.end()) | 297 if (found == name_to_plugin_info_.end()) |
| 290 return NULL; | 298 return NULL; |
| 291 return found->second.iface; | 299 return found->second.iface; |
| 292 } | 300 } |
| 293 | 301 |
| 302 #if !defined(OS_NACL) |
| 294 void InterfaceList::AddFlashInterfaces() { | 303 void InterfaceList::AddFlashInterfaces() { |
| 295 #if !defined(OS_NACL) | |
| 296 AddProxy(API_ID_PPB_FLASH, &ProxyFactory<PPB_Flash_Proxy>); | 304 AddProxy(API_ID_PPB_FLASH, &ProxyFactory<PPB_Flash_Proxy>); |
| 297 AddPPB(PPB_FLASH_INTERFACE_11_0, API_ID_PPB_FLASH, | 305 AddPPB(PPB_FLASH_INTERFACE_11_0, API_ID_PPB_FLASH, |
| 298 PPB_Flash_Proxy::GetInterface11()); | 306 PPB_Flash_Proxy::GetInterface11()); |
| 299 AddPPB(PPB_FLASH_INTERFACE_12_0, API_ID_PPB_FLASH, | 307 AddPPB(PPB_FLASH_INTERFACE_12_0, API_ID_PPB_FLASH, |
| 300 PPB_Flash_Proxy::GetInterface12_0()); | 308 PPB_Flash_Proxy::GetInterface12_0()); |
| 301 AddPPB(PPB_FLASH_INTERFACE_12_1, API_ID_PPB_FLASH, | 309 AddPPB(PPB_FLASH_INTERFACE_12_1, API_ID_PPB_FLASH, |
| 302 PPB_Flash_Proxy::GetInterface12_1()); | 310 PPB_Flash_Proxy::GetInterface12_1()); |
| 303 AddPPB(PPB_FLASH_INTERFACE_12_2, API_ID_PPB_FLASH, | 311 AddPPB(PPB_FLASH_INTERFACE_12_2, API_ID_PPB_FLASH, |
| 304 PPB_Flash_Proxy::GetInterface12_2()); | 312 PPB_Flash_Proxy::GetInterface12_2()); |
| 305 | 313 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 328 thunk::GetPPB_Flash_Menu_0_2_Thunk()); | 336 thunk::GetPPB_Flash_Menu_0_2_Thunk()); |
| 329 | 337 |
| 330 AddProxy(API_ID_PPB_FLASH_MESSAGELOOP, | 338 AddProxy(API_ID_PPB_FLASH_MESSAGELOOP, |
| 331 &ProxyFactory<PPB_Flash_MessageLoop_Proxy>); | 339 &ProxyFactory<PPB_Flash_MessageLoop_Proxy>); |
| 332 AddPPB(PPB_FLASH_MESSAGELOOP_INTERFACE_0_1, API_ID_PPB_FLASH_MESSAGELOOP, | 340 AddPPB(PPB_FLASH_MESSAGELOOP_INTERFACE_0_1, API_ID_PPB_FLASH_MESSAGELOOP, |
| 333 thunk::GetPPB_Flash_MessageLoop_0_1_Thunk()); | 341 thunk::GetPPB_Flash_MessageLoop_0_1_Thunk()); |
| 334 | 342 |
| 335 // Only add the interface; PPB_TCPSocket_Private provides the API ID's proxy. | 343 // Only add the interface; PPB_TCPSocket_Private provides the API ID's proxy. |
| 336 AddPPB(PPB_FLASH_TCPSOCKET_INTERFACE_0_2, API_ID_PPB_TCPSOCKET_PRIVATE, | 344 AddPPB(PPB_FLASH_TCPSOCKET_INTERFACE_0_2, API_ID_PPB_TCPSOCKET_PRIVATE, |
| 337 thunk::GetPPB_TCPSocket_Private_0_3_Thunk()); | 345 thunk::GetPPB_TCPSocket_Private_0_3_Thunk()); |
| 346 } |
| 338 #endif // !defined(OS_NACL) | 347 #endif // !defined(OS_NACL) |
| 339 } | |
| 340 | 348 |
| 341 void InterfaceList::AddProxy(ApiID id, | 349 void InterfaceList::AddProxy(ApiID id, |
| 342 InterfaceProxy::Factory factory) { | 350 InterfaceProxy::Factory factory) { |
| 343 // For interfaces with no corresponding _Proxy objects, the macros will | 351 // For interfaces with no corresponding _Proxy objects, the macros will |
| 344 // generate calls to this function with API_ID_NONE. This means we | 352 // generate calls to this function with API_ID_NONE. This means we |
| 345 // should just skip adding a factory for these functions. | 353 // should just skip adding a factory for these functions. |
| 346 if (id == API_ID_NONE) | 354 if (id == API_ID_NONE) |
| 347 return; | 355 return; |
| 348 | 356 |
| 349 // The factory should be an exact dupe of the one we already have if it | 357 // The factory should be an exact dupe of the one we already have if it |
| (...skipping 23 matching lines...) Expand all Loading... |
| 373 AddPPB(info->name, info->id, info->interface_ptr); | 381 AddPPB(info->name, info->id, info->interface_ptr); |
| 374 } | 382 } |
| 375 | 383 |
| 376 void InterfaceList::AddPPP(const InterfaceProxy::Info* info) { | 384 void InterfaceList::AddPPP(const InterfaceProxy::Info* info) { |
| 377 AddProxy(info->id, info->create_proxy); | 385 AddProxy(info->id, info->create_proxy); |
| 378 AddPPP(info->name, info->id, info->interface_ptr); | 386 AddPPP(info->name, info->id, info->interface_ptr); |
| 379 } | 387 } |
| 380 | 388 |
| 381 } // namespace proxy | 389 } // namespace proxy |
| 382 } // namespace ppapi | 390 } // namespace ppapi |
| OLD | NEW |