5#include "flutter/shell/common/shell.h"
7#include "flutter/benchmarking/benchmarking.h"
8#include "flutter/fml/logging.h"
9#include "flutter/runtime/dart_vm.h"
10#include "flutter/shell/common/thread_host.h"
11#include "flutter/testing/elf_loader.h"
12#include "flutter/testing/testing.h"
18 bool measure_shutdown) {
21 std::unique_ptr<Shell>
shell;
22 std::unique_ptr<ThreadHost> thread_host;
29 settings.task_observer_remove = [](intptr_t) {};
36 <<
"Could not set up settings with AOT symbols.";
38 settings.application_kernels = [&]() {
39 std::vector<std::unique_ptr<const fml::Mapping>> kernel_mappings;
40 kernel_mappings.emplace_back(
42 return kernel_mappings;
49 ThreadHost::Type::kIo | ThreadHost::Type::kUi));
52 thread_host->platform_thread->GetTaskRunner(),
53 thread_host->raster_thread->GetTaskRunner(),
54 thread_host->ui_thread->GetTaskRunner(),
55 thread_host->io_thread->GetTaskRunner());
60 return std::make_unique<PlatformView>(
shell,
shell.GetTaskRunners());
75 state, !measure_shutdown || !measure_startup);
78 [&latch]() { latch.Signal(); });
87 thread_host->platform_thread->GetTaskRunner(),
88 [&
shell, &latch]()
mutable {
100 while (
state.KeepRunning()) {
108 while (
state.KeepRunning()) {
116 while (
state.KeepRunning()) {
static bool IsRunningPrecompiledCode()
Checks if VM instances in the process can run precompiled code. This call can be made at any time and...
static std::unique_ptr< Shell > Create(const PlatformData &platform_data, const TaskRunners &task_runners, Settings settings, const CreateCallback< PlatformView > &on_create_platform_view, const CreateCallback< Rasterizer > &on_create_rasterizer, bool is_gpu_disabled=false)
Creates a shell instance using the provided settings. The callbacks to create the various shell subco...
static std::unique_ptr< FileMapping > CreateReadOnly(const std::string &path)
static void RunNowOrPostTask(const fml::RefPtr< fml::TaskRunner > &runner, const fml::closure &task)
@ kRaster
Suitable for thread which raster data.
#define FML_CHECK(condition)
const char * GetFixturesPath()
Returns the directory containing the test fixture for the target if this target has fixtures configur...
ELFAOTSymbols LoadELFSymbolFromFixturesIfNeccessary(std::string elf_filename)
Attempts to resolve AOT symbols from the portable ELF loader. This location is automatically resolved...
bool PrepareSettingsForAOTWithSymbols(Settings &settings, const ELFAOTSymbols &symbols)
Prepare the settings objects various AOT mappings resolvers with the symbols already loaded....
constexpr const char * kDefaultAOTAppELFFileName
static void BM_ShellInitialization(benchmark::State &state)
static void StartupAndShutdownShell(benchmark::State &state, bool measure_startup, bool measure_shutdown)
BENCHMARK(BM_PathVolatilityTracker) -> Unit(benchmark::kMillisecond)
static void BM_ShellInitializationAndShutdown(benchmark::State &state)
static void BM_ShellShutdown(benchmark::State &state)
fml::UniqueFD OpenDirectory(const char *path, bool create_if_necessary, FilePermission permission)
std::function< void()> closure