| Index: tools/gn/loader.cc
|
| diff --git a/tools/gn/loader.cc b/tools/gn/loader.cc
|
| index 69fb7668e17dd200c23ec5b37a7f591c5f774d5a..5a3f7832e07acb589167fc4b526e8262e28afd3b 100644
|
| --- a/tools/gn/loader.cc
|
| +++ b/tools/gn/loader.cc
|
| @@ -6,8 +6,7 @@
|
|
|
| #include "base/bind.h"
|
| #include "base/memory/ptr_util.h"
|
| -#include "base/message_loop/message_loop.h"
|
| -#include "base/single_thread_task_runner.h"
|
| +#include "base/threading/thread_task_runner_handle.h"
|
| #include "tools/gn/build_settings.h"
|
| #include "tools/gn/err.h"
|
| #include "tools/gn/filesystem_utils.h"
|
| @@ -100,9 +99,11 @@ SourceFile Loader::BuildFileForLabel(const Label& label) {
|
| // -----------------------------------------------------------------------------
|
|
|
| LoaderImpl::LoaderImpl(const BuildSettings* build_settings)
|
| - : main_loop_(base::MessageLoop::current()),
|
| - pending_loads_(0),
|
| - build_settings_(build_settings) {
|
| + : pending_loads_(0), build_settings_(build_settings) {
|
| + // There may not be an active TaskRunner at this point. When that's the case,
|
| + // the calling code is expected to call set_task_runner().
|
| + if (base::ThreadTaskRunnerHandle::IsSet())
|
| + task_runner_ = base::ThreadTaskRunnerHandle::Get();
|
| }
|
|
|
| LoaderImpl::~LoaderImpl() {
|
| @@ -239,7 +240,7 @@ void LoaderImpl::BackgroundLoadFile(const Settings* settings,
|
| const LocationRange& origin,
|
| const ParseNode* root) {
|
| if (!root) {
|
| - main_loop_->task_runner()->PostTask(
|
| + task_runner_->PostTask(
|
| FROM_HERE, base::Bind(&LoaderImpl::DecrementPendingLoads, this));
|
| return;
|
| }
|
| @@ -280,8 +281,7 @@ void LoaderImpl::BackgroundLoadFile(const Settings* settings,
|
|
|
| trace.Done();
|
|
|
| - main_loop_->task_runner()->PostTask(
|
| - FROM_HERE, base::Bind(&LoaderImpl::DidLoadFile, this));
|
| + task_runner_->PostTask(FROM_HERE, base::Bind(&LoaderImpl::DidLoadFile, this));
|
| }
|
|
|
| void LoaderImpl::BackgroundLoadBuildConfig(
|
| @@ -289,7 +289,7 @@ void LoaderImpl::BackgroundLoadBuildConfig(
|
| const Scope::KeyValueMap& toolchain_overrides,
|
| const ParseNode* root) {
|
| if (!root) {
|
| - main_loop_->task_runner()->PostTask(
|
| + task_runner_->PostTask(
|
| FROM_HERE, base::Bind(&LoaderImpl::DecrementPendingLoads, this));
|
| return;
|
| }
|
| @@ -339,9 +339,9 @@ void LoaderImpl::BackgroundLoadBuildConfig(
|
| }
|
| }
|
|
|
| - main_loop_->task_runner()->PostTask(
|
| - FROM_HERE, base::Bind(&LoaderImpl::DidLoadBuildConfig, this,
|
| - settings->toolchain_label()));
|
| + task_runner_->PostTask(FROM_HERE,
|
| + base::Bind(&LoaderImpl::DidLoadBuildConfig, this,
|
| + settings->toolchain_label()));
|
| }
|
|
|
| void LoaderImpl::DidLoadFile() {
|
|
|