Flutter Engine
The Flutter Engine
Classes | Namespaces | Macros | Functions | Variables
tester_main.cc File Reference
#include <cstdlib>
#include <cstring>
#include <iostream>
#include "flutter/assets/asset_manager.h"
#include "flutter/assets/directory_asset_bundle.h"
#include "flutter/flow/embedded_views.h"
#include "flutter/fml/build_config.h"
#include "flutter/fml/file.h"
#include "flutter/fml/make_copyable.h"
#include "flutter/fml/message_loop.h"
#include "flutter/fml/paths.h"
#include "flutter/fml/synchronization/waitable_event.h"
#include "flutter/fml/task_runner.h"
#include "flutter/shell/common/platform_view.h"
#include "flutter/shell/common/rasterizer.h"
#include "flutter/shell/common/shell.h"
#include "flutter/shell/common/switches.h"
#include "flutter/shell/common/thread_host.h"
#include "flutter/shell/gpu/gpu_surface_software.h"
#include "flutter/third_party/abseil-cpp/absl/base/no_destructor.h"
#include "third_party/dart/runtime/include/bin/dart_io_api.h"
#include "third_party/dart/runtime/include/dart_api.h"
#include "third_party/skia/include/core/SkSurface.h"

Go to the source code of this file.

Classes

struct  ImpellerVulkanContextHolder
 
class  flutter::TesterExternalViewEmbedder
 
class  flutter::TesterGPUSurfaceSoftware
 
class  flutter::TesterPlatformView
 
class  flutter::ScriptCompletionTaskObserver
 

Namespaces

namespace  flutter
 

Macros

#define FML_USED_ON_EMBEDDER
 
#define ALLOW_IMPELLER   (IMPELLER_SUPPORTS_RENDERING && IMPELLER_ENABLE_VULKAN)
 
#define EXPORTED   __attribute__((visibility("default")))
 

Functions

static void flutter::ConfigureShell (Shell *shell)
 
static void flutter::UnblockSIGPROF ()
 
int flutter::RunTester (const flutter::Settings &settings, bool run_forever, bool multithreaded)
 
EXPORTED Dart_Handle flutter::LoadLibraryFromKernel (const char *path)
 
EXPORTED Dart_Handle flutter::LookupEntryPoint (const char *uri, const char *name)
 
EXPORTED void flutter::Spawn (const char *entrypoint, const char *route)
 
EXPORTED void flutter::ForceShutdownIsolate ()
 
int main (int argc, char *argv[])
 

Variables

static absl::NoDestructor< std::unique_ptr< Shell > > flutter::g_shell
 

Macro Definition Documentation

◆ ALLOW_IMPELLER

#define ALLOW_IMPELLER   (IMPELLER_SUPPORTS_RENDERING && IMPELLER_ENABLE_VULKAN)

Definition at line 34 of file tester_main.cc.

◆ EXPORTED

#define EXPORTED   __attribute__((visibility("default")))

Definition at line 520 of file tester_main.cc.

◆ FML_USED_ON_EMBEDDER

#define FML_USED_ON_EMBEDDER

Definition at line 5 of file tester_main.cc.

Function Documentation

◆ main()

int main ( int  argc,
char *  argv[] 
)

Definition at line 620 of file tester_main.cc.

620 {
623
624 auto command_line = fml::CommandLineFromPlatformOrArgcArgv(argc, argv);
625
626 if (command_line.HasOption(flutter::FlagForSwitch(flutter::Switch::Help))) {
627 flutter::PrintUsage("flutter_tester");
628 return EXIT_SUCCESS;
629 }
630
631 auto settings = flutter::SettingsFromCommandLine(command_line);
632 if (!command_line.positional_args().empty()) {
633 // The tester may not use the switch for the main dart file path. Specifying
634 // it as a positional argument instead.
635 settings.application_kernel_asset = command_line.positional_args()[0];
636 }
637
638 if (settings.application_kernel_asset.empty()) {
639 FML_LOG(ERROR) << "Dart kernel file not specified.";
640 return EXIT_FAILURE;
641 }
642
643 settings.leak_vm = false;
644 settings.enable_platform_isolates = true;
645
646 if (settings.icu_data_path.empty()) {
647 settings.icu_data_path = "icudtl.dat";
648 }
649
650 // The tools that read logs get confused if there is a log tag specified.
651 settings.log_tag = "";
652
653 settings.log_message_callback = [](const std::string& tag,
654 const std::string& message) {
655 if (!tag.empty()) {
656 std::cout << tag << ": ";
657 }
658 std::cout << message << std::endl;
659 };
660
661 settings.task_observer_add = [](intptr_t key, const fml::closure& callback) {
663 };
664
665 settings.task_observer_remove = [](intptr_t key) {
667 };
668
669 settings.unhandled_exception_callback = [](const std::string& error,
670 const std::string& stack_trace) {
671 FML_LOG(ERROR) << "Unhandled exception" << std::endl
672 << "Exception: " << error << std::endl
673 << "Stack trace: " << stack_trace;
674 ::exit(1);
675 return true;
676 };
677
678#if defined(FML_OS_WIN)
679 CoInitializeEx(nullptr, COINIT_MULTITHREADED);
680#endif // defined(FML_OS_WIN)
681
683 command_line.HasOption(flutter::FlagForSwitch(
684 flutter::Switch::RunForever)),
685 command_line.HasOption(flutter::FlagForSwitch(
686 flutter::Switch::ForceMultithreading)));
687}
void RemoveTaskObserver(intptr_t key)
Definition: message_loop.cc:68
void AddTaskObserver(intptr_t key, const fml::closure &callback)
Definition: message_loop.cc:64
static FML_EMBEDDER_ONLY MessageLoop & GetCurrent()
Definition: message_loop.cc:19
FlKeyEvent uint64_t FlKeyResponderAsyncCallback callback
const uint8_t uint32_t uint32_t GError ** error
#define FML_LOG(severity)
Definition: logging.h:82
Win32Message message
char ** argv
Definition: library.h:9
void SetExecutableName(const char *executable_name)
void SetExecutableArguments(int script_index, char **argv)
exit(kErrorExitCode)
int RunTester(const flutter::Settings &settings, bool run_forever, bool multithreaded)
Definition: tester_main.cc:334
void PrintUsage(const std::string &executable_name)
Definition: switches.cc:90
Settings SettingsFromCommandLine(const fml::CommandLine &command_line)
Definition: switches.cc:228
const std::string_view FlagForSwitch(Switch swtch)
Definition: switches.cc:144
std::function< void()> closure
Definition: closure.h:14
CommandLine CommandLineFromPlatformOrArgcArgv(int argc, const char *const *argv)
Definition: command_line.h:242
def Help(missing)
Definition: spec_parse.py:21
#define ERROR(message)
Definition: elf_loader.cc:260