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

Unified Diff: content/renderer/pepper/ppb_graphics_3d_impl.cc

Issue 126993002: Switch from CommandLine switch to WebPreferences to control Pepper 3D. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix a bug jamesr pointed out Created 6 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/renderer/pepper/ppb_graphics_3d_impl.h ('k') | webkit/common/webpreferences.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « content/renderer/pepper/ppb_graphics_3d_impl.h ('k') | webkit/common/webpreferences.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698