From de5f535e508ec7cead7098630f41ec145ab47a11 Mon Sep 17 00:00:00 2001 From: Chinmay Garde Date: Wed, 1 Aug 2018 14:18:33 -0700 Subject: [PATCH] Make FML task runner methods virtual so that FXL adaptors in Fuchsia are possible. (#5921) --- fml/task_runner.cc | 4 +--- fml/task_runner.h | 17 +++++++++-------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/fml/task_runner.cc b/fml/task_runner.cc index c21e0fece549e..573c1bb8b7b34 100644 --- a/fml/task_runner.cc +++ b/fml/task_runner.cc @@ -15,9 +15,7 @@ namespace fml { TaskRunner::TaskRunner(fml::RefPtr loop) - : loop_(std::move(loop)) { - FML_CHECK(loop_); -} + : loop_(std::move(loop)) {} TaskRunner::~TaskRunner() = default; diff --git a/fml/task_runner.h b/fml/task_runner.h index 4c77b9fe5a9e3..0a196604fac81 100644 --- a/fml/task_runner.h +++ b/fml/task_runner.h @@ -17,23 +17,24 @@ class MessageLoopImpl; class TaskRunner : public fml::RefCountedThreadSafe { public: - void PostTask(fml::closure task); + virtual void PostTask(fml::closure task); - void PostTaskForTime(fml::closure task, fml::TimePoint target_time); + virtual void PostTaskForTime(fml::closure task, fml::TimePoint target_time); - void PostDelayedTask(fml::closure task, fml::TimeDelta delay); + virtual void PostDelayedTask(fml::closure task, fml::TimeDelta delay); - bool RunsTasksOnCurrentThread(); + virtual bool RunsTasksOnCurrentThread(); + + virtual ~TaskRunner(); static void RunNowOrPostTask(fml::RefPtr runner, fml::closure task); - private: - fml::RefPtr loop_; - + protected: TaskRunner(fml::RefPtr loop); - ~TaskRunner(); + private: + fml::RefPtr loop_; FML_FRIEND_MAKE_REF_COUNTED(TaskRunner); FML_FRIEND_REF_COUNTED_THREAD_SAFE(TaskRunner);