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

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

Issue 2589363003: Use timer task runner for V8PerIsolate tasks (Closed)
Patch Set: One more fix Created 4 years 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
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/file_runner.h" 5 #include "gin/test/file_runner.h"
6 6
7 #include "base/files/file_util.h" 7 #include "base/files/file_util.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "base/path_service.h" 9 #include "base/path_service.h"
10 #include "base/run_loop.h" 10 #include "base/run_loop.h"
11 #include "base/threading/thread_task_runner_handle.h"
11 #include "gin/array_buffer.h" 12 #include "gin/array_buffer.h"
12 #include "gin/converter.h" 13 #include "gin/converter.h"
13 #include "gin/modules/console.h" 14 #include "gin/modules/console.h"
14 #include "gin/modules/module_registry.h" 15 #include "gin/modules/module_registry.h"
15 #include "gin/public/context_holder.h" 16 #include "gin/public/context_holder.h"
16 #include "gin/public/isolate_holder.h" 17 #include "gin/public/isolate_holder.h"
17 #include "gin/test/file.h" 18 #include "gin/test/file.h"
18 #include "gin/test/gc.h" 19 #include "gin/test/gc.h"
19 #include "gin/test/gtest.h" 20 #include "gin/test/gtest.h"
20 #include "gin/try_catch.h" 21 #include "gin/try_catch.h"
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 63
63 #ifdef V8_USE_EXTERNAL_STARTUP_DATA 64 #ifdef V8_USE_EXTERNAL_STARTUP_DATA
64 gin::V8Initializer::LoadV8Snapshot(); 65 gin::V8Initializer::LoadV8Snapshot();
65 gin::V8Initializer::LoadV8Natives(); 66 gin::V8Initializer::LoadV8Natives();
66 #endif 67 #endif
67 68
68 gin::IsolateHolder::Initialize(gin::IsolateHolder::kStrictMode, 69 gin::IsolateHolder::Initialize(gin::IsolateHolder::kStrictMode,
69 gin::IsolateHolder::kStableV8Extras, 70 gin::IsolateHolder::kStableV8Extras,
70 gin::ArrayBufferAllocator::SharedInstance()); 71 gin::ArrayBufferAllocator::SharedInstance());
71 72
72 gin::IsolateHolder instance; 73 gin::IsolateHolder instance(base::ThreadTaskRunnerHandle::Get());
73 gin::ShellRunner runner(delegate, instance.isolate()); 74 gin::ShellRunner runner(delegate, instance.isolate());
74 { 75 {
75 gin::Runner::Scope scope(&runner); 76 gin::Runner::Scope scope(&runner);
76 instance.isolate()->SetCaptureStackTraceForUncaughtExceptions(true); 77 instance.isolate()->SetCaptureStackTraceForUncaughtExceptions(true);
77 runner.Run(source, path.AsUTF8Unsafe()); 78 runner.Run(source, path.AsUTF8Unsafe());
78 79
79 if (run_until_idle) { 80 if (run_until_idle) {
80 base::RunLoop().RunUntilIdle(); 81 base::RunLoop().RunUntilIdle();
81 } else { 82 } else {
82 base::RunLoop().Run(); 83 base::RunLoop().Run();
83 } 84 }
84 85
85 v8::Local<v8::Value> result = runner.global()->Get( 86 v8::Local<v8::Value> result = runner.global()->Get(
86 StringToSymbol(runner.GetContextHolder()->isolate(), "result")); 87 StringToSymbol(runner.GetContextHolder()->isolate(), "result"));
87 EXPECT_EQ("PASS", V8ToString(result)); 88 EXPECT_EQ("PASS", V8ToString(result));
88 } 89 }
89 } 90 }
90 91
91 } // namespace gin 92 } // namespace gin
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698