Chris Bracken 06b29ae838 [trace clients] Replace trace-provider with trace-provider-with-fdio
PT-63

Change-Id: I9acd5aeba5f82e6d58ec324f0f64bf109a413410

Ported from Topaz tree.
2019-06-28 17:40:00 -07:00

45 lines
1.2 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>
#if !defined(FUCHSIA_SDK)
#include <trace-provider/provider.h>
#include <trace/event.h>
#endif
#include <cstdlib>
#include "loop.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));
#if !defined(FUCHSIA_SDK)
std::unique_ptr<trace::TraceProviderWithFdio> provider;
{
TRACE_DURATION("flutter", "CreateTraceProvider");
bool already_started;
// Use CreateSynchronously to prevent loss of early events.
trace::TraceProviderWithFdio::CreateSynchronously(
loop->dispatcher(), "flutter_runner", &provider, &already_started);
}
#endif
// Set up the process-wide /tmp memfs.
dart_utils::SetupRunnerTemp();
FML_DLOG(INFO) << "Flutter application services initialized.";
flutter_runner::Runner runner(loop.get());
loop->Run();
FML_DLOG(INFO) << "Flutter application services terminated.";
return EXIT_SUCCESS;
}