| OLD | NEW |
| 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 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 349 if (IsCurrentlyThrottled()) { | 349 if (IsCurrentlyThrottled()) { |
| 350 SDVLOG(1) << "Unable to run a job because we're throttled."; | 350 SDVLOG(1) << "Unable to run a job because we're throttled."; |
| 351 return false; | 351 return false; |
| 352 } | 352 } |
| 353 | 353 |
| 354 if (IsBackingOff() && priority != CANARY_PRIORITY) { | 354 if (IsBackingOff() && priority != CANARY_PRIORITY) { |
| 355 SDVLOG(1) << "Unable to run a job because we're backing off."; | 355 SDVLOG(1) << "Unable to run a job because we're backing off."; |
| 356 return false; | 356 return false; |
| 357 } | 357 } |
| 358 | 358 |
| 359 if (cycle_context_->connection_manager()->HasInvalidAuthToken()) { | 359 // ### Only if needed. |
| 360 SDVLOG(1) << "Unable to run a job because we have no valid auth token."; | 360 //if (cycle_context_->connection_manager()->HasInvalidAuthToken()) { |
| 361 return false; | 361 // SDVLOG(1) << "Unable to run a job because we have no valid auth token."; |
| 362 } | 362 // return false; |
| 363 //} |
| 363 | 364 |
| 364 return true; | 365 return true; |
| 365 } | 366 } |
| 366 | 367 |
| 367 bool SyncSchedulerImpl::CanRunNudgeJobNow(JobPriority priority) { | 368 bool SyncSchedulerImpl::CanRunNudgeJobNow(JobPriority priority) { |
| 368 DCHECK(CalledOnValidThread()); | 369 DCHECK(CalledOnValidThread()); |
| 369 | 370 |
| 370 if (!CanRunJobNow(priority)) { | 371 if (!CanRunJobNow(priority)) { |
| 371 SDVLOG(1) << "Unable to run a nudge job right now"; | 372 SDVLOG(1) << "Unable to run a nudge job right now"; |
| 372 return false; | 373 return false; |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 513 } | 514 } |
| 514 } else { | 515 } else { |
| 515 HandleFailure(cycle->status_controller().model_neutral_state()); | 516 HandleFailure(cycle->status_controller().model_neutral_state()); |
| 516 } | 517 } |
| 517 } | 518 } |
| 518 | 519 |
| 519 void SyncSchedulerImpl::DoConfigurationSyncCycleJob(JobPriority priority) { | 520 void SyncSchedulerImpl::DoConfigurationSyncCycleJob(JobPriority priority) { |
| 520 DCHECK(CalledOnValidThread()); | 521 DCHECK(CalledOnValidThread()); |
| 521 DCHECK_EQ(mode_, CONFIGURATION_MODE); | 522 DCHECK_EQ(mode_, CONFIGURATION_MODE); |
| 522 DCHECK(pending_configure_params_ != NULL); | 523 DCHECK(pending_configure_params_ != NULL); |
| 523 | 524 LOG(ERROR) << "@@@@@ SyncSchedulerImpl::DoConfigurationSyncCycleJob 1"; |
| 524 if (!CanRunJobNow(priority)) { | 525 if (!CanRunJobNow(priority)) { |
| 525 SDVLOG(2) << "Unable to run configure job right now."; | 526 SDVLOG(2) << "Unable to run configure job right now."; |
| 526 RunAndReset(&pending_configure_params_->retry_task); | 527 RunAndReset(&pending_configure_params_->retry_task); |
| 527 return; | 528 return; |
| 528 } | 529 } |
| 529 | 530 |
| 531 LOG(ERROR) << "@@@@@ SyncSchedulerImpl::DoConfigurationSyncCycleJob 2"; |
| 530 SDVLOG(2) << "Will run configure SyncShare with types " | 532 SDVLOG(2) << "Will run configure SyncShare with types " |
| 531 << ModelTypeSetToString(cycle_context_->GetEnabledTypes()); | 533 << ModelTypeSetToString(cycle_context_->GetEnabledTypes()); |
| 532 std::unique_ptr<SyncCycle> cycle(SyncCycle::Build(cycle_context_, this)); | 534 std::unique_ptr<SyncCycle> cycle(SyncCycle::Build(cycle_context_, this)); |
| 533 bool success = syncer_->ConfigureSyncShare( | 535 bool success = syncer_->ConfigureSyncShare( |
| 534 pending_configure_params_->types_to_download, | 536 pending_configure_params_->types_to_download, |
| 535 pending_configure_params_->source, cycle.get()); | 537 pending_configure_params_->source, cycle.get()); |
| 536 | 538 |
| 537 if (success) { | 539 if (success) { |
| 540 LOG(ERROR) << "@@@@@ SyncSchedulerImpl::DoConfigurationSyncCycleJob 3"; |
| 538 SDVLOG(2) << "Configure succeeded."; | 541 SDVLOG(2) << "Configure succeeded."; |
| 539 pending_configure_params_->ready_task.Run(); | 542 pending_configure_params_->ready_task.Run(); |
| 540 pending_configure_params_.reset(); | 543 pending_configure_params_.reset(); |
| 541 HandleSuccess(); | 544 HandleSuccess(); |
| 542 } else { | 545 } else { |
| 546 LOG(ERROR) << "@@@@@ SyncSchedulerImpl::DoConfigurationSyncCycleJob 4"; |
| 543 HandleFailure(cycle->status_controller().model_neutral_state()); | 547 HandleFailure(cycle->status_controller().model_neutral_state()); |
| 544 // Sync cycle might receive response from server that causes scheduler to | 548 // Sync cycle might receive response from server that causes scheduler to |
| 545 // stop and draws pending_configure_params_ invalid. | 549 // stop and draws pending_configure_params_ invalid. |
| 546 if (started_) | 550 if (started_) |
| 547 RunAndReset(&pending_configure_params_->retry_task); | 551 RunAndReset(&pending_configure_params_->retry_task); |
| 548 } | 552 } |
| 549 } | 553 } |
| 550 | 554 |
| 551 void SyncSchedulerImpl::DoClearServerDataSyncCycleJob(JobPriority priority) { | 555 void SyncSchedulerImpl::DoClearServerDataSyncCycleJob(JobPriority priority) { |
| 552 DCHECK(CalledOnValidThread()); | 556 DCHECK(CalledOnValidThread()); |
| (...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 963 | 967 |
| 964 #undef SDVLOG_LOC | 968 #undef SDVLOG_LOC |
| 965 | 969 |
| 966 #undef SDVLOG | 970 #undef SDVLOG |
| 967 | 971 |
| 968 #undef SLOG | 972 #undef SLOG |
| 969 | 973 |
| 970 #undef ENUM_CASE | 974 #undef ENUM_CASE |
| 971 | 975 |
| 972 } // namespace syncer | 976 } // namespace syncer |
| OLD | NEW |