diff options
author | Lei Zhang <thestig@chromium.org> | 2015-10-04 16:01:52 -0700 |
---|---|---|
committer | Lei Zhang <thestig@chromium.org> | 2015-10-04 16:01:52 -0700 |
commit | 794c9b67d3d519342aa7e15052766f7d4a99f551 (patch) | |
tree | e21fdbf59ce171b978126b9f94e69085ff30d211 /fpdfsdk/src/javascript/app.cpp | |
parent | 4f277fc8d41303cbf007335dfbbff60b81fffde0 (diff) | |
download | pdfium-794c9b67d3d519342aa7e15052766f7d4a99f551.tar.xz |
CJS_Timer should observe CJS_Runtime destruction.
Also remove dead CJS_EmbedObj::{Begin,End}Timer code.
BUG=539107
R=tsepez@chromium.org
Review URL: https://codereview.chromium.org/1384883002 .
Diffstat (limited to 'fpdfsdk/src/javascript/app.cpp')
-rw-r--r-- | fpdfsdk/src/javascript/app.cpp | 27 |
1 files changed, 10 insertions, 17 deletions
diff --git a/fpdfsdk/src/javascript/app.cpp b/fpdfsdk/src/javascript/app.cpp index 9d4fa9ca13..067ae108bd 100644 --- a/fpdfsdk/src/javascript/app.cpp +++ b/fpdfsdk/src/javascript/app.cpp @@ -408,16 +408,10 @@ FX_BOOL app::setInterval(IFXJS_Context* cc, CPDFDoc_Environment* pApp = pRuntime->GetReaderApp(); ASSERT(pApp); - CJS_Timer* pTimer = new CJS_Timer(this, pApp); + CJS_Timer* pTimer = + new CJS_Timer(this, pApp, pRuntime, 0, script, dwInterval, 0); m_aTimer.Add(pTimer); - pTimer->SetType(0); - pTimer->SetRuntime(pRuntime); - pTimer->SetJScript(script); - pTimer->SetTimeOut(0); - // pTimer->SetStartTime(GetTickCount()); - pTimer->SetJSTimer(dwInterval); - v8::Local<v8::Object> pRetObj = FXJS_NewFxDynamicObj( pRuntime->GetIsolate(), pContext, FXJS_GetObjDefnID(pRuntime->GetIsolate(), L"TimerObj")); @@ -462,15 +456,10 @@ FX_BOOL app::setTimeOut(IFXJS_Context* cc, CPDFDoc_Environment* pApp = pRuntime->GetReaderApp(); ASSERT(pApp); - CJS_Timer* pTimer = new CJS_Timer(this, pApp); + CJS_Timer* pTimer = + new CJS_Timer(this, pApp, pRuntime, 1, script, dwTimeOut, dwTimeOut); m_aTimer.Add(pTimer); - pTimer->SetType(1); - pTimer->SetRuntime(pRuntime); - pTimer->SetJScript(script); - pTimer->SetTimeOut(dwTimeOut); - pTimer->SetJSTimer(dwTimeOut); - v8::Local<v8::Object> pRetObj = FXJS_NewFxDynamicObj( pRuntime->GetIsolate(), pContext, FXJS_GetObjDefnID(pRuntime->GetIsolate(), L"TimerObj")); @@ -585,13 +574,17 @@ FX_BOOL app::execMenuItem(IFXJS_Context* cc, void app::TimerProc(CJS_Timer* pTimer) { ASSERT(pTimer != NULL); + CJS_Runtime* pRuntime = pTimer->GetRuntime(); + switch (pTimer->GetType()) { case 0: // interval - RunJsScript(pTimer->GetRuntime(), pTimer->GetJScript()); + if (pRuntime) + RunJsScript(pRuntime, pTimer->GetJScript()); break; case 1: if (pTimer->GetTimeOut() > 0) { - RunJsScript(pTimer->GetRuntime(), pTimer->GetJScript()); + if (pRuntime) + RunJsScript(pRuntime, pTimer->GetJScript()); pTimer->KillJSTimer(); } break; |