Commit 40da4ce2 authored by Marc Treib's avatar Marc Treib Committed by Commit Bot

Sync StartupController: remove unused return values

Before this CL, TryStart and TryStartImmediately returned a bool.
However, nobody actually consumed it, and IMO its meaning was unclear
and more confusing than helpful. This CL removes the return values.

Bug: none
Change-Id: Ib9ff4786bd888d0fbefad7d89fc26be1e681238f
Reviewed-on: https://chromium-review.googlesource.com/1054876Reviewed-by: default avatarvitaliii <vitaliii@chromium.org>
Commit-Queue: Marc Treib <treib@chromium.org>
Cr-Commit-Position: refs/heads/master@{#557861}
parent 2794e1b2
......@@ -80,10 +80,11 @@ void StartupController::SetSetupInProgress(bool setup_in_progress) {
}
}
bool StartupController::StartUp(StartUpDeferredOption deferred_option) {
void StartupController::StartUp(StartUpDeferredOption deferred_option) {
const bool first_start = start_up_time_.is_null();
if (first_start)
if (first_start) {
start_up_time_ = base::Time::Now();
}
if (deferred_option == STARTUP_DEFERRED &&
!base::CommandLine::ForCurrentProcess()->HasSwitch(
......@@ -96,15 +97,13 @@ bool StartupController::StartUp(StartUpDeferredOption deferred_option) {
weak_factory_.GetWeakPtr()),
fallback_timeout_);
}
return false;
return;
}
if (start_engine_time_.is_null()) {
start_engine_time_ = base::Time::Now();
start_engine_.Run();
}
return true;
}
void StartupController::OverrideFallbackTimeoutForTest(
......@@ -112,9 +111,10 @@ void StartupController::OverrideFallbackTimeoutForTest(
fallback_timeout_ = timeout;
}
bool StartupController::TryStart() {
if (!can_start_.Run())
return false;
void StartupController::TryStart() {
if (!can_start_.Run()) {
return;
}
// For performance reasons, defer the heavy lifting for sync init unless:
//
......@@ -124,19 +124,16 @@ bool StartupController::TryStart() {
// Do not start up the sync engine if setup has not completed and isn't
// in progress, unless told to otherwise.
if (setup_in_progress_) {
return StartUp(STARTUP_IMMEDIATE);
StartUp(STARTUP_IMMEDIATE);
} else if (sync_prefs_->IsFirstSetupComplete() || bypass_setup_complete_) {
return StartUp(received_start_request_ ? STARTUP_IMMEDIATE
: STARTUP_DEFERRED);
} else {
return false;
StartUp(received_start_request_ ? STARTUP_IMMEDIATE : STARTUP_DEFERRED);
}
}
bool StartupController::TryStartImmediately() {
void StartupController::TryStartImmediately() {
received_start_request_ = true;
bypass_setup_complete_ = true;
return TryStart();
TryStart();
}
void StartupController::RecordTimeDeferred() {
......
......@@ -26,13 +26,11 @@ class StartupController {
~StartupController();
// Starts up sync if it is requested by the user and preconditions are met.
// Returns true if these preconditions are met, although does not imply
// the engine was started.
bool TryStart();
void TryStart();
// Same as TryStart() above, but bypasses deferred startup and the first setup
// complete check.
bool TryStartImmediately();
void TryStartImmediately();
// Called when a datatype (SyncableService) has a need for sync to start
// ASAP, presumably because a local change event has occurred but we're
......@@ -60,8 +58,8 @@ class StartupController {
private:
enum StartUpDeferredOption { STARTUP_DEFERRED, STARTUP_IMMEDIATE };
// Returns true if all conditions to start the engine are met.
bool StartUp(StartUpDeferredOption deferred_option);
void StartUp(StartUpDeferredOption deferred_option);
void OnFallbackStartupTimerExpired();
// Records time spent in deferred state with UMA histograms.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment