Bug 1117304 - Add missing MOZ2D_WARN_IF definition to fix bustage. r=milan, a=bustage
authorRyan VanderMeulen <ryanvm@gmail.com>
Mon, 26 Jan 2015 17:24:46 -0500
changeset 200536 bbab000f050730dc16d4d262783a66e5bbb9021b
parent 200535 5ee3807b4bb24c5fef5d4262c05749118a98943c
child 200537 b2a513d1a08d0b19057852ede33b8f516e447c3e
push id178
push userryanvm@gmail.com
push dateMon, 26 Jan 2015 22:33:03 +0000
treeherdermozilla-esr31@891f9e72b4c2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmilan, bustage
bugs1117304
milestone31.4.0
Bug 1117304 - Add missing MOZ2D_WARN_IF definition to fix bustage. r=milan, a=bustage
gfx/2d/FilterNodeSoftware.cpp
gfx/2d/Logging.h
--- a/gfx/2d/FilterNodeSoftware.cpp
+++ b/gfx/2d/FilterNodeSoftware.cpp
@@ -7,16 +7,17 @@
 
 #include <cmath>
 #include "FilterNodeSoftware.h"
 #include "2D.h"
 #include "Tools.h"
 #include "Blur.h"
 #include <map>
 #include "FilterProcessing.h"
+#include "Logging.h"
 #include "mozilla/PodOperations.h"
 #include "mozilla/DebugOnly.h"
 
 // #define DEBUG_DUMP_SURFACES
 
 #ifdef DEBUG_DUMP_SURFACES
 #include "gfxImageSurface.h"
 namespace mozilla {
--- a/gfx/2d/Logging.h
+++ b/gfx/2d/Logging.h
@@ -150,16 +150,35 @@ typedef Log<LOG_WARNING> WarningLog;
 #define gfxDebug if (1) ; else NoLog
 #endif
 #ifdef GFX_LOG_WARNING
 #define gfxWarning WarningLog
 #else
 #define gfxWarning if (1) ; else NoLog
 #endif
 
+// See nsDebug.h and the NS_WARN_IF macro
+
+#ifdef __cplusplus
+#ifdef DEBUG
+inline bool MOZ2D_warn_if_impl(bool aCondition, const char* aExpr,
+                               const char* aFile, int32_t aLine)
+{
+  if (MOZ_UNLIKELY(aCondition)) {
+    gfxWarning() << aExpr << " at " << aFile << ":" << aLine;
+  }
+  return aCondition;
+}
+#define MOZ2D_WARN_IF(condition) \
+  MOZ2D_warn_if_impl(condition, #condition, __FILE__, __LINE__)
+#else
+#define MOZ2D_WARN_IF(condition) (bool)(condition)
+#endif
+#endif
+
 const int INDENT_PER_LEVEL = 2;
 
 class TreeLog
 {
 public:
   TreeLog(const std::string& aPrefix = "")
         : mLog(LogOptions::NoNewline),
           mPrefix(aPrefix),