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

Unified Diff: chrome/browser/process_resource_usage.h

Issue 1081323003: Convert renderer JS memory usage reporting to use Mojo. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@utility-process-report-js-memory
Patch Set: Fix build files. 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
index ad295a6bf5528c37f95045821f9c0870a50706fe..46061e9fa1f03316e46f281fd8595a02969f8fd9 100644
--- a/chrome/browser/process_resource_usage.h
+++ b/chrome/browser/process_resource_usage.h
@@ -5,9 +5,13 @@
#ifndef CHROME_BROWSER_PROCESS_RESOURCE_USAGE_H_
#define CHROME_BROWSER_PROCESS_RESOURCE_USAGE_H_
+#include <deque>
+
#include "base/basictypes.h"
+#include "base/callback.h"
#include "base/threading/thread_checker.h"
#include "chrome/common/resource_usage_reporter.mojom.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/error_handler.h"
// Provides resource usage information about a child process.
//
@@ -28,14 +32,15 @@
//
// Note: ProcessResourceUsage is thread-hostile and must live on a single
// thread.
-class ProcessResourceUsage {
+class ProcessResourceUsage : public mojo::ErrorHandler {
public:
// Must be called from the same thread that created |service|.
explicit ProcessResourceUsage(ResourceUsageReporterPtr service);
- ~ProcessResourceUsage();
+ ~ProcessResourceUsage() override;
- // Refresh the resource usage information.
- void Refresh();
+ // Refresh the resource usage information. |callback| is invoked when the
+ // usage data is updated, or when the IPC connection is lost.
+ void Refresh(const base::Closure& callback);
// Get V8 memory usage information.
bool ReportsV8MemoryStats() const;
@@ -46,8 +51,14 @@ class ProcessResourceUsage {
// Mojo IPC callback.
void OnRefreshDone(ResourceUsageDataPtr data);
+ // mojo::ErrorHandler implementation:
+ void OnConnectionError() override;
ncarter (slow) 2015/05/14 06:28:12 Making this method private doesn't really hide it
Anand Mistry (off Chromium) 2015/05/14 07:30:41 Moved to a private helper class. I'd rather not go
+
+ void RunPendingRefreshCallbacks();
+
ResourceUsageReporterPtr service_;
bool update_in_progress_;
+ std::deque<base::Closure> refresh_callbacks_;
ResourceUsageDataPtr stats_;

Powered by Google App Engine
This is Rietveld 408576698