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

Side by Side Diff: chrome/browser/task_manager/renderer_resource.cc

Issue 2197483003: Move the Mac Task Manager to the new backend code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: mark Created 4 years, 4 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/task_manager/renderer_resource.h"
6
7 #include <utility>
8
9 #include "chrome/browser/devtools/devtools_window.h"
10 #include "chrome/browser/process_resource_usage.h"
11 #include "chrome/browser/profiles/profile.h"
12 #include "chrome/browser/task_manager/resource_provider.h"
13 #include "chrome/browser/task_manager/task_manager_util.h"
14 #include "content/public/browser/render_process_host.h"
15 #include "content/public/browser/render_view_host.h"
16 #include "services/shell/public/cpp/interface_provider.h"
17
18 namespace task_manager {
19
20 RendererResource::RendererResource(base::ProcessHandle process,
21 content::RenderViewHost* render_view_host)
22 : process_(process), render_view_host_(render_view_host) {
23 // We cache the process and pid as when a Tab/BackgroundContents is closed the
24 // process reference becomes NULL and the TaskManager still needs it.
25 unique_process_id_ = render_view_host_->GetProcess()->GetID();
26 mojom::ResourceUsageReporterPtr service;
27 render_view_host_->GetProcess()->GetRemoteInterfaces()->GetInterface(
28 &service);
29 process_resource_usage_.reset(new ProcessResourceUsage(std::move(service)));
30 }
31
32 RendererResource::~RendererResource() {
33 }
34
35 void RendererResource::Refresh() {
36 process_resource_usage_->Refresh(base::Closure());
37 }
38
39 blink::WebCache::ResourceTypeStats
40 RendererResource::GetWebCoreCacheStats() const {
41 return process_resource_usage_->GetWebCoreCacheStats();
42 }
43
44 size_t RendererResource::GetV8MemoryAllocated() const {
45 return process_resource_usage_->GetV8MemoryAllocated();
46 }
47
48 size_t RendererResource::GetV8MemoryUsed() const {
49 return process_resource_usage_->GetV8MemoryUsed();
50 }
51
52 base::string16 RendererResource::GetProfileName() const {
53 return util::GetProfileNameFromAttributesStorage(Profile::FromBrowserContext(
54 render_view_host_->GetProcess()->GetBrowserContext()));
55 }
56
57 base::ProcessHandle RendererResource::GetProcess() const {
58 return process_;
59 }
60
61 int RendererResource::GetUniqueChildProcessId() const {
62 return unique_process_id_;
63 }
64
65 Resource::Type RendererResource::GetType() const {
66 return RENDERER;
67 }
68
69 int RendererResource::GetRoutingID() const {
70 return render_view_host_->GetRoutingID();
71 }
72
73 bool RendererResource::ReportsCacheStats() const {
74 return true;
75 }
76
77 bool RendererResource::ReportsV8MemoryStats() const {
78 return true;
79 }
80
81 bool RendererResource::SupportNetworkUsage() const {
82 return true;
83 }
84
85 } // namespace task_manager
OLDNEW
« no previous file with comments | « chrome/browser/task_manager/renderer_resource.h ('k') | chrome/browser/task_manager/resource_provider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698