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

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: 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/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 111ac99c49b6405840988b078b17fbc79d933e3f..30ff951ca46a0156e5934c7208ae24009e4688f7 100644
--- a/chrome/utility/chrome_content_utility_client.cc
+++ b/chrome/utility/chrome_content_utility_client.cc
@@ -28,8 +28,11 @@
#include "ui/gfx/geometry/size.h"
#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)
@@ -87,6 +90,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();
jam 2015/05/12 16:12:23 so this looks like a general purpose interface to
Anand Mistry (off Chromium) 2015/05/13 00:42:11 Yes.
jam 2015/05/15 06:54:22 hmm, then perhaps this method should be called Get
Anand Mistry (off Chromium) 2015/05/15 07:25:41 Except that https://codereview.chromium.org/108132
Anand Mistry (off Chromium) 2015/05/19 04:30:50 I asked the V8 folks about this and the response i
jam 2015/05/19 16:11:46 I see, ok thanks for checking. I don't want to blo
jam 2015/05/19 16:11:46 My comment is about net::ProxyResolverV8::GetTotal
+ if (total_heap_size) {
+ data->reports_v8_stats = true;
+ data->v8_memory_allocated = total_heap_size;
+ data->v8_memory_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
@@ -187,6 +218,8 @@ void ChromeContentUtilityClient::RegisterMojoServices(
#if !defined(OS_ANDROID)
registry->AddService<net::interfaces::ProxyResolverFactory>(
base::Bind(CreateProxyResolverFactory));
+ registry->AddService<ResourceUsageReporter>(
+ base::Bind(CreateResourceUsageReporter));
#endif
}

Powered by Google App Engine
This is Rietveld 408576698