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

Side by Side Diff: chrome/browser/site_details.h

Issue 1674873002: SiteDetailsBrowserTest: prepare to add proxy information (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@uma
Patch Set: thestig's fixes Created 4 years, 10 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
« no previous file with comments | « no previous file | chrome/browser/site_details.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 // Maps an ID representing each BrowsingInstance to a set of site URLs. 16 // Collects information for a browsing instance assuming some alternate
17 using BrowsingInstanceSiteMap = base::hash_map<int32_t, std::set<GURL>>; 17 // isolation scenario.
18 struct ScenarioBrowsingInstanceInfo {
19 ScenarioBrowsingInstanceInfo();
20 ~ScenarioBrowsingInstanceInfo();
18 21
19 // Maps a SiteInstance to a set of all SiteInstances in the same 22 std::set<GURL> sites;
20 // BrowsingInstance. 23 };
21 using SiteInstanceMap = 24 using ScenarioBrowsingInstanceMap =
22 base::hash_map<content::SiteInstance*, std::set<content::SiteInstance*>>; 25 base::hash_map<int32_t, ScenarioBrowsingInstanceInfo>;
26
27 // Collects metrics about an actual browsing instance in the current session.
28 struct BrowsingInstanceInfo {
29 BrowsingInstanceInfo();
30 ~BrowsingInstanceInfo();
31
32 std::set<content::SiteInstance*> site_instances;
33 };
34 using BrowsingInstanceMap =
35 base::hash_map<content::SiteInstance*, BrowsingInstanceInfo>;
23 36
24 // This enum represents various alternative process model policies that we want 37 // This enum represents various alternative process model policies that we want
25 // to evaluate. We'll estimate the process cost of each scenario. 38 // to evaluate. We'll estimate the process cost of each scenario.
26 enum IsolationScenarioType { 39 enum IsolationScenarioType {
27 ISOLATE_NOTHING, 40 ISOLATE_NOTHING,
28 ISOLATE_ALL_SITES, 41 ISOLATE_ALL_SITES,
29 ISOLATE_HTTPS_SITES, 42 ISOLATE_HTTPS_SITES,
30 ISOLATE_EXTENSIONS, 43 ISOLATE_EXTENSIONS,
31 ISOLATION_SCENARIO_LAST = ISOLATE_EXTENSIONS 44 ISOLATION_SCENARIO_LAST = ISOLATE_EXTENSIONS
32 }; 45 };
33 46
34 // Contains the state required to estimate the process count under a particular 47 // Contains the state required to estimate the process count under a particular
35 // process model. We have one of these per IsolationScenarioType. 48 // process model. We have one of these per IsolationScenarioType.
36 struct IsolationScenario { 49 struct IsolationScenario {
37 IsolationScenario(); 50 IsolationScenario();
38 ~IsolationScenario(); 51 ~IsolationScenario();
39 52
40 IsolationScenarioType policy; 53 IsolationScenarioType policy;
41 std::set<GURL> sites; 54 std::set<GURL> all_sites;
42 BrowsingInstanceSiteMap browsing_instance_site_map; 55 ScenarioBrowsingInstanceMap browsing_instances;
43 }; 56 };
44 57
45 // Information about the sites and SiteInstances in each BrowsingInstance, for 58 // Information about the sites and SiteInstances in each BrowsingInstance, for
46 // use in estimating the number of processes needed for various process models. 59 // use in estimating the number of processes needed for various process models.
47 struct SiteData { 60 struct SiteData {
48 SiteData(); 61 SiteData();
49 ~SiteData(); 62 ~SiteData();
50 63
51 // One IsolationScenario object per IsolationScenarioType. 64 // One IsolationScenario object per IsolationScenarioType.
52 IsolationScenario scenarios[ISOLATION_SCENARIO_LAST + 1]; 65 IsolationScenario scenarios[ISOLATION_SCENARIO_LAST + 1];
53 66
54 // Global list of all SiteInstances, used for de-duping related instances. 67 // This map groups related SiteInstances together into BrowsingInstances. The
55 // It also keeps a set of all SiteInstances in the BrowsingInstance identified 68 // first SiteInstance we see in a BrowsingInstance is designated as the
56 // by the SiteInstance used as the key. 69 // 'primary' SiteInstance, and becomes the key of this map.
57 SiteInstanceMap instances; 70 BrowsingInstanceMap browsing_instances;
58 71
59 // A count of all RenderFrameHosts, which are in a different SiteInstance from 72 // A count of all RenderFrameHosts, which are in a different SiteInstance from
60 // their parents. 73 // their parents.
61 int out_of_process_frames; 74 int out_of_process_frames;
62 }; 75 };
63 76
64 // Maps a BrowserContext to information about the sites it contains. 77 // Maps a BrowserContext to information about the sites it contains.
65 typedef base::hash_map<content::BrowserContext*, SiteData> 78 typedef base::hash_map<content::BrowserContext*, SiteData>
66 BrowserContextSiteDataMap; 79 BrowserContextSiteDataMap;
67 80
(...skipping 11 matching lines...) Expand all
79 92
80 private: 93 private:
81 // Never needs to be constructed. 94 // Never needs to be constructed.
82 SiteDetails(); 95 SiteDetails();
83 ~SiteDetails(); 96 ~SiteDetails();
84 97
85 DISALLOW_COPY_AND_ASSIGN(SiteDetails); 98 DISALLOW_COPY_AND_ASSIGN(SiteDetails);
86 }; 99 };
87 100
88 #endif // CHROME_BROWSER_SITE_DETAILS_H_ 101 #endif // CHROME_BROWSER_SITE_DETAILS_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/site_details.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698