OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/task_manager/renderer_resource.h" | 5 #include "chrome/browser/task_manager/renderer_resource.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "chrome/browser/devtools/devtools_window.h" | 9 #include "chrome/browser/devtools/devtools_window.h" |
10 #include "chrome/browser/process_resource_usage.h" | 10 #include "chrome/browser/process_resource_usage.h" |
11 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
12 #include "chrome/browser/task_manager/resource_provider.h" | 12 #include "chrome/browser/task_manager/resource_provider.h" |
13 #include "chrome/browser/task_manager/task_manager_util.h" | 13 #include "chrome/browser/task_manager/task_manager_util.h" |
14 #include "content/public/browser/render_process_host.h" | 14 #include "content/public/browser/render_process_host.h" |
15 #include "content/public/browser/render_view_host.h" | 15 #include "content/public/browser/render_view_host.h" |
16 #include "content/public/common/service_registry.h" | 16 #include "services/shell/public/cpp/interface_provider.h" |
17 | 17 |
18 namespace task_manager { | 18 namespace task_manager { |
19 | 19 |
20 RendererResource::RendererResource(base::ProcessHandle process, | 20 RendererResource::RendererResource(base::ProcessHandle process, |
21 content::RenderViewHost* render_view_host) | 21 content::RenderViewHost* render_view_host) |
22 : process_(process), render_view_host_(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 | 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. | 24 // process reference becomes NULL and the TaskManager still needs it. |
25 unique_process_id_ = render_view_host_->GetProcess()->GetID(); | 25 unique_process_id_ = render_view_host_->GetProcess()->GetID(); |
26 mojom::ResourceUsageReporterPtr service; | 26 mojom::ResourceUsageReporterPtr service; |
27 content::ServiceRegistry* service_registry = | 27 render_view_host_->GetProcess()->GetRemoteInterfaces()->GetInterface( |
28 render_view_host_->GetProcess()->GetServiceRegistry(); | 28 &service); |
29 if (service_registry) | |
30 service_registry->ConnectToRemoteService(mojo::GetProxy(&service)); | |
31 process_resource_usage_.reset(new ProcessResourceUsage(std::move(service))); | 29 process_resource_usage_.reset(new ProcessResourceUsage(std::move(service))); |
32 } | 30 } |
33 | 31 |
34 RendererResource::~RendererResource() { | 32 RendererResource::~RendererResource() { |
35 } | 33 } |
36 | 34 |
37 void RendererResource::Refresh() { | 35 void RendererResource::Refresh() { |
38 process_resource_usage_->Refresh(base::Closure()); | 36 process_resource_usage_->Refresh(base::Closure()); |
39 } | 37 } |
40 | 38 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 | 76 |
79 bool RendererResource::ReportsV8MemoryStats() const { | 77 bool RendererResource::ReportsV8MemoryStats() const { |
80 return true; | 78 return true; |
81 } | 79 } |
82 | 80 |
83 bool RendererResource::SupportNetworkUsage() const { | 81 bool RendererResource::SupportNetworkUsage() const { |
84 return true; | 82 return true; |
85 } | 83 } |
86 | 84 |
87 } // namespace task_manager | 85 } // namespace task_manager |
OLD | NEW |