b=598328; clean up nv console spam; r=joe, a=b
authorVladimir Vukicevic <vladimir@pobox.com>
Tue, 16 Nov 2010 20:33:04 -0800
changeset 57641 69844c0f4fd1401982a3fe60ee47395c4eb89ea8
parent 57640 56876e7bd59006ba7a2d0a50ce608cf470b898aa
child 57642 ce47d24af7931a7eed4071e0deba10ad84c3e37c
push id1
push usershaver@mozilla.com
push dateTue, 04 Jan 2011 17:58:04 +0000
reviewersjoe, b
bugs598328
milestone2.0b8pre
b=598328; clean up nv console spam; r=joe, a=b
gfx/layers/d3d9/Nv3DVUtils.cpp
--- a/gfx/layers/d3d9/Nv3DVUtils.cpp
+++ b/gfx/layers/d3d9/Nv3DVUtils.cpp
@@ -64,68 +64,42 @@ Nv3DVUtils::~Nv3DVUtils()
 }
 
 /**
  * Initializes the Nv3DVUtils object.
  */
 void
 Nv3DVUtils::Initialize()
 {
-  nsCOMPtr<nsIConsoleService>
-  consoleCustom(do_GetService(NS_CONSOLESERVICE_CONTRACTID));
-
   /*
    * Detect if 3D Streaming object is already loaded. Do nothing in that case.
    */
   if (m3DVStreaming) {
     NS_WARNING("Nv3DVStreaming COM object already instantiated.\n");
     return;
   }
 
   /*
    * Create the COM object. If we fail at any stage, just return
    */
   HRESULT hr = CoCreateInstance(CLSID_NV3DVStreaming, NULL, CLSCTX_INPROC_SERVER, IID_INV3DVStreaming, (void**)(getter_AddRefs(m3DVStreaming)));
   if (FAILED(hr) || !m3DVStreaming) {
-    if (consoleCustom) {
-      nsString msg;
-      msg += NS_LITERAL_STRING("CoCreateInstance() FAILED.\n");
-      consoleCustom->LogStringMessage(msg.get());
-    }
+    NS_WARNING("Nv3DVStreaming CoCreateInstance failed (disabled).");
     return;
   }
 
-  if (consoleCustom) {
-    nsString msg;
-    msg += NS_LITERAL_STRING("Nv3DVStreaming COM object instantiated successfully.\n");
-    consoleCustom->LogStringMessage(msg.get());
-  }
-
   /*
    * Initialize the object. Note that m3DVStreaming cannot be NULL at this point.
    */
   bool bRetVal = m3DVStreaming->Nv3DVInitialize();
 
   if (!bRetVal) {
-    if (consoleCustom) {
-      nsString msg;
-      msg += NS_LITERAL_STRING("Nv3DVInitialize() FAILED!\n");
-      consoleCustom->LogStringMessage(msg.get());
-    }
+    NS_WARNING("Nv3DVStreaming Nv3DVInitialize failed!");
     return;
   }
-
-  /*
-   * Nv3DVUtils::Initialize() was successful
-   */
-  if (consoleCustom) {
-    nsString msg;
-    msg += NS_LITERAL_STRING("Nv3DVUtils::Initialize SUCCEEDED!\n");
-    consoleCustom->LogStringMessage(msg.get());
-  }
 }
 
 /**
  * Release resources used by the COM Object, and then release 
  * the COM Object (nsRefPtr gets released by setting to NULL) 
  *
  */
 void
@@ -138,100 +112,58 @@ Nv3DVUtils::UnInitialize()
 
 /**
  * Sets the device info, along with any other initialization that is needed after device creation
  * Pass the D3D9 device pointer is an IUnknown input argument.
  */
 void 
 Nv3DVUtils::SetDeviceInfo(IUnknown *devUnknown)
 {
-  nsCOMPtr<nsIConsoleService>
-  consoleCustom(do_GetService(NS_CONSOLESERVICE_CONTRACTID));
-
   if (!devUnknown) {
     NS_WARNING("D3D Device Pointer (IUnknown) is NULL.\n");
     return;
   }
 
-  if (m3DVStreaming) {
-    bool rv = false;
-    rv = m3DVStreaming->Nv3DVSetDevice(devUnknown);
-    if (!rv) {
-      if (consoleCustom) {
-        nsString msg;
-        msg += NS_LITERAL_STRING("Nv3DVSetDevice() FAILED!\n");
-        consoleCustom->LogStringMessage(msg.get());
-      }
+  if (!m3DVStreaming) {
       return;
-    }
+  }
 
-    rv = m3DVStreaming->Nv3DVControl(STEREO_MODE_RIGHT_LEFT, true, FIREFOX_3DV_APP_HANDLE);
-    if (!rv) {
-      if (consoleCustom) {
-        nsString msg;
-        msg += NS_LITERAL_STRING("Nv3DVControl() FAILED!\n");
-        consoleCustom->LogStringMessage(msg.get());
-      }
-      return;
-    }
+  bool rv = false;
+  rv = m3DVStreaming->Nv3DVSetDevice(devUnknown);
+  NS_ASSERTION(rv, "Nv3DVStreaming Nv3DVControl failed!");
 
-    if (consoleCustom) {
-      nsString msg;
-      msg += NS_LITERAL_STRING("Nv3DVSetDevice() and Nv3DVControl() both SUCCEEDED!\n");
-      consoleCustom->LogStringMessage(msg.get());
-    }
+  if (!rv)
+      return;
 
-  } // m3DVStreaming
-
-  return;
+  rv = m3DVStreaming->Nv3DVControl(STEREO_MODE_RIGHT_LEFT, true, FIREFOX_3DV_APP_HANDLE);
+  NS_ASSERTION(rv, "Nv3DVStreaming Nv3DVControl failed!");
 }
 
 /*
  * Send Stereo Control Information. Used mainly to re-route 
  * calls from ImageLayerD3D9 to the 3DV COM object
  */
 void 
 Nv3DVUtils::SendNv3DVControl(Stereo_Mode eStereoMode, bool bEnableStereo, DWORD dw3DVAppHandle)
 {
-  nsCOMPtr<nsIConsoleService>
-    consoleCustom(do_GetService(NS_CONSOLESERVICE_CONTRACTID));
+  if (!m3DVStreaming)
+      return;
 
-  if (m3DVStreaming) {
-    bool rv = m3DVStreaming->Nv3DVControl(eStereoMode, bEnableStereo, dw3DVAppHandle);
-    if (consoleCustom) {
-      nsString msg;
-      if (rv) {
-        msg += NS_LITERAL_STRING("Nv3DVControl() SUCCEEDED!\n");
-      } else {
-        msg += NS_LITERAL_STRING("Nv3DVControl()FAILED!\n");
-      }
-      consoleCustom->LogStringMessage(msg.get());
-    }
-  } // m3DVStreaming
-
+  bool rv = m3DVStreaming->Nv3DVControl(eStereoMode, bEnableStereo, dw3DVAppHandle);
+  NS_ASSERTION(rv, "Nv3DVStreaming Nv3DVControl failed");
 }
 
 /*
  * Send Stereo Metadata. Used mainly to re-route calls 
  * from ImageLayerD3D9 to the 3DV COM object
  */
 void 
 Nv3DVUtils::SendNv3DVMetaData(unsigned int dwWidth, unsigned int dwHeight, HANDLE hSrcLuma, HANDLE hDst)
 {
-  nsCOMPtr<nsIConsoleService>
-    consoleCustom(do_GetService(NS_CONSOLESERVICE_CONTRACTID));
+  if (!m3DVStreaming)
+      return;
 
-  if (m3DVStreaming) {
-    bool rv = m3DVStreaming->Nv3DVMetaData((DWORD)dwWidth, (DWORD)dwHeight, hSrcLuma, hDst);
-    if (consoleCustom) {
-      nsString msg;
-      if (rv) {
-        msg += NS_LITERAL_STRING("Nv3DVMetaData() SUCCEEDED!\n");
-      } else {
-        msg += NS_LITERAL_STRING("Nv3DVMetaData() FAILED!\n");
-      }
-      consoleCustom->LogStringMessage(msg.get());
-    }
-  } // m3DVStreaming
+  bool rv = m3DVStreaming->Nv3DVMetaData((DWORD)dwWidth, (DWORD)dwHeight, hSrcLuma, hDst);
+  NS_ASSERTION(rv, "Nv3DVStreaming Nv3DVMetaData failed!");
 }
 
 } /* namespace layers */
 } /* namespace mozilla */