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

Side by Side Diff: chrome/browser/browsing_instance.h

Issue 255087: Adding a unique runtime Id to Profile objects, that can be used as the key... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 2 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 #ifndef CHROME_BROWSER_BROWSING_INSTANCE_H__ 5 #ifndef CHROME_BROWSER_BROWSING_INSTANCE_H__
6 #define CHROME_BROWSER_BROWSING_INSTANCE_H__ 6 #define CHROME_BROWSER_BROWSING_INSTANCE_H__
7 7
8 #include "base/hash_tables.h" 8 #include "base/hash_tables.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/ref_counted.h" 10 #include "base/ref_counted.h"
11 #include "chrome/browser/profile.h"
11 12
12 class GURL; 13 class GURL;
13 class Profile;
14 class SiteInstance; 14 class SiteInstance;
15 15
16 /////////////////////////////////////////////////////////////////////////////// 16 ///////////////////////////////////////////////////////////////////////////////
17 // 17 //
18 // BrowsingInstance class 18 // BrowsingInstance class
19 // 19 //
20 // A browsing instance corresponds to the notion of a "unit of related browsing 20 // A browsing instance corresponds to the notion of a "unit of related browsing
21 // contexts" in the HTML 5 spec. Intuitively, it represents a collection of 21 // contexts" in the HTML 5 spec. Intuitively, it represents a collection of
22 // tabs and frames that can have script connections to each other. In that 22 // tabs and frames that can have script connections to each other. In that
23 // sense, it reflects the user interface, and not the contents of the tabs and 23 // sense, it reflects the user interface, and not the contents of the tabs and
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 // if the user later visits a page from this site, within this 93 // if the user later visits a page from this site, within this
94 // BrowsingInstance. 94 // BrowsingInstance.
95 void UnregisterSiteInstance(SiteInstance* site_instance); 95 void UnregisterSiteInstance(SiteInstance* site_instance);
96 96
97 private: 97 private:
98 // Map of site to SiteInstance, to ensure we only have one SiteInstance per 98 // Map of site to SiteInstance, to ensure we only have one SiteInstance per
99 // site. The site string should be the possibly_invalid_spec() of a GURL 99 // site. The site string should be the possibly_invalid_spec() of a GURL
100 // obtained with SiteInstance::GetSiteForURL. 100 // obtained with SiteInstance::GetSiteForURL.
101 typedef base::hash_map<std::string, SiteInstance*> SiteInstanceMap; 101 typedef base::hash_map<std::string, SiteInstance*> SiteInstanceMap;
102 102
103 // Map of Profile to SiteInstanceMap, for use in the process-per-site model. 103 // Map of Profile runtime Id to SiteInstanceMap, for use in the
104 typedef base::hash_map<Profile*, SiteInstanceMap> ProfileSiteInstanceMap; 104 // process-per-site model.
105 typedef base::hash_map<ProfileId, SiteInstanceMap> ProfileSiteInstanceMap;
105 106
106 // Returns a pointer to the relevant SiteInstanceMap for this object. If the 107 // Returns a pointer to the relevant SiteInstanceMap for this object. If the
107 // process-per-site model is in use, or if process-per-site-instance is in 108 // process-per-site model is in use, or if process-per-site-instance is in
108 // use and |url| matches a site for which we always use one process (e.g., 109 // use and |url| matches a site for which we always use one process (e.g.,
109 // the new tab page), then this returns the SiteInstanceMap for the entire 110 // the new tab page), then this returns the SiteInstanceMap for the entire
110 // profile. If not, this returns the BrowsingInstance's own private 111 // profile. If not, this returns the BrowsingInstance's own private
111 // SiteInstanceMap. 112 // SiteInstanceMap.
112 SiteInstanceMap* GetSiteInstanceMap(Profile* profile, const GURL& url); 113 SiteInstanceMap* GetSiteInstanceMap(Profile* profile, const GURL& url);
113 114
114 // Common profile to which all SiteInstances in this BrowsingInstance 115 // Common profile to which all SiteInstances in this BrowsingInstance
115 // must belong. 116 // must belong.
116 Profile* const profile_; 117 Profile* const profile_;
117 118
118 // Map of site to SiteInstance, to ensure we only have one SiteInstance per 119 // Map of site to SiteInstance, to ensure we only have one SiteInstance per
119 // site. The site string should be the possibly_invalid_spec() of a GURL 120 // site. The site string should be the possibly_invalid_spec() of a GURL
120 // obtained with SiteInstance::GetSiteForURL. Note that this map may not 121 // obtained with SiteInstance::GetSiteForURL. Note that this map may not
121 // contain every active SiteInstance, because a race exists where two 122 // contain every active SiteInstance, because a race exists where two
122 // SiteInstances can be assigned to the same site. This is ok in rare cases. 123 // SiteInstances can be assigned to the same site. This is ok in rare cases.
123 // This field is only used if we are not using process-per-site. 124 // This field is only used if we are not using process-per-site.
124 SiteInstanceMap site_instance_map_; 125 SiteInstanceMap site_instance_map_;
125 126
126 // Global map of Profile to SiteInstanceMap, for process-per-site. 127 // Global map of Profile to SiteInstanceMap, for process-per-site.
127 static ProfileSiteInstanceMap profile_site_instance_map_; 128 static ProfileSiteInstanceMap profile_site_instance_map_;
128 129
129 DISALLOW_EVIL_CONSTRUCTORS(BrowsingInstance); 130 DISALLOW_EVIL_CONSTRUCTORS(BrowsingInstance);
130 }; 131 };
131 132
132 #endif // CHROME_BROWSER_BROWSING_INSTANCE_H__ 133 #endif // CHROME_BROWSER_BROWSING_INSTANCE_H__
OLDNEW
« no previous file with comments | « chrome/browser/automation/automation_resource_message_filter.cc ('k') | chrome/browser/browsing_instance.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698