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

Issue 2204333003: Add joinable option to SimpleThread::Options as was just done for Thread. (Closed)

Created:
4 years, 4 months ago by gab
Modified:
4 years, 4 months ago
CC:
chromium-reviews, mlamouri+watch-content_chromium.org, kinuko+watch, jam, darin-cc_chromium.org, blink-worker-reviews_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@b1_nonjoinable_thread
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Add joinable option to SimpleThread::Options as was just done for Thread::Options. SimpleThread will be more suitable than Thread for https://codereview.chromium.org/2197753002/ per it not needing a MessageLoop. Also, cleanup the SimpleThread::Options API, making it more like Thread::Options. Non-joinable SimpleThreads will have to remain alive so long as their Run() method uses member state (SimpleThread itself won't after invoking Run()). DelegateSimpleThread provides a safe way to do this by explicitly supporting being deleted while Run() is active but ensuring the Delegate itself outlives Run()). Note: it might seem overkill to let DelegateSimpleThread be deleted early but this is eventually what I want to do for base::Thread (https://crbug.com/629139#c14) and this is a good precursor to this paradigm (it really takes all its sense on base::Thread where the destructor is more meaningful though -- winds down the MessageLoop). The logic on SimpleThread is fairly simple, the complexity is in the assertions (which were put behind DCHECK_IS_ON() to clearly isolate them) and the tests. BUG=629716, 634835, 629139 TBR=avi@chromium.org CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_chromium_tsan_rel_ng Committed: https://crrev.com/8b35b0572443f4a84377a1fbd199a1edabe3d7d6 Cr-Commit-Position: refs/heads/master@{#409830} Reverted: https://crrev.com/a9094bdb2cda679e8bf3a5b43b27c12efa975d3c Committed: https://crrev.com/addc8ef1bcae5bff546fba73eca8bea3e640ebcd Cr-Original-Commit-Position: refs/heads/master@{#410169} Cr-Commit-Position: refs/heads/master@{#411897}

Patch Set 1 #

Total comments: 8

Patch Set 2 : review:thestig #1 #

Patch Set 3 : rebase on r410390 post revert #

Patch Set 4 : New lifetime rules around non-joinable SimpleThreads (crbug/634835) #

Patch Set 5 : Format and fix ASan #

Patch Set 6 : Fix ASan for real? #

Patch Set 7 : WaitableEvents owned by test fixture #

Patch Set 8 : fix TSan? #

Patch Set 9 : ScopedAllowWait for destructor dcheck #

Patch Set 10 : +friend for ScopedAllowWait.. #

Total comments: 8

Patch Set 11 : nits:thestig #

Total comments: 9

Patch Set 12 : Remove DCHECK => rely on ASAN/TSAN for early Delegate deletion #

Total comments: 4

Patch Set 13 : simplify Delegate interface further #

Patch Set 14 : fix compile #

Patch Set 15 : fix TSan and ASan #

Unified diffs Side-by-side diffs Delta from patch set Stats (+151 lines, -54 lines) Patch
M base/threading/simple_thread.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 6 chunks +33 lines, -21 lines 0 comments Download
M base/threading/simple_thread.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 2 chunks +23 lines, -28 lines 0 comments Download
M base/threading/simple_thread_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 6 chunks +94 lines, -4 lines 0 comments Download
M content/renderer/categorized_worker_pool.cc View 11 12 13 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 144 (102 generated)
gab
Lei PTAL, much simpler than the base::Thread version. Thanks! Gab
4 years, 4 months ago (2016-08-03 21:13:07 UTC) #5
gab
On 2016/08/03 21:13:07, gab wrote: > Lei PTAL, much simpler than the base::Thread version. PS: ...
4 years, 4 months ago (2016-08-03 21:16:03 UTC) #6
Lei Zhang
Looks ok. I think one of the red bots is yours. https://codereview.chromium.org/2204333003/diff/1/base/threading/simple_thread.cc File base/threading/simple_thread.cc (right): ...
4 years, 4 months ago (2016-08-03 23:24:12 UTC) #9
gab
On 2016/08/03 23:24:12, Lei Zhang wrote: > Looks ok. I think one of the red ...
4 years, 4 months ago (2016-08-04 14:35:01 UTC) #11
Lei Zhang
lgtm
4 years, 4 months ago (2016-08-04 16:41:27 UTC) #15
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/2204333003/20001
4 years, 4 months ago (2016-08-04 17:04:22 UTC) #17
commit-bot: I haz the power
Try jobs failed on following builders: chromium_presubmit on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/chromium_presubmit/builds/231198)
4 years, 4 months ago (2016-08-04 17:10:40 UTC) #19
gab
TBR avi for content/renderer/categorized_worker_pool.cc side-effects
4 years, 4 months ago (2016-08-04 17:54:25 UTC) #22
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/2204333003/20001
4 years, 4 months ago (2016-08-04 17:55:01 UTC) #24
commit-bot: I haz the power
Committed patchset #2 (id:20001)
4 years, 4 months ago (2016-08-04 18:00:15 UTC) #26
commit-bot: I haz the power
Patchset 2 (id:??) landed as https://crrev.com/8b35b0572443f4a84377a1fbd199a1edabe3d7d6 Cr-Commit-Position: refs/heads/master@{#409830}
4 years, 4 months ago (2016-08-04 18:03:53 UTC) #28
justincohen
A revert of this CL (patchset #2 id:20001) has been created in https://codereview.chromium.org/2223433003/ by justincohen@chromium.org. ...
4 years, 4 months ago (2016-08-05 20:03:29 UTC) #29
gab
Lei PTAnL : issues highlighted in http://crbug.com/634835 when landing patch set 2 have been addressed ...
4 years, 4 months ago (2016-08-10 16:23:59 UTC) #86
jam
lgtm https://codereview.chromium.org/2204333003/diff/240001/base/threading/thread_restrictions.h File base/threading/thread_restrictions.h (right): https://codereview.chromium.org/2204333003/diff/240001/base/threading/thread_restrictions.h#newcode12 base/threading/thread_restrictions.h:12: #if DCHECK_IS_ON() tangent: it's odd that this is ...
4 years, 4 months ago (2016-08-10 17:34:36 UTC) #89
jam
https://codereview.chromium.org/2204333003/diff/240001/base/threading/thread_restrictions.h File base/threading/thread_restrictions.h (right): https://codereview.chromium.org/2204333003/diff/240001/base/threading/thread_restrictions.h#newcode12 base/threading/thread_restrictions.h:12: #if DCHECK_IS_ON() On 2016/08/10 17:34:36, jam wrote: > tangent: ...
4 years, 4 months ago (2016-08-10 17:35:19 UTC) #90
Lei Zhang
https://codereview.chromium.org/2204333003/diff/240001/base/threading/simple_thread.cc File base/threading/simple_thread.cc (right): https://codereview.chromium.org/2204333003/diff/240001/base/threading/simple_thread.cc#newcode93 base/threading/simple_thread.cc:93: active_runners_decremented_.TimedWait(remaining_time); Can we just Wait() instead of doing TimedWait() ...
4 years, 4 months ago (2016-08-10 21:12:38 UTC) #91
gab
Reply from phone, will address nits tomorrow https://codereview.chromium.org/2204333003/diff/240001/base/threading/simple_thread.cc File base/threading/simple_thread.cc (right): https://codereview.chromium.org/2204333003/diff/240001/base/threading/simple_thread.cc#newcode93 base/threading/simple_thread.cc:93: active_runners_decremented_.TimedWait(remaining_time); On ...
4 years, 4 months ago (2016-08-10 22:37:00 UTC) #92
Lei Zhang
On 2016/08/10 22:37:00, gab wrote: > That would make the check not as good IMO ...
4 years, 4 months ago (2016-08-11 03:02:02 UTC) #93
gab
Nits from Lei addressed but he appears to be OOO now, @danakj to finalize this ...
4 years, 4 months ago (2016-08-11 13:06:18 UTC) #97
danakj
https://codereview.chromium.org/2204333003/diff/260001/base/threading/simple_thread.h File base/threading/simple_thread.h (right): https://codereview.chromium.org/2204333003/diff/260001/base/threading/simple_thread.h#newcode147 base/threading/simple_thread.h:147: // Run() is private pure virtual because only RunHelper() ...
4 years, 4 months ago (2016-08-12 18:38:00 UTC) #100
gab
https://codereview.chromium.org/2204333003/diff/260001/base/threading/simple_thread.h File base/threading/simple_thread.h (right): https://codereview.chromium.org/2204333003/diff/260001/base/threading/simple_thread.h#newcode147 base/threading/simple_thread.h:147: // Run() is private pure virtual because only RunHelper() ...
4 years, 4 months ago (2016-08-12 18:45:05 UTC) #101
danakj
https://codereview.chromium.org/2204333003/diff/260001/base/threading/simple_thread.h File base/threading/simple_thread.h (right): https://codereview.chromium.org/2204333003/diff/260001/base/threading/simple_thread.h#newcode147 base/threading/simple_thread.h:147: // Run() is private pure virtual because only RunHelper() ...
4 years, 4 months ago (2016-08-12 18:55:17 UTC) #102
danakj
On 2016/08/12 18:55:17, danakj wrote: > https://codereview.chromium.org/2204333003/diff/260001/base/threading/simple_thread.h > File base/threading/simple_thread.h (right): > > https://codereview.chromium.org/2204333003/diff/260001/base/threading/simple_thread.h#newcode147 > ...
4 years, 4 months ago (2016-08-12 18:56:16 UTC) #103
gab
https://codereview.chromium.org/2204333003/diff/260001/base/threading/simple_thread.h File base/threading/simple_thread.h (right): https://codereview.chromium.org/2204333003/diff/260001/base/threading/simple_thread.h#newcode147 base/threading/simple_thread.h:147: // Run() is private pure virtual because only RunHelper() ...
4 years, 4 months ago (2016-08-12 19:05:50 UTC) #104
danakj
LGTM for the non-joinable bits. A little bit meh about the DCHECK stuff, like I ...
4 years, 4 months ago (2016-08-12 20:49:10 UTC) #105
gab
https://codereview.chromium.org/2204333003/diff/260001/base/threading/simple_thread.cc File base/threading/simple_thread.cc (right): https://codereview.chromium.org/2204333003/diff/260001/base/threading/simple_thread.cc#newcode98 base/threading/simple_thread.cc:98: DCHECK(AtomicRefCountIsZero(&active_runners_)) On 2016/08/12 20:49:10, danakj wrote: > Hm, I ...
4 years, 4 months ago (2016-08-12 21:23:18 UTC) #106
gab
Removed complex DCHECK_IS_ON() logic. As we discussed offline ASAN/TSAN should be able to catch cases ...
4 years, 4 months ago (2016-08-12 22:36:34 UTC) #108
danakj
LGTM https://codereview.chromium.org/2204333003/diff/300001/base/threading/simple_thread.h File base/threading/simple_thread.h (right): https://codereview.chromium.org/2204333003/diff/300001/base/threading/simple_thread.h#newcode138 base/threading/simple_thread.h:138: Delegate() = default; this not needed at all ...
4 years, 4 months ago (2016-08-12 23:12:25 UTC) #109
gab
Thanks, done :-) https://codereview.chromium.org/2204333003/diff/300001/base/threading/simple_thread.h File base/threading/simple_thread.h (right): https://codereview.chromium.org/2204333003/diff/300001/base/threading/simple_thread.h#newcode138 base/threading/simple_thread.h:138: Delegate() = default; On 2016/08/12 23:12:25, ...
4 years, 4 months ago (2016-08-12 23:29:51 UTC) #110
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/2204333003/320001
4 years, 4 months ago (2016-08-12 23:31:00 UTC) #113
commit-bot: I haz the power
Try jobs failed on following builders: mac_chromium_compile_dbg_ng on master.tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/mac_chromium_compile_dbg_ng/builds/250817)
4 years, 4 months ago (2016-08-12 23:40:37 UTC) #115
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/2204333003/340001
4 years, 4 months ago (2016-08-13 01:49:29 UTC) #118
commit-bot: I haz the power
Exceeded global retry quota
4 years, 4 months ago (2016-08-13 03:07:36 UTC) #120
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/2204333003/360001
4 years, 4 months ago (2016-08-13 12:44:12 UTC) #123
commit-bot: I haz the power
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/builds/51805)
4 years, 4 months ago (2016-08-13 12:49:13 UTC) #125
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/2204333003/380001
4 years, 4 months ago (2016-08-13 12:50:02 UTC) #128
gab
FYI, fixed ASan and TSan: - API has to be that DelegateSimpleThread can be deleted ...
4 years, 4 months ago (2016-08-13 13:10:08 UTC) #132
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/2204333003/440001
4 years, 4 months ago (2016-08-13 13:11:06 UTC) #136
commit-bot: I haz the power
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/builds/51811)
4 years, 4 months ago (2016-08-13 13:17:37 UTC) #138
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/2204333003/440001
4 years, 4 months ago (2016-08-13 17:00:04 UTC) #140
commit-bot: I haz the power
Committed patchset #15 (id:440001)
4 years, 4 months ago (2016-08-13 17:29:12 UTC) #142
commit-bot: I haz the power
4 years, 4 months ago (2016-08-13 17:30:53 UTC) #144
Message was sent while issue was closed.
Patchset 15 (id:??) landed as
https://crrev.com/addc8ef1bcae5bff546fba73eca8bea3e640ebcd
Cr-Commit-Position: refs/heads/master@{#411897}

Powered by Google App Engine
This is Rietveld 408576698