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

Unified Diff: remoting/client/plugin/main_plugin_thread_task_runner.cc

Issue 1410923004: Replace PluginThreadTaskRunner with a simpler MainPluginThreadTaskRunner. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@fix_mac_test
Patch Set: Created 5 years, 2 months 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
Index: remoting/client/plugin/main_plugin_thread_task_runner.cc
diff --git a/remoting/client/plugin/main_plugin_thread_task_runner.cc b/remoting/client/plugin/main_plugin_thread_task_runner.cc
new file mode 100644
index 0000000000000000000000000000000000000000..35095ab29e1011cc5ab9258978e9b235dfc0cf33
--- /dev/null
+++ b/remoting/client/plugin/main_plugin_thread_task_runner.cc
@@ -0,0 +1,42 @@
+// Copyright 2015 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 "remoting/client/plugin/main_plugin_thread_task_runner.h"
+
+#include "base/bind.h"
+#include "ppapi/cpp/core.h"
+
+namespace remoting {
+
+MainPluginThreadTaskRunner::MainPluginThreadTaskRunner()
+ : core_(pp::Module::Get()->core()), callback_factory_(this) {}
+MainPluginThreadTaskRunner::~MainPluginThreadTaskRunner() {}
+
+bool MainPluginThreadTaskRunner::PostDelayedTask(
+ const tracked_objects::Location& from_here,
+ const base::Closure& task,
+ base::TimeDelta delay) {
+ core_->CallOnMainThread(delay.InMilliseconds(),
Wez 2015/10/20 23:05:48 Any risk of e.g. spinning due to this fine-grained
Sergey Ulanov 2015/10/20 23:28:05 Here CallOnMainThread() is guaranteed to be called
Wez 2015/10/20 23:43:52 Right - spinning callers are as bad as spinning in
+ callback_factory_.NewCallback(
+ &MainPluginThreadTaskRunner::RunTask, task));
+ return true;
+}
+
+bool MainPluginThreadTaskRunner::PostNonNestableDelayedTask(
+ const tracked_objects::Location& from_here,
+ const base::Closure& task,
+ base::TimeDelta delay) {
+ return PostDelayedTask(from_here, task, delay);
+}
+
+bool MainPluginThreadTaskRunner::RunsTasksOnCurrentThread() const {
+ return core_->IsMainThread();
+}
+
+void MainPluginThreadTaskRunner::RunTask(int32_t result,
+ const base::Closure& closure) {
+ closure.Run();
+}
+
+} // namespace remoting

Powered by Google App Engine
This is Rietveld 408576698