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

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

Issue 1136523004: [Sessions] Add detailed logging of SessionRestore events. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Refactored per sky@'s suggestion. Created 5 years, 7 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
Index: chrome/browser/sessions/tab_loader.cc
diff --git a/chrome/browser/sessions/tab_loader.cc b/chrome/browser/sessions/tab_loader.cc
index bf1b00a0258d2b777399dc95c5984891bc02b319..bee50bcb8f00619a1a9ece6498a876866ef3f4b9 100644
--- a/chrome/browser/sessions/tab_loader.cc
+++ b/chrome/browser/sessions/tab_loader.cc
@@ -9,6 +9,7 @@
#include "base/metrics/histogram.h"
#include "base/strings/stringprintf.h"
+#include "chrome/browser/sessions/session_restore_stats_collector.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
@@ -214,9 +215,17 @@ void TabLoader::OnMemoryPressure(
// Stop the timer and suppress any tab loads while we clean the list.
SetTabLoadingEnabled(false);
while (!tabs_to_load_.empty()) {
- NavigationController* controller = tabs_to_load_.front();
+ NavigationController* tab = tabs_to_load_.front();
tabs_to_load_.pop_front();
- RemoveTab(controller);
+ RemoveTab(tab);
+
+ // Notify the stats collector that a tab's loading has been deferred due to
+ // memory pressure. It's possible for the stats collector to infer this on
+ // its own, but not in the presence of the above experiment, hence this is
+ // explicitly called.
+ // TODO(chrisha): Re-evaluate this was the memory-pressure experiment is
+ // finished.
+ SessionRestoreStatsCollector::DeferTab(tab);
}
// By calling |LoadNextTab| explicitly, we make sure that the
// |NOTIFICATION_SESSION_RESTORE_DONE| event gets sent.

Powered by Google App Engine
This is Rietveld 408576698