GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — src: add a flag to keep the embedder's wasm streaming callback · nodejs/node@b19ffab

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • src
    • api
      • environment.cc
    • node.h
  • test/cctest
    • test_environment.cc
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎src/api/environment.cc‎

Copy file name to clipboardExpand all lines: src/api/environment.cc
+3-1Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,9 @@ void SetIsolateMiscHandlers(v8::Isolate* isolate, const IsolateSettings& s) {
271271
isolate->SetModifyCodeGenerationFromStringsCallback(
272272
modify_code_generation_from_strings_callback);
273273

274-
isolate->SetWasmStreamingCallback(wasm_web_api::StartStreamingCompilation);
274+
if ((s.flags & SHOULD_NOT_SET_WASM_STREAMING_CALLBACK) == 0) {
275+
isolate->SetWasmStreamingCallback(wasm_web_api::StartStreamingCompilation);
276+
}
275277

276278
Mutex::ScopedLock lock(node::per_process::cli_options_mutex);
277279
if (per_process::cli_options->get_per_isolate_options()
Collapse file

‎src/node.h‎

Copy file name to clipboardExpand all lines: src/node.h
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -466,6 +466,7 @@ enum IsolateSettingsFlags {
466466
DETAILED_SOURCE_POSITIONS_FOR_PROFILING = 1 << 1,
467467
SHOULD_NOT_SET_PROMISE_REJECTION_CALLBACK = 1 << 2,
468468
SHOULD_NOT_SET_PREPARE_STACK_TRACE_CALLBACK = 1 << 3,
469+
SHOULD_NOT_SET_WASM_STREAMING_CALLBACK = 1 << 4,
469470
ALLOW_MODIFY_CODE_GENERATION_FROM_STRINGS_CALLBACK = 0, /* legacy no-op */
470471
};
471472

Collapse file

‎test/cctest/test_environment.cc‎

Copy file name to clipboardExpand all lines: test/cctest/test_environment.cc
+33Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,39 @@ TEST_F(EnvironmentTest, ManagedBufferCache) {
6565
(*env)->release_managed_buffer(buffer);
6666
}
6767

68+
static int embedder_wasm_streaming_calls = 0;
69+
static void EmbedderWasmStreaming(const v8::FunctionCallbackInfo<v8::Value>&) {
70+
embedder_wasm_streaming_calls++;
71+
}
72+
73+
TEST_F(EnvironmentTest, KeepsEmbedderWasmStreamingCallbackWhenAsked) {
74+
const v8::HandleScope handle_scope(isolate_);
75+
const Argv argv;
76+
Env env{handle_scope, argv};
77+
78+
auto compile_streaming = [&]() {
79+
v8::Local<v8::Context> context = isolate_->GetCurrentContext();
80+
v8::Script::Compile(context,
81+
v8::String::NewFromUtf8Literal(
82+
isolate_, "WebAssembly.compileStreaming(0); 0"))
83+
.ToLocalChecked()
84+
->Run(context)
85+
.ToLocalChecked();
86+
isolate_->PerformMicrotaskCheckpoint();
87+
};
88+
89+
node::IsolateSettings settings;
90+
settings.flags |= node::SHOULD_NOT_SET_WASM_STREAMING_CALLBACK;
91+
isolate_->SetWasmStreamingCallback(EmbedderWasmStreaming);
92+
node::SetIsolateUpForNode(isolate_, settings);
93+
compile_streaming();
94+
EXPECT_EQ(embedder_wasm_streaming_calls, 1);
95+
96+
node::SetIsolateUpForNode(isolate_);
97+
compile_streaming();
98+
EXPECT_EQ(embedder_wasm_streaming_calls, 1);
99+
}
100+
68101
TEST_F(EnvironmentTest, EnvironmentWithoutBrowserGlobals) {
69102
const v8::HandleScope handle_scope(isolate_);
70103
Argv argv;

0 commit comments

Comments
0 (0)
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.