OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_management/providers/web_contents/renderer_task.h" | 5 #include "chrome/browser/task_management/providers/web_contents/renderer_task.h" |
6 | 6 |
| 7 #include <utility> |
| 8 |
7 #include "base/i18n/rtl.h" | 9 #include "base/i18n/rtl.h" |
8 #include "base/numerics/safe_conversions.h" | 10 #include "base/numerics/safe_conversions.h" |
9 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
10 #include "chrome/browser/browser_process.h" | 12 #include "chrome/browser/browser_process.h" |
11 #include "chrome/browser/favicon/favicon_utils.h" | 13 #include "chrome/browser/favicon/favicon_utils.h" |
12 #include "chrome/browser/process_resource_usage.h" | 14 #include "chrome/browser/process_resource_usage.h" |
13 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
14 #include "chrome/browser/task_management/task_manager_observer.h" | 16 #include "chrome/browser/task_management/task_manager_observer.h" |
15 #include "chrome/grit/generated_resources.h" | 17 #include "chrome/grit/generated_resources.h" |
16 #include "content/public/browser/render_process_host.h" | 18 #include "content/public/browser/render_process_host.h" |
17 #include "content/public/browser/web_contents.h" | 19 #include "content/public/browser/web_contents.h" |
18 #include "content/public/browser/web_contents_delegate.h" | 20 #include "content/public/browser/web_contents_delegate.h" |
19 #include "content/public/common/service_registry.h" | 21 #include "content/public/common/service_registry.h" |
20 #include "ui/base/l10n/l10n_util.h" | 22 #include "ui/base/l10n/l10n_util.h" |
21 | 23 |
22 namespace task_management { | 24 namespace task_management { |
23 | 25 |
24 namespace { | 26 namespace { |
25 | 27 |
26 // Creates the Mojo service wrapper that will be used to sample the V8 memory | 28 // Creates the Mojo service wrapper that will be used to sample the V8 memory |
27 // usage and the the WebCache resource stats of the render process hosted by | 29 // usage and the the WebCache resource stats of the render process hosted by |
28 // |render_process_host|. | 30 // |render_process_host|. |
29 ProcessResourceUsage* CreateRendererResourcesSampler( | 31 ProcessResourceUsage* CreateRendererResourcesSampler( |
30 content::RenderProcessHost* render_process_host) { | 32 content::RenderProcessHost* render_process_host) { |
31 ResourceUsageReporterPtr service; | 33 ResourceUsageReporterPtr service; |
32 content::ServiceRegistry* service_registry = | 34 content::ServiceRegistry* service_registry = |
33 render_process_host->GetServiceRegistry(); | 35 render_process_host->GetServiceRegistry(); |
34 if (service_registry) | 36 if (service_registry) |
35 service_registry->ConnectToRemoteService(mojo::GetProxy(&service)); | 37 service_registry->ConnectToRemoteService(mojo::GetProxy(&service)); |
36 return new ProcessResourceUsage(service.Pass()); | 38 return new ProcessResourceUsage(std::move(service)); |
37 } | 39 } |
38 | 40 |
39 // Gets the profile name associated with the browser context of the given | 41 // Gets the profile name associated with the browser context of the given |
40 // |render_process_host| from the profile info cache. | 42 // |render_process_host| from the profile info cache. |
41 base::string16 GetRendererProfileName( | 43 base::string16 GetRendererProfileName( |
42 const content::RenderProcessHost* render_process_host) { | 44 const content::RenderProcessHost* render_process_host) { |
43 Profile* profile = | 45 Profile* profile = |
44 Profile::FromBrowserContext(render_process_host->GetBrowserContext()); | 46 Profile::FromBrowserContext(render_process_host->GetBrowserContext()); |
45 return Task::GetProfileNameFromProfile(profile); | 47 return Task::GetProfileNameFromProfile(profile); |
46 } | 48 } |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 if (is_incognito) | 222 if (is_incognito) |
221 message_id = IDS_TASK_MANAGER_EXTENSION_INCOGNITO_PREFIX; | 223 message_id = IDS_TASK_MANAGER_EXTENSION_INCOGNITO_PREFIX; |
222 else | 224 else |
223 message_id = IDS_TASK_MANAGER_EXTENSION_PREFIX; | 225 message_id = IDS_TASK_MANAGER_EXTENSION_PREFIX; |
224 } | 226 } |
225 | 227 |
226 return l10n_util::GetStringFUTF16(message_id, title); | 228 return l10n_util::GetStringFUTF16(message_id, title); |
227 } | 229 } |
228 | 230 |
229 } // namespace task_management | 231 } // namespace task_management |
OLD | NEW |