Index: components/scheduler/child/webthread_base.cc |
diff --git a/components/scheduler/child/webthread_base.cc b/components/scheduler/child/webthread_base.cc |
index a48849d35403514f548641cfb2ab805ace71f2bd..71c2b3189c53726ccfa5d12bd0437d3da001438a 100644 |
--- a/components/scheduler/child/webthread_base.cc |
+++ b/components/scheduler/child/webthread_base.cc |
@@ -72,35 +72,6 @@ void WebThreadBase::RemoveTaskObserverInternal( |
base::MessageLoop::current()->RemoveTaskObserver(observer); |
} |
-// RunWebThreadTask takes the ownership of |task| from base::Closure and |
-// deletes it on the first invocation of the closure for thread-safety. |
-// base::Closure made from RunWebThreadTask is copyable but Closure::Run |
-// should be called at most only once. |
-// This is because WebThread::Task can contain RefPtr to a |
-// thread-unsafe-reference-counted object (e.g. WorkerThreadTask can contain |
-// RefPtr to WebKit's StringImpl), and if we don't delete |task| here, |
-// it causes a race condition as follows: |
-// [A] In task->run(), more RefPtr's to the refcounted object can be created, |
-// and the reference counter of the object can be modified via these |
-// RefPtr's (as intended) on the thread where the task is executed. |
-// [B] However, base::Closure still retains the ownership of WebThread::Task |
-// even after RunWebThreadTask is called. |
-// When base::Closure is deleted, WebThread::Task is deleted and the |
-// reference counter of the object is decreased by one, possibly from a |
-// different thread from [A], which is a race condition. |
-// Taking the ownership of |task| here by using scoped_ptr and base::Passed |
-// removes the reference counter modification of [B] and the race condition. |
-// When the closure never runs at all, the corresponding WebThread::Task is |
-// destructed when base::Closure is deleted (like [B]). In this case, there |
-// are no reference counter modification like [A] (because task->run() is not |
-// executed), so there are no race conditions. |
-// See https://crbug.com/390851 for more details. |
-// |
-// static |
-void WebThreadBase::RunWebThreadTask(scoped_ptr<blink::WebThread::Task> task) { |
- task->run(); |
-} |
- |
// static |
void WebThreadBase::RunWebThreadIdleTask( |
scoped_ptr<blink::WebThread::IdleTask> idle_task, |
@@ -108,22 +79,6 @@ void WebThreadBase::RunWebThreadIdleTask( |
idle_task->run((deadline - base::TimeTicks()).InSecondsF()); |
} |
-void WebThreadBase::postTask(const blink::WebTraceLocation& location, |
- Task* task) { |
- postDelayedTask(location, task, 0); |
-} |
- |
-void WebThreadBase::postDelayedTask(const blink::WebTraceLocation& web_location, |
- Task* task, |
- long long delay_ms) { |
- tracked_objects::Location location(web_location.functionName(), |
- web_location.fileName(), -1, nullptr); |
- TaskRunner()->PostDelayedTask( |
- location, |
- base::Bind(RunWebThreadTask, base::Passed(make_scoped_ptr(task))), |
- base::TimeDelta::FromMilliseconds(delay_ms)); |
-} |
- |
void WebThreadBase::postIdleTask(const blink::WebTraceLocation& web_location, |
IdleTask* idle_task) { |
tracked_objects::Location location(web_location.functionName(), |