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

Issue 2273703002: Force events to be non blocking if main thread is unresponsive. (Closed)

Created:
4 years, 4 months ago by tdresser
Modified:
4 years ago
CC:
altimin, asvitkine+watch_chromium.org, blink-reviews, blink-reviews-api_chromium.org, chromium-reviews, darin-cc_chromium.org, dglazkov+blink, dtapuska+chromiumwatch_chromium.org, jam, mlamouri+watch-content_chromium.org, scheduler-bugs_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Force events to be non blocking if main thread is unresponsive. Behind the MainThreadBusyScrollIntervention content feature. Uses the estimated input latency (https://docs.google.com/document/d/1b9slyaB9yho91YTOkAQfpCdULFkZM9LqsipcX3t7He8/) to determine when the main thread is unresponsive. When the main thread is unresponsive, forces events to be non-blocking. To be enabled via Finch. TEST=MainThreadEventQueueTest.ForcedNonBlockingDueToUnresponsiveMainThread, RenderWidgetUnittest.RenderWidgetInputEventUmaMetrics QueueingTimeEstimatorTest.EstimateQueueingTimeDuringSingleLongTaskIncompleteWindow QueueingTimeEstimatorTest.EstimateQueueingTimeDuringSingleLongTaskExceedingWindow BUG=599609 Committed: https://crrev.com/2c6c355f995d54c481419acebed7f988207c57c4 Cr-Commit-Position: refs/heads/master@{#439106}

Patch Set 1 #

Total comments: 16

Patch Set 2 : Address Dave's comments. #

Total comments: 10

Patch Set 3 : Address Sami's feedback, except for frequent locking. #

Patch Set 4 : Rebase. #

Patch Set 5 : Rebase. #

Patch Set 6 : Use SeqLock - needs some additional tests. #

Patch Set 7 : Fix build. #

Total comments: 9

Patch Set 8 : Address feedback. #

Total comments: 7

Patch Set 9 : Address feedback (still needs tests) #

Patch Set 10 : Rebase. #

Patch Set 11 : Add tests, fix bugs. #

Total comments: 24

Patch Set 12 : Rebase. #

Patch Set 13 : Address nits. #

Total comments: 4

Patch Set 14 : Fix nits #

Total comments: 4

Patch Set 15 : Nits #

Total comments: 2

Patch Set 16 : Renamed ReadOrFail to TryRead. #

Total comments: 4

Patch Set 17 : Histogram nits #

Unified diffs Side-by-side diffs Delta from patch set Stats (+420 lines, -64 lines) Patch
M content/public/common/content_features.h View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +1 line, -0 lines 0 comments Download
M content/public/common/content_features.cc View 1 2 3 4 5 6 7 8 9 10 11 2 chunks +5 lines, -1 line 0 comments Download
M content/renderer/input/main_thread_event_queue.h View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +1 line, -0 lines 0 comments Download
M content/renderer/input/main_thread_event_queue.cc View 1 2 3 4 5 6 7 8 9 10 11 2 chunks +15 lines, -0 lines 0 comments Download
M content/renderer/input/render_widget_input_handler.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 3 chunks +13 lines, -0 lines 0 comments Download
M content/renderer/render_widget_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 4 chunks +22 lines, -1 line 0 comments Download
M device/base/synchronization/one_writer_seqlock.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 2 chunks +3 lines, -2 lines 0 comments Download
M device/base/synchronization/one_writer_seqlock.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 chunk +11 lines, -0 lines 0 comments Download
M device/base/synchronization/shared_memory_seqlock_buffer.h View 1 2 3 4 5 6 7 8 1 chunk +2 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/platform/BUILD.gn View 1 2 3 4 5 6 7 8 9 10 11 2 chunks +2 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/platform/scheduler/base/queueing_time_estimator.h View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +24 lines, -8 lines 0 comments Download
M third_party/WebKit/Source/platform/scheduler/base/queueing_time_estimator.cc View 1 2 3 4 5 6 7 8 9 10 11 12 2 chunks +82 lines, -20 lines 0 comments Download
M third_party/WebKit/Source/platform/scheduler/base/queueing_time_estimator_unittest.cc View 1 2 3 4 5 6 7 8 9 10 3 chunks +66 lines, -12 lines 0 comments Download
M third_party/WebKit/Source/platform/scheduler/renderer/renderer_scheduler_impl.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 8 chunks +14 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/platform/scheduler/renderer/renderer_scheduler_impl.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 9 chunks +63 lines, -11 lines 0 comments Download
M third_party/WebKit/Source/platform/scheduler/renderer/renderer_scheduler_impl_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 3 chunks +61 lines, -1 line 0 comments Download
M third_party/WebKit/Source/platform/scheduler/test/fake_renderer_scheduler.cc View 1 2 3 4 5 6 7 8 9 10 1 chunk +4 lines, -0 lines 0 comments Download
M third_party/WebKit/public/platform/WebInputEvent.h View 1 2 3 4 5 6 7 8 9 10 11 2 chunks +5 lines, -1 line 0 comments Download
M third_party/WebKit/public/platform/scheduler/renderer/renderer_scheduler.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +5 lines, -0 lines 0 comments Download
M third_party/WebKit/public/platform/scheduler/test/fake_renderer_scheduler.h View 1 2 3 4 5 6 7 8 9 10 1 chunk +1 line, -0 lines 0 comments Download
M third_party/WebKit/public/platform/scheduler/test/mock_renderer_scheduler.h View 1 2 3 4 5 6 7 8 9 10 1 chunk +1 line, -0 lines 0 comments Download
M tools/metrics/histograms/histograms.xml View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 2 chunks +19 lines, -5 lines 0 comments Download

Messages

Total messages: 91 (50 generated)
tdresser
PTAL
4 years, 4 months ago (2016-08-23 15:56:45 UTC) #4
dtapuska
https://codereview.chromium.org/2273703002/diff/1/content/public/common/content_features.cc File content/public/common/content_features.cc (right): https://codereview.chromium.org/2273703002/diff/1/content/public/common/content_features.cc#newcode71 content/public/common/content_features.cc:71: // passive when the main thread is deemed unresponsive. ...
4 years, 4 months ago (2016-08-23 16:18:30 UTC) #5
tdresser
https://codereview.chromium.org/2273703002/diff/1/content/public/common/content_features.cc File content/public/common/content_features.cc (right): https://codereview.chromium.org/2273703002/diff/1/content/public/common/content_features.cc#newcode71 content/public/common/content_features.cc:71: // passive when the main thread is deemed unresponsive. ...
4 years, 4 months ago (2016-08-23 17:25:33 UTC) #8
dtapuska
lgtm
4 years, 4 months ago (2016-08-23 19:42:36 UTC) #9
tdresser
+skyostil for scheduling logic.
4 years, 4 months ago (2016-08-23 19:59:58 UTC) #11
lanwei
LGTM!
4 years, 4 months ago (2016-08-24 03:04:47 UTC) #12
Sami
Thanks Tim, added some comments. https://codereview.chromium.org/2273703002/diff/20001/third_party/WebKit/Source/platform/scheduler/base/queueing_time_estimator.cc File third_party/WebKit/Source/platform/scheduler/base/queueing_time_estimator.cc (right): https://codereview.chromium.org/2273703002/diff/20001/third_party/WebKit/Source/platform/scheduler/base/queueing_time_estimator.cc#newcode98 third_party/WebKit/Source/platform/scheduler/base/queueing_time_estimator.cc:98: base::TimeDelta worst_queueing_time() { naming ...
4 years, 4 months ago (2016-08-24 14:56:01 UTC) #13
tdresser
https://codereview.chromium.org/2273703002/diff/20001/third_party/WebKit/Source/platform/scheduler/base/queueing_time_estimator.cc File third_party/WebKit/Source/platform/scheduler/base/queueing_time_estimator.cc (right): https://codereview.chromium.org/2273703002/diff/20001/third_party/WebKit/Source/platform/scheduler/base/queueing_time_estimator.cc#newcode98 third_party/WebKit/Source/platform/scheduler/base/queueing_time_estimator.cc:98: base::TimeDelta worst_queueing_time() { On 2016/08/24 14:56:01, Sami wrote: > ...
4 years, 4 months ago (2016-08-24 17:22:50 UTC) #14
tdresser
On 2016/08/24 17:22:50, tdresser wrote: > https://codereview.chromium.org/2273703002/diff/20001/third_party/WebKit/Source/platform/scheduler/base/queueing_time_estimator.cc > File > third_party/WebKit/Source/platform/scheduler/base/queueing_time_estimator.cc > (right): > > ...
4 years, 4 months ago (2016-08-24 18:41:28 UTC) #19
Sami
Thanks Tim. https://codereview.chromium.org/2273703002/diff/20001/third_party/WebKit/Source/platform/scheduler/renderer/renderer_scheduler_impl.cc File third_party/WebKit/Source/platform/scheduler/renderer/renderer_scheduler_impl.cc (right): https://codereview.chromium.org/2273703002/diff/20001/third_party/WebKit/Source/platform/scheduler/renderer/renderer_scheduler_impl.cc#newcode1431 third_party/WebKit/Source/platform/scheduler/renderer/renderer_scheduler_impl.cc:1431: base::AutoLock lock(any_thread_lock_); On 2016/08/24 17:22:50, tdresser wrote: ...
4 years, 3 months ago (2016-08-25 12:48:44 UTC) #24
tdresser
https://codereview.chromium.org/2273703002/diff/20001/third_party/WebKit/Source/platform/scheduler/renderer/renderer_scheduler_impl.cc File third_party/WebKit/Source/platform/scheduler/renderer/renderer_scheduler_impl.cc (right): https://codereview.chromium.org/2273703002/diff/20001/third_party/WebKit/Source/platform/scheduler/renderer/renderer_scheduler_impl.cc#newcode1431 third_party/WebKit/Source/platform/scheduler/renderer/renderer_scheduler_impl.cc:1431: base::AutoLock lock(any_thread_lock_); On 2016/08/25 12:48:44, Sami wrote: > On ...
4 years, 3 months ago (2016-08-25 15:27:12 UTC) #25
Sami
On 2016/08/25 15:27:12, tdresser wrote: > One of the biggest cases we want to address ...
4 years, 3 months ago (2016-08-25 16:12:53 UTC) #28
tdresser
On 2016/08/25 16:12:53, Sami wrote: > On 2016/08/25 15:27:12, tdresser wrote: > > One of ...
4 years, 3 months ago (2016-08-25 21:02:36 UTC) #29
Sami
On 2016/08/25 21:02:36, tdresser wrote: > How does the cost of an atomic write compare ...
4 years, 3 months ago (2016-08-26 10:39:33 UTC) #30
tdresser
On 2016/08/26 10:39:33, Sami wrote: > On 2016/08/25 21:02:36, tdresser wrote: > > How does ...
4 years, 3 months ago (2016-08-30 12:23:40 UTC) #31
tdresser
I've migrated over to a SeqLock, which just assumes the main thread isn't busy if ...
4 years, 1 month ago (2016-11-01 15:44:38 UTC) #34
Sami
Thanks Tim! https://codereview.chromium.org/2273703002/diff/120001/device/base/synchronization/shared_memory_seqlock_buffer.h File device/base/synchronization/shared_memory_seqlock_buffer.h (right): https://codereview.chromium.org/2273703002/diff/120001/device/base/synchronization/shared_memory_seqlock_buffer.h#newcode24 device/base/synchronization/shared_memory_seqlock_buffer.h:24: SharedMemorySeqLockBuffer(Data data) : data(data) {} nit: explicit ...
4 years, 1 month ago (2016-11-02 19:01:42 UTC) #45
tdresser
Thanks. Any idea on the best way to test the cases with contention? https://codereview.chromium.org/2273703002/diff/120001/device/base/synchronization/shared_memory_seqlock_buffer.h File ...
4 years, 1 month ago (2016-11-03 13:56:10 UTC) #48
alex clarke (OOO till 29th)
https://codereview.chromium.org/2273703002/diff/120001/third_party/WebKit/Source/platform/scheduler/renderer/renderer_scheduler_impl.cc File third_party/WebKit/Source/platform/scheduler/renderer/renderer_scheduler_impl.cc (right): https://codereview.chromium.org/2273703002/diff/120001/third_party/WebKit/Source/platform/scheduler/renderer/renderer_scheduler_impl.cc#newcode1458 third_party/WebKit/Source/platform/scheduler/renderer/renderer_scheduler_impl.cc:1458: // TODO - is this copy okay? Use memcpy? ...
4 years, 1 month ago (2016-11-03 15:20:53 UTC) #51
Sami
> Any idea on the best way to test the cases with contention? Might be ...
4 years, 1 month ago (2016-11-03 16:43:15 UTC) #52
tdresser
https://codereview.chromium.org/2273703002/diff/140001/third_party/WebKit/Source/platform/scheduler/renderer/renderer_scheduler_impl.cc File third_party/WebKit/Source/platform/scheduler/renderer/renderer_scheduler_impl.cc (right): https://codereview.chromium.org/2273703002/diff/140001/third_party/WebKit/Source/platform/scheduler/renderer/renderer_scheduler_impl.cc#newcode1459 third_party/WebKit/Source/platform/scheduler/renderer/renderer_scheduler_impl.cc:1459: return false; On 2016/11/03 16:43:15, Sami wrote: > Could ...
4 years, 1 month ago (2016-11-03 18:23:54 UTC) #53
Sami
https://codereview.chromium.org/2273703002/diff/140001/third_party/WebKit/Source/platform/scheduler/renderer/renderer_scheduler_impl.cc File third_party/WebKit/Source/platform/scheduler/renderer/renderer_scheduler_impl.cc (right): https://codereview.chromium.org/2273703002/diff/140001/third_party/WebKit/Source/platform/scheduler/renderer/renderer_scheduler_impl.cc#newcode1459 third_party/WebKit/Source/platform/scheduler/renderer/renderer_scheduler_impl.cc:1459: return false; On 2016/11/03 18:23:54, tdresser wrote: > On ...
4 years, 1 month ago (2016-11-03 18:34:51 UTC) #54
tdresser
Added some tests, and fixed a bug or two. PTAL
4 years, 1 month ago (2016-11-14 06:30:04 UTC) #63
alex clarke (OOO till 29th)
https://codereview.chromium.org/2273703002/diff/200001/third_party/WebKit/Source/platform/scheduler/base/queueing_time_estimator.h File third_party/WebKit/Source/platform/scheduler/base/queueing_time_estimator.h (right): https://codereview.chromium.org/2273703002/diff/200001/third_party/WebKit/Source/platform/scheduler/base/queueing_time_estimator.h#newcode12 third_party/WebKit/Source/platform/scheduler/base/queueing_time_estimator.h:12: #include <array> Is this needed? https://codereview.chromium.org/2273703002/diff/200001/third_party/WebKit/Source/platform/scheduler/renderer/renderer_scheduler_impl.cc File third_party/WebKit/Source/platform/scheduler/renderer/renderer_scheduler_impl.cc (right): ...
4 years, 1 month ago (2016-11-14 17:00:18 UTC) #64
alex clarke (OOO till 29th)
https://codereview.chromium.org/2273703002/diff/200001/third_party/WebKit/Source/platform/scheduler/base/queueing_time_estimator.cc File third_party/WebKit/Source/platform/scheduler/base/queueing_time_estimator.cc (right): https://codereview.chromium.org/2273703002/diff/200001/third_party/WebKit/Source/platform/scheduler/base/queueing_time_estimator.cc#newcode62 third_party/WebKit/Source/platform/scheduler/base/queueing_time_estimator.cc:62: QueueingTimeEstimator::QueueingTimeEstimator(const Data& data) : data_(data) {} client_ is not ...
4 years, 1 month ago (2016-11-14 17:09:35 UTC) #65
Sami
Thanks Tim, I think the threading logic looks solid now. Couple of minor niggles. https://codereview.chromium.org/2273703002/diff/200001/third_party/WebKit/Source/platform/scheduler/base/queueing_time_estimator.h ...
4 years, 1 month ago (2016-11-14 21:16:45 UTC) #66
tdresser
Sorry for the massive patch latency in this CL... Now that you've completely forgotten what ...
4 years ago (2016-12-15 13:17:00 UTC) #71
alex clarke (OOO till 29th)
+altimin as fyi
4 years ago (2016-12-15 13:32:56 UTC) #72
alex clarke (OOO till 29th)
I think this looks OK now, Sami WDYT? https://codereview.chromium.org/2273703002/diff/240001/third_party/WebKit/Source/platform/scheduler/renderer/renderer_scheduler_impl.cc File third_party/WebKit/Source/platform/scheduler/renderer/renderer_scheduler_impl.cc (right): https://codereview.chromium.org/2273703002/diff/240001/third_party/WebKit/Source/platform/scheduler/renderer/renderer_scheduler_impl.cc#newcode226 third_party/WebKit/Source/platform/scheduler/renderer/renderer_scheduler_impl.cc:226: RendererSchedulerImpl* ...
4 years ago (2016-12-15 14:24:37 UTC) #73
tdresser
Thanks Alex. https://codereview.chromium.org/2273703002/diff/240001/third_party/WebKit/Source/platform/scheduler/renderer/renderer_scheduler_impl.cc File third_party/WebKit/Source/platform/scheduler/renderer/renderer_scheduler_impl.cc (right): https://codereview.chromium.org/2273703002/diff/240001/third_party/WebKit/Source/platform/scheduler/renderer/renderer_scheduler_impl.cc#newcode226 third_party/WebKit/Source/platform/scheduler/renderer/renderer_scheduler_impl.cc:226: RendererSchedulerImpl* renderer_scheduler_impl) On 2016/12/15 14:24:37, alex clarke ...
4 years ago (2016-12-15 14:53:25 UTC) #74
Sami
lgtm, thanks for your patience! https://codereview.chromium.org/2273703002/diff/200001/third_party/WebKit/Source/platform/scheduler/renderer/renderer_scheduler_impl.h File third_party/WebKit/Source/platform/scheduler/renderer/renderer_scheduler_impl.h (right): https://codereview.chromium.org/2273703002/diff/200001/third_party/WebKit/Source/platform/scheduler/renderer/renderer_scheduler_impl.h#newcode387 third_party/WebKit/Source/platform/scheduler/renderer/renderer_scheduler_impl.h:387: SeqLockQueueingTimeEstimator seqlock_queueing_time_estimator_; On 2016/12/15 ...
4 years ago (2016-12-15 17:54:38 UTC) #75
tdresser
+jochen@ for content/public content/renderer/render_widget_unittest.cc third_party/WebKit/public/platform/WebInputEvent.h +rockot@ for device +isherman@ for tools/metrics/histograms/histograms.xml +jbroman@ for third_party/WebKit/Source/platform/BUILD.gn https://codereview.chromium.org/2273703002/diff/200001/third_party/WebKit/Source/platform/scheduler/renderer/renderer_scheduler_impl.h ...
4 years ago (2016-12-15 19:16:10 UTC) #77
jbroman
Source/platform/BUILD.gn lgtm
4 years ago (2016-12-15 19:19:36 UTC) #78
Ken Rockot(use gerrit already)
device lgtm https://codereview.chromium.org/2273703002/diff/280001/device/base/synchronization/one_writer_seqlock.h File device/base/synchronization/one_writer_seqlock.h (right): https://codereview.chromium.org/2273703002/diff/280001/device/base/synchronization/one_writer_seqlock.h#newcode35 device/base/synchronization/one_writer_seqlock.h:35: void ReadOrFail(bool* can_read, base::subtle::Atomic32* version) const; nitty ...
4 years ago (2016-12-15 19:20:37 UTC) #79
tdresser
https://codereview.chromium.org/2273703002/diff/280001/device/base/synchronization/one_writer_seqlock.h File device/base/synchronization/one_writer_seqlock.h (right): https://codereview.chromium.org/2273703002/diff/280001/device/base/synchronization/one_writer_seqlock.h#newcode35 device/base/synchronization/one_writer_seqlock.h:35: void ReadOrFail(bool* can_read, base::subtle::Atomic32* version) const; On 2016/12/15 19:20:37, ...
4 years ago (2016-12-15 19:27:22 UTC) #80
Ilya Sherman
Metrics LGTM % comments: https://codereview.chromium.org/2273703002/diff/300001/content/renderer/input/render_widget_input_handler.cc File content/renderer/input/render_widget_input_handler.cc (right): https://codereview.chromium.org/2273703002/diff/300001/content/renderer/input/render_widget_input_handler.cc#newcode181 content/renderer/input/render_widget_input_handler.cc:181: GetEventLatencyMicros(event_timestamp, now), 1, 10000000, 100); ...
4 years ago (2016-12-16 00:46:02 UTC) #81
jochen (gone - plz use gerrit)
lgtm
4 years ago (2016-12-16 09:27:12 UTC) #82
tdresser
https://codereview.chromium.org/2273703002/diff/300001/content/renderer/input/render_widget_input_handler.cc File content/renderer/input/render_widget_input_handler.cc (right): https://codereview.chromium.org/2273703002/diff/300001/content/renderer/input/render_widget_input_handler.cc#newcode181 content/renderer/input/render_widget_input_handler.cc:181: GetEventLatencyMicros(event_timestamp, now), 1, 10000000, 100); On 2016/12/16 00:46:02, Ilya ...
4 years ago (2016-12-16 13:32:43 UTC) #83
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2273703002/320001
4 years ago (2016-12-16 13:35:15 UTC) #86
commit-bot: I haz the power
Committed patchset #17 (id:320001)
4 years ago (2016-12-16 15:18:07 UTC) #89
commit-bot: I haz the power
4 years ago (2016-12-16 15:20:47 UTC) #91
Message was sent while issue was closed.
Patchset 17 (id:??) landed as
https://crrev.com/2c6c355f995d54c481419acebed7f988207c57c4
Cr-Commit-Position: refs/heads/master@{#439106}

Powered by Google App Engine
This is Rietveld 408576698