Index: content/public/browser/process_resource_usage.h |
diff --git a/content/public/browser/process_resource_usage.h b/content/public/browser/process_resource_usage.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..81c097375175f4a71e9a58abce7605e874fd9054 |
--- /dev/null |
+++ b/content/public/browser/process_resource_usage.h |
@@ -0,0 +1,53 @@ |
+// 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 CONTENT_PUBLIC_BROWSER_PROCESS_RESOURCE_USAGE_H_ |
+#define CONTENT_PUBLIC_BROWSER_PROCESS_RESOURCE_USAGE_H_ |
+ |
+#include "base/memory/scoped_ptr.h" |
+#include "content/common/content_export.h" |
+#include "content/public/common/resource_usage_reporter.mojom.h" |
+ |
+namespace content { |
+ |
+// Provides resource usage information about a child process. |
ncarter (slow)
2015/05/07 20:12:44
Thanks for adding these comments, they are great.
Anand Mistry (off Chromium)
2015/05/11 05:41:31
Acknowledged.
|
+// |
+// 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. |
+// |
+// 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 Create(). |
ncarter (slow)
2015/05/07 20:12:44
If you do change the way that the setup dance work
|
+// |
+// Note: ProcessResourceUsage is thread-hostile and must live on a single |
+// thread. |
+class CONTENT_EXPORT ProcessResourceUsage { |
+ public: |
+ virtual ~ProcessResourceUsage() {} |
+ |
+ // Creates a new resource usage reported that is connected to the given Mojo |
+ // service. |service| must be bound to the current thread. |
+ static scoped_ptr<ProcessResourceUsage> Create( |
+ ResourceUsageReporterPtr service); |
+ |
+ // Refresh the resource usage information. |
+ virtual void Refresh() = 0; |
+ |
+ // Get V8 memory usage information. |
+ virtual bool ReportsV8MemoryStats() const = 0; |
+ virtual size_t GetV8MemoryAllocated() const = 0; |
+ virtual size_t GetV8MemoryUsed() const = 0; |
+}; |
ncarter (slow)
2015/05/07 20:12:44
During my the first pass, I missed the pretty impo
Anand Mistry (off Chromium)
2015/05/11 05:41:31
I've thought about it and this doesn't belong in c
|
+ |
+} // namespace content |
+ |
+#endif // CONTENT_PUBLIC_BROWSER_PROCESS_RESOURCE_USAGE_H_ |