electron/shell/common/gin_helper
Calvin 37639b5400
refactor: replace gin_helper::MicrotasksScope with v8::MicrotasksScope (#46963)
* Remove microtasks_scope.h and microtasks_scope.cc

* Use v8::MicrotasksScope when ignoring browser checkpoint

These call always skip the browser checkpoint, so they are equivalent to using v8::MicrotasksScope directly (modulo the optional wrapper behavior).

* Remove MicrotasksScope from node_bindings.cc

This code seems contradictory: it explicitly specifies "do not run microtasks" yet runs a microtask checkpoint in the browser process.

Looking at its history, it [was introduced][1] with the intention to not run microtasks, but a [subtle C++ language behavior][2] caused it to do the opposite later in the same roll. Since the original intention was to not run microtasks, and since that is also the simplest explanation, we can assume `ignore_browser_checkpoint` should be true and migrate this to `v8::MicrotasksScope` as it is equivalent (modulo the optional wrapper behavior).

[1]: https://github.com/electron/electron/pull/29058/commits/a4ea80dd47b1f13e10e218d298e70d6dd6b4fd0a#diff-efe58cf03c97028f37f801db044d396a5f428686da6595d2c692f1c052bbd09c
[2]: https://github.com/electron/electron/pull/43185

* Migrate gin_helper/promise.h and gin_helper/promise.cc to v8::MicrotasksScope

Restores the [original][1] behavior of running the microtask checkpoint at destruction, but preserves the behavior of running microtasks in the browser process. This had last changed in the migration to gin_helper::MicroTasks.

[1]: https://github.com/electron/electron/pull/16401
2025-05-07 14:10:34 -05:00
..
accessor.h chore: enable check raw ptr fields (#38167) 2023-05-11 16:07:39 -04:00
arguments.cc chore: cleanup include groupings (#43478) 2024-08-26 10:44:20 -04:00
arguments.h chore: migrate base::StringPiece to std::string_view (#40915) 2024-01-10 19:00:37 -06:00
callback.cc refactor: use v8::True(isolate) and v8::False(isolate) (#46544) 2025-04-08 12:58:39 -05:00
callback.h refactor: replace gin_helper::MicrotasksScope with v8::MicrotasksScope (#46963) 2025-05-07 14:10:34 -05:00
cleaned_up_at_exit.cc fix: crash in gin::wrappable::secondweakcallback (#45368) 2025-01-29 10:20:37 -08:00
cleaned_up_at_exit.h fix: crash in gin::wrappable::secondweakcallback (#45368) 2025-01-29 10:20:37 -08:00
constructible.h chore: more iwyu (#43063) 2024-07-29 12:42:57 -05:00
constructor.h refactor: make a variadic gin_helper::internal::InvokeFactory() (#45988) 2025-03-13 17:24:49 -05:00
destroyable.cc chore: more iwyu (#43063) 2024-07-29 12:42:57 -05:00
destroyable.h chore: more iwyu (#43063) 2024-07-29 12:42:57 -05:00
dictionary.h refactor: add gin_helper::Dictionary::ValueOrDefault() (#46939) 2025-05-06 15:20:12 -05:00
error_thrower.cc perf: have ErrorThrower lazily lookup the current isolate (#46388) 2025-04-01 12:25:27 -05:00
error_thrower.h perf: have ErrorThrower lazily lookup the current isolate (#46388) 2025-04-01 12:25:27 -05:00
event.cc chore: more iwyu (#43063) 2024-07-29 12:42:57 -05:00
event.h refactor: declare gin::Wrapper subclasses as final (#43527) 2024-09-04 18:40:02 -05:00
event_emitter.h perf: avoid redundant method calls in EventEmitter (#45786) 2025-02-25 19:20:33 -06:00
event_emitter_caller.cc refactor: replace gin_helper::MicrotasksScope with v8::MicrotasksScope (#46963) 2025-05-07 14:10:34 -05:00
event_emitter_caller.h refactor: do not use AdaptCallbackForRepeating() in electron_api_url_loader.cc (#45771) 2025-02-24 11:09:01 -05:00
event_emitter_template.cc chore: migrate to v8::Object::SetPrototypeV2() (#43535) 2024-09-04 20:30:54 -05:00
event_emitter_template.h refactor: simplify events (#37099) 2023-02-13 13:39:18 -08:00
function_template.cc chore: remove unused #includes (#42971) 2024-07-22 11:31:32 +02:00
function_template.h refactor: replace gin_helper::MicrotasksScope with v8::MicrotasksScope (#46963) 2025-05-07 14:10:34 -05:00
function_template_extensions.h chore: replace absl::optional<T> with std::optional<T> (#40928) 2024-01-10 16:23:35 -06:00
locker.cc chore: more iwyu (#43063) 2024-07-29 12:42:57 -05:00
locker.h chore: more iwyu (#43063) 2024-07-29 12:42:57 -05:00
object_template_builder.cc chore: migrate base::StringPiece to std::string_view (#40915) 2024-01-10 19:00:37 -06:00
object_template_builder.h chore: migrate base::StringPiece to std::string_view (#40915) 2024-01-10 19:00:37 -06:00
persistent_dictionary.cc chore: remove native_mate (Part 12) (#20869) 2019-10-31 16:56:00 +09:00
persistent_dictionary.h perf: avoid duplicate calculations in gin_helper::Dictionary getters (#43073) 2024-07-29 12:43:28 -05:00
pinnable.h chore: more iwyu (#43063) 2024-07-29 12:42:57 -05:00
promise.cc refactor: replace gin_helper::MicrotasksScope with v8::MicrotasksScope (#46963) 2025-05-07 14:10:34 -05:00
promise.h refactor: replace gin_helper::MicrotasksScope with v8::MicrotasksScope (#46963) 2025-05-07 14:10:34 -05:00
reply_channel.cc feat: service worker preload scripts for improved extensions support (#44411) 2025-01-31 09:32:45 -05:00
reply_channel.h feat: service worker preload scripts for improved extensions support (#44411) 2025-01-31 09:32:45 -05:00
trackable_object.cc chore: fix clang-tidy warnings (#38079) 2023-04-26 10:09:54 -04:00
trackable_object.h refactor: make TrackableObjectBase::weak_map_id_ const (#46524) 2025-04-07 20:49:05 -05:00
wrappable.cc fix: postMessage crash with invalid transferrable (#46639) 2025-04-17 15:09:48 +02:00
wrappable.h fix: postMessage crash with invalid transferrable (#46639) 2025-04-17 15:09:48 +02:00
wrappable_base.h refactor: remove unused gin_helper::WrappableBase::GetWrapper(v8::Isolate*) (#45793) 2025-02-25 19:50:09 -06:00