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

Unified Diff: chrome/browser/process_resource_usage.h

Issue 972083002: Report utility process JS memory in task manager. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@v8-pac-oop
Patch Set: Try to fix build... again. Created 5 years, 7 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: chrome/browser/process_resource_usage.h
diff --git a/chrome/browser/process_resource_usage.h b/chrome/browser/process_resource_usage.h
new file mode 100644
index 0000000000000000000000000000000000000000..ad295a6bf5528c37f95045821f9c0870a50706fe
--- /dev/null
+++ b/chrome/browser/process_resource_usage.h
@@ -0,0 +1,59 @@
+// Copyright 2015 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.
+
+#ifndef CHROME_BROWSER_PROCESS_RESOURCE_USAGE_H_
+#define CHROME_BROWSER_PROCESS_RESOURCE_USAGE_H_
+
+#include "base/basictypes.h"
+#include "base/threading/thread_checker.h"
+#include "chrome/common/resource_usage_reporter.mojom.h"
+
+// Provides resource usage information about a child process.
+//
+// This is a wrapper around the ResourceUsageReporter Mojo service that exposes
+// information about resources used by a child process. Currently, this is only
+// V8 memory usage, but could be expanded to include other resources such as web
+// cache. This is intended for status viewers such as the task manager and
+// about://memory-internals.
jam 2015/05/12 16:12:23 is someone tasked to make about:memory-internals t
Anand Mistry (off Chromium) 2015/05/13 00:42:11 Yes, me. I have another CL in progress that switch
+//
+// To create:
+// 1. Obtain a ResourceUsageReporter connection using the child process's
+// service registry. i.e:
+// ResourceUsageReporterPtr service;
+// process->GetServiceRegistry()->ConnectToRemoteService(&service);
+// 2. If needed, the connection can be passed to another thread using
+// ResourceUsageReporterPtr::PassInterface().
+// 3. Pass the service to the constructor.
+//
+// Note: ProcessResourceUsage is thread-hostile and must live on a single
+// thread.
+class ProcessResourceUsage {
+ public:
+ // Must be called from the same thread that created |service|.
+ explicit ProcessResourceUsage(ResourceUsageReporterPtr service);
+ ~ProcessResourceUsage();
+
+ // Refresh the resource usage information.
+ void Refresh();
+
+ // Get V8 memory usage information.
+ bool ReportsV8MemoryStats() const;
+ size_t GetV8MemoryAllocated() const;
+ size_t GetV8MemoryUsed() const;
+
+ private:
+ // Mojo IPC callback.
+ void OnRefreshDone(ResourceUsageDataPtr data);
+
+ ResourceUsageReporterPtr service_;
+ bool update_in_progress_;
+
+ ResourceUsageDataPtr stats_;
+
+ base::ThreadChecker thread_checker_;
+
+ DISALLOW_COPY_AND_ASSIGN(ProcessResourceUsage);
+};
+
+#endif // CHROME_BROWSER_PROCESS_RESOURCE_USAGE_H_
« no previous file with comments | « no previous file | chrome/browser/process_resource_usage.cc » ('j') | chrome/browser/task_manager/task_manager_browsertest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698