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

Side by Side Diff: components/sync/driver/startup_controller.cc

Issue 2106743002: WIP: Local sync only... (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix after rebase. Created 4 years, 2 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/sync/driver/startup_controller.h" 5 #include "components/sync/driver/startup_controller.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 if (setup_in_progress_) { 80 if (setup_in_progress_) {
81 TryStart(); 81 TryStart();
82 } 82 }
83 } 83 }
84 84
85 bool StartupController::StartUp(StartUpDeferredOption deferred_option) { 85 bool StartupController::StartUp(StartUpDeferredOption deferred_option) {
86 const bool first_start = start_up_time_.is_null(); 86 const bool first_start = start_up_time_.is_null();
87 if (first_start) 87 if (first_start)
88 start_up_time_ = base::Time::Now(); 88 start_up_time_ = base::Time::Now();
89 89
90 LOG(ERROR) << "@@@ StartupController::StartUp " << deferred_option;
91
90 if (deferred_option == STARTUP_BACKEND_DEFERRED && 92 if (deferred_option == STARTUP_BACKEND_DEFERRED &&
91 !base::CommandLine::ForCurrentProcess()->HasSwitch( 93 !base::CommandLine::ForCurrentProcess()->HasSwitch(
92 switches::kSyncDisableDeferredStartup) && 94 switches::kSyncDisableDeferredStartup) &&
93 sync_prefs_->GetPreferredDataTypes(registered_types_) 95 sync_prefs_->GetPreferredDataTypes(registered_types_)
94 .Has(syncer::SESSIONS)) { 96 .Has(syncer::SESSIONS)) {
95 if (first_start) { 97 if (first_start) {
96 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( 98 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
97 FROM_HERE, 99 FROM_HERE,
98 base::Bind(&StartupController::OnFallbackStartupTimerExpired, 100 base::Bind(&StartupController::OnFallbackStartupTimerExpired,
99 weak_factory_.GetWeakPtr()), 101 weak_factory_.GetWeakPtr()),
100 fallback_timeout_); 102 fallback_timeout_);
101 } 103 }
102 return false; 104 return false;
103 } 105 }
104 106
105 if (start_backend_time_.is_null()) { 107 if (start_backend_time_.is_null()) {
106 start_backend_time_ = base::Time::Now(); 108 start_backend_time_ = base::Time::Now();
109 LOG(ERROR) << "@@@@ DO IT NOW!";
107 start_backend_.Run(); 110 start_backend_.Run();
108 } 111 }
109 112
110 return true; 113 return true;
111 } 114 }
112 115
113 void StartupController::OverrideFallbackTimeoutForTest( 116 void StartupController::OverrideFallbackTimeoutForTest(
114 const base::TimeDelta& timeout) { 117 const base::TimeDelta& timeout) {
115 fallback_timeout_ = timeout; 118 fallback_timeout_ = timeout;
116 } 119 }
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 if (!start_up_time_.is_null()) { 199 if (!start_up_time_.is_null()) {
197 RecordTimeDeferred(); 200 RecordTimeDeferred();
198 UMA_HISTOGRAM_ENUMERATION("Sync.Startup.DeferredInitTrigger", 201 UMA_HISTOGRAM_ENUMERATION("Sync.Startup.DeferredInitTrigger",
199 TRIGGER_DATA_TYPE_REQUEST, MAX_TRIGGER_VALUE); 202 TRIGGER_DATA_TYPE_REQUEST, MAX_TRIGGER_VALUE);
200 } 203 }
201 received_start_request_ = true; 204 received_start_request_ = true;
202 TryStart(); 205 TryStart();
203 } 206 }
204 207
205 } // namespace browser_sync 208 } // namespace browser_sync
OLDNEW
« no previous file with comments | « components/sync/driver/glue/sync_backend_host_core.cc ('k') | components/sync/engine_impl/net/loopback_connection_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698