OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_COMMON_SITE_ISOLATION_POLICY_H_ | 5 #ifndef CONTENT_COMMON_SITE_ISOLATION_POLICY_H_ |
6 #define CONTENT_COMMON_SITE_ISOLATION_POLICY_H_ | 6 #define CONTENT_COMMON_SITE_ISOLATION_POLICY_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "content/common/content_export.h" | 9 #include "content/common/content_export.h" |
10 #include "url/gurl.h" | 10 #include "url/gurl.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 // | 27 // |
28 // Note: Since cross-process frames will soon be possible by default, usage | 28 // Note: Since cross-process frames will soon be possible by default, usage |
29 // should be limited to temporary stop-gaps. | 29 // should be limited to temporary stop-gaps. |
30 // | 30 // |
31 // Instead of calling this method, prefer to examine object state to see | 31 // Instead of calling this method, prefer to examine object state to see |
32 // whether a particular frame happens to have a cross-process relationship | 32 // whether a particular frame happens to have a cross-process relationship |
33 // with another, or to consult DoesSiteRequireDedicatedProcess() to see if a | 33 // with another, or to consult DoesSiteRequireDedicatedProcess() to see if a |
34 // particular site merits protection. | 34 // particular site merits protection. |
35 static bool AreCrossProcessFramesPossible(); | 35 static bool AreCrossProcessFramesPossible(); |
36 | 36 |
37 // Returns true if pages loaded from |effective_url| ought to be handled only | 37 // Returns true if every site should be placed in a dedicated process. |
38 // by a renderer process isolated from other sites. If --site-per-process is | 38 static bool UseDedicatedProcessesForAllSites(); |
39 // on the command line, this is true for all sites. In other site isolation | |
40 // modes, only a subset of sites will require dedicated processes. | |
41 // | |
42 // |effective_url| must be an effective URL -- practically speaking, that | |
43 // means that this function should only be called on the UI thread in the | |
44 // browser process. | |
45 static bool DoesSiteRequireDedicatedProcess(const GURL& effective_url); | |
46 | 39 |
47 // Returns true if navigation and history code should maintain per-frame | 40 // Returns true if navigation and history code should maintain per-frame |
48 // navigation entries. This is an in-progress feature related to site | 41 // navigation entries. This is an in-progress feature related to site |
49 // isolation, so the return value is currently tied to --site-per-process. | 42 // isolation, so the return value is currently tied to --site-per-process. |
50 // TODO(creis, avi): Make this the default, and eliminate this. | 43 // TODO(creis, avi): Make this the default, and eliminate this. |
51 static bool UseSubframeNavigationEntries(); | 44 static bool UseSubframeNavigationEntries(); |
52 | 45 |
53 // Returns true if we are currently in a mode where the swapped out state | 46 // Returns true if we are currently in a mode where the swapped out state |
54 // should not be used. Currently (as an implementation strategy) swapped out | 47 // should not be used. Currently (as an implementation strategy) swapped out |
55 // is forbidden under --site-per-process, but our goal is to eliminate the | 48 // is forbidden under --site-per-process, but our goal is to eliminate the |
56 // mode entirely. In code that deals with the swapped out state, prefer calls | 49 // mode entirely. In code that deals with the swapped out state, prefer calls |
57 // to this function over consulting the switches directly. It will be easier | 50 // to this function over consulting the switches directly. It will be easier |
58 // to grep, and easier to rip out. | 51 // to grep, and easier to rip out. |
59 // | 52 // |
60 // TODO(nasko): When swappedout:// is eliminated entirely, this function | 53 // TODO(nasko): When swappedout:// is eliminated entirely, this function |
61 // should be removed and its callers cleaned up. | 54 // should be removed and its callers cleaned up. |
62 static bool IsSwappedOutStateForbidden(); | 55 static bool IsSwappedOutStateForbidden(); |
63 | 56 |
64 // Overrides the default site isolation mode so that all sites are | |
65 // isolated. Returns true if successful. Can fail if SiteIsolationPolicy | |
66 // has already been consulted at runtime prior to the override call -- | |
67 // if so, try calling this earlier in the test, maybe before creating | |
68 // any renderer processes. | |
69 static bool IsolateAllSitesForTesting(); | |
70 | |
71 private: | 57 private: |
72 SiteIsolationPolicy(); // Not instantiable. | 58 SiteIsolationPolicy(); // Not instantiable. |
73 | 59 |
74 DISALLOW_COPY_AND_ASSIGN(SiteIsolationPolicy); | 60 DISALLOW_COPY_AND_ASSIGN(SiteIsolationPolicy); |
75 }; | 61 }; |
76 | 62 |
77 } // namespace content | 63 } // namespace content |
78 | 64 |
79 #endif // CONTENT_COMMON_SITE_ISOLATION_POLICY_H_ | 65 #endif // CONTENT_COMMON_SITE_ISOLATION_POLICY_H_ |
OLD | NEW |