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

Side by Side Diff: gin/test/v8_test.cc

Issue 553903003: Refactor IsolateHolder to be able to always create the isolate (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: updates Created 6 years, 3 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 | « gin/test/file_runner.cc ('k') | mojo/apps/js/main.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium 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 "gin/test/v8_test.h" 5 #include "gin/test/v8_test.h"
6 6
7 #include "gin/array_buffer.h"
7 #include "gin/public/isolate_holder.h" 8 #include "gin/public/isolate_holder.h"
8 9
9 using v8::Context; 10 using v8::Context;
10 using v8::Local; 11 using v8::Local;
11 using v8::HandleScope; 12 using v8::HandleScope;
12 13
13 namespace gin { 14 namespace gin {
14 15
15 V8Test::V8Test() { 16 V8Test::V8Test() {
16 } 17 }
17 18
18 V8Test::~V8Test() { 19 V8Test::~V8Test() {
19 } 20 }
20 21
21 void V8Test::SetUp() { 22 void V8Test::SetUp() {
22 instance_.reset(new gin::IsolateHolder(gin::IsolateHolder::kStrictMode)); 23 gin::IsolateHolder::Initialize(gin::IsolateHolder::kStrictMode,
24 gin::ArrayBufferAllocator::SharedInstance());
25 instance_.reset(new gin::IsolateHolder);
23 instance_->isolate()->Enter(); 26 instance_->isolate()->Enter();
24 HandleScope handle_scope(instance_->isolate()); 27 HandleScope handle_scope(instance_->isolate());
25 context_.Reset(instance_->isolate(), Context::New(instance_->isolate())); 28 context_.Reset(instance_->isolate(), Context::New(instance_->isolate()));
26 Local<Context>::New(instance_->isolate(), context_)->Enter(); 29 Local<Context>::New(instance_->isolate(), context_)->Enter();
27 } 30 }
28 31
29 void V8Test::TearDown() { 32 void V8Test::TearDown() {
30 { 33 {
31 HandleScope handle_scope(instance_->isolate()); 34 HandleScope handle_scope(instance_->isolate());
32 Local<Context>::New(instance_->isolate(), context_)->Exit(); 35 Local<Context>::New(instance_->isolate(), context_)->Exit();
33 context_.Reset(); 36 context_.Reset();
34 } 37 }
35 instance_->isolate()->Exit(); 38 instance_->isolate()->Exit();
36 instance_.reset(); 39 instance_.reset();
37 } 40 }
38 41
39 } // namespace gin 42 } // namespace gin
OLDNEW
« no previous file with comments | « gin/test/file_runner.cc ('k') | mojo/apps/js/main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698