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

Side by Side Diff: base/message_loop/incoming_task_queue.cc

Issue 1222013004: Revert of Don't peek messages in the MessagePumpForUI class when we receive our kMsgHaveWork message. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « base/message_loop/incoming_task_queue.h ('k') | base/message_loop/message_loop.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/message_loop/incoming_task_queue.h" 5 #include "base/message_loop/incoming_task_queue.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "base/location.h" 9 #include "base/location.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 112
113 void IncomingTaskQueue::StartScheduling() { 113 void IncomingTaskQueue::StartScheduling() {
114 AutoLock lock(incoming_queue_lock_); 114 AutoLock lock(incoming_queue_lock_);
115 DCHECK(!is_ready_for_scheduling_); 115 DCHECK(!is_ready_for_scheduling_);
116 DCHECK(!message_loop_scheduled_); 116 DCHECK(!message_loop_scheduled_);
117 is_ready_for_scheduling_ = true; 117 is_ready_for_scheduling_ = true;
118 if (!incoming_queue_.empty()) 118 if (!incoming_queue_.empty())
119 ScheduleWork(); 119 ScheduleWork();
120 } 120 }
121 121
122 TimeTicks IncomingTaskQueue::GetNewlyAddedTaskDelay() {
123 return !incoming_queue_.empty() ? incoming_queue_.front().delayed_run_time :
124 TimeTicks();
125 }
126
127 IncomingTaskQueue::~IncomingTaskQueue() { 122 IncomingTaskQueue::~IncomingTaskQueue() {
128 // Verify that WillDestroyCurrentMessageLoop() has been called. 123 // Verify that WillDestroyCurrentMessageLoop() has been called.
129 DCHECK(!message_loop_); 124 DCHECK(!message_loop_);
130 } 125 }
131 126
132 TimeTicks IncomingTaskQueue::CalculateDelayedRuntime(TimeDelta delay) { 127 TimeTicks IncomingTaskQueue::CalculateDelayedRuntime(TimeDelta delay) {
133 TimeTicks delayed_run_time; 128 TimeTicks delayed_run_time;
134 if (delay > TimeDelta()) 129 if (delay > TimeDelta())
135 delayed_run_time = TimeTicks::Now() + delay; 130 delayed_run_time = TimeTicks::Now() + delay;
136 else 131 else
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 // After we've scheduled the message loop, we do not need to do so again 173 // After we've scheduled the message loop, we do not need to do so again
179 // until we know it has processed all of the work in our queue and is 174 // until we know it has processed all of the work in our queue and is
180 // waiting for more work again. The message loop will always attempt to 175 // waiting for more work again. The message loop will always attempt to
181 // reload from the incoming queue before waiting again so we clear this flag 176 // reload from the incoming queue before waiting again so we clear this flag
182 // in ReloadWorkQueue(). 177 // in ReloadWorkQueue().
183 message_loop_scheduled_ = true; 178 message_loop_scheduled_ = true;
184 } 179 }
185 180
186 } // namespace internal 181 } // namespace internal
187 } // namespace base 182 } // namespace base
OLDNEW
« no previous file with comments | « base/message_loop/incoming_task_queue.h ('k') | base/message_loop/message_loop.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698