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/public/navigation_item.h" | 11 #import "ios/web/public/navigation_item.h" |
12 #import "ios/web/public/navigation_manager.h" | 12 #import "ios/web/public/navigation_manager.h" |
13 #import "ios/web/public/web_state/web_state.h" | 13 #import "ios/web/public/web_state/web_state.h" |
14 #import "ios/web/web_state/ui/crw_web_controller.h" | 14 #import "ios/web/web_state/ui/crw_web_controller.h" |
15 | 15 |
16 #if !defined(__has_feature) || !__has_feature(objc_arc) | |
17 #error "This file requires ARC support." | |
18 #endif | |
19 | |
20 const char kTabUsageHistogramPrefix[] = "Tab"; | 16 const char kTabUsageHistogramPrefix[] = "Tab"; |
21 | 17 |
22 // The histogram recording the state of the tab the user switches to. | 18 // The histogram recording the state of the tab the user switches to. |
23 const char kSelectedTabHistogramName[] = | 19 const char kSelectedTabHistogramName[] = |
24 "Tab.StatusWhenSwitchedBackToForeground"; | 20 "Tab.StatusWhenSwitchedBackToForeground"; |
25 | 21 |
26 // The histogram to record the number of page loads before an evicted tab is | 22 // The histogram to record the number of page loads before an evicted tab is |
27 // selected. | 23 // selected. |
28 const char kPageLoadsBeforeEvictedTabSelected[] = | 24 const char kPageLoadsBeforeEvictedTabSelected[] = |
29 "Tab.PageLoadsSinceLastSwitchToEvictedTab"; | 25 "Tab.PageLoadsSinceLastSwitchToEvictedTab"; |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 } | 334 } |
339 | 335 |
340 void TabUsageRecorder::ClearDeletedTabs() { | 336 void TabUsageRecorder::ClearDeletedTabs() { |
341 base::WeakNSObject<Tab> empty_tab(nil); | 337 base::WeakNSObject<Tab> empty_tab(nil); |
342 auto tab_item = evicted_tabs_.find(empty_tab); | 338 auto tab_item = evicted_tabs_.find(empty_tab); |
343 while (tab_item != evicted_tabs_.end()) { | 339 while (tab_item != evicted_tabs_.end()) { |
344 evicted_tabs_.erase(empty_tab); | 340 evicted_tabs_.erase(empty_tab); |
345 tab_item = evicted_tabs_.find(empty_tab); | 341 tab_item = evicted_tabs_.find(empty_tab); |
346 } | 342 } |
347 } | 343 } |
OLD | NEW |