From 2c4c95d545c6e27b775a286e88130caadf8d5a7c Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Wed, 10 Oct 2018 17:28:33 +0000 Subject: Fix some random nits. Change-Id: I735c057d4900bcd58c1041df16b885dc7c9ed27d Reviewed-on: https://pdfium-review.googlesource.com/c/43793 Reviewed-by: Tom Sepez Commit-Queue: Lei Zhang --- core/fxcrt/maybe_owned.h | 2 +- core/fxcrt/observable.h | 6 +++--- core/fxcrt/weak_ptr.h | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) (limited to 'core/fxcrt') diff --git a/core/fxcrt/maybe_owned.h b/core/fxcrt/maybe_owned.h index 511e63223b..26e9d6fe1c 100644 --- a/core/fxcrt/maybe_owned.h +++ b/core/fxcrt/maybe_owned.h @@ -21,7 +21,7 @@ namespace fxcrt { template > class MaybeOwned { public: - MaybeOwned() : m_pObj(nullptr) {} + MaybeOwned() = default; explicit MaybeOwned(T* ptr) : m_pObj(ptr) {} explicit MaybeOwned(const UnownedPtr& ptr) : m_pObj(ptr.Get()) {} explicit MaybeOwned(std::unique_ptr ptr) diff --git a/core/fxcrt/observable.h b/core/fxcrt/observable.h index e99dadfc8e..e118dc898b 100644 --- a/core/fxcrt/observable.h +++ b/core/fxcrt/observable.h @@ -25,13 +25,13 @@ class Observable { // Simple case of a self-nulling pointer. class ObservedPtr final : public Observer { public: - ObservedPtr() : m_pObservable(nullptr) {} + ObservedPtr() = default; explicit ObservedPtr(T* pObservable) : m_pObservable(pObservable) { if (m_pObservable) m_pObservable->AddObserver(this); } ObservedPtr(const ObservedPtr& that) : ObservedPtr(that.Get()) {} - ~ObservedPtr() { + ~ObservedPtr() override { if (m_pObservable) m_pObservable->RemoveObserver(this); } @@ -60,7 +60,7 @@ class Observable { T* operator->() const { return m_pObservable; } private: - T* m_pObservable; + T* m_pObservable = nullptr; }; Observable() = default; diff --git a/core/fxcrt/weak_ptr.h b/core/fxcrt/weak_ptr.h index 3ec3942c5f..7b345aa993 100644 --- a/core/fxcrt/weak_ptr.h +++ b/core/fxcrt/weak_ptr.h @@ -58,8 +58,8 @@ class WeakPtr { private: class Handle { public: - explicit Handle(std::unique_ptr ptr) - : m_nCount(0), m_pObj(std::move(ptr)) {} + explicit Handle(std::unique_ptr ptr) : m_pObj(std::move(ptr)) {} + void Reset(std::unique_ptr ptr) { m_pObj = std::move(ptr); } void Clear() { // Now you're all weak ptrs ... m_pObj.reset(); // unique_ptr nulls first before invoking delete. @@ -78,7 +78,7 @@ class WeakPtr { private: ~Handle() = default; - intptr_t m_nCount; + intptr_t m_nCount = 0; std::unique_ptr m_pObj; }; -- cgit v1.2.3