Commit 7d92e9e2 authored by Yuta Kitamura's avatar Yuta Kitamura Committed by Commit Bot

Use ThreadScheduler::Current() in bindings/.

This CL replaces the occurrences of "Platform::Current()
->CurrentThread()->Scheduler()" with "ThreadScheduler::Current()"
which has the same meaning.

Also, this CL simplifies the code that assumes Thread::Scheduler()
can be null, which is no longer true.

Bug: 826203
Change-Id: I994db5b3be6e5e0f29cfe346dac15b49ca40394e
Reviewed-on: https://chromium-review.googlesource.com/c/1314079Reviewed-by: default avatarYuki Shiino <yukishiino@chromium.org>
Reviewed-by: default avatarAlexander Timin <altimin@chromium.org>
Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Commit-Queue: Yuta Kitamura <yutak@chromium.org>
Cr-Commit-Position: refs/heads/master@{#605271}
parent 21ce588d
......@@ -59,10 +59,9 @@ static size_t GetMemoryUsage() {
namespace blink {
V8GCForContextDispose::V8GCForContextDispose()
: pseudo_idle_timer_(
Platform::Current()->MainThread()->Scheduler()->V8TaskRunner(),
this,
&V8GCForContextDispose::PseudoIdleTimerFired),
: pseudo_idle_timer_(ThreadScheduler::Current()->V8TaskRunner(),
this,
&V8GCForContextDispose::PseudoIdleTimerFired),
force_page_navigation_gc_(false) {
Reset();
}
......
......@@ -695,9 +695,7 @@ void V8Initializer::InitializeMainThread(const intptr_t* reference_table) {
v8_extras_mode, &array_buffer_allocator,
reference_table);
// NOTE: Some threads (namely utility threads) don't have a scheduler.
ThreadScheduler* scheduler =
Platform::Current()->CurrentThread()->Scheduler();
ThreadScheduler* scheduler = ThreadScheduler::Current();
#if defined(USE_V8_CONTEXT_SNAPSHOT)
V8PerIsolateData::V8ContextSnapshotMode v8_context_snapshot_mode =
......@@ -715,10 +713,8 @@ void V8Initializer::InitializeMainThread(const intptr_t* reference_table) {
V8PerIsolateData::V8ContextSnapshotMode::kDontUseSnapshot;
#endif // USE_V8_CONTEXT_SNAPSHOT
v8::Isolate* isolate = V8PerIsolateData::Initialize(
scheduler ? scheduler->V8TaskRunner()
: Platform::Current()->CurrentThread()->GetTaskRunner(),
v8_context_snapshot_mode);
v8::Isolate* isolate = V8PerIsolateData::Initialize(scheduler->V8TaskRunner(),
v8_context_snapshot_mode);
// ThreadState::isolate_ needs to be set before setting the EmbedderHeapTracer
// as setting the tracer indicates that a V8 garbage collection should trace
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment