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

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

Issue 1044413002: Record async "task backtraces" (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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
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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 const Closure& task, 52 const Closure& task,
53 TimeDelta delay, 53 TimeDelta delay,
54 bool nestable) { 54 bool nestable) {
55 DLOG_IF(WARNING, 55 DLOG_IF(WARNING,
56 delay.InSeconds() > kTaskDelayWarningThresholdInSeconds) 56 delay.InSeconds() > kTaskDelayWarningThresholdInSeconds)
57 << "Requesting super-long task delay period of " << delay.InSeconds() 57 << "Requesting super-long task delay period of " << delay.InSeconds()
58 << " seconds from here: " << from_here.ToString(); 58 << " seconds from here: " << from_here.ToString();
59 59
60 AutoLock locked(incoming_queue_lock_); 60 AutoLock locked(incoming_queue_lock_);
61 PendingTask pending_task( 61 PendingTask pending_task(
62 from_here, task, CalculateDelayedRuntime(delay), nestable); 62 from_here, MessageLoop::current()->current_pending_task_, task,
63 CalculateDelayedRuntime(delay), nestable);
63 #if defined(OS_WIN) 64 #if defined(OS_WIN)
64 // We consider the task needs a high resolution timer if the delay is 65 // We consider the task needs a high resolution timer if the delay is
65 // more than 0 and less than 32ms. This caps the relative error to 66 // more than 0 and less than 32ms. This caps the relative error to
66 // less than 50% : a 33ms wait can wake at 48ms since the default 67 // less than 50% : a 33ms wait can wake at 48ms since the default
67 // resolution on Windows is between 10 and 15ms. 68 // resolution on Windows is between 10 and 15ms.
68 if (delay > TimeDelta() && 69 if (delay > TimeDelta() &&
69 delay.InMilliseconds() < (2 * Time::kMinLowResolutionThresholdMs)) { 70 delay.InMilliseconds() < (2 * Time::kMinLowResolutionThresholdMs)) {
70 ++high_res_task_count_; 71 ++high_res_task_count_;
71 pending_task.is_high_res = true; 72 pending_task.is_high_res = true;
72 } 73 }
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 // reload from the incoming queue before waiting again so we clear this flag 158 // reload from the incoming queue before waiting again so we clear this flag
158 // in ReloadWorkQueue(). 159 // in ReloadWorkQueue().
159 message_loop_scheduled_ = true; 160 message_loop_scheduled_ = true;
160 } 161 }
161 162
162 return true; 163 return true;
163 } 164 }
164 165
165 } // namespace internal 166 } // namespace internal
166 } // namespace base 167 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698