Commit 37b558ce authored by alexclarke's avatar alexclarke Committed by Commit bot

TestBlinkWebUnitTestSupport to create the scheduler on the main thread

Rather than lazily creatng the schedueler (which could happen on any
thread), create it in the constructor if there is a message loop.
Frustratingly the problem this solves only shows up if you
run all the webkit_tests, not just one of them.

BUG=391005

Review URL: https://codereview.chromium.org/890333003

Cr-Commit-Position: refs/heads/master@{#314309}
parent 870ebb78
...@@ -64,6 +64,11 @@ TestBlinkWebUnitTestSupport::TestBlinkWebUnitTestSupport() { ...@@ -64,6 +64,11 @@ TestBlinkWebUnitTestSupport::TestBlinkWebUnitTestSupport() {
gin::IsolateHolder::LoadV8Snapshot(); gin::IsolateHolder::LoadV8Snapshot();
#endif #endif
if (base::MessageLoopProxy::current()) {
renderer_scheduler_ = RendererScheduler::Create();
web_scheduler_.reset(new WebSchedulerImpl(renderer_scheduler_.get()));
}
blink::initialize(this); blink::initialize(this);
blink::mainThreadIsolate()->SetCounterFunction( blink::mainThreadIsolate()->SetCounterFunction(
base::StatsTable::FindLocation); base::StatsTable::FindLocation);
...@@ -322,12 +327,6 @@ bool TestBlinkWebUnitTestSupport::getBlobItems( ...@@ -322,12 +327,6 @@ bool TestBlinkWebUnitTestSupport::getBlobItems(
} }
blink::WebScheduler* TestBlinkWebUnitTestSupport::scheduler() { blink::WebScheduler* TestBlinkWebUnitTestSupport::scheduler() {
// Lazily create the WebSchedulerImpl and RendererScheduler if needed.
if (!web_scheduler_) {
if (!renderer_scheduler_)
renderer_scheduler_ = RendererScheduler::Create();
web_scheduler_.reset(new WebSchedulerImpl(renderer_scheduler_.get()));
}
return web_scheduler_.get(); return web_scheduler_.get();
} }
......
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