|
|
Created:
4 years ago by The one and only Dr. Crash Modified:
3 years, 11 months ago Reviewers:
Mark Mentovai CC:
chromium-reviews, chirantan+watch_chromium.org, vmpstr+watch_chromium.org, dkalin, kumarniranjan Target Ref:
refs/pending/heads/master Project:
chromium Visibility:
Public. |
DescriptionGetTimeToCallback() returns estimated time to callback.
BUG=none
TEST=unit tests
Committed: https://crrev.com/ceb6d93b695b137481f050f5b967d882a77b7398
Cr-Commit-Position: refs/heads/master@{#439174}
Patch Set 1 #
Total comments: 5
Patch Set 2 : Updated unite tests. #Patch Set 3 : Updated doc. #Patch Set 4 : Always return time to call back WRT scheduled time. #Patch Set 5 : Removed an old file that sneaked in the patchest. #
Messages
Total messages: 38 (15 generated)
Description was changed from ========== GetTimeToCallback() returns estimated time to callback. BUG=none TEST=unit tests ========== to ========== GetTimeToCallback() returns estimated time to callback. BUG=none TEST=unit tests ==========
drcrash@chromium.org changed reviewers: + mark@chromium.org
Per our discussion, added a method to return the time to the next callback.
On 2016/12/06 06:29:26, The one and only Dr. Crash wrote: > Per our discussion, added a method to return the time to the next callback. I am open to better names. And maybe it should at least be CallBack (as in call back). I initially thought TimeToFire but I don't see that we use the term "fire" anywhere, while all the doc says "... will call back."
https://codereview.chromium.org/2557663002/diff/1/base/timer/timer.h File base/timer/timer.h (right): https://codereview.chromium.org/2557663002/diff/1/base/timer/timer.h#newcode103 base/timer/timer.h:103: // Returns an estimated time to the timer calling the user_task_ back. If Two spaces between “calling” and “the” should only be one. And add to this comment that the function may return a negative TimeDelta. https://codereview.chromium.org/2557663002/diff/1/base/timer/timer.h#newcode106 base/timer/timer.h:106: virtual TimeDelta GetTimeToCallback() const; No point in making this virtual if nobody overrides it.
https://codereview.chromium.org/2557663002/diff/1/base/timer/timer.h File base/timer/timer.h (right): https://codereview.chromium.org/2557663002/diff/1/base/timer/timer.h#newcode103 base/timer/timer.h:103: // Returns an estimated time to the timer calling the user_task_ back. If On 2016/12/06 18:01:16, Mark Mentovai wrote: > Two spaces between “calling” and “the” should only be one. And add to this > comment that the function may return a negative TimeDelta. Can it return a negative TimeDelta? If the timer isn't running (which will happens automatically for a one shot timer, for example), it will return TimeDelta::Max(). If it is running, then it should always be positive. https://codereview.chromium.org/2557663002/diff/1/base/timer/timer.h#newcode106 base/timer/timer.h:106: virtual TimeDelta GetTimeToCallback() const; On 2016/12/06 18:01:16, Mark Mentovai wrote: > No point in making this virtual if nobody overrides it. Ok. As far as I could tell, other virtual functions (e.g. GetCurrentDelay()) aren't overriden either.
https://codereview.chromium.org/2557663002/diff/1/base/timer/timer.h File base/timer/timer.h (right): https://codereview.chromium.org/2557663002/diff/1/base/timer/timer.h#newcode103 base/timer/timer.h:103: // Returns an estimated time to the timer calling the user_task_ back. If On 2016/12/06 20:04:38, The one and only Dr. Crash wrote: > On 2016/12/06 18:01:16, Mark Mentovai wrote: > > Two spaces between “calling” and “the” should only be one. And add to this > > comment that the function may return a negative TimeDelta. > > > Can it return a negative TimeDelta? If the timer isn't running (which will > happens automatically for a one shot timer, for example), it will return > TimeDelta::Max(). If it is running, then it should always be positive. If things get jammed up and the callback should have fired already but hasn’t had a chance to run, the delta will be negative.
OK. On Tue, Dec 6, 2016, 12:09 <mark@chromium.org> wrote: > > https://codereview.chromium.org/2557663002/diff/1/base/timer/timer.h > File base/timer/timer.h (right): > > > https://codereview.chromium.org/2557663002/diff/1/base/timer/timer.h#newcode103 > base/timer/timer.h:103: // Returns an estimated time to the timer > calling the user_task_ back. If > On 2016/12/06 20:04:38, The one and only Dr. Crash wrote: > > On 2016/12/06 18:01:16, Mark Mentovai wrote: > > > Two spaces between “calling” and “the” should only be one. And add > to this > > > comment that the function may return a negative TimeDelta. > > > > > > Can it return a negative TimeDelta? If the timer isn't running (which > will > > happens automatically for a one shot timer, for example), it will > return > > TimeDelta::Max(). If it is running, then it should always be positive. > > If things get jammed up and the callback should have fired already but > hasn’t had a chance to run, the delta will be negative. > > https://codereview.chromium.org/2557663002/ > -- You received this message because you are subscribed to the Google Groups "Chromium-reviews" group. To unsubscribe from this group and stop receiving emails from it, send an email to chromium-reviews+unsubscribe@chromium.org.
Ignore patchset 2 (wrong git branch). Patchset 3 does what you asked.
The CQ bit was checked by drcrash@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
LGTM
The CQ bit was unchecked by drcrash@chromium.org
So I realized that if the timer has fired (or was scheduled to be fired, unless we want more state in the Timer class to record that it had fired), I would like GetTimeToCallback() to return a negative time (how long ago it fired). I was going to look at the desired_/scheduled_run_time_ not being zero, but the .h says they might actually be zero for tasks that run immediately, though I don't really see that in the code? On Tue, Dec 6, 2016 at 2:37 PM, <mark@chromium.org> wrote: > LGTM > > https://codereview.chromium.org/2557663002/ > -- You received this message because you are subscribed to the Google Groups "Chromium-reviews" group. To unsubscribe from this group and stop receiving emails from it, send an email to chromium-reviews+unsubscribe@chromium.org.
Mark, I made the changes I was talking about, do you want to have a look before I submit?
LGTM
The CQ bit was checked by drcrash@chromium.org
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Try jobs failed on following builders: ios-simulator on master.tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/ios-simulator/bui...)
The CQ bit was checked by drcrash@chromium.org
The patchset sent to the CQ was uploaded after l-g-t-m from mark@chromium.org Link to the patchset: https://codereview.chromium.org/2557663002/#ps80001 (title: "Removed an old file that sneaked in the patchest.")
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Try jobs failed on following builders: linux_chromium_rel_ng on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_...)
The CQ bit was checked by drcrash@chromium.org
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
CQ is committing da patch. Bot data: {"patchset_id": 80001, "attempt_start_ts": 1481910914546310, "parent_rev": "9b3286e384f88274269262268681753ba8290bca", "commit_rev": "ddffe90abf4e3ee57c51d7bed6d3c17e21928d7c"}
Message was sent while issue was closed.
Description was changed from ========== GetTimeToCallback() returns estimated time to callback. BUG=none TEST=unit tests ========== to ========== GetTimeToCallback() returns estimated time to callback. BUG=none TEST=unit tests Review-Url: https://codereview.chromium.org/2557663002 ==========
Message was sent while issue was closed.
Committed patchset #5 (id:80001)
Message was sent while issue was closed.
Description was changed from ========== GetTimeToCallback() returns estimated time to callback. BUG=none TEST=unit tests Review-Url: https://codereview.chromium.org/2557663002 ========== to ========== GetTimeToCallback() returns estimated time to callback. BUG=none TEST=unit tests Committed: https://crrev.com/ceb6d93b695b137481f050f5b967d882a77b7398 Cr-Commit-Position: refs/heads/master@{#439174} ==========
Message was sent while issue was closed.
Patchset 5 (id:??) landed as https://crrev.com/ceb6d93b695b137481f050f5b967d882a77b7398 Cr-Commit-Position: refs/heads/master@{#439174}
Message was sent while issue was closed.
What was this added for? There's not associated BUG on this CL and I don't see any other callers still today on trunk? This call is a pain to handle in my rewrite of base::Timer: https://codereview.chromium.org/2491613004/
Message was sent while issue was closed.
Description was changed from ========== GetTimeToCallback() returns estimated time to callback. BUG=none TEST=unit tests Committed: https://crrev.com/ceb6d93b695b137481f050f5b967d882a77b7398 Cr-Commit-Position: refs/heads/master@{#439174} ========== to ========== GetTimeToCallback() returns estimated time to callback. BUG=none TEST=unit tests Committed: https://crrev.com/ceb6d93b695b137481f050f5b967d882a77b7398 Cr-Commit-Position: refs/heads/master@{#439174} ==========
Message was sent while issue was closed.
I added that to be able to handle timeouts across multiple calls in a pending CL. I can probably deal with that in a different way, pushing the complexity to the client. However, it's pretty useful to be enable how much time one has left on a timer... Why is it a pain to handle? On Fri, Dec 23, 2016 at 12:21 PM, <gab@chromium.org> wrote: > What was this added for? There's not associated BUG on this CL and I don't > see > any other callers still today on trunk? > > This call is a pain to handle in my rewrite of base::Timer: > https://codereview.chromium.org/2491613004/ > > https://codereview.chromium.org/2557663002/ > -- You received this message because you are subscribed to the Google Groups "Chromium-reviews" group. To unsubscribe from this group and stop receiving emails from it, send an email to chromium-reviews+unsubscribe@chromium.org.
Message was sent while issue was closed.
On 2016/12/28 18:04:45, The one and only Dr. Crash wrote: > I added that to be able to handle timeouts across multiple calls in a > pending CL. I can probably deal with that in a different way, pushing the > complexity to the client. However, it's pretty useful to be enable how much > time one has left on a timer... Why is it a pain to handle? Because in https://codereview.chromium.org/2491613004/, the delayed task can be on a separate sequence when SetTaskRunner() is used (as it should currently be but the current impl is racy). In that CL, another internal object owns "time" and it can only be queried asynchronously if SetTaskRunner() is used. > > On Fri, Dec 23, 2016 at 12:21 PM, <https://mail.google.com/mail/?view=cm&fs=1&tf=1&to=gab@chromium.org> wrote: > > > What was this added for? There's not associated BUG on this CL and I don't > > see > > any other callers still today on trunk? > > > > This call is a pain to handle in my rewrite of base::Timer: > > https://codereview.chromium.org/2491613004/ > > > > https://codereview.chromium.org/2557663002/ > > > > -- > You received this message because you are subscribed to the Google Groups > "Chromium-reviews" group. > To unsubscribe from this group and stop receiving emails from it, send an email > to https://mail.google.com/mail/?view=cm&fs=1&tf=1&to=chromium-reviews+unsubscri....
Message was sent while issue was closed.
Ok, get rid of that method then and I'll do something on my side. On Thu, Jan 5, 2017 at 2:21 PM, <gab@chromium.org> wrote: > On 2016/12/28 18:04:45, The one and only Dr. Crash wrote: > > I added that to be able to handle timeouts across multiple calls in a > > pending CL. I can probably deal with that in a different way, pushing the > > complexity to the client. However, it's pretty useful to be enable how > much > > time one has left on a timer... Why is it a pain to handle? > > Because in https://codereview.chromium.org/2491613004/, the delayed task > can be > on a separate sequence when SetTaskRunner() is used (as it should > currently be > but the current impl is racy). In that CL, another internal object owns > "time" > and it can only be queried asynchronously if SetTaskRunner() is used. > > > > > On Fri, Dec 23, 2016 at 12:21 PM, > <https://mail.google.com/mail/?view=cm&fs=1&tf=1&to=gab@chromium.org> > wrote: > > > > > What was this added for? There's not associated BUG on this CL and I > don't > > > see > > > any other callers still today on trunk? > > > > > > This call is a pain to handle in my rewrite of base::Timer: > > > https://codereview.chromium.org/2491613004/ > > > > > > https://codereview.chromium.org/2557663002/ > > > > > > > -- > > You received this message because you are subscribed to the Google Groups > > "Chromium-reviews" group. > > To unsubscribe from this group and stop receiving emails from it, send an > email > > to > https://mail.google.com/mail/?view=cm&fs=1&tf=1&to=chromium- > reviews+unsubscribe@chromium.org. > > > > https://codereview.chromium.org/2557663002/ > -- You received this message because you are subscribed to the Google Groups "Chromium-reviews" group. To unsubscribe from this group and stop receiving emails from it, send an email to chromium-reviews+unsubscribe@chromium.org.
Message was sent while issue was closed.
A revert of this CL (patchset #5 id:80001) has been created in https://codereview.chromium.org/2621663002/ by gab@chromium.org. The reason for reverting is: Removing Timer::GetTimeToCallback() as discussed post commit on CL introducing it.. |