Flutter Engine
main.cc File Reference
#include <lib/async-loop/cpp/loop.h>
#include <lib/async-loop/default.h>
#include <lib/syslog/global.h>
#include <lib/trace-provider/provider.h>
#include <lib/trace/event.h>
#include "dart_runner.h"
#include "flutter/fml/logging.h"
#include "flutter/fml/trace_event.h"
#include "logging.h"
#include "platform/utils.h"
#include "runtime/dart/utils/files.h"
#include "runtime/dart/utils/tempfs.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 34 of file main.cc.

References RegisterProfilerSymbols().

34  {
35  async::Loop loop(&kAsyncLoopConfigAttachToCurrentThread);
36 
37  std::unique_ptr<trace::TraceProviderWithFdio> provider;
38  {
39  bool already_started;
40  // Use CreateSynchronously to prevent loss of early events.
41  trace::TraceProviderWithFdio::CreateSynchronously(
42  loop.dispatcher(), "dart_runner", &provider, &already_started);
43  }
44 
45 #if !defined(DART_PRODUCT)
46 #if defined(AOT_RUNTIME)
47  RegisterProfilerSymbols("pkg/data/dart_aot_runner.dartprofilersymbols", "");
48 #else
49  RegisterProfilerSymbols("pkg/data/dart_jit_runner.dartprofilersymbols", "");
50 #endif // defined(AOT_RUNTIME)
51 #endif // !defined(DART_PRODUCT)
52 
53  dart_utils::RunnerTemp runner_temp;
54  dart_runner::DartRunner runner(dart::ComponentContext());
55  loop.Run();
56  return 0;
57 }
static void RegisterProfilerSymbols(const char *symbols_path, const char *dso_name)
Definition: main.cc:22

◆ RegisterProfilerSymbols()

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

Definition at line 22 of file main.cc.

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

Referenced by main().

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