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

Side by Side Diff: components/sync/engine_impl/sync_scheduler_impl.cc

Issue 2494873003: [Sync] Allow sync start without sign-in if the local sync backend is on. (Closed)
Patch Set: Remove ifdefs around include. Created 4 years 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/engine_impl/sync_scheduler_impl.h" 5 #include "components/sync/engine_impl/sync_scheduler_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cstring> 8 #include <cstring>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 #define SLOG(severity) LOG(severity) << name_ << ": " 144 #define SLOG(severity) LOG(severity) << name_ << ": "
145 145
146 #define SDVLOG(verbose_level) DVLOG(verbose_level) << name_ << ": " 146 #define SDVLOG(verbose_level) DVLOG(verbose_level) << name_ << ": "
147 147
148 #define SDVLOG_LOC(from_here, verbose_level) \ 148 #define SDVLOG_LOC(from_here, verbose_level) \
149 DVLOG_LOC(from_here, verbose_level) << name_ << ": " 149 DVLOG_LOC(from_here, verbose_level) << name_ << ": "
150 150
151 SyncSchedulerImpl::SyncSchedulerImpl(const std::string& name, 151 SyncSchedulerImpl::SyncSchedulerImpl(const std::string& name,
152 BackoffDelayProvider* delay_provider, 152 BackoffDelayProvider* delay_provider,
153 SyncCycleContext* context, 153 SyncCycleContext* context,
154 Syncer* syncer) 154 Syncer* syncer,
155 bool ignore_auth_credentials)
155 : name_(name), 156 : name_(name),
156 started_(false), 157 started_(false),
157 syncer_short_poll_interval_seconds_( 158 syncer_short_poll_interval_seconds_(
158 TimeDelta::FromSeconds(kDefaultShortPollIntervalSeconds)), 159 TimeDelta::FromSeconds(kDefaultShortPollIntervalSeconds)),
159 syncer_long_poll_interval_seconds_( 160 syncer_long_poll_interval_seconds_(
160 TimeDelta::FromSeconds(kDefaultLongPollIntervalSeconds)), 161 TimeDelta::FromSeconds(kDefaultLongPollIntervalSeconds)),
161 mode_(CONFIGURATION_MODE), 162 mode_(CONFIGURATION_MODE),
162 delay_provider_(delay_provider), 163 delay_provider_(delay_provider),
163 syncer_(syncer), 164 syncer_(syncer),
164 cycle_context_(context), 165 cycle_context_(context),
165 next_sync_cycle_job_priority_(NORMAL_PRIORITY), 166 next_sync_cycle_job_priority_(NORMAL_PRIORITY),
167 ignore_auth_credentials_(ignore_auth_credentials),
166 weak_ptr_factory_(this), 168 weak_ptr_factory_(this),
167 weak_ptr_factory_for_weak_handle_(this) { 169 weak_ptr_factory_for_weak_handle_(this) {
168 weak_handle_this_ = 170 weak_handle_this_ =
169 MakeWeakHandle(weak_ptr_factory_for_weak_handle_.GetWeakPtr()); 171 MakeWeakHandle(weak_ptr_factory_for_weak_handle_.GetWeakPtr());
170 } 172 }
171 173
172 SyncSchedulerImpl::~SyncSchedulerImpl() { 174 SyncSchedulerImpl::~SyncSchedulerImpl() {
173 DCHECK(CalledOnValidThread()); 175 DCHECK(CalledOnValidThread());
174 Stop(); 176 Stop();
175 } 177 }
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 if (IsCurrentlyThrottled()) { 332 if (IsCurrentlyThrottled()) {
331 SDVLOG(1) << "Unable to run a job because we're throttled."; 333 SDVLOG(1) << "Unable to run a job because we're throttled.";
332 return false; 334 return false;
333 } 335 }
334 336
335 if (IsBackingOff() && priority != CANARY_PRIORITY) { 337 if (IsBackingOff() && priority != CANARY_PRIORITY) {
336 SDVLOG(1) << "Unable to run a job because we're backing off."; 338 SDVLOG(1) << "Unable to run a job because we're backing off.";
337 return false; 339 return false;
338 } 340 }
339 341
340 if (cycle_context_->connection_manager()->HasInvalidAuthToken()) { 342 if (!ignore_auth_credentials_ &&
343 cycle_context_->connection_manager()->HasInvalidAuthToken()) {
341 SDVLOG(1) << "Unable to run a job because we have no valid auth token."; 344 SDVLOG(1) << "Unable to run a job because we have no valid auth token.";
342 return false; 345 return false;
343 } 346 }
344 347
345 return true; 348 return true;
346 } 349 }
347 350
348 bool SyncSchedulerImpl::CanRunNudgeJobNow(JobPriority priority) { 351 bool SyncSchedulerImpl::CanRunNudgeJobNow(JobPriority priority) {
349 DCHECK(CalledOnValidThread()); 352 DCHECK(CalledOnValidThread());
350 353
(...skipping 622 matching lines...) Expand 10 before | Expand all | Expand 10 after
973 976
974 #undef SDVLOG_LOC 977 #undef SDVLOG_LOC
975 978
976 #undef SDVLOG 979 #undef SDVLOG
977 980
978 #undef SLOG 981 #undef SLOG
979 982
980 #undef ENUM_CASE 983 #undef ENUM_CASE
981 984
982 } // namespace syncer 985 } // namespace syncer
OLDNEW
« no previous file with comments | « components/sync/engine_impl/sync_scheduler_impl.h ('k') | components/sync/engine_impl/sync_scheduler_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698