Chromium Code Reviews| Index: content/child/webthread_impl.cc |
| diff --git a/content/child/webthread_impl.cc b/content/child/webthread_impl.cc |
| index 28d687bd5ad08a697f0969a865ff1a33b84a6d87..de385cfc57ead6444b7f0c57d696b1c58faa2a7e 100644 |
| --- a/content/child/webthread_impl.cc |
| +++ b/content/child/webthread_impl.cc |
| @@ -12,6 +12,7 @@ |
| #include "base/message_loop/message_loop.h" |
| #include "base/pending_task.h" |
| #include "base/threading/platform_thread.h" |
| +#include "third_party/WebKit/public/platform/WebTraceLocation.h" |
| namespace content { |
| @@ -88,9 +89,12 @@ static void RunWebThreadTask(scoped_ptr<blink::WebThread::Task> task) { |
| } |
| void WebThreadImpl::postTask(Task* task) { |
| - thread_->message_loop()->PostTask( |
| - FROM_HERE, |
| - base::Bind(RunWebThreadTask, base::Passed(scoped_ptr<Task>(task)))); |
| + postDelayedTask(task, 0); |
| +} |
| + |
| +void WebThreadImpl::postTask(const blink::WebTraceLocation& location, |
| + Task* task) { |
| + postDelayedTask(location, task, 0); |
| } |
| void WebThreadImpl::postDelayedTask(Task* task, long long delay_ms) { |
| @@ -100,6 +104,17 @@ void WebThreadImpl::postDelayedTask(Task* task, long long delay_ms) { |
| base::TimeDelta::FromMilliseconds(delay_ms)); |
| } |
| +void WebThreadImpl::postDelayedTask(const blink::WebTraceLocation& web_location, |
| + Task* task, |
| + long long delay_ms) { |
| + tracked_objects::Location location(web_location.functionName(), |
| + web_location.fileName(), -1, nullptr); |
| + thread_->message_loop()->PostDelayedTask( |
| + location, |
| + base::Bind(RunWebThreadTask, base::Passed(scoped_ptr<Task>(task))), |
|
no sievers
2015/01/23 20:39:47
nit: make_scoped_ptr
Sami
2015/01/26 13:41:17
Thanks, fixed.
|
| + base::TimeDelta::FromMilliseconds(delay_ms)); |
| +} |
| + |
| void WebThreadImpl::enterRunLoop() { |
| CHECK(isCurrentThread()); |
| CHECK(!thread_->message_loop()->is_running()); // We don't support nesting. |
| @@ -130,9 +145,13 @@ WebThreadImplForMessageLoop::WebThreadImplForMessageLoop( |
| thread_id_(base::PlatformThread::CurrentId()) {} |
| void WebThreadImplForMessageLoop::postTask(Task* task) { |
| - main_thread_task_runner_->PostTask( |
| - FROM_HERE, |
| - base::Bind(RunWebThreadTask, base::Passed(make_scoped_ptr(task)))); |
| + postDelayedTask(task, 0); |
| +} |
| + |
| +void WebThreadImplForMessageLoop::postTask( |
| + const blink::WebTraceLocation& location, |
| + Task* task) { |
| + postDelayedTask(location, task, 0); |
| } |
| void WebThreadImplForMessageLoop::postDelayedTask(Task* task, |
| @@ -143,6 +162,18 @@ void WebThreadImplForMessageLoop::postDelayedTask(Task* task, |
| base::TimeDelta::FromMilliseconds(delay_ms)); |
| } |
| +void WebThreadImplForMessageLoop::postDelayedTask( |
| + const blink::WebTraceLocation& web_location, |
| + Task* task, |
| + long long delay_ms) { |
| + tracked_objects::Location location(web_location.functionName(), |
| + web_location.fileName(), -1, nullptr); |
| + main_thread_task_runner_->PostDelayedTask( |
| + location, |
| + base::Bind(RunWebThreadTask, base::Passed(make_scoped_ptr(task))), |
| + base::TimeDelta::FromMilliseconds(delay_ms)); |
| +} |
| + |
| void WebThreadImplForMessageLoop::enterRunLoop() { |
| CHECK(isCurrentThread()); |
| // We don't support nesting. |