| 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" |
| 11 #include "content/public/browser/browser_context.h" | 11 #include "content/public/browser/browser_context.h" |
| 12 #include "content/public/browser/content_browser_client.h" | 12 #include "content/public/browser/content_browser_client.h" |
| 13 #include "content/public/common/content_switches.h" | 13 #include "content/public/common/content_switches.h" |
| 14 #include "content/public/common/url_constants.h" | 14 #include "content/public/common/url_constants.h" |
| 15 | 15 |
| 16 namespace content { | 16 namespace content { |
| 17 | 17 |
| 18 BrowsingInstance::BrowsingInstance(BrowserContext* browser_context) | 18 BrowsingInstance::BrowsingInstance(BrowserContext* browser_context, |
| 19 int child_process_param_id) |
| 19 : browser_context_(browser_context), | 20 : browser_context_(browser_context), |
| 20 active_contents_count_(0u) { | 21 child_process_param_id_(child_process_param_id), |
| 21 } | 22 active_contents_count_(0u) {} |
| 22 | 23 |
| 23 bool BrowsingInstance::HasSiteInstance(const GURL& url) { | 24 bool BrowsingInstance::HasSiteInstance(const GURL& url) { |
| 24 std::string site = | 25 std::string site = |
| 25 SiteInstanceImpl::GetSiteForURL(browser_context_, url) | 26 SiteInstanceImpl::GetSiteForURL(browser_context_, url) |
| 26 .possibly_invalid_spec(); | 27 .possibly_invalid_spec(); |
| 27 | 28 |
| 28 return site_instance_map_.find(site) != site_instance_map_.end(); | 29 return site_instance_map_.find(site) != site_instance_map_.end(); |
| 29 } | 30 } |
| 30 | 31 |
| 31 scoped_refptr<SiteInstanceImpl> BrowsingInstance::GetSiteInstanceForURL( | 32 scoped_refptr<SiteInstanceImpl> BrowsingInstance::GetSiteInstanceForURL( |
| (...skipping 71 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 |