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

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: Fix typo. Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/sessions/tab_loader.h ('k') | chrome/chrome_tests_unit.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sessions/tab_loader.cc
diff --git a/chrome/browser/sessions/tab_loader.cc b/chrome/browser/sessions/tab_loader.cc
index 98226b717633683458e3e6a51d82a1e221f9be37..0bff726d5ce68e67a3b9e632882622e1daa0fc0e 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"
@@ -49,13 +50,17 @@ void TabLoader::Observe(int type,
}
void TabLoader::SetTabLoadingEnabled(bool enable_tab_loading) {
+ // TODO(chrisha): Make the SessionRestoreStatsCollector aware that tab loading
+ // was explicitly stopped or restarted. This can make be used to invalidate
+ // various metrics.
if (enable_tab_loading == loading_enabled_)
return;
loading_enabled_ = enable_tab_loading;
- if (loading_enabled_)
+ if (loading_enabled_) {
LoadNextTab();
- else
+ } else {
force_load_timer_.Stop();
+ }
}
// static
@@ -64,6 +69,7 @@ void TabLoader::RestoreTabs(const std::vector<RestoredTab>& tabs,
if (!shared_tab_loader_)
shared_tab_loader_ = new TabLoader(restore_started);
+ shared_tab_loader_->stats_collector_->TrackTabs(tabs);
shared_tab_loader_->StartLoading(tabs);
}
@@ -73,6 +79,10 @@ TabLoader::TabLoader(base::TimeTicks restore_started)
force_load_delay_multiplier_(1),
loading_enabled_(true),
restore_started_(restore_started) {
+ stats_collector_ = new SessionRestoreStatsCollector(
+ restore_started,
+ make_scoped_ptr(
+ new SessionRestoreStatsCollector::UmaStatsReportingDelegate()));
shared_tab_loader_ = this;
this_retainer_ = this;
}
@@ -221,9 +231,13 @@ 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.
+ stats_collector_->DeferTab(tab);
}
// By calling |LoadNextTab| explicitly, we make sure that the
// |NOTIFICATION_SESSION_RESTORE_DONE| event gets sent.
« no previous file with comments | « chrome/browser/sessions/tab_loader.h ('k') | chrome/chrome_tests_unit.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698