Skip to content

Commit

Permalink
Make FML task runner methods virtual so that FXL adaptors in Fuchsia …
Browse files Browse the repository at this point in the history
…are possible. (flutter#5921)
  • Loading branch information
chinmaygarde authored Aug 1, 2018
1 parent 33b4123 commit de5f535
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
4 changes: 1 addition & 3 deletions fml/task_runner.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@
namespace fml {

TaskRunner::TaskRunner(fml::RefPtr<MessageLoopImpl> loop)
: loop_(std::move(loop)) {
FML_CHECK(loop_);
}
: loop_(std::move(loop)) {}

TaskRunner::~TaskRunner() = default;

Expand Down
17 changes: 9 additions & 8 deletions fml/task_runner.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,24 @@ class MessageLoopImpl;

class TaskRunner : public fml::RefCountedThreadSafe<TaskRunner> {
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<fml::TaskRunner> runner,
fml::closure task);

private:
fml::RefPtr<MessageLoopImpl> loop_;

protected:
TaskRunner(fml::RefPtr<MessageLoopImpl> loop);

~TaskRunner();
private:
fml::RefPtr<MessageLoopImpl> loop_;

FML_FRIEND_MAKE_REF_COUNTED(TaskRunner);
FML_FRIEND_REF_COUNTED_THREAD_SAFE(TaskRunner);
Expand Down

0 comments on commit de5f535

Please sign in to comment.