Flutter Engine Uber Docs
Docs for the entire Flutter Engine repo.
 
Loading...
Searching...
No Matches
main.cc File Reference
#include <lib/async-loop/cpp/loop.h>
#include <lib/async-loop/default.h>
#include <lib/inspect/component/cpp/component.h>
#include <lib/syslog/cpp/log_settings.h>
#include <lib/trace-provider/provider.h>
#include <lib/trace/event.h>
#include "flutter/fml/logging.h"
#include "flutter/shell/platform/fuchsia/dart_runner/dart_runner.h"
#include "flutter/shell/platform/fuchsia/dart_runner/logging.h"
#include "flutter/shell/platform/fuchsia/runtime/dart/utils/build_info.h"
#include "flutter/shell/platform/fuchsia/runtime/dart/utils/files.h"
#include "flutter/shell/platform/fuchsia/runtime/dart/utils/root_inspect_node.h"
#include "platform/utils.h"
#include "third_party/dart/runtime/include/dart_api.h"

Go to the source code of this file.

Functions

static void RegisterProfilerSymbols (const char *symbols_path, const char *dso_name)
 
int main (int argc, const char **argv)
 

Function Documentation

◆ main()

int main ( int  argc,
const char **  argv 
)

Definition at line 35 of file main.cc.

35 {
36 async::Loop loop(&kAsyncLoopConfigAttachToCurrentThread);
37
38 // Set up logging.
39 fuchsia_logging::LogSettingsBuilder()
40 .WithTags({LOG_TAG})
41 .WithDispatcher(loop.dispatcher())
42 .BuildAndInitialize();
43
44 // Create our component context which is served later.
45 auto context = sys::ComponentContext::Create();
47 auto build_info = dart_utils::RootInspectNode::CreateRootChild("build_info");
49
50 dart::SetDartVmNode(std::make_unique<inspect::Node>(
52
53 std::unique_ptr<trace::TraceProviderWithFdio> provider;
54 {
55 bool already_started;
56 // Use CreateSynchronously to prevent loss of early events.
57 trace::TraceProviderWithFdio::CreateSynchronously(
58 loop.dispatcher(), "dart_runner", &provider, &already_started);
59 }
60
61#if !defined(DART_PRODUCT)
62#if defined(AOT_RUNTIME)
63 RegisterProfilerSymbols("pkg/data/dart_aot_runner.dartprofilersymbols", "");
64#else
65 RegisterProfilerSymbols("pkg/data/dart_jit_runner.dartprofilersymbols", "");
66#endif // defined(AOT_RUNTIME)
67#endif // !defined(DART_PRODUCT)
68
69 dart_runner::DartRunner runner(context.get());
70
71 // Wait to serve until we have finished all of our setup.
72 context->outgoing()->ServeFromStartupInfo();
73
74 loop.Run();
75 return 0;
76}
static void Dump(inspect::Node &node)
static void Initialize(sys::ComponentContext *context)
static inspect::Node CreateRootChild(const std::string &name)
#define LOG_TAG
Definition logging.h:11
static void RegisterProfilerSymbols(const char *symbols_path, const char *dso_name)
Definition main.cc:23

References dart_utils::RootInspectNode::CreateRootChild(), dart_utils::BuildInfo::Dump(), dart_utils::RootInspectNode::Initialize(), LOG_TAG, and RegisterProfilerSymbols().

◆ RegisterProfilerSymbols()

static void RegisterProfilerSymbols ( const char *  symbols_path,
const char *  dso_name 
)
static

Definition at line 23 of file main.cc.

24 {
25 std::string* symbols = new std::string();
26 if (dart_utils::ReadFileToString(symbols_path, symbols)) {
27 Dart_AddSymbols(dso_name, symbols->data(), symbols->size());
28 } else {
29 FML_LOG(ERROR) << "Failed to load " << symbols_path;
30 FML_CHECK(false);
31 }
32}
#define FML_LOG(severity)
Definition logging.h:101
#define FML_CHECK(condition)
Definition logging.h:104
bool ReadFileToString(const std::string &path, std::string *result)
Definition files.cc:56

References FML_CHECK, FML_LOG, and dart_utils::ReadFileToString().

Referenced by main().