diff options
author | Tom Sepez <tsepez@chromium.org> | 2018-06-06 18:30:15 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-06-06 18:30:15 +0000 |
commit | ddaa40fe873070d3aae9a21b9a93848fc7e809f1 (patch) | |
tree | 222d228484da9e234a647254440e9aff98dca224 /fxjs/cjs_app.cpp | |
parent | 5caa34c64382d8587a3ec3de5edbb30976b1390d (diff) | |
download | pdfium-ddaa40fe873070d3aae9a21b9a93848fc7e809f1.tar.xz |
Stop using some v8::Context slot to find runtime.
Instead, use the object binding's pointer. Puts the cart back
behind the horse.
Change-Id: I4c06ae991b871c6e90b0e6c70b69886addca2354
Reviewed-on: https://pdfium-review.googlesource.com/33630
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'fxjs/cjs_app.cpp')
-rw-r--r-- | fxjs/cjs_app.cpp | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/fxjs/cjs_app.cpp b/fxjs/cjs_app.cpp index 3f9244cf66..1997e9afe9 100644 --- a/fxjs/cjs_app.cpp +++ b/fxjs/cjs_app.cpp @@ -99,9 +99,10 @@ CJS_App::~CJS_App() = default; CJS_Return CJS_App::get_active_docs(CJS_Runtime* pRuntime) { CJS_Document* pJSDocument = nullptr; v8::Local<v8::Object> pObj = pRuntime->GetThisObj(); - if (CFXJS_Engine::GetObjDefnID(pObj) == CJS_Document::GetObjDefnID()) - pJSDocument = static_cast<CJS_Document*>(pRuntime->GetObjectPrivate(pObj)); - + if (CFXJS_Engine::GetObjDefnID(pObj) == CJS_Document::GetObjDefnID()) { + pJSDocument = + static_cast<CJS_Document*>(CFXJS_Engine::GetObjectPrivate(pObj)); + } v8::Local<v8::Array> aDocs = pRuntime->NewArray(); pRuntime->PutArrayElement( aDocs, 0, @@ -326,8 +327,9 @@ CJS_Return CJS_App::setInterval( if (pRetObj.IsEmpty()) return CJS_Return(false); - CJS_TimerObj* pJS_TimerObj = - static_cast<CJS_TimerObj*>(pRuntime->GetObjectPrivate(pRetObj)); + auto* pJS_TimerObj = + static_cast<CJS_TimerObj*>(CFXJS_Engine::GetObjectPrivate(pRetObj)); + pJS_TimerObj->SetTimer(pTimerRef); return CJS_Return(pRetObj); } @@ -354,8 +356,9 @@ CJS_Return CJS_App::setTimeOut( if (pRetObj.IsEmpty()) return CJS_Return(false); - CJS_TimerObj* pJS_TimerObj = - static_cast<CJS_TimerObj*>(pRuntime->GetObjectPrivate(pRetObj)); + auto* pJS_TimerObj = + static_cast<CJS_TimerObj*>(CFXJS_Engine::GetObjectPrivate(pRetObj)); + pJS_TimerObj->SetTimer(pTimerRef); return CJS_Return(pRetObj); } @@ -389,12 +392,11 @@ void CJS_App::ClearTimerCommon(CJS_Runtime* pRuntime, if (CFXJS_Engine::GetObjDefnID(pObj) != CJS_TimerObj::GetObjDefnID()) return; - CJS_Object* pJSObj = pRuntime->GetObjectPrivate(pObj); + CJS_Object* pJSObj = CFXJS_Engine::GetObjectPrivate(pObj); if (!pJSObj) return; - CJS_TimerObj* pJS_TimerObj = static_cast<CJS_TimerObj*>(pJSObj); - GlobalTimer::Cancel(pJS_TimerObj->GetTimerID()); + GlobalTimer::Cancel(static_cast<CJS_TimerObj*>(pJSObj)->GetTimerID()); } CJS_Return CJS_App::execMenuItem( |