Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(45)

Issue 1119683003: Implement requestIdleCallback API (Closed)

Created:
5 years, 7 months ago by rmcilroy
Modified:
5 years, 4 months ago
CC:
arv+blink, blink-reviews, blink-reviews-dom_chromium.org, Inactive, dglazkov+blink, eae+blinkwatch, rwlbuis, scheduler-bugs_chromium.org, sof, vivekg_samsung, vivekg__
Target Ref:
refs/heads/master
Project:
blink
Visibility:
Public.

Description

Implementation of the requestIdleCallback API Initial implementation of the requestIdleCallback API based on the spec at https://w3c.github.io/requestidlecallback/. This API is behind a flag and is not enabled by default. BUG=514651 TBR=jochen@chromium.org NOTRY=true Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=200992

Patch Set 1 #

Patch Set 2 : #

Total comments: 16

Patch Set 3 : Rebased and renamed to requestIdleCallback #

Patch Set 4 : Review comments #

Patch Set 5 : Update based on updated spec #

Patch Set 6 : Rebased #

Patch Set 7 : Add LayoutTest and fix minor spec violation #

Total comments: 30

Patch Set 8 : Address Review Comments #

Total comments: 15

Patch Set 9 : Address review comments #

Patch Set 10 : Update to incorportate spec change #11 #

Patch Set 11 : Rebased #

Total comments: 36

Patch Set 12 : Address Elliott's review comments #

Total comments: 16

Patch Set 13 : Address final comments. #

Patch Set 14 : Rebased #

Unified diffs Side-by-side diffs Delta from patch set Stats (+553 lines, -15 lines) Patch
M LayoutTests/VirtualTestSuites View 1 2 3 4 5 6 7 1 chunk +5 lines, -0 lines 0 comments Download
A LayoutTests/virtual/threaded/fast/idle-callback/README.txt View 1 2 3 4 5 6 1 chunk +2 lines, -0 lines 0 comments Download
A LayoutTests/virtual/threaded/fast/idle-callback/basic.html View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +53 lines, -0 lines 0 comments Download
A LayoutTests/virtual/threaded/fast/idle-callback/timeout.html View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +73 lines, -0 lines 0 comments Download
M LayoutTests/webexposed/global-interface-listing-expected.txt View 1 2 3 4 5 6 7 8 9 10 11 12 13 3 chunks +6 lines, -0 lines 0 comments Download
M Source/core/core.gypi View 1 2 3 4 5 6 7 8 9 10 3 chunks +7 lines, -0 lines 0 comments Download
M Source/core/dom/Document.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 5 chunks +7 lines, -0 lines 0 comments Download
M Source/core/dom/Document.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 5 chunks +25 lines, -0 lines 0 comments Download
A Source/core/dom/IdleCallbackDeadline.h View 1 2 3 4 5 6 7 8 9 1 chunk +46 lines, -0 lines 0 comments Download
A Source/core/dom/IdleCallbackDeadline.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +28 lines, -0 lines 0 comments Download
A + Source/core/dom/IdleCallbackDeadline.idl View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +4 lines, -6 lines 0 comments Download
A Source/core/dom/IdleRequestCallback.h View 1 2 3 4 5 6 7 1 chunk +25 lines, -0 lines 0 comments Download
A + Source/core/dom/IdleRequestCallback.idl View 1 2 3 4 5 6 7 8 9 10 1 chunk +4 lines, -3 lines 0 comments Download
A Source/core/dom/ScriptedIdleTaskController.h View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +59 lines, -0 lines 0 comments Download
A Source/core/dom/ScriptedIdleTaskController.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +160 lines, -0 lines 0 comments Download
M Source/core/frame/DOMWindow.h View 1 2 3 4 5 6 7 2 chunks +5 lines, -0 lines 0 comments Download
M Source/core/frame/LocalDOMWindow.h View 1 2 3 4 5 6 7 1 chunk +2 lines, -0 lines 0 comments Download
M Source/core/frame/LocalDOMWindow.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +19 lines, -6 lines 0 comments Download
M Source/core/frame/RemoteDOMWindow.h View 1 2 3 4 5 6 7 1 chunk +2 lines, -0 lines 0 comments Download
M Source/core/frame/RemoteDOMWindow.cpp View 1 2 3 4 5 6 7 1 chunk +11 lines, -0 lines 0 comments Download
M Source/core/frame/Window.idl View 1 2 3 4 1 chunk +3 lines, -0 lines 0 comments Download
M Source/platform/RuntimeEnabledFeatures.in View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +1 line, -0 lines 0 comments Download
M Source/platform/WebScheduler.cpp View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +5 lines, -0 lines 0 comments Download
M public/platform/WebScheduler.h View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +1 line, -0 lines 0 comments Download

Depends on Patchset:

Messages

Total messages: 70 (24 generated)
esprehn
https://codereview.chromium.org/1119683003/diff/20001/Source/core/dom/ScriptedIdleTaskController.cpp File Source/core/dom/ScriptedIdleTaskController.cpp (right): https://codereview.chromium.org/1119683003/diff/20001/Source/core/dom/ScriptedIdleTaskController.cpp#newcode21 Source/core/dom/ScriptedIdleTaskController.cpp:21: ScriptedIdleTaskController::ScriptedIdleTaskController(Document* document) reference https://codereview.chromium.org/1119683003/diff/20001/Source/core/dom/ScriptedIdleTaskController.cpp#newcode23 Source/core/dom/ScriptedIdleTaskController.cpp:23: , m_callbacks() no need ...
5 years, 6 months ago (2015-06-10 07:11:42 UTC) #2
esprehn
btw, I know this wasn't really up for review, but I thought I'd just share ...
5 years, 6 months ago (2015-06-10 07:12:24 UTC) #3
rmcilroy
> btw, I know this wasn't really up for review, but I thought I'd just ...
5 years, 6 months ago (2015-06-10 18:32:41 UTC) #4
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1119683003/100001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1119683003/100001
5 years, 5 months ago (2015-07-23 17:00:45 UTC) #6
commit-bot: I haz the power
Dry run: Try jobs failed on following builders: win_blink_rel on tryserver.blink (JOB_FAILED, http://build.chromium.org/p/tryserver.blink/builders/win_blink_rel/builds/71381)
5 years, 5 months ago (2015-07-23 18:10:58 UTC) #8
rmcilroy
+jochen. Still to add LayoutTests, but feel free to take a look before then if ...
5 years, 4 months ago (2015-07-29 15:21:42 UTC) #10
rmcilroy
Added LayoutTests, please take a look, thanks.
5 years, 4 months ago (2015-07-31 09:04:28 UTC) #11
jochen (gone - plz use gerrit)
https://codereview.chromium.org/1119683003/diff/120001/Source/core/core.gypi File Source/core/core.gypi (right): https://codereview.chromium.org/1119683003/diff/120001/Source/core/core.gypi#newcode2286 Source/core/core.gypi:2286: 'dom/IdleCallbackDeadline.cpp', alphabetical ordering https://codereview.chromium.org/1119683003/diff/120001/Source/core/core.gypi#newcode2372 Source/core/core.gypi:2372: 'dom/ScriptedIdleController.h', ScripedIdle*Task*Controller.h https://codereview.chromium.org/1119683003/diff/120001/Source/core/dom/Document.cpp File ...
5 years, 4 months ago (2015-07-31 09:19:19 UTC) #12
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1119683003/120001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1119683003/120001
5 years, 4 months ago (2015-07-31 12:02:18 UTC) #14
commit-bot: I haz the power
Dry run: Try jobs failed on following builders: android_blink_compile_dbg on tryserver.blink (JOB_FAILED, http://build.chromium.org/p/tryserver.blink/builders/android_blink_compile_dbg/builds/44708) android_blink_compile_rel on ...
5 years, 4 months ago (2015-07-31 12:05:37 UTC) #16
Sami
Looks pretty good I think. A few comments below. https://codereview.chromium.org/1119683003/diff/120001/LayoutTests/virtual/threaded/fast/idle-callback/README.txt File LayoutTests/virtual/threaded/fast/idle-callback/README.txt (right): https://codereview.chromium.org/1119683003/diff/120001/LayoutTests/virtual/threaded/fast/idle-callback/README.txt#newcode2 LayoutTests/virtual/threaded/fast/idle-callback/README.txt:2: ...
5 years, 4 months ago (2015-08-10 09:47:47 UTC) #18
rmcilroy
All comments addressed, ptal, thanks. https://codereview.chromium.org/1119683003/diff/120001/LayoutTests/virtual/threaded/fast/idle-callback/README.txt File LayoutTests/virtual/threaded/fast/idle-callback/README.txt (right): https://codereview.chromium.org/1119683003/diff/120001/LayoutTests/virtual/threaded/fast/idle-callback/README.txt#newcode2 LayoutTests/virtual/threaded/fast/idle-callback/README.txt:2: # --enable-threaded-compositing since the ...
5 years, 4 months ago (2015-08-11 16:30:52 UTC) #19
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1119683003/140001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1119683003/140001
5 years, 4 months ago (2015-08-11 16:45:41 UTC) #21
Sami
Thanks, just tiny nits. https://codereview.chromium.org/1119683003/diff/140001/LayoutTests/virtual/threaded/fast/idle-callback/timeout.html File LayoutTests/virtual/threaded/fast/idle-callback/timeout.html (right): https://codereview.chromium.org/1119683003/diff/140001/LayoutTests/virtual/threaded/fast/idle-callback/timeout.html#newcode39 LayoutTests/virtual/threaded/fast/idle-callback/timeout.html:39: }, 'requestIdleCallback not scheduled when ...
5 years, 4 months ago (2015-08-11 18:03:00 UTC) #22
commit-bot: I haz the power
Dry run: This issue passed the CQ dry run.
5 years, 4 months ago (2015-08-11 18:46:42 UTC) #24
rmcilroy
https://codereview.chromium.org/1119683003/diff/140001/LayoutTests/virtual/threaded/fast/idle-callback/timeout.html File LayoutTests/virtual/threaded/fast/idle-callback/timeout.html (right): https://codereview.chromium.org/1119683003/diff/140001/LayoutTests/virtual/threaded/fast/idle-callback/timeout.html#newcode39 LayoutTests/virtual/threaded/fast/idle-callback/timeout.html:39: }, 'requestIdleCallback not scheduled when event loop is busy.'); ...
5 years, 4 months ago (2015-08-12 14:17:31 UTC) #25
Sami
Thanks! Non-owner lgtm! https://codereview.chromium.org/1119683003/diff/140001/LayoutTests/virtual/threaded/fast/idle-callback/timeout.html File LayoutTests/virtual/threaded/fast/idle-callback/timeout.html (right): https://codereview.chromium.org/1119683003/diff/140001/LayoutTests/virtual/threaded/fast/idle-callback/timeout.html#newcode39 LayoutTests/virtual/threaded/fast/idle-callback/timeout.html:39: }, 'requestIdleCallback not scheduled when event ...
5 years, 4 months ago (2015-08-12 15:47:39 UTC) #26
jochen (gone - plz use gerrit)
i won't have the time to review this thoroughly before my vacation, sorry
5 years, 4 months ago (2015-08-12 16:33:49 UTC) #27
rmcilroy
On 2015/08/12 16:33:49, jochen (ooo) wrote: > i won't have the time to review this ...
5 years, 4 months ago (2015-08-12 21:57:26 UTC) #30
rmcilroy
On 2015/08/12 21:57:26, rmcilroy wrote: > On 2015/08/12 16:33:49, jochen (ooo) wrote: > > i ...
5 years, 4 months ago (2015-08-13 21:43:36 UTC) #31
rmcilroy
Elliott, would you be able to take a look or is there someone else you ...
5 years, 4 months ago (2015-08-13 21:44:34 UTC) #32
esprehn
On 2015/08/13 at 21:44:34, rmcilroy wrote: > Elliott, would you be able to take a ...
5 years, 4 months ago (2015-08-13 21:59:41 UTC) #33
rmcilroy
> Sure I'll look this over Thanks Elliott. Any chance you could have a look ...
5 years, 4 months ago (2015-08-18 11:17:25 UTC) #34
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1119683003/220001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1119683003/220001
5 years, 4 months ago (2015-08-20 13:34:34 UTC) #37
rmcilroy
Updated to incorporate the spec change from deadline/isExceeded() to timeRemaining() as discussed on https://github.com/w3c/requestidlecallback/issues/11. Elliott ...
5 years, 4 months ago (2015-08-20 13:39:09 UTC) #38
commit-bot: I haz the power
Dry run: This issue passed the CQ dry run.
5 years, 4 months ago (2015-08-20 18:37:29 UTC) #40
esprehn
https://codereview.chromium.org/1119683003/diff/220001/LayoutTests/virtual/threaded/fast/idle-callback/README.txt File LayoutTests/virtual/threaded/fast/idle-callback/README.txt (right): https://codereview.chromium.org/1119683003/diff/220001/LayoutTests/virtual/threaded/fast/idle-callback/README.txt#newcode2 LayoutTests/virtual/threaded/fast/idle-callback/README.txt:2: # --enable-threaded-compositing since the tests require threaded compositing It ...
5 years, 4 months ago (2015-08-20 20:45:56 UTC) #41
esprehn
https://codereview.chromium.org/1119683003/diff/220001/Source/core/dom/ScriptedIdleTaskController.h File Source/core/dom/ScriptedIdleTaskController.h (right): https://codereview.chromium.org/1119683003/diff/220001/Source/core/dom/ScriptedIdleTaskController.h#newcode86 Source/core/dom/ScriptedIdleTaskController.h:86: PersistentHeapHashMapWillBeHeapHashMap<CallbackId, Member<IdleRequestCallback>> m_callbacks; I think you just want WillBeHeapHashMap, ...
5 years, 4 months ago (2015-08-20 21:52:40 UTC) #42
rmcilroy
Thanks for the review Elliott. All comments addressed as discussed offline. If you get another ...
5 years, 4 months ago (2015-08-21 00:03:45 UTC) #43
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1119683003/240001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1119683003/240001
5 years, 4 months ago (2015-08-21 00:04:45 UTC) #45
commit-bot: I haz the power
Dry run: This issue passed the CQ dry run.
5 years, 4 months ago (2015-08-21 02:42:54 UTC) #47
esprehn
Please fix the going negative bug, timeRemaining needs to be >= 0. We also need ...
5 years, 4 months ago (2015-08-21 08:22:21 UTC) #48
rmcilroy
All comments addressed. Sami, could you give this a final once-over and check you're OK ...
5 years, 4 months ago (2015-08-21 11:21:52 UTC) #49
rmcilroy
All comments addressed. Sami, could you give this a final once-over and check you're OK ...
5 years, 4 months ago (2015-08-21 11:21:52 UTC) #50
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1119683003/260001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1119683003/260001
5 years, 4 months ago (2015-08-21 11:25:22 UTC) #52
commit-bot: I haz the power
Dry run: Try jobs failed on following builders: linux_chromium_compile_dbg_32_ng on tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_compile_dbg_32_ng/builds/87976) mac_chromium_compile_dbg_ng on ...
5 years, 4 months ago (2015-08-21 11:26:56 UTC) #54
Sami
Looks great. Posting the timeout as normal timer task is way cleaner. lgtm.
5 years, 4 months ago (2015-08-21 11:32:48 UTC) #55
rmcilroy
On 2015/08/21 11:32:48, Sami wrote: > Looks great. Posting the timeout as normal timer task ...
5 years, 4 months ago (2015-08-21 12:06:40 UTC) #56
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1119683003/280001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1119683003/280001
5 years, 4 months ago (2015-08-21 12:07:04 UTC) #59
commit-bot: I haz the power
Try jobs failed on following builders: win_chromium_rel_ng on tryserver.chromium.win (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.win/builders/win_chromium_rel_ng/builds/96736)
5 years, 4 months ago (2015-08-21 13:21:53 UTC) #61
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1119683003/280001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1119683003/280001
5 years, 4 months ago (2015-08-21 14:50:09 UTC) #63
igrigorik
> https://codereview.chromium.org/1119683003/diff/240001/Source/core/dom/ScriptedIdleTaskController.cpp#newcode35 > Source/core/dom/ScriptedIdleTaskController.cpp:35: > callbackWrapper->controller()->callbackFired(callbackWrapper->id(), > deadlineSeconds, IdleCallbackDeadline::CallbackType::CalledWhenIdle); > On 2015/08/21 08:22:21, esprehn wrote: ...
5 years, 4 months ago (2015-08-21 14:55:02 UTC) #64
commit-bot: I haz the power
Try jobs failed on following builders: linux_chromium_rel_ng on tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_rel_ng/builds/101874)
5 years, 4 months ago (2015-08-21 17:04:32 UTC) #66
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1119683003/280001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1119683003/280001
5 years, 4 months ago (2015-08-21 17:12:49 UTC) #68
commit-bot: I haz the power
Committed patchset #14 (id:280001) as https://src.chromium.org/viewvc/blink?view=rev&revision=200992
5 years, 4 months ago (2015-08-21 17:17:53 UTC) #69
rmcilroy
5 years, 4 months ago (2015-08-21 17:24:08 UTC) #70
Message was sent while issue was closed.
> What Elliott is highlighting here is a bit different: 
> - For idle periods that are <20ms have a minimum reporting granularity of ~2ms
-
> e.g. 10ms, 8ms, 6ms.
> - For long idle periods that are >20ms we can be precise.
> 
> The intent is to avoid giving extra information to raF-based timing attacks.

Is this something which has been discussed somewhere already or is it just an
idea at the moment? Personally 2ms seems a bit too granular, particularly since
the clamping of now() is only to 5us which is much smaller. In any case, This
should be something we add to the spec once we decide.

Powered by Google App Engine
This is Rietveld 408576698