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

Side by Side Diff: chrome/browser/tab_contents/site_instance.cc

Issue 18432: Factor out the test web contents from the WebContents unit test so that it ca... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' 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 | Annotate | Revision Log
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/tab_contents/site_instance.h" 5 #include "chrome/browser/tab_contents/site_instance.h"
6 6
7 #include "chrome/browser/renderer_host/browser_render_process_host.h" 7 #include "chrome/browser/renderer_host/browser_render_process_host.h"
8 #include "net/base/registry_controlled_domain.h" 8 #include "net/base/registry_controlled_domain.h"
9 9
10 SiteInstance::~SiteInstance() { 10 SiteInstance::~SiteInstance() {
(...skipping 10 matching lines...) Expand all
21 process = RenderProcessHost::FromID(process_host_id_); 21 process = RenderProcessHost::FromID(process_host_id_);
22 22
23 // Create a new process if ours went away or was reused. 23 // Create a new process if ours went away or was reused.
24 if (!process) { 24 if (!process) {
25 // See if we should reuse an old process 25 // See if we should reuse an old process
26 if (RenderProcessHost::ShouldTryToUseExistingProcessHost()) 26 if (RenderProcessHost::ShouldTryToUseExistingProcessHost())
27 process = RenderProcessHost::GetExistingProcessHost( 27 process = RenderProcessHost::GetExistingProcessHost(
28 browsing_instance_->profile()); 28 browsing_instance_->profile());
29 29
30 // Otherwise (or if that fails), create a new one. 30 // Otherwise (or if that fails), create a new one.
31 if (!process) 31 if (!process) {
32 process = new BrowserRenderProcessHost(browsing_instance_->profile()); 32 if (render_process_host_factory_) {
33 process = render_process_host_factory_->CreateRenderProcessHost(
34 browsing_instance_->profile());
35 } else {
36 process = new BrowserRenderProcessHost(browsing_instance_->profile());
37 }
38 }
33 39
34 // Update our host ID, so all pages in this SiteInstance will use 40 // Update our host ID, so all pages in this SiteInstance will use
35 // the correct process. 41 // the correct process.
36 process_host_id_ = process->host_id(); 42 process_host_id_ = process->host_id();
37 43
38 // Make sure the process starts at the right max_page_id 44 // Make sure the process starts at the right max_page_id
39 process->UpdateMaxPageID(max_page_id_); 45 process->UpdateMaxPageID(max_page_id_);
40 } 46 }
41 DCHECK(process); 47 DCHECK(process);
42 48
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 } 143 }
138 144
139 // If the schemes differ, they aren't part of the same site. 145 // If the schemes differ, they aren't part of the same site.
140 if (url1.scheme() != url2.scheme()) { 146 if (url1.scheme() != url2.scheme()) {
141 return false; 147 return false;
142 } 148 }
143 149
144 return net::RegistryControlledDomainService::SameDomainOrHost(url1, url2); 150 return net::RegistryControlledDomainService::SameDomainOrHost(url1, url2);
145 } 151 }
146 152
OLDNEW
« no previous file with comments | « chrome/browser/tab_contents/site_instance.h ('k') | chrome/browser/tab_contents/test_web_contents.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698