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

Side by Side Diff: content/public/browser/site_instance.h

Issue 257083002: Check BrowsingInstance before swapping prerenders. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 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 | Annotate | Revision Log
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_PUBLIC_BROWSER_SITE_INSTANCE_H_ 5 #ifndef CONTENT_PUBLIC_BROWSER_SITE_INSTANCE_H_
6 #define CONTENT_PUBLIC_BROWSER_SITE_INSTANCE_H_ 6 #define CONTENT_PUBLIC_BROWSER_SITE_INSTANCE_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "content/common/content_export.h" 10 #include "content/common/content_export.h"
11 #include "url/gurl.h" 11 #include "url/gurl.h"
12 12
13 namespace content { 13 namespace content {
14 class BrowserContext; 14 class BrowserContext;
15 class BrowsingInstance;
16 class RenderProcessHost; 15 class RenderProcessHost;
17 16
18 /////////////////////////////////////////////////////////////////////////////// 17 ///////////////////////////////////////////////////////////////////////////////
19 // SiteInstance interface. 18 // SiteInstance interface.
20 // 19 //
21 // A SiteInstance represents a group of web pages that may be able to 20 // A SiteInstance represents a group of web pages that may be able to
22 // synchronously script each other, and thus must live in the same renderer 21 // synchronously script each other, and thus must live in the same renderer
23 // process. 22 // process.
24 // 23 //
25 // We identify this group using a combination of where the page comes from 24 // We identify this group using a combination of where the page comes from
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 // class from the rest of the codebase.) 99 // class from the rest of the codebase.)
101 // TODO(creis): This may be an argument to build a pass_refptr<T> class, as 100 // TODO(creis): This may be an argument to build a pass_refptr<T> class, as
102 // Darin suggests. 101 // Darin suggests.
103 virtual SiteInstance* GetRelatedSiteInstance(const GURL& url) = 0; 102 virtual SiteInstance* GetRelatedSiteInstance(const GURL& url) = 0;
104 103
105 // Returns whether the given SiteInstance is in the same BrowsingInstance as 104 // Returns whether the given SiteInstance is in the same BrowsingInstance as
106 // this one. If so, JavaScript interactions that are permitted across 105 // this one. If so, JavaScript interactions that are permitted across
107 // origins (e.g., postMessage) should be supported. 106 // origins (e.g., postMessage) should be supported.
108 virtual bool IsRelatedSiteInstance(const SiteInstance* instance) = 0; 107 virtual bool IsRelatedSiteInstance(const SiteInstance* instance) = 0;
109 108
109 // Returns the total active WebContents count for this SiteInstance and all
110 // related SiteInstances in the same BrowsingInstance.
111 virtual size_t GetRelatedActiveContentsCount() = 0;
112
110 // Factory method to create a new SiteInstance. This will create a new 113 // Factory method to create a new SiteInstance. This will create a new
111 // new BrowsingInstance, so it should only be used when creating a new tab 114 // new BrowsingInstance, so it should only be used when creating a new tab
112 // from scratch (or similar circumstances). Callers should ensure that 115 // from scratch (or similar circumstances). Callers should ensure that
113 // this SiteInstance becomes ref counted, by storing it in a scoped_refptr. 116 // this SiteInstance becomes ref counted, by storing it in a scoped_refptr.
114 // 117 //
115 // The render process host factory may be NULL. See SiteInstance constructor. 118 // The render process host factory may be NULL. See SiteInstance constructor.
116 // 119 //
117 // TODO(creis): This may be an argument to build a pass_refptr<T> class, as 120 // TODO(creis): This may be an argument to build a pass_refptr<T> class, as
118 // Darin suggests. 121 // Darin suggests.
119 static SiteInstance* Create(content::BrowserContext* browser_context); 122 static SiteInstance* Create(content::BrowserContext* browser_context);
(...skipping 22 matching lines...) Expand all
142 protected: 145 protected:
143 friend class base::RefCounted<SiteInstance>; 146 friend class base::RefCounted<SiteInstance>;
144 147
145 SiteInstance() {} 148 SiteInstance() {}
146 virtual ~SiteInstance() {} 149 virtual ~SiteInstance() {}
147 }; 150 };
148 151
149 } // namespace content. 152 } // namespace content.
150 153
151 #endif // CONTENT_PUBLIC_BROWSER_SITE_INSTANCE_H_ 154 #endif // CONTENT_PUBLIC_BROWSER_SITE_INSTANCE_H_
OLDNEW
« no previous file with comments | « content/browser/web_contents/web_contents_impl_unittest.cc ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698