Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(428)

Unified Diff: content/child/worker_thread_task_runner.cc

Issue 63843002: Add ChildMessageFilter, a base class for renderer/worker cross-thread MessageFilter (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: RemoveFilter fix Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/child/worker_thread_task_runner.h ('k') | content/content_child.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/child/worker_thread_task_runner.cc
diff --git a/content/child/worker_thread_task_runner.cc b/content/child/worker_thread_task_runner.cc
new file mode 100644
index 0000000000000000000000000000000000000000..fb2a5a89c9007dfef3848cec316ac18776bc4b67
--- /dev/null
+++ b/content/child/worker_thread_task_runner.cc
@@ -0,0 +1,40 @@
+// Copyright 2013 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_thread_task_runner.h"
+
+#include "base/logging.h"
+#include "webkit/child/worker_task_runner.h"
+
+using webkit_glue::WorkerTaskRunner;
+
+namespace content {
+
+WorkerThreadTaskRunner::WorkerThreadTaskRunner(int worker_thread_id)
+ : worker_thread_id_(worker_thread_id) {
+}
+
+scoped_refptr<WorkerThreadTaskRunner> WorkerThreadTaskRunner::current() {
+ int worker_thread_id = WorkerTaskRunner::Instance()->CurrentWorkerId();
+ if (!worker_thread_id)
+ return scoped_refptr<WorkerThreadTaskRunner>();
+ return make_scoped_refptr(new WorkerThreadTaskRunner(worker_thread_id));
+}
+
+bool WorkerThreadTaskRunner::PostDelayedTask(
+ const tracked_objects::Location& /* from_here */,
+ const base::Closure& task,
+ base::TimeDelta delay) {
+ // Currently non-zero delay is not supported.
+ DCHECK(!delay.ToInternalValue());
+ return WorkerTaskRunner::Instance()->PostTask(worker_thread_id_, task);
+}
+
+bool WorkerThreadTaskRunner::RunsTasksOnCurrentThread() const {
+ return worker_thread_id_ == WorkerTaskRunner::Instance()->CurrentWorkerId();
+}
+
+WorkerThreadTaskRunner::~WorkerThreadTaskRunner() {}
+
+} // namespace content
« no previous file with comments | « content/child/worker_thread_task_runner.h ('k') | content/content_child.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698