Remove use of v8:Lockers
The entire code base is single-threaded, hence the lockers
ought not be required.
Review-Url: https://codereview.chromium.org/2026933002
diff --git a/fpdfsdk/javascript/cjs_context.cpp b/fpdfsdk/javascript/cjs_context.cpp
index 66a3e07..c8630ab 100644
--- a/fpdfsdk/javascript/cjs_context.cpp
+++ b/fpdfsdk/javascript/cjs_context.cpp
@@ -30,9 +30,6 @@
FX_BOOL CJS_Context::RunScript(const CFX_WideString& script,
CFX_WideString* info) {
v8::Isolate::Scope isolate_scope(m_pRuntime->GetIsolate());
-#ifdef PDF_ENABLE_XFA
- v8::Locker locker(m_pRuntime->GetIsolate());
-#endif // PDF_ENABLE_XFA
v8::HandleScope handle_scope(m_pRuntime->GetIsolate());
v8::Local<v8::Context> context = m_pRuntime->NewJSContext();
v8::Context::Scope context_scope(context);
diff --git a/fpdfsdk/javascript/cjs_runtime.cpp b/fpdfsdk/javascript/cjs_runtime.cpp
index bcdc17c..9cbf1b0 100644
--- a/fpdfsdk/javascript/cjs_runtime.cpp
+++ b/fpdfsdk/javascript/cjs_runtime.cpp
@@ -88,7 +88,6 @@
v8::Isolate* isolate = m_isolate;
v8::Isolate::Scope isolate_scope(isolate);
- v8::Locker locker(isolate);
v8::HandleScope handle_scope(isolate);
if (CPDFXFA_App::GetInstance()->IsJavaScriptInitialized()) {
CJS_Context* pContext = (CJS_Context*)NewContext();
@@ -128,9 +127,6 @@
void CJS_Runtime::DefineJSObjects() {
v8::Isolate::Scope isolate_scope(GetIsolate());
-#ifdef PDF_ENABLE_XFA
- v8::Locker locker(GetIsolate());
-#endif
v8::HandleScope handle_scope(GetIsolate());
v8::Local<v8::Context> context = v8::Context::New(GetIsolate());
v8::Context::Scope context_scope(context);
@@ -197,9 +193,6 @@
void CJS_Runtime::SetReaderDocument(CPDFSDK_Document* pReaderDoc) {
if (m_pDocument != pReaderDoc) {
v8::Isolate::Scope isolate_scope(m_isolate);
-#ifdef PDF_ENABLE_XFA
- v8::Locker locker(m_isolate);
-#endif
v8::HandleScope handle_scope(m_isolate);
v8::Local<v8::Context> context =
v8::Local<v8::Context>::New(m_isolate, m_context);
@@ -265,7 +258,6 @@
#ifdef PDF_ENABLE_XFA
const FX_CHAR* name = utf8Name.c_str();
- v8::Locker lock(GetIsolate());
v8::Isolate::Scope isolate_scope(GetIsolate());
v8::HandleScope handle_scope(GetIsolate());
v8::Local<v8::Context> old_context = GetIsolate()->GetCurrentContext();
@@ -302,7 +294,6 @@
return FALSE;
const FX_CHAR* name = utf8Name.c_str();
v8::Isolate* pIsolate = GetIsolate();
- v8::Locker lock(pIsolate);
v8::Isolate::Scope isolate_scope(pIsolate);
v8::HandleScope handle_scope(pIsolate);
v8::Local<v8::Context> context =
diff --git a/fpdfsdk/javascript/public_methods_embeddertest.cpp b/fpdfsdk/javascript/public_methods_embeddertest.cpp
index 1fc967b..80ec649 100644
--- a/fpdfsdk/javascript/public_methods_embeddertest.cpp
+++ b/fpdfsdk/javascript/public_methods_embeddertest.cpp
@@ -21,9 +21,6 @@
TEST_F(PublicMethodsEmbedderTest, MakeRegularDate) {
v8::Isolate::Scope isolate_scope(isolate());
-#ifdef PDF_ENABLE_XFA
- v8::Locker locker(isolate());
-#endif // PDF_ENABLE_XFA
v8::HandleScope handle_scope(isolate());
v8::Context::Scope context_scope(GetV8Context());
bool bWrongFormat;
@@ -104,9 +101,6 @@
TEST_F(PublicMethodsEmbedderTest, MakeFormatDate) {
v8::Isolate::Scope isolate_scope(isolate());
-#ifdef PDF_ENABLE_XFA
- v8::Locker locker(isolate());
-#endif // PDF_ENABLE_XFA
v8::HandleScope handle_scope(isolate());
v8::Context::Scope context_scope(GetV8Context());
CFX_WideString formatted_date;
diff --git a/fpdfsdk/jsapi/fxjs_v8.cpp b/fpdfsdk/jsapi/fxjs_v8.cpp
index a471d56..f8c2a3d 100644
--- a/fpdfsdk/jsapi/fxjs_v8.cpp
+++ b/fpdfsdk/jsapi/fxjs_v8.cpp
@@ -312,9 +312,6 @@
++g_isolate_ref_count;
v8::Isolate::Scope isolate_scope(pIsolate);
-#ifdef PDF_ENABLE_XFA
- v8::Locker locker(pIsolate);
-#endif // PDF_ENABLE_XFA
v8::HandleScope handle_scope(pIsolate);
v8::Local<v8::Context> v8Context =
v8::Context::New(pIsolate, NULL, GetGlobalObjectTemplate(pIsolate));
@@ -363,9 +360,6 @@
v8::Global<v8::Context>* pV8PersistentContext,
std::vector<v8::Global<v8::Object>*>* pStaticObjects) {
v8::Isolate::Scope isolate_scope(pIsolate);
-#ifdef PDF_ENABLE_XFA
- v8::Locker locker(pIsolate);
-#endif // PDF_ENABLE_XFA
v8::HandleScope handle_scope(pIsolate);
v8::Local<v8::Context> context =
v8::Local<v8::Context>::New(pIsolate, *pV8PersistentContext);
diff --git a/fpdfsdk/jsapi/fxjs_v8_embeddertest.cpp b/fpdfsdk/jsapi/fxjs_v8_embeddertest.cpp
index e89bb28..161487f 100644
--- a/fpdfsdk/jsapi/fxjs_v8_embeddertest.cpp
+++ b/fpdfsdk/jsapi/fxjs_v8_embeddertest.cpp
@@ -36,9 +36,6 @@
TEST_F(FXJSV8EmbedderTest, Getters) {
v8::Isolate::Scope isolate_scope(isolate());
-#ifdef PDF_ENABLE_XFA
- v8::Locker locker(isolate());
-#endif // PDF_ENABLE_XFA
v8::HandleScope handle_scope(isolate());
v8::Context::Scope context_scope(GetV8Context());
@@ -48,9 +45,6 @@
TEST_F(FXJSV8EmbedderTest, MultipleRutimes) {
v8::Isolate::Scope isolate_scope(isolate());
-#ifdef PDF_ENABLE_XFA
- v8::Locker locker(isolate());
-#endif // PDF_ENABLE_XFA
v8::HandleScope handle_scope(isolate());
v8::Global<v8::Context> global_context1;
diff --git a/testing/js_embedder_test.cpp b/testing/js_embedder_test.cpp
index 4815cd5..bdd1573 100644
--- a/testing/js_embedder_test.cpp
+++ b/testing/js_embedder_test.cpp
@@ -19,9 +19,6 @@
EmbedderTest::SetUp();
v8::Isolate::Scope isolate_scope(m_pIsolate);
-#ifdef PDF_ENABLE_XFA
- v8::Locker locker(m_pIsolate);
-#endif // PDF_ENABLE_XFA
v8::HandleScope handle_scope(m_pIsolate);
FXJS_PerIsolateData::SetUp(m_pIsolate);
FXJS_InitializeRuntime(m_pIsolate, nullptr, &m_pPersistentContext,
diff --git a/xfa/fxjse/runtime.cpp b/xfa/fxjse/runtime.cpp
index 64d685b..70d90c4 100644
--- a/xfa/fxjse/runtime.cpp
+++ b/xfa/fxjse/runtime.cpp
@@ -36,12 +36,9 @@
}
static void FXJSE_Runtime_DisposeCallback(v8::Isolate* pIsolate) {
- {
- v8::Locker locker(pIsolate);
- if (FXJS_PerIsolateData* pData = FXJS_PerIsolateData::Get(pIsolate)) {
- delete pData->m_pFXJSERuntimeData;
- pData->m_pFXJSERuntimeData = nullptr;
- }
+ if (FXJS_PerIsolateData* pData = FXJS_PerIsolateData::Get(pIsolate)) {
+ delete pData->m_pFXJSERuntimeData;
+ pData->m_pFXJSERuntimeData = nullptr;
}
pIsolate->Dispose();
}
diff --git a/xfa/fxjse/scope_inline.h b/xfa/fxjse/scope_inline.h
index 90b20fc..8ef9c85 100644
--- a/xfa/fxjse/scope_inline.h
+++ b/xfa/fxjse/scope_inline.h
@@ -14,7 +14,6 @@
public:
explicit CFXJSE_ScopeUtil_IsolateHandle(v8::Isolate* pIsolate)
: m_isolate(pIsolate),
- m_locker(pIsolate),
m_iscope(pIsolate),
m_hscope(pIsolate) {}
v8::Isolate* GetIsolate() { return m_isolate; }
@@ -27,7 +26,6 @@
void operator delete(void*, size_t) = delete;
v8::Isolate* m_isolate;
- v8::Locker m_locker;
v8::Isolate::Scope m_iscope;
v8::HandleScope m_hscope;
};