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

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

Issue 2004383002: OwnPtr: Add reset() as an alias of clear(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 | « no previous file | 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 bool isHashTableDeletedValue() const { return m_ptr == hashTableDeletedValue (); } 52 bool isHashTableDeletedValue() const { return m_ptr == hashTableDeletedValue (); }
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 // Note: clear() will soon get renamed to reset() as a part of OwnPtr -> std ::unique_ptr transition.
63 // For now, both are allowed to facilitate the rename process. See also: htt p://crbug.com/611661
62 void clear(); 64 void clear();
65 void reset() { clear(); }
66
63 PtrType leakPtr() WARN_UNUSED_RETURN; 67 PtrType leakPtr() WARN_UNUSED_RETURN;
64 68
65 ValueType& operator*() const { ASSERT(m_ptr); return *m_ptr; } 69 ValueType& operator*() const { ASSERT(m_ptr); return *m_ptr; }
66 PtrType operator->() const { ASSERT(m_ptr); return m_ptr; } 70 PtrType operator->() const { ASSERT(m_ptr); return m_ptr; }
67 71
68 ValueType& operator[](std::ptrdiff_t i) const; 72 ValueType& operator[](std::ptrdiff_t i) const;
69 73
70 bool operator!() const { return !m_ptr; } 74 bool operator!() const { return !m_ptr; }
71 explicit operator bool() const { return m_ptr; } 75 explicit operator bool() const { return m_ptr; }
72 76
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 template <typename T> inline typename OwnPtr<T>::PtrType getPtr(const OwnPtr<T>& p) 190 template <typename T> inline typename OwnPtr<T>::PtrType getPtr(const OwnPtr<T>& p)
187 { 191 {
188 return p.get(); 192 return p.get();
189 } 193 }
190 194
191 } // namespace WTF 195 } // namespace WTF
192 196
193 using WTF::OwnPtr; 197 using WTF::OwnPtr;
194 198
195 #endif // WTF_OwnPtr_h 199 #endif // WTF_OwnPtr_h
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698