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

Unified Diff: base/message_loop/message_loop.cc

Issue 873393004: [Windows] Fix for Browser IO MessageLoop spinning the CPU. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move constant out of platform-specific region of file. 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_pump_win.cc » ('j') | base/message_loop/message_pump_win.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/message_loop/message_loop.cc
diff --git a/base/message_loop/message_loop.cc b/base/message_loop/message_loop.cc
index 818073367bdf2698a233a9aa46a79b878d3fbe7b..67ddbfa6c8c73a11d6188481d4f362c02207390b 100644
--- a/base/message_loop/message_loop.cc
+++ b/base/message_loop/message_loop.cc
@@ -5,6 +5,7 @@
#include "base/message_loop/message_loop.h"
#include <algorithm>
+#include <limits>
#include "base/bind.h"
#include "base/compiler_specific.h"
@@ -43,6 +44,12 @@ namespace {
LazyInstance<base::ThreadLocalPointer<MessageLoop> >::Leaky lazy_tls_ptr =
LAZY_INSTANCE_INITIALIZER;
+// Delays larger than this many microseconds are likely 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;
+
// Logical events for Histogram profiling. Run with -message-loop-histogrammer
// to get an accounting of messages and actions taken on each thread.
const int kTaskRunEvent = 0x1;
@@ -275,6 +282,10 @@ void MessageLoop::PostDelayedTask(
const Closure& task,
TimeDelta delay) {
DCHECK(!task.is_null()) << from_here.ToString();
+ DLOG_IF(WARNING,
+ delay.InMicroseconds() > kTaskDelayWarningThresholdInMicroseconds)
+ << "Requesting super-long task delay period of " << delay.InMicroseconds()
+ << " usec from " << from_here.ToString();
incoming_task_queue_->AddToIncomingQueue(from_here, task, delay, true);
}
@@ -290,6 +301,10 @@ void MessageLoop::PostNonNestableDelayedTask(
const Closure& task,
TimeDelta delay) {
DCHECK(!task.is_null()) << from_here.ToString();
+ DLOG_IF(WARNING,
+ delay.InMicroseconds() > kTaskDelayWarningThresholdInMicroseconds)
+ << "Requesting super-long task delay period of " << delay.InMicroseconds()
+ << " usec from " << from_here.ToString();
incoming_task_queue_->AddToIncomingQueue(from_here, task, delay, false);
darin (slow to review) 2015/01/27 07:52:39 would it be better to move this DLOG_IF to the imp
}
« no previous file with comments | « no previous file | base/message_loop/message_pump_win.cc » ('j') | base/message_loop/message_pump_win.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698