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 IOS_CHROME_BROWSER_METRICS_TAB_USAGE_RECORDER_H_ | 5 #ifndef IOS_CHROME_BROWSER_METRICS_TAB_USAGE_RECORDER_H_ |
6 #define IOS_CHROME_BROWSER_METRICS_TAB_USAGE_RECORDER_H_ | 6 #define IOS_CHROME_BROWSER_METRICS_TAB_USAGE_RECORDER_H_ |
7 | 7 |
8 #import <Foundation/Foundation.h> | 8 #import <Foundation/Foundation.h> |
9 #include <deque> | 9 #include <deque> |
10 #include <map> | 10 #include <map> |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 void RecordRestoreStartTime(); | 184 void RecordRestoreStartTime(); |
185 | 185 |
186 // Clears deleted tabs from |evicted_tabs_|. | 186 // Clears deleted tabs from |evicted_tabs_|. |
187 void ClearDeletedTabs(); | 187 void ClearDeletedTabs(); |
188 | 188 |
189 // Number of page loads since the last evicted tab was seen. | 189 // Number of page loads since the last evicted tab was seen. |
190 unsigned int page_loads_; | 190 unsigned int page_loads_; |
191 | 191 |
192 // Keep track of the current tab, but only if it has been evicted. | 192 // Keep track of the current tab, but only if it has been evicted. |
193 // This is kept as a pointer value only - it should never be dereferenced. | 193 // This is kept as a pointer value only - it should never be dereferenced. |
194 void* evicted_tab_; | 194 __unsafe_unretained Tab* evicted_tab_; |
195 | 195 |
196 // State of |evicted_tab_| at the time it became the current tab. | 196 // State of |evicted_tab_| at the time it became the current tab. |
197 TabStateWhenSelected evicted_tab_state_; | 197 TabStateWhenSelected evicted_tab_state_; |
198 | 198 |
199 // Keep track of the tab last selected when this tab model was switched | 199 // Keep track of the tab last selected when this tab model was switched |
200 // away from to another mode (e.g. to incognito). | 200 // away from to another mode (e.g. to incognito). |
201 // Kept as a pointer value only - it should never be dereferenced. | 201 // Kept as a pointer value only - it should never be dereferenced. |
202 void* mode_switch_tab_; | 202 __unsafe_unretained Tab* mode_switch_tab_; |
203 | 203 |
204 // Keep track of a tab that was created to be immediately selected. It should | 204 // Keep track of a tab that was created to be immediately selected. It should |
205 // not contribute to the "StatusWhenSwitchedBackToForeground" metric. | 205 // not contribute to the "StatusWhenSwitchedBackToForeground" metric. |
206 void* tab_created_selected_; | 206 __unsafe_unretained Tab* tab_created_selected_; |
207 | 207 |
208 // Keep track of when the evicted tab starts to reload, so that the total | 208 // Keep track of when the evicted tab starts to reload, so that the total |
209 // time it takes to reload can be recorded. | 209 // time it takes to reload can be recorded. |
210 base::TimeTicks evicted_tab_reload_start_time_; | 210 base::TimeTicks evicted_tab_reload_start_time_; |
211 | 211 |
212 // Keep track of the tabs that have a known eviction cause. | 212 // Keep track of the tabs that have a known eviction cause. |
213 std::map<base::WeakNSObject<Tab>, TabStateWhenSelected> evicted_tabs_; | 213 std::map<base::WeakNSObject<Tab>, TabStateWhenSelected> evicted_tabs_; |
214 | 214 |
215 // Reference to TabUsageRecorderDelegate which provides access to the count of | 215 // Reference to TabUsageRecorderDelegate which provides access to the count of |
216 // live tabs monitored by this recorder. | 216 // live tabs monitored by this recorder. |
217 base::WeakNSProtocol<id<TabUsageRecorderDelegate>> recorder_delegate_; | 217 base::WeakNSProtocol<id<TabUsageRecorderDelegate>> recorder_delegate_; |
218 | 218 |
219 DISALLOW_COPY_AND_ASSIGN(TabUsageRecorder); | 219 DISALLOW_COPY_AND_ASSIGN(TabUsageRecorder); |
220 }; | 220 }; |
221 | 221 |
222 #endif // IOS_CHROME_BROWSER_METRICS_TAB_USAGE_RECORDER_H_ | 222 #endif // IOS_CHROME_BROWSER_METRICS_TAB_USAGE_RECORDER_H_ |
OLD | NEW |