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..812a074fe19aa05513aad5f84b9ac59280144ae3 100644 |
| --- a/content/child/blink_platform_impl.cc |
| +++ b/content/child/blink_platform_impl.cc |
| @@ -418,13 +418,28 @@ static int ToMessageID(WebLocalizedString::Name name) { |
| } |
| BlinkPlatformImpl::BlinkPlatformImpl() |
| - : 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), |
| shared_timer_suspended_(0), |
| current_thread_slot_(&DestroyCurrentThread) { |
| - // ChildThread may not exist in some tests. |
| + InternalInit(); |
| +} |
| + |
| +BlinkPlatformImpl::BlinkPlatformImpl( |
|
Sami
2014/11/06 00:22:59
Delegated constructors still blocked it looks like
alex clarke (OOO till 29th)
2014/11/06 00:40:49
Lets just get this patch in :) I can add a fixme
|
| + scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner) |
| + : main_thread_task_runner_(main_thread_task_runner), |
| + shared_timer_func_(NULL), |
| + shared_timer_fire_time_(0.0), |
| + shared_timer_fire_time_was_set_while_suspended_(false), |
| + shared_timer_suspended_(0), |
| + current_thread_slot_(&DestroyCurrentThread) { |
| + InternalInit(); |
| +} |
| + |
| +void BlinkPlatformImpl::InternalInit() { |
| + // ChildThread may not exist in some tests. |
| if (ChildThread::current()) { |
| geofencing_provider_.reset(new WebGeofencingProviderImpl( |
| ChildThread::current()->thread_safe_sender())); |
| @@ -490,12 +505,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() && |
| + main_thread_task_runner_->BelongsToCurrentThread()) { |
|
Sami
2014/11/06 00:22:59
Could you rewrite this in a way that we don't do t
alex clarke (OOO till 29th)
2014/11/06 00:40:49
Done.
|
| + 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 +1012,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( |