| Index: third_party/WebKit/Source/wtf/PtrUtil.h
|
| diff --git a/third_party/WebKit/Source/wtf/PtrUtil.h b/third_party/WebKit/Source/wtf/PtrUtil.h
|
| index a26aa4cfe2e67008cc175e83c97cbe0fab630051..bba00bbc207591196335ed16fbdd699472eeecba 100644
|
| --- a/third_party/WebKit/Source/wtf/PtrUtil.h
|
| +++ b/third_party/WebKit/Source/wtf/PtrUtil.h
|
| @@ -5,6 +5,7 @@
|
| #ifndef PtrUtil_h
|
| #define PtrUtil_h
|
|
|
| +#include "base/memory/ptr_util.h"
|
| #include "wtf/TypeTraits.h"
|
|
|
| #include <memory>
|
| @@ -27,8 +28,27 @@ std::unique_ptr<T[]> wrapArrayUnique(T* ptr) {
|
| return std::unique_ptr<T[]>(ptr);
|
| }
|
|
|
| +// WTF::makeUnique is base::MakeUnique. See base/ptr_util.h for documentation.
|
| +template <typename T, typename... Args>
|
| +auto makeUnique(Args&&... args)
|
| + -> decltype(base::MakeUnique<T>(std::forward<Args>(args)...)) {
|
| + static_assert(
|
| + !WTF::IsGarbageCollectedType<T>::value,
|
| + "Garbage collected types should not be stored in std::unique_ptr!");
|
| + return base::MakeUnique<T>(std::forward<Args>(args)...);
|
| +}
|
| +
|
| +template <typename T>
|
| +auto makeUnique(size_t size) -> decltype(base::MakeUnique<T>(size)) {
|
| + static_assert(
|
| + !WTF::IsGarbageCollectedType<T>::value,
|
| + "Garbage collected types should not be stored in std::unique_ptr!");
|
| + return base::MakeUnique<T>(size);
|
| +}
|
| +
|
| } // namespace WTF
|
|
|
| +using WTF::makeUnique;
|
| using WTF::wrapUnique;
|
| using WTF::wrapArrayUnique;
|
|
|
|
|