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

Side by Side 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "remoting/client/plugin/main_plugin_thread_task_runner.h"
6
7 #include "base/bind.h"
8 #include "ppapi/cpp/core.h"
9
10 namespace remoting {
11
12 MainPluginThreadTaskRunner::MainPluginThreadTaskRunner()
13 : core_(pp::Module::Get()->core()), callback_factory_(this) {}
14 MainPluginThreadTaskRunner::~MainPluginThreadTaskRunner() {}
15
16 bool MainPluginThreadTaskRunner::PostDelayedTask(
17 const tracked_objects::Location& from_here,
18 const base::Closure& task,
19 base::TimeDelta delay) {
20 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
21 callback_factory_.NewCallback(
22 &MainPluginThreadTaskRunner::RunTask, task));
23 return true;
24 }
25
26 bool MainPluginThreadTaskRunner::PostNonNestableDelayedTask(
27 const tracked_objects::Location& from_here,
28 const base::Closure& task,
29 base::TimeDelta delay) {
30 return PostDelayedTask(from_here, task, delay);
31 }
32
33 bool MainPluginThreadTaskRunner::RunsTasksOnCurrentThread() const {
34 return core_->IsMainThread();
35 }
36
37 void MainPluginThreadTaskRunner::RunTask(int32_t result,
38 const base::Closure& closure) {
39 closure.Run();
40 }
41
42 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698