Chromium Code Reviews| Index: content/child/blink_platform_impl.cc |
| diff --git a/content/child/blink_platform_impl.cc b/content/child/blink_platform_impl.cc |
| index 79f72adcffcbe5daa58d9d36e8d9587f52cc11ce..a05fea4538ae497d9631510fc0a789bab2528684 100644 |
| --- a/content/child/blink_platform_impl.cc |
| +++ b/content/child/blink_platform_impl.cc |
| @@ -418,7 +418,7 @@ static int ToMessageID(WebLocalizedString::Name name) { |
| } |
| BlinkPlatformImpl::BlinkPlatformImpl() |
|
Sami
2014/11/04 01:59:01
Could we make main_thread_task_runner a parameter
alex clarke (OOO till 29th)
2014/11/04 18:40:20
I've added a new constructor rather than altering
|
| - : main_loop_(base::MessageLoop::current()), |
| + : main_thread_task_runner_(base::MessageLoopProxy::current()), |
| shared_timer_func_(NULL), |
| shared_timer_fire_time_(0.0), |
| shared_timer_fire_time_was_set_while_suspended_(false), |
| @@ -490,12 +490,17 @@ blink::WebThread* BlinkPlatformImpl::currentThread() { |
| if (thread) |
| return (thread); |
| - scoped_refptr<base::MessageLoopProxy> message_loop = |
| + scoped_refptr<base::SingleThreadTaskRunner> task_runner = |
| base::MessageLoopProxy::current(); |
| - if (!message_loop.get()) |
| + if (main_thread_task_runner_.get() && |
|
Sami
2014/11/04 01:59:01
|main_thread_task_runner_| should always be non-nu
alex clarke (OOO till 29th)
2014/11/04 18:40:20
That's not always true and in fact the browser wil
|
| + main_thread_task_runner_->BelongsToCurrentThread()) { |
| + task_runner = main_thread_task_runner_; |
| + } |
| + |
| + if (!task_runner.get()) |
| return NULL; |
| - thread = new WebThreadImplForMessageLoop(message_loop.get()); |
| + thread = new WebThreadImplForMessageLoop(task_runner); |
| current_thread_slot_.Set(thread); |
| return thread; |
| } |
| @@ -992,7 +997,7 @@ void BlinkPlatformImpl::stopSharedTimer() { |
| void BlinkPlatformImpl::callOnMainThread( |
| void (*func)(void*), void* context) { |
| - main_loop_->PostTask(FROM_HERE, base::Bind(func, context)); |
| + main_thread_task_runner_->PostTask(FROM_HERE, base::Bind(func, context)); |
| } |
| blink::WebGestureCurve* BlinkPlatformImpl::createFlingAnimationCurve( |