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 #include "ios/chrome/browser/metrics/tab_usage_recorder.h" | 5 #include "ios/chrome/browser/metrics/tab_usage_recorder.h" |
6 | 6 |
7 #include "base/metrics/histogram_macros.h" | 7 #include "base/metrics/histogram_macros.h" |
8 #include "ios/chrome/browser/chrome_url_constants.h" | 8 #include "ios/chrome/browser/chrome_url_constants.h" |
9 #import "ios/chrome/browser/metrics/previous_session_info.h" | 9 #import "ios/chrome/browser/metrics/previous_session_info.h" |
10 #import "ios/chrome/browser/tabs/tab.h" | 10 #import "ios/chrome/browser/tabs/tab.h" |
11 #import "ios/web/web_state/ui/crw_web_controller.h" | 11 #import "ios/web/web_state/ui/crw_web_controller.h" |
12 | 12 |
| 13 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 14 #error "This file requires ARC support." |
| 15 #endif |
| 16 |
13 const char kTabUsageHistogramPrefix[] = "Tab"; | 17 const char kTabUsageHistogramPrefix[] = "Tab"; |
14 | 18 |
15 // The histogram recording the state of the tab the user switches to. | 19 // The histogram recording the state of the tab the user switches to. |
16 const char kSelectedTabHistogramName[] = | 20 const char kSelectedTabHistogramName[] = |
17 "Tab.StatusWhenSwitchedBackToForeground"; | 21 "Tab.StatusWhenSwitchedBackToForeground"; |
18 | 22 |
19 // The histogram to record the number of page loads before an evicted tab is | 23 // The histogram to record the number of page loads before an evicted tab is |
20 // selected. | 24 // selected. |
21 const char kPageLoadsBeforeEvictedTabSelected[] = | 25 const char kPageLoadsBeforeEvictedTabSelected[] = |
22 "Tab.PageLoadsSinceLastSwitchToEvictedTab"; | 26 "Tab.PageLoadsSinceLastSwitchToEvictedTab"; |
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 } | 331 } |
328 | 332 |
329 void TabUsageRecorder::ClearDeletedTabs() { | 333 void TabUsageRecorder::ClearDeletedTabs() { |
330 base::WeakNSObject<Tab> empty_tab(nil); | 334 base::WeakNSObject<Tab> empty_tab(nil); |
331 auto tab_item = evicted_tabs_.find(empty_tab); | 335 auto tab_item = evicted_tabs_.find(empty_tab); |
332 while (tab_item != evicted_tabs_.end()) { | 336 while (tab_item != evicted_tabs_.end()) { |
333 evicted_tabs_.erase(empty_tab); | 337 evicted_tabs_.erase(empty_tab); |
334 tab_item = evicted_tabs_.find(empty_tab); | 338 tab_item = evicted_tabs_.find(empty_tab); |
335 } | 339 } |
336 } | 340 } |
OLD | NEW |