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

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

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
Index: mojo/public/cpp/system/watcher.h
diff --git a/mojo/public/cpp/system/watcher.h b/mojo/public/cpp/system/watcher.h
index 815b73b3b50b1d7dc71bbb465587862a2aeb2301..7901f7d5427df31dda7c82ee6bf876fefddc72e7 100644
--- a/mojo/public/cpp/system/watcher.h
+++ b/mojo/public/cpp/system/watcher.h
@@ -36,8 +36,9 @@ class MOJO_CPP_SYSTEM_EXPORT Watcher {
// been cancelled implicitly.
using ReadyCallback = base::Callback<void(MojoResult result)>;
- explicit Watcher(scoped_refptr<base::SingleThreadTaskRunner> runner =
- base::ThreadTaskRunnerHandle::Get());
+ Watcher(const tracked_objects::Location& from_here,
+ scoped_refptr<base::SingleThreadTaskRunner> runner =
+ base::ThreadTaskRunnerHandle::Get());
// NOTE: This destructor automatically calls |Cancel()| if the Watcher is
// still active.
@@ -74,6 +75,10 @@ class MOJO_CPP_SYSTEM_EXPORT Watcher {
Handle handle() const { return handle_; }
ReadyCallback ready_callback() const { return callback_; }
+ void set_heap_profiler_tag(const std::string& heap_profiler_tag) {
+ heap_profiler_tag_ = heap_profiler_tag;
+ }
+
private:
void OnHandleReady(MojoResult result);
@@ -104,6 +109,9 @@ class MOJO_CPP_SYSTEM_EXPORT Watcher {
// The callback to call when the handle is signaled.
ReadyCallback callback_;
+ // Tag used to ID memory allocation triggered by this watcher.
+ std::string heap_profiler_tag_;
+
base::WeakPtrFactory<Watcher> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(Watcher);

Powered by Google App Engine
This is Rietveld 408576698