refactor: remove last use of InternalCallbackScope (#27029)

* refactor: remove last use of InternalCallbackScope

* update patches

Co-authored-by: Electron Bot <electron@github.com>
This commit is contained in:
Shelley Vohr 2020-12-16 12:02:36 -08:00 committed by GitHub
parent 9377b04e0b
commit 75247d18d0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 4 additions and 59 deletions

View file

@ -4,14 +4,12 @@ refactor_alter_child_process_fork_to_use_execute_script_with.patch
feat_add_uv_loop_watcher_queue_code.patch
feat_initialize_asar_support.patch
expose_get_builtin_module_function.patch
fix_expose_internalcallbackscope.patch
build_add_gn_build_files.patch
fix_add_default_values_for_enable_lto_and_build_v8_with_gn_in.patch
feat_add_new_built_with_electron_variable_to_config_gypi.patch
feat_add_flags_for_low-level_hooks_and_exceptions.patch
fix_expose_tracing_agent_and_use_tracing_tracingcontroller_instead.patch
pass_all_globals_through_require.patch
fixme_remove_async_id_assertion_check.patch
fixme_comment_trace_event_macro.patch
fix_key_gen_apis_are_not_available_in_boringssl.patch
build_modify_js2c_py_to_allow_injection_of_original-fs_and_custom_embedder_js.patch

View file

@ -1,20 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: deepak1556 <hop2deep@gmail.com>
Date: Sat, 6 Jan 2018 18:28:10 +0530
Subject: fix: expose InternalCallbackScope
This commit exposes InternalCallbackScope in order to allow us access to its internal flags.
diff --git a/src/node_internals.h b/src/node_internals.h
index aa7180e18544cab4004a0ef87ba230bd2e732d28..9a5b2165d5648045ea18d66b0c15d29b4ea1cced 100644
--- a/src/node_internals.h
+++ b/src/node_internals.h
@@ -200,7 +200,7 @@ v8::MaybeLocal<v8::Value> InternalMakeCallback(
v8::Local<v8::Value> argv[],
async_context asyncContext);
-class InternalCallbackScope {
+class NODE_EXTERN InternalCallbackScope {
public:
enum Flags {
kNoFlags = 0,

View file

@ -7,7 +7,7 @@ This broke the build at some point. Does it still? We should probably remove
this patch and find out!
diff --git a/src/node_internals.h b/src/node_internals.h
index 9a5b2165d5648045ea18d66b0c15d29b4ea1cced..6aff1a4ee7f708437dbf581b9eacc21e5bdd1c43 100644
index aa7180e18544cab4004a0ef87ba230bd2e732d28..0a01dcd8ed194b205d7fe510451315610e5a60be 100644
--- a/src/node_internals.h
+++ b/src/node_internals.h
@@ -368,10 +368,11 @@ class TraceEventScope {

View file

@ -1,27 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Shelley Vohr <shelley.vohr@gmail.com>
Date: Thu, 13 Sep 2018 09:08:10 -0700
Subject: FIXME: remove async_id assertion check
async hooks are hella broken in Electron. This was checking that they weren't,
but they are, so we just disabled the check. YOLO.
diff --git a/src/api/callback.cc b/src/api/callback.cc
index 3d4f91a866ea3966689992e996b62142b207a602..8b9850dd6a7f76c9384eca65ab5308da69377e26 100644
--- a/src/api/callback.cc
+++ b/src/api/callback.cc
@@ -116,12 +116,14 @@ void InternalCallbackScope::Close() {
perform_stopping_check();
}
+#if 0 // FIXME(codebytere): figure out why this check fails/causes crash
// Make sure the stack unwound properly. If there are nested MakeCallback's
// then it should return early and not reach this code.
if (env_->async_hooks()->fields()[AsyncHooks::kTotals]) {
CHECK_EQ(env_->execution_async_id(), 0);
CHECK_EQ(env_->trigger_async_id(), 0);
}
+#endif
if (!tick_info->has_tick_scheduled() && !tick_info->has_rejection_to_warn()) {
return;

View file

@ -206,7 +206,7 @@ int NodeMain(int argc, char* argv[]) {
exec_argv + exec_argc); // NOLINT
env = node::CreateEnvironment(isolate_data, gin_env.context(), args,
exec_args);
CHECK_NE(nullptr, env);
CHECK_NOT_NULL(env);
node::IsolateSettings is;
node::SetIsolateUpForNode(isolate, is);
@ -239,14 +239,8 @@ int NodeMain(int argc, char* argv[]) {
}
}
// TODO(codebytere): we should try to handle this upstream.
{
v8::HandleScope scope(isolate);
node::InternalCallbackScope callback_scope(
env, v8::Object::New(isolate), {1, 0},
node::InternalCallbackScope::kSkipAsyncHooks);
node::LoadEnvironment(env);
}
v8::HandleScope scope(isolate);
node::LoadEnvironment(env);
env->set_trace_sync_io(env->options()->trace_sync_io);