Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 5a1439c

Browse files
authored
Revert "Disable setting a library tag handler." (#16157)
This reverts commit ef3aa01. This address the use case of an internal customer. In a subsequent patch, I will add a test for this functionality. Instead of removing support for the same from tonic (along with the stuff surrounding filesystem access and package map handling), I’ll rework the same to use FML to avoid code duplication and maintainability.
1 parent 0889e97 commit 5a1439c

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

runtime/dart_isolate.cc

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,11 @@ bool DartIsolate::Initialize(Dart_Isolate dart_isolate) {
184184

185185
SetMessageHandlingTaskRunner(GetTaskRunners().GetUITaskRunner());
186186

187+
if (tonic::LogIfError(
188+
Dart_SetLibraryTagHandler(tonic::DartState::HandleLibraryTag))) {
189+
return false;
190+
}
191+
187192
if (!UpdateThreadPoolNames()) {
188193
return false;
189194
}
@@ -618,9 +623,10 @@ Dart_Isolate DartIsolate::DartCreateAndStartServiceIsolate(
618623

619624
tonic::DartState::Scope scope(service_isolate);
620625
if (!DartServiceIsolate::Startup(
621-
settings.observatory_host, // server IP address
622-
settings.observatory_port, // server observatory port
623-
false, // disable websocket origin check
626+
settings.observatory_host, // server IP address
627+
settings.observatory_port, // server observatory port
628+
tonic::DartState::HandleLibraryTag, // embedder library tag handler
629+
false, // disable websocket origin check
624630
settings.disable_service_auth_codes, // disable VM service auth codes
625631
error // error (out)
626632
)) {

runtime/dart_service_isolate.cc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
namespace flutter {
3131
namespace {
3232

33+
static Dart_LibraryTagHandler g_embedder_tag_handler;
3334
static tonic::DartLibraryNatives* g_natives;
3435
static std::string g_observatory_uri;
3536

@@ -126,12 +127,17 @@ void DartServiceIsolate::Shutdown(Dart_NativeArguments args) {
126127

127128
bool DartServiceIsolate::Startup(std::string server_ip,
128129
intptr_t server_port,
130+
Dart_LibraryTagHandler embedder_tag_handler,
129131
bool disable_origin_check,
130132
bool disable_service_auth_codes,
131133
char** error) {
132134
Dart_Isolate isolate = Dart_CurrentIsolate();
133135
FML_CHECK(isolate);
134136

137+
// Remember the embedder's library tag handler.
138+
g_embedder_tag_handler = embedder_tag_handler;
139+
FML_CHECK(g_embedder_tag_handler);
140+
135141
// Setup native entries.
136142
if (!g_natives) {
137143
g_natives = new tonic::DartLibraryNatives();

runtime/dart_service_isolate.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ class DartServiceIsolate {
2323

2424
static bool Startup(std::string server_ip,
2525
intptr_t server_port,
26+
Dart_LibraryTagHandler embedder_tag_handler,
2627
bool disable_origin_check,
2728
bool disable_service_auth_codes,
2829
char** error);

0 commit comments

Comments
 (0)