OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. | 2 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. |
3 * All rights reserved. | 3 * All rights reserved. |
4 * | 4 * |
5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
9 * | 9 * |
10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 template <typename T> | 67 template <typename T> |
68 class PassRefPtr { | 68 class PassRefPtr { |
69 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); | 69 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); |
70 | 70 |
71 public: | 71 public: |
72 PassRefPtr() : ptr_(nullptr) {} | 72 PassRefPtr() : ptr_(nullptr) {} |
73 PassRefPtr(std::nullptr_t) : ptr_(nullptr) {} | 73 PassRefPtr(std::nullptr_t) : ptr_(nullptr) {} |
74 PassRefPtr(T* ptr) : ptr_(ptr) { RefIfNotNull(ptr); } | 74 PassRefPtr(T* ptr) : ptr_(ptr) { RefIfNotNull(ptr); } |
75 PassRefPtr(PassRefPtr&& o) : ptr_(o.LeakRef()) {} | 75 PassRefPtr(PassRefPtr&& o) : ptr_(o.LeakRef()) {} |
76 template <typename U> | 76 template <typename U> |
77 PassRefPtr(const PassRefPtr<U>& o, EnsurePtrConvertibleArgDecl(U, T)) | 77 PassRefPtr(PassRefPtr<U>&& o, EnsurePtrConvertibleArgDecl(U, T)) |
78 : ptr_(o.LeakRef()) {} | 78 : ptr_(o.LeakRef()) {} |
79 | 79 |
80 ALWAYS_INLINE ~PassRefPtr() { DerefIfNotNull(ptr_); } | 80 ALWAYS_INLINE ~PassRefPtr() { DerefIfNotNull(ptr_); } |
81 | 81 |
82 template <typename U> | 82 template <typename U> |
83 PassRefPtr(const RefPtr<U>&, EnsurePtrConvertibleArgDecl(U, T)); | 83 PassRefPtr(const RefPtr<U>&, EnsurePtrConvertibleArgDecl(U, T)); |
84 template <typename U> | 84 template <typename U> |
85 PassRefPtr(RefPtr<U>&&, EnsurePtrConvertibleArgDecl(U, T)); | 85 PassRefPtr(RefPtr<U>&&, EnsurePtrConvertibleArgDecl(U, T)); |
86 | 86 |
87 T* Get() const { return ptr_; } | 87 T* Get() const { return ptr_; } |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 inline T* GetPtr(const PassRefPtr<T>& p) { | 215 inline T* GetPtr(const PassRefPtr<T>& p) { |
216 return p.Get(); | 216 return p.Get(); |
217 } | 217 } |
218 | 218 |
219 } // namespace WTF | 219 } // namespace WTF |
220 | 220 |
221 using WTF::PassRefPtr; | 221 using WTF::PassRefPtr; |
222 using WTF::AdoptRef; | 222 using WTF::AdoptRef; |
223 | 223 |
224 #endif // WTF_PassRefPtr_h | 224 #endif // WTF_PassRefPtr_h |
OLD | NEW |