-
Notifications
You must be signed in to change notification settings - Fork 15.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor: reduce code duplication in gin_helper::Promise #43716
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ckerr
added
semver/patch
backwards-compatible bug fixes
target/33-x-y
PR should also be added to the "33-x-y" branch.
labels
Sep 13, 2024
idea stolen from SpellCheckScope
ckerr
force-pushed
the
refactor/dry-promise
branch
from
September 14, 2024 21:52
782a222
to
bf59116
Compare
ckerr
force-pushed
the
refactor/dry-promise
branch
from
September 15, 2024 02:15
cb05f18
to
e452dd6
Compare
jkleinsc
approved these changes
Sep 16, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! LGTM
No Release Notes |
I was unable to backport this PR to "33-x-y" cleanly; |
trop
bot
added
needs-manual-bp/33-x-y
and removed
target/33-x-y
PR should also be added to the "33-x-y" branch.
labels
Sep 17, 2024
ckerr
added a commit
that referenced
this pull request
Sep 18, 2024
* refactor: move scope scaffolding into SettletScope idea stolen from SpellCheckScope * refactor: move impl of PromiseBase::RejectPromise() to the cc file * chore: remove unused #include
codebytere
added a commit
that referenced
this pull request
Sep 19, 2024
…3778) refactor: reduce code duplication in gin_helper::Promise (#43716) * refactor: move scope scaffolding into SettletScope idea stolen from SpellCheckScope * refactor: move impl of PromiseBase::RejectPromise() to the cc file * chore: remove unused #include Co-authored-by: Shelley Vohr <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of Change
Refactor some parts of
node_helper::Promise
to avoid code repetition:There were five methods with identical handle/microtask/context scopes setup before doing v8::Promise work. This PR extracts that setup into a new
SettleScope
struct, borrowing the idea fromSpellCheckScope
.There were three methods with identical logic to decide whether to settle the promise immediately or to post it as a task. This PR extracts that logic into a new protected static method,
PromiseBase::GetTaskRunner()
. This has a happy side-effect of decoupling promise.h from the content module, which is good because about 80 files includepromise.h
.Side-cleanup:
PromiseBase::ResolvePromise()
isn't a templated function, so its implementation can be moved from the header into the cc file.There are a handful of unrelated .cc and .h files that need new
#include
lines because they are directly using API that used to be indirectly included via promise.hChecklist
npm test
passesRelease Notes
Notes: none.