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

Unified Diff: chrome/browser/sessions/session_restore.cc

Issue 902613003: Record the number of tabs in a session restore in SampledProfile (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add more detailed description of meaning of num tabs, given by sky Created 5 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/sessions/session_restore.h ('k') | chrome/browser/sessions/session_restore_test_helper.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sessions/session_restore.cc
diff --git a/chrome/browser/sessions/session_restore.cc b/chrome/browser/sessions/session_restore.cc
index 83b71f4e94be868960976a944364dbdb4f5f8c26..0c26a3e0d9e1573dc8fd80b4f34350eae84eae6e 100644
--- a/chrome/browser/sessions/session_restore.cc
+++ b/chrome/browser/sessions/session_restore.cc
@@ -335,7 +335,7 @@ void TabLoader::LoadNextTab() {
// When the session restore is done synchronously, notification is sent from
// SessionRestoreImpl::Restore .
if (tabs_to_load_.empty() && !SessionRestore::IsRestoringSynchronously()) {
- on_session_restored_callbacks_->Notify();
+ on_session_restored_callbacks_->Notify(tab_count_);
}
}
@@ -641,8 +641,13 @@ class SessionRestoreImpl : public content::NotificationObserver {
loop.Run();
quit_closure_for_sync_restore_ = base::Closure();
}
+ // Count the total number of tabs in |windows_|.
+ int total_num_tabs = 0;
+ for (int i = 0; i < static_cast<int>(windows_.size()); ++i)
+ total_num_tabs += windows_[i]->tabs.size();
+
Browser* browser = ProcessSessionWindows(&windows_, active_window_id_);
- on_session_restored_callbacks_->Notify();
+ on_session_restored_callbacks_->Notify(total_num_tabs);
delete this;
return browser;
}
@@ -1354,10 +1359,10 @@ bool SessionRestore::IsRestoringSynchronously() {
// static
SessionRestore::CallbackSubscription
SessionRestore::RegisterOnSessionRestoredCallback(
- const base::Closure& callback) {
+ const base::Callback<void(int)>& callback) {
return on_session_restored_callbacks()->Add(callback);
}
// static
-base::CallbackList<void(void)>*
+base::CallbackList<void(int)>*
SessionRestore::on_session_restored_callbacks_ = nullptr;
« no previous file with comments | « chrome/browser/sessions/session_restore.h ('k') | chrome/browser/sessions/session_restore_test_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698