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

Side by Side Diff: content/browser/site_instance.cc

Issue 7063015: Swap processes on reload if a hosted app has been installed/uninstalled. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix compile on Windows Created 9 years, 7 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
« no previous file with comments | « content/browser/site_instance.h ('k') | content/browser/tab_contents/navigation_entry.h » ('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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "content/browser/site_instance.h" 5 #include "content/browser/site_instance.h"
6 6
7 #include "content/browser/browsing_instance.h" 7 #include "content/browser/browsing_instance.h"
8 #include "content/browser/content_browser_client.h" 8 #include "content/browser/content_browser_client.h"
9 #include "content/browser/renderer_host/browser_render_process_host.h" 9 #include "content/browser/renderer_host/browser_render_process_host.h"
10 #include "content/browser/webui/web_ui_factory.h" 10 #include "content/browser/webui/web_ui_factory.h"
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 } 109 }
110 110
111 bool SiteInstance::HasRelatedSiteInstance(const GURL& url) { 111 bool SiteInstance::HasRelatedSiteInstance(const GURL& url) {
112 return browsing_instance_->HasSiteInstance(url); 112 return browsing_instance_->HasSiteInstance(url);
113 } 113 }
114 114
115 SiteInstance* SiteInstance::GetRelatedSiteInstance(const GURL& url) { 115 SiteInstance* SiteInstance::GetRelatedSiteInstance(const GURL& url) {
116 return browsing_instance_->GetSiteInstanceForURL(url); 116 return browsing_instance_->GetSiteInstanceForURL(url);
117 } 117 }
118 118
119 bool SiteInstance::HasWrongProcessForURL(const GURL& url) const {
120 // Having no process isn't a problem, since we'll assign it correctly.
121 if (!HasProcess())
122 return false;
123
124 // If the effective URL is an extension (e.g., for hosted apps) but the
125 // process is not (or vice versa), make sure we notice and fix it.
126 GURL effective_url = GetEffectiveURL(browsing_instance_->profile(), url);
127 return effective_url.SchemeIs(chrome::kExtensionScheme) !=
128 process_->is_extension_process();
129 }
130
119 /*static*/ 131 /*static*/
120 SiteInstance* SiteInstance::CreateSiteInstance(Profile* profile) { 132 SiteInstance* SiteInstance::CreateSiteInstance(Profile* profile) {
121 return new SiteInstance(new BrowsingInstance(profile)); 133 return new SiteInstance(new BrowsingInstance(profile));
122 } 134 }
123 135
124 /*static*/ 136 /*static*/
125 SiteInstance* SiteInstance::CreateSiteInstanceForURL(Profile* profile, 137 SiteInstance* SiteInstance::CreateSiteInstanceForURL(Profile* profile,
126 const GURL& url) { 138 const GURL& url) {
127 // This BrowsingInstance may be deleted if it returns an existing 139 // This BrowsingInstance may be deleted if it returns an existing
128 // SiteInstance. 140 // SiteInstance.
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 } 235 }
224 236
225 void SiteInstance::Observe(NotificationType type, 237 void SiteInstance::Observe(NotificationType type,
226 const NotificationSource& source, 238 const NotificationSource& source,
227 const NotificationDetails& details) { 239 const NotificationDetails& details) {
228 DCHECK(type == NotificationType::RENDERER_PROCESS_TERMINATED); 240 DCHECK(type == NotificationType::RENDERER_PROCESS_TERMINATED);
229 RenderProcessHost* rph = Source<RenderProcessHost>(source).ptr(); 241 RenderProcessHost* rph = Source<RenderProcessHost>(source).ptr();
230 if (rph == process_) 242 if (rph == process_)
231 process_ = NULL; 243 process_ = NULL;
232 } 244 }
OLDNEW
« no previous file with comments | « content/browser/site_instance.h ('k') | content/browser/tab_contents/navigation_entry.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698