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

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: moar 00 like. Created 3 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
Index: base/pending_task.cc
diff --git a/base/pending_task.cc b/base/pending_task.cc
index cca9ebfbff3d43bc1c840ce9493e372864e9e0d1..defca0674782c608741de7899d7b4f1b5bdf571c 100644
--- a/base/pending_task.cc
+++ b/base/pending_task.cc
@@ -4,18 +4,14 @@
#include "base/pending_task.h"
+#include "base/message_loop/message_loop.h"
#include "base/tracked_objects.h"
namespace base {
PendingTask::PendingTask(const tracked_objects::Location& posted_from,
OnceClosure task)
- : base::TrackingInfo(posted_from, TimeTicks()),
- task(std::move(task)),
- posted_from(posted_from),
- sequence_num(0),
- nestable(true),
- is_high_res(false) {}
+ : PendingTask(posted_from, std::move(task), TimeTicks(), true) {}
PendingTask::PendingTask(const tracked_objects::Location& posted_from,
OnceClosure task,
@@ -26,7 +22,16 @@ PendingTask::PendingTask(const tracked_objects::Location& posted_from,
posted_from(posted_from),
sequence_num(0),
nestable(nestable),
- is_high_res(false) {}
+ is_high_res(false) {
+ const PendingTask* parent_task =
+ MessageLoop::current() ? MessageLoop::current()->current_pending_task_
+ : NULL;
+ task_backtrace[0] = posted_from.program_counter();
+ if (parent_task) {
+ memcpy(&task_backtrace[1], &parent_task->task_backtrace[0],
+ sizeof(task_backtrace[0]) * (arraysize(task_backtrace) - 1));
+ }
+}
PendingTask::PendingTask(PendingTask&& other) = default;

Powered by Google App Engine
This is Rietveld 408576698