diff options
author | glider <glider@chromium.org> | 2015-05-18 22:24:19 +0900 |
---|---|---|
committer | Qijiang Fan <fqj@google.com> | 2020-06-04 18:56:54 +0900 |
commit | 9545b1322750d42b0a7ff58450fe017fa6be438d (patch) | |
tree | ed0eae0976d57a77669e65188aa37d2b80b35af1 /base/message_loop/incoming_task_queue.cc | |
parent | f15caeecc8009d9cce23f544ad909864f6e9f50f (diff) | |
download | libchrome-9545b1322750d42b0a7ff58450fe017fa6be438d.tar.gz |
Revert of Reland: Lazily initialize MessageLoop for faster thread startup (patchset #5 id:160001 of https://codereview.chromium.org/1129953004/)
Reason for revert:
Massive data race reports, see https://crbug.com/489263
Original issue's description:
> Reland: Lazily initialize MessageLoop for faster thread startup
>
> Original review: https://codereview.chromium.org/1011683002/
>
> Reverted because it's suspected for following flakiness issues:
> http://crbug.com/485157 - Windows race
> http://crbug.com/485091 - Android ThreadWatcher
> http://crbug.com/485178 - interactive_ui_tests Menu* tests
>
> PS1 is the original patch set that gets reverted.
>
> BUG=465458, 485157, 485091, 485178
> TBR=jam
>
> Committed: https://crrev.com/8b6133a69f16702a32a3c3104630c4d9ac393b7a
> Cr-Commit-Position: refs/heads/master@{#330329}
TBR=thakis@chromium.org,toyoshim@chromium.org,jam@chromium.org,kinuko@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=465458, 485157, 485091, 485178
Review URL: https://codereview.chromium.org/1140363002
Cr-Commit-Position: refs/heads/master@{#330351}
CrOS-Libchrome-Original-Commit: 787e3347eb49a59db5e6fe0374f50464f36d48e3
Diffstat (limited to 'base/message_loop/incoming_task_queue.cc')
-rw-r--r-- | base/message_loop/incoming_task_queue.cc | 36 |
1 files changed, 10 insertions, 26 deletions
diff --git a/base/message_loop/incoming_task_queue.cc b/base/message_loop/incoming_task_queue.cc index 5e9a4613da..c1ce939b0c 100644 --- a/base/message_loop/incoming_task_queue.cc +++ b/base/message_loop/incoming_task_queue.cc @@ -44,8 +44,7 @@ IncomingTaskQueue::IncomingTaskQueue(MessageLoop* message_loop) message_loop_(message_loop), next_sequence_num_(0), message_loop_scheduled_(false), - always_schedule_work_(AlwaysNotifyPump(message_loop_->type())), - is_ready_for_scheduling_(false) { + always_schedule_work_(AlwaysNotifyPump(message_loop_->type())) { } bool IncomingTaskQueue::AddToIncomingQueue( @@ -110,15 +109,6 @@ void IncomingTaskQueue::WillDestroyCurrentMessageLoop() { message_loop_ = NULL; } -void IncomingTaskQueue::StartScheduling() { - AutoLock lock(incoming_queue_lock_); - DCHECK(!is_ready_for_scheduling_); - DCHECK(!message_loop_scheduled_); - is_ready_for_scheduling_ = true; - if (!incoming_queue_.empty()) - ScheduleWork(); -} - IncomingTaskQueue::~IncomingTaskQueue() { // Verify that WillDestroyCurrentMessageLoop() has been called. DCHECK(!message_loop_); @@ -158,25 +148,19 @@ bool IncomingTaskQueue::PostPendingTask(PendingTask* pending_task) { incoming_queue_.push(*pending_task); pending_task->task.Reset(); - if (is_ready_for_scheduling_ && - (always_schedule_work_ || (!message_loop_scheduled_ && was_empty))) { - ScheduleWork(); + if (always_schedule_work_ || (!message_loop_scheduled_ && was_empty)) { + // Wake up the message loop. + message_loop_->ScheduleWork(); + // After we've scheduled the message loop, we do not need to do so again + // until we know it has processed all of the work in our queue and is + // waiting for more work again. The message loop will always attempt to + // reload from the incoming queue before waiting again so we clear this flag + // in ReloadWorkQueue(). + message_loop_scheduled_ = true; } return true; } -void IncomingTaskQueue::ScheduleWork() { - DCHECK(is_ready_for_scheduling_); - // Wake up the message loop. - message_loop_->ScheduleWork(); - // After we've scheduled the message loop, we do not need to do so again - // until we know it has processed all of the work in our queue and is - // waiting for more work again. The message loop will always attempt to - // reload from the incoming queue before waiting again so we clear this flag - // in ReloadWorkQueue(). - message_loop_scheduled_ = true; -} - } // namespace internal } // namespace base |