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

Unified Diff: chrome/utility/chrome_content_utility_client.cc

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: Add comment. 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/utility/BUILD.gn ('k') | content/browser/browser_child_process_host_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/utility/chrome_content_utility_client.cc
diff --git a/chrome/utility/chrome_content_utility_client.cc b/chrome/utility/chrome_content_utility_client.cc
index a9c67a133c7e1a4f4dec099deca72bc820651e0b..ba8b9f9f4dea5027637809729f56306afe9e9bdf 100644
--- a/chrome/utility/chrome_content_utility_client.cc
+++ b/chrome/utility/chrome_content_utility_client.cc
@@ -31,8 +31,11 @@
#endif
#if !defined(OS_ANDROID)
+#include "chrome/common/resource_usage_reporter.mojom.h"
#include "chrome/utility/profile_import_handler.h"
#include "net/proxy/mojo_proxy_resolver_factory_impl.h"
+#include "net/proxy/proxy_resolver_v8.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/strong_binding.h"
#endif
#if defined(OS_ANDROID) && defined(USE_SECCOMP_BPF)
@@ -90,6 +93,34 @@ void CreateProxyResolverFactory(
// will be destroyed.
new net::MojoProxyResolverFactoryImpl(request.Pass());
}
+
+class ResourceUsageReporterImpl : public ResourceUsageReporter {
+ public:
+ explicit ResourceUsageReporterImpl(
+ mojo::InterfaceRequest<ResourceUsageReporter> req)
+ : binding_(this, req.Pass()) {}
+ ~ResourceUsageReporterImpl() override {}
+
+ private:
+ void GetUsageData(
+ const mojo::Callback<void(ResourceUsageDataPtr)>& callback) override {
+ ResourceUsageDataPtr data = ResourceUsageData::New();
+ size_t total_heap_size = net::ProxyResolverV8::GetTotalHeapSize();
+ if (total_heap_size) {
+ data->reports_v8_stats = true;
+ data->v8_bytes_allocated = total_heap_size;
+ data->v8_bytes_used = net::ProxyResolverV8::GetUsedHeapSize();
+ }
+ callback.Run(data.Pass());
+ }
+
+ mojo::StrongBinding<ResourceUsageReporter> binding_;
+};
+
+void CreateResourceUsageReporter(
+ mojo::InterfaceRequest<ResourceUsageReporter> request) {
+ new ResourceUsageReporterImpl(request.Pass());
+}
#endif // OS_ANDROID
} // namespace
@@ -192,6 +223,8 @@ void ChromeContentUtilityClient::RegisterMojoServices(
#if !defined(OS_ANDROID)
registry->AddService<net::interfaces::ProxyResolverFactory>(
base::Bind(CreateProxyResolverFactory));
+ registry->AddService<ResourceUsageReporter>(
+ base::Bind(CreateResourceUsageReporter));
#endif
}
« no previous file with comments | « chrome/utility/BUILD.gn ('k') | content/browser/browser_child_process_host_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698