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

Unified Diff: base/debug/task_annotator.cc

Issue 1647803004: Move base to DEPS (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 4 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 | « base/debug/task_annotator.h ('k') | base/debug/task_annotator_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/debug/task_annotator.cc
diff --git a/base/debug/task_annotator.cc b/base/debug/task_annotator.cc
deleted file mode 100644
index b74d390938d75867af4f52d379774ae6fe265667..0000000000000000000000000000000000000000
--- a/base/debug/task_annotator.cc
+++ /dev/null
@@ -1,62 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "base/debug/task_annotator.h"
-
-#include "base/debug/alias.h"
-#include "base/pending_task.h"
-#include "base/trace_event/trace_event.h"
-#include "base/tracked_objects.h"
-
-namespace base {
-namespace debug {
-
-TaskAnnotator::TaskAnnotator() {
-}
-
-TaskAnnotator::~TaskAnnotator() {
-}
-
-void TaskAnnotator::DidQueueTask(const char* queue_function,
- const PendingTask& pending_task) {
- TRACE_EVENT_FLOW_BEGIN0(TRACE_DISABLED_BY_DEFAULT("toplevel.flow"),
- queue_function,
- TRACE_ID_MANGLE(GetTaskTraceID(pending_task)));
-}
-
-void TaskAnnotator::RunTask(const char* queue_function,
- const PendingTask& pending_task) {
- tracked_objects::TaskStopwatch stopwatch;
- stopwatch.Start();
- tracked_objects::Duration queue_duration =
- stopwatch.StartTime() - pending_task.EffectiveTimePosted();
-
- TRACE_EVENT_FLOW_END1(TRACE_DISABLED_BY_DEFAULT("toplevel.flow"),
- queue_function,
- TRACE_ID_MANGLE(GetTaskTraceID(pending_task)),
- "queue_duration",
- queue_duration.InMilliseconds());
-
- // Before running the task, store the program counter where it was posted
- // and deliberately alias it to ensure it is on the stack if the task
- // crashes. Be careful not to assume that the variable itself will have the
- // expected value when displayed by the optimizer in an optimized build.
- // Look at a memory dump of the stack.
- const void* program_counter = pending_task.posted_from.program_counter();
- debug::Alias(&program_counter);
-
- pending_task.task.Run();
-
- stopwatch.Stop();
- tracked_objects::ThreadData::TallyRunOnNamedThreadIfTracking(
- pending_task, stopwatch);
-}
-
-uint64 TaskAnnotator::GetTaskTraceID(const PendingTask& task) const {
- return (static_cast<uint64>(task.sequence_num) << 32) |
- ((static_cast<uint64>(reinterpret_cast<intptr_t>(this)) << 32) >> 32);
-}
-
-} // namespace debug
-} // namespace base
« no previous file with comments | « base/debug/task_annotator.h ('k') | base/debug/task_annotator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698