Filip Filmar fe70fc74a0
[fuchsia] Use dart::ComponentContext() (#17876)
This functionality is added in issue #41523.  Allows runners to request
the singleton instance of `sys::ComponentContext`, while it remains also
accessible to component-specific code that does not have direct access
to top-level objects.

Fixes #41523
2020-04-30 13:27:57 -07:00

39 lines
1.1 KiB
C++

// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <lib/async-loop/cpp/loop.h>
#include <lib/trace-provider/provider.h>
#include <lib/trace/event.h>
#include <cstdlib>
#include "loop.h"
#include "platform/utils.h"
#include "runner.h"
#include "runtime/dart/utils/tempfs.h"
int main(int argc, char const* argv[]) {
std::unique_ptr<async::Loop> loop(flutter_runner::MakeObservableLoop(true));
std::unique_ptr<trace::TraceProviderWithFdio> provider;
{
bool already_started;
// Use CreateSynchronously to prevent loss of early events.
trace::TraceProviderWithFdio::CreateSynchronously(
loop->dispatcher(), "flutter_runner", &provider, &already_started);
}
// Set up the process-wide /tmp memfs.
dart_utils::RunnerTemp runner_temp;
FML_DLOG(INFO) << "Flutter application services initialized.";
flutter_runner::Runner runner(loop.get(), dart::ComponentContext());
loop->Run();
FML_DLOG(INFO) << "Flutter application services terminated.";
return EXIT_SUCCESS;
}