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

Side by Side Diff: core/fxcrt/cfx_weak_ptr.h

Issue 2385303002: Rename CFX_WeakPtr::Clear() to DestroyObject() (Closed)
Patch Set: 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 | « core/fpdfapi/fpdf_parser/cpdf_document.cpp ('k') | core/fxcrt/cfx_weak_ptr_unittest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 PDFium Authors. All rights reserved. 1 // Copyright 2016 PDFium 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 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #ifndef CORE_FXCRT_CFX_WEAK_PTR_H_ 7 #ifndef CORE_FXCRT_CFX_WEAK_PTR_H_
8 #define CORE_FXCRT_CFX_WEAK_PTR_H_ 8 #define CORE_FXCRT_CFX_WEAK_PTR_H_
9 9
10 #include <memory> 10 #include <memory>
(...skipping 17 matching lines...) Expand all
28 CFX_WeakPtr& operator=(const CFX_WeakPtr& that) { 28 CFX_WeakPtr& operator=(const CFX_WeakPtr& that) {
29 m_pHandle = that.m_pHandle; 29 m_pHandle = that.m_pHandle;
30 return *this; 30 return *this;
31 } 31 }
32 bool operator==(const CFX_WeakPtr& that) const { 32 bool operator==(const CFX_WeakPtr& that) const {
33 return m_pHandle == that.m_pHandle; 33 return m_pHandle == that.m_pHandle;
34 } 34 }
35 bool operator!=(const CFX_WeakPtr& that) const { return !(*this == that); } 35 bool operator!=(const CFX_WeakPtr& that) const { return !(*this == that); }
36 36
37 T* Get() const { return m_pHandle ? m_pHandle->Get() : nullptr; } 37 T* Get() const { return m_pHandle ? m_pHandle->Get() : nullptr; }
38 void Clear() { 38 void DeleteObject() {
39 if (m_pHandle) { 39 if (m_pHandle) {
40 m_pHandle->Clear(); 40 m_pHandle->Clear();
41 m_pHandle.Reset(); 41 m_pHandle.Reset();
42 } 42 }
43 } 43 }
44 void Reset() { m_pHandle.Reset(); } 44 void Reset() { m_pHandle.Reset(); }
45 void Reset(std::unique_ptr<T, D> pObj) { 45 void Reset(std::unique_ptr<T, D> pObj) {
46 m_pHandle.Reset(new Handle(std::move(pObj))); 46 m_pHandle.Reset(new Handle(std::move(pObj)));
47 } 47 }
48 void Swap(CFX_WeakPtr& that) { m_pHandle.Swap(that.m_pHandle); } 48 void Swap(CFX_WeakPtr& that) { m_pHandle.Swap(that.m_pHandle); }
(...skipping 22 matching lines...) Expand all
71 ~Handle() {} 71 ~Handle() {}
72 72
73 intptr_t m_nCount; 73 intptr_t m_nCount;
74 std::unique_ptr<T, D> m_pObj; 74 std::unique_ptr<T, D> m_pObj;
75 }; 75 };
76 76
77 CFX_RetainPtr<Handle> m_pHandle; 77 CFX_RetainPtr<Handle> m_pHandle;
78 }; 78 };
79 79
80 #endif // CORE_FXCRT_CFX_WEAK_PTR_H_ 80 #endif // CORE_FXCRT_CFX_WEAK_PTR_H_
OLDNEW
« no previous file with comments | « core/fpdfapi/fpdf_parser/cpdf_document.cpp ('k') | core/fxcrt/cfx_weak_ptr_unittest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698