Moving the scheduler into blink makes it possible for us to fix various issues that were not previously possible to to fix with the old layering. https://docs.google.com/document/d/1gNpWSrF3Qz3vFc9FBMO8ArDlNDGbU_HKHeQlFDBgI-k/edit#
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/098f0e5e5786dbccfe2aef2d9b8319dc92798b99 commit 098f0e5e5786dbccfe2aef2d9b8319dc92798b99 Author: alexclarke <alexclarke@chromium.org> Date: Fri Aug 19 12:55:38 2016 Make tasks cancellable inside the blink scheduler. The complexity of WorkQueue got a bit worse O(log n) insert & pop but this seems unlikely to matter in prartice because the queues never really get big enough for this to matter. Follow on patches will enable Timer<> to use the new style of cancellation which result in smaller queues. Note the cost of running a NOP task is currently quite high so overall we should get a net benefit once Blink tasks use the new API even if this patch adds extra overhead. BUG= 638542 , 605718 Review-Url: https://codereview.chromium.org/2258713004 Cr-Commit-Position: refs/heads/master@{#413120} [modify] https://crrev.com/098f0e5e5786dbccfe2aef2d9b8319dc92798b99/third_party/WebKit/Source/platform/scheduler/base/enqueue_order.cc [modify] https://crrev.com/098f0e5e5786dbccfe2aef2d9b8319dc92798b99/third_party/WebKit/Source/platform/scheduler/base/enqueue_order.h [modify] https://crrev.com/098f0e5e5786dbccfe2aef2d9b8319dc92798b99/third_party/WebKit/Source/platform/scheduler/base/task_queue_impl.cc [modify] https://crrev.com/098f0e5e5786dbccfe2aef2d9b8319dc92798b99/third_party/WebKit/Source/platform/scheduler/base/task_queue_impl.h [modify] https://crrev.com/098f0e5e5786dbccfe2aef2d9b8319dc92798b99/third_party/WebKit/Source/platform/scheduler/base/task_queue_manager_unittest.cc [modify] https://crrev.com/098f0e5e5786dbccfe2aef2d9b8319dc92798b99/third_party/WebKit/Source/platform/scheduler/base/task_queue_selector_unittest.cc [modify] https://crrev.com/098f0e5e5786dbccfe2aef2d9b8319dc92798b99/third_party/WebKit/Source/platform/scheduler/base/time_domain.cc [modify] https://crrev.com/098f0e5e5786dbccfe2aef2d9b8319dc92798b99/third_party/WebKit/Source/platform/scheduler/base/time_domain.h [modify] https://crrev.com/098f0e5e5786dbccfe2aef2d9b8319dc92798b99/third_party/WebKit/Source/platform/scheduler/base/time_domain_unittest.cc [modify] https://crrev.com/098f0e5e5786dbccfe2aef2d9b8319dc92798b99/third_party/WebKit/Source/platform/scheduler/base/work_queue.cc [modify] https://crrev.com/098f0e5e5786dbccfe2aef2d9b8319dc92798b99/third_party/WebKit/Source/platform/scheduler/base/work_queue.h [modify] https://crrev.com/098f0e5e5786dbccfe2aef2d9b8319dc92798b99/third_party/WebKit/Source/platform/scheduler/base/work_queue_sets.cc [modify] https://crrev.com/098f0e5e5786dbccfe2aef2d9b8319dc92798b99/third_party/WebKit/Source/platform/scheduler/base/work_queue_sets.h [modify] https://crrev.com/098f0e5e5786dbccfe2aef2d9b8319dc92798b99/third_party/WebKit/Source/platform/scheduler/base/work_queue_sets_unittest.cc [modify] https://crrev.com/098f0e5e5786dbccfe2aef2d9b8319dc92798b99/third_party/WebKit/Source/platform/scheduler/child/compositor_worker_scheduler.cc [modify] https://crrev.com/098f0e5e5786dbccfe2aef2d9b8319dc92798b99/third_party/WebKit/Source/platform/scheduler/child/webthread_impl_for_worker_scheduler.cc [modify] https://crrev.com/098f0e5e5786dbccfe2aef2d9b8319dc92798b99/third_party/WebKit/public/platform/scheduler/base/task_queue.h
It wasn't terribly scientific but I took some measurements of task cancellation and it turns out tasks are cancelled a lot more than I expected! https://docs.google.com/document/d/1IummzxGNDkgBdPOZFxyPPFhPIGLqrB5N8UpX65vOEjk/edit# Running cancelled tasks is expensive on Android too.
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/4dab46210f989c26fb3cb40064a8d60846015f38 commit 4dab46210f989c26fb3cb40064a8d60846015f38 Author: alexclarke <alexclarke@chromium.org> Date: Fri Aug 26 22:33:55 2016 Optimize posting of WTF::Closure and improve scheduler test mocks Previously posting a WTF::Closure (which contains a base::Closure) resulted in it getting wrapped in a WebTaskRunner::Task which was then wrapped in a base::Closure! We fix that here by posting the wrapped base::Closure directly. We also and refactor the various blink scheduler mocks to use either a real scheduler or a centralized FakeWebTaskRunner. At Sami's request taskRunner has been renamed to toSingleThreadTaskRunner. BUG= 638542 Review-Url: https://codereview.chromium.org/2266443002 Cr-Commit-Position: refs/heads/master@{#414834} [modify] https://crrev.com/4dab46210f989c26fb3cb40064a8d60846015f38/content/child/web_url_loader_impl.cc [modify] https://crrev.com/4dab46210f989c26fb3cb40064a8d60846015f38/third_party/WebKit/Source/core/dom/ScriptRunnerTest.cpp [modify] https://crrev.com/4dab46210f989c26fb3cb40064a8d60846015f38/third_party/WebKit/Source/core/fetch/ImageResourceTest.cpp [modify] https://crrev.com/4dab46210f989c26fb3cb40064a8d60846015f38/third_party/WebKit/Source/core/fetch/ResourceFetcherTest.cpp [modify] https://crrev.com/4dab46210f989c26fb3cb40064a8d60846015f38/third_party/WebKit/Source/core/layout/ImageQualityControllerTest.cpp [modify] https://crrev.com/4dab46210f989c26fb3cb40064a8d60846015f38/third_party/WebKit/Source/core/svg/graphics/SVGImageTest.cpp [modify] https://crrev.com/4dab46210f989c26fb3cb40064a8d60846015f38/third_party/WebKit/Source/platform/DEPS [modify] https://crrev.com/4dab46210f989c26fb3cb40064a8d60846015f38/third_party/WebKit/Source/platform/TimerTest.cpp [modify] https://crrev.com/4dab46210f989c26fb3cb40064a8d60846015f38/third_party/WebKit/Source/platform/WebTaskRunner.cpp [modify] https://crrev.com/4dab46210f989c26fb3cb40064a8d60846015f38/third_party/WebKit/Source/platform/blink_platform.gypi [modify] https://crrev.com/4dab46210f989c26fb3cb40064a8d60846015f38/third_party/WebKit/Source/platform/graphics/RecordingImageBufferSurfaceTest.cpp [modify] https://crrev.com/4dab46210f989c26fb3cb40064a8d60846015f38/third_party/WebKit/Source/platform/scheduler/child/web_task_runner_impl.cc [modify] https://crrev.com/4dab46210f989c26fb3cb40064a8d60846015f38/third_party/WebKit/Source/platform/scheduler/child/web_task_runner_impl.h [add] https://crrev.com/4dab46210f989c26fb3cb40064a8d60846015f38/third_party/WebKit/Source/platform/scheduler/test/fake_web_task_runner.cc [add] https://crrev.com/4dab46210f989c26fb3cb40064a8d60846015f38/third_party/WebKit/Source/platform/scheduler/test/fake_web_task_runner.h [modify] https://crrev.com/4dab46210f989c26fb3cb40064a8d60846015f38/third_party/WebKit/Source/platform/testing/TestingPlatformSupport.cpp [modify] https://crrev.com/4dab46210f989c26fb3cb40064a8d60846015f38/third_party/WebKit/Source/platform/testing/TestingPlatformSupport.h [modify] https://crrev.com/4dab46210f989c26fb3cb40064a8d60846015f38/third_party/WebKit/public/platform/WebTaskRunner.h
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/c2db8aa78e1130a08bd47f2aa611f322afaf8dc5 commit c2db8aa78e1130a08bd47f2aa611f322afaf8dc5 Author: alexclarke <alexclarke@chromium.org> Date: Mon Sep 05 18:04:20 2016 Remove after wakeup logic and replace PumpTask with Fences Task pumping is a neat concept for throttling but it adds a lot of complexity to the task queues. For example it prevents the WorkQueues from being read only (which they could otherwise be). Fences provide similar functionality but don't preclude various queue optimizations. They are also a more familiar concept which should make the code easier to comprehend. The after wake up logic isn't used and it also adds a lot of complexity. Lets get rid of it :) BUG= 638542 Review-Url: https://codereview.chromium.org/2276353002 Cr-Commit-Position: refs/heads/master@{#416558} [modify] https://crrev.com/c2db8aa78e1130a08bd47f2aa611f322afaf8dc5/third_party/WebKit/Source/platform/BUILD.gn [modify] https://crrev.com/c2db8aa78e1130a08bd47f2aa611f322afaf8dc5/third_party/WebKit/Source/platform/WebScheduler.cpp [modify] https://crrev.com/c2db8aa78e1130a08bd47f2aa611f322afaf8dc5/third_party/WebKit/Source/platform/scheduler/base/task_queue_impl.cc [modify] https://crrev.com/c2db8aa78e1130a08bd47f2aa611f322afaf8dc5/third_party/WebKit/Source/platform/scheduler/base/task_queue_impl.h [modify] https://crrev.com/c2db8aa78e1130a08bd47f2aa611f322afaf8dc5/third_party/WebKit/Source/platform/scheduler/base/task_queue_manager.cc [modify] https://crrev.com/c2db8aa78e1130a08bd47f2aa611f322afaf8dc5/third_party/WebKit/Source/platform/scheduler/base/task_queue_manager.h [modify] https://crrev.com/c2db8aa78e1130a08bd47f2aa611f322afaf8dc5/third_party/WebKit/Source/platform/scheduler/base/task_queue_manager_unittest.cc [modify] https://crrev.com/c2db8aa78e1130a08bd47f2aa611f322afaf8dc5/third_party/WebKit/Source/platform/scheduler/base/time_domain.cc [modify] https://crrev.com/c2db8aa78e1130a08bd47f2aa611f322afaf8dc5/third_party/WebKit/Source/platform/scheduler/base/time_domain.h [modify] https://crrev.com/c2db8aa78e1130a08bd47f2aa611f322afaf8dc5/third_party/WebKit/Source/platform/scheduler/base/time_domain_unittest.cc [modify] https://crrev.com/c2db8aa78e1130a08bd47f2aa611f322afaf8dc5/third_party/WebKit/Source/platform/scheduler/base/work_queue.cc [modify] https://crrev.com/c2db8aa78e1130a08bd47f2aa611f322afaf8dc5/third_party/WebKit/Source/platform/scheduler/base/work_queue.h [add] https://crrev.com/c2db8aa78e1130a08bd47f2aa611f322afaf8dc5/third_party/WebKit/Source/platform/scheduler/base/work_queue_unittest.cc [modify] https://crrev.com/c2db8aa78e1130a08bd47f2aa611f322afaf8dc5/third_party/WebKit/Source/platform/scheduler/child/compositor_worker_scheduler.cc [modify] https://crrev.com/c2db8aa78e1130a08bd47f2aa611f322afaf8dc5/third_party/WebKit/Source/platform/scheduler/child/idle_helper.cc [modify] https://crrev.com/c2db8aa78e1130a08bd47f2aa611f322afaf8dc5/third_party/WebKit/Source/platform/scheduler/child/idle_helper.h [modify] https://crrev.com/c2db8aa78e1130a08bd47f2aa611f322afaf8dc5/third_party/WebKit/Source/platform/scheduler/child/idle_helper_unittest.cc [modify] https://crrev.com/c2db8aa78e1130a08bd47f2aa611f322afaf8dc5/third_party/WebKit/Source/platform/scheduler/child/scheduler_helper.cc [modify] https://crrev.com/c2db8aa78e1130a08bd47f2aa611f322afaf8dc5/third_party/WebKit/Source/platform/scheduler/child/scheduler_helper.h [modify] https://crrev.com/c2db8aa78e1130a08bd47f2aa611f322afaf8dc5/third_party/WebKit/Source/platform/scheduler/child/scheduler_helper_unittest.cc [modify] https://crrev.com/c2db8aa78e1130a08bd47f2aa611f322afaf8dc5/third_party/WebKit/Source/platform/scheduler/child/single_thread_idle_task_runner.cc [modify] https://crrev.com/c2db8aa78e1130a08bd47f2aa611f322afaf8dc5/third_party/WebKit/Source/platform/scheduler/child/web_scheduler_impl.cc [modify] https://crrev.com/c2db8aa78e1130a08bd47f2aa611f322afaf8dc5/third_party/WebKit/Source/platform/scheduler/child/web_scheduler_impl.h [modify] https://crrev.com/c2db8aa78e1130a08bd47f2aa611f322afaf8dc5/third_party/WebKit/Source/platform/scheduler/child/webthread_base.cc [modify] https://crrev.com/c2db8aa78e1130a08bd47f2aa611f322afaf8dc5/third_party/WebKit/Source/platform/scheduler/child/worker_scheduler_impl_unittest.cc [modify] https://crrev.com/c2db8aa78e1130a08bd47f2aa611f322afaf8dc5/third_party/WebKit/Source/platform/scheduler/renderer/renderer_scheduler_impl_unittest.cc [modify] https://crrev.com/c2db8aa78e1130a08bd47f2aa611f322afaf8dc5/third_party/WebKit/Source/platform/scheduler/renderer/throttling_helper.cc [modify] https://crrev.com/c2db8aa78e1130a08bd47f2aa611f322afaf8dc5/third_party/WebKit/Source/platform/scheduler/renderer/throttling_helper.h [modify] https://crrev.com/c2db8aa78e1130a08bd47f2aa611f322afaf8dc5/third_party/WebKit/Source/platform/scheduler/renderer/throttling_helper_unittest.cc [modify] https://crrev.com/c2db8aa78e1130a08bd47f2aa611f322afaf8dc5/third_party/WebKit/Source/platform/scheduler/renderer/web_frame_scheduler_impl.h [modify] https://crrev.com/c2db8aa78e1130a08bd47f2aa611f322afaf8dc5/third_party/WebKit/Source/platform/testing/TestingPlatformSupport.h [modify] https://crrev.com/c2db8aa78e1130a08bd47f2aa611f322afaf8dc5/third_party/WebKit/public/platform/WebScheduler.h [modify] https://crrev.com/c2db8aa78e1130a08bd47f2aa611f322afaf8dc5/third_party/WebKit/public/platform/scheduler/base/task_queue.h [modify] https://crrev.com/c2db8aa78e1130a08bd47f2aa611f322afaf8dc5/third_party/WebKit/public/platform/scheduler/child/single_thread_idle_task_runner.h [modify] https://crrev.com/c2db8aa78e1130a08bd47f2aa611f322afaf8dc5/third_party/WebKit/public/platform/scheduler/child/webthread_base.h
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/e4e5868c5f32b015bf0d07a6eeace892d6a789a1 commit e4e5868c5f32b015bf0d07a6eeace892d6a789a1 Author: alexclarke <alexclarke@chromium.org> Date: Fri Sep 09 17:42:13 2016 Make canceling Timers fast. base::Closure recently got an IsCancelled method. Taking advantage of that the scheduler can short circuit a bunch of logic for cancelled tasks and avoid running them and the rest of the task selection machinery. On the new TimerPerfTest benchmark this makes running 10000 cancelled tasks aprox 50x - 60x faster (measured on Android and Linux). Note this patch reverts many of the changes made in https://codereview.chromium.org/2258713004 in favor of WeakPtr based cancellation as favored by the base owners. BUG= 605718 , 638542 Review-Url: https://codereview.chromium.org/2319053004 Cr-Commit-Position: refs/heads/master@{#417621} [modify] https://crrev.com/e4e5868c5f32b015bf0d07a6eeace892d6a789a1/third_party/WebKit/Source/platform/Timer.cpp [modify] https://crrev.com/e4e5868c5f32b015bf0d07a6eeace892d6a789a1/third_party/WebKit/Source/platform/Timer.h [modify] https://crrev.com/e4e5868c5f32b015bf0d07a6eeace892d6a789a1/third_party/WebKit/Source/platform/scheduler/base/task_queue_impl.cc [modify] https://crrev.com/e4e5868c5f32b015bf0d07a6eeace892d6a789a1/third_party/WebKit/Source/platform/scheduler/base/task_queue_impl.h [modify] https://crrev.com/e4e5868c5f32b015bf0d07a6eeace892d6a789a1/third_party/WebKit/Source/platform/scheduler/base/task_queue_manager.cc [modify] https://crrev.com/e4e5868c5f32b015bf0d07a6eeace892d6a789a1/third_party/WebKit/Source/platform/scheduler/base/task_queue_manager_perftest.cc [modify] https://crrev.com/e4e5868c5f32b015bf0d07a6eeace892d6a789a1/third_party/WebKit/Source/platform/scheduler/base/task_queue_manager_unittest.cc [modify] https://crrev.com/e4e5868c5f32b015bf0d07a6eeace892d6a789a1/third_party/WebKit/Source/platform/scheduler/base/time_domain.cc [modify] https://crrev.com/e4e5868c5f32b015bf0d07a6eeace892d6a789a1/third_party/WebKit/Source/platform/scheduler/base/work_queue.cc [modify] https://crrev.com/e4e5868c5f32b015bf0d07a6eeace892d6a789a1/third_party/WebKit/Source/platform/scheduler/base/work_queue.h [modify] https://crrev.com/e4e5868c5f32b015bf0d07a6eeace892d6a789a1/third_party/WebKit/Source/platform/scheduler/base/work_queue_sets_unittest.cc [modify] https://crrev.com/e4e5868c5f32b015bf0d07a6eeace892d6a789a1/third_party/WebKit/Source/platform/scheduler/base/work_queue_unittest.cc [modify] https://crrev.com/e4e5868c5f32b015bf0d07a6eeace892d6a789a1/third_party/WebKit/Source/platform/scheduler/child/compositor_worker_scheduler.cc [modify] https://crrev.com/e4e5868c5f32b015bf0d07a6eeace892d6a789a1/third_party/WebKit/Source/platform/scheduler/child/web_task_runner_impl.cc [modify] https://crrev.com/e4e5868c5f32b015bf0d07a6eeace892d6a789a1/third_party/WebKit/Source/platform/scheduler/child/web_task_runner_impl.h [modify] https://crrev.com/e4e5868c5f32b015bf0d07a6eeace892d6a789a1/third_party/WebKit/Source/platform/scheduler/test/fake_web_task_runner.cc [modify] https://crrev.com/e4e5868c5f32b015bf0d07a6eeace892d6a789a1/third_party/WebKit/Source/platform/scheduler/test/fake_web_task_runner.h [modify] https://crrev.com/e4e5868c5f32b015bf0d07a6eeace892d6a789a1/third_party/WebKit/Source/web/BUILD.gn [add] https://crrev.com/e4e5868c5f32b015bf0d07a6eeace892d6a789a1/third_party/WebKit/Source/web/tests/TimerPerfTest.cpp [modify] https://crrev.com/e4e5868c5f32b015bf0d07a6eeace892d6a789a1/third_party/WebKit/public/platform/WebTaskRunner.h [modify] https://crrev.com/e4e5868c5f32b015bf0d07a6eeace892d6a789a1/third_party/WebKit/public/platform/scheduler/base/task_queue.h
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/bee7b64b4772d14c9cafc00f60629a89e8f5bf81 commit bee7b64b4772d14c9cafc00f60629a89e8f5bf81 Author: fs <fs@opera.com> Date: Sat Sep 10 21:57:34 2016 Revert of Make canceling Timers fast. (patchset #10 id:180001 of https://codereview.chromium.org/2319053004/ ) Reason for revert: Wreaks havoc on the ASAN bots: https://build.chromium.org/p/chromium.webkit/builders/WebKit%20Linux%20ASAN STDERR: ================================================================= STDERR: ==4==ERROR: AddressSanitizer: use-after-poison on address 0x7ed9a5616190 at pc 0x00000768b0da bp 0x7fff4bbca630 sp 0x7fff4bbca628 STDERR: READ of size 8 at 0x7ed9a5616190 thread T0 (content_shell) STDERR: #0 0x768b0d9 in operator-> third_party/WebKit/Source/wtf/RefPtr.h:68:50 STDERR: #1 0x768b0d9 in revokeAll third_party/WebKit/Source/wtf/WeakPtr.h:146:0 STDERR: #2 0x768b344 in ?? third_party/WebKit/Source/platform/Timer.cpp:124:22 STDERR: #3 0x47a4461 in Run base/callback.h:56:12 STDERR: #4 0x47a4461 in RunTask base/debug/task_annotator.cc:54:0 STDERR: #5 0x79e2381 in ProcessTaskFromWorkQueue third_party/WebKit/Source/platform/scheduler/base/task_queue_manager.cc:316:19 ... STDERR: AddressSanitizer can not describe address in more detail (wild memory access suspected). STDERR: SUMMARY: AddressSanitizer: use-after-poison Appears to be accessing a "user-poison" area, so maybe a timer in something that was swept? (Wild guess.) Original issue's description: > Make canceling Timers fast. > > base::Closure recently got an IsCancelled method. Taking advantage of > that the scheduler can short circuit a bunch of logic for cancelled > tasks and avoid running them and the rest of the task selection > machinery. > > On the new TimerPerfTest benchmark this makes running 10000 cancelled > tasks aprox 50x - 60x faster (measured on Android and Linux). > > Note this patch reverts many of the changes made in > https://codereview.chromium.org/2258713004 in favor of > WeakPtr based cancellation as favored by the base owners. > > BUG= 605718 , 638542 > > Committed: https://crrev.com/e4e5868c5f32b015bf0d07a6eeace892d6a789a1 > Cr-Commit-Position: refs/heads/master@{#417621} TBR=jochen@chromium.org,haraken@chromium.org,skyostil@chromium.org,alexclarke@chromium.org # Not skipping CQ checks because original CL landed more than 1 days ago. BUG= 605718 , 638542 Review-Url: https://codereview.chromium.org/2326313003 Cr-Commit-Position: refs/heads/master@{#417846} [modify] https://crrev.com/bee7b64b4772d14c9cafc00f60629a89e8f5bf81/third_party/WebKit/Source/platform/Timer.cpp [modify] https://crrev.com/bee7b64b4772d14c9cafc00f60629a89e8f5bf81/third_party/WebKit/Source/platform/Timer.h [modify] https://crrev.com/bee7b64b4772d14c9cafc00f60629a89e8f5bf81/third_party/WebKit/Source/platform/scheduler/base/task_queue_impl.cc [modify] https://crrev.com/bee7b64b4772d14c9cafc00f60629a89e8f5bf81/third_party/WebKit/Source/platform/scheduler/base/task_queue_impl.h [modify] https://crrev.com/bee7b64b4772d14c9cafc00f60629a89e8f5bf81/third_party/WebKit/Source/platform/scheduler/base/task_queue_manager.cc [modify] https://crrev.com/bee7b64b4772d14c9cafc00f60629a89e8f5bf81/third_party/WebKit/Source/platform/scheduler/base/task_queue_manager_perftest.cc [modify] https://crrev.com/bee7b64b4772d14c9cafc00f60629a89e8f5bf81/third_party/WebKit/Source/platform/scheduler/base/task_queue_manager_unittest.cc [modify] https://crrev.com/bee7b64b4772d14c9cafc00f60629a89e8f5bf81/third_party/WebKit/Source/platform/scheduler/base/time_domain.cc [modify] https://crrev.com/bee7b64b4772d14c9cafc00f60629a89e8f5bf81/third_party/WebKit/Source/platform/scheduler/base/work_queue.cc [modify] https://crrev.com/bee7b64b4772d14c9cafc00f60629a89e8f5bf81/third_party/WebKit/Source/platform/scheduler/base/work_queue.h [modify] https://crrev.com/bee7b64b4772d14c9cafc00f60629a89e8f5bf81/third_party/WebKit/Source/platform/scheduler/base/work_queue_sets_unittest.cc [modify] https://crrev.com/bee7b64b4772d14c9cafc00f60629a89e8f5bf81/third_party/WebKit/Source/platform/scheduler/base/work_queue_unittest.cc [modify] https://crrev.com/bee7b64b4772d14c9cafc00f60629a89e8f5bf81/third_party/WebKit/Source/platform/scheduler/child/compositor_worker_scheduler.cc [modify] https://crrev.com/bee7b64b4772d14c9cafc00f60629a89e8f5bf81/third_party/WebKit/Source/platform/scheduler/child/web_task_runner_impl.cc [modify] https://crrev.com/bee7b64b4772d14c9cafc00f60629a89e8f5bf81/third_party/WebKit/Source/platform/scheduler/child/web_task_runner_impl.h [modify] https://crrev.com/bee7b64b4772d14c9cafc00f60629a89e8f5bf81/third_party/WebKit/Source/platform/scheduler/test/fake_web_task_runner.cc [modify] https://crrev.com/bee7b64b4772d14c9cafc00f60629a89e8f5bf81/third_party/WebKit/Source/platform/scheduler/test/fake_web_task_runner.h [modify] https://crrev.com/bee7b64b4772d14c9cafc00f60629a89e8f5bf81/third_party/WebKit/Source/web/BUILD.gn [delete] https://crrev.com/f06159b98aa70d663afdc22ea5e8c0ad0ca06bf2/third_party/WebKit/Source/web/tests/TimerPerfTest.cpp [modify] https://crrev.com/bee7b64b4772d14c9cafc00f60629a89e8f5bf81/third_party/WebKit/public/platform/WebTaskRunner.h [modify] https://crrev.com/bee7b64b4772d14c9cafc00f60629a89e8f5bf81/third_party/WebKit/public/platform/scheduler/base/task_queue.h
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/77f183aaf924ea7742df562455db8579607224e0 commit 77f183aaf924ea7742df562455db8579607224e0 Author: alexclarke <alexclarke@chromium.org> Date: Mon Sep 12 13:59:45 2016 Make canceling Timers fast. base::Closure recently got an IsCancelled method. Taking advantage of that the scheduler can short circuit a bunch of logic for cancelled tasks and avoid running them and the rest of the task selection machinery. On the new TimerPerfTest benchmark this makes running 10000 cancelled tasks aprox 50x - 60x faster (measured on Android and Linux). Note this patch reverts many of the changes made in https://codereview.chromium.org/2258713004 in favor of WeakPtr based cancellation as favored by the base owners. NOTE it's possible this might break https://build.chromium.org/p/chromium.webkit/builders/WebKit%20Linux%20ASAN I was not able to reproduce the ASAN failure locally however I suspect it's due to the Timer getting swept away which should be fixed by the change in the latest patchset. BUG= 605718 , 638542 , 645876 Committed: https://crrev.com/e4e5868c5f32b015bf0d07a6eeace892d6a789a1 Review-Url: https://codereview.chromium.org/2319053004 Cr-Original-Commit-Position: refs/heads/master@{#417621} Cr-Commit-Position: refs/heads/master@{#417931} [modify] https://crrev.com/77f183aaf924ea7742df562455db8579607224e0/third_party/WebKit/Source/platform/Timer.cpp [modify] https://crrev.com/77f183aaf924ea7742df562455db8579607224e0/third_party/WebKit/Source/platform/Timer.h [modify] https://crrev.com/77f183aaf924ea7742df562455db8579607224e0/third_party/WebKit/Source/platform/scheduler/base/task_queue_impl.cc [modify] https://crrev.com/77f183aaf924ea7742df562455db8579607224e0/third_party/WebKit/Source/platform/scheduler/base/task_queue_impl.h [modify] https://crrev.com/77f183aaf924ea7742df562455db8579607224e0/third_party/WebKit/Source/platform/scheduler/base/task_queue_manager.cc [modify] https://crrev.com/77f183aaf924ea7742df562455db8579607224e0/third_party/WebKit/Source/platform/scheduler/base/task_queue_manager_perftest.cc [modify] https://crrev.com/77f183aaf924ea7742df562455db8579607224e0/third_party/WebKit/Source/platform/scheduler/base/task_queue_manager_unittest.cc [modify] https://crrev.com/77f183aaf924ea7742df562455db8579607224e0/third_party/WebKit/Source/platform/scheduler/base/time_domain.cc [modify] https://crrev.com/77f183aaf924ea7742df562455db8579607224e0/third_party/WebKit/Source/platform/scheduler/base/work_queue.cc [modify] https://crrev.com/77f183aaf924ea7742df562455db8579607224e0/third_party/WebKit/Source/platform/scheduler/base/work_queue.h [modify] https://crrev.com/77f183aaf924ea7742df562455db8579607224e0/third_party/WebKit/Source/platform/scheduler/base/work_queue_sets_unittest.cc [modify] https://crrev.com/77f183aaf924ea7742df562455db8579607224e0/third_party/WebKit/Source/platform/scheduler/base/work_queue_unittest.cc [modify] https://crrev.com/77f183aaf924ea7742df562455db8579607224e0/third_party/WebKit/Source/platform/scheduler/child/compositor_worker_scheduler.cc [modify] https://crrev.com/77f183aaf924ea7742df562455db8579607224e0/third_party/WebKit/Source/platform/scheduler/child/web_task_runner_impl.cc [modify] https://crrev.com/77f183aaf924ea7742df562455db8579607224e0/third_party/WebKit/Source/platform/scheduler/child/web_task_runner_impl.h [modify] https://crrev.com/77f183aaf924ea7742df562455db8579607224e0/third_party/WebKit/Source/platform/scheduler/test/fake_web_task_runner.cc [modify] https://crrev.com/77f183aaf924ea7742df562455db8579607224e0/third_party/WebKit/Source/platform/scheduler/test/fake_web_task_runner.h [modify] https://crrev.com/77f183aaf924ea7742df562455db8579607224e0/third_party/WebKit/Source/web/BUILD.gn [add] https://crrev.com/77f183aaf924ea7742df562455db8579607224e0/third_party/WebKit/Source/web/tests/TimerPerfTest.cpp [modify] https://crrev.com/77f183aaf924ea7742df562455db8579607224e0/third_party/WebKit/public/platform/WebTaskRunner.h [modify] https://crrev.com/77f183aaf924ea7742df562455db8579607224e0/third_party/WebKit/public/platform/scheduler/base/task_queue.h
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/929cbb9f92b5570867c3842c80778243db81a013 commit 929cbb9f92b5570867c3842c80778243db81a013 Author: alexclarke <alexclarke@chromium.org> Date: Wed Sep 14 14:29:46 2016 Prevent redundant DoWorks due to canceled delayed tasks To achieve this we make a few changes: 1. We only register the next wakeup with the TimeDomain, rather than all of them. 2. MoveReadyDelayedTasksToDelayedWorkQueue now registers the next wakeup (if any). Since it removes all canceled delayed tasks from the front of the priority queue this has the effect of not scheduling wakeups for cancelled tasks. 3. Tweaking the TaskQueueManager level delayed DoWork de-duplication logic to only post a delayed DoWork if the task is meant to run before any previously registered delayed DoWorks. BUG= 638542 , 605718 Review-Url: https://codereview.chromium.org/2320403003 Cr-Commit-Position: refs/heads/master@{#418556} [modify] https://crrev.com/929cbb9f92b5570867c3842c80778243db81a013/third_party/WebKit/Source/platform/scheduler/base/task_queue_impl.cc [modify] https://crrev.com/929cbb9f92b5570867c3842c80778243db81a013/third_party/WebKit/Source/platform/scheduler/base/task_queue_impl.h [modify] https://crrev.com/929cbb9f92b5570867c3842c80778243db81a013/third_party/WebKit/Source/platform/scheduler/base/task_queue_manager.cc [modify] https://crrev.com/929cbb9f92b5570867c3842c80778243db81a013/third_party/WebKit/Source/platform/scheduler/base/task_queue_manager_unittest.cc [modify] https://crrev.com/929cbb9f92b5570867c3842c80778243db81a013/third_party/WebKit/Source/platform/scheduler/base/time_domain.cc [modify] https://crrev.com/929cbb9f92b5570867c3842c80778243db81a013/third_party/WebKit/Source/platform/scheduler/base/time_domain.h
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/04e1e5cab53931ea11d58a578a237d6a5762a054 commit 04e1e5cab53931ea11d58a578a237d6a5762a054 Author: kbr <kbr@chromium.org> Date: Mon Sep 19 20:07:45 2016 Revert of Prevent redundant DoWorks due to canceled delayed tasks (patchset #6 id:100001 of https://codereview.chromium.org/2320403003/ ) Reason for revert: Suspect that this CL caused breakage in Gmail and Hangouts per http://crbug.com/647484 . Original issue's description: > Prevent redundant DoWorks due to canceled delayed tasks > > To achieve this we make a few changes: > > 1. We only register the next wakeup with the TimeDomain, rather than all > of them. > 2. MoveReadyDelayedTasksToDelayedWorkQueue now registers the next > wakeup (if any). Since it removes all canceled delayed tasks from the > front of the priority queue this has the effect of not scheduling > wakeups for cancelled tasks. > 3. Tweaking the TaskQueueManager level delayed DoWork de-duplication > logic to only post a delayed DoWork if the task is meant to run before > any previously registered delayed DoWorks. > > BUG= 638542 , 605718 > > Committed: https://crrev.com/929cbb9f92b5570867c3842c80778243db81a013 > Cr-Commit-Position: refs/heads/master@{#418556} TBR=skyostil@chromium.org,alexclarke@chromium.org # Not skipping CQ checks because original CL landed more than 1 days ago. BUG= 638542 , 605718 Review-Url: https://codereview.chromium.org/2353473003 Cr-Commit-Position: refs/heads/master@{#419542} [modify] https://crrev.com/04e1e5cab53931ea11d58a578a237d6a5762a054/third_party/WebKit/Source/platform/scheduler/base/task_queue_impl.cc [modify] https://crrev.com/04e1e5cab53931ea11d58a578a237d6a5762a054/third_party/WebKit/Source/platform/scheduler/base/task_queue_impl.h [modify] https://crrev.com/04e1e5cab53931ea11d58a578a237d6a5762a054/third_party/WebKit/Source/platform/scheduler/base/task_queue_manager.cc [modify] https://crrev.com/04e1e5cab53931ea11d58a578a237d6a5762a054/third_party/WebKit/Source/platform/scheduler/base/task_queue_manager_unittest.cc [modify] https://crrev.com/04e1e5cab53931ea11d58a578a237d6a5762a054/third_party/WebKit/Source/platform/scheduler/base/time_domain.cc [modify] https://crrev.com/04e1e5cab53931ea11d58a578a237d6a5762a054/third_party/WebKit/Source/platform/scheduler/base/time_domain.h
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/917d60230680d15af69e12a34a44bfd25ca4784c commit 917d60230680d15af69e12a34a44bfd25ca4784c Author: alexclarke <alexclarke@chromium.org> Date: Fri Sep 23 20:01:08 2016 Prevent redundant DoWorks due to canceled delayed tasks (v2) The TimeDomain now only knows about the first wake up per queue and the system tries to only have one pending delayed DoWork posted on the base runloop. Because of this any cancelled delayed tasks get removed by TaskQueueImpl::WakeUpForDelayedWork before a wakeup is requested. TimeDomain has been changed to take advantage of this new limitation and several redundant methods have now been removed. The bug which caused the revert of V1 has been fixed, specifically ThrottlingHelper::PumpThrottledTasks doesn't get broken by the new assumptions since we're no longer using ClearExpiredWakeups. BUG= 638542 , 605718 Review-Url: https://codereview.chromium.org/2359493002 Cr-Commit-Position: refs/heads/master@{#420707} [modify] https://crrev.com/917d60230680d15af69e12a34a44bfd25ca4784c/third_party/WebKit/Source/platform/scheduler/base/task_queue_impl.cc [modify] https://crrev.com/917d60230680d15af69e12a34a44bfd25ca4784c/third_party/WebKit/Source/platform/scheduler/base/task_queue_impl.h [modify] https://crrev.com/917d60230680d15af69e12a34a44bfd25ca4784c/third_party/WebKit/Source/platform/scheduler/base/task_queue_manager.cc [modify] https://crrev.com/917d60230680d15af69e12a34a44bfd25ca4784c/third_party/WebKit/Source/platform/scheduler/base/task_queue_manager_unittest.cc [modify] https://crrev.com/917d60230680d15af69e12a34a44bfd25ca4784c/third_party/WebKit/Source/platform/scheduler/base/time_domain.cc [modify] https://crrev.com/917d60230680d15af69e12a34a44bfd25ca4784c/third_party/WebKit/Source/platform/scheduler/base/time_domain.h [modify] https://crrev.com/917d60230680d15af69e12a34a44bfd25ca4784c/third_party/WebKit/Source/platform/scheduler/base/time_domain_unittest.cc [modify] https://crrev.com/917d60230680d15af69e12a34a44bfd25ca4784c/third_party/WebKit/Source/platform/scheduler/base/virtual_time_domain.h [modify] https://crrev.com/917d60230680d15af69e12a34a44bfd25ca4784c/third_party/WebKit/Source/platform/scheduler/renderer/throttled_time_domain.h [modify] https://crrev.com/917d60230680d15af69e12a34a44bfd25ca4784c/third_party/WebKit/Source/platform/scheduler/renderer/throttling_helper.cc
The cancellation changes have improved a couple of benchmarks: 3-7% improvement in speedometer: https://chromeperf.appspot.com/group_report?bug_id=645876 4-5% improvement in sunspider: https://chromeperf.appspot.com/group_report?bug_id=648699
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/d15597b8f924879440a66ef0f12f9a939b7c30ea commit d15597b8f924879440a66ef0f12f9a939b7c30ea Author: altimin <altimin@chromium.org> Date: Fri Nov 25 19:30:08 2016 [scheduler] Add options to TaskQueue::InsertFence Make TaskQueue::InsertFence configurable and allow to insert a fence in the beginning for the TaskQueue, effectively disabling it. It will allow TaskQueueThrottler to use only fences without disabling and enabling queues. R=alexclarke@chromium.org,skyostil@chromium.org BUG= 638542 Review-Url: https://codereview.chromium.org/2533603002 Cr-Commit-Position: refs/heads/master@{#434542} [modify] https://crrev.com/d15597b8f924879440a66ef0f12f9a939b7c30ea/third_party/WebKit/Source/platform/scheduler/base/enqueue_order.cc [modify] https://crrev.com/d15597b8f924879440a66ef0f12f9a939b7c30ea/third_party/WebKit/Source/platform/scheduler/base/enqueue_order.h [modify] https://crrev.com/d15597b8f924879440a66ef0f12f9a939b7c30ea/third_party/WebKit/Source/platform/scheduler/base/task_queue_impl.cc [modify] https://crrev.com/d15597b8f924879440a66ef0f12f9a939b7c30ea/third_party/WebKit/Source/platform/scheduler/base/task_queue_impl.h [modify] https://crrev.com/d15597b8f924879440a66ef0f12f9a939b7c30ea/third_party/WebKit/Source/platform/scheduler/base/task_queue_manager_unittest.cc [modify] https://crrev.com/d15597b8f924879440a66ef0f12f9a939b7c30ea/third_party/WebKit/Source/platform/scheduler/base/work_queue.cc [modify] https://crrev.com/d15597b8f924879440a66ef0f12f9a939b7c30ea/third_party/WebKit/Source/platform/scheduler/base/work_queue_sets.cc [modify] https://crrev.com/d15597b8f924879440a66ef0f12f9a939b7c30ea/third_party/WebKit/Source/platform/scheduler/base/work_queue_sets.h [modify] https://crrev.com/d15597b8f924879440a66ef0f12f9a939b7c30ea/third_party/WebKit/Source/platform/scheduler/base/work_queue_sets_unittest.cc [modify] https://crrev.com/d15597b8f924879440a66ef0f12f9a939b7c30ea/third_party/WebKit/Source/platform/scheduler/base/work_queue_unittest.cc [modify] https://crrev.com/d15597b8f924879440a66ef0f12f9a939b7c30ea/third_party/WebKit/Source/platform/scheduler/child/compositor_worker_scheduler.cc [modify] https://crrev.com/d15597b8f924879440a66ef0f12f9a939b7c30ea/third_party/WebKit/Source/platform/scheduler/child/idle_helper.cc [modify] https://crrev.com/d15597b8f924879440a66ef0f12f9a939b7c30ea/third_party/WebKit/Source/platform/scheduler/renderer/renderer_scheduler_impl.cc [modify] https://crrev.com/d15597b8f924879440a66ef0f12f9a939b7c30ea/third_party/WebKit/Source/platform/scheduler/renderer/task_queue_throttler.cc [modify] https://crrev.com/d15597b8f924879440a66ef0f12f9a939b7c30ea/third_party/WebKit/Source/platform/scheduler/renderer/task_queue_throttler.h [modify] https://crrev.com/d15597b8f924879440a66ef0f12f9a939b7c30ea/third_party/WebKit/Source/platform/scheduler/renderer/task_queue_throttler_unittest.cc [modify] https://crrev.com/d15597b8f924879440a66ef0f12f9a939b7c30ea/third_party/WebKit/public/platform/scheduler/base/task_queue.h
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/6abf248fbb96094a0ee7c103840eeccb23b38a31 commit 6abf248fbb96094a0ee7c103840eeccb23b38a31 Author: Alexander Timin <altimin@chromium.org> Date: Thu Dec 01 14:58:53 2016 [scheduler] Add options to TaskQueue::InsertFence Make TaskQueue::InsertFence configurable and allow to insert a fence in the beginning for the TaskQueue, effectively disabling it. It will allow TaskQueueThrottler to use only fences without disabling and enabling queues. R=alexclarke@chromium.org,skyostil@chromium.org BUG= 638542 Review-Url: https://codereview.chromium.org/2533603002 Cr-Commit-Position: refs/heads/master@{#434542} (cherry picked from commit d15597b8f924879440a66ef0f12f9a939b7c30ea) Review URL: https://codereview.chromium.org/2538833005 . Cr-Commit-Position: refs/branch-heads/2924@{#246} Cr-Branched-From: 3a87aecc31cd1ffe751dd72c04e5a96a1fc8108a-refs/heads/master@{#433059} [modify] https://crrev.com/6abf248fbb96094a0ee7c103840eeccb23b38a31/third_party/WebKit/Source/platform/scheduler/base/enqueue_order.cc [modify] https://crrev.com/6abf248fbb96094a0ee7c103840eeccb23b38a31/third_party/WebKit/Source/platform/scheduler/base/enqueue_order.h [modify] https://crrev.com/6abf248fbb96094a0ee7c103840eeccb23b38a31/third_party/WebKit/Source/platform/scheduler/base/task_queue_impl.cc [modify] https://crrev.com/6abf248fbb96094a0ee7c103840eeccb23b38a31/third_party/WebKit/Source/platform/scheduler/base/task_queue_impl.h [modify] https://crrev.com/6abf248fbb96094a0ee7c103840eeccb23b38a31/third_party/WebKit/Source/platform/scheduler/base/task_queue_manager_unittest.cc [modify] https://crrev.com/6abf248fbb96094a0ee7c103840eeccb23b38a31/third_party/WebKit/Source/platform/scheduler/base/work_queue.cc [modify] https://crrev.com/6abf248fbb96094a0ee7c103840eeccb23b38a31/third_party/WebKit/Source/platform/scheduler/base/work_queue_sets.cc [modify] https://crrev.com/6abf248fbb96094a0ee7c103840eeccb23b38a31/third_party/WebKit/Source/platform/scheduler/base/work_queue_sets.h [modify] https://crrev.com/6abf248fbb96094a0ee7c103840eeccb23b38a31/third_party/WebKit/Source/platform/scheduler/base/work_queue_sets_unittest.cc [modify] https://crrev.com/6abf248fbb96094a0ee7c103840eeccb23b38a31/third_party/WebKit/Source/platform/scheduler/base/work_queue_unittest.cc [modify] https://crrev.com/6abf248fbb96094a0ee7c103840eeccb23b38a31/third_party/WebKit/Source/platform/scheduler/child/compositor_worker_scheduler.cc [modify] https://crrev.com/6abf248fbb96094a0ee7c103840eeccb23b38a31/third_party/WebKit/Source/platform/scheduler/child/idle_helper.cc [modify] https://crrev.com/6abf248fbb96094a0ee7c103840eeccb23b38a31/third_party/WebKit/Source/platform/scheduler/renderer/renderer_scheduler_impl.cc [modify] https://crrev.com/6abf248fbb96094a0ee7c103840eeccb23b38a31/third_party/WebKit/Source/platform/scheduler/renderer/task_queue_throttler.cc [modify] https://crrev.com/6abf248fbb96094a0ee7c103840eeccb23b38a31/third_party/WebKit/Source/platform/scheduler/renderer/task_queue_throttler.h [modify] https://crrev.com/6abf248fbb96094a0ee7c103840eeccb23b38a31/third_party/WebKit/Source/platform/scheduler/renderer/task_queue_throttler_unittest.cc [modify] https://crrev.com/6abf248fbb96094a0ee7c103840eeccb23b38a31/third_party/WebKit/public/platform/scheduler/base/task_queue.h
It seems that we're done here :)
Comment 1 by bugdroid1@chromium.org
, Aug 19 2016