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

Unified Diff: base/pending_task.cc

Issue 1044413002: Record async "task backtraces" (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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
Index: base/pending_task.cc
diff --git a/base/pending_task.cc b/base/pending_task.cc
index 3d7891414c8dc7df431f0c4d8a6bf8dcb26eb9a5..e08b781d0fee4f8b060e193fb5c2074520a965f6 100644
--- a/base/pending_task.cc
+++ b/base/pending_task.cc
@@ -9,6 +9,7 @@
namespace base {
PendingTask::PendingTask(const tracked_objects::Location& posted_from,
+ const PendingTask* parent_task,
const base::Closure& task)
: base::TrackingInfo(posted_from, TimeTicks()),
task(task),
@@ -16,9 +17,15 @@ PendingTask::PendingTask(const tracked_objects::Location& posted_from,
sequence_num(0),
nestable(true),
is_high_res(false) {
+ task_backtrace[0] = posted_from.program_counter();
+ if (parent_task) {
+ memcpy(&task_backtrace[1], &parent_task->task_backtrace[0],
+ sizeof(task_backtrace[0]) * ARRAYSIZE_UNSAFE(task_backtrace) - 1);
+ }
}
PendingTask::PendingTask(const tracked_objects::Location& posted_from,
+ const PendingTask* parent_task,
const base::Closure& task,
TimeTicks delayed_run_time,
bool nestable)
@@ -28,6 +35,11 @@ PendingTask::PendingTask(const tracked_objects::Location& posted_from,
sequence_num(0),
nestable(nestable),
is_high_res(false) {
+ task_backtrace[0] = posted_from.program_counter();
+ if (parent_task) {
+ memcpy(&task_backtrace[1], &parent_task->task_backtrace[0],
+ sizeof(task_backtrace[0]) * ARRAYSIZE_UNSAFE(task_backtrace) - 1);
+ }
}
PendingTask::~PendingTask() {

Powered by Google App Engine
This is Rietveld 408576698