diff options
author | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-02-19 06:42:14 +0000 |
---|---|---|
committer | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-02-19 06:42:14 +0000 |
commit | 3dda5851a121c2d424db0a731b7314fee3fd5a3d (patch) | |
tree | df69fe7c90dd41846de91d01d5e3f706967c0a28 /content | |
parent | 400aec2701f8152512dacf97e21559c24f8e6101 (diff) | |
download | chromium_src-3dda5851a121c2d424db0a731b7314fee3fd5a3d.zip chromium_src-3dda5851a121c2d424db0a731b7314fee3fd5a3d.tar.gz chromium_src-3dda5851a121c2d424db0a731b7314fee3fd5a3d.tar.bz2 |
Move WorkerTaskRunner to content/child.
This moves it from webkit/child to content/child, since src/webkit is
dying and it is a trivial move. WorkerTaskRunner has no
dependencies besides base, and nobody in webkit/ is using it, just
content.
BUG=265753
TEST=content_shell and content_unittests
R=jochen@chromium.org,jam@chromium.org,darin@chromium.org
TBR=darin
Review URL: https://codereview.chromium.org/165373004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@251975 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
21 files changed, 263 insertions, 51 deletions
diff --git a/content/child/fileapi/webfilesystem_impl.cc b/content/child/fileapi/webfilesystem_impl.cc index 7d265a4..c149afd 100644 --- a/content/child/fileapi/webfilesystem_impl.cc +++ b/content/child/fileapi/webfilesystem_impl.cc @@ -15,6 +15,7 @@ #include "content/child/child_thread.h" #include "content/child/fileapi/file_system_dispatcher.h" #include "content/child/fileapi/webfilewriter_impl.h" +#include "content/child/worker_task_runner.h" #include "content/common/fileapi/file_system_messages.h" #include "third_party/WebKit/public/platform/WebFileInfo.h" #include "third_party/WebKit/public/platform/WebFileSystemCallbacks.h" @@ -22,7 +23,6 @@ #include "third_party/WebKit/public/platform/WebURL.h" #include "third_party/WebKit/public/web/WebHeap.h" #include "url/gurl.h" -#include "webkit/child/worker_task_runner.h" #include "webkit/common/fileapi/directory_entry.h" #include "webkit/common/fileapi/file_system_util.h" @@ -32,7 +32,6 @@ using blink::WebFileSystemEntry; using blink::WebString; using blink::WebURL; using blink::WebVector; -using webkit_glue::WorkerTaskRunner; namespace content { diff --git a/content/child/fileapi/webfilesystem_impl.h b/content/child/fileapi/webfilesystem_impl.h index d37f9a3..40cc2e0 100644 --- a/content/child/fileapi/webfilesystem_impl.h +++ b/content/child/fileapi/webfilesystem_impl.h @@ -11,8 +11,8 @@ #include "base/compiler_specific.h" #include "base/memory/ref_counted.h" #include "base/threading/non_thread_safe.h" +#include "content/child/worker_task_runner.h" #include "third_party/WebKit/public/platform/WebFileSystem.h" -#include "webkit/child/worker_task_runner.h" namespace base { class MessageLoopProxy; @@ -26,10 +26,9 @@ class WebFileWriterClient; namespace content { -class WebFileSystemImpl - : public blink::WebFileSystem, - public webkit_glue::WorkerTaskRunner::Observer, - public base::NonThreadSafe { +class WebFileSystemImpl : public blink::WebFileSystem, + public WorkerTaskRunner::Observer, + public base::NonThreadSafe { public: // Returns thread-specific instance. If non-null |main_thread_loop| // is given and no thread-specific instance has been created it may @@ -45,7 +44,7 @@ class WebFileSystemImpl explicit WebFileSystemImpl(base::MessageLoopProxy* main_thread_loop); virtual ~WebFileSystemImpl(); - // webkit_glue::WorkerTaskRunner::Observer implementation. + // WorkerTaskRunner::Observer implementation. virtual void OnWorkerRunLoopStopped() OVERRIDE; // WebFileSystem implementation. diff --git a/content/child/fileapi/webfilewriter_impl.cc b/content/child/fileapi/webfilewriter_impl.cc index d93289f..2c9b480 100644 --- a/content/child/fileapi/webfilewriter_impl.cc +++ b/content/child/fileapi/webfilewriter_impl.cc @@ -9,9 +9,7 @@ #include "base/synchronization/waitable_event.h" #include "content/child/child_thread.h" #include "content/child/fileapi/file_system_dispatcher.h" -#include "webkit/child/worker_task_runner.h" - -using webkit_glue::WorkerTaskRunner; +#include "content/child/worker_task_runner.h" namespace content { diff --git a/content/child/indexed_db/indexed_db_dispatcher.cc b/content/child/indexed_db/indexed_db_dispatcher.cc index a43b310..72b91fa 100644 --- a/content/child/indexed_db/indexed_db_dispatcher.cc +++ b/content/child/indexed_db/indexed_db_dispatcher.cc @@ -32,7 +32,6 @@ using blink::WebIDBMetadata; using blink::WebString; using blink::WebVector; using base::ThreadLocalPointer; -using webkit_glue::WorkerTaskRunner; namespace content { static base::LazyInstance<ThreadLocalPointer<IndexedDBDispatcher> >::Leaky @@ -75,7 +74,7 @@ IndexedDBDispatcher* IndexedDBDispatcher::ThreadSpecificInstance( IndexedDBDispatcher* dispatcher = new IndexedDBDispatcher(thread_safe_sender); if (WorkerTaskRunner::Instance()->CurrentWorkerId()) - webkit_glue::WorkerTaskRunner::Instance()->AddStopObserver(dispatcher); + WorkerTaskRunner::Instance()->AddStopObserver(dispatcher); return dispatcher; } diff --git a/content/child/indexed_db/indexed_db_dispatcher.h b/content/child/indexed_db/indexed_db_dispatcher.h index babc4a1..6492c7c 100644 --- a/content/child/indexed_db/indexed_db_dispatcher.h +++ b/content/child/indexed_db/indexed_db_dispatcher.h @@ -12,13 +12,13 @@ #include "base/id_map.h" #include "base/memory/ref_counted.h" #include "base/strings/nullable_string16.h" +#include "content/child/worker_task_runner.h" #include "content/common/content_export.h" #include "ipc/ipc_sync_message_filter.h" #include "third_party/WebKit/public/platform/WebIDBCallbacks.h" #include "third_party/WebKit/public/platform/WebIDBCursor.h" #include "third_party/WebKit/public/platform/WebIDBDatabase.h" #include "third_party/WebKit/public/platform/WebIDBDatabaseCallbacks.h" -#include "webkit/child/worker_task_runner.h" struct IndexedDBDatabaseMetadata; struct IndexedDBMsg_CallbacksSuccessCursorContinue_Params; @@ -42,8 +42,7 @@ CONTENT_EXPORT extern const size_t kMaxIDBValueSizeInBytes; // Handle the indexed db related communication for this context thread - the // main thread and each worker thread have their own copies. -class CONTENT_EXPORT IndexedDBDispatcher - : public webkit_glue::WorkerTaskRunner::Observer { +class CONTENT_EXPORT IndexedDBDispatcher : public WorkerTaskRunner::Observer { public: // Constructor made public to allow RenderThreadImpl to own a copy without // failing a NOTREACHED in ThreadSpecificInstance in tests that instantiate @@ -57,7 +56,7 @@ class CONTENT_EXPORT IndexedDBDispatcher static IndexedDBDispatcher* ThreadSpecificInstance( ThreadSafeSender* thread_safe_sender); - // webkit_glue::WorkerTaskRunner::Observer implementation. + // WorkerTaskRunner::Observer implementation. virtual void OnWorkerRunLoopStopped() OVERRIDE; static blink::WebIDBMetadata ConvertMetadata( @@ -176,7 +175,7 @@ class CONTENT_EXPORT IndexedDBDispatcher enum { kAllCursors = -1 }; static int32 CurrentWorkerId() { - return webkit_glue::WorkerTaskRunner::Instance()->CurrentWorkerId(); + return WorkerTaskRunner::Instance()->CurrentWorkerId(); } template <typename T> diff --git a/content/child/indexed_db/webidbdatabase_impl.cc b/content/child/indexed_db/webidbdatabase_impl.cc index 1c9c8ca..22e2aab 100644 --- a/content/child/indexed_db/webidbdatabase_impl.cc +++ b/content/child/indexed_db/webidbdatabase_impl.cc @@ -9,12 +9,12 @@ #include "content/child/indexed_db/indexed_db_dispatcher.h" #include "content/child/indexed_db/indexed_db_key_builders.h" #include "content/child/thread_safe_sender.h" +#include "content/child/worker_task_runner.h" #include "content/common/indexed_db/indexed_db_messages.h" #include "third_party/WebKit/public/platform/WebIDBKeyPath.h" #include "third_party/WebKit/public/platform/WebIDBMetadata.h" #include "third_party/WebKit/public/platform/WebString.h" #include "third_party/WebKit/public/platform/WebVector.h" -#include "webkit/child/worker_task_runner.h" using blink::WebIDBCallbacks; using blink::WebIDBCursor; @@ -26,7 +26,6 @@ using blink::WebIDBKeyPath; using blink::WebIDBKeyRange; using blink::WebString; using blink::WebVector; -using webkit_glue::WorkerTaskRunner; namespace content { diff --git a/content/child/quota_dispatcher.cc b/content/child/quota_dispatcher.cc index ff762ed..8d21d95 100644 --- a/content/child/quota_dispatcher.cc +++ b/content/child/quota_dispatcher.cc @@ -15,14 +15,11 @@ #include "third_party/WebKit/public/platform/WebStorageQuotaType.h" #include "url/gurl.h" -using quota::QuotaStatusCode; -using quota::StorageType; - using blink::WebStorageQuotaCallbacks; using blink::WebStorageQuotaError; using blink::WebStorageQuotaType; - -using webkit_glue::WorkerTaskRunner; +using quota::QuotaStatusCode; +using quota::StorageType; namespace content { diff --git a/content/child/quota_dispatcher.h b/content/child/quota_dispatcher.h index 000777f..b80b194 100644 --- a/content/child/quota_dispatcher.h +++ b/content/child/quota_dispatcher.h @@ -11,7 +11,7 @@ #include "base/basictypes.h" #include "base/id_map.h" #include "base/memory/ref_counted.h" -#include "webkit/child/worker_task_runner.h" +#include "content/child/worker_task_runner.h" #include "webkit/common/quota/quota_types.h" class GURL; @@ -33,7 +33,7 @@ class QuotaMessageFilter; // process from/to the main browser process. There is one instance // per each thread. Thread-specific instance can be obtained by // ThreadSpecificInstance(). -class QuotaDispatcher : public webkit_glue::WorkerTaskRunner::Observer { +class QuotaDispatcher : public WorkerTaskRunner::Observer { public: class Callback { public: @@ -53,7 +53,7 @@ class QuotaDispatcher : public webkit_glue::WorkerTaskRunner::Observer { ThreadSafeSender* thread_safe_sender, QuotaMessageFilter* quota_message_filter); - // webkit_glue::WorkerTaskRunner::Observer implementation. + // WorkerTaskRunner::Observer implementation. virtual void OnWorkerRunLoopStopped() OVERRIDE; void OnMessageReceived(const IPC::Message& msg); diff --git a/content/child/service_worker/service_worker_dispatcher.cc b/content/child/service_worker/service_worker_dispatcher.cc index def3a44..b9da048 100644 --- a/content/child/service_worker/service_worker_dispatcher.cc +++ b/content/child/service_worker/service_worker_dispatcher.cc @@ -14,7 +14,6 @@ using blink::WebServiceWorkerError; using blink::WebServiceWorkerProvider; using base::ThreadLocalPointer; -using webkit_glue::WorkerTaskRunner; namespace content { @@ -90,7 +89,7 @@ ServiceWorkerDispatcher* ServiceWorkerDispatcher::ThreadSpecificInstance( ServiceWorkerDispatcher* dispatcher = new ServiceWorkerDispatcher(thread_safe_sender); if (WorkerTaskRunner::Instance()->CurrentWorkerId()) - webkit_glue::WorkerTaskRunner::Instance()->AddStopObserver(dispatcher); + WorkerTaskRunner::Instance()->AddStopObserver(dispatcher); return dispatcher; } diff --git a/content/child/service_worker/service_worker_dispatcher.h b/content/child/service_worker/service_worker_dispatcher.h index 72be706..a3a1abc 100644 --- a/content/child/service_worker/service_worker_dispatcher.h +++ b/content/child/service_worker/service_worker_dispatcher.h @@ -8,9 +8,9 @@ #include "base/id_map.h" #include "base/memory/ref_counted.h" #include "base/strings/string16.h" +#include "content/child/worker_task_runner.h" #include "third_party/WebKit/public/platform/WebServiceWorkerError.h" #include "third_party/WebKit/public/platform/WebServiceWorkerProvider.h" -#include "webkit/child/worker_task_runner.h" class GURL; @@ -30,7 +30,7 @@ class WebServiceWorkerImpl; // This class manages communication with the browser process about // registration of the service worker, exposed to renderer and worker // scripts through methods like navigator.registerServiceWorker(). -class ServiceWorkerDispatcher : public webkit_glue::WorkerTaskRunner::Observer { +class ServiceWorkerDispatcher : public WorkerTaskRunner::Observer { public: explicit ServiceWorkerDispatcher(ThreadSafeSender* thread_safe_sender); virtual ~ServiceWorkerDispatcher(); @@ -54,7 +54,7 @@ class ServiceWorkerDispatcher : public webkit_glue::WorkerTaskRunner::Observer { ThreadSafeSender* thread_safe_sender); private: - // webkit_glue::WorkerTaskRunner::Observer implementation. + // WorkerTaskRunner::Observer implementation. virtual void OnWorkerRunLoopStopped() OVERRIDE; // The asynchronous success response to RegisterServiceWorker. diff --git a/content/child/webkitplatformsupport_child_impl.cc b/content/child/webkitplatformsupport_child_impl.cc index b08ef7dd..d45407e 100644 --- a/content/child/webkitplatformsupport_child_impl.cc +++ b/content/child/webkitplatformsupport_child_impl.cc @@ -8,11 +8,11 @@ #include "base/memory/scoped_ptr.h" #include "base/synchronization/waitable_event.h" #include "content/child/web_discardable_memory_impl.h" +#include "content/child/worker_task_runner.h" #include "third_party/WebKit/public/platform/WebWaitableEvent.h" #include "third_party/WebKit/public/web/WebInputEvent.h" #include "webkit/child/fling_curve_configuration.h" #include "webkit/child/webthread_impl.h" -#include "webkit/child/worker_task_runner.h" #if defined(OS_ANDROID) #include "webkit/child/fling_animator_impl_android.h" @@ -120,15 +120,13 @@ blink::WebWaitableEvent* WebKitPlatformSupportChildImpl::waitMultipleEvents( void WebKitPlatformSupportChildImpl::didStartWorkerRunLoop( const blink::WebWorkerRunLoop& runLoop) { - webkit_glue::WorkerTaskRunner* worker_task_runner = - webkit_glue::WorkerTaskRunner::Instance(); + WorkerTaskRunner* worker_task_runner = WorkerTaskRunner::Instance(); worker_task_runner->OnWorkerRunLoopStarted(runLoop); } void WebKitPlatformSupportChildImpl::didStopWorkerRunLoop( const blink::WebWorkerRunLoop& runLoop) { - webkit_glue::WorkerTaskRunner* worker_task_runner = - webkit_glue::WorkerTaskRunner::Instance(); + WorkerTaskRunner* worker_task_runner = WorkerTaskRunner::Instance(); worker_task_runner->OnWorkerRunLoopStopped(runLoop); } diff --git a/content/child/worker_task_runner.cc b/content/child/worker_task_runner.cc new file mode 100644 index 0000000..02c4bab --- /dev/null +++ b/content/child/worker_task_runner.cc @@ -0,0 +1,112 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "content/child/worker_task_runner.h" + +#include "base/callback.h" +#include "base/lazy_instance.h" +#include "base/logging.h" +#include "base/memory/scoped_ptr.h" +#include "base/observer_list.h" + +using blink::WebWorkerRunLoop; + +namespace content { + +namespace { + +class RunClosureTask : public WebWorkerRunLoop::Task { + public: + RunClosureTask(const base::Closure& task) : task_(task) {} + virtual ~RunClosureTask() {} + virtual void Run() { + task_.Run(); + } + private: + base::Closure task_; +}; + +} // namespace + +struct WorkerTaskRunner::ThreadLocalState { + ThreadLocalState(int id, const WebWorkerRunLoop& loop) + : id_(id), run_loop_(loop) { + } + int id_; + WebWorkerRunLoop run_loop_; + ObserverList<WorkerTaskRunner::Observer> stop_observers_; +}; + +WorkerTaskRunner::WorkerTaskRunner() { + // Start worker ids at 1, 0 is reserved for the main thread. + int id = id_sequence_.GetNext(); + DCHECK(!id); +} + +bool WorkerTaskRunner::PostTask( + int id, const base::Closure& closure) { + DCHECK(id > 0); + base::AutoLock locker(loop_map_lock_); + IDToLoopMap::iterator found = loop_map_.find(id); + if (found == loop_map_.end()) + return false; + return found->second.postTask(new RunClosureTask(closure)); +} + +int WorkerTaskRunner::PostTaskToAllThreads(const base::Closure& closure) { + base::AutoLock locker(loop_map_lock_); + IDToLoopMap::iterator it; + for (it = loop_map_.begin(); it != loop_map_.end(); ++it) + it->second.postTask(new RunClosureTask(closure)); + return static_cast<int>(loop_map_.size()); +} + +int WorkerTaskRunner::CurrentWorkerId() { + if (!current_tls_.Get()) + return 0; + return current_tls_.Get()->id_; +} + +WorkerTaskRunner* WorkerTaskRunner::Instance() { + static base::LazyInstance<WorkerTaskRunner>::Leaky + worker_task_runner = LAZY_INSTANCE_INITIALIZER; + return worker_task_runner.Pointer(); +} + +void WorkerTaskRunner::AddStopObserver(Observer* obs) { + DCHECK(CurrentWorkerId() > 0); + current_tls_.Get()->stop_observers_.AddObserver(obs); +} + +void WorkerTaskRunner::RemoveStopObserver(Observer* obs) { + DCHECK(CurrentWorkerId() > 0); + current_tls_.Get()->stop_observers_.RemoveObserver(obs); +} + +WorkerTaskRunner::~WorkerTaskRunner() { +} + +void WorkerTaskRunner::OnWorkerRunLoopStarted(const WebWorkerRunLoop& loop) { + DCHECK(!current_tls_.Get()); + int id = id_sequence_.GetNext(); + current_tls_.Set(new ThreadLocalState(id, loop)); + + base::AutoLock locker_(loop_map_lock_); + loop_map_[id] = loop; +} + +void WorkerTaskRunner::OnWorkerRunLoopStopped(const WebWorkerRunLoop& loop) { + DCHECK(current_tls_.Get()); + FOR_EACH_OBSERVER(Observer, current_tls_.Get()->stop_observers_, + OnWorkerRunLoopStopped()); + { + base::AutoLock locker(loop_map_lock_); + DCHECK(loop_map_[CurrentWorkerId()] == loop); + loop_map_.erase(CurrentWorkerId()); + } + delete current_tls_.Get(); + current_tls_.Set(NULL); +} + +} // namespace content diff --git a/content/child/worker_task_runner.h b/content/child/worker_task_runner.h new file mode 100644 index 0000000..6230551 --- /dev/null +++ b/content/child/worker_task_runner.h @@ -0,0 +1,59 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CONTENT_CHILD_WORKER_TASK_RUNNER_H_ +#define CONTENT_CHILD_WORKER_TASK_RUNNER_H_ + +#include <map> + +#include "base/atomic_sequence_num.h" +#include "base/callback_forward.h" +#include "base/synchronization/lock.h" +#include "base/threading/thread_local.h" +#include "content/common/content_export.h" +#include "third_party/WebKit/public/platform/WebWorkerRunLoop.h" + +namespace content { + +class CONTENT_EXPORT WorkerTaskRunner { + public: + WorkerTaskRunner(); + + bool PostTask(int id, const base::Closure& task); + int PostTaskToAllThreads(const base::Closure& task); + int CurrentWorkerId(); + static WorkerTaskRunner* Instance(); + + class CONTENT_EXPORT Observer { + public: + virtual ~Observer() {} + virtual void OnWorkerRunLoopStopped() = 0; + }; + // Add/Remove an observer that will get notified when the current worker run + // loop is stopping. This observer will not get notified when other threads + // are stopping. It's only valid to call these on a worker thread. + void AddStopObserver(Observer* observer); + void RemoveStopObserver(Observer* observer); + + void OnWorkerRunLoopStarted(const blink::WebWorkerRunLoop& loop); + void OnWorkerRunLoopStopped(const blink::WebWorkerRunLoop& loop); + + private: + friend class WorkerTaskRunnerTest; + + typedef std::map<int, blink::WebWorkerRunLoop> IDToLoopMap; + + ~WorkerTaskRunner(); + + struct ThreadLocalState; + base::ThreadLocalPointer<ThreadLocalState> current_tls_; + + base::AtomicSequenceNumber id_sequence_; + IDToLoopMap loop_map_; + base::Lock loop_map_lock_; +}; + +} // namespace content + +#endif // CONTENT_CHILD_WORKER_TASK_RUNNER_H_ diff --git a/content/child/worker_task_runner_unittest.cc b/content/child/worker_task_runner_unittest.cc new file mode 100644 index 0000000..530c8a2 --- /dev/null +++ b/content/child/worker_task_runner_unittest.cc @@ -0,0 +1,57 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "content/child/worker_task_runner.h" + +#include "base/logging.h" +#include "testing/gmock/include/gmock/gmock.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace content { + +class WorkerTaskRunnerTest : public testing::Test { + public: + void FakeStart() { + task_runner_.OnWorkerRunLoopStarted(blink::WebWorkerRunLoop()); + } + void FakeStop() { + task_runner_.OnWorkerRunLoopStopped(blink::WebWorkerRunLoop()); + } + WorkerTaskRunner task_runner_; +}; + +class MockObserver : public WorkerTaskRunner::Observer { + public: + MOCK_METHOD0(OnWorkerRunLoopStopped, void()); + void RemoveSelfOnNotify() { + ON_CALL(*this, OnWorkerRunLoopStopped()).WillByDefault( + testing::Invoke(this, &MockObserver::RemoveSelf)); + } + void RemoveSelf() { + runner_->RemoveStopObserver(this); + } + WorkerTaskRunner* runner_; +}; + +TEST_F(WorkerTaskRunnerTest, BasicObservingAndWorkerId) { + ASSERT_EQ(0, task_runner_.CurrentWorkerId()); + MockObserver o; + EXPECT_CALL(o, OnWorkerRunLoopStopped()).Times(1); + FakeStart(); + task_runner_.AddStopObserver(&o); + ASSERT_LT(0, task_runner_.CurrentWorkerId()); + FakeStop(); +} + +TEST_F(WorkerTaskRunnerTest, CanRemoveSelfDuringNotification) { + MockObserver o; + o.RemoveSelfOnNotify(); + o.runner_ = &task_runner_; + EXPECT_CALL(o, OnWorkerRunLoopStopped()).Times(1); + FakeStart(); + task_runner_.AddStopObserver(&o); + FakeStop(); +} + +} // namespace content diff --git a/content/child/worker_thread_task_runner.cc b/content/child/worker_thread_task_runner.cc index fb2a5a8..8e5b2e7 100644 --- a/content/child/worker_thread_task_runner.cc +++ b/content/child/worker_thread_task_runner.cc @@ -5,9 +5,7 @@ #include "content/child/worker_thread_task_runner.h" #include "base/logging.h" -#include "webkit/child/worker_task_runner.h" - -using webkit_glue::WorkerTaskRunner; +#include "content/child/worker_task_runner.h" namespace content { diff --git a/content/child/worker_thread_task_runner.h b/content/child/worker_thread_task_runner.h index a4fbc91..54b9ea0 100644 --- a/content/child/worker_thread_task_runner.h +++ b/content/child/worker_thread_task_runner.h @@ -10,7 +10,7 @@ namespace content { // A task runner that runs tasks on a single webkit worker thread which -// is managed by webkit_glue::WorkerTaskRunner. +// is managed by WorkerTaskRunner. // Note that this implementation ignores the delay duration for PostDelayedTask // and have it behave the same as PostTask. class WorkerThreadTaskRunner : public base::TaskRunner { diff --git a/content/content_child.gypi b/content/content_child.gypi index a275f8d..08be4c1 100644 --- a/content/content_child.gypi +++ b/content/content_child.gypi @@ -175,6 +175,8 @@ 'child/webthemeengine_impl_default.h', 'child/webthemeengine_impl_mac.cc', 'child/webthemeengine_impl_mac.h', + 'child/worker_task_runner.cc', + 'child/worker_task_runner.h', 'child/worker_thread_task_runner.cc', 'child/worker_thread_task_runner.h', 'public/child/image_decoder_utils.h', diff --git a/content/content_tests.gypi b/content/content_tests.gypi index e0ffa66..69a839d 100644 --- a/content/content_tests.gypi +++ b/content/content_tests.gypi @@ -516,6 +516,7 @@ 'child/power_monitor_broadcast_source_unittest.cc', 'child/resource_dispatcher_unittest.cc', 'child/site_isolation_policy_unittest.cc', + 'child/worker_task_runner_unittest.cc', 'common/android/address_parser_unittest.cc', 'common/cc_messages_unittest.cc', 'common/common_param_traits_unittest.cc', @@ -625,7 +626,6 @@ '../webkit/browser/fileapi/timed_task_helper_unittest.cc', '../webkit/child/multipart_response_delegate_unittest.cc', '../webkit/child/touch_fling_gesture_curve_unittest.cc', - '../webkit/child/worker_task_runner_unittest.cc', '../webkit/common/blob/shareable_file_reference_unittest.cc', '../webkit/common/cursors/webcursor_unittest.cc', '../webkit/common/database/database_connections_unittest.cc', diff --git a/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc index e27d04f..f7d7a38 100644 --- a/content/renderer/render_thread_impl.cc +++ b/content/renderer/render_thread_impl.cc @@ -21,8 +21,8 @@ #include "base/metrics/stats_table.h" #include "base/path_service.h" #include "base/strings/string16.h" -#include "base/strings/string_tokenizer.h" #include "base/strings/string_number_conversions.h" +#include "base/strings/string_tokenizer.h" #include "base/strings/utf_string_conversions.h" #include "base/threading/thread_local.h" #include "base/threading/thread_restrictions.h" @@ -41,6 +41,7 @@ #include "content/child/runtime_features.h" #include "content/child/thread_safe_sender.h" #include "content/child/web_database_observer_impl.h" +#include "content/child/worker_task_runner.h" #include "content/common/child_process_messages.h" #include "content/common/content_constants_internal.h" #include "content/common/database_messages.h" @@ -112,7 +113,6 @@ #include "ui/base/layout.h" #include "ui/base/ui_base_switches.h" #include "v8/include/v8.h" -#include "webkit/child/worker_task_runner.h" #include "webkit/renderer/compositor_bindings/web_external_bitmap_impl.h" #if defined(OS_WIN) @@ -875,8 +875,7 @@ void RenderThreadImpl::UpdateHistograms(int sequence_number) { } int RenderThreadImpl::PostTaskToAllWebWorkers(const base::Closure& closure) { - return webkit_glue::WorkerTaskRunner::Instance()->PostTaskToAllThreads( - closure); + return WorkerTaskRunner::Instance()->PostTaskToAllThreads(closure); } bool RenderThreadImpl::ResolveProxy(const GURL& url, std::string* proxy_list) { diff --git a/content/renderer/service_worker/embedded_worker_context_client.cc b/content/renderer/service_worker/embedded_worker_context_client.cc index 4bf5558..db1437d 100644 --- a/content/renderer/service_worker/embedded_worker_context_client.cc +++ b/content/renderer/service_worker/embedded_worker_context_client.cc @@ -9,6 +9,7 @@ #include "base/pickle.h" #include "base/threading/thread_local.h" #include "content/child/thread_safe_sender.h" +#include "content/child/worker_task_runner.h" #include "content/child/worker_thread_task_runner.h" #include "content/common/service_worker/embedded_worker_messages.h" #include "content/renderer/render_thread_impl.h" @@ -16,9 +17,6 @@ #include "content/renderer/service_worker/service_worker_script_context.h" #include "ipc/ipc_message_macros.h" #include "third_party/WebKit/public/platform/WebString.h" -#include "webkit/child/worker_task_runner.h" - -using webkit_glue::WorkerTaskRunner; namespace content { diff --git a/content/renderer/service_worker/embedded_worker_dispatcher.cc b/content/renderer/service_worker/embedded_worker_dispatcher.cc index ba83beb..d975479 100644 --- a/content/renderer/service_worker/embedded_worker_dispatcher.cc +++ b/content/renderer/service_worker/embedded_worker_dispatcher.cc @@ -10,6 +10,7 @@ #include "content/child/child_process.h" #include "content/child/scoped_child_process_reference.h" #include "content/child/thread_safe_sender.h" +#include "content/child/worker_task_runner.h" #include "content/common/service_worker/embedded_worker_messages.h" #include "content/renderer/render_thread_impl.h" #include "content/renderer/service_worker/embedded_worker_context_client.h" @@ -17,7 +18,6 @@ #include "third_party/WebKit/public/platform/WebURL.h" #include "third_party/WebKit/public/web/WebEmbeddedWorker.h" #include "third_party/WebKit/public/web/WebEmbeddedWorkerStartData.h" -#include "webkit/child/worker_task_runner.h" #include "webkit/common/user_agent/user_agent.h" namespace content { |