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

Side by Side Diff: ios/chrome/browser/metrics/tab_usage_recorder.mm

Issue 2820763002: Remove usage of Tab's |url| property from TabUsageRecorder. (Closed)
Patch Set: visible => lastCommitted Created 3 years, 8 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 | no next file » | 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 #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"
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 287
288 void TabUsageRecorder::ResetEvictedTab() { 288 void TabUsageRecorder::ResetEvictedTab() {
289 evicted_tab_ = NULL; 289 evicted_tab_ = NULL;
290 evicted_tab_state_ = IN_MEMORY; 290 evicted_tab_state_ = IN_MEMORY;
291 evicted_tab_reload_start_time_ = base::TimeTicks(); 291 evicted_tab_reload_start_time_ = base::TimeTicks();
292 } 292 }
293 293
294 bool TabUsageRecorder::ShouldIgnoreTab(Tab* tab) { 294 bool TabUsageRecorder::ShouldIgnoreTab(Tab* tab) {
295 // Do not count chrome:// urls to avoid data noise. For example, if they were 295 // Do not count chrome:// urls to avoid data noise. For example, if they were
296 // counted, every new tab created would add noise to the page load count. 296 // counted, every new tab created would add noise to the page load count.
297 return [tab url].SchemeIs(kChromeUIScheme); 297 return tab.lastCommittedURL.SchemeIs(kChromeUIScheme);
kkhorimoto 2017/04/14 20:40:47 chrome:// URLs are never pending, so lastCommitted
Eugene But (OOO till 7-30) 2017/04/14 21:48:09 WebUI can be a pending URL, so maybe we should che
kkhorimoto 2017/05/31 23:06:17 Done.
298 } 298 }
299 299
300 bool TabUsageRecorder::TabAlreadyEvicted(Tab* tab) { 300 bool TabUsageRecorder::TabAlreadyEvicted(Tab* tab) {
301 base::WeakNSObject<Tab> weak_tab(tab); 301 base::WeakNSObject<Tab> weak_tab(tab);
302 auto tab_item = evicted_tabs_.find(weak_tab); 302 auto tab_item = evicted_tabs_.find(weak_tab);
303 return tab_item != evicted_tabs_.end(); 303 return tab_item != evicted_tabs_.end();
304 } 304 }
305 305
306 TabUsageRecorder::TabStateWhenSelected TabUsageRecorder::ExtractTabState( 306 TabUsageRecorder::TabStateWhenSelected TabUsageRecorder::ExtractTabState(
307 Tab* tab) { 307 Tab* tab) {
(...skipping 19 matching lines...) Expand all
327 } 327 }
328 328
329 void TabUsageRecorder::ClearDeletedTabs() { 329 void TabUsageRecorder::ClearDeletedTabs() {
330 base::WeakNSObject<Tab> empty_tab(nil); 330 base::WeakNSObject<Tab> empty_tab(nil);
331 auto tab_item = evicted_tabs_.find(empty_tab); 331 auto tab_item = evicted_tabs_.find(empty_tab);
332 while (tab_item != evicted_tabs_.end()) { 332 while (tab_item != evicted_tabs_.end()) {
333 evicted_tabs_.erase(empty_tab); 333 evicted_tabs_.erase(empty_tab);
334 tab_item = evicted_tabs_.find(empty_tab); 334 tab_item = evicted_tabs_.find(empty_tab);
335 } 335 }
336 } 336 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698