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

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

Issue 2875793002: Why this CL triggers an OilPan crash.
Patch Set: Created 3 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
OLDNEW
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 int g_next_browsing_instance_id = 1;
19
18 BrowsingInstance::BrowsingInstance(BrowserContext* browser_context) 20 BrowsingInstance::BrowsingInstance(BrowserContext* browser_context)
19 : browser_context_(browser_context), 21 : browser_context_(browser_context),
20 active_contents_count_(0u) { 22 active_contents_count_(0u),
21 } 23 browsing_instance_id_(g_next_browsing_instance_id++) {}
22 24
23 bool BrowsingInstance::HasSiteInstance(const GURL& url) { 25 bool BrowsingInstance::HasSiteInstance(const GURL& url) {
24 std::string site = 26 std::string site =
25 SiteInstanceImpl::GetSiteForURL(browser_context_, url) 27 SiteInstanceImpl::GetSiteForURL(browser_context_, url)
26 .possibly_invalid_spec(); 28 .possibly_invalid_spec();
27 29
28 return site_instance_map_.find(site) != site_instance_map_.end(); 30 return site_instance_map_.find(site) != site_instance_map_.end();
29 } 31 }
30 32
31 scoped_refptr<SiteInstanceImpl> BrowsingInstance::GetSiteInstanceForURL( 33 scoped_refptr<SiteInstanceImpl> BrowsingInstance::GetSiteInstanceForURL(
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 } 105 }
104 106
105 BrowsingInstance::~BrowsingInstance() { 107 BrowsingInstance::~BrowsingInstance() {
106 // We should only be deleted when all of the SiteInstances that refer to 108 // We should only be deleted when all of the SiteInstances that refer to
107 // us are gone. 109 // us are gone.
108 DCHECK(site_instance_map_.empty()); 110 DCHECK(site_instance_map_.empty());
109 DCHECK_EQ(0u, active_contents_count_); 111 DCHECK_EQ(0u, active_contents_count_);
110 } 112 }
111 113
112 } // namespace content 114 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/browsing_instance.h ('k') | content/browser/renderer_host/render_view_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698