summaryrefslogtreecommitdiff
path: root/core/fxcrt/include
diff options
context:
space:
mode:
authortsepez <tsepez@chromium.org>2016-06-08 11:51:23 -0700
committerCommit bot <commit-bot@chromium.org>2016-06-08 11:51:23 -0700
commit7d2a8d966643ebc77c1aa0f0c53a0ffd2d681c4c (patch)
tree5f2823bb9e2a575e39044ebea114f4ed4e5a9368 /core/fxcrt/include
parentb7a5179a7cd73d33355e1cece763caf238b7dc22 (diff)
downloadpdfium-7d2a8d966643ebc77c1aa0f0c53a0ffd2d681c4c.tar.xz
Remove implicit CFX_CountedRef::operator T*()
Explicitly invoke GetObject() method instead. This avoids having code where it looks like non-pointers are assigned to pointers but works due to the cast operator. Review-Url: https://codereview.chromium.org/2045083003
Diffstat (limited to 'core/fxcrt/include')
-rw-r--r--core/fxcrt/include/fx_basic.h24
1 files changed, 9 insertions, 15 deletions
diff --git a/core/fxcrt/include/fx_basic.h b/core/fxcrt/include/fx_basic.h
index 8e39f5577a..bc05a3479d 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(); }
+ 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() {}