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

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

Issue 2706933003: webapk: Avoid overwriting default CreationParams
Patch Set: rebase 461342 Created 3 years, 8 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 #ifndef CONTENT_BROWSER_BROWSING_INSTANCE_H_ 5 #ifndef CONTENT_BROWSER_BROWSING_INSTANCE_H_
6 #define CONTENT_BROWSER_BROWSING_INSTANCE_H_ 6 #define CONTENT_BROWSER_BROWSING_INSTANCE_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include "base/containers/hash_tables.h" 10 #include "base/containers/hash_tables.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 class CONTENT_EXPORT BrowsingInstance final 58 class CONTENT_EXPORT BrowsingInstance final
59 : public base::RefCounted<BrowsingInstance> { 59 : public base::RefCounted<BrowsingInstance> {
60 private: 60 private:
61 friend class base::RefCounted<BrowsingInstance>; 61 friend class base::RefCounted<BrowsingInstance>;
62 friend class SiteInstanceImpl; 62 friend class SiteInstanceImpl;
63 FRIEND_TEST_ALL_PREFIXES(SiteInstanceTest, OneSiteInstancePerSite); 63 FRIEND_TEST_ALL_PREFIXES(SiteInstanceTest, OneSiteInstancePerSite);
64 FRIEND_TEST_ALL_PREFIXES(SiteInstanceTest, 64 FRIEND_TEST_ALL_PREFIXES(SiteInstanceTest,
65 OneSiteInstancePerSiteInBrowserContext); 65 OneSiteInstancePerSiteInBrowserContext);
66 66
67 // Create a new BrowsingInstance. 67 // Create a new BrowsingInstance.
68 explicit BrowsingInstance(BrowserContext* context); 68 BrowsingInstance(BrowserContext* context, int child_process_param_id);
69 69
70 ~BrowsingInstance(); 70 ~BrowsingInstance();
71 71
72 // Get the browser context to which this BrowsingInstance belongs. 72 // Get the browser context to which this BrowsingInstance belongs.
73 BrowserContext* browser_context() const { return browser_context_; } 73 BrowserContext* browser_context() const { return browser_context_; }
74 74
75 // An opaque id used passed to ChildProcessLauncher to launch child processes.
76 int child_process_param_id() const { return child_process_param_id_; }
77
75 // Returns whether this BrowsingInstance has registered a SiteInstance for 78 // Returns whether this BrowsingInstance has registered a SiteInstance for
76 // the site of the given URL. 79 // the site of the given URL.
77 bool HasSiteInstance(const GURL& url); 80 bool HasSiteInstance(const GURL& url);
78 81
79 // Get the SiteInstance responsible for rendering the given URL. Should 82 // Get the SiteInstance responsible for rendering the given URL. Should
80 // create a new one if necessary, but should not create more than one 83 // create a new one if necessary, but should not create more than one
81 // SiteInstance per site. 84 // SiteInstance per site.
82 scoped_refptr<SiteInstanceImpl> GetSiteInstanceForURL(const GURL& url); 85 scoped_refptr<SiteInstanceImpl> GetSiteInstanceForURL(const GURL& url);
83 86
84 // Returns a SiteInstance that should be used for subframes when an oopif is 87 // Returns a SiteInstance that should be used for subframes when an oopif is
(...skipping 21 matching lines...) Expand all
106 } 109 }
107 110
108 // Map of site to SiteInstance, to ensure we only have one SiteInstance per 111 // Map of site to SiteInstance, to ensure we only have one SiteInstance per
109 // site. 112 // site.
110 typedef base::hash_map<std::string, SiteInstanceImpl*> SiteInstanceMap; 113 typedef base::hash_map<std::string, SiteInstanceImpl*> SiteInstanceMap;
111 114
112 // Common browser context to which all SiteInstances in this BrowsingInstance 115 // Common browser context to which all SiteInstances in this BrowsingInstance
113 // must belong. 116 // must belong.
114 BrowserContext* const browser_context_; 117 BrowserContext* const browser_context_;
115 118
119 const int child_process_param_id_;
120
116 // Map of site to SiteInstance, to ensure we only have one SiteInstance per 121 // Map of site to SiteInstance, to ensure we only have one SiteInstance per
117 // site. The site string should be the possibly_invalid_spec() of a GURL 122 // site. The site string should be the possibly_invalid_spec() of a GURL
118 // obtained with SiteInstanceImpl::GetSiteForURL. Note that this map may not 123 // obtained with SiteInstanceImpl::GetSiteForURL. Note that this map may not
119 // contain every active SiteInstance, because a race exists where two 124 // contain every active SiteInstance, because a race exists where two
120 // SiteInstances can be assigned to the same site. This is ok in rare cases. 125 // SiteInstances can be assigned to the same site. This is ok in rare cases.
121 // It also does not contain SiteInstances which have not yet been assigned a 126 // It also does not contain SiteInstances which have not yet been assigned a
122 // site, such as about:blank. See NavigatorImpl::ShouldAssignSiteForURL. 127 // site, such as about:blank. See NavigatorImpl::ShouldAssignSiteForURL.
123 SiteInstanceMap site_instance_map_; 128 SiteInstanceMap site_instance_map_;
124 129
125 // Number of WebContentses currently using this BrowsingInstance. 130 // Number of WebContentses currently using this BrowsingInstance.
126 size_t active_contents_count_; 131 size_t active_contents_count_;
127 132
128 SiteInstanceImpl* default_subframe_site_instance_ = nullptr; 133 SiteInstanceImpl* default_subframe_site_instance_ = nullptr;
129 134
130 DISALLOW_COPY_AND_ASSIGN(BrowsingInstance); 135 DISALLOW_COPY_AND_ASSIGN(BrowsingInstance);
131 }; 136 };
132 137
133 } // namespace content 138 } // namespace content
134 139
135 #endif // CONTENT_BROWSER_BROWSING_INSTANCE_H_ 140 #endif // CONTENT_BROWSER_BROWSING_INSTANCE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698