Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(304)

Side by Side Diff: third_party/WebKit/Source/wtf/OwnPtr.h

Issue 1987203002: Remove OwnPtr::release(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merge with trunk for landing. Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/platform/fonts/win/FontCacheSkiaWin.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
3 * Copyright (C) 2013 Intel Corporation. All rights reserved. 3 * Copyright (C) 2013 Intel Corporation. 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 53
54 ~OwnPtr() 54 ~OwnPtr()
55 { 55 {
56 OwnedPtrDeleter<T>::deletePtr(m_ptr); 56 OwnedPtrDeleter<T>::deletePtr(m_ptr);
57 m_ptr = nullptr; 57 m_ptr = nullptr;
58 } 58 }
59 59
60 PtrType get() const { return m_ptr; } 60 PtrType get() const { return m_ptr; }
61 61
62 void clear(); 62 void clear();
63 PassOwnPtr<T> release();
64 PtrType leakPtr() WARN_UNUSED_RETURN; 63 PtrType leakPtr() WARN_UNUSED_RETURN;
65 64
66 ValueType& operator*() const { ASSERT(m_ptr); return *m_ptr; } 65 ValueType& operator*() const { ASSERT(m_ptr); return *m_ptr; }
67 PtrType operator->() const { ASSERT(m_ptr); return m_ptr; } 66 PtrType operator->() const { ASSERT(m_ptr); return m_ptr; }
68 67
69 ValueType& operator[](std::ptrdiff_t i) const; 68 ValueType& operator[](std::ptrdiff_t i) const;
70 69
71 bool operator!() const { return !m_ptr; } 70 bool operator!() const { return !m_ptr; }
72 explicit operator bool() const { return m_ptr; } 71 explicit operator bool() const { return m_ptr; }
73 72
(...skipping 29 matching lines...) Expand all
103 PtrType m_ptr; 102 PtrType m_ptr;
104 }; 103 };
105 104
106 template <typename T> inline void OwnPtr<T>::clear() 105 template <typename T> inline void OwnPtr<T>::clear()
107 { 106 {
108 PtrType ptr = m_ptr; 107 PtrType ptr = m_ptr;
109 m_ptr = nullptr; 108 m_ptr = nullptr;
110 OwnedPtrDeleter<T>::deletePtr(ptr); 109 OwnedPtrDeleter<T>::deletePtr(ptr);
111 } 110 }
112 111
113 template <typename T> inline PassOwnPtr<T> OwnPtr<T>::release()
114 {
115 PtrType ptr = m_ptr;
116 m_ptr = nullptr;
117 return PassOwnPtr<T>(ptr);
118 }
119
120 template <typename T> inline typename OwnPtr<T>::PtrType OwnPtr<T>::leakPtr() 112 template <typename T> inline typename OwnPtr<T>::PtrType OwnPtr<T>::leakPtr()
121 { 113 {
122 PtrType ptr = m_ptr; 114 PtrType ptr = m_ptr;
123 m_ptr = nullptr; 115 m_ptr = nullptr;
124 return ptr; 116 return ptr;
125 } 117 }
126 118
127 template <typename T> inline typename OwnPtr<T>::ValueType& OwnPtr<T>::operator[ ](std::ptrdiff_t i) const 119 template <typename T> inline typename OwnPtr<T>::ValueType& OwnPtr<T>::operator[ ](std::ptrdiff_t i) const
128 { 120 {
129 static_assert(std::is_array<T>::value, "elements access is possible for arra ys only"); 121 static_assert(std::is_array<T>::value, "elements access is possible for arra ys only");
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 template <typename T> inline typename OwnPtr<T>::PtrType getPtr(const OwnPtr<T>& p) 186 template <typename T> inline typename OwnPtr<T>::PtrType getPtr(const OwnPtr<T>& p)
195 { 187 {
196 return p.get(); 188 return p.get();
197 } 189 }
198 190
199 } // namespace WTF 191 } // namespace WTF
200 192
201 using WTF::OwnPtr; 193 using WTF::OwnPtr;
202 194
203 #endif // WTF_OwnPtr_h 195 #endif // WTF_OwnPtr_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/fonts/win/FontCacheSkiaWin.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698