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 #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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
11 #include "content/common/content_export.h" | 11 #include "content/common/content_export.h" |
12 #include "googleurl/src/gurl.h" | 12 #include "googleurl/src/gurl.h" |
13 | 13 |
14 class BrowsingInstance; | 14 class BrowsingInstance; |
15 | 15 |
16 namespace content { | 16 namespace content { |
17 class BrowserContext; | 17 class BrowserContext; |
18 class RenderProcessHost; | 18 class RenderProcessHost; |
19 | 19 |
20 /////////////////////////////////////////////////////////////////////////////// | 20 /////////////////////////////////////////////////////////////////////////////// |
21 // SiteInstance interface. | 21 // SiteInstance interface. |
22 // | 22 // |
23 // A SiteInstance is a data structure that is associated with all pages in a | 23 // A SiteInstance is a data structure that is associated with all pages in a |
24 // given instance of a web site. Here, a web site is identified by its | 24 // given instance of a web site. Here, a web site is identified by its |
25 // registered domain name and scheme. An instance includes all pages | 25 // registered domain name and scheme. An instance includes all pages |
26 // that are connected (i.e., either a user or a script navigated from one | 26 // that are connected (i.e., either a user or a script navigated from one |
27 // to the other). We represent instances using the BrowsingInstance class. | 27 // to the other). We represent instances using the BrowsingInstance class. |
28 // | 28 // |
29 // In --process-per-tab, one SiteInstance is created for each tab (i.e., in the | 29 // In --process-per-tab, one SiteInstance is created for each tab (i.e., in the |
30 // TabContents constructor), unless the tab is created by script (i.e., in | 30 // WebContents constructor), unless the tab is created by script (i.e., in |
31 // TabContents::CreateNewView). This corresponds to one process per | 31 // WebContents::CreateNewView). This corresponds to one process per |
32 // BrowsingInstance. | 32 // BrowsingInstance. |
33 // | 33 // |
34 // In process-per-site-instance (the current default process model), | 34 // In process-per-site-instance (the current default process model), |
35 // SiteInstances are created (1) when the user manually creates a new tab | 35 // SiteInstances are created (1) when the user manually creates a new tab |
36 // (which also creates a new BrowsingInstance), and (2) when the user navigates | 36 // (which also creates a new BrowsingInstance), and (2) when the user navigates |
37 // across site boundaries (which uses the same BrowsingInstance). If the user | 37 // across site boundaries (which uses the same BrowsingInstance). If the user |
38 // navigates within a site, or opens links in new tabs within a site, the same | 38 // navigates within a site, or opens links in new tabs within a site, the same |
39 // SiteInstance is used. | 39 // SiteInstance is used. |
40 // | 40 // |
41 // In --process-per-site, we consolidate all SiteInstances for a given site, | 41 // In --process-per-site, we consolidate all SiteInstances for a given site, |
42 // throughout the entire browser context. This ensures that only one process | 42 // throughout the entire browser context. This ensures that only one process |
43 // will be dedicated to each site. | 43 // will be dedicated to each site. |
44 // | 44 // |
45 // Each NavigationEntry for a TabContents points to the SiteInstance that | 45 // Each NavigationEntry for a WebContents points to the SiteInstance that |
46 // rendered it. Each RenderViewHost also points to the SiteInstance that it is | 46 // rendered it. Each RenderViewHost also points to the SiteInstance that it is |
47 // associated with. A SiteInstance keeps track of the number of these | 47 // associated with. A SiteInstance keeps track of the number of these |
48 // references and deletes itself when the count goes to zero. This means that | 48 // references and deletes itself when the count goes to zero. This means that |
49 // a SiteInstance is only live as long as it is accessible, either from new | 49 // a SiteInstance is only live as long as it is accessible, either from new |
50 // tabs with no NavigationEntries or in NavigationEntries in the history. | 50 // tabs with no NavigationEntries or in NavigationEntries in the history. |
51 // | 51 // |
52 /////////////////////////////////////////////////////////////////////////////// | 52 /////////////////////////////////////////////////////////////////////////////// |
53 class CONTENT_EXPORT SiteInstance : public base::RefCounted<SiteInstance> { | 53 class CONTENT_EXPORT SiteInstance : public base::RefCounted<SiteInstance> { |
54 public: | 54 public: |
55 // Returns a unique ID for this SiteInstance. | 55 // Returns a unique ID for this SiteInstance. |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 protected: | 113 protected: |
114 friend class base::RefCounted<SiteInstance>; | 114 friend class base::RefCounted<SiteInstance>; |
115 | 115 |
116 SiteInstance() {} | 116 SiteInstance() {} |
117 virtual ~SiteInstance() {} | 117 virtual ~SiteInstance() {} |
118 }; | 118 }; |
119 | 119 |
120 } // namespace content. | 120 } // namespace content. |
121 | 121 |
122 #endif // CONTENT_PUBLIC_BROWSER_SITE_INSTANCE_H_ | 122 #endif // CONTENT_PUBLIC_BROWSER_SITE_INSTANCE_H_ |
OLD | NEW |