Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(129)

Side by Side Diff: testing/js_embedder_test.cpp

Issue 2019383002: Fix V8 isolate setup in embedder tests and roll V8 to 055bfa7. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « DEPS ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 PDFium Authors. All rights reserved. 1 // Copyright 2015 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "testing/js_embedder_test.h" 5 #include "testing/js_embedder_test.h"
6 6
7 JSEmbedderTest::JSEmbedderTest() 7 JSEmbedderTest::JSEmbedderTest()
8 : m_pArrayBufferAllocator(new FXJS_ArrayBufferAllocator) { 8 : m_pArrayBufferAllocator(new FXJS_ArrayBufferAllocator),
9 m_pIsolate(nullptr) {}
10
11 JSEmbedderTest::~JSEmbedderTest() {
12 }
13
14 void JSEmbedderTest::SetUp() {
9 v8::Isolate::CreateParams params; 15 v8::Isolate::CreateParams params;
10 params.array_buffer_allocator = m_pArrayBufferAllocator.get(); 16 params.array_buffer_allocator = m_pArrayBufferAllocator.get();
11 m_pIsolate = v8::Isolate::New(params); 17 m_pIsolate = v8::Isolate::New(params);
Lei Zhang 2016/05/30 20:19:20 Is this going to leak?
12 }
13 18
14 JSEmbedderTest::~JSEmbedderTest() {
15 m_pIsolate->Dispose();
16 }
17
18 void JSEmbedderTest::SetUp() {
19 EmbedderTest::SetExternalIsolate(m_pIsolate); 19 EmbedderTest::SetExternalIsolate(m_pIsolate);
20 EmbedderTest::SetUp(); 20 EmbedderTest::SetUp();
21 21
22 v8::Isolate::Scope isolate_scope(m_pIsolate); 22 v8::Isolate::Scope isolate_scope(m_pIsolate);
23 #ifdef PDF_ENABLE_XFA 23 #ifdef PDF_ENABLE_XFA
24 v8::Locker locker(m_pIsolate); 24 v8::Locker locker(m_pIsolate);
25 #endif // PDF_ENABLE_XFA 25 #endif // PDF_ENABLE_XFA
26 v8::HandleScope handle_scope(m_pIsolate); 26 v8::HandleScope handle_scope(m_pIsolate);
27 FXJS_PerIsolateData::SetUp(m_pIsolate); 27 FXJS_PerIsolateData::SetUp(m_pIsolate);
28 FXJS_InitializeRuntime(m_pIsolate, nullptr, &m_pPersistentContext, 28 FXJS_InitializeRuntime(m_pIsolate, nullptr, &m_pPersistentContext,
29 &m_StaticObjects); 29 &m_StaticObjects);
30 } 30 }
31 31
32 void JSEmbedderTest::TearDown() { 32 void JSEmbedderTest::TearDown() {
33 FXJS_ReleaseRuntime(m_pIsolate, &m_pPersistentContext, &m_StaticObjects); 33 FXJS_ReleaseRuntime(m_pIsolate, &m_pPersistentContext, &m_StaticObjects);
34 m_pPersistentContext.Reset(); 34 m_pPersistentContext.Reset();
35 FXJS_Release(); 35 FXJS_Release();
36 EmbedderTest::TearDown(); 36 EmbedderTest::TearDown();
37 m_pIsolate = nullptr;
37 } 38 }
38 39
39 v8::Isolate* JSEmbedderTest::isolate() { 40 v8::Isolate* JSEmbedderTest::isolate() {
40 return m_pIsolate; 41 return m_pIsolate;
41 } 42 }
42 43
43 v8::Local<v8::Context> JSEmbedderTest::GetV8Context() { 44 v8::Local<v8::Context> JSEmbedderTest::GetV8Context() {
44 return m_pPersistentContext.Get(m_pIsolate); 45 return m_pPersistentContext.Get(m_pIsolate);
45 } 46 }
OLDNEW
« no previous file with comments | « DEPS ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698