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

Unified Diff: base/message_loop/incoming_task_queue.cc

Issue 903273002: Update from https://crrev.com/315085 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/memory/scoped_open_process.h ('k') | base/message_loop/message_loop.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/message_loop/incoming_task_queue.cc
diff --git a/base/message_loop/incoming_task_queue.cc b/base/message_loop/incoming_task_queue.cc
index 9e5b013684f003211256d011741c0cab800b0ec5..c1ce939b0c4708ac431d80b54a35ee8ef73b314c 100644
--- a/base/message_loop/incoming_task_queue.cc
+++ b/base/message_loop/incoming_task_queue.cc
@@ -4,6 +4,8 @@
#include "base/message_loop/incoming_task_queue.h"
+#include <limits>
+
#include "base/location.h"
#include "base/message_loop/message_loop.h"
#include "base/metrics/histogram.h"
@@ -15,6 +17,13 @@ namespace internal {
namespace {
+#ifndef NDEBUG
+// Delays larger than this are often bogus, and a warning should be emitted in
+// debug builds to warn developers. http://crbug.com/450045
+const int kTaskDelayWarningThresholdInSeconds =
+ 14 * 24 * 60 * 60; // 14 days.
+#endif
+
// Returns true if MessagePump::ScheduleWork() must be called one
// time for every task that is added to the MessageLoop incoming queue.
bool AlwaysNotifyPump(MessageLoop::Type type) {
@@ -43,6 +52,11 @@ bool IncomingTaskQueue::AddToIncomingQueue(
const Closure& task,
TimeDelta delay,
bool nestable) {
+ DLOG_IF(WARNING,
+ delay.InSeconds() > kTaskDelayWarningThresholdInSeconds)
+ << "Requesting super-long task delay period of " << delay.InSeconds()
+ << " seconds from here: " << from_here.ToString();
+
AutoLock locked(incoming_queue_lock_);
PendingTask pending_task(
from_here, task, CalculateDelayedRuntime(delay), nestable);
« no previous file with comments | « base/memory/scoped_open_process.h ('k') | base/message_loop/message_loop.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698