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

Unified Diff: base/message_loop/incoming_task_queue.cc

Issue 878033005: Move 'super-long post delayed task' warning to IncomingTaskQueue. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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 | « no previous file | 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..07de4a155df1726d47b1041ca7dd621d86190297 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,12 @@ namespace internal {
namespace {
+// Delays larger than this many microseconds are often bogus, and a warning
+// should be emitted in debug builds to warn developers.
+// http://crbug.com/450045
+const int kTaskDelayWarningThresholdInMicroseconds =
+ std::numeric_limits<int>::max() / 2; // A little less than 18 minutes.
+
// 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 +51,11 @@ bool IncomingTaskQueue::AddToIncomingQueue(
const Closure& task,
TimeDelta delay,
bool nestable) {
+ DLOG_IF(WARNING,
+ delay.InMicroseconds() > kTaskDelayWarningThresholdInMicroseconds)
+ << "Requesting super-long task delay period of " << delay.InMicroseconds()
+ << " usec from here: " << from_here.ToString();
+
AutoLock locked(incoming_queue_lock_);
PendingTask pending_task(
from_here, task, CalculateDelayedRuntime(delay), nestable);
« no previous file with comments | « no previous file | base/message_loop/message_loop.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698