summaryrefslogtreecommitdiff
path: root/fpdfsdk/src/javascript/JS_Runtime.cpp
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2015-10-08 12:04:40 -0700
committerTom Sepez <tsepez@chromium.org>2015-10-08 12:04:40 -0700
commit287b63d9ab410783d71cf37291f09fd57d3059b4 (patch)
treef7694e057d86f98833830ea1a34c2a2bbdca8399 /fpdfsdk/src/javascript/JS_Runtime.cpp
parent4fa0e27ba39f49ba92fb4c160ab836a6f1dd2893 (diff)
downloadpdfium-287b63d9ab410783d71cf37291f09fd57d3059b4.tar.xz
Wean CJS_Value off of v8::Isolate.
CJS_Values should belong to CJS_Runtimes so that we may eventually cram much of the v8 dependencies down into fxjs. This is a first step; the remaining split in this code between isolate and CJS_Runtime goes away when fxjs provides a CFXJS_Runtime object, and the CJS_Runtime is-a/has-a CFXJS_Runtime. But that can't happen until this is resolved. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1394103002 .
Diffstat (limited to 'fpdfsdk/src/javascript/JS_Runtime.cpp')
-rw-r--r--fpdfsdk/src/javascript/JS_Runtime.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/fpdfsdk/src/javascript/JS_Runtime.cpp b/fpdfsdk/src/javascript/JS_Runtime.cpp
index fcf6ee8795..83e2c9af2a 100644
--- a/fpdfsdk/src/javascript/JS_Runtime.cpp
+++ b/fpdfsdk/src/javascript/JS_Runtime.cpp
@@ -29,10 +29,17 @@
/* ------------------------------ CJS_Runtime ------------------------------ */
+// static
IJS_Runtime* IJS_Runtime::Create(CPDFDoc_Environment* pEnv) {
return new CJS_Runtime(pEnv);
}
+// static
+CJS_Runtime* CJS_Runtime::FromContext(const IJS_Context* cc) {
+ const CJS_Context* pContext = static_cast<const CJS_Context*>(cc);
+ return pContext->GetJSRuntime();
+}
+
CJS_Runtime::CJS_Runtime(CPDFDoc_Environment* pApp)
: m_pApp(pApp),
m_pDocument(NULL),
@@ -115,8 +122,8 @@ void CJS_Runtime::DefineJSObjects() {
// ObjDefIDs 18 - 20 (these can't fail, return void).
CJS_PublicMethods::DefineJSObjects(GetIsolate());
- CJS_GlobalConsts::DefineJSObjects(GetIsolate());
- CJS_GlobalArrays::DefineJSObjects(GetIsolate());
+ CJS_GlobalConsts::DefineJSObjects(this);
+ CJS_GlobalArrays::DefineJSObjects(this);
// ObjDefIDs 21 - 22.
CJS_TimerObj::DefineJSObjects(GetIsolate(), FXJSOBJTYPE_DYNAMIC);