diff options
author | Tom Sepez <tsepez@chromium.org> | 2015-11-10 15:07:08 -0800 |
---|---|---|
committer | Tom Sepez <tsepez@chromium.org> | 2015-11-10 15:07:08 -0800 |
commit | 7d4c74d1b96d82681d49519c129262a1568e87d4 (patch) | |
tree | f1417bd69f8960f072b3fef8309ff092a8380605 /fpdfsdk/src/jsapi/fxjs_v8_embeddertest.cpp | |
parent | 46960a43145ab978ca3c90cb6133bb3d5600ad1d (diff) | |
download | pdfium-7d4c74d1b96d82681d49519c129262a1568e87d4.tar.xz |
Keep "static" objects per-context rather than per isolate.
Every time we initialize a new v8::Context, we make a new set of
pre-existing native objects, and overwrite the v8::Global
handles to those in the previous set. Thus, we may be
theoretically releasing some v8::Globals early.
R=jochen@chromium.org
Review URL: https://codereview.chromium.org/1424933013 .
Diffstat (limited to 'fpdfsdk/src/jsapi/fxjs_v8_embeddertest.cpp')
-rw-r--r-- | fpdfsdk/src/jsapi/fxjs_v8_embeddertest.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/fpdfsdk/src/jsapi/fxjs_v8_embeddertest.cpp b/fpdfsdk/src/jsapi/fxjs_v8_embeddertest.cpp index b965ced32e..eaaee86d67 100644 --- a/fpdfsdk/src/jsapi/fxjs_v8_embeddertest.cpp +++ b/fpdfsdk/src/jsapi/fxjs_v8_embeddertest.cpp @@ -32,11 +32,12 @@ class FXJSV8Embeddertest : public EmbedderTest { v8::Isolate::Scope isolate_scope(m_pIsolate); v8::HandleScope handle_scope(m_pIsolate); FXJS_PerIsolateData::SetUp(m_pIsolate); - FXJS_InitializeRuntime(m_pIsolate, nullptr, m_pPersistentContext); + FXJS_InitializeRuntime(m_pIsolate, nullptr, &m_pPersistentContext, + &m_StaticObjects); } void TearDown() override { - FXJS_ReleaseRuntime(m_pIsolate, m_pPersistentContext); + FXJS_ReleaseRuntime(m_pIsolate, &m_pPersistentContext, &m_StaticObjects); m_pPersistentContext.Reset(); FXJS_Release(); EmbedderTest::TearDown(); @@ -51,6 +52,7 @@ class FXJSV8Embeddertest : public EmbedderTest { nonstd::unique_ptr<FXJS_ArrayBufferAllocator> m_pArrayBufferAllocator; v8::Isolate* m_pIsolate; v8::Global<v8::Context> m_pPersistentContext; + std::vector<v8::Global<v8::Object>*> m_StaticObjects; }; TEST_F(FXJSV8Embeddertest, Getters) { |