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

Unified Diff: mojo/public/cpp/system/watcher.cc

Issue 2623263005: Tag some of Mojo heap allocations for the heap profiler. (Closed)
Patch Set: Minor clean-up. 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
« mojo/public/cpp/bindings/connector.h ('K') | « mojo/public/cpp/system/watcher.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/cpp/system/watcher.cc
diff --git a/mojo/public/cpp/system/watcher.cc b/mojo/public/cpp/system/watcher.cc
index fc03c5a0a0e8b1f4e41c01b29705d743e051d34c..318470be51bfd9278b9f15e81f6c21d68eca129a 100644
--- a/mojo/public/cpp/system/watcher.cc
+++ b/mojo/public/cpp/system/watcher.cc
@@ -7,14 +7,17 @@
#include "base/bind.h"
#include "base/location.h"
#include "base/macros.h"
+#include "base/trace_event/heap_profiler.h"
#include "mojo/public/c/system/functions.h"
namespace mojo {
-Watcher::Watcher(scoped_refptr<base::SingleThreadTaskRunner> runner)
+Watcher::Watcher(const tracked_objects::Location& from_here,
+ scoped_refptr<base::SingleThreadTaskRunner> runner)
: task_runner_(std::move(runner)),
is_default_task_runner_(task_runner_ ==
base::ThreadTaskRunnerHandle::Get()),
+ heap_profiler_tag_(from_here.ToString()),
ssid 2017/01/12 21:50:03 Can you please just use file_name() here instead o
Jay Civelli 2017/01/13 01:09:27 Done.
weak_factory_(this) {
DCHECK(task_runner_->BelongsToCurrentThread());
weak_self_ = weak_factory_.GetWeakPtr();
@@ -94,6 +97,10 @@ void Watcher::CallOnHandleReady(uintptr_t context,
// TODO: Maybe we should also expose |signals_state| through the Watcher API.
// Current HandleWatcher users have no need for it, so it's omitted here.
Watcher* watcher = reinterpret_cast<Watcher*>(context);
+
+ TRACE_HEAP_PROFILER_API_SCOPED_TASK_EXECUTION event(
+ watcher->heap_profiler_tag_.c_str());
+
if ((flags & MOJO_WATCH_NOTIFICATION_FLAG_FROM_SYSTEM) &&
watcher->task_runner_->RunsTasksOnCurrentThread() &&
watcher->is_default_task_runner_) {
« mojo/public/cpp/bindings/connector.h ('K') | « mojo/public/cpp/system/watcher.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698