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

Issue 1903133003: TaskScheduler: Avoid Sequence refcount bump in GetWork() (Closed)

Created:
4 years, 8 months ago by gab
Modified:
4 years, 7 months ago
Reviewers:
robliao, danakj, fdoray
CC:
chromium-reviews, gab+watch_chromium.org, robliao+watch_chromium.org, fdoray+watch_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

TaskScheduler: Avoid Sequence refcount bump in GetWork() vmpstr@ discovered an implicit copy constructor resulting in a refcount bump in https://codereview.chromium.org/1895903003/ and made it explicit in https://codereview.chromium.org/1901223003/ this CL removes the need for it via a couple changes: 1) Make SequenceAndSortKey move-only - Allows it to be in std::priority_queue without std::unique_ptr's - Less pointer chasing == yay?! - Removing need for custom SequenceAndSortKeyComparator. 2) Add a take_sequence() method to it: - Allows to take its Sequence without refbump on Pop() 3) Make it a private implementation detail and make Transaction's API: - Push(sequence,sort_key), PeekSortKey(), PopSequence() 4) Do fdoray's TODO on adding IsEmpty() to Transaction's API: - Removes need for null SequenceAndSortKey (required change to allow for PeekSortKey). 5) Make SequenceSortKey copyable. - Required for SequenceAndSortKey's move constructor - Means it turns into a class with operator== for tests instead of custom test member verifiers. Might have been able to split these up but they all line up fairly nicely and don't amount to a crazy amount of code so here it is :-). BUG=553459 Committed: https://crrev.com/eaec122b5f9b9f1689e9da9d32e53939921b6f58 Cr-Commit-Position: refs/heads/master@{#390451}

Patch Set 1 #

Patch Set 2 : real CL and rebase after discussion #1-5 #

Total comments: 14

Patch Set 3 : review:robliao/fdoray#14-15 #

Total comments: 4

Patch Set 4 : review:danakj#19 #

Total comments: 2

Patch Set 5 : review:fdoray#23 #

Patch Set 6 : merge up to r390397 #

Patch Set 7 : fix compile (why did this compile locally?! #

Unified diffs Side-by-side diffs Delta from patch set Stats (+281 lines, -187 lines) Patch
M base/task_scheduler/priority_queue.h View 1 2 3 chunks +22 lines, -44 lines 0 comments Download
M base/task_scheduler/priority_queue.cc View 1 2 3 4 5 6 2 chunks +66 lines, -24 lines 0 comments Download
M base/task_scheduler/priority_queue_unittest.cc View 1 3 chunks +17 lines, -61 lines 0 comments Download
M base/task_scheduler/scheduler_thread_pool.h View 1 2 3 4 5 1 chunk +1 line, -1 line 0 comments Download
M base/task_scheduler/scheduler_thread_pool_impl.h View 1 2 3 4 5 1 chunk +0 lines, -1 line 0 comments Download
M base/task_scheduler/scheduler_thread_pool_impl.cc View 1 2 3 4 5 5 chunks +15 lines, -24 lines 0 comments Download
M base/task_scheduler/sequence_sort_key.h View 1 2 3 1 chunk +17 lines, -4 lines 0 comments Download
M base/task_scheduler/sequence_sort_key.cc View 1 chunk +4 lines, -3 lines 0 comments Download
M base/task_scheduler/sequence_sort_key_unittest.cc View 1 2 3 4 1 chunk +114 lines, -0 lines 0 comments Download
M base/task_scheduler/sequence_unittest.cc View 1 2 chunks +25 lines, -25 lines 0 comments Download

Messages

Total messages: 39 (16 generated)
gab
Francois/Rob Please don't thoroughly review the files just yet but instead let me know what ...
4 years, 8 months ago (2016-04-20 18:44:24 UTC) #1
fdoray
On 2016/04/20 18:44:24, gab wrote: > Francois/Rob > > Please don't thoroughly review the files ...
4 years, 8 months ago (2016-04-20 19:42:06 UTC) #2
robliao
On 2016/04/20 19:42:06, fdoray wrote: > On 2016/04/20 18:44:24, gab wrote: > > Francois/Rob > ...
4 years, 8 months ago (2016-04-20 20:22:43 UTC) #3
gab
Sorry for the delay, replies to some points below: On 2016/04/20 20:22:43, robliao wrote: > ...
4 years, 8 months ago (2016-04-25 16:52:36 UTC) #4
fdoray
> Right, but the usage would be confusing as Peek() is const& and used for ...
4 years, 8 months ago (2016-04-25 17:03:55 UTC) #5
gab
Here it is, Francois/Rob PTAL, thanks!
4 years, 8 months ago (2016-04-26 23:22:32 UTC) #12
gab
https://codereview.chromium.org/1903133003/diff/40001/base/task_scheduler/scheduler_thread_pool_impl.cc File base/task_scheduler/scheduler_thread_pool_impl.cc (right): https://codereview.chromium.org/1903133003/diff/40001/base/task_scheduler/scheduler_thread_pool_impl.cc#newcode420 base/task_scheduler/scheduler_thread_pool_impl.cc:420: sequence = std::move(single_threaded_transaction->PopSequence()); Are these moves required? I don't ...
4 years, 8 months ago (2016-04-26 23:32:45 UTC) #13
robliao
https://codereview.chromium.org/1903133003/diff/40001/base/task_scheduler/priority_queue.h File base/task_scheduler/priority_queue.h (right): https://codereview.chromium.org/1903133003/diff/40001/base/task_scheduler/priority_queue.h#newcode42 base/task_scheduler/priority_queue.h:42: // lock inter- dependency with |sequence|. Nit: interdependency https://codereview.chromium.org/1903133003/diff/40001/base/task_scheduler/scheduler_thread_pool_impl.cc ...
4 years, 8 months ago (2016-04-27 00:59:01 UTC) #14
fdoray
https://codereview.chromium.org/1903133003/diff/40001/base/task_scheduler/priority_queue.cc File base/task_scheduler/priority_queue.cc (right): https://codereview.chromium.org/1903133003/diff/40001/base/task_scheduler/priority_queue.cc#newcode38 base/task_scheduler/priority_queue.cc:38: scoped_refptr<Sequence>&& take_sequence() { && isn't required according to my ...
4 years, 8 months ago (2016-04-27 01:05:10 UTC) #15
gab
@fdoray/robliao: done, PTAL. @danakj PTAL after https://codereview.chromium.org/1876363004/ Thanks! Gab https://codereview.chromium.org/1903133003/diff/40001/base/task_scheduler/priority_queue.cc File base/task_scheduler/priority_queue.cc (right): https://codereview.chromium.org/1903133003/diff/40001/base/task_scheduler/priority_queue.cc#newcode38 base/task_scheduler/priority_queue.cc:38: ...
4 years, 7 months ago (2016-04-27 20:40:30 UTC) #17
danakj
> 5) Make SequenceSortKey copyable. > - Required for SequenceAndSortKey's move constructor Is it? Or ...
4 years, 7 months ago (2016-04-27 20:50:59 UTC) #19
gab
On 2016/04/27 20:50:59, danakj wrote: > > 5) Make SequenceSortKey copyable. > > - Required ...
4 years, 7 months ago (2016-04-28 13:47:16 UTC) #20
gab
On 2016/04/28 13:47:16, gab wrote: > On 2016/04/27 20:50:59, danakj wrote: > > > 5) ...
4 years, 7 months ago (2016-04-28 13:54:32 UTC) #22
fdoray
lgtm with one comment https://codereview.chromium.org/1903133003/diff/80001/base/task_scheduler/sequence_sort_key_unittest.cc File base/task_scheduler/sequence_sort_key_unittest.cc (right): https://codereview.chromium.org/1903133003/diff/80001/base/task_scheduler/sequence_sort_key_unittest.cc#newcode142 base/task_scheduler/sequence_sort_key_unittest.cc:142: EXPECT_EQ(key_a, key_a); This test will ...
4 years, 7 months ago (2016-04-28 14:32:29 UTC) #23
gab
https://codereview.chromium.org/1903133003/diff/80001/base/task_scheduler/sequence_sort_key_unittest.cc File base/task_scheduler/sequence_sort_key_unittest.cc (right): https://codereview.chromium.org/1903133003/diff/80001/base/task_scheduler/sequence_sort_key_unittest.cc#newcode142 base/task_scheduler/sequence_sort_key_unittest.cc:142: EXPECT_EQ(key_a, key_a); On 2016/04/28 14:32:29, fdoray wrote: > This ...
4 years, 7 months ago (2016-04-28 15:36:55 UTC) #24
danakj
LGTM
4 years, 7 months ago (2016-04-28 17:52:24 UTC) #25
danakj
On Thu, Apr 28, 2016 at 6:47 AM, <gab@chromium.org> wrote: > On 2016/04/27 20:50:59, danakj ...
4 years, 7 months ago (2016-04-28 17:52:42 UTC) #26
robliao
lgtm
4 years, 7 months ago (2016-04-28 17:53:42 UTC) #27
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1903133003/120001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1903133003/120001
4 years, 7 months ago (2016-04-28 17:54:32 UTC) #30
commit-bot: I haz the power
Try jobs failed on following builders: ios_dbg_simulator_gn on tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/ios_dbg_simulator_gn/builds/26774) ios_rel_device_ninja on tryserver.chromium.mac (JOB_FAILED, ...
4 years, 7 months ago (2016-04-28 18:02:10 UTC) #32
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1903133003/140001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1903133003/140001
4 years, 7 months ago (2016-04-28 18:48:26 UTC) #35
commit-bot: I haz the power
Committed patchset #7 (id:140001)
4 years, 7 months ago (2016-04-28 19:44:59 UTC) #37
commit-bot: I haz the power
4 years, 7 months ago (2016-04-30 17:20:23 UTC) #38
Message was sent while issue was closed.
Patchset 7 (id:??) landed as
https://crrev.com/eaec122b5f9b9f1689e9da9d32e53939921b6f58
Cr-Commit-Position: refs/heads/master@{#390451}

Powered by Google App Engine
This is Rietveld 408576698