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

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

Issue 594603003: Infrastructure for reading V8's initial snapshot from external files (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: sync Created 6 years, 1 month 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') | gin/v8.isolate » ('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/array_buffer.h"
8 #include "gin/public/isolate_holder.h" 8 #include "gin/public/isolate_holder.h"
9 9
10 #ifdef V8_USE_EXTERNAL_STARTUP_DATA
11 #include "gin/public/isolate_holder.h"
12 #endif
13
10 using v8::Context; 14 using v8::Context;
11 using v8::Local; 15 using v8::Local;
12 using v8::HandleScope; 16 using v8::HandleScope;
13 17
14 namespace gin { 18 namespace gin {
15 19
16 V8Test::V8Test() { 20 V8Test::V8Test() {
17 } 21 }
18 22
19 V8Test::~V8Test() { 23 V8Test::~V8Test() {
20 } 24 }
21 25
22 void V8Test::SetUp() { 26 void V8Test::SetUp() {
27 #ifdef V8_USE_EXTERNAL_STARTUP_DATA
28 gin::IsolateHolder::LoadV8Snapshot();
29 #endif
23 gin::IsolateHolder::Initialize(gin::IsolateHolder::kStrictMode, 30 gin::IsolateHolder::Initialize(gin::IsolateHolder::kStrictMode,
24 gin::ArrayBufferAllocator::SharedInstance()); 31 gin::ArrayBufferAllocator::SharedInstance());
25 instance_.reset(new gin::IsolateHolder); 32 instance_.reset(new gin::IsolateHolder);
26 instance_->isolate()->Enter(); 33 instance_->isolate()->Enter();
27 HandleScope handle_scope(instance_->isolate()); 34 HandleScope handle_scope(instance_->isolate());
28 context_.Reset(instance_->isolate(), Context::New(instance_->isolate())); 35 context_.Reset(instance_->isolate(), Context::New(instance_->isolate()));
29 Local<Context>::New(instance_->isolate(), context_)->Enter(); 36 Local<Context>::New(instance_->isolate(), context_)->Enter();
30 } 37 }
31 38
32 void V8Test::TearDown() { 39 void V8Test::TearDown() {
33 { 40 {
34 HandleScope handle_scope(instance_->isolate()); 41 HandleScope handle_scope(instance_->isolate());
35 Local<Context>::New(instance_->isolate(), context_)->Exit(); 42 Local<Context>::New(instance_->isolate(), context_)->Exit();
36 context_.Reset(); 43 context_.Reset();
37 } 44 }
38 instance_->isolate()->Exit(); 45 instance_->isolate()->Exit();
39 instance_.reset(); 46 instance_.reset();
40 } 47 }
41 48
42 } // namespace gin 49 } // namespace gin
OLDNEW
« no previous file with comments | « gin/test/file_runner.cc ('k') | gin/v8.isolate » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698