Fix use of multiple shells w/ different snapshots (#24152)

This commit is contained in:
David Worsham 2021-02-03 17:42:36 -08:00 committed by GitHub
parent 8c69c7475b
commit 810e433308
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
22 changed files with 190 additions and 227 deletions

View File

@ -155,7 +155,7 @@ static std::shared_ptr<const fml::Mapping> ResolveIsolateInstructions(
#endif // DART_SNAPSHOT_STATIC_LINK
}
fml::RefPtr<DartSnapshot> DartSnapshot::VMSnapshotFromSettings(
fml::RefPtr<const DartSnapshot> DartSnapshot::VMSnapshotFromSettings(
const Settings& settings) {
TRACE_EVENT0("flutter", "DartSnapshot::VMSnapshotFromSettings");
auto snapshot =
@ -168,7 +168,7 @@ fml::RefPtr<DartSnapshot> DartSnapshot::VMSnapshotFromSettings(
return nullptr;
}
fml::RefPtr<DartSnapshot> DartSnapshot::IsolateSnapshotFromSettings(
fml::RefPtr<const DartSnapshot> DartSnapshot::IsolateSnapshotFromSettings(
const Settings& settings) {
TRACE_EVENT0("flutter", "DartSnapshot::IsolateSnapshotFromSettings");
auto snapshot =

View File

@ -79,7 +79,7 @@ class DartSnapshot : public fml::RefCountedThreadSafe<DartSnapshot> {
///
/// @return A valid core snapshot or nullptr.
///
static fml::RefPtr<DartSnapshot> VMSnapshotFromSettings(
static fml::RefPtr<const DartSnapshot> VMSnapshotFromSettings(
const Settings& settings);
//----------------------------------------------------------------------------
@ -99,7 +99,7 @@ class DartSnapshot : public fml::RefCountedThreadSafe<DartSnapshot> {
///
/// @return A valid isolate snapshot or nullptr.
///
static fml::RefPtr<DartSnapshot> IsolateSnapshotFromSettings(
static fml::RefPtr<const DartSnapshot> IsolateSnapshotFromSettings(
const Settings& settings);
//----------------------------------------------------------------------------

View File

@ -245,8 +245,8 @@ static void EmbedderInformationCallback(Dart_EmbedderInformation* info) {
std::shared_ptr<DartVM> DartVM::Create(
Settings settings,
fml::RefPtr<DartSnapshot> vm_snapshot,
fml::RefPtr<DartSnapshot> isolate_snapshot,
fml::RefPtr<const DartSnapshot> vm_snapshot,
fml::RefPtr<const DartSnapshot> isolate_snapshot,
std::shared_ptr<IsolateNameServer> isolate_name_server) {
auto vm_data = DartVMData::Create(settings, //
std::move(vm_snapshot), //

View File

@ -173,8 +173,8 @@ class DartVM {
static std::shared_ptr<DartVM> Create(
Settings settings,
fml::RefPtr<DartSnapshot> vm_snapshot,
fml::RefPtr<DartSnapshot> isolate_snapshot,
fml::RefPtr<const DartSnapshot> vm_snapshot,
fml::RefPtr<const DartSnapshot> isolate_snapshot,
std::shared_ptr<IsolateNameServer> isolate_name_server);
DartVM(std::shared_ptr<const DartVMData> data,

View File

@ -8,8 +8,8 @@ namespace flutter {
std::shared_ptr<const DartVMData> DartVMData::Create(
Settings settings,
fml::RefPtr<DartSnapshot> vm_snapshot,
fml::RefPtr<DartSnapshot> isolate_snapshot) {
fml::RefPtr<const DartSnapshot> vm_snapshot,
fml::RefPtr<const DartSnapshot> isolate_snapshot) {
if (!vm_snapshot || !vm_snapshot->IsValid()) {
// Caller did not provide a valid VM snapshot. Attempt to infer one
// from the settings.

View File

@ -37,8 +37,8 @@ class DartVMData {
///
static std::shared_ptr<const DartVMData> Create(
Settings settings,
fml::RefPtr<DartSnapshot> vm_snapshot,
fml::RefPtr<DartSnapshot> isolate_snapshot);
fml::RefPtr<const DartSnapshot> vm_snapshot,
fml::RefPtr<const DartSnapshot> isolate_snapshot);
//----------------------------------------------------------------------------
/// @brief Collect the DartVMData instance.

View File

@ -42,8 +42,8 @@ DartVMRef::~DartVMRef() {
}
DartVMRef DartVMRef::Create(Settings settings,
fml::RefPtr<DartSnapshot> vm_snapshot,
fml::RefPtr<DartSnapshot> isolate_snapshot) {
fml::RefPtr<const DartSnapshot> vm_snapshot,
fml::RefPtr<const DartSnapshot> isolate_snapshot) {
std::scoped_lock lifecycle_lock(gVMMutex);
if (!settings.leak_vm) {

View File

@ -29,8 +29,8 @@ class DartVMRef {
public:
[[nodiscard]] static DartVMRef Create(
Settings settings,
fml::RefPtr<DartSnapshot> vm_snapshot = nullptr,
fml::RefPtr<DartSnapshot> isolate_snapshot = nullptr);
fml::RefPtr<const DartSnapshot> vm_snapshot = nullptr,
fml::RefPtr<const DartSnapshot> isolate_snapshot = nullptr);
DartVMRef(const DartVMRef&) = default;

View File

@ -51,7 +51,7 @@ TEST_F(ShellTest, VSyncTargetTime) {
fml::MessageLoop::EnsureInitializedForCurrentThread();
shell = Shell::Create(
task_runners, settings,
flutter::PlatformData(), task_runners, settings,
[vsync_clock, &create_vsync_waiter](Shell& shell) {
return ShellTestPlatformView::Create(
shell, shell.GetTaskRunners(), vsync_clock,

View File

@ -63,7 +63,7 @@ Engine::Engine(Delegate& delegate,
DartVM& vm,
fml::RefPtr<const DartSnapshot> isolate_snapshot,
TaskRunners task_runners,
const PlatformData platform_data,
const PlatformData& platform_data,
Settings settings,
std::unique_ptr<Animator> animator,
fml::WeakPtr<IOManager> io_manager,

View File

@ -347,7 +347,7 @@ class Engine final : public RuntimeDelegate,
DartVM& vm,
fml::RefPtr<const DartSnapshot> isolate_snapshot,
TaskRunners task_runners,
const PlatformData platform_data,
const PlatformData& platform_data,
Settings settings,
std::unique_ptr<Animator> animator,
fml::WeakPtr<IOManager> io_manager,

View File

@ -40,13 +40,14 @@ constexpr char kTypeKey[] = "type";
constexpr char kFontChange[] = "fontsChange";
namespace {
std::unique_ptr<Engine> CreateEngine(
Engine::Delegate& delegate,
const PointerDataDispatcherMaker& dispatcher_maker,
DartVM& vm,
fml::RefPtr<const DartSnapshot> isolate_snapshot,
TaskRunners task_runners,
const PlatformData platform_data,
const PlatformData& platform_data,
Settings settings,
std::unique_ptr<Animator> animator,
fml::WeakPtr<IOManager> io_manager,
@ -66,12 +67,111 @@ std::unique_ptr<Engine> CreateEngine(
snapshot_delegate, //
volatile_path_tracker);
}
void Tokenize(const std::string& input,
std::vector<std::string>* results,
char delimiter) {
std::istringstream ss(input);
std::string token;
while (std::getline(ss, token, delimiter)) {
results->push_back(token);
}
}
// Though there can be multiple shells, some settings apply to all components in
// the process. These have to be setup before the shell or any of its
// sub-components can be initialized. In a perfect world, this would be empty.
// TODO(chinmaygarde): The unfortunate side effect of this call is that settings
// that cause shell initialization failures will still lead to some of their
// settings being applied.
void PerformInitializationTasks(Settings& settings) {
{
fml::LogSettings log_settings;
log_settings.min_log_level =
settings.verbose_logging ? fml::LOG_INFO : fml::LOG_ERROR;
fml::SetLogSettings(log_settings);
}
static std::once_flag gShellSettingsInitialization = {};
std::call_once(gShellSettingsInitialization, [&settings] {
if (settings.engine_start_timestamp.count() == 0) {
settings.engine_start_timestamp =
std::chrono::microseconds(Dart_TimelineGetMicros());
}
tonic::SetLogHandler(
[](const char* message) { FML_LOG(ERROR) << message; });
if (settings.trace_skia) {
InitSkiaEventTracer(settings.trace_skia);
}
if (!settings.trace_allowlist.empty()) {
std::vector<std::string> prefixes;
Tokenize(settings.trace_allowlist, &prefixes, ',');
fml::tracing::TraceSetAllowlist(prefixes);
}
if (!settings.skia_deterministic_rendering_on_cpu) {
SkGraphics::Init();
} else {
FML_DLOG(INFO) << "Skia deterministic rendering is enabled.";
}
if (settings.icu_initialization_required) {
if (settings.icu_data_path.size() != 0) {
fml::icu::InitializeICU(settings.icu_data_path);
} else if (settings.icu_mapper) {
fml::icu::InitializeICUFromMapping(settings.icu_mapper());
} else {
FML_DLOG(WARNING) << "Skipping ICU initialization in the shell.";
}
}
});
PersistentCache::SetCacheSkSL(settings.cache_sksl);
}
} // namespace
std::unique_ptr<Shell> Shell::Create(
const PlatformData& platform_data,
TaskRunners task_runners,
Settings settings,
const Shell::CreateCallback<PlatformView>& on_create_platform_view,
const Shell::CreateCallback<Rasterizer>& on_create_rasterizer) {
// This must come first as it initializes tracing.
PerformInitializationTasks(settings);
TRACE_EVENT0("flutter", "Shell::Create");
// Always use the `vm_snapshot` and `isolate_snapshot` provided by the
// settings to launch the VM. If the VM is already running, the snapshot
// arguments are ignored.
auto vm_snapshot = DartSnapshot::VMSnapshotFromSettings(settings);
auto isolate_snapshot = DartSnapshot::IsolateSnapshotFromSettings(settings);
auto vm = DartVMRef::Create(settings, vm_snapshot, isolate_snapshot);
FML_CHECK(vm) << "Must be able to initialize the VM.";
// If the settings did not specify an `isolate_snapshot`, fall back to the
// one the VM was launched with.
if (!isolate_snapshot) {
isolate_snapshot = vm->GetVMData()->GetIsolateSnapshot();
}
return CreateWithSnapshot(std::move(platform_data), //
std::move(task_runners), //
std::move(settings), //
std::move(vm), //
std::move(isolate_snapshot), //
std::move(on_create_platform_view), //
std::move(on_create_rasterizer), //
CreateEngine);
}
std::unique_ptr<Shell> Shell::CreateShellOnPlatformThread(
DartVMRef vm,
TaskRunners task_runners,
const PlatformData platform_data,
const PlatformData& platform_data,
Settings settings,
fml::RefPtr<const DartSnapshot> isolate_snapshot,
const Shell::CreateCallback<PlatformView>& on_create_platform_view,
@ -207,123 +307,23 @@ std::unique_ptr<Shell> Shell::CreateShellOnPlatformThread(
return shell;
}
static void Tokenize(const std::string& input,
std::vector<std::string>* results,
char delimiter) {
std::istringstream ss(input);
std::string token;
while (std::getline(ss, token, delimiter)) {
results->push_back(token);
}
}
// Though there can be multiple shells, some settings apply to all components in
// the process. These have to be setup before the shell or any of its
// sub-components can be initialized. In a perfect world, this would be empty.
// TODO(chinmaygarde): The unfortunate side effect of this call is that settings
// that cause shell initialization failures will still lead to some of their
// settings being applied.
static void PerformInitializationTasks(Settings& settings) {
{
fml::LogSettings log_settings;
log_settings.min_log_level =
settings.verbose_logging ? fml::LOG_INFO : fml::LOG_ERROR;
fml::SetLogSettings(log_settings);
}
static std::once_flag gShellSettingsInitialization = {};
std::call_once(gShellSettingsInitialization, [&settings] {
if (settings.engine_start_timestamp.count() == 0) {
settings.engine_start_timestamp =
std::chrono::microseconds(Dart_TimelineGetMicros());
}
tonic::SetLogHandler(
[](const char* message) { FML_LOG(ERROR) << message; });
if (settings.trace_skia) {
InitSkiaEventTracer(settings.trace_skia);
}
if (!settings.trace_allowlist.empty()) {
std::vector<std::string> prefixes;
Tokenize(settings.trace_allowlist, &prefixes, ',');
fml::tracing::TraceSetAllowlist(prefixes);
}
if (!settings.skia_deterministic_rendering_on_cpu) {
SkGraphics::Init();
} else {
FML_DLOG(INFO) << "Skia deterministic rendering is enabled.";
}
if (settings.icu_initialization_required) {
if (settings.icu_data_path.size() != 0) {
fml::icu::InitializeICU(settings.icu_data_path);
} else if (settings.icu_mapper) {
fml::icu::InitializeICUFromMapping(settings.icu_mapper());
} else {
FML_DLOG(WARNING) << "Skipping ICU initialization in the shell.";
}
}
});
}
std::unique_ptr<Shell> Shell::Create(
std::unique_ptr<Shell> Shell::CreateWithSnapshot(
const PlatformData& platform_data,
TaskRunners task_runners,
Settings settings,
const Shell::CreateCallback<PlatformView>& on_create_platform_view,
const Shell::CreateCallback<Rasterizer>& on_create_rasterizer) {
return Shell::Create(std::move(task_runners), //
PlatformData{/* default platform data */}, //
std::move(settings), //
std::move(on_create_platform_view), //
std::move(on_create_rasterizer) //
);
}
std::unique_ptr<Shell> Shell::Create(
TaskRunners task_runners,
const PlatformData platform_data,
Settings settings,
Shell::CreateCallback<PlatformView> on_create_platform_view,
Shell::CreateCallback<Rasterizer> on_create_rasterizer) {
PerformInitializationTasks(settings);
PersistentCache::SetCacheSkSL(settings.cache_sksl);
TRACE_EVENT0("flutter", "Shell::Create");
auto vm = DartVMRef::Create(settings);
FML_CHECK(vm) << "Must be able to initialize the VM.";
auto vm_data = vm->GetVMData();
return Shell::Create(std::move(task_runners), //
std::move(platform_data), //
std::move(settings), //
vm_data->GetIsolateSnapshot(), // isolate snapshot
on_create_platform_view, //
on_create_rasterizer, //
std::move(vm), //
CreateEngine);
}
std::unique_ptr<Shell> Shell::Create(
TaskRunners task_runners,
const PlatformData platform_data,
Settings settings,
DartVMRef vm,
fml::RefPtr<const DartSnapshot> isolate_snapshot,
const Shell::CreateCallback<PlatformView>& on_create_platform_view,
const Shell::CreateCallback<Rasterizer>& on_create_rasterizer,
DartVMRef vm,
const Shell::EngineCreateCallback& on_create_engine) {
// This must come first as it initializes tracing.
PerformInitializationTasks(settings);
PersistentCache::SetCacheSkSL(settings.cache_sksl);
TRACE_EVENT0("flutter", "Shell::CreateWithSnapshots");
TRACE_EVENT0("flutter", "Shell::CreateWithSnapshot");
if (!task_runners.IsValid() || !on_create_platform_view ||
!on_create_rasterizer) {
const bool callbacks_valid =
on_create_platform_view && on_create_rasterizer && on_create_engine;
if (!task_runners.IsValid() || !callbacks_valid) {
return nullptr;
}
@ -331,26 +331,28 @@ std::unique_ptr<Shell> Shell::Create(
std::unique_ptr<Shell> shell;
fml::TaskRunner::RunNowOrPostTask(
task_runners.GetPlatformTaskRunner(),
fml::MakeCopyable([&latch, //
vm = std::move(vm), //
&shell, //
task_runners = std::move(task_runners), //
platform_data, //
settings, //
on_create_platform_view, //
on_create_rasterizer, //
&on_create_engine]() mutable {
auto isolate_snapshot = vm->GetVMData()->GetIsolateSnapshot();
shell = CreateShellOnPlatformThread(std::move(vm),
std::move(task_runners), //
platform_data, //
settings, //
std::move(isolate_snapshot), //
on_create_platform_view, //
on_create_rasterizer, //
on_create_engine);
latch.Signal();
}));
fml::MakeCopyable(
[&latch, //
&shell, //
task_runners = std::move(task_runners), //
platform_data = std::move(platform_data), //
settings = std::move(settings), //
vm = std::move(vm), //
isolate_snapshot = std::move(isolate_snapshot), //
on_create_platform_view = std::move(on_create_platform_view), //
on_create_rasterizer = std::move(on_create_rasterizer), //
on_create_engine = std::move(on_create_engine)]() mutable {
shell = CreateShellOnPlatformThread(
std::move(vm), //
std::move(task_runners), //
std::move(platform_data), //
std::move(settings), //
std::move(isolate_snapshot), //
std::move(on_create_platform_view), //
std::move(on_create_rasterizer), //
std::move(on_create_engine));
latch.Signal();
}));
latch.Wait();
return shell;
}
@ -479,15 +481,15 @@ std::unique_ptr<Shell> Shell::Spawn(
const CreateCallback<PlatformView>& on_create_platform_view,
const CreateCallback<Rasterizer>& on_create_rasterizer) const {
FML_DCHECK(task_runners_.IsValid());
std::unique_ptr<Shell> result(Shell::Create(
task_runners_, PlatformData{}, GetSettings(),
std::unique_ptr<Shell> result(CreateWithSnapshot(
PlatformData{}, task_runners_, GetSettings(), vm_,
vm_->GetVMData()->GetIsolateSnapshot(), on_create_platform_view,
on_create_rasterizer, vm_,
on_create_rasterizer,
[engine = this->engine_.get()](
Engine::Delegate& delegate,
const PointerDataDispatcherMaker& dispatcher_maker, DartVM& vm,
fml::RefPtr<const DartSnapshot> isolate_snapshot,
TaskRunners task_runners, const PlatformData platform_data,
TaskRunners task_runners, const PlatformData& platform_data,
Settings settings, std::unique_ptr<Animator> animator,
fml::WeakPtr<IOManager> io_manager,
fml::RefPtr<SkiaUnrefQueue> unref_queue,

View File

@ -30,6 +30,7 @@
#include "flutter/lib/ui/volatile_path_tracker.h"
#include "flutter/lib/ui/window/platform_message.h"
#include "flutter/runtime/dart_vm_lifecycle.h"
#include "flutter/runtime/platform_data.h"
#include "flutter/runtime/service_protocol.h"
#include "flutter/shell/common/animator.h"
#include "flutter/shell/common/display_manager.h"
@ -104,7 +105,7 @@ class Shell final : public PlatformView::Delegate,
DartVM& vm,
fml::RefPtr<const DartSnapshot> isolate_snapshot,
TaskRunners task_runners,
const PlatformData platform_data,
const PlatformData& platform_data,
Settings settings,
std::unique_ptr<Animator> animator,
fml::WeakPtr<IOManager> io_manager,
@ -119,6 +120,9 @@ class Shell final : public PlatformView::Delegate,
/// called on the appropriate threads before this method returns.
/// If this is the first instance of a shell in the process, this
/// call also bootstraps the Dart VM.
/// @note The root isolate which will run this Shell's Dart code takes
/// its instructions from the passed in settings. This allows
/// embedders to host multiple Shells with different Dart code.
///
/// @param[in] task_runners The task runners
/// @param[in] settings The settings
@ -140,70 +144,12 @@ class Shell final : public PlatformView::Delegate,
/// immediately after getting a pointer to it.
///
static std::unique_ptr<Shell> Create(
const PlatformData& platform_data,
TaskRunners task_runners,
Settings settings,
const CreateCallback<PlatformView>& on_create_platform_view,
const CreateCallback<Rasterizer>& on_create_rasterizer);
//----------------------------------------------------------------------------
/// @brief Creates a shell instance using the provided settings. The
/// callbacks to create the various shell subcomponents will be
/// called on the appropriate threads before this method returns.
/// Unlike the simpler variant of this factory method, this method
/// allows for specification of window data. If this is the first
/// instance of a shell in the process, this call also bootstraps
/// the Dart VM.
///
/// @param[in] task_runners The task runners
/// @param[in] platform_data The default data for setting up
/// ui.Window that attached to this
/// intance.
/// @param[in] settings The settings
/// @param[in] on_create_platform_view The callback that must return a
/// platform view. This will be called on
/// the platform task runner before this
/// method returns.
/// @param[in] on_create_rasterizer That callback that must provide a
/// valid rasterizer. This will be called
/// on the render task runner before this
/// method returns.
///
/// @return A full initialized shell if the settings and callbacks are
/// valid. The root isolate has been created but not yet launched.
/// It may be launched by obtaining the engine weak pointer and
/// posting a task onto the UI task runner with a valid run
/// configuration to run the isolate. The embedder must always
/// check the validity of the shell (using the IsSetup call)
/// immediately after getting a pointer to it.
///
static std::unique_ptr<Shell> Create(
TaskRunners task_runners,
const PlatformData platform_data,
Settings settings,
CreateCallback<PlatformView> on_create_platform_view,
CreateCallback<Rasterizer> on_create_rasterizer);
//----------------------------------------------------------------------------
/// @brief Creates a shell instance using the provided settings.
/// @details This version of Create can take in a running DartVMRef and a
/// function that defines how the Shell's Engine should be
/// created.
/// @param[in] vm A running DartVMRef where this Shell's Dart
/// code will be executed.
/// @param[in] on_create_engine A function that creates an Engine during
/// initialization.
/// @see Shell::Create
///
static std::unique_ptr<Shell> Create(
TaskRunners task_runners,
const PlatformData platform_data,
Settings settings,
fml::RefPtr<const DartSnapshot> isolate_snapshot,
const CreateCallback<PlatformView>& on_create_platform_view,
const CreateCallback<Rasterizer>& on_create_rasterizer,
DartVMRef vm,
const EngineCreateCallback& on_create_engine);
//----------------------------------------------------------------------------
/// @brief Destroys the shell. This is a synchronous operation and
/// synchronous barrier blocks are introduced on the various
@ -216,7 +162,7 @@ class Shell final : public PlatformView::Delegate,
/// @brief Creates one Shell from another Shell where the created Shell
/// takes the opportunity to share any internal components it can.
/// This results is a Shell that has a smaller startup time cost
/// and a smaller memory footprint than an Shell created with a
/// and a smaller memory footprint than an Shell created with the
/// Create function.
///
/// The new Shell is returned in a running state so RunEngine
@ -472,12 +418,21 @@ class Shell final : public PlatformView::Delegate,
static std::unique_ptr<Shell> CreateShellOnPlatformThread(
DartVMRef vm,
TaskRunners task_runners,
const PlatformData platform_data,
const PlatformData& platform_data,
Settings settings,
fml::RefPtr<const DartSnapshot> isolate_snapshot,
const Shell::CreateCallback<PlatformView>& on_create_platform_view,
const Shell::CreateCallback<Rasterizer>& on_create_rasterizer,
const EngineCreateCallback& on_create_engine);
static std::unique_ptr<Shell> CreateWithSnapshot(
const PlatformData& platform_data,
TaskRunners task_runners,
Settings settings,
DartVMRef vm,
fml::RefPtr<const DartSnapshot> isolate_snapshot,
const CreateCallback<PlatformView>& on_create_platform_view,
const CreateCallback<Rasterizer>& on_create_rasterizer,
const EngineCreateCallback& on_create_engine);
bool Setup(std::unique_ptr<PlatformView> platform_view,
std::unique_ptr<Engine> engine,

View File

@ -54,7 +54,7 @@ static void StartupAndShutdownShell(benchmark::State& state,
thread_host->io_thread->GetTaskRunner());
shell = Shell::Create(
std::move(task_runners), settings,
flutter::PlatformData(), std::move(task_runners), settings,
[](Shell& shell) {
return std::make_unique<PlatformView>(shell, shell.GetTaskRunners());
},

View File

@ -326,7 +326,7 @@ std::unique_ptr<Shell> ShellTest::CreateShell(
}
};
return Shell::Create(
task_runners, settings,
flutter::PlatformData(), task_runners, settings,
[vsync_clock, &create_vsync_waiter,
shell_test_external_view_embedder](Shell& shell) {
return ShellTestPlatformView::Create(

View File

@ -301,7 +301,7 @@ TEST_F(ShellTest,
thread_host.ui_thread->GetTaskRunner(),
thread_host.io_thread->GetTaskRunner());
auto shell = Shell::Create(
std::move(task_runners), settings,
flutter::PlatformData(), std::move(task_runners), settings,
[](Shell& shell) {
// This is unused in the platform view as we are not using the simulated
// vsync mechanism. We should have better DI in the tests.

View File

@ -124,8 +124,8 @@ AndroidShellHolder::AndroidShellHolder(
});
shell_ =
Shell::Create(task_runners, // task runners
GetDefaultPlatformData(), // window data
Shell::Create(GetDefaultPlatformData(), // window data
task_runners, // task runners
settings_, // settings
on_create_platform_view, // platform view create callback
on_create_rasterizer // rasterizer create callback

View File

@ -613,8 +613,8 @@ static void SetEntryPoint(flutter::Settings* settings, NSString* entrypoint, NSS
// Create the shell. This is a blocking operation.
std::unique_ptr<flutter::Shell> shell =
flutter::Shell::Create(std::move(task_runners), // task runners
std::move(platformData), // window data
flutter::Shell::Create(std::move(platformData), // window data
std::move(task_runners), // task runners
std::move(settings), // settings
on_create_platform_view, // platform view creation
on_create_rasterizer // rasterzier creation

View File

@ -58,9 +58,9 @@ bool EmbedderEngine::LaunchShell() {
FML_DLOG(ERROR) << "Shell already initialized";
}
shell_ = Shell::Create(task_runners_, shell_args_->settings,
shell_args_->on_create_platform_view,
shell_args_->on_create_rasterizer);
shell_ = Shell::Create(
flutter::PlatformData(), task_runners_, shell_args_->settings,
shell_args_->on_create_platform_view, shell_args_->on_create_rasterizer);
// Reset the args no matter what. They will never be used to initialize a
// shell again.

View File

@ -407,6 +407,11 @@ Application::Application(
return std::make_unique<fml::NonOwnedMapping>(isolate_instructions, 0,
hold_snapshot);
};
isolate_snapshot_ = fml::MakeRefCounted<flutter::DartSnapshot>(
std::make_shared<fml::NonOwnedMapping>(isolate_data, 0,
hold_snapshot),
std::make_shared<fml::NonOwnedMapping>(isolate_instructions, 0,
hold_snapshot));
} else {
const int namespace_fd = application_data_directory_.get();
settings_.vm_snapshot_data = [namespace_fd]() {

View File

@ -340,8 +340,8 @@ Engine::Engine(Delegate& delegate,
{
TRACE_EVENT0("flutter", "CreateShell");
shell_ = flutter::Shell::Create(
std::move(task_runners), // host task runners
flutter::PlatformData(), // default window data
std::move(task_runners), // host task runners
std::move(settings), // shell launch settings
std::move(on_create_platform_view), // platform view create callback
std::move(on_create_rasterizer) // rasterizer create callback

View File

@ -144,7 +144,8 @@ int RunTester(const flutter::Settings& settings,
return std::make_unique<Rasterizer>(shell);
};
auto shell = Shell::Create(task_runners, //
auto shell = Shell::Create(flutter::PlatformData(), //
task_runners, //
settings, //
on_create_platform_view, //
on_create_rasterizer //