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

Unified Diff: chrome/browser/task_manager/child_process_resource_provider.cc

Issue 862813002: WIP: Prototype OOP V8 PAC. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Slight cleanup and report JS memory usage. Created 5 years, 11 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/net/proxy_service_factory.cc ('k') | chrome/utility/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/task_manager/child_process_resource_provider.cc
diff --git a/chrome/browser/task_manager/child_process_resource_provider.cc b/chrome/browser/task_manager/child_process_resource_provider.cc
index d4714b35240ebf913439dbd3bff73c52ce9680c4..6016a5a3f9c779fefc94a073f7c908408bbd814a 100644
--- a/chrome/browser/task_manager/child_process_resource_provider.cc
+++ b/chrome/browser/task_manager/child_process_resource_provider.cc
@@ -15,6 +15,7 @@
#include "content/public/browser/browser_child_process_host_iterator.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/child_process_data.h"
+#include "content/public/browser/process_resource.h"
#include "grit/theme_resources.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/resource/resource_bundle.h"
@@ -22,6 +23,7 @@
using content::BrowserChildProcessHostIterator;
using content::BrowserThread;
+using content::ProcessResource;
using content::WebContents;
namespace task_manager {
@@ -31,7 +33,8 @@ class ChildProcessResource : public Resource {
ChildProcessResource(int process_type,
const base::string16& name,
base::ProcessHandle handle,
- int unique_process_id);
+ int unique_process_id,
+ const scoped_refptr<ProcessResource>& process_resource);
~ChildProcessResource() override;
// Resource methods:
@@ -43,6 +46,10 @@ class ChildProcessResource : public Resource {
Type GetType() const override;
bool SupportNetworkUsage() const override;
void SetSupportNetworkUsage() override;
+ void Refresh() override;
+ bool ReportsV8MemoryStats() const override;
+ size_t GetV8MemoryAllocated() const override;
+ size_t GetV8MemoryUsed() const override;
// Returns the pid of the child process.
int process_id() const { return pid_; }
@@ -59,6 +66,7 @@ class ChildProcessResource : public Resource {
int unique_process_id_;
mutable base::string16 title_;
bool network_usage_support_;
+ scoped_refptr<ProcessResource> process_resource_;
// The icon painted for the child processs.
// TODO(jcampan): we should have plugin specific icons for well-known
@@ -74,12 +82,14 @@ ChildProcessResource::ChildProcessResource(
int process_type,
const base::string16& name,
base::ProcessHandle handle,
- int unique_process_id)
+ int unique_process_id,
+ const scoped_refptr<ProcessResource>& process_resource)
: process_type_(process_type),
name_(name),
handle_(handle),
unique_process_id_(unique_process_id),
- network_usage_support_(false) {
+ network_usage_support_(false),
+ process_resource_(process_resource) {
// We cache the process id because it's not cheap to calculate, and it won't
// be available when we get the plugin disconnected notification.
pid_ = base::GetProcId(handle);
@@ -200,6 +210,29 @@ base::string16 ChildProcessResource::GetLocalizedTitle() const {
return title;
}
+void ChildProcessResource::Refresh() {
+ if (process_resource_)
+ process_resource_->Refresh();
+}
+
+bool ChildProcessResource::ReportsV8MemoryStats() const {
+ if (process_resource_)
+ return process_resource_->ReportsV8MemoryStats();
+ return false;
+}
+
+size_t ChildProcessResource::GetV8MemoryAllocated() const {
+ if (process_resource_)
+ return process_resource_->GetV8MemoryAllocated();
+ return 0;
+}
+
+size_t ChildProcessResource::GetV8MemoryUsed() const {
+ if (process_resource_)
+ return process_resource_->GetV8MemoryUsed();
+ return 0;
+}
+
////////////////////////////////////////////////////////////////////////////////
// ChildProcessResourceProvider class
////////////////////////////////////////////////////////////////////////////////
@@ -300,7 +333,8 @@ void ChildProcessResourceProvider::AddToTaskManager(
child_process_data.process_type,
child_process_data.name,
child_process_data.handle,
- child_process_data.id);
+ child_process_data.id,
+ child_process_data.process_resource);
resources_[child_process_data.handle] = resource;
pid_to_resources_[resource->process_id()] = resource;
task_manager_->AddResource(resource);
« no previous file with comments | « chrome/browser/net/proxy_service_factory.cc ('k') | chrome/utility/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698