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

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

Issue 2566583002: Change allowed bindings to be per RenderFrame instead of per RenderView. (Closed)
Patch Set: rebase Created 3 years, 10 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 (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 <algorithm> 7 #include <algorithm>
8 #include <set> 8 #include <set>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/file_version_info.h" 11 #include "base/file_version_info.h"
12 #include "base/metrics/histogram_macros.h" 12 #include "base/metrics/histogram_macros.h"
13 #include "base/strings/string_util.h" 13 #include "base/strings/string_util.h"
14 #include "base/strings/stringprintf.h" 14 #include "base/strings/stringprintf.h"
15 #include "base/strings/utf_string_conversions.h" 15 #include "base/strings/utf_string_conversions.h"
16 #include "build/build_config.h" 16 #include "build/build_config.h"
17 #include "chrome/browser/profiles/profile.h" 17 #include "chrome/browser/profiles/profile.h"
18 #include "chrome/grit/generated_resources.h" 18 #include "chrome/grit/generated_resources.h"
19 #include "components/nacl/common/nacl_process_type.h" 19 #include "components/nacl/common/nacl_process_type.h"
20 #include "components/strings/grit/components_strings.h" 20 #include "components/strings/grit/components_strings.h"
21 #include "content/public/browser/browser_child_process_host_iterator.h" 21 #include "content/public/browser/browser_child_process_host_iterator.h"
22 #include "content/public/browser/browser_thread.h" 22 #include "content/public/browser/browser_thread.h"
23 #include "content/public/browser/child_process_data.h" 23 #include "content/public/browser/child_process_data.h"
24 #include "content/public/browser/navigation_controller.h" 24 #include "content/public/browser/navigation_controller.h"
25 #include "content/public/browser/navigation_entry.h" 25 #include "content/public/browser/navigation_entry.h"
26 #include "content/public/browser/render_frame_host.h"
26 #include "content/public/browser/render_process_host.h" 27 #include "content/public/browser/render_process_host.h"
27 #include "content/public/browser/render_view_host.h" 28 #include "content/public/browser/render_view_host.h"
28 #include "content/public/browser/render_widget_host.h" 29 #include "content/public/browser/render_widget_host.h"
29 #include "content/public/browser/render_widget_host_iterator.h" 30 #include "content/public/browser/render_widget_host_iterator.h"
30 #include "content/public/browser/web_contents.h" 31 #include "content/public/browser/web_contents.h"
31 #include "content/public/common/bindings_policy.h" 32 #include "content/public/common/bindings_policy.h"
32 #include "content/public/common/content_constants.h" 33 #include "content/public/common/content_constants.h"
33 #include "extensions/features/features.h" 34 #include "extensions/features/features.h"
34 #include "ui/base/l10n/l10n_util.h" 35 #include "ui/base/l10n/l10n_util.h"
35 36
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 // WebContents. 291 // WebContents.
291 if (rvh != contents->GetRenderViewHost()) 292 if (rvh != contents->GetRenderViewHost())
292 continue; 293 continue;
293 294
294 // The rest of this block will happen only once per WebContents. 295 // The rest of this block will happen only once per WebContents.
295 GURL page_url = contents->GetLastCommittedURL(); 296 GURL page_url = contents->GetLastCommittedURL();
296 SiteData& site_data = 297 SiteData& site_data =
297 chrome_browser->site_data[contents->GetBrowserContext()]; 298 chrome_browser->site_data[contents->GetBrowserContext()];
298 SiteDetails::CollectSiteInfo(contents, &site_data); 299 SiteDetails::CollectSiteInfo(contents, &site_data);
299 300
300 bool is_webui = 301 bool is_webui = rvh->GetMainFrame()->GetEnabledBindings() &
301 rvh->GetEnabledBindings() & content::BINDINGS_POLICY_WEB_UI; 302 content::BINDINGS_POLICY_WEB_UI;
302 303
303 if (is_webui) { 304 if (is_webui) {
304 process.renderer_type = ProcessMemoryInformation::RENDERER_CHROME; 305 process.renderer_type = ProcessMemoryInformation::RENDERER_CHROME;
305 } 306 }
306 307
307 #if BUILDFLAG(ENABLE_EXTENSIONS) 308 #if BUILDFLAG(ENABLE_EXTENSIONS)
308 if (!is_webui && process_is_for_extensions) { 309 if (!is_webui && process_is_for_extensions) {
309 const Extension* extension = 310 const Extension* extension =
310 extensions::ExtensionRegistry::Get( 311 extensions::ExtensionRegistry::Get(
311 render_process_host->GetBrowserContext()) 312 render_process_host->GetBrowserContext())
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 // Get rid of other Chrome processes that are from a different profile. 346 // Get rid of other Chrome processes that are from a different profile.
346 auto is_unknown = [](ProcessMemoryInformation& process) { 347 auto is_unknown = [](ProcessMemoryInformation& process) {
347 return process.process_type == content::PROCESS_TYPE_UNKNOWN; 348 return process.process_type == content::PROCESS_TYPE_UNKNOWN;
348 }; 349 };
349 auto& vector = chrome_browser->processes; 350 auto& vector = chrome_browser->processes;
350 vector.erase(std::remove_if(vector.begin(), vector.end(), is_unknown), 351 vector.erase(std::remove_if(vector.begin(), vector.end(), is_unknown),
351 vector.end()); 352 vector.end());
352 353
353 OnDetailsAvailable(); 354 OnDetailsAvailable();
354 } 355 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698