From 51da093564cdfd32a6ac02ad75e981787a0f1b35 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Wed, 25 Nov 2015 16:05:49 -0800 Subject: Inflict PDF_ENABLE_XFA ifdefs on XFA fpdfsdk/ R=thestig@chromium.org Review URL: https://codereview.chromium.org/1477583002 . --- fpdfsdk/src/jsapi/fxjs_v8.cpp | 8 ++++++++ fpdfsdk/src/jsapi/fxjs_v8_embeddertest.cpp | 4 ++++ 2 files changed, 12 insertions(+) (limited to 'fpdfsdk/src/jsapi') diff --git a/fpdfsdk/src/jsapi/fxjs_v8.cpp b/fpdfsdk/src/jsapi/fxjs_v8.cpp index 9a3a268652..d7d2ef54af 100644 --- a/fpdfsdk/src/jsapi/fxjs_v8.cpp +++ b/fpdfsdk/src/jsapi/fxjs_v8.cpp @@ -281,7 +281,9 @@ void FXJS_InitializeRuntime( ++g_isolate_ref_count; v8::Isolate::Scope isolate_scope(pIsolate); +#ifdef PDF_ENABLE_XFA v8::Locker locker(pIsolate); +#endif v8::HandleScope handle_scope(pIsolate); v8::Local v8Context = v8::Context::New(pIsolate, NULL, GetGlobalObjectTemplate(pIsolate)); @@ -325,7 +327,9 @@ void FXJS_ReleaseRuntime(v8::Isolate* pIsolate, v8::Global* pV8PersistentContext, std::vector*>* pStaticObjects) { v8::Isolate::Scope isolate_scope(pIsolate); +#ifdef PDF_ENABLE_XFA v8::Locker locker(pIsolate); +#endif v8::HandleScope handle_scope(pIsolate); v8::Local context = v8::Local::New(pIsolate, *pV8PersistentContext); @@ -335,9 +339,11 @@ void FXJS_ReleaseRuntime(v8::Isolate* pIsolate, if (!pData) return; +#ifdef PDF_ENABLE_XFA // XFA, if present, should have already cleaned itself up. FXSYS_assert(!pData->m_pFXJSERuntimeData); +#endif int maxID = CFXJS_ObjDefinition::MaxID(pIsolate); for (int i = 0; i < maxID; ++i) { CFXJS_ObjDefinition* pObjDef = CFXJS_ObjDefinition::ForID(pIsolate, i); @@ -374,11 +380,13 @@ IJS_Runtime* FXJS_GetRuntimeFromIsolate(v8::Isolate* pIsolate) { context->GetAlignedPointerFromEmbedderData(kPerContextDataIndex)); } +#ifdef PDF_ENABLE_XFA void FXJS_SetRuntimeForV8Context(v8::Local v8Context, IJS_Runtime* pIRuntime) { v8Context->SetAlignedPointerInEmbedderData(kPerContextDataIndex, pIRuntime); } +#endif int FXJS_Execute(v8::Isolate* pIsolate, IJS_Context* pJSContext, const wchar_t* script, diff --git a/fpdfsdk/src/jsapi/fxjs_v8_embeddertest.cpp b/fpdfsdk/src/jsapi/fxjs_v8_embeddertest.cpp index 8e685c9bd4..e7f50e1b94 100644 --- a/fpdfsdk/src/jsapi/fxjs_v8_embeddertest.cpp +++ b/fpdfsdk/src/jsapi/fxjs_v8_embeddertest.cpp @@ -30,7 +30,9 @@ class FXJSV8Embeddertest : public EmbedderTest { EmbedderTest::SetUp(); v8::Isolate::Scope isolate_scope(m_pIsolate); +#ifdef PDF_ENABLE_XFA v8::Locker locker(m_pIsolate); +#endif v8::HandleScope handle_scope(m_pIsolate); FXJS_PerIsolateData::SetUp(m_pIsolate); FXJS_InitializeRuntime(m_pIsolate, nullptr, &m_pPersistentContext, @@ -58,7 +60,9 @@ class FXJSV8Embeddertest : public EmbedderTest { TEST_F(FXJSV8Embeddertest, Getters) { v8::Isolate::Scope isolate_scope(isolate()); +#ifdef PDF_ENABLE_XFA v8::Locker locker(isolate()); +#endif v8::HandleScope handle_scope(isolate()); v8::Context::Scope context_scope(GetV8Context()); -- cgit v1.2.3