| OLD | NEW |
| 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 "content/browser/browsing_instance.h" | 5 #include "content/browser/browsing_instance.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "content/browser/site_instance_impl.h" | 9 #include "content/browser/site_instance_impl.h" |
| 10 #include "content/common/site_isolation_policy.h" | 10 #include "content/common/site_isolation_policy.h" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 instance->SetSite(url); | 44 instance->SetSite(url); |
| 45 return instance; | 45 return instance; |
| 46 } | 46 } |
| 47 | 47 |
| 48 scoped_refptr<SiteInstanceImpl> | 48 scoped_refptr<SiteInstanceImpl> |
| 49 BrowsingInstance::GetDefaultSubframeSiteInstance() { | 49 BrowsingInstance::GetDefaultSubframeSiteInstance() { |
| 50 // This should only be used for --top-document-isolation mode. | 50 // This should only be used for --top-document-isolation mode. |
| 51 CHECK(SiteIsolationPolicy::IsTopDocumentIsolationEnabled()); | 51 CHECK(SiteIsolationPolicy::IsTopDocumentIsolationEnabled()); |
| 52 if (!default_subframe_site_instance_) { | 52 if (!default_subframe_site_instance_) { |
| 53 SiteInstanceImpl* instance = new SiteInstanceImpl(this); | 53 SiteInstanceImpl* instance = new SiteInstanceImpl(this); |
| 54 instance->set_is_default_subframe_site_instance(); | 54 instance->set_process_reuse_policy( |
| 55 SiteInstanceImpl::ProcessReusePolicy::USE_DEFAULT_SUBFRAME_PROCESS); |
| 55 | 56 |
| 56 // TODO(nick): This is a hack for now. | 57 // TODO(nick): This is a hack for now. |
| 57 instance->SetSite(GURL("http://web-subframes.invalid")); | 58 instance->SetSite(GURL("http://web-subframes.invalid")); |
| 58 | 59 |
| 59 default_subframe_site_instance_ = instance; | 60 default_subframe_site_instance_ = instance; |
| 60 } | 61 } |
| 61 | 62 |
| 62 return make_scoped_refptr(default_subframe_site_instance_); | 63 return make_scoped_refptr(default_subframe_site_instance_); |
| 63 } | 64 } |
| 64 | 65 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 } | 104 } |
| 104 | 105 |
| 105 BrowsingInstance::~BrowsingInstance() { | 106 BrowsingInstance::~BrowsingInstance() { |
| 106 // We should only be deleted when all of the SiteInstances that refer to | 107 // We should only be deleted when all of the SiteInstances that refer to |
| 107 // us are gone. | 108 // us are gone. |
| 108 DCHECK(site_instance_map_.empty()); | 109 DCHECK(site_instance_map_.empty()); |
| 109 DCHECK_EQ(0u, active_contents_count_); | 110 DCHECK_EQ(0u, active_contents_count_); |
| 110 } | 111 } |
| 111 | 112 |
| 112 } // namespace content | 113 } // namespace content |
| OLD | NEW |