summaryrefslogtreecommitdiff
path: root/fpdfsdk/javascript/app.cpp
diff options
context:
space:
mode:
authortsepez <tsepez@chromium.org>2016-09-12 09:47:52 -0700
committerCommit bot <commit-bot@chromium.org>2016-09-12 09:47:52 -0700
commit1c62054a42cf0759148501a36c541de5d5769d32 (patch)
treeed2e53f26474dff1149ce83d3f175c3c36b31631 /fpdfsdk/javascript/app.cpp
parent75f84a56fed36111ece82d0ac96e87289622b093 (diff)
downloadpdfium-1c62054a42cf0759148501a36c541de5d5769d32.tar.xz
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
Diffstat (limited to 'fpdfsdk/javascript/app.cpp')
-rw-r--r--fpdfsdk/javascript/app.cpp7
1 files changed, 3 insertions, 4 deletions
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() {