Flutter Engine
The Flutter Engine
Namespaces | Macros | Functions | Variables
main_impl.cc File Reference
#include "bin/main_impl.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <memory>
#include <utility>
#include "bin/builtin.h"
#include "bin/console.h"
#include "bin/crashpad.h"
#include "bin/dartdev_isolate.h"
#include "bin/dartutils.h"
#include "bin/dfe.h"
#include "bin/error_exit.h"
#include "bin/exe_utils.h"
#include "bin/file.h"
#include "bin/gzip.h"
#include "bin/isolate_data.h"
#include "bin/loader.h"
#include "bin/main_options.h"
#include "bin/platform.h"
#include "bin/process.h"
#include "bin/snapshot_utils.h"
#include "bin/utils.h"
#include "bin/vmservice_impl.h"
#include "include/bin/dart_io_api.h"
#include "include/bin/native_assets_api.h"
#include "include/dart_api.h"
#include "include/dart_embedder_api.h"
#include "include/dart_tools_api.h"
#include "platform/globals.h"
#include "platform/syslog.h"
#include "platform/utils.h"

Go to the source code of this file.

Namespaces

namespace  dart
 
namespace  dart::bin
 

Macros

#define SAVE_ERROR_AND_EXIT(result)
 
#define CHECK_RESULT(result)
 
#define CHECK_RESULT_CLEANUP(result, cleanup)
 
#define CHECK_RESULT(result)
 

Functions

static void dart::bin::WriteDepsFile ()
 
static void dart::bin::OnExitHook (int64_t exit_code)
 
static Dart_Handle dart::bin::SetupCoreLibraries (Dart_Isolate isolate, IsolateData *isolate_data, bool is_isolate_group_start, bool is_kernel_isolate, const char **resolved_packages_config)
 
static bool dart::bin::OnIsolateInitialize (void **child_callback_data, char **error)
 
static void * dart::bin::NativeAssetsDlopenRelative (const char *path, char **error)
 
static Dart_Isolate dart::bin::IsolateSetupHelper (Dart_Isolate isolate, bool is_main_isolate, const char *script_uri, const char *packages_config, bool isolate_run_app_snapshot, Dart_IsolateFlags *flags, char **error, int *exit_code)
 
static Dart_Isolate dart::bin::CreateAndSetupKernelIsolate (const char *script_uri, const char *packages_config, Dart_IsolateFlags *flags, char **error, int *exit_code)
 
static Dart_Isolate dart::bin::CreateAndSetupServiceIsolate (const char *script_uri, const char *packages_config, Dart_IsolateFlags *flags, char **error, int *exit_code)
 
static Dart_Isolate dart::bin::CreateAndSetupDartDevIsolate (const char *script_uri, const char *packages_config, Dart_IsolateFlags *flags, char **error, int *exit_code)
 
static Dart_Isolate dart::bin::CreateIsolateGroupAndSetupHelper (bool is_main_isolate, const char *script_uri, const char *name, const char *packages_config, Dart_IsolateFlags *flags, void *callback_data, char **error, int *exit_code)
 
static Dart_Isolate dart::bin::CreateIsolateGroupAndSetup (const char *script_uri, const char *main, const char *package_root, const char *package_config, Dart_IsolateFlags *flags, void *callback_data, char **error)
 
static const char * dart::bin::RegisterKernelBlob (const uint8_t *kernel_buffer, intptr_t kernel_buffer_size)
 
static void dart::bin::UnregisterKernelBlob (const char *kernel_blob_uri)
 
static void dart::bin::OnIsolateShutdown (void *isolate_group_data, void *isolate_data)
 
static void dart::bin::DeleteIsolateData (void *isolate_group_data, void *callback_data)
 
static void dart::bin::DeleteIsolateGroupData (void *callback_data)
 
static bool dart::bin::ServiceStreamListenCallback (const char *stream_id)
 
static void dart::bin::ServiceStreamCancelCallback (const char *stream_id)
 
static bool dart::bin::FileModifiedCallback (const char *url, int64_t since)
 
static void dart::bin::EmbedderInformationCallback (Dart_EmbedderInformation *info)
 
static void dart::bin::CompileAndSaveKernel (const char *script_name, const char *package_config_override, CommandLineOptions *dart_options)
 
void dart::bin::RunMainIsolate (const char *script_name, const char *package_config_override, CommandLineOptions *dart_options)
 
static bool dart::bin::CheckForInvalidPath (const char *path)
 
Dart_Handle dart::bin::GetVMServiceAssetsArchiveCallback ()
 
int dart::bin::main (int argc, char **argv)
 

Variables

const uint8_t kDartVmSnapshotData []
 
const uint8_t kDartVmSnapshotInstructions []
 
const uint8_t kDartCoreIsolateSnapshotData []
 
const uint8_t kDartCoreIsolateSnapshotInstructions []
 
const uint8_t * dart::bin::vm_snapshot_data = kDartVmSnapshotData
 
const uint8_t * dart::bin::vm_snapshot_instructions = kDartVmSnapshotInstructions
 
const uint8_t * dart::bin::core_isolate_snapshot_data = kDartCoreIsolateSnapshotData
 
const uint8_t * dart::bin::core_isolate_snapshot_instructions
 
static bool dart::bin::vm_run_app_snapshot = false
 
static char * dart::bin::app_script_uri = nullptr
 
static const uint8_t * dart::bin::app_isolate_snapshot_data = nullptr
 
static const uint8_t * dart::bin::app_isolate_snapshot_instructions = nullptr
 
static bool dart::bin::kernel_isolate_is_running = false
 
static Dart_Isolate dart::bin::main_isolate = nullptr
 
static constexpr const char * dart::bin::kStdoutStreamId = "Stdout"
 
static constexpr const char * dart::bin::kStderrStreamId = "Stderr"
 
unsigned int dart::bin::observatory_assets_archive_len = 0
 
const uint8_t * dart::bin::observatory_assets_archive = observatory_assets_archive_
 

Macro Definition Documentation

◆ CHECK_RESULT [1/2]

#define CHECK_RESULT (   result)
Value:
if (Dart_IsError(result)) { \
SAVE_ERROR_AND_EXIT(result); \
}
DART_EXPORT bool Dart_IsError(Dart_Handle handle)
GAsyncResult * result

Definition at line 969 of file main_impl.cc.

◆ CHECK_RESULT [2/2]

#define CHECK_RESULT (   result)
Value:
if (Dart_IsError(result)) { \
const int exit_code = Dart_IsCompilationError(result) \
ErrorExit(exit_code, "%s\n", Dart_GetError(result)); \
}
DART_EXPORT const char * Dart_GetError(Dart_Handle handle)
DART_EXPORT bool Dart_IsCompilationError(Dart_Handle handle)
constexpr int kCompilationErrorExitCode
Definition: error_exit.h:16
constexpr int kErrorExitCode
Definition: error_exit.h:18

Definition at line 969 of file main_impl.cc.

◆ CHECK_RESULT_CLEANUP

#define CHECK_RESULT_CLEANUP (   result,
  cleanup 
)
Value:
if (Dart_IsError(result)) { \
delete (cleanup); \
SAVE_ERROR_AND_EXIT(result); \
}

Definition at line 93 of file main_impl.cc.

◆ SAVE_ERROR_AND_EXIT

#define SAVE_ERROR_AND_EXIT (   result)
Value:
*error = Utils::StrDup(Dart_GetError(result)); \
*exit_code = kCompilationErrorExitCode; \
} else if (Dart_IsApiError(result)) { \
*exit_code = kApiErrorExitCode; \
} else { \
*exit_code = kErrorExitCode; \
} \
Dart_ExitScope(); \
Dart_ShutdownIsolate(); \
return nullptr;
DART_EXPORT bool Dart_IsApiError(Dart_Handle handle)
const uint8_t uint32_t uint32_t GError ** error
constexpr int kApiErrorExitCode
Definition: error_exit.h:14

Definition at line 75 of file main_impl.cc.

Variable Documentation

◆ kDartCoreIsolateSnapshotData

const uint8_t kDartCoreIsolateSnapshotData[]
extern

Definition at line 13 of file snapshot_empty.cc.

◆ kDartCoreIsolateSnapshotInstructions

const uint8_t kDartCoreIsolateSnapshotInstructions[]
extern

Definition at line 14 of file snapshot_empty.cc.

◆ kDartVmSnapshotData

const uint8_t kDartVmSnapshotData[]
extern

Definition at line 11 of file snapshot_empty.cc.

◆ kDartVmSnapshotInstructions

const uint8_t kDartVmSnapshotInstructions[]
extern

Definition at line 12 of file snapshot_empty.cc.