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

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

Issue 18248: CommandLine API rework (Closed)
Patch Set: fixes Created 11 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
« no previous file with comments | « chrome/browser/browser_process_impl.cc ('k') | chrome/browser/chrome_plugin_host.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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/browsing_instance.h" 5 #include "chrome/browser/browsing_instance.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "chrome/browser/tab_contents/site_instance.h" 8 #include "chrome/browser/tab_contents/site_instance.h"
9 #include "chrome/common/chrome_switches.h" 9 #include "chrome/common/chrome_switches.h"
10 10
11 /*static*/ 11 /*static*/
12 BrowsingInstance::ProfileSiteInstanceMap 12 BrowsingInstance::ProfileSiteInstanceMap
13 BrowsingInstance::profile_site_instance_map_; 13 BrowsingInstance::profile_site_instance_map_;
14 14
15 bool BrowsingInstance::ShouldUseProcessPerSite(const GURL& url) { 15 bool BrowsingInstance::ShouldUseProcessPerSite(const GURL& url) {
16 // Returns true if we should use the process-per-site model. This will be 16 // Returns true if we should use the process-per-site model. This will be
17 // the case if the --process-per-site switch is specified, or in 17 // the case if the --process-per-site switch is specified, or in
18 // process-per-site-instance for particular sites (e.g., the new tab page). 18 // process-per-site-instance for particular sites (e.g., the new tab page).
19 19
20 if (CommandLine().HasSwitch(switches::kProcessPerSite)) 20 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
21 if (command_line.HasSwitch(switches::kProcessPerSite))
21 return true; 22 return true;
22 23
23 if (!CommandLine().HasSwitch(switches::kProcessPerTab)) { 24 if (!command_line.HasSwitch(switches::kProcessPerTab)) {
24 // We are not in process-per-site or process-per-tab, so we must be in the 25 // We are not in process-per-site or process-per-tab, so we must be in the
25 // default (process-per-site-instance). Only use the process-per-site 26 // default (process-per-site-instance). Only use the process-per-site
26 // logic for particular sites that we want to consolidate. 27 // logic for particular sites that we want to consolidate.
27 // Note that --single-process may have been specified, but that affects the 28 // Note that --single-process may have been specified, but that affects the
28 // process creation logic in RenderProcessHost, so we do not need to worry 29 // process creation logic in RenderProcessHost, so we do not need to worry
29 // about it here. 30 // about it here.
30 if (url.SchemeIs("chrome")) 31 if (url.SchemeIs("chrome"))
31 // Always consolidate instances of the new tab page (and instances of any 32 // Always consolidate instances of the new tab page (and instances of any
32 // other internal resource urls). 33 // other internal resource urls).
33 return true; 34 return true;
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 // for the site. (It might have been an unregistered SiteInstance. See the 105 // for the site. (It might have been an unregistered SiteInstance. See the
105 // comments in RegisterSiteInstance.) 106 // comments in RegisterSiteInstance.)
106 SiteInstanceMap* map = GetSiteInstanceMap(profile_, site_instance->site()); 107 SiteInstanceMap* map = GetSiteInstanceMap(profile_, site_instance->site());
107 SiteInstanceMap::iterator i = map->find(site); 108 SiteInstanceMap::iterator i = map->find(site);
108 if (i != map->end() && i->second == site_instance) { 109 if (i != map->end() && i->second == site_instance) {
109 // Matches, so erase it. 110 // Matches, so erase it.
110 map->erase(i); 111 map->erase(i);
111 } 112 }
112 } 113 }
113 114
OLDNEW
« no previous file with comments | « chrome/browser/browser_process_impl.cc ('k') | chrome/browser/chrome_plugin_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698