| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_SITE_DETAILS_H_ | 5 #ifndef CHROME_BROWSER_SITE_DETAILS_H_ |
| 6 #define CHROME_BROWSER_SITE_DETAILS_H_ | 6 #define CHROME_BROWSER_SITE_DETAILS_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/containers/hash_tables.h" | 10 #include "base/containers/hash_tables.h" |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "content/public/browser/browser_context.h" | 12 #include "content/public/browser/browser_context.h" |
| 13 #include "content/public/browser/site_instance.h" | 13 #include "content/public/browser/site_instance.h" |
| 14 #include "content/public/browser/web_contents.h" | 14 #include "content/public/browser/web_contents.h" |
| 15 | 15 |
| 16 // Collects information for a browsing instance assuming some alternate | 16 // Collects information for a browsing instance assuming some alternate |
| 17 // isolation scenario. | 17 // isolation scenario. |
| 18 struct ScenarioBrowsingInstanceInfo { | 18 struct ScenarioBrowsingInstanceInfo { |
| 19 ScenarioBrowsingInstanceInfo(); | 19 ScenarioBrowsingInstanceInfo(); |
| 20 ScenarioBrowsingInstanceInfo(const ScenarioBrowsingInstanceInfo& other); |
| 20 ~ScenarioBrowsingInstanceInfo(); | 21 ~ScenarioBrowsingInstanceInfo(); |
| 21 | 22 |
| 22 std::set<GURL> sites; | 23 std::set<GURL> sites; |
| 23 }; | 24 }; |
| 24 using ScenarioBrowsingInstanceMap = | 25 using ScenarioBrowsingInstanceMap = |
| 25 base::hash_map<int32_t, ScenarioBrowsingInstanceInfo>; | 26 base::hash_map<int32_t, ScenarioBrowsingInstanceInfo>; |
| 26 | 27 |
| 27 // Collects metrics about an actual browsing instance in the current session. | 28 // Collects metrics about an actual browsing instance in the current session. |
| 28 struct BrowsingInstanceInfo { | 29 struct BrowsingInstanceInfo { |
| 29 BrowsingInstanceInfo(); | 30 BrowsingInstanceInfo(); |
| 31 BrowsingInstanceInfo(const BrowsingInstanceInfo& other); |
| 30 ~BrowsingInstanceInfo(); | 32 ~BrowsingInstanceInfo(); |
| 31 | 33 |
| 32 std::set<content::SiteInstance*> site_instances; | 34 std::set<content::SiteInstance*> site_instances; |
| 33 int proxy_count = 0; | 35 int proxy_count = 0; |
| 34 }; | 36 }; |
| 35 using BrowsingInstanceMap = | 37 using BrowsingInstanceMap = |
| 36 base::hash_map<content::SiteInstance*, BrowsingInstanceInfo>; | 38 base::hash_map<content::SiteInstance*, BrowsingInstanceInfo>; |
| 37 | 39 |
| 38 // This enum represents various alternative process model policies that we want | 40 // This enum represents various alternative process model policies that we want |
| 39 // to evaluate. We'll estimate the process cost of each scenario. | 41 // to evaluate. We'll estimate the process cost of each scenario. |
| 40 enum IsolationScenarioType { | 42 enum IsolationScenarioType { |
| 41 ISOLATE_NOTHING, | 43 ISOLATE_NOTHING, |
| 42 ISOLATE_ALL_SITES, | 44 ISOLATE_ALL_SITES, |
| 43 ISOLATE_HTTPS_SITES, | 45 ISOLATE_HTTPS_SITES, |
| 44 ISOLATE_EXTENSIONS, | 46 ISOLATE_EXTENSIONS, |
| 45 ISOLATION_SCENARIO_LAST = ISOLATE_EXTENSIONS | 47 ISOLATION_SCENARIO_LAST = ISOLATE_EXTENSIONS |
| 46 }; | 48 }; |
| 47 | 49 |
| 48 // Contains the state required to estimate the process count under a particular | 50 // Contains the state required to estimate the process count under a particular |
| 49 // process model. We have one of these per IsolationScenarioType. | 51 // process model. We have one of these per IsolationScenarioType. |
| 50 struct IsolationScenario { | 52 struct IsolationScenario { |
| 51 IsolationScenario(); | 53 IsolationScenario(); |
| 54 IsolationScenario(const IsolationScenario& other); |
| 52 ~IsolationScenario(); | 55 ~IsolationScenario(); |
| 53 | 56 |
| 54 IsolationScenarioType policy = ISOLATE_NOTHING; | 57 IsolationScenarioType policy = ISOLATE_NOTHING; |
| 55 std::set<GURL> all_sites; | 58 std::set<GURL> all_sites; |
| 56 ScenarioBrowsingInstanceMap browsing_instances; | 59 ScenarioBrowsingInstanceMap browsing_instances; |
| 57 }; | 60 }; |
| 58 | 61 |
| 59 // Information about the sites and SiteInstances in each BrowsingInstance, for | 62 // Information about the sites and SiteInstances in each BrowsingInstance, for |
| 60 // use in estimating the number of processes needed for various process models. | 63 // use in estimating the number of processes needed for various process models. |
| 61 struct SiteData { | 64 struct SiteData { |
| 62 SiteData(); | 65 SiteData(); |
| 66 SiteData(const SiteData& other); |
| 63 ~SiteData(); | 67 ~SiteData(); |
| 64 | 68 |
| 65 // One IsolationScenario object per IsolationScenarioType. | 69 // One IsolationScenario object per IsolationScenarioType. |
| 66 IsolationScenario scenarios[ISOLATION_SCENARIO_LAST + 1]; | 70 IsolationScenario scenarios[ISOLATION_SCENARIO_LAST + 1]; |
| 67 | 71 |
| 68 // This map groups related SiteInstances together into BrowsingInstances. The | 72 // This map groups related SiteInstances together into BrowsingInstances. The |
| 69 // first SiteInstance we see in a BrowsingInstance is designated as the | 73 // first SiteInstance we see in a BrowsingInstance is designated as the |
| 70 // 'primary' SiteInstance, and becomes the key of this map. | 74 // 'primary' SiteInstance, and becomes the key of this map. |
| 71 BrowsingInstanceMap browsing_instances; | 75 BrowsingInstanceMap browsing_instances; |
| 72 | 76 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 93 | 97 |
| 94 private: | 98 private: |
| 95 // Never needs to be constructed. | 99 // Never needs to be constructed. |
| 96 SiteDetails(); | 100 SiteDetails(); |
| 97 ~SiteDetails(); | 101 ~SiteDetails(); |
| 98 | 102 |
| 99 DISALLOW_COPY_AND_ASSIGN(SiteDetails); | 103 DISALLOW_COPY_AND_ASSIGN(SiteDetails); |
| 100 }; | 104 }; |
| 101 | 105 |
| 102 #endif // CHROME_BROWSER_SITE_DETAILS_H_ | 106 #endif // CHROME_BROWSER_SITE_DETAILS_H_ |
| OLD | NEW |