From 1c62054a42cf0759148501a36c541de5d5769d32 Mon Sep 17 00:00:00 2001 From: tsepez Date: Mon, 12 Sep 2016 09:47:52 -0700 Subject: Make CFX_Obeservable::Observer into a pointer-ish type; This may be a better design because it avoids having a level of indirection that the Observer required. Review-Url: https://codereview.chromium.org/2326763002 --- fpdfsdk/javascript/app.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'fpdfsdk/javascript/app.cpp') diff --git a/fpdfsdk/javascript/app.cpp b/fpdfsdk/javascript/app.cpp index d7086d211e..1e3ea2f04a 100644 --- a/fpdfsdk/javascript/app.cpp +++ b/fpdfsdk/javascript/app.cpp @@ -21,7 +21,7 @@ #include "fpdfsdk/javascript/resource.h" #include "third_party/base/stl_util.h" -class GlobalTimer : public CJS_Runtime::Observer { +class GlobalTimer { public: GlobalTimer(app* pObj, CPDFDoc_Environment* pApp, @@ -38,7 +38,7 @@ class GlobalTimer : public CJS_Runtime::Observer { bool IsOneShot() const { return m_nType == 1; } uint32_t GetTimeOut() const { return m_dwTimeOut; } int GetTimerID() const { return m_nTimerID; } - CJS_Runtime* GetRuntime() const { return m_pRuntime; } + CJS_Runtime* GetRuntime() const { return m_pRuntime.Get(); } CFX_WideString GetJScript() const { return m_swJScript; } private: @@ -53,7 +53,7 @@ class GlobalTimer : public CJS_Runtime::Observer { const int m_nType; // 0:Interval; 1:TimeOut const uint32_t m_dwTimeOut; const CFX_WideString m_swJScript; - CJS_Runtime* m_pRuntime; + CJS_Runtime::ObservedPtr m_pRuntime; CPDFDoc_Environment* const m_pApp; }; @@ -75,7 +75,6 @@ GlobalTimer::GlobalTimer(app* pObj, CFX_SystemHandler* pHandler = m_pApp->GetSysHandler(); m_nTimerID = pHandler->SetTimer(dwElapse, Trigger); (*GetGlobalTimerMap())[m_nTimerID] = this; - SetWatchedPtr(&m_pRuntime); } GlobalTimer::~GlobalTimer() { -- cgit v1.2.3