Index: content/renderer/pepper/ppb_graphics_3d_impl.cc |
diff --git a/content/renderer/pepper/ppb_graphics_3d_impl.cc b/content/renderer/pepper/ppb_graphics_3d_impl.cc |
index 4f138f37dccbb395d75d724e277e885e3c7a298f..f143968c34d229f765915e5110f7ab80b6c3b188 100644 |
--- a/content/renderer/pepper/ppb_graphics_3d_impl.cc |
+++ b/content/renderer/pepper/ppb_graphics_3d_impl.cc |
@@ -69,20 +69,10 @@ PPB_Graphics3D_Impl::~PPB_Graphics3D_Impl() { |
} |
// static |
-PP_Bool PPB_Graphics3D_Impl::IsGpuBlacklisted() { |
- CommandLine* command_line = CommandLine::ForCurrentProcess(); |
- if (command_line) |
- return PP_FromBool(command_line->HasSwitch(switches::kDisablePepper3d)); |
- return PP_TRUE; |
-} |
- |
-// static |
PP_Resource PPB_Graphics3D_Impl::Create(PP_Instance instance, |
PP_Resource share_context, |
const int32_t* attrib_list) { |
PPB_Graphics3D_API* share_api = NULL; |
- if (IsGpuBlacklisted()) |
- return 0; |
if (share_context) { |
EnterResourceNoLock<PPB_Graphics3D_API> enter(share_context, true); |
if (enter.failed()) |
@@ -101,8 +91,6 @@ PP_Resource PPB_Graphics3D_Impl::CreateRaw(PP_Instance instance, |
PP_Resource share_context, |
const int32_t* attrib_list) { |
PPB_Graphics3D_API* share_api = NULL; |
- if (IsGpuBlacklisted()) |
- return 0; |
if (share_context) { |
EnterResourceNoLock<PPB_Graphics3D_API> enter(share_context, true); |
if (enter.failed()) |
@@ -243,18 +231,14 @@ bool PPB_Graphics3D_Impl::InitRaw(PPB_Graphics3D_API* share_context, |
if (!plugin_instance) |
return false; |
- PlatformContext3D* share_platform_context = NULL; |
- if (share_context) { |
- PPB_Graphics3D_Impl* share_graphics = |
- static_cast<PPB_Graphics3D_Impl*>(share_context); |
- share_platform_context = share_graphics->platform_context(); |
- } |
- |
+ const WebPreferences& prefs = static_cast<RenderViewImpl*>(plugin_instance-> |
+ GetRenderView())->webkit_preferences(); |
+ // 3D access might be disabled or blacklisted. |
+ if (!prefs.pepper_3d_enabled) |
+ return false; |
// If accelerated compositing of plugins is disabled, fail to create a 3D |
// context, because it won't be visible. This allows graceful fallback in the |
// modules. |
- const WebPreferences& prefs = static_cast<RenderViewImpl*>(plugin_instance-> |
- GetRenderView())->webkit_preferences(); |
if (!prefs.accelerated_compositing_for_plugins_enabled) |
return false; |
@@ -262,6 +246,13 @@ bool PPB_Graphics3D_Impl::InitRaw(PPB_Graphics3D_API* share_context, |
if (!platform_context_) |
return false; |
+ PlatformContext3D* share_platform_context = NULL; |
+ if (share_context) { |
+ PPB_Graphics3D_Impl* share_graphics = |
+ static_cast<PPB_Graphics3D_Impl*>(share_context); |
+ share_platform_context = share_graphics->platform_context(); |
+ } |
+ |
if (!platform_context_->Init(attrib_list, share_platform_context)) |
return false; |