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

Issue 1011683002: Lazily initialize MessageLoop for faster thread startup (Closed)

Created:
5 years, 9 months ago by kinuko
Modified:
5 years, 7 months ago
CC:
chromium-reviews, erikwright+watch_chromium.org, sadrul, Peter Kasting, eroman, brettw
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Lazily initialize MessageLoop for faster thread startup Summary of the change and background discussion: https://docs.google.com/a/chromium.org/document/d/1o1vUUOjX3tC7pV5-nxchaGtElo4NwtzKOAb4Zm09ezw/edit# This implements approach 1 in the doc. Approach 2: https://codereview.chromium.org/1086663002/ Approach 3: https://codereview.chromium.org/1058603004/ Discussion thread: https://groups.google.com/a/chromium.org/forum/#!topic/chromium-dev/2t6lB8hUgYw BUG=465458 Committed: https://crrev.com/f1f70cb5ebe24d85c575396f026a415ed0fe9afc Cr-Commit-Position: refs/heads/master@{#328347}

Patch Set 1 : #

Patch Set 2 : Fix some crashers #

Patch Set 3 : More build fix #

Patch Set 4 : moar fixes #

Patch Set 5 : test fixes #

Patch Set 6 : #

Patch Set 7 : more test fixes #

Patch Set 8 : Start AudioThread synchronously #

Patch Set 9 : cleanup, test fix attempt #

Patch Set 10 : #

Patch Set 11 : #

Patch Set 12 : #

Total comments: 10

Patch Set 13 : addressed comments #

Patch Set 14 : #

Patch Set 15 : changing running_event_ back to start_event_ #

Patch Set 16 : thread_id() fix #

Patch Set 17 : non-blocking thread_id() #

Total comments: 38

Patch Set 18 : addressed comments and simplified a bit #

Patch Set 19 : #

Patch Set 20 : removed audio thread hack #

Patch Set 21 : StartAndWait -> StartAndWaitForTesting #

Total comments: 50

Patch Set 22 : addressed comments #

Total comments: 16

Patch Set 23 : refine comments, make the new message loop ctor private #

Patch Set 24 : remove DCHECK's in message_loop_proxy_impl #

Patch Set 25 : Android DNS thread fix #

Patch Set 26 : weak ptr #

Total comments: 2

Patch Set 27 : WaitUntilThreadStarted in NetworkChangeNotifierAndroid #

Patch Set 28 : rebase #

Unified diffs Side-by-side diffs Delta from patch set Stats (+265 lines, -177 lines) Patch
M base/message_loop/incoming_task_queue.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 3 chunks +10 lines, -0 lines 0 comments Download
M base/message_loop/incoming_task_queue.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 3 chunks +26 lines, -10 lines 0 comments Download
M base/message_loop/message_loop.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 5 chunks +36 lines, -7 lines 0 comments Download
M base/message_loop/message_loop.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 4 chunks +47 lines, -33 lines 0 comments Download
M base/message_loop/message_loop_proxy_impl.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 chunk +3 lines, -0 lines 0 comments Download
M base/message_loop/message_loop_proxy_impl.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 23 1 chunk +6 lines, -1 line 0 comments Download
M base/message_loop/message_pump_perftest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 3 chunks +0 lines, -5 lines 0 comments Download
M base/threading/platform_thread.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 1 chunk +4 lines, -0 lines 0 comments Download
M base/threading/platform_thread_win.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 1 chunk +3 lines, -2 lines 0 comments Download
M base/threading/thread.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 7 chunks +24 lines, -12 lines 0 comments Download
M base/threading/thread.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 7 chunks +78 lines, -79 lines 0 comments Download
M base/threading/thread_id_name_manager_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 3 chunks +6 lines, -6 lines 0 comments Download
M base/threading/thread_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 1 chunk +3 lines, -2 lines 0 comments Download
M chrome/browser/io_thread.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 1 chunk +0 lines, -1 line 0 comments Download
M chrome/browser/io_thread.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 1 chunk +0 lines, -5 lines 0 comments Download
M chrome/browser/metrics/thread_watcher_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 25 2 chunks +4 lines, -4 lines 0 comments Download
M chrome/browser/sync/glue/sync_backend_registrar_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 1 chunk +3 lines, -0 lines 0 comments Download
M content/browser/browser_thread_impl.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 1 chunk +1 line, -7 lines 0 comments Download
M content/public/browser/browser_thread_delegate.h View 1 2 3 4 5 6 7 1 chunk +0 lines, -3 lines 0 comments Download
M content/public/test/test_browser_thread.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 chunk +4 lines, -0 lines 0 comments Download
M content/public/test/test_browser_thread.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 chunk +4 lines, -0 lines 0 comments Download
M net/android/network_change_notifier_android.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 1 chunk +3 lines, -0 lines 0 comments Download

Messages

Total messages: 78 (35 generated)
DaleCurtis
A bit more invasive than I'd hoped, but seems reasonable. Are you able to notice ...
5 years, 9 months ago (2015-03-18 22:04:28 UTC) #6
kinuko
Thanks! I'm also going to write a short doc that summarizes the change and discussion ...
5 years, 9 months ago (2015-03-19 03:08:16 UTC) #7
kinuko
https://codereview.chromium.org/1011683002/diff/300001/base/threading/thread.cc File base/threading/thread.cc (right): https://codereview.chromium.org/1011683002/diff/300001/base/threading/thread.cc#newcode225 base/threading/thread.cc:225: { On 2015/03/19 03:08:16, kinuko wrote: > On 2015/03/18 ...
5 years, 9 months ago (2015-03-20 08:44:22 UTC) #8
kinuko
Hi rvargas@, would you be able to review this change and/or add appropriate base/ reviewers? ...
5 years, 9 months ago (2015-03-25 13:00:17 UTC) #13
rvargas (doing something else)
On 2015/03/25 13:00:17, kinuko wrote: > Hi rvargas@, would you be able to review this ...
5 years, 9 months ago (2015-03-25 18:12:47 UTC) #14
DaleCurtis
https://codereview.chromium.org/1011683002/diff/440001/media/audio/audio_manager_base.cc File media/audio/audio_manager_base.cc (right): https://codereview.chromium.org/1011683002/diff/440001/media/audio/audio_manager_base.cc#newcode99 media/audio/audio_manager_base.cc:99: // We check COM initializer status right after calling ...
5 years, 9 months ago (2015-03-26 00:12:38 UTC) #16
kinuko
On 2015/03/26 00:12:38, DaleCurtis wrote: > https://codereview.chromium.org/1011683002/diff/440001/media/audio/audio_manager_base.cc > File media/audio/audio_manager_base.cc (right): > > https://codereview.chromium.org/1011683002/diff/440001/media/audio/audio_manager_base.cc#newcode99 > ...
5 years, 9 months ago (2015-03-26 00:25:59 UTC) #17
DaleCurtis
Ah, I see, unfortunately it looks like those test logs have already been deleted. I ...
5 years, 9 months ago (2015-03-26 00:31:23 UTC) #18
rvargas (doing something else)
Sorry for the delay. It's taking me a long time to go over the code. ...
5 years, 9 months ago (2015-03-26 02:19:28 UTC) #19
kinuko
Resumed working on this, updated the code. I think the newer version's a bit simpler. ...
5 years, 8 months ago (2015-04-13 02:03:00 UTC) #28
kinuko
Since Ricardo seems out-of-office let me add a few more base/ owners. Mark, Nico, (or ...
5 years, 8 months ago (2015-04-16 14:50:29 UTC) #31
Nico
I'm looking now. (Well…I read the discussion thread and the design doc while on the ...
5 years, 8 months ago (2015-04-16 15:52:16 UTC) #32
DaleCurtis
https://codereview.chromium.org/1011683002/diff/440001/media/audio/audio_manager_base.cc File media/audio/audio_manager_base.cc (right): https://codereview.chromium.org/1011683002/diff/440001/media/audio/audio_manager_base.cc#newcode99 media/audio/audio_manager_base.cc:99: // We check COM initializer status right after calling ...
5 years, 8 months ago (2015-04-16 16:41:07 UTC) #33
kinuko
On 2015/04/16 16:41:07, DaleCurtis wrote: > Did you have a chance to dig into this ...
5 years, 8 months ago (2015-04-17 16:11:10 UTC) #34
DaleCurtis
On 2015/04/17 16:11:10, kinuko wrote: > On 2015/04/16 16:41:07, DaleCurtis wrote: > > Did you ...
5 years, 8 months ago (2015-04-17 18:25:36 UTC) #35
kinuko
On 2015/04/17 18:25:36, DaleCurtis wrote: > On 2015/04/17 16:11:10, kinuko wrote: > > On 2015/04/16 ...
5 years, 8 months ago (2015-04-17 22:01:24 UTC) #36
kinuko
Updated the code, as we no longer need to call StartAndWait() in audio code it's ...
5 years, 8 months ago (2015-04-21 08:17:33 UTC) #37
kinuko
It looks I'm having a bit tough time to get reviewers who are not ooo ...
5 years, 8 months ago (2015-04-24 04:55:06 UTC) #39
danakj
Before I go in too deep, some comments/questions on MessageLoop https://codereview.chromium.org/1011683002/diff/680001/base/message_loop/incoming_task_queue.cc File base/message_loop/incoming_task_queue.cc (right): https://codereview.chromium.org/1011683002/diff/680001/base/message_loop/incoming_task_queue.cc#newcode115 ...
5 years, 8 months ago (2015-04-24 20:54:40 UTC) #40
Nico
Dana, I'm looking at this right now. (Was OOO sick the last 4 days, sorry) ...
5 years, 8 months ago (2015-04-24 20:57:47 UTC) #41
Nico
Thanks for writing the comprehensive document. I'm not sure if any approach is "obviously better", ...
5 years, 8 months ago (2015-04-24 21:31:16 UTC) #42
kinuko
Nico, Dana thanks for taking a look! Updated the patch. https://codereview.chromium.org/1011683002/diff/680001/base/message_loop/incoming_task_queue.cc File base/message_loop/incoming_task_queue.cc (right): https://codereview.chromium.org/1011683002/diff/680001/base/message_loop/incoming_task_queue.cc#newcode114 ...
5 years, 8 months ago (2015-04-27 16:36:05 UTC) #44
danakj
https://codereview.chromium.org/1011683002/diff/680001/base/message_loop/message_loop.h File base/message_loop/message_loop.h (right): https://codereview.chromium.org/1011683002/diff/680001/base/message_loop/message_loop.h#newcode143 base/message_loop/message_loop.h:143: // constructor is used only for testing. No need ...
5 years, 8 months ago (2015-04-27 16:46:40 UTC) #45
Nico
Code looks fine. I have a few questions on how to best handle the half-initialized ...
5 years, 8 months ago (2015-04-27 22:49:34 UTC) #46
kinuko
https://codereview.chromium.org/1011683002/diff/680001/base/threading/thread.cc File base/threading/thread.cc (right): https://codereview.chromium.org/1011683002/diff/680001/base/threading/thread.cc#newcode166 base/threading/thread.cc:166: AutoLock lock(lock_); On 2015/04/27 22:49:34, Nico wrote: > On ...
5 years, 7 months ago (2015-04-28 15:43:26 UTC) #48
Nico
Looks good. Are the test failures on try trybots real?
5 years, 7 months ago (2015-04-28 19:16:19 UTC) #49
kinuko
On 2015/04/28 19:16:19, Nico wrote: > Looks good. > > Are the test failures on ...
5 years, 7 months ago (2015-04-29 14:14:50 UTC) #50
kinuko
> It looks net_unittests failures on linux_android_rel_ng are real too, I'll need > some investigation ...
5 years, 7 months ago (2015-04-30 12:36:45 UTC) #51
Nico
lgtm, but please have someone familiar with that code look at the network_change_notifier_android change
5 years, 7 months ago (2015-04-30 18:00:52 UTC) #52
kinuko
On 2015/04/30 18:00:52, Nico wrote: > lgtm, but please have someone familiar with that code ...
5 years, 7 months ago (2015-05-01 05:40:47 UTC) #53
kinuko
pauljensen@: could you review changes in network_change_notifier_android.cc? After this patch Thread::Init() will start to be ...
5 years, 7 months ago (2015-05-01 05:43:01 UTC) #55
pauljensen
https://codereview.chromium.org/1011683002/diff/810001/net/android/network_change_notifier_android.cc File net/android/network_change_notifier_android.cc (right): https://codereview.chromium.org/1011683002/diff/810001/net/android/network_change_notifier_android.cc#newcode110 net/android/network_change_notifier_android.cc:110: base::Bind(&DnsConfigServiceThread::InitAfterStart, weak_ptr_)); This is not good. This will allow ...
5 years, 7 months ago (2015-05-01 11:54:44 UTC) #58
kinuko
https://codereview.chromium.org/1011683002/diff/810001/net/android/network_change_notifier_android.cc File net/android/network_change_notifier_android.cc (right): https://codereview.chromium.org/1011683002/diff/810001/net/android/network_change_notifier_android.cc#newcode110 net/android/network_change_notifier_android.cc:110: base::Bind(&DnsConfigServiceThread::InitAfterStart, weak_ptr_)); On 2015/05/01 11:54:44, pauljensen wrote: > This ...
5 years, 7 months ago (2015-05-01 13:58:06 UTC) #59
kinuko
Updated the network_change_notifier_android.cc, this time I made it simply blocking after Thread::Start before it calls ...
5 years, 7 months ago (2015-05-02 04:35:09 UTC) #62
pauljensen
net/ LGTM
5 years, 7 months ago (2015-05-04 11:20:03 UTC) #63
kinuko
jam@: could you do owner review for content/ changes?
5 years, 7 months ago (2015-05-04 15:31:23 UTC) #65
jam
On 2015/05/04 15:31:23, kinuko wrote: > jam@: could you do owner review for content/ changes? ...
5 years, 7 months ago (2015-05-04 18:16:06 UTC) #66
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1011683002/850001
5 years, 7 months ago (2015-05-05 04:18:39 UTC) #69
commit-bot: I haz the power
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/49448) ios_dbg_simulator_ninja on tryserver.chromium.mac (JOB_FAILED, ...
5 years, 7 months ago (2015-05-05 04:24:58 UTC) #71
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1011683002/870001
5 years, 7 months ago (2015-05-05 14:24:56 UTC) #74
commit-bot: I haz the power
Committed patchset #28 (id:870001)
5 years, 7 months ago (2015-05-05 17:14:16 UTC) #75
commit-bot: I haz the power
Patchset 28 (id:??) landed as https://crrev.com/f1f70cb5ebe24d85c575396f026a415ed0fe9afc Cr-Commit-Position: refs/heads/master@{#328347}
5 years, 7 months ago (2015-05-05 17:15:50 UTC) #76
kinuko
5 years, 7 months ago (2015-05-07 01:26:50 UTC) #77
Message was sent while issue was closed.
A revert of this CL (patchset #28 id:870001) has been created in
https://codereview.chromium.org/1122383003/ by kinuko@chromium.org.

The reason for reverting is: This introduced flaky assertion failure on some
tests  http://crbug.com/485157.

Powered by Google App Engine
This is Rietveld 408576698