b=517729; rename more canvas3d prefs to webgl; r=mwsteele
authorVladimir Vukicevic <vladimir@pobox.com>
Sun, 20 Sep 2009 12:05:23 -0700
changeset 32891 4c431bb5e64b98ff7186fe650144cdceb3d12bc4
parent 32890 cba68dfbceba61ca37cd6a423fa62a36840df05a
child 32892 f9b8b71645d9bf57c63628a0465dd05b6af1c8af
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmwsteele
bugs517729
milestone1.9.3a1pre
b=517729; rename more canvas3d prefs to webgl; r=mwsteele
content/canvas/src/WebGLContext.cpp
content/canvas/src/nsGLPbufferOSMesa.cpp
modules/libpref/src/init/all.js
--- a/content/canvas/src/WebGLContext.cpp
+++ b/content/canvas/src/WebGLContext.cpp
@@ -77,17 +77,17 @@ WebGLContext::SetCanvasElement(nsICanvas
     // Let's find our prefs
     //
     nsCOMPtr<nsIPrefService> prefService = do_GetService(NS_PREFSERVICE_CONTRACTID, &rv);
     NS_ENSURE_SUCCESS(rv, rv);
 
     PRBool forceSoftware = PR_FALSE;
 
     nsCOMPtr<nsIPrefBranch> prefBranch;
-    rv = prefService->GetBranch("layout.canvas3d.", getter_AddRefs(prefBranch));
+    rv = prefService->GetBranch("webgl.", getter_AddRefs(prefBranch));
     if (NS_SUCCEEDED(rv)) {
         PRBool val;
 
         rv = prefBranch->GetBoolPref("software_render", &val);
         if (NS_SUCCEEDED(rv))
             forceSoftware = val;
     }
 
--- a/content/canvas/src/nsGLPbufferOSMesa.cpp
+++ b/content/canvas/src/nsGLPbufferOSMesa.cpp
@@ -75,22 +75,24 @@ nsGLPbufferOSMESA::Init(WebGLContext *pr
 {
     mPriv = priv;
     nsresult rv;
 
     nsCOMPtr<nsIPrefService> prefService = do_GetService(NS_PREFSERVICE_CONTRACTID, &rv);
     NS_ENSURE_SUCCESS(rv, PR_FALSE);
 
     nsCOMPtr<nsIPrefBranch> prefBranch;
-    rv = prefService->GetBranch("extensions.canvas3d.", getter_AddRefs(prefBranch));
+    rv = prefService->GetBranch("webgl.", getter_AddRefs(prefBranch));
     NS_ENSURE_SUCCESS(rv, PR_FALSE);
 
     nsCString osmesalib;
 
     rv = prefBranch->GetCharPref("osmesalib", getter_Copies(osmesalib));
+
+#if 0
     if (NS_FAILED(rv)) {
         osmesalib.Truncate();
 
         // try our default; build it from the profile dir
         nsCOMPtr<nsIFile> libfile;
         rv = NS_GetSpecialDirectory(NS_APP_USER_PROFILE_50_DIR, getter_AddRefs(libfile));
         if (NS_FAILED(rv)) {
             fprintf (stderr, "NS_GetSpecialDirectory failed?\n");
@@ -129,19 +131,22 @@ nsGLPbufferOSMESA::Init(WebGLContext *pr
 
         // I'm told by the comments in nsIFile that I'm not supposed to do this.  Noted.
         rv = libfile->GetNativeTarget(osmesalib);
         if (NS_FAILED(rv)) {
             LogMessage("Canvas 3D: Couldn't find OSMesa lib");
             return PR_FALSE;
         }
     }
-
-    if (!gMesaWrap.OpenLibrary(osmesalib.get())) {
-        LogMessage("Canvas 3D: Couldn't open OSMesa lib -- either default or extension.canvas3d.osmesalib path is incorrect, or not a valid shared library");
+#endif
+    if (NS_FAILED(rv) ||
+        osmesalib.Length() == 0 ||
+        !gMesaWrap.OpenLibrary(osmesalib.get()))
+    {
+        LogMessage("Canvas 3D: Couldn't open OSMesa lib -- webgl.osmesalib path is incorrect, or not a valid shared library");
         return PR_FALSE;
     }
 
     if (!gMesaWrap.Init())
         return PR_FALSE;
 
     PRInt32 prefAntialiasing;
     rv = prefBranch->GetIntPref("antialiasing", &prefAntialiasing);
--- a/modules/libpref/src/init/all.js
+++ b/modules/libpref/src/init/all.js
@@ -2756,18 +2756,20 @@ pref("toolkit.zoomManager.zoomValues", "
 pref("image.cache.size", 5242880);
 // A weight, from 0-1000, to place on time when comparing to size.
 // Size is given a weight of 1000 - timeweight.
 pref("image.cache.timeweight", 500);
 
 // The default Accept header sent for images loaded over HTTP(S)
 pref("image.http.accept", "image/png,image/*;q=0.8,*/*;q=0.5");
 
-// WebGL global enable flag
+// WebGL prefs
 pref("webgl.enabled_for_all_sites", false);
+pref("webgl.software_render", false);
+pref("webgl.osmesalib", "");
 
 #ifdef XP_WIN
 #ifndef WINCE
 // The default TCP send window on Windows is too small, and autotuning only occurs on receive
 pref("network.tcp.sendbuffer", 131072);
 #endif
 #endif