From ddaa40fe873070d3aae9a21b9a93848fc7e809f1 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Wed, 6 Jun 2018 18:30:15 +0000 Subject: 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 Reviewed-by: dsinclair --- fxjs/cjs_app.cpp | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'fxjs/cjs_app.cpp') 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 pObj = pRuntime->GetThisObj(); - if (CFXJS_Engine::GetObjDefnID(pObj) == CJS_Document::GetObjDefnID()) - pJSDocument = static_cast(pRuntime->GetObjectPrivate(pObj)); - + if (CFXJS_Engine::GetObjDefnID(pObj) == CJS_Document::GetObjDefnID()) { + pJSDocument = + static_cast(CFXJS_Engine::GetObjectPrivate(pObj)); + } v8::Local 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(pRuntime->GetObjectPrivate(pRetObj)); + auto* pJS_TimerObj = + static_cast(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(pRuntime->GetObjectPrivate(pRetObj)); + auto* pJS_TimerObj = + static_cast(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(pJSObj); - GlobalTimer::Cancel(pJS_TimerObj->GetTimerID()); + GlobalTimer::Cancel(static_cast(pJSObj)->GetTimerID()); } CJS_Return CJS_App::execMenuItem( -- cgit v1.2.3