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

Side by Side Diff: chrome/browser/resource_coordinator/tab_manager.cc

Issue 2935183002: [TabMetrics] Add signals that mark the start and end of session restore. (Closed)
Patch Set: Use OnSessionRestore[Started,Ended]() directly in TabLoader. Created 3 years, 6 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/browser/resource_coordinator/tab_manager.h" 5 #include "chrome/browser/resource_coordinator/tab_manager.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <set> 10 #include <set>
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 129
130 TabManager::TabManager() 130 TabManager::TabManager()
131 : discard_count_(0), 131 : discard_count_(0),
132 recent_tab_discard_(false), 132 recent_tab_discard_(false),
133 discard_once_(false), 133 discard_once_(false),
134 #if !defined(OS_CHROMEOS) 134 #if !defined(OS_CHROMEOS)
135 minimum_protection_time_(base::TimeDelta::FromMinutes(10)), 135 minimum_protection_time_(base::TimeDelta::FromMinutes(10)),
136 #endif 136 #endif
137 browser_tab_strip_tracker_(this, nullptr, nullptr), 137 browser_tab_strip_tracker_(this, nullptr, nullptr),
138 test_tick_clock_(nullptr), 138 test_tick_clock_(nullptr),
139 in_session_restore_(false),
139 weak_ptr_factory_(this) { 140 weak_ptr_factory_(this) {
140 #if defined(OS_CHROMEOS) 141 #if defined(OS_CHROMEOS)
141 delegate_.reset(new TabManagerDelegate(weak_ptr_factory_.GetWeakPtr())); 142 delegate_.reset(new TabManagerDelegate(weak_ptr_factory_.GetWeakPtr()));
142 #endif 143 #endif
143 browser_tab_strip_tracker_.Init(); 144 browser_tab_strip_tracker_.Init();
144 } 145 }
145 146
146 TabManager::~TabManager() { 147 TabManager::~TabManager() {
147 Stop(); 148 Stop();
148 } 149 }
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after
468 469
469 // Being more recently active is more important. 470 // Being more recently active is more important.
470 return first.last_active > second.last_active; 471 return first.last_active > second.last_active;
471 } 472 }
472 473
473 // static 474 // static
474 int64_t TabManager::IdFromWebContents(WebContents* web_contents) { 475 int64_t TabManager::IdFromWebContents(WebContents* web_contents) {
475 return reinterpret_cast<int64_t>(web_contents); 476 return reinterpret_cast<int64_t>(web_contents);
476 } 477 }
477 478
479 void TabManager::OnSessionRestoreStarted() {
480 DCHECK(!in_session_restore_);
481 in_session_restore_ = true;
482 }
483
484 void TabManager::OnSessionRestoreEnded() {
485 DCHECK(in_session_restore_);
486 in_session_restore_ = false;
487 }
488
478 /////////////////////////////////////////////////////////////////////////////// 489 ///////////////////////////////////////////////////////////////////////////////
479 // TabManager, private: 490 // TabManager, private:
480 491
481 void TabManager::OnDiscardedStateChange(content::WebContents* contents, 492 void TabManager::OnDiscardedStateChange(content::WebContents* contents,
482 bool is_discarded) { 493 bool is_discarded) {
483 for (TabManagerObserver& observer : observers_) 494 for (TabManagerObserver& observer : observers_)
484 observer.OnDiscardedStateChange(contents, is_discarded); 495 observer.OnDiscardedStateChange(contents, is_discarded);
485 } 496 }
486 497
487 void TabManager::OnAutoDiscardableStateChange(content::WebContents* contents, 498 void TabManager::OnAutoDiscardableStateChange(content::WebContents* contents,
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after
897 browser_info.window_is_minimized = browser->window()->IsMinimized(); 908 browser_info.window_is_minimized = browser->window()->IsMinimized();
898 browser_info.window_bounds = browser->window()->GetBounds(); 909 browser_info.window_bounds = browser->window()->GetBounds();
899 browser_info.browser_is_app = browser->is_app(); 910 browser_info.browser_is_app = browser->is_app();
900 browser_info_list.push_back(browser_info); 911 browser_info_list.push_back(browser_info);
901 } 912 }
902 913
903 return browser_info_list; 914 return browser_info_list;
904 } 915 }
905 916
906 } // namespace resource_coordinator 917 } // namespace resource_coordinator
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698