Skip to content

Commit

Permalink
5539888: [api] Remove several APIs deprecated in version 12.6
Browse files Browse the repository at this point in the history
https://chromium-review.googlesource.com/c/v8/v8/+/5539888

This commit essentially only removes the `only_terminate_in_safe_scope` isolate creation parameter. This undoes some work that was originally done in #35766.
  • Loading branch information
clavin authored and jkleinsc committed Jun 7, 2024
1 parent e6374b3 commit 00b3aec
Showing 1 changed file with 7 additions and 30 deletions.
37 changes: 7 additions & 30 deletions shell/browser/javascript_environment.cc
Original file line number Diff line number Diff line change
Expand Up @@ -75,38 +75,15 @@ struct base::trace_event::TraceValue::Helper<

namespace electron {

namespace {

gin::IsolateHolder CreateIsolateHolder(v8::Isolate* isolate) {
std::unique_ptr<v8::Isolate::CreateParams> create_params =
gin::IsolateHolder::getDefaultIsolateParams();
// Align behavior with V8 Isolate default for Node.js.
// This is necessary for important aspects of Node.js
// including heap and cpu profilers to function properly.
//
// Additional note:
// We do not want to invoke a termination exception at exit when
// we're running with only_terminate_in_safe_scope set to false. Heap and
// coverage profilers run after environment exit and if there is a pending
// exception at this stage then they will fail to generate the appropriate
// profiles. Node.js does not call node::Stop(), which calls
// isolate->TerminateExecution(), and therefore does not have this issue
// when also running with only_terminate_in_safe_scope set to false.
create_params->only_terminate_in_safe_scope = false;

return gin::IsolateHolder(
base::SingleThreadTaskRunner::GetCurrentDefault(),
gin::IsolateHolder::kSingleThread,
gin::IsolateHolder::IsolateType::kUtility, std::move(create_params),
gin::IsolateHolder::IsolateCreationMode::kNormal, nullptr, isolate);
}

} // namespace

JavascriptEnvironment::JavascriptEnvironment(uv_loop_t* event_loop,
bool setup_wasm_streaming)
: isolate_holder_{CreateIsolateHolder(
Initialize(event_loop, setup_wasm_streaming))},
: isolate_holder_(base::SingleThreadTaskRunner::GetCurrentDefault(),
gin::IsolateHolder::kSingleThread,
gin::IsolateHolder::IsolateType::kUtility,
gin::IsolateHolder::getDefaultIsolateParams(),
gin::IsolateHolder::IsolateCreationMode::kNormal,
nullptr,
Initialize(event_loop, setup_wasm_streaming)),
isolate_{isolate_holder_.isolate()},
locker_{isolate_} {
isolate_->Enter();
Expand Down

0 comments on commit 00b3aec

Please sign in to comment.