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

Side by Side Diff: webkit/plugins/ppapi/plugin_module.cc

Issue 7402002: Move --disable-3d-apis check into resource creation so GetInterface() doesn't crash. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 | « no previous file | webkit/plugins/ppapi/resource_creation_impl.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 "webkit/plugins/ppapi/plugin_module.h" 5 #include "webkit/plugins/ppapi/plugin_module.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/logging.h"
11 #include "base/memory/scoped_ptr.h"
10 #include "base/message_loop.h" 12 #include "base/message_loop.h"
11 #include "base/message_loop_proxy.h" 13 #include "base/message_loop_proxy.h"
12 #include "base/logging.h"
13 #include "base/memory/scoped_ptr.h"
14 #include "base/time.h" 14 #include "base/time.h"
15 #include "ppapi/c/dev/ppb_buffer_dev.h" 15 #include "ppapi/c/dev/ppb_buffer_dev.h"
16 #include "ppapi/c/dev/ppb_char_set_dev.h" 16 #include "ppapi/c/dev/ppb_char_set_dev.h"
17 #include "ppapi/c/dev/ppb_console_dev.h"
17 #include "ppapi/c/dev/ppb_context_3d_dev.h" 18 #include "ppapi/c/dev/ppb_context_3d_dev.h"
18 #include "ppapi/c/dev/ppb_context_3d_trusted_dev.h" 19 #include "ppapi/c/dev/ppb_context_3d_trusted_dev.h"
19 #include "ppapi/c/dev/ppb_console_dev.h"
20 #include "ppapi/c/dev/ppb_crypto_dev.h" 20 #include "ppapi/c/dev/ppb_crypto_dev.h"
21 #include "ppapi/c/dev/ppb_cursor_control_dev.h" 21 #include "ppapi/c/dev/ppb_cursor_control_dev.h"
22 #include "ppapi/c/dev/ppb_directory_reader_dev.h" 22 #include "ppapi/c/dev/ppb_directory_reader_dev.h"
23 #include "ppapi/c/dev/ppb_file_chooser_dev.h" 23 #include "ppapi/c/dev/ppb_file_chooser_dev.h"
24 #include "ppapi/c/dev/ppb_find_dev.h" 24 #include "ppapi/c/dev/ppb_find_dev.h"
25 #include "ppapi/c/dev/ppb_font_dev.h" 25 #include "ppapi/c/dev/ppb_font_dev.h"
26 #include "ppapi/c/dev/ppb_fullscreen_dev.h" 26 #include "ppapi/c/dev/ppb_fullscreen_dev.h"
27 #include "ppapi/c/dev/ppb_gles_chromium_texture_mapping_dev.h" 27 #include "ppapi/c/dev/ppb_gles_chromium_texture_mapping_dev.h"
28 #include "ppapi/c/dev/ppb_graphics_3d_dev.h" 28 #include "ppapi/c/dev/ppb_graphics_3d_dev.h"
29 #include "ppapi/c/dev/ppb_layer_compositor_dev.h" 29 #include "ppapi/c/dev/ppb_layer_compositor_dev.h"
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 #include "webkit/plugins/ppapi/ppb_proxy_impl.h" 98 #include "webkit/plugins/ppapi/ppb_proxy_impl.h"
99 #include "webkit/plugins/ppapi/ppb_scrollbar_impl.h" 99 #include "webkit/plugins/ppapi/ppb_scrollbar_impl.h"
100 #include "webkit/plugins/ppapi/ppb_uma_private_impl.h" 100 #include "webkit/plugins/ppapi/ppb_uma_private_impl.h"
101 #include "webkit/plugins/ppapi/ppb_url_util_impl.h" 101 #include "webkit/plugins/ppapi/ppb_url_util_impl.h"
102 #include "webkit/plugins/ppapi/ppb_video_decoder_impl.h" 102 #include "webkit/plugins/ppapi/ppb_video_decoder_impl.h"
103 #include "webkit/plugins/ppapi/ppb_video_layer_impl.h" 103 #include "webkit/plugins/ppapi/ppb_video_layer_impl.h"
104 #include "webkit/plugins/ppapi/resource_tracker.h" 104 #include "webkit/plugins/ppapi/resource_tracker.h"
105 #include "webkit/plugins/ppapi/var.h" 105 #include "webkit/plugins/ppapi/var.h"
106 #include "webkit/plugins/ppapi/webkit_forwarding_impl.h" 106 #include "webkit/plugins/ppapi/webkit_forwarding_impl.h"
107 107
108 using ppapi::TimeTicksToPPTimeTicks;
109 using ppapi::TimeToPPTime;
108 using ppapi::thunk::EnterResource; 110 using ppapi::thunk::EnterResource;
109 using ppapi::thunk::PPB_Graphics2D_API; 111 using ppapi::thunk::PPB_Graphics2D_API;
110 using ppapi::TimeTicksToPPTimeTicks;
111 using ppapi::TimeToPPTime;
112 112
113 namespace webkit { 113 namespace webkit {
114 namespace ppapi { 114 namespace ppapi {
115 115
116 namespace { 116 namespace {
117 117
118 // Maintains all currently loaded plugin libs for validating PP_Module 118 // Maintains all currently loaded plugin libs for validating PP_Module
119 // identifiers. 119 // identifiers.
120 typedef std::set<PluginModule*> PluginModuleSet; 120 typedef std::set<PluginModule*> PluginModuleSet;
121 121
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 if (strcmp(name, PPB_VIDEOLAYER_DEV_INTERFACE) == 0) 329 if (strcmp(name, PPB_VIDEOLAYER_DEV_INTERFACE) == 0)
330 return ::ppapi::thunk::GetPPB_VideoLayer_Thunk(); 330 return ::ppapi::thunk::GetPPB_VideoLayer_Thunk();
331 if (strcmp(name, PPB_WHEEL_INPUT_EVENT_INTERFACE) == 0) 331 if (strcmp(name, PPB_WHEEL_INPUT_EVENT_INTERFACE) == 0)
332 return ::ppapi::thunk::GetPPB_WheelInputEvent_Thunk(); 332 return ::ppapi::thunk::GetPPB_WheelInputEvent_Thunk();
333 if (strcmp(name, PPB_WIDGET_DEV_INTERFACE) == 0) 333 if (strcmp(name, PPB_WIDGET_DEV_INTERFACE) == 0)
334 return ::ppapi::thunk::GetPPB_Widget_Thunk(); 334 return ::ppapi::thunk::GetPPB_Widget_Thunk();
335 if (strcmp(name, PPB_ZOOM_DEV_INTERFACE) == 0) 335 if (strcmp(name, PPB_ZOOM_DEV_INTERFACE) == 0)
336 return ::ppapi::thunk::GetPPB_Zoom_Thunk(); 336 return ::ppapi::thunk::GetPPB_Zoom_Thunk();
337 337
338 #ifdef ENABLE_GPU 338 #ifdef ENABLE_GPU
339 // This should really refer to switches::kDisable3DAPIs. 339 if (strcmp(name, PPB_GRAPHICS_3D_DEV_INTERFACE) == 0)
340 if (!CommandLine::ForCurrentProcess()->HasSwitch("disable-3d-apis")) { 340 return ::ppapi::thunk::GetPPB_Graphics3D_Thunk();
341 if (strcmp(name, PPB_GRAPHICS_3D_DEV_INTERFACE) == 0) 341 if (strcmp(name, PPB_CONTEXT_3D_DEV_INTERFACE) == 0)
342 return ::ppapi::thunk::GetPPB_Graphics3D_Thunk(); 342 return ::ppapi::thunk::GetPPB_Context3D_Thunk();
343 if (strcmp(name, PPB_CONTEXT_3D_DEV_INTERFACE) == 0) 343 if (strcmp(name, PPB_CONTEXT_3D_TRUSTED_DEV_INTERFACE) == 0)
344 return ::ppapi::thunk::GetPPB_Context3D_Thunk(); 344 return ::ppapi::thunk::GetPPB_Context3DTrusted_Thunk();
345 if (strcmp(name, PPB_CONTEXT_3D_TRUSTED_DEV_INTERFACE) == 0) 345 if (strcmp(name, PPB_GLES_CHROMIUM_TEXTURE_MAPPING_DEV_INTERFACE) == 0)
346 return ::ppapi::thunk::GetPPB_Context3DTrusted_Thunk(); 346 return ::ppapi::thunk::GetPPB_GLESChromiumTextureMapping_Thunk();
347 if (strcmp(name, PPB_GLES_CHROMIUM_TEXTURE_MAPPING_DEV_INTERFACE) == 0) 347 if (strcmp(name, PPB_OPENGLES2_DEV_INTERFACE) == 0)
348 return ::ppapi::thunk::GetPPB_GLESChromiumTextureMapping_Thunk(); 348 return PPB_OpenGLES_Impl::GetInterface();
349 if (strcmp(name, PPB_OPENGLES2_DEV_INTERFACE) == 0) 349 if (strcmp(name, PPB_SURFACE_3D_DEV_INTERFACE) == 0)
350 return PPB_OpenGLES_Impl::GetInterface(); 350 return ::ppapi::thunk::GetPPB_Surface3D_Thunk();
351 if (strcmp(name, PPB_SURFACE_3D_DEV_INTERFACE) == 0) 351 if (strcmp(name, PPB_LAYER_COMPOSITOR_DEV_INTERFACE) == 0)
352 return ::ppapi::thunk::GetPPB_Surface3D_Thunk(); 352 return ::ppapi::thunk::GetPPB_LayerCompositor_Thunk();
353 if (strcmp(name, PPB_LAYER_COMPOSITOR_DEV_INTERFACE) == 0)
354 return ::ppapi::thunk::GetPPB_LayerCompositor_Thunk();
355 }
356 #endif // ENABLE_GPU 353 #endif // ENABLE_GPU
357 354
358 #ifdef ENABLE_FLAPPER_HACKS 355 #ifdef ENABLE_FLAPPER_HACKS
359 if (strcmp(name, PPB_FLASH_NETCONNECTOR_INTERFACE) == 0) 356 if (strcmp(name, PPB_FLASH_NETCONNECTOR_INTERFACE) == 0)
360 return ::ppapi::thunk::GetPPB_Flash_NetConnector_Thunk(); 357 return ::ppapi::thunk::GetPPB_Flash_NetConnector_Thunk();
361 #endif // ENABLE_FLAPPER_HACKS 358 #endif // ENABLE_FLAPPER_HACKS
362 359
363 #if defined(ENABLE_P2P_APIS) 360 #if defined(ENABLE_P2P_APIS)
364 if (strcmp(name, PPB_TRANSPORT_DEV_INTERFACE) == 0) 361 if (strcmp(name, PPB_TRANSPORT_DEV_INTERFACE) == 0)
365 return ::ppapi::thunk::GetPPB_Transport_Thunk(); 362 return ::ppapi::thunk::GetPPB_Transport_Thunk();
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
641 int retval = entry_points.initialize_module(pp_module(), &GetInterface); 638 int retval = entry_points.initialize_module(pp_module(), &GetInterface);
642 if (retval != 0) { 639 if (retval != 0) {
643 LOG(WARNING) << "PPP_InitializeModule returned failure " << retval; 640 LOG(WARNING) << "PPP_InitializeModule returned failure " << retval;
644 return false; 641 return false;
645 } 642 }
646 return true; 643 return true;
647 } 644 }
648 645
649 } // namespace ppapi 646 } // namespace ppapi
650 } // namespace webkit 647 } // namespace webkit
OLDNEW
« no previous file with comments | « no previous file | webkit/plugins/ppapi/resource_creation_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698