mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 21:31:04 +00:00
Bug 1270231 - avoid #define leakage of common symbols outside of Skia. r=jrmuizel
This commit is contained in:
parent
6205a2679f
commit
b0ad2e9c84
@ -432,7 +432,7 @@ template <typename T> inline bool operator>=(std::nullptr_t, const sk_sp<T>& b)
|
||||
|
||||
template <typename T, typename... Args>
|
||||
sk_sp<T> sk_make_sp(Args&&... args) {
|
||||
return sk_sp<T>(new T(std::forward<Args>(args)...));
|
||||
return sk_sp<T>(new T(std__forward<Args>(args)...));
|
||||
}
|
||||
|
||||
#ifdef SK_SUPPORT_TRANSITION_TO_SP_INTERFACES
|
||||
|
@ -51,7 +51,7 @@ public:
|
||||
if (this->isValid()) {
|
||||
fPtr->~T();
|
||||
}
|
||||
fPtr = new (SkTCast<T*>(fStorage.get())) T(std::forward<Args>(args)...);
|
||||
fPtr = new (SkTCast<T*>(fStorage.get())) T(std__forward<Args>(args)...);
|
||||
return fPtr;
|
||||
}
|
||||
|
||||
|
@ -359,6 +359,6 @@ typedef GrEGLImage (GR_GL_FUNCTION_TYPE* GrEGLCreateImageProc)(GrEGLDisplay dpy,
|
||||
typedef GrEGLBoolean (GR_GL_FUNCTION_TYPE* GrEGLDestroyImageProc)(GrEGLDisplay dpy, GrEGLImage image);
|
||||
} // extern "C"
|
||||
|
||||
template <typename GLPTR> using GrGLFunction = std::function<skstd::remove_pointer_t<GLPTR>>;
|
||||
template <typename GLPTR> using GrGLFunction = std__function<skstd::remove_pointer_t<GLPTR>>;
|
||||
|
||||
#endif
|
||||
|
@ -160,7 +160,7 @@ public:
|
||||
*/
|
||||
T& push_back(T&& t) {
|
||||
T* newT = reinterpret_cast<T*>(this->push_back_raw(1));
|
||||
new (newT) T(std::move(t));
|
||||
new (newT) T(std__move(t));
|
||||
return *newT;
|
||||
}
|
||||
|
||||
@ -169,7 +169,7 @@ public:
|
||||
*/
|
||||
template<class... Args> T& emplace_back(Args&&... args) {
|
||||
T* newT = reinterpret_cast<T*>(this->push_back_raw(1));
|
||||
return *new (newT) T(std::forward<Args>(args)...);
|
||||
return *new (newT) T(std__forward<Args>(args)...);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -415,12 +415,12 @@ private:
|
||||
}
|
||||
}
|
||||
template <bool E = MEM_COPY> SK_WHEN(!E, void) move(int dst, int src) {
|
||||
new (&fItemArray[dst]) T(std::move(fItemArray[src]));
|
||||
new (&fItemArray[dst]) T(std__move(fItemArray[src]));
|
||||
fItemArray[src].~T();
|
||||
}
|
||||
template <bool E = MEM_COPY> SK_WHEN(!E, void) move(char* dst) {
|
||||
for (int i = 0; i < fCount; ++i) {
|
||||
new (dst + sizeof(T) * i) T(std::move(fItemArray[i]));
|
||||
new (dst + sizeof(T) * i) T(std__move(fItemArray[i]));
|
||||
fItemArray[i].~T();
|
||||
}
|
||||
}
|
||||
|
@ -28,17 +28,24 @@
|
||||
#include "mozilla/UniquePtr.h"
|
||||
|
||||
namespace std {
|
||||
#define std__forward mozilla::Forward
|
||||
#define std__move mozilla::Move
|
||||
#if SKIA_IMPLEMENTATION
|
||||
using mozilla::Forward;
|
||||
using mozilla::Move;
|
||||
#define forward Forward
|
||||
#define move Move
|
||||
#endif
|
||||
|
||||
// If we have 'using mozilla::function', we're going to collide with
|
||||
// 'std::function' on platforms that have it. Therefore we use a macro
|
||||
// work around.
|
||||
template<typename Signature>
|
||||
using moz_function = mozilla::function<Signature>;
|
||||
#define std__function std::moz_function
|
||||
#if SKIA_IMPLEMENTATION
|
||||
#define function moz_function
|
||||
#endif
|
||||
|
||||
typedef decltype(nullptr) moz_nullptr_t;
|
||||
#define nullptr_t moz_nullptr_t
|
||||
@ -88,6 +95,10 @@ template <typename T> using underlying_type_t = typename skstd::underlying_type<
|
||||
|
||||
#else /* !MOZ_SKIA_AVOID_CXX11 */
|
||||
|
||||
#define std__forward std::forward
|
||||
#define std__move std::move
|
||||
#define std__function std::function
|
||||
|
||||
#include <type_traits>
|
||||
|
||||
namespace skstd {
|
||||
|
Loading…
Reference in New Issue
Block a user