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

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

Issue 709813004: Remove the deprecated function ExtensionService::extensions(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed thestig@'s comments. Created 6 years, 1 month 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 (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"
(...skipping 14 matching lines...) Expand all
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 "content/public/common/content_constants.h" 27 #include "content/public/common/content_constants.h"
28 #include "ui/base/l10n/l10n_util.h" 28 #include "ui/base/l10n/l10n_util.h"
29 29
30 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID) 30 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID)
31 #include "content/public/browser/zygote_host_linux.h" 31 #include "content/public/browser/zygote_host_linux.h"
32 #endif 32 #endif
33 33
34 #if defined(ENABLE_EXTENSIONS) 34 #if defined(ENABLE_EXTENSIONS)
35 #include "chrome/browser/extensions/extension_service.h" 35 #include "extensions/browser/extension_registry.h"
36 #include "extensions/browser/extension_system.h"
37 #include "extensions/browser/process_manager.h" 36 #include "extensions/browser/process_manager.h"
38 #include "extensions/browser/process_map.h" 37 #include "extensions/browser/process_map.h"
39 #include "extensions/browser/view_type_utils.h" 38 #include "extensions/browser/view_type_utils.h"
40 #include "extensions/common/extension.h" 39 #include "extensions/common/extension.h"
41 #endif 40 #endif
42 41
43 using base::StringPrintf; 42 using base::StringPrintf;
44 using content::BrowserChildProcessHostIterator; 43 using content::BrowserChildProcessHostIterator;
45 using content::BrowserThread; 44 using content::BrowserThread;
46 using content::NavigationEntry; 45 using content::NavigationEntry;
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 // process be considered a diagnostics process. 278 // process be considered a diagnostics process.
280 if (!widget->IsRenderView()) 279 if (!widget->IsRenderView())
281 continue; 280 continue;
282 281
283 process.process_type = content::PROCESS_TYPE_RENDERER; 282 process.process_type = content::PROCESS_TYPE_RENDERER;
284 bool is_extension = false; 283 bool is_extension = false;
285 RenderViewHost* host = RenderViewHost::From(widget); 284 RenderViewHost* host = RenderViewHost::From(widget);
286 #if defined(ENABLE_EXTENSIONS) 285 #if defined(ENABLE_EXTENSIONS)
287 content::BrowserContext* context = 286 content::BrowserContext* context =
288 render_process_host->GetBrowserContext(); 287 render_process_host->GetBrowserContext();
289 ExtensionService* extension_service = 288 extensions::ExtensionRegistry* extension_registry =
290 extensions::ExtensionSystem::Get(context)->extension_service(); 289 extensions::ExtensionRegistry::Get(context);
291 extensions::ProcessMap* extension_process_map = 290 extensions::ProcessMap* extension_process_map =
292 extensions::ProcessMap::Get(context); 291 extensions::ProcessMap::Get(context);
293 is_extension = extension_process_map->Contains( 292 is_extension = extension_process_map->Contains(
294 host->GetProcess()->GetID()); 293 host->GetProcess()->GetID());
295 #endif 294 #endif
296 295
297 WebContents* contents = WebContents::FromRenderViewHost(host); 296 WebContents* contents = WebContents::FromRenderViewHost(host);
298 GURL url; 297 GURL url;
299 if (contents) { 298 if (contents) {
300 url = contents->GetURL(); 299 url = contents->GetURL();
301 SiteData* site_data = 300 SiteData* site_data =
302 &chrome_browser->site_data[contents->GetBrowserContext()]; 301 &chrome_browser->site_data[contents->GetBrowserContext()];
303 SiteDetails::CollectSiteInfo(contents, site_data); 302 SiteDetails::CollectSiteInfo(contents, site_data);
304 } 303 }
305 #if defined(ENABLE_EXTENSIONS) 304 #if defined(ENABLE_EXTENSIONS)
306 extensions::ViewType type = extensions::GetViewType(contents); 305 extensions::ViewType type = extensions::GetViewType(contents);
307 #endif 306 #endif
308 if (host->GetEnabledBindings() & content::BINDINGS_POLICY_WEB_UI) { 307 if (host->GetEnabledBindings() & content::BINDINGS_POLICY_WEB_UI) {
309 process.renderer_type = ProcessMemoryInformation::RENDERER_CHROME; 308 process.renderer_type = ProcessMemoryInformation::RENDERER_CHROME;
310 } else if (is_extension) { 309 } else if (is_extension) {
311 #if defined(ENABLE_EXTENSIONS) 310 #if defined(ENABLE_EXTENSIONS)
312 // For our purposes, don't count processes containing only hosted apps 311 // For our purposes, don't count processes containing only hosted apps
313 // as extension processes. See also: crbug.com/102533. 312 // as extension processes. See also: crbug.com/102533.
314 std::set<std::string> extension_ids = 313 std::set<std::string> extension_ids =
315 extension_process_map->GetExtensionsInProcess( 314 extension_process_map->GetExtensionsInProcess(
316 host->GetProcess()->GetID()); 315 host->GetProcess()->GetID());
317 for (std::set<std::string>::iterator iter = extension_ids.begin(); 316 for (std::set<std::string>::iterator iter = extension_ids.begin();
318 iter != extension_ids.end(); ++iter) { 317 iter != extension_ids.end(); ++iter) {
319 const Extension* extension = 318 const Extension* extension =
320 extension_service->GetExtensionById(*iter, false); 319 extension_registry->enabled_extensions().GetByID(*iter);
321 if (extension && !extension->is_hosted_app()) { 320 if (extension && !extension->is_hosted_app()) {
322 process.renderer_type = 321 process.renderer_type =
323 ProcessMemoryInformation::RENDERER_EXTENSION; 322 ProcessMemoryInformation::RENDERER_EXTENSION;
324 break; 323 break;
325 } 324 }
326 } 325 }
327 #endif 326 #endif
328 } 327 }
329 #if defined(ENABLE_EXTENSIONS) 328 #if defined(ENABLE_EXTENSIONS)
330 if (is_extension) { 329 if (is_extension) {
331 const Extension* extension = 330 const Extension* extension =
332 extension_service->extensions()->GetByID(url.host()); 331 extension_registry->enabled_extensions().GetByID(url.host());
333 if (extension) { 332 if (extension) {
334 base::string16 title = base::UTF8ToUTF16(extension->name()); 333 base::string16 title = base::UTF8ToUTF16(extension->name());
335 process.titles.push_back(title); 334 process.titles.push_back(title);
336 process.renderer_type = 335 process.renderer_type =
337 ProcessMemoryInformation::RENDERER_EXTENSION; 336 ProcessMemoryInformation::RENDERER_EXTENSION;
338 continue; 337 continue;
339 } 338 }
340 } 339 }
341 #endif 340 #endif
342 341
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
641 640
642 if (swap_info_.orig_data_size > 0 && swap_info_.compr_data_size > 0) { 641 if (swap_info_.orig_data_size > 0 && swap_info_.compr_data_size > 0) {
643 UMA_HISTOGRAM_CUSTOM_COUNTS( 642 UMA_HISTOGRAM_CUSTOM_COUNTS(
644 "Memory.Swap.CompressionRatio", 643 "Memory.Swap.CompressionRatio",
645 swap_info_.orig_data_size / swap_info_.compr_data_size, 644 swap_info_.orig_data_size / swap_info_.compr_data_size,
646 1, 20, 20); 645 1, 20, 20);
647 } 646 }
648 } 647 }
649 648
650 #endif // defined(OS_CHROMEOS) 649 #endif // defined(OS_CHROMEOS)
OLDNEW
« no previous file with comments | « chrome/browser/media_galleries/media_galleries_preferences.cc ('k') | chrome/browser/policy/policy_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698