summaryrefslogtreecommitdiffstats
path: root/chromium/base/message_loop/message_loop.cc
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2018-01-31 16:33:43 +0100
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2018-02-06 16:33:22 +0000
commitda51f56cc21233c2d30f0fe0d171727c3102b2e0 (patch)
tree4e579ab70ce4b19bee7984237f3ce05a96d59d83 /chromium/base/message_loop/message_loop.cc
parentc8c2d1901aec01e934adf561a9fdf0cc776cdef8 (diff)
BASELINE: Update Chromium to 65.0.3525.40
Also imports missing submodules Change-Id: I36901b7c6a325cda3d2c10cedb2186c25af3b79b Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'chromium/base/message_loop/message_loop.cc')
-rw-r--r--chromium/base/message_loop/message_loop.cc24
1 files changed, 16 insertions, 8 deletions
diff --git a/chromium/base/message_loop/message_loop.cc b/chromium/base/message_loop/message_loop.cc
index 2c8899bf05e..a51db8ba54e 100644
--- a/chromium/base/message_loop/message_loop.cc
+++ b/chromium/base/message_loop/message_loop.cc
@@ -258,9 +258,17 @@ void MessageLoop::RemoveTaskObserver(TaskObserver* task_observer) {
}
bool MessageLoop::IsIdleForTesting() {
- // We only check the incoming queue, since we don't want to lock the work
- // queue.
- return incoming_task_queue_->IsIdleForTesting();
+ // Have unprocessed tasks? (this reloads the work queue if necessary)
+ if (incoming_task_queue_->triage_tasks().HasTasks())
+ return false;
+
+ // Have unprocessed deferred tasks which can be processed at this run-level?
+ if (incoming_task_queue_->deferred_tasks().HasTasks() &&
+ !RunLoop::IsNestedOnCurrentThread()) {
+ return false;
+ }
+
+ return true;
}
//------------------------------------------------------------------------------
@@ -303,7 +311,7 @@ void MessageLoop::BindToCurrentThread() {
internal::ScopedSetSequenceLocalStorageMapForCurrentThread>(
&sequence_local_storage_map_);
- run_loop_client_ = RunLoop::RegisterDelegateForCurrentThread(this);
+ RunLoop::RegisterDelegateForCurrentThread(this);
}
std::string MessageLoop::GetThreadName() const {
@@ -334,7 +342,7 @@ void MessageLoop::Run(bool application_tasks_allowed) {
DCHECK_EQ(this, current());
if (application_tasks_allowed && !task_execution_allowed_) {
// Allow nested task execution as explicitly requested.
- DCHECK(run_loop_client_->IsNested());
+ DCHECK(RunLoop::IsNestedOnCurrentThread());
task_execution_allowed_ = true;
pump_->Run(this);
task_execution_allowed_ = false;
@@ -363,7 +371,7 @@ void MessageLoop::SetThreadTaskRunnerHandle() {
}
bool MessageLoop::ProcessNextDelayedNonNestableTask() {
- if (run_loop_client_->IsNested())
+ if (RunLoop::IsNestedOnCurrentThread())
return false;
while (incoming_task_queue_->deferred_tasks().HasTasks()) {
@@ -399,7 +407,7 @@ void MessageLoop::RunTask(PendingTask* pending_task) {
bool MessageLoop::DeferOrRunPendingTask(PendingTask pending_task) {
if (pending_task.nestable == Nestable::kNestable ||
- !run_loop_client_->IsNested()) {
+ !RunLoop::IsNestedOnCurrentThread()) {
RunTask(&pending_task);
// Show that we ran a task (Note: a new one might arrive as a
// consequence!).
@@ -491,7 +499,7 @@ bool MessageLoop::DoIdleWork() {
if (ProcessNextDelayedNonNestableTask())
return true;
- if (run_loop_client_->ShouldQuitWhenIdle())
+ if (ShouldQuitWhenIdle())
pump_->Quit();
// When we return we will do a kernel wait for more tasks.