summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2018-06-01 16:41:23 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-06-01 16:41:23 +0000
commit3018c1c7323a1aa9fd89c7de5420ed925b5b6611 (patch)
tree23fdf52f752690c9012c8781e3a3fd0dc0645238
parent180656569acbb93fd1ba4ff9b9264e4b41ca17b2 (diff)
downloadpdfium-3018c1c7323a1aa9fd89c7de5420ed925b5b6611.tar.xz
Return unique_ptr from CPDFXFA_Context::GetTimerMgr()
Proves ownership by avoiding a std::unique_ptr::reset() call. Change-Id: Ia6e11920d84dda49699736ef3189e58d240d409e Reviewed-on: https://pdfium-review.googlesource.com/33230 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
-rw-r--r--fpdfsdk/fpdfxfa/cpdfxfa_context.cpp9
-rw-r--r--fpdfsdk/fpdfxfa/cpdfxfa_context.h2
-rw-r--r--xfa/fwl/cfwl_timer.cpp2
-rw-r--r--xfa/fxfa/cxfa_ffapp.cpp3
-rw-r--r--xfa/fxfa/cxfa_ffapp.h2
-rw-r--r--xfa/fxfa/fxfa.h3
6 files changed, 11 insertions, 10 deletions
diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_context.cpp b/fpdfsdk/fpdfxfa/cpdfxfa_context.cpp
index 36d86650b7..446a77ea96 100644
--- a/fpdfsdk/fpdfxfa/cpdfxfa_context.cpp
+++ b/fpdfsdk/fpdfxfa/cpdfxfa_context.cpp
@@ -341,9 +341,8 @@ bool CPDFXFA_Context::PutRequestURL(const WideString& wsURL,
m_pFormFillEnv->PutRequestURL(wsURL, wsData, wsEncode);
}
-IFWL_AdapterTimerMgr* CPDFXFA_Context::GetTimerMgr() {
- CXFA_FWLAdapterTimerMgr* pAdapter = nullptr;
- if (m_pFormFillEnv)
- pAdapter = new CXFA_FWLAdapterTimerMgr(m_pFormFillEnv.Get());
- return pAdapter;
+std::unique_ptr<IFWL_AdapterTimerMgr> CPDFXFA_Context::GetTimerMgr() {
+ if (!m_pFormFillEnv)
+ return nullptr;
+ return pdfium::MakeUnique<CXFA_FWLAdapterTimerMgr>(m_pFormFillEnv.Get());
}
diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_context.h b/fpdfsdk/fpdfxfa/cpdfxfa_context.h
index b240e7ee11..6458926a68 100644
--- a/fpdfsdk/fpdfxfa/cpdfxfa_context.h
+++ b/fpdfsdk/fpdfxfa/cpdfxfa_context.h
@@ -91,7 +91,7 @@ class CPDFXFA_Context : public CPDF_Document::Extension,
const WideString& wsData,
const WideString& wsEncode) override;
- IFWL_AdapterTimerMgr* GetTimerMgr() override;
+ std::unique_ptr<IFWL_AdapterTimerMgr> GetTimerMgr() override;
protected:
friend class CPDFXFA_DocEnvironment;
diff --git a/xfa/fwl/cfwl_timer.cpp b/xfa/fwl/cfwl_timer.cpp
index 597f928ba0..07d8461b9f 100644
--- a/xfa/fwl/cfwl_timer.cpp
+++ b/xfa/fwl/cfwl_timer.cpp
@@ -26,7 +26,7 @@ CFWL_TimerInfo* CFWL_Timer::StartTimer(uint32_t dwElapse, bool bImmediately) {
return nullptr;
if (!m_pTimeMgrAdapter)
- m_pTimeMgrAdapter.reset(pAdapterNative->GetTimerMgr());
+ m_pTimeMgrAdapter = pAdapterNative->GetTimerMgr();
if (!m_pTimeMgrAdapter)
return nullptr;
diff --git a/xfa/fxfa/cxfa_ffapp.cpp b/xfa/fxfa/cxfa_ffapp.cpp
index 1367a77b87..f6d6bdd6b5 100644
--- a/xfa/fxfa/cxfa_ffapp.cpp
+++ b/xfa/fxfa/cxfa_ffapp.cpp
@@ -16,6 +16,7 @@
#include "xfa/fgas/font/cfgas_fontmgr.h"
#include "xfa/fwl/cfwl_notedriver.h"
#include "xfa/fwl/cfwl_widgetmgr.h"
+#include "xfa/fwl/ifwl_adaptertimermgr.h"
#include "xfa/fxfa/cxfa_ffdoc.h"
#include "xfa/fxfa/cxfa_ffwidgethandler.h"
#include "xfa/fxfa/cxfa_fontmgr.h"
@@ -66,7 +67,7 @@ CXFA_FWLAdapterWidgetMgr* CXFA_FFApp::GetFWLAdapterWidgetMgr() {
return m_pAdapterWidgetMgr.get();
}
-IFWL_AdapterTimerMgr* CXFA_FFApp::GetTimerMgr() const {
+std::unique_ptr<IFWL_AdapterTimerMgr> CXFA_FFApp::GetTimerMgr() const {
return m_pProvider->GetTimerMgr();
}
diff --git a/xfa/fxfa/cxfa_ffapp.h b/xfa/fxfa/cxfa_ffapp.h
index c43cb3e6b2..acc3bf0783 100644
--- a/xfa/fxfa/cxfa_ffapp.h
+++ b/xfa/fxfa/cxfa_ffapp.h
@@ -44,8 +44,8 @@ class CXFA_FFApp {
IXFA_AppProvider* GetAppProvider() const { return m_pProvider.Get(); }
const CFWL_App* GetFWLApp() const { return m_pFWLApp.get(); }
- IFWL_AdapterTimerMgr* GetTimerMgr() const;
CXFA_FontMgr* GetXFAFontMgr() { return &m_pFontMgr; }
+ std::unique_ptr<IFWL_AdapterTimerMgr> GetTimerMgr() const;
void ClearEventTargets();
diff --git a/xfa/fxfa/fxfa.h b/xfa/fxfa/fxfa.h
index 8a2c4e0296..59c8c08de8 100644
--- a/xfa/fxfa/fxfa.h
+++ b/xfa/fxfa/fxfa.h
@@ -7,6 +7,7 @@
#ifndef XFA_FXFA_FXFA_H_
#define XFA_FXFA_FXFA_H_
+#include <memory>
#include <vector>
#include "core/fxcrt/fx_coordinates.h"
@@ -201,7 +202,7 @@ class IXFA_AppProvider {
const WideString& wsData,
const WideString& wsEncode) = 0;
- virtual IFWL_AdapterTimerMgr* GetTimerMgr() = 0;
+ virtual std::unique_ptr<IFWL_AdapterTimerMgr> GetTimerMgr() = 0;
};
class IXFA_DocEnvironment {