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

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: Rebase and fix tests. 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
« no previous file with comments | « chrome/browser/chrome_notification_types.h ('k') | chrome/browser/process_resource_usage.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..bf38c813be270bbe985eea0004beecc4292d7fa7 100644
--- a/chrome/browser/process_resource_usage.h
+++ b/chrome/browser/process_resource_usage.h
@@ -5,7 +5,11 @@
#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/memory/scoped_ptr.h"
#include "base/threading/thread_checker.h"
#include "chrome/common/resource_usage_reporter.mojom.h"
@@ -34,8 +38,9 @@ class ProcessResourceUsage {
explicit ProcessResourceUsage(ResourceUsageReporterPtr service);
~ProcessResourceUsage();
- // 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;
@@ -43,14 +48,20 @@ class ProcessResourceUsage {
size_t GetV8MemoryUsed() const;
private:
+ class ErrorHandler;
+
// Mojo IPC callback.
void OnRefreshDone(ResourceUsageDataPtr data);
+ void RunPendingRefreshCallbacks();
+
ResourceUsageReporterPtr service_;
bool update_in_progress_;
+ std::deque<base::Closure> refresh_callbacks_;
ResourceUsageDataPtr stats_;
+ scoped_ptr<ErrorHandler> error_handler_;
base::ThreadChecker thread_checker_;
DISALLOW_COPY_AND_ASSIGN(ProcessResourceUsage);
« no previous file with comments | « chrome/browser/chrome_notification_types.h ('k') | chrome/browser/process_resource_usage.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698