OLD | NEW |
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/renderer_host/browser_render_process_host.h" | 8 #include "content/browser/renderer_host/render_process_host_impl.h" |
9 #include "content/browser/webui/web_ui_factory.h" | 9 #include "content/browser/webui/web_ui_factory.h" |
10 #include "content/public/browser/content_browser_client.h" | 10 #include "content/public/browser/content_browser_client.h" |
11 #include "content/public/browser/notification_service.h" | 11 #include "content/public/browser/notification_service.h" |
12 #include "content/public/browser/notification_types.h" | 12 #include "content/public/browser/notification_types.h" |
| 13 #include "content/public/browser/render_process_host_factory.h" |
13 #include "content/public/common/url_constants.h" | 14 #include "content/public/common/url_constants.h" |
14 #include "net/base/registry_controlled_domain.h" | 15 #include "net/base/registry_controlled_domain.h" |
15 | 16 |
16 static bool IsURLSameAsAnySiteInstance(const GURL& url) { | 17 static bool IsURLSameAsAnySiteInstance(const GURL& url) { |
17 if (!url.is_valid()) | 18 if (!url.is_valid()) |
18 return false; | 19 return false; |
19 | 20 |
20 // We treat javascript: as the same site as any URL since it is actually | 21 // We treat javascript: as the same site as any URL since it is actually |
21 // a modifier on existing pages. | 22 // a modifier on existing pages. |
22 if (url.SchemeIs(chrome::kJavaScriptScheme)) | 23 if (url.SchemeIs(chrome::kJavaScriptScheme)) |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 process_ = RenderProcessHost::GetExistingProcessHost( | 71 process_ = RenderProcessHost::GetExistingProcessHost( |
71 browsing_instance_->browser_context(), site_); | 72 browsing_instance_->browser_context(), site_); |
72 | 73 |
73 // Otherwise (or if that fails), create a new one. | 74 // Otherwise (or if that fails), create a new one. |
74 if (!process_) { | 75 if (!process_) { |
75 if (render_process_host_factory_) { | 76 if (render_process_host_factory_) { |
76 process_ = render_process_host_factory_->CreateRenderProcessHost( | 77 process_ = render_process_host_factory_->CreateRenderProcessHost( |
77 browsing_instance_->browser_context()); | 78 browsing_instance_->browser_context()); |
78 } else { | 79 } else { |
79 process_ = | 80 process_ = |
80 new BrowserRenderProcessHost(browsing_instance_->browser_context()); | 81 new RenderProcessHostImpl(browsing_instance_->browser_context()); |
81 } | 82 } |
82 } | 83 } |
83 | 84 |
84 content::GetContentClient()->browser()->SiteInstanceGotProcess(this); | 85 content::GetContentClient()->browser()->SiteInstanceGotProcess(this); |
85 | 86 |
86 // Make sure the process starts at the right max_page_id | 87 // Make sure the process starts at the right max_page_id |
87 process_->UpdateMaxPageID(max_page_id_); | 88 process_->UpdateMaxPageID(max_page_id_); |
88 } | 89 } |
89 DCHECK(process_); | 90 DCHECK(process_); |
90 | 91 |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 } | 221 } |
221 | 222 |
222 void SiteInstance::Observe(int type, | 223 void SiteInstance::Observe(int type, |
223 const content::NotificationSource& source, | 224 const content::NotificationSource& source, |
224 const content::NotificationDetails& details) { | 225 const content::NotificationDetails& details) { |
225 DCHECK(type == content::NOTIFICATION_RENDERER_PROCESS_TERMINATED); | 226 DCHECK(type == content::NOTIFICATION_RENDERER_PROCESS_TERMINATED); |
226 RenderProcessHost* rph = content::Source<RenderProcessHost>(source).ptr(); | 227 RenderProcessHost* rph = content::Source<RenderProcessHost>(source).ptr(); |
227 if (rph == process_) | 228 if (rph == process_) |
228 process_ = NULL; | 229 process_ = NULL; |
229 } | 230 } |
OLD | NEW |