diff options
author | tsepez <tsepez@chromium.org> | 2016-11-16 17:31:18 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-11-16 17:31:18 -0800 |
commit | 5913a6ca71c85401e3f5317758d44a9fc4a667b2 (patch) | |
tree | 388ad0bd98b44a47c251568e198e2c3c231c7d30 /core/fxcrt | |
parent | cc4d0a44f3025821f88f3ed1ee78dfdc416487c7 (diff) | |
download | pdfium-5913a6ca71c85401e3f5317758d44a9fc4a667b2.tar.xz |
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
Diffstat (limited to 'core/fxcrt')
-rw-r--r-- | core/fxcrt/cfx_weak_ptr.h | 4 |
1 files changed, 4 insertions, 0 deletions
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 <cstddef> #include <memory> #include "core/fxcrt/cfx_retain_ptr.h" @@ -21,6 +22,9 @@ class CFX_WeakPtr { CFX_WeakPtr(std::unique_ptr<T, D> 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(); } |