From 5913a6ca71c85401e3f5317758d44a9fc4a667b2 Mon Sep 17 00:00:00 2001 From: tsepez Date: Wed, 16 Nov 2016 17:31:18 -0800 Subject: Make CPDF_Object subclass constructors intern strings Make CDPF_Arrays intern the object they create. Allow passing nullptr as a CFX_WeakPtr shortcut as well. Review-Url: https://codereview.chromium.org/2509123002 --- core/fxcrt/cfx_weak_ptr.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'core/fxcrt/cfx_weak_ptr.h') diff --git a/core/fxcrt/cfx_weak_ptr.h b/core/fxcrt/cfx_weak_ptr.h index 9ac1475884..f679696992 100644 --- a/core/fxcrt/cfx_weak_ptr.h +++ b/core/fxcrt/cfx_weak_ptr.h @@ -7,6 +7,7 @@ #ifndef CORE_FXCRT_CFX_WEAK_PTR_H_ #define CORE_FXCRT_CFX_WEAK_PTR_H_ +#include #include #include "core/fxcrt/cfx_retain_ptr.h" @@ -21,6 +22,9 @@ class CFX_WeakPtr { CFX_WeakPtr(std::unique_ptr pObj) : m_pHandle(new Handle(std::move(pObj))) {} + // Deliberately implicit to allow passing nullptr. + CFX_WeakPtr(std::nullptr_t arg) {} + explicit operator bool() const { return m_pHandle && !!m_pHandle->Get(); } bool HasOneRef() const { return m_pHandle && m_pHandle->HasOneRef(); } T* operator->() { return m_pHandle->Get(); } -- cgit v1.2.3