OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef PtrUtil_h | 5 #ifndef PtrUtil_h |
6 #define PtrUtil_h | 6 #define PtrUtil_h |
7 | 7 |
8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
9 #include "wtf/TypeTraits.h" | 9 #include "platform/wtf/TypeTraits.h" |
10 | 10 |
11 #include <memory> | 11 #include <memory> |
12 | 12 |
13 namespace WTF { | 13 namespace WTF { |
14 | 14 |
15 template <typename T> | 15 template <typename T> |
16 std::unique_ptr<T> wrapUnique(T* ptr) { | 16 std::unique_ptr<T> wrapUnique(T* ptr) { |
17 static_assert( | 17 static_assert( |
18 !WTF::IsGarbageCollectedType<T>::value, | 18 !WTF::IsGarbageCollectedType<T>::value, |
19 "Garbage collected types should not be stored in std::unique_ptr!"); | 19 "Garbage collected types should not be stored in std::unique_ptr!"); |
(...skipping 24 matching lines...) Expand all Loading... |
44 !WTF::IsGarbageCollectedType<T>::value, | 44 !WTF::IsGarbageCollectedType<T>::value, |
45 "Garbage collected types should not be stored in std::unique_ptr!"); | 45 "Garbage collected types should not be stored in std::unique_ptr!"); |
46 return base::MakeUnique<T>(size); | 46 return base::MakeUnique<T>(size); |
47 } | 47 } |
48 | 48 |
49 } // namespace WTF | 49 } // namespace WTF |
50 | 50 |
51 using WTF::wrapArrayUnique; | 51 using WTF::wrapArrayUnique; |
52 | 52 |
53 #endif // PtrUtil_h | 53 #endif // PtrUtil_h |
OLD | NEW |