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

Unified Diff: core/fxcrt/include/cfx_count_ref.h

Issue 2283113002: Add -> operators to CFX_CountRef. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@privatize
Patch Set: Regenerate patch, rebase off of master. Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « core/fxcrt/cfx_count_ref_unittest.cpp ('k') | core/fxge/ge/cfx_cliprgn.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/fxcrt/include/cfx_count_ref.h
diff --git a/core/fxcrt/include/cfx_count_ref.h b/core/fxcrt/include/cfx_count_ref.h
index 817ce95add494ad5cc44598668cbbcd3df466aef..0837894c66932776c8914ac19788d81b96b15715 100644
--- a/core/fxcrt/include/cfx_count_ref.h
+++ b/core/fxcrt/include/cfx_count_ref.h
@@ -29,17 +29,16 @@ class CFX_CountRef {
return *this;
}
- void SetNull() { m_pObject.Reset(); }
+ void Clear() { m_pObject.Reset(); }
ObjClass* GetObject() { return m_pObject.Get(); }
const ObjClass* GetObject() const { return m_pObject.Get(); }
template <typename... Args>
- ObjClass* GetPrivateCopy(Args... params) {
+ void MakePrivateCopy(Args... params) {
if (!m_pObject)
- return New(params...);
- if (!m_pObject->HasOneRef())
+ m_pObject.Reset(new CountedObj(params...));
+ else if (!m_pObject->HasOneRef())
m_pObject.Reset(new CountedObj(*m_pObject));
- return m_pObject.Get();
}
bool operator==(const CFX_CountRef& that) const {
@@ -47,6 +46,8 @@ class CFX_CountRef {
}
bool operator!=(const CFX_CountRef& that) const { return !(*this == that); }
operator bool() const { return m_pObject; }
+ ObjClass& operator*() const { return *m_pObject.Get(); }
+ ObjClass* operator->() const { return m_pObject.Get(); }
private:
class CountedObj : public ObjClass {
« no previous file with comments | « core/fxcrt/cfx_count_ref_unittest.cpp ('k') | core/fxge/ge/cfx_cliprgn.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698