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

Side by Side Diff: chrome/browser/memory_details.cc

Issue 139943005: Convert extensions::ProcessMap to BrowserContextKeyedService (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase process_map Created 6 years, 11 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/memory_details.h" 5 #include "chrome/browser/memory_details.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/file_version_info.h" 8 #include "base/file_version_info.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
11 #include "base/strings/stringprintf.h" 11 #include "base/strings/stringprintf.h"
12 #include "base/strings/utf_string_conversions.h" 12 #include "base/strings/utf_string_conversions.h"
13 #include "chrome/browser/extensions/extension_service.h" 13 #include "chrome/browser/extensions/extension_service.h"
14 #include "chrome/browser/profiles/profile.h" 14 #include "chrome/browser/profiles/profile.h"
15 #include "chrome/common/url_constants.h" 15 #include "chrome/common/url_constants.h"
16 #include "components/nacl/common/nacl_process_type.h" 16 #include "components/nacl/common/nacl_process_type.h"
17 #include "content/public/browser/browser_child_process_host_iterator.h" 17 #include "content/public/browser/browser_child_process_host_iterator.h"
18 #include "content/public/browser/browser_thread.h" 18 #include "content/public/browser/browser_thread.h"
19 #include "content/public/browser/child_process_data.h" 19 #include "content/public/browser/child_process_data.h"
20 #include "content/public/browser/navigation_controller.h" 20 #include "content/public/browser/navigation_controller.h"
21 #include "content/public/browser/navigation_entry.h" 21 #include "content/public/browser/navigation_entry.h"
22 #include "content/public/browser/render_process_host.h" 22 #include "content/public/browser/render_process_host.h"
23 #include "content/public/browser/render_view_host.h" 23 #include "content/public/browser/render_view_host.h"
24 #include "content/public/browser/render_widget_host_iterator.h" 24 #include "content/public/browser/render_widget_host_iterator.h"
25 #include "content/public/browser/web_contents.h" 25 #include "content/public/browser/web_contents.h"
26 #include "content/public/common/bindings_policy.h" 26 #include "content/public/common/bindings_policy.h"
27 #include "extensions/browser/process_manager.h" 27 #include "extensions/browser/process_manager.h"
28 #include "extensions/browser/process_map.h"
28 #include "extensions/browser/view_type_utils.h" 29 #include "extensions/browser/view_type_utils.h"
29 #include "extensions/common/extension.h" 30 #include "extensions/common/extension.h"
30 #include "grit/chromium_strings.h" 31 #include "grit/chromium_strings.h"
31 #include "grit/generated_resources.h" 32 #include "grit/generated_resources.h"
32 #include "ui/base/l10n/l10n_util.h" 33 #include "ui/base/l10n/l10n_util.h"
33 34
34 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID) 35 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID)
35 #include "content/public/browser/zygote_host_linux.h" 36 #include "content/public/browser/zygote_host_linux.h"
36 #endif 37 #endif
37 38
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 continue; 232 continue;
232 } 233 }
233 process.process_type = content::PROCESS_TYPE_RENDERER; 234 process.process_type = content::PROCESS_TYPE_RENDERER;
234 Profile* profile = 235 Profile* profile =
235 Profile::FromBrowserContext( 236 Profile::FromBrowserContext(
236 render_process_host->GetBrowserContext()); 237 render_process_host->GetBrowserContext());
237 ExtensionService* extension_service = profile->GetExtensionService(); 238 ExtensionService* extension_service = profile->GetExtensionService();
238 extensions::ProcessMap* extension_process_map = NULL; 239 extensions::ProcessMap* extension_process_map = NULL;
239 // No extensions on Android. So extension_service can be NULL. 240 // No extensions on Android. So extension_service can be NULL.
240 if (extension_service) 241 if (extension_service)
241 extension_process_map = extension_service->process_map(); 242 extension_process_map = extensions::ProcessMap::Get(profile);
242 243
243 // The RenderProcessHost may host multiple WebContentses. Any 244 // The RenderProcessHost may host multiple WebContentses. Any
244 // of them which contain diagnostics information make the whole 245 // of them which contain diagnostics information make the whole
245 // process be considered a diagnostics process. 246 // process be considered a diagnostics process.
246 if (!widget->IsRenderView()) 247 if (!widget->IsRenderView())
247 continue; 248 continue;
248 249
249 RenderViewHost* host = RenderViewHost::From(widget); 250 RenderViewHost* host = RenderViewHost::From(widget);
250 WebContents* contents = WebContents::FromRenderViewHost(host); 251 WebContents* contents = WebContents::FromRenderViewHost(host);
251 GURL url; 252 GURL url;
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
588 589
589 if (swap_info_.orig_data_size > 0 && swap_info_.compr_data_size > 0) { 590 if (swap_info_.orig_data_size > 0 && swap_info_.compr_data_size > 0) {
590 UMA_HISTOGRAM_CUSTOM_COUNTS( 591 UMA_HISTOGRAM_CUSTOM_COUNTS(
591 "Memory.Swap.CompressionRatio", 592 "Memory.Swap.CompressionRatio",
592 swap_info_.orig_data_size / swap_info_.compr_data_size, 593 swap_info_.orig_data_size / swap_info_.compr_data_size,
593 1, 20, 20); 594 1, 20, 20);
594 } 595 }
595 } 596 }
596 597
597 #endif 598 #endif
OLDNEW
« no previous file with comments | « chrome/browser/geolocation/chrome_geolocation_permission_context.cc ('k') | chrome/browser/metrics/metrics_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698