| Index: xfa/src/fxjse/src/runtime.cpp
|
| diff --git a/xfa/src/fxjse/src/runtime.cpp b/xfa/src/fxjse/src/runtime.cpp
|
| index a7ee67bc2a7d1978ae2914584c4c0d15cd85622d..7943c68480f406ea9600f53c7969b5c23e589984 100644
|
| --- a/xfa/src/fxjse/src/runtime.cpp
|
| +++ b/xfa/src/fxjse/src/runtime.cpp
|
| @@ -9,6 +9,9 @@
|
| #include "runtime.h"
|
| #include "scope_inline.h"
|
|
|
| +// TODO(tsepez): unify embedder data slot usage.
|
| +static const unsigned int kFXJSEEmbedderDataSlot = 1u;
|
| +
|
| // Duplicates fpdfsdk's JS_Runtime.h, but keeps XFA from depending on it.
|
| // TODO(tsepez): make a single version of this.
|
| class FXJSE_ArrayBufferAllocator : public v8::ArrayBuffer::Allocator {
|
| @@ -38,10 +41,10 @@ void FXJSE_Initialize() {
|
| static void FXJSE_Runtime_DisposeCallback(v8::Isolate* pIsolate) {
|
| {
|
| v8::Locker locker(pIsolate);
|
| - CFXJSE_RuntimeData* pRuntimeData =
|
| - reinterpret_cast<CFXJSE_RuntimeData*>(pIsolate->GetData(0));
|
| + CFXJSE_RuntimeData* pRuntimeData = reinterpret_cast<CFXJSE_RuntimeData*>(
|
| + pIsolate->GetData(kFXJSEEmbedderDataSlot));
|
| if (pRuntimeData) {
|
| - pIsolate->SetData(0, NULL);
|
| + pIsolate->SetData(kFXJSEEmbedderDataSlot, NULL);
|
| delete pRuntimeData;
|
| }
|
| }
|
| @@ -73,7 +76,6 @@ void FXJSE_Runtime_Release(FXJSE_HRUNTIME hRuntime) {
|
| }
|
| CFXJSE_RuntimeData* CFXJSE_RuntimeData::Create(v8::Isolate* pIsolate) {
|
| CFXJSE_RuntimeData* pRuntimeData = new CFXJSE_RuntimeData(pIsolate);
|
| - ASSERT(pRuntimeData);
|
| CFXJSE_ScopeUtil_IsolateHandle scope(pIsolate);
|
| v8::Local<v8::FunctionTemplate> hFuncTemplate =
|
| v8::FunctionTemplate::New(pIsolate);
|
| @@ -85,13 +87,12 @@ CFXJSE_RuntimeData* CFXJSE_RuntimeData::Create(v8::Isolate* pIsolate) {
|
| return pRuntimeData;
|
| }
|
| CFXJSE_RuntimeData* CFXJSE_RuntimeData::Get(v8::Isolate* pIsolate) {
|
| - ASSERT(pIsolate);
|
| - CFXJSE_RuntimeData* pRuntimeData =
|
| - static_cast<CFXJSE_RuntimeData*>(pIsolate->GetData(0));
|
| + CFXJSE_RuntimeData* pRuntimeData = static_cast<CFXJSE_RuntimeData*>(
|
| + pIsolate->GetData(kFXJSEEmbedderDataSlot));
|
| if (!pRuntimeData) {
|
| pRuntimeData = CFXJSE_RuntimeData::Create(pIsolate);
|
| ASSERT(pRuntimeData);
|
| - pIsolate->SetData(0, pRuntimeData);
|
| + pIsolate->SetData(kFXJSEEmbedderDataSlot, pRuntimeData);
|
| }
|
| return pRuntimeData;
|
| }
|
|
|