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

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

Issue 1130673003: Make session restore forced tab load delay Finch configurable, and separate first tab loads from su… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Cleaned up comments. 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
« no previous file with comments | « chrome/browser/sessions/tab_loader_delegate.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sessions/tab_loader_delegate.cc
diff --git a/chrome/browser/sessions/tab_loader_delegate.cc b/chrome/browser/sessions/tab_loader_delegate.cc
index 640495ed68077d5f8379997dd0b7d310c539196f..251096cb66d9665d787f4f886374e0e327ed6b43 100644
--- a/chrome/browser/sessions/tab_loader_delegate.cc
+++ b/chrome/browser/sessions/tab_loader_delegate.cc
@@ -4,6 +4,8 @@
#include "chrome/browser/sessions/tab_loader_delegate.h"
+#include "base/strings/string_number_conversions.h"
+#include "components/variations/variations_associated_data.h"
#include "net/base/network_change_notifier.h"
namespace {
@@ -22,8 +24,13 @@ class TabLoaderDelegateImpl
~TabLoaderDelegateImpl() override;
// TabLoaderDelegate:
+ base::TimeDelta GetFirstTabLoadingTimeout() const override {
+ return first_timeout_;
+ }
+
+ // TabLoaderDelegate:
base::TimeDelta GetTimeoutBeforeLoadingNextTab() const override {
- return base::TimeDelta::FromMilliseconds(kInitialDelayTimerMS);
+ return timeout_;
}
// net::NetworkChangeNotifier::ConnectionTypeObserver:
@@ -34,6 +41,10 @@ class TabLoaderDelegateImpl
// The function to call when the connection type changes.
TabLoaderCallback* callback_;
+ // The timeouts to use in tab loading.
+ base::TimeDelta first_timeout_;
+ base::TimeDelta timeout_;
+
DISALLOW_COPY_AND_ASSIGN(TabLoaderDelegateImpl);
};
@@ -47,6 +58,28 @@ TabLoaderDelegateImpl::TabLoaderDelegateImpl(TabLoaderCallback* callback)
// distributes network access, we can remove this.
callback->SetTabLoadingEnabled(false);
}
+
+ // Initialize the timeouts to use from the session restore field trial.
+ // Default to the usual value if none is specified.
+
+ static const char kIntelligentSessionRestore[] = "IntelligentSessionRestore";
+ std::string timeout = variations::GetVariationParamValue(
+ kIntelligentSessionRestore, "FirstTabLoadTimeoutMs");
+ int timeout_ms = 0;
+ if (timeout.empty() || !base::StringToInt(timeout, &timeout_ms) ||
+ timeout_ms <= 0) {
+ timeout_ms = kInitialDelayTimerMS;
+ }
+ first_timeout_ = base::TimeDelta::FromMilliseconds(timeout_ms);
+
+ timeout = variations::GetVariationParamValue(
+ kIntelligentSessionRestore, "TabLoadTimeoutMs");
+ timeout_ms = 0;
+ if (timeout.empty() || !base::StringToInt(timeout, &timeout_ms) ||
+ timeout_ms <= 0) {
+ timeout_ms = kInitialDelayTimerMS;
+ }
+ timeout_ = base::TimeDelta::FromMilliseconds(timeout_ms);
}
TabLoaderDelegateImpl::~TabLoaderDelegateImpl() {
« no previous file with comments | « chrome/browser/sessions/tab_loader_delegate.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698