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

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

Issue 2437883002: Made PassRefPtr move only and replaced new copies with moves. (Closed)
Patch Set: Removed stale comment Created 4 years, 2 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/modules/fetch/FormDataBytesConsumer.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) 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 } 64 }
65 65
66 template <typename T> 66 template <typename T>
67 class PassRefPtr { 67 class PassRefPtr {
68 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); 68 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW();
69 69
70 public: 70 public:
71 PassRefPtr() : m_ptr(nullptr) {} 71 PassRefPtr() : m_ptr(nullptr) {}
72 PassRefPtr(std::nullptr_t) : m_ptr(nullptr) {} 72 PassRefPtr(std::nullptr_t) : m_ptr(nullptr) {}
73 PassRefPtr(T* ptr) : m_ptr(ptr) { refIfNotNull(ptr); } 73 PassRefPtr(T* ptr) : m_ptr(ptr) { refIfNotNull(ptr); }
74 // It somewhat breaks the type system to allow transfer of ownership out of
75 // a const PassRefPtr. However, it makes it much easier to work with
76 // PassRefPtr temporaries, and we don't have a need to use real const
77 // PassRefPtrs anyway.
78 PassRefPtr(const PassRefPtr& o) : m_ptr(o.leakRef()) {}
79 PassRefPtr(PassRefPtr&& o) : m_ptr(o.leakRef()) {} 74 PassRefPtr(PassRefPtr&& o) : m_ptr(o.leakRef()) {}
80 template <typename U> 75 template <typename U>
81 PassRefPtr(const PassRefPtr<U>& o, EnsurePtrConvertibleArgDecl(U, T)) 76 PassRefPtr(const PassRefPtr<U>& o, EnsurePtrConvertibleArgDecl(U, T))
82 : m_ptr(o.leakRef()) {} 77 : m_ptr(o.leakRef()) {}
83 78
84 ALWAYS_INLINE ~PassRefPtr() { derefIfNotNull(m_ptr); } 79 ALWAYS_INLINE ~PassRefPtr() { derefIfNotNull(m_ptr); }
85 80
86 template <typename U> 81 template <typename U>
87 PassRefPtr(const RefPtr<U>&, EnsurePtrConvertibleArgDecl(U, T)); 82 PassRefPtr(const RefPtr<U>&, EnsurePtrConvertibleArgDecl(U, T));
88 template <typename U> 83 template <typename U>
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 inline T* getPtr(const PassRefPtr<T>& p) { 214 inline T* getPtr(const PassRefPtr<T>& p) {
220 return p.get(); 215 return p.get();
221 } 216 }
222 217
223 } // namespace WTF 218 } // namespace WTF
224 219
225 using WTF::PassRefPtr; 220 using WTF::PassRefPtr;
226 using WTF::adoptRef; 221 using WTF::adoptRef;
227 222
228 #endif // WTF_PassRefPtr_h 223 #endif // WTF_PassRefPtr_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/fetch/FormDataBytesConsumer.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698