From b4694249b336d1c0bea9222880b49dcf9284791d Mon Sep 17 00:00:00 2001 From: tsepez Date: Mon, 15 Aug 2016 16:44:55 -0700 Subject: Push v8::Isolate into CFXJS_Engine class Nearly all the "loose" functions in FXJS become methods on the CFJXS_Engine. This is the "missing link" wrt some layering violatons that have been around forever. We can stop passing &m_ variables from CJS_ down into FXJS Initialization as a result. Review-Url: https://codereview.chromium.org/2245863002 --- testing/js_embedder_test.cpp | 11 ++++++----- testing/js_embedder_test.h | 4 ++-- 2 files changed, 8 insertions(+), 7 deletions(-) (limited to 'testing') diff --git a/testing/js_embedder_test.cpp b/testing/js_embedder_test.cpp index 1b21fe04db..f7aa7e38f7 100644 --- a/testing/js_embedder_test.cpp +++ b/testing/js_embedder_test.cpp @@ -21,13 +21,14 @@ void JSEmbedderTest::SetUp() { v8::Isolate::Scope isolate_scope(m_pIsolate); v8::HandleScope handle_scope(m_pIsolate); FXJS_PerIsolateData::SetUp(m_pIsolate); - FXJS_InitializeEngine(m_pIsolate, nullptr, &m_pPersistentContext, - &m_StaticObjects); + m_Engine.reset(new CFXJS_Engine); + m_Engine->SetIsolate(m_pIsolate); + m_Engine->InitializeEngine(); } void JSEmbedderTest::TearDown() { - FXJS_ReleaseEngine(m_pIsolate, &m_pPersistentContext, &m_StaticObjects); - m_pPersistentContext.Reset(); + m_Engine->ReleaseEngine(); + m_Engine.reset(); EmbedderTest::TearDown(); m_pIsolate->Dispose(); m_pIsolate = nullptr; @@ -38,5 +39,5 @@ v8::Isolate* JSEmbedderTest::isolate() { } v8::Local JSEmbedderTest::GetV8Context() { - return m_pPersistentContext.Get(m_pIsolate); + return m_Engine->GetPersistentContext(); } diff --git a/testing/js_embedder_test.h b/testing/js_embedder_test.h index b2bd5a87b1..f0beb1eb29 100644 --- a/testing/js_embedder_test.h +++ b/testing/js_embedder_test.h @@ -21,12 +21,12 @@ class JSEmbedderTest : public EmbedderTest { v8::Isolate* isolate(); v8::Local GetV8Context(); + CFXJS_Engine* engine() { return m_Engine.get(); } private: std::unique_ptr m_pArrayBufferAllocator; v8::Isolate* m_pIsolate; - v8::Global m_pPersistentContext; - std::vector*> m_StaticObjects; + std::unique_ptr m_Engine; }; #endif // TESTING_JS_EMBEDDER_TEST_H_ -- cgit v1.2.3