diff options
author | Tom Sepez <tsepez@chromium.org> | 2015-11-20 14:23:02 -0800 |
---|---|---|
committer | Tom Sepez <tsepez@chromium.org> | 2015-11-20 14:23:02 -0800 |
commit | b8ec0a3405c6f184e4b9811870081295cae078c9 (patch) | |
tree | d2b951564b94191968a3f52427ee70c8a09de828 /fpdfsdk/src/jsapi/fxjs_v8.cpp | |
parent | 3f7dc2be794e981a2728b2ae1eddf4a32179db9a (diff) | |
download | pdfium-b8ec0a3405c6f184e4b9811870081295cae078c9.tar.xz |
Mising JS refactoring in XFA.
R=thestig@chromium.org
Review URL: https://codereview.chromium.org/1463973002 .
Diffstat (limited to 'fpdfsdk/src/jsapi/fxjs_v8.cpp')
-rw-r--r-- | fpdfsdk/src/jsapi/fxjs_v8.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/fpdfsdk/src/jsapi/fxjs_v8.cpp b/fpdfsdk/src/jsapi/fxjs_v8.cpp index a3100bec41..9c2c538aa8 100644 --- a/fpdfsdk/src/jsapi/fxjs_v8.cpp +++ b/fpdfsdk/src/jsapi/fxjs_v8.cpp @@ -288,7 +288,7 @@ void FXJS_InitializeRuntime( v8::Context::Scope context_scope(v8Context); FXJS_PerIsolateData::SetUp(pIsolate); - FXJS_SetRuntimeForV8Context(v8Context, pIRuntime); + v8Context->SetAlignedPointerInEmbedderData(kPerContextDataIndex, pIRuntime); int maxID = CFXJS_ObjDefinition::MaxID(pIsolate); pStaticObjects->resize(maxID + 1); @@ -366,16 +366,17 @@ void FXJS_ReleaseRuntime(v8::Isolate* pIsolate, delete pData; } +IJS_Runtime* FXJS_GetRuntimeFromIsolate(v8::Isolate* pIsolate) { + v8::Local<v8::Context> context = pIsolate->GetCurrentContext(); + return static_cast<IJS_Runtime*>( + context->GetAlignedPointerFromEmbedderData(kPerContextDataIndex)); +} + 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*>( - v8Context->GetAlignedPointerFromEmbedderData(kPerContextDataIndex)); -} - int FXJS_Execute(v8::Isolate* pIsolate, IJS_Context* pJSContext, const wchar_t* script, |