Chromium Code Reviews| Index: core/fxcrt/include/fx_basic.h |
| diff --git a/core/fxcrt/include/fx_basic.h b/core/fxcrt/include/fx_basic.h |
| index 8e39f5577aba1186aa781600c750967f0c58c74c..bc05a3479dacd5038ef4d780e3b011413089eca2 100644 |
| --- a/core/fxcrt/include/fx_basic.h |
| +++ b/core/fxcrt/include/fx_basic.h |
| @@ -648,27 +648,24 @@ class CFX_BitStream { |
| const uint8_t* m_pData; |
| }; |
| + |
| template <class ObjClass> |
| class CFX_CountRef { |
| public: |
| - typedef CFX_CountRef<ObjClass> Ref; |
| + using Ref = CFX_CountRef<ObjClass>; |
| class CountedObj : public ObjClass { |
| public: |
| CountedObj() {} |
| - |
| CountedObj(const CountedObj& src) : ObjClass(src) {} |
| int m_RefCount; |
| }; |
| - CFX_CountRef() { m_pObject = nullptr; } |
| - |
| - CFX_CountRef(const Ref& ref) { |
| - m_pObject = ref.m_pObject; |
| - if (m_pObject) { |
| + CFX_CountRef() : m_pObject(nullptr) {} |
| + CFX_CountRef(const Ref& ref) : m_pObject(ref.m_pObject) { |
| + if (m_pObject) |
| m_pObject->m_RefCount++; |
| - } |
| } |
| ~CFX_CountRef() { SetNull(); } |
| @@ -687,14 +684,10 @@ class CFX_CountRef { |
| m_pObject = ref.m_pObject; |
| } |
| - const ObjClass* GetObject() const { return m_pObject; } |
| - |
| - operator const ObjClass*() const { return m_pObject; } |
| - |
| - FX_BOOL IsNull() const { return !m_pObject; } |
| - |
| - FX_BOOL NotNull() const { return !IsNull(); } |
| + bool IsNull() const { return !m_pObject; } |
| + bool NotNull() const { return !IsNull(); } |
|
dsinclair
2016/06/08 18:45:54
Can we have a followup to remove this? Seems just
|
| + const ObjClass* GetObject() const { return m_pObject; } |
| ObjClass* GetModify() { |
| if (!m_pObject) { |
| m_pObject = new CountedObj; |
| @@ -724,6 +717,7 @@ class CFX_CountRef { |
| protected: |
| CountedObj* m_pObject; |
| }; |
| + |
| class IFX_Pause { |
| public: |
| virtual ~IFX_Pause() {} |