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

Side by Side Diff: chrome/browser/task_management/providers/web_contents/renderer_task.cc

Issue 2096643002: Eliminate MojoApplicationHost (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mah3
Patch Set: . Created 4 years, 6 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
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> 7 #include <utility>
8 8
9 #include "base/i18n/rtl.h" 9 #include "base/i18n/rtl.h"
10 #include "base/numerics/safe_conversions.h" 10 #include "base/numerics/safe_conversions.h"
11 #include "base/strings/utf_string_conversions.h" 11 #include "base/strings/utf_string_conversions.h"
12 #include "chrome/browser/browser_process.h" 12 #include "chrome/browser/browser_process.h"
13 #include "chrome/browser/favicon/favicon_utils.h" 13 #include "chrome/browser/favicon/favicon_utils.h"
14 #include "chrome/browser/process_resource_usage.h" 14 #include "chrome/browser/process_resource_usage.h"
15 #include "chrome/browser/profiles/profile.h" 15 #include "chrome/browser/profiles/profile.h"
16 #include "chrome/browser/sessions/session_tab_helper.h" 16 #include "chrome/browser/sessions/session_tab_helper.h"
17 #include "chrome/browser/task_management/task_manager_observer.h" 17 #include "chrome/browser/task_management/task_manager_observer.h"
18 #include "chrome/grit/generated_resources.h" 18 #include "chrome/grit/generated_resources.h"
19 #include "content/public/browser/render_process_host.h" 19 #include "content/public/browser/render_process_host.h"
20 #include "content/public/browser/web_contents.h" 20 #include "content/public/browser/web_contents.h"
21 #include "content/public/browser/web_contents_delegate.h" 21 #include "content/public/browser/web_contents_delegate.h"
22 #include "content/public/common/service_registry.h" 22 #include "services/shell/public/cpp/interface_provider.h"
23 #include "ui/base/l10n/l10n_util.h" 23 #include "ui/base/l10n/l10n_util.h"
24 24
25 namespace task_management { 25 namespace task_management {
26 26
27 namespace { 27 namespace {
28 28
29 // Creates the Mojo service wrapper that will be used to sample the V8 memory 29 // Creates the Mojo service wrapper that will be used to sample the V8 memory
30 // usage and the the WebCache resource stats of the render process hosted by 30 // usage and the the WebCache resource stats of the render process hosted by
31 // |render_process_host|. 31 // |render_process_host|.
32 ProcessResourceUsage* CreateRendererResourcesSampler( 32 ProcessResourceUsage* CreateRendererResourcesSampler(
33 content::RenderProcessHost* render_process_host) { 33 content::RenderProcessHost* render_process_host) {
34 mojom::ResourceUsageReporterPtr service; 34 mojom::ResourceUsageReporterPtr service;
35 content::ServiceRegistry* service_registry = 35 render_process_host->GetRemoteInterfaces()->GetInterface(&service);
36 render_process_host->GetServiceRegistry();
37 if (service_registry)
38 service_registry->ConnectToRemoteService(mojo::GetProxy(&service));
39 return new ProcessResourceUsage(std::move(service)); 36 return new ProcessResourceUsage(std::move(service));
40 } 37 }
41 38
42 // Gets the profile name associated with the browser context of the given 39 // Gets the profile name associated with the browser context of the given
43 // |render_process_host| from the profile info cache. 40 // |render_process_host| from the profile info cache.
44 base::string16 GetRendererProfileName( 41 base::string16 GetRendererProfileName(
45 const content::RenderProcessHost* render_process_host) { 42 const content::RenderProcessHost* render_process_host) {
46 Profile* profile = 43 Profile* profile =
47 Profile::FromBrowserContext(render_process_host->GetBrowserContext()); 44 Profile::FromBrowserContext(render_process_host->GetBrowserContext());
48 return Task::GetProfileNameFromProfile(profile); 45 return Task::GetProfileNameFromProfile(profile);
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 if (is_incognito) 235 if (is_incognito)
239 message_id = IDS_TASK_MANAGER_EXTENSION_INCOGNITO_PREFIX; 236 message_id = IDS_TASK_MANAGER_EXTENSION_INCOGNITO_PREFIX;
240 else 237 else
241 message_id = IDS_TASK_MANAGER_EXTENSION_PREFIX; 238 message_id = IDS_TASK_MANAGER_EXTENSION_PREFIX;
242 } 239 }
243 240
244 return l10n_util::GetStringFUTF16(message_id, title); 241 return l10n_util::GetStringFUTF16(message_id, title);
245 } 242 }
246 243
247 } // namespace task_management 244 } // namespace task_management
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698