From c91087708686ae1c47abee65e19536688e5ec8f2 Mon Sep 17 00:00:00 2001
From: Ryan VanderMeulen <ryanvm@gmail.com>
Date: Mon, 26 Jan 2015 17:24:46 -0500
Subject: [PATCH] Bug 1117304 - Add missing MOZ2D_WARN_IF definition to fix
 bustage. r=milan, a=bustage

---
 gfx/2d/FilterNodeSoftware.cpp |  1 +
 gfx/2d/Logging.h              | 19 +++++++++++++++++++
 2 files changed, 20 insertions(+)

diff --git a/gfx/2d/FilterNodeSoftware.cpp b/gfx/2d/FilterNodeSoftware.cpp
index 10d92c6..48bf162 100644
--- a/gfx/2d/FilterNodeSoftware.cpp
+++ b/gfx/2d/FilterNodeSoftware.cpp
@@ -12,6 +12,7 @@
 #include "Blur.h"
 #include <map>
 #include "FilterProcessing.h"
+#include "Logging.h"
 #include "mozilla/PodOperations.h"
 #include "mozilla/DebugOnly.h"
 
diff --git a/gfx/2d/Logging.h b/gfx/2d/Logging.h
index 85e788c..d7728bb 100644
--- a/gfx/2d/Logging.h
+++ b/gfx/2d/Logging.h
@@ -155,6 +155,25 @@ typedef Log<LOG_WARNING> WarningLog;
 #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
-- 
2.2.1

