Flutter Engine
The Flutter Engine
shell
platform
fuchsia
flutter
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/trace-provider/provider.h>
8
#include <lib/trace/event.h>
9
10
#include <cstdlib>
11
12
#include "
fml/message_loop.h
"
13
#include "
fml/platform/fuchsia/log_interest_listener.h
"
14
#include "
fml/platform/fuchsia/log_state.h
"
15
#include "lib/async/default.h"
16
#include "
logging.h
"
17
#include "
platform/utils.h
"
18
#include "
runner.h
"
19
#include "
runtime/dart/utils/build_info.h
"
20
#include "
runtime/dart/utils/root_inspect_node.h
"
21
#include "
runtime/dart/utils/tempfs.h
"
22
23
int
main
(
int
argc,
char
const
*
argv
[]) {
24
fml::MessageLoop::EnsureInitializedForCurrentThread
();
25
26
// Setup logging.
27
fml::LogState::Default
().
SetTags
({
LOG_TAG
});
28
fml::LogInterestListener
listener(
fml::LogState::Default
().TakeClientEnd(),
29
async_get_default_dispatcher());
30
listener.
AsyncWaitForInterestChanged
();
31
32
// Create our component context which is served later.
33
auto
context =
sys::ComponentContext::Create
();
34
dart_utils::RootInspectNode::Initialize
(context.get());
35
auto
build_info =
dart_utils::RootInspectNode::CreateRootChild
(
"build_info"
);
36
dart_utils::BuildInfo::Dump
(build_info);
37
38
// We inject the 'vm' node into the dart vm so that it can add any inspect
39
// data that it needs to the inspect tree.
40
dart::SetDartVmNode
(std::make_unique<inspect::Node>(
41
dart_utils::RootInspectNode::CreateRootChild
(
"vm"
)));
42
43
std::unique_ptr<trace::TraceProviderWithFdio> provider;
44
{
45
bool
already_started;
46
// Use CreateSynchronously to prevent loss of early events.
47
trace::TraceProviderWithFdio::CreateSynchronously(
48
async_get_default_dispatcher(),
"flutter_runner"
, &provider,
49
&already_started);
50
}
51
52
fml::MessageLoop
& loop =
fml::MessageLoop::GetCurrent
();
53
flutter_runner::Runner
runner(loop.
GetTaskRunner
(), context.
get
());
54
55
// Wait to serve until we have finished all of our setup.
56
context->outgoing()->ServeFromStartupInfo();
57
58
loop.
Run
();
59
60
return
EXIT_SUCCESS;
61
}
Create
static sk_sp< Effect > Create()
Definition:
RefCntTest.cpp:117
build_info.h
dart_utils::BuildInfo::Dump
static void Dump(inspect::Node &node)
Definition:
build_info_in.cc:25
dart_utils::RootInspectNode::Initialize
static void Initialize(sys::ComponentContext *context)
Definition:
root_inspect_node.cc:13
dart_utils::RootInspectNode::CreateRootChild
static inspect::Node CreateRootChild(const std::string &name)
Definition:
root_inspect_node.cc:21
flutter_runner::Runner
Definition:
runner.h:32
fml::LogInterestListener
Definition:
log_interest_listener.h:18
fml::LogInterestListener::AsyncWaitForInterestChanged
void AsyncWaitForInterestChanged()
Definition:
log_interest_listener.cc:16
fml::LogState::SetTags
void SetTags(const std::initializer_list< std::string > &tags)
Definition:
log_state.cc:56
fml::LogState::Default
static LogState & Default()
Definition:
log_state.cc:61
fml::MessageLoop
Definition:
message_loop.h:28
fml::MessageLoop::EnsureInitializedForCurrentThread
static void EnsureInitializedForCurrentThread()
Definition:
message_loop.cc:27
fml::MessageLoop::GetTaskRunner
fml::RefPtr< fml::TaskRunner > GetTaskRunner() const
Definition:
message_loop.cc:56
fml::MessageLoop::GetCurrent
static FML_EMBEDDER_ONLY MessageLoop & GetCurrent()
Definition:
message_loop.cc:19
fml::MessageLoop::Run
void Run()
Definition:
message_loop.cc:48
fml::RefPtr::get
T * get() const
Definition:
ref_ptr.h:116
main
int main(int argc, char **argv)
Definition:
main.cc:407
argv
char ** argv
Definition:
library.h:9
log_interest_listener.h
log_state.h
message_loop.h
dart::SetDartVmNode
void SetDartVmNode(std::unique_ptr< inspect::Node > node)
root_inspect_node.h
runner.h
utils.h
LOG_TAG
#define LOG_TAG
Definition:
logging.h:11
tempfs.h
logging.h
Generated on Sun Jun 23 2024 21:54:56 for Flutter Engine by
1.9.4