diff options
Diffstat (limited to 'fpdfsdk/src/jsapi')
-rw-r--r-- | fpdfsdk/src/jsapi/fxjs_v8.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/fpdfsdk/src/jsapi/fxjs_v8.cpp b/fpdfsdk/src/jsapi/fxjs_v8.cpp index 2ff515d0ab..3413d72bb3 100644 --- a/fpdfsdk/src/jsapi/fxjs_v8.cpp +++ b/fpdfsdk/src/jsapi/fxjs_v8.cpp @@ -287,7 +287,7 @@ void FXJS_InitializeRuntime(v8::Isolate* pIsolate, v8::Context::Scope context_scope(v8Context); FXJS_PerIsolateData::SetUp(pIsolate); - v8Context->SetAlignedPointerInEmbedderData(kPerContextDataIndex, pIRuntime); + FXJS_SetRuntimeForV8Context(v8Context, pIRuntime); int maxID = CFXJS_ObjDefinition::MaxID(pIsolate); for (int i = 0; i < maxID; ++i) { @@ -361,10 +361,14 @@ void FXJS_ReleaseRuntime(v8::Isolate* pIsolate, delete pData; } -IJS_Runtime* FXJS_GetRuntimeFromIsolate(v8::Isolate* pIsolate) { - v8::Local<v8::Context> context = pIsolate->GetCurrentContext(); +void FXJS_SetRuntimeForV8Context(v8::Local<v8::Context> v8Context, + IJS_Runtime* pIRuntime) { + v8Context->SetAlignedPointerInEmbedderData(kPerContextDataIndex, pIRuntime); +} + +IJS_Runtime* FXJS_GetRuntimeFromV8Context(v8::Local<v8::Context> v8Context) { return static_cast<IJS_Runtime*>( - context->GetAlignedPointerFromEmbedderData(kPerContextDataIndex)); + v8Context->GetAlignedPointerFromEmbedderData(kPerContextDataIndex)); } int FXJS_Execute(v8::Isolate* pIsolate, |