From 721ec7f8578afb27b9664641b109d483439b9859 Mon Sep 17 00:00:00 2001 From: sadrul Date: Thu, 26 Feb 2015 07:36:18 -0800 Subject: [PATCH] chrome: Remove the use of WebWorkerRunLoop. WebWorkerRunLoop serves no purpose anymore. So remove its use from chrome. This is part 1 of 3. Part 2: https://codereview.chromium.org/960443002 Part 3: https://codereview.chromium.org/955883002 BUG=461664 Review URL: https://codereview.chromium.org/937313003 Cr-Commit-Position: refs/heads/master@{#318235} --- content/child/blink_platform_impl.cc | 18 +++++++++++++++--- content/child/blink_platform_impl.h | 6 ++++++ content/child/worker_task_runner.cc | 6 ++---- content/child/worker_task_runner.h | 5 ++--- content/child/worker_task_runner_unittest.cc | 4 ++-- 5 files changed, 27 insertions(+), 12 deletions(-) diff --git a/content/child/blink_platform_impl.cc b/content/child/blink_platform_impl.cc index ffea5f9f7bde..0b8777cdc495 100644 --- a/content/child/blink_platform_impl.cc +++ b/content/child/blink_platform_impl.cc @@ -1040,14 +1040,26 @@ blink::WebGestureCurve* BlinkPlatformImpl::createFlingAnimationCurve( void BlinkPlatformImpl::didStartWorkerRunLoop( const blink::WebWorkerRunLoop& runLoop) { - WorkerTaskRunner* worker_task_runner = WorkerTaskRunner::Instance(); - worker_task_runner->OnWorkerRunLoopStarted(runLoop); + // TODO(sad): Remove once this is removed from the blink::Platform interface. + // http://crbug.com/461664 + didStartWorkerRunLoop(); } void BlinkPlatformImpl::didStopWorkerRunLoop( const blink::WebWorkerRunLoop& runLoop) { + // TODO(sad): Remove once this is removed from the blink::Platform interface. + // http://crbug.com/461664 + didStopWorkerRunLoop(); +} + +void BlinkPlatformImpl::didStartWorkerRunLoop() { + WorkerTaskRunner* worker_task_runner = WorkerTaskRunner::Instance(); + worker_task_runner->OnWorkerRunLoopStarted(); +} + +void BlinkPlatformImpl::didStopWorkerRunLoop() { WorkerTaskRunner* worker_task_runner = WorkerTaskRunner::Instance(); - worker_task_runner->OnWorkerRunLoopStopped(runLoop); + worker_task_runner->OnWorkerRunLoopStopped(); } blink::WebCrypto* BlinkPlatformImpl::crypto() { diff --git a/content/child/blink_platform_impl.h b/content/child/blink_platform_impl.h index 2c1764ff5215..9445ea662f59 100644 --- a/content/child/blink_platform_impl.h +++ b/content/child/blink_platform_impl.h @@ -31,6 +31,10 @@ namespace base { class MessageLoop; } +namespace blink { +class WebWorkerRunLoop; +} + namespace content { class FlingCurveConfiguration; class NotificationDispatcher; @@ -153,6 +157,8 @@ class CONTENT_EXPORT BlinkPlatformImpl const blink::WebWorkerRunLoop& runLoop); virtual void didStopWorkerRunLoop( const blink::WebWorkerRunLoop& runLoop); + virtual void didStartWorkerRunLoop(); + virtual void didStopWorkerRunLoop(); virtual blink::WebCrypto* crypto(); virtual blink::WebGeofencingProvider* geofencingProvider(); virtual blink::WebBluetooth* bluetooth(); diff --git a/content/child/worker_task_runner.cc b/content/child/worker_task_runner.cc index 82410fc48a1b..17b4e1654b59 100644 --- a/content/child/worker_task_runner.cc +++ b/content/child/worker_task_runner.cc @@ -14,8 +14,6 @@ #include "base/stl_util.h" #include "base/thread_task_runner_handle.h" -using blink::WebWorkerRunLoop; - namespace content { namespace { @@ -90,7 +88,7 @@ void WorkerTaskRunner::RemoveStopObserver(Observer* obs) { WorkerTaskRunner::~WorkerTaskRunner() { } -void WorkerTaskRunner::OnWorkerRunLoopStarted(const WebWorkerRunLoop& loop) { +void WorkerTaskRunner::OnWorkerRunLoopStarted() { DCHECK(!current_tls_.Get()); DCHECK(!base::PlatformThread::CurrentRef().is_null()); current_tls_.Set(new ThreadLocalState()); @@ -101,7 +99,7 @@ void WorkerTaskRunner::OnWorkerRunLoopStarted(const WebWorkerRunLoop& loop) { CHECK(task_runner_map_[id]); } -void WorkerTaskRunner::OnWorkerRunLoopStopped(const WebWorkerRunLoop& loop) { +void WorkerTaskRunner::OnWorkerRunLoopStopped() { DCHECK(current_tls_.Get()); FOR_EACH_OBSERVER(Observer, current_tls_.Get()->stop_observers_, OnWorkerRunLoopStopped()); diff --git a/content/child/worker_task_runner.h b/content/child/worker_task_runner.h index 8e9ff2846283..2df0185dc1e3 100644 --- a/content/child/worker_task_runner.h +++ b/content/child/worker_task_runner.h @@ -13,7 +13,6 @@ #include "base/threading/platform_thread.h" #include "base/threading/thread_local.h" #include "content/common/content_export.h" -#include "third_party/WebKit/public/platform/WebWorkerRunLoop.h" namespace base { class TaskRunner; @@ -41,8 +40,8 @@ class CONTENT_EXPORT WorkerTaskRunner { void AddStopObserver(Observer* observer); void RemoveStopObserver(Observer* observer); - void OnWorkerRunLoopStarted(const blink::WebWorkerRunLoop& loop); - void OnWorkerRunLoopStopped(const blink::WebWorkerRunLoop& loop); + void OnWorkerRunLoopStarted(); + void OnWorkerRunLoopStopped(); base::TaskRunner* GetTaskRunnerFor(int worker_id); diff --git a/content/child/worker_task_runner_unittest.cc b/content/child/worker_task_runner_unittest.cc index ca231d1395e1..20eddfb9c475 100644 --- a/content/child/worker_task_runner_unittest.cc +++ b/content/child/worker_task_runner_unittest.cc @@ -14,10 +14,10 @@ namespace content { class WorkerTaskRunnerTest : public testing::Test { public: void FakeStart() { - task_runner_.OnWorkerRunLoopStarted(blink::WebWorkerRunLoop()); + task_runner_.OnWorkerRunLoopStarted(); } void FakeStop() { - task_runner_.OnWorkerRunLoopStopped(blink::WebWorkerRunLoop()); + task_runner_.OnWorkerRunLoopStopped(); } WorkerTaskRunner task_runner_; -- 2.11.4.GIT