diff options
author | Tom Sepez <tsepez@chromium.org> | 2017-04-25 14:29:00 -0700 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-04-25 21:46:00 +0000 |
commit | f52a65f6e7a328535a086b7d29c46938473bbebe (patch) | |
tree | b213832c396c4c7409b792b29e5f75e60852ae0a /core/fxge/android/cfpf_skiadevicemodule.cpp | |
parent | cf89faf5da79e186ad354b320ea3e562a2956c37 (diff) | |
download | pdfium-f52a65f6e7a328535a086b7d29c46938473bbebe.tar.xz |
Use unique_ptr in CFPF_SkiaDeviceModule
Change-Id: Ie50deca34dd3c122efb483ef210f96798abe9e4e
Reviewed-on: https://pdfium-review.googlesource.com/4498
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'core/fxge/android/cfpf_skiadevicemodule.cpp')
-rw-r--r-- | core/fxge/android/cfpf_skiadevicemodule.cpp | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/core/fxge/android/cfpf_skiadevicemodule.cpp b/core/fxge/android/cfpf_skiadevicemodule.cpp index 7bdf64666f..bb3f70afa1 100644 --- a/core/fxge/android/cfpf_skiadevicemodule.cpp +++ b/core/fxge/android/cfpf_skiadevicemodule.cpp @@ -6,7 +6,10 @@ #include "core/fxge/android/cfpf_skiadevicemodule.h" +#include <utility> + #include "core/fxge/android/cfpf_skiafontmgr.h" +#include "third_party/base/ptr_util.h" namespace { @@ -20,9 +23,9 @@ CFPF_SkiaDeviceModule* CFPF_GetSkiaDeviceModule() { return gs_pPFModule; } -CFPF_SkiaDeviceModule::~CFPF_SkiaDeviceModule() { - delete m_pFontMgr; -} +CFPF_SkiaDeviceModule::CFPF_SkiaDeviceModule() {} + +CFPF_SkiaDeviceModule::~CFPF_SkiaDeviceModule() {} void CFPF_SkiaDeviceModule::Destroy() { delete gs_pPFModule; @@ -31,11 +34,10 @@ void CFPF_SkiaDeviceModule::Destroy() { CFPF_SkiaFontMgr* CFPF_SkiaDeviceModule::GetFontMgr() { if (!m_pFontMgr) { - m_pFontMgr = new CFPF_SkiaFontMgr; - if (!m_pFontMgr->InitFTLibrary()) { - delete m_pFontMgr; + auto pNewMgr = pdfium::MakeUnique<CFPF_SkiaFontMgr>(); + if (!pNewMgr->InitFTLibrary()) return nullptr; - } + m_pFontMgr = std::move(pNewMgr); } - return m_pFontMgr; + return m_pFontMgr.get(); } |