提交 67a42cd1 编写于 作者: A Adam Barth 提交者: GitHub

Fix hot reloading (#2890)

We were creating the task runner adaptor before the underlying base::Thread had
a TaskRunner to adapt. Now we wait until after we start the thread.
上级 5f75e0bf
......@@ -20,7 +20,9 @@ void RunClosure(ftl::Closure task) {
} // namespace
TaskRunnerAdaptor::TaskRunnerAdaptor(scoped_refptr<base::TaskRunner> runner)
: runner_(std::move(runner)) {}
: runner_(std::move(runner)) {
FTL_DCHECK(runner_);
}
TaskRunnerAdaptor::~TaskRunnerAdaptor() {}
......
......@@ -16,14 +16,14 @@ class Thread::ThreadImpl : public base::Thread {
ThreadImpl(std::string name) : base::Thread(std::move(name)) {}
};
Thread::Thread(std::string name) : impl_(new ThreadImpl(name)) {
task_runner_ = ftl::MakeRefCounted<TaskRunnerAdaptor>(impl_->task_runner());
}
Thread::Thread(std::string name) : impl_(new ThreadImpl(name)) {}
Thread::~Thread() {}
bool Thread::Start() {
return impl_->Start();
bool result = impl_->Start();
task_runner_ = ftl::MakeRefCounted<TaskRunnerAdaptor>(impl_->task_runner());
return result;
}
} // namespace glue
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册