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> |
| 8 |
7 #include "chrome/browser/devtools/devtools_window.h" | 9 #include "chrome/browser/devtools/devtools_window.h" |
8 #include "chrome/browser/process_resource_usage.h" | 10 #include "chrome/browser/process_resource_usage.h" |
9 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
10 #include "chrome/browser/task_manager/resource_provider.h" | 12 #include "chrome/browser/task_manager/resource_provider.h" |
11 #include "chrome/browser/task_manager/task_manager_util.h" | 13 #include "chrome/browser/task_manager/task_manager_util.h" |
12 #include "content/public/browser/render_process_host.h" | 14 #include "content/public/browser/render_process_host.h" |
13 #include "content/public/browser/render_view_host.h" | 15 #include "content/public/browser/render_view_host.h" |
14 #include "content/public/common/service_registry.h" | 16 #include "content/public/common/service_registry.h" |
15 | 17 |
16 namespace task_manager { | 18 namespace task_manager { |
17 | 19 |
18 RendererResource::RendererResource(base::ProcessHandle process, | 20 RendererResource::RendererResource(base::ProcessHandle process, |
19 content::RenderViewHost* render_view_host) | 21 content::RenderViewHost* render_view_host) |
20 : process_(process), render_view_host_(render_view_host) { | 22 : process_(process), render_view_host_(render_view_host) { |
21 // 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 |
22 // process reference becomes NULL and the TaskManager still needs it. | 24 // process reference becomes NULL and the TaskManager still needs it. |
23 unique_process_id_ = render_view_host_->GetProcess()->GetID(); | 25 unique_process_id_ = render_view_host_->GetProcess()->GetID(); |
24 ResourceUsageReporterPtr service; | 26 ResourceUsageReporterPtr service; |
25 content::ServiceRegistry* service_registry = | 27 content::ServiceRegistry* service_registry = |
26 render_view_host_->GetProcess()->GetServiceRegistry(); | 28 render_view_host_->GetProcess()->GetServiceRegistry(); |
27 if (service_registry) | 29 if (service_registry) |
28 service_registry->ConnectToRemoteService(mojo::GetProxy(&service)); | 30 service_registry->ConnectToRemoteService(mojo::GetProxy(&service)); |
29 process_resource_usage_.reset(new ProcessResourceUsage(service.Pass())); | 31 process_resource_usage_.reset(new ProcessResourceUsage(std::move(service))); |
30 } | 32 } |
31 | 33 |
32 RendererResource::~RendererResource() { | 34 RendererResource::~RendererResource() { |
33 } | 35 } |
34 | 36 |
35 void RendererResource::Refresh() { | 37 void RendererResource::Refresh() { |
36 process_resource_usage_->Refresh(base::Closure()); | 38 process_resource_usage_->Refresh(base::Closure()); |
37 } | 39 } |
38 | 40 |
39 blink::WebCache::ResourceTypeStats | 41 blink::WebCache::ResourceTypeStats |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 | 78 |
77 bool RendererResource::ReportsV8MemoryStats() const { | 79 bool RendererResource::ReportsV8MemoryStats() const { |
78 return true; | 80 return true; |
79 } | 81 } |
80 | 82 |
81 bool RendererResource::SupportNetworkUsage() const { | 83 bool RendererResource::SupportNetworkUsage() const { |
82 return true; | 84 return true; |
83 } | 85 } |
84 | 86 |
85 } // namespace task_manager | 87 } // namespace task_manager |
OLD | NEW |