diff options
author | Lei Zhang <thestig@chromium.org> | 2018-10-10 17:28:33 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-10-10 17:28:33 +0000 |
commit | 2c4c95d545c6e27b775a286e88130caadf8d5a7c (patch) | |
tree | b5aa06a161591f81279296c3ee0dd8ed6f8a9a6a | |
parent | 7bf816420aa79b23c37ad433183f01dc5af653fa (diff) | |
download | pdfium-2c4c95d545c6e27b775a286e88130caadf8d5a7c.tar.xz |
Fix some random nits.
Change-Id: I735c057d4900bcd58c1041df16b885dc7c9ed27d
Reviewed-on: https://pdfium-review.googlesource.com/c/43793
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
-rw-r--r-- | core/fxcrt/maybe_owned.h | 2 | ||||
-rw-r--r-- | core/fxcrt/observable.h | 6 | ||||
-rw-r--r-- | core/fxcrt/weak_ptr.h | 6 | ||||
-rw-r--r-- | fxjs/ijs_runtime.h | 2 |
4 files changed, 8 insertions, 8 deletions
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 <typename T, typename D = std::default_delete<T>> class MaybeOwned { public: - MaybeOwned() : m_pObj(nullptr) {} + MaybeOwned() = default; explicit MaybeOwned(T* ptr) : m_pObj(ptr) {} explicit MaybeOwned(const UnownedPtr<T>& ptr) : m_pObj(ptr.Get()) {} explicit MaybeOwned(std::unique_ptr<T, D> 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<T, D> ptr) - : m_nCount(0), m_pObj(std::move(ptr)) {} + explicit Handle(std::unique_ptr<T, D> ptr) : m_pObj(std::move(ptr)) {} + void Reset(std::unique_ptr<T, D> 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<T, D> m_pObj; }; diff --git a/fxjs/ijs_runtime.h b/fxjs/ijs_runtime.h index d74bb94929..61aeda5600 100644 --- a/fxjs/ijs_runtime.h +++ b/fxjs/ijs_runtime.h @@ -44,7 +44,7 @@ class IJS_Runtime { IJS_EventContext* operator->() const { return m_pContext.Get(); } private: - UnownedPtr<IJS_Runtime> m_pRuntime; + UnownedPtr<IJS_Runtime> const m_pRuntime; UnownedPtr<IJS_EventContext> m_pContext; }; |