Bug 1250196 - Part 1: Import mozilla::Forward and mozilla::UniqePtr into the std namespace in a way that is compatible with libc++; r=lsalzman
authorEhsan Akhgari <ehsan@mozilla.com>
Mon, 22 Feb 2016 11:53:59 -0500
changeset 285068 390c755ec4b3528b501f3155f56a1860bdbbada0
parent 285067 22b111e834ddd1c604d4d9da4cf89967a09432bf
child 285069 aab8109b413262c1976debe0e9fbea534093eccc
push id72225
push usereakhgari@mozilla.com
push dateMon, 22 Feb 2016 21:02:29 +0000
treeherdermozilla-inbound@aab8109b4132 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerslsalzman
bugs1250196
milestone47.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1250196 - Part 1: Import mozilla::Forward and mozilla::UniqePtr into the std namespace in a way that is compatible with libc++; r=lsalzman
gfx/skia/skia/include/private/SkTLogic.h
gfx/skia/skia/include/private/SkUniquePtr.h
--- a/gfx/skia/skia/include/private/SkTLogic.h
+++ b/gfx/skia/skia/include/private/SkTLogic.h
@@ -27,20 +27,33 @@
 #ifdef MOZ_SKIA
 #include "mozilla/Move.h"
 #include "mozilla/TypeTraits.h"
 
 #if SKIA_IMPLEMENTATION
 #include "mozilla/Function.h"
 #endif
 
-namespace std {
+// In libc++, symbols such as std::forward may be defined in std::__1.
+// The _LIBCPP_BEGIN_NAMESPACE_STD and _LIBCPP_END_NAMESPACE_STD macros
+// will expand to the correct namespace.
+#ifdef _LIBCPP_BEGIN_NAMESPACE_STD
+#define MOZ_BEGIN_STD_NAMESPACE _LIBCPP_BEGIN_NAMESPACE_STD
+#define MOZ_END_STD_NAMESPACE _LIBCPP_END_NAMESPACE_STD
+#else
+#define MOZ_BEGIN_STD_NAMESPACE namespace std {
+#define MOZ_END_STD_NAMESPACE }
+#endif
+
+MOZ_BEGIN_STD_NAMESPACE
     using mozilla::Forward;
     #define forward Forward
+MOZ_END_STD_NAMESPACE
 
+namespace std {
 #if SKIA_IMPLEMENTATION
     using mozilla::IntegralConstant;
     using mozilla::IsEmpty;
     using mozilla::FalseType;
     using mozilla::TrueType;
     #define integral_constant IntegralConstant
     #define is_empty IsEmpty
     #define false_type FalseType
--- a/gfx/skia/skia/include/private/SkUniquePtr.h
+++ b/gfx/skia/skia/include/private/SkUniquePtr.h
@@ -10,16 +10,21 @@
 
 #include "SkTLogic.h"
 #include <cstddef>
 #include <utility>
 
 #ifdef MOZ_SKIA
 #include "mozilla/UniquePtr.h"
 
+namespace std {
+    using mozilla::DefaultDelete;
+    using mozilla::UniquePtr;
+}
+
 namespace skstd {
     using mozilla::DefaultDelete;
     using mozilla::UniquePtr;
     #define default_delete DefaultDelete
     #define unique_ptr UniquePtr
 }
 #else
 namespace skstd {