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/inspect/component/cpp/component.h>
7#include <lib/syslog/cpp/log_settings.h>
8#include <lib/trace-provider/provider.h>
9#include <lib/trace/event.h>
10
11#include <cstdlib>
12
13#include "fml/message_loop.h"
14#include "lib/async/default.h"
15#include "logging.h"
16#include "platform/utils.h"
17#include "runner.h"
21
22int main(int argc, char const* argv[]) {
24
25 // Set up logging.
26 fuchsia_logging::LogSettingsBuilder()
27 .WithTags({LOG_TAG})
28 .WithDispatcher(async_get_default_dispatcher())
29 .BuildAndInitialize();
30
31 // Create our component context which is served later.
32 auto context = sys::ComponentContext::Create();
34 auto build_info = dart_utils::RootInspectNode::CreateRootChild("build_info");
36
37 // We inject the 'vm' node into the dart vm so that it can add any inspect
38 // data that it needs to the inspect tree.
39 dart::SetDartVmNode(std::make_unique<inspect::Node>(
41
42 std::unique_ptr<trace::TraceProviderWithFdio> provider;
43 {
44 bool already_started;
45 // Use CreateSynchronously to prevent loss of early events.
46 trace::TraceProviderWithFdio::CreateSynchronously(
47 async_get_default_dispatcher(), "flutter_runner", &provider,
48 &already_started);
49 }
50
52 flutter_runner::Runner runner(loop.GetTaskRunner(), context.get());
53
54 // Wait to serve until we have finished all of our setup.
55 context->outgoing()->ServeFromStartupInfo();
56
57 loop.Run();
58
59 return EXIT_SUCCESS;
60}
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:22