| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 <algorithm> | 5 #include <algorithm> |
| 6 #include <functional> | 6 #include <functional> |
| 7 | 7 |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/task.h" | 10 #include "base/task.h" |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 } | 219 } |
| 220 | 220 |
| 221 // Pause the sync backend before starting the data types. | 221 // Pause the sync backend before starting the data types. |
| 222 state_ = PAUSE_PENDING; | 222 state_ = PAUSE_PENDING; |
| 223 PauseSyncer(); | 223 PauseSyncer(); |
| 224 } | 224 } |
| 225 | 225 |
| 226 void DataTypeManagerImpl::StartNextType() { | 226 void DataTypeManagerImpl::StartNextType() { |
| 227 // If there are any data types left to start, start the one at the | 227 // If there are any data types left to start, start the one at the |
| 228 // front of the list. | 228 // front of the list. |
| 229 if (needs_start_.size() > 0) { | 229 if (!needs_start_.empty()) { |
| 230 current_dtc_ = needs_start_[0]; | 230 current_dtc_ = needs_start_[0]; |
| 231 VLOG(1) << "Starting " << current_dtc_->name(); | 231 VLOG(1) << "Starting " << current_dtc_->name(); |
| 232 current_dtc_->Start( | 232 current_dtc_->Start( |
| 233 NewCallback(this, &DataTypeManagerImpl::TypeStartCallback)); | 233 NewCallback(this, &DataTypeManagerImpl::TypeStartCallback)); |
| 234 return; | 234 return; |
| 235 } | 235 } |
| 236 | 236 |
| 237 // If no more data types need starting, we're done. Resume the sync | 237 // If no more data types need starting, we're done. Resume the sync |
| 238 // backend to finish. | 238 // backend to finish. |
| 239 DCHECK_EQ(state_, CONFIGURING); | 239 DCHECK_EQ(state_, CONFIGURING); |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 476 AddObserver(NotificationType::SYNC_PAUSED); | 476 AddObserver(NotificationType::SYNC_PAUSED); |
| 477 pause_pending_ = true; | 477 pause_pending_ = true; |
| 478 if (!backend_->RequestPause()) { | 478 if (!backend_->RequestPause()) { |
| 479 pause_pending_ = false; | 479 pause_pending_ = false; |
| 480 RemoveObserver(NotificationType::SYNC_PAUSED); | 480 RemoveObserver(NotificationType::SYNC_PAUSED); |
| 481 FinishStopAndNotify(UNRECOVERABLE_ERROR); | 481 FinishStopAndNotify(UNRECOVERABLE_ERROR); |
| 482 } | 482 } |
| 483 } | 483 } |
| 484 | 484 |
| 485 } // namespace browser_sync | 485 } // namespace browser_sync |
| OLD | NEW |