Skip to content
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

src: introduce TimerWrap/TimerWrapHandle utility #34186

Closed
wants to merge 3 commits into from

Conversation

jasnell
Copy link
Member

@jasnell jasnell commented Jul 3, 2020

Several places throughout src/* make use of uv_timer_t internally (inspector, perf, quic, etc). These duplicate code. This introduces a new utility class to consolidate code and make it easier overall to work with internal uv_timer_t instances.

First commit adds the utility, subsequent commits update systems that use it.

The quic specific commit cannot be backported to 14.x, the rest of the commits are backportable.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines

@jasnell jasnell requested a review from a team July 3, 2020 17:01
@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. lib / src Issues and PRs related to general changes in the lib or src directory. labels Jul 3, 2020
@nodejs-github-bot
Copy link
Collaborator

src/timer_wrap.cc Show resolved Hide resolved
src/timer_wrap.h Outdated Show resolved Hide resolved
src/node_perf.cc Outdated Show resolved Hide resolved
src/node_perf.h Outdated Show resolved Hide resolved
@jasnell jasnell requested a review from addaleax July 3, 2020 18:27
@jasnell jasnell added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Jul 3, 2020
@nodejs-github-bot
Copy link
Collaborator

nodejs-github-bot commented Jul 3, 2020

CI: https://ci.nodejs.org/job/node-test-pull-request/32204/ (:yellow_heart:)

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

jasnell added 3 commits July 5, 2020 14:21
Consolidate uv_timer_t boilerplate code into a shared utility.
There are several places throughout the code where we use uv_timer_t
internally (inspector, perf, quic), with some code duplication.
This eliminates the duplicated code, ensures that cleanup occurs
correctly, and simplifies use of the timers.

Signed-off-by: James M Snell <jasnell@gmail.com>
Signed-off-by: James M Snell <jasnell@gmail.com>
Signed-off-by: James M Snell <jasnell@gmail.com>
jasnell added a commit that referenced this pull request Jul 5, 2020
Consolidate uv_timer_t boilerplate code into a shared utility.
There are several places throughout the code where we use uv_timer_t
internally (inspector, perf, quic), with some code duplication.
This eliminates the duplicated code, ensures that cleanup occurs
correctly, and simplifies use of the timers.

Signed-off-by: James M Snell <jasnell@gmail.com>

PR-URL: #34186
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
jasnell added a commit that referenced this pull request Jul 5, 2020
Signed-off-by: James M Snell <jasnell@gmail.com>

PR-URL: #34186
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
jasnell added a commit that referenced this pull request Jul 5, 2020
Signed-off-by: James M Snell <jasnell@gmail.com>

PR-URL: #34186
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
@jasnell
Copy link
Member Author

jasnell commented Jul 5, 2020

Landed in d4f6900, e19a251, and 0f97d60

@jasnell jasnell closed this Jul 5, 2020
addaleax added a commit to addaleax/node that referenced this pull request Jul 7, 2020
0f97d60 accidentally removed this.

Refs: nodejs#34186
jasnell pushed a commit to jasnell/node that referenced this pull request Jul 8, 2020
0f97d60 accidentally removed this.

Refs: nodejs#34186
jasnell pushed a commit that referenced this pull request Jul 9, 2020
0f97d60 accidentally removed this.

Refs: #34186

PR-URL: #34247
Reviewed-By: James M Snell <jasnell@gmail.com>
@MylesBorins
Copy link
Contributor

Marked as "backport-requested" because I do not believe quic is on 14.x yet. Should we change the label to "dont-land"?

@targos targos added backported-to-v14.x and removed author ready PRs that have at least one approval, no pending requests for changes, and a CI started. backport-requested-v14.x labels Apr 30, 2021
targos pushed a commit that referenced this pull request May 1, 2021
Consolidate uv_timer_t boilerplate code into a shared utility.
There are several places throughout the code where we use uv_timer_t
internally (inspector, perf, quic), with some code duplication.
This eliminates the duplicated code, ensures that cleanup occurs
correctly, and simplifies use of the timers.

Signed-off-by: James M Snell <jasnell@gmail.com>

PR-URL: #34186
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
targos pushed a commit that referenced this pull request May 1, 2021
Signed-off-by: James M Snell <jasnell@gmail.com>

PR-URL: #34186
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
@danielleadams danielleadams mentioned this pull request May 3, 2021
codebytere added a commit to electron/electron that referenced this pull request May 14, 2021
codebytere added a commit to electron/electron that referenced this pull request May 14, 2021
codebytere added a commit to electron/electron that referenced this pull request May 18, 2021
codebytere added a commit to electron/electron that referenced this pull request May 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c++ Issues and PRs that require attention from people who are familiar with C++. lib / src Issues and PRs related to general changes in the lib or src directory.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants