Flutter Engine
The Flutter Engine
dart_isolate_group_data.cc
Go to the documentation of this file.
1// Copyright 2013 The Flutter Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "flutter/runtime/dart_isolate_group_data.h"
6
7#include <utility>
8
9#include "flutter/runtime/dart_snapshot.h"
10
11namespace flutter {
12
14 const Settings& settings,
15 fml::RefPtr<const DartSnapshot> isolate_snapshot,
16 std::string advisory_script_uri,
17 std::string advisory_script_entrypoint,
18 const ChildIsolatePreparer& child_isolate_preparer,
19 const fml::closure& isolate_create_callback,
20 const fml::closure& isolate_shutdown_callback)
22 isolate_snapshot_(std::move(isolate_snapshot)),
23 advisory_script_uri_(std::move(advisory_script_uri)),
24 advisory_script_entrypoint_(std::move(advisory_script_entrypoint)),
25 child_isolate_preparer_(child_isolate_preparer),
26 isolate_create_callback_(isolate_create_callback),
27 isolate_shutdown_callback_(isolate_shutdown_callback) {
28 FML_DCHECK(isolate_snapshot_) << "Must contain a valid isolate snapshot.";
29}
30
32
34 return settings_;
35}
36
38 const {
39 return isolate_snapshot_;
40}
41
43 return advisory_script_uri_;
44}
45
47 return advisory_script_entrypoint_;
48}
49
51 std::scoped_lock lock(child_isolate_preparer_mutex_);
52 return child_isolate_preparer_;
53}
54
56 return isolate_create_callback_;
57}
58
60 return isolate_shutdown_callback_;
61}
62
65 std::scoped_lock lock(child_isolate_preparer_mutex_);
66 child_isolate_preparer_ = value;
67}
68
70 int64_t root_isolate_token,
71 std::weak_ptr<PlatformMessageHandler> handler) {
72 std::scoped_lock lock(platform_message_handlers_mutex_);
73 platform_message_handlers_[root_isolate_token] = handler;
74}
75
76std::weak_ptr<PlatformMessageHandler>
78 int64_t root_isolate_token) const {
79 std::scoped_lock lock(platform_message_handlers_mutex_);
80 auto it = platform_message_handlers_.find(root_isolate_token);
81 return it == platform_message_handlers_.end()
82 ? std::weak_ptr<PlatformMessageHandler>()
83 : it->second;
84}
85
87 const std::shared_ptr<const fml::Mapping>& buffer) {
88 kernel_buffers_.push_back(buffer);
89}
90
91std::vector<std::shared_ptr<const fml::Mapping>>
93 return kernel_buffers_;
94}
95
96} // namespace flutter
fml::RefPtr< const DartSnapshot > GetIsolateSnapshot() const
const fml::closure & GetIsolateShutdownCallback() const
std::vector< std::shared_ptr< const fml::Mapping > > GetKernelBuffers() const
const std::string & GetAdvisoryScriptURI() const
DartIsolateGroupData(const Settings &settings, fml::RefPtr< const DartSnapshot > isolate_snapshot, std::string advisory_script_uri, std::string advisory_script_entrypoint, const ChildIsolatePreparer &child_isolate_preparer, const fml::closure &isolate_create_callback, const fml::closure &isolate_shutdown_callback)
const std::string & GetAdvisoryScriptEntrypoint() const
void SetChildIsolatePreparer(const ChildIsolatePreparer &value)
std::weak_ptr< PlatformMessageHandler > GetPlatformMessageHandler(int64_t root_isolate_token) const override
ChildIsolatePreparer GetChildIsolatePreparer() const
void SetPlatformMessageHandler(int64_t root_isolate_token, std::weak_ptr< PlatformMessageHandler > handler) override
const Settings & GetSettings() const
const fml::closure & GetIsolateCreateCallback() const
void AddKernelBuffer(const std::shared_ptr< const fml::Mapping > &buffer)
Adds a kernel buffer mapping to the kernels loaded for this isolate group.
Settings settings_
uint8_t value
#define FML_DCHECK(condition)
Definition: logging.h:103
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified vm service A custom Dart VM Service port The default is to pick a randomly available open port disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode disable vm service Disable mDNS Dart VM Service publication Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set endless trace buffer
Definition: switches.h:126
std::function< bool(DartIsolate *)> ChildIsolatePreparer
std::function< void()> closure
Definition: closure.h:14
Definition: ref_ptr.h:256