Flutter Engine Uber Docs
Docs for the entire Flutter Engine repo.
 
Loading...
Searching...
No Matches
main.cc
Go to the documentation of this file.
1// Copyright 2013 The Flutter Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include <lib/async-loop/cpp/loop.h>
6#include <lib/async/default.h>
7#include <lib/inspect/component/cpp/component.h>
8#include <lib/syslog/cpp/log_settings.h>
9#include <lib/trace-provider/provider.h>
10#include <lib/trace/event.h>
11
12#include <cstdlib>
13
19#include "platform/utils.h"
20
21int main(int argc, char const* argv[]) {
23
24 // Set up logging.
25 fuchsia_logging::LogSettingsBuilder()
26 .WithTags({LOG_TAG})
27 .WithDispatcher(async_get_default_dispatcher())
28 .BuildAndInitialize();
29
30 // Create our component context which is served later.
31 auto context = sys::ComponentContext::Create();
33 auto build_info = dart_utils::RootInspectNode::CreateRootChild("build_info");
35
36 // We inject the 'vm' node into the dart vm so that it can add any inspect
37 // data that it needs to the inspect tree.
38 dart::SetDartVmNode(std::make_unique<inspect::Node>(
40
41 std::unique_ptr<trace::TraceProviderWithFdio> provider;
42 {
43 bool already_started;
44 // Use CreateSynchronously to prevent loss of early events.
45 trace::TraceProviderWithFdio::CreateSynchronously(
46 async_get_default_dispatcher(), "flutter_runner", &provider,
47 &already_started);
48 }
49
51 flutter_runner::Runner runner(loop.GetTaskRunner(), context.get());
52
53 // Wait to serve until we have finished all of our setup.
54 context->outgoing()->ServeFromStartupInfo();
55
56 loop.Run();
57
58 return EXIT_SUCCESS;
59}
static void Dump(inspect::Node &node)
static void Initialize(sys::ComponentContext *context)
static inspect::Node CreateRootChild(const std::string &name)
static void EnsureInitializedForCurrentThread()
fml::RefPtr< fml::TaskRunner > GetTaskRunner() const
static FML_EMBEDDER_ONLY MessageLoop & GetCurrent()
T * get() const
Definition ref_ptr.h:117
char ** argv
Definition library.h:9
#define LOG_TAG
Definition logging.h:11
int main(int argc, char const *argv[])
Definition main.cc:21