| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/sync/engine/model_changing_syncer_command.h" | 5 #include "chrome/browser/sync/engine/model_changing_syncer_command.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/callback_old.h" | 8 #include "base/callback_old.h" |
| 9 #include "chrome/browser/sync/engine/model_safe_worker.h" | 9 #include "chrome/browser/sync/engine/model_safe_worker.h" |
| 10 #include "chrome/browser/sync/sessions/status_controller.h" | 10 #include "chrome/browser/sync/sessions/status_controller.h" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 for (size_t i = 0; i < session->workers().size(); ++i) { | 38 for (size_t i = 0; i < session->workers().size(); ++i) { |
| 39 ModelSafeWorker* worker = session->workers()[i]; | 39 ModelSafeWorker* worker = session->workers()[i]; |
| 40 ModelSafeGroup group = worker->GetModelSafeGroup(); | 40 ModelSafeGroup group = worker->GetModelSafeGroup(); |
| 41 // Skip workers whose group isn't active. | 41 // Skip workers whose group isn't active. |
| 42 if (active_groups.find(group) == active_groups.end()) { | 42 if (active_groups.find(group) == active_groups.end()) { |
| 43 VLOG(2) << "Skipping worker for group " | 43 VLOG(2) << "Skipping worker for group " |
| 44 << ModelSafeGroupToString(group); | 44 << ModelSafeGroupToString(group); |
| 45 continue; | 45 continue; |
| 46 } | 46 } |
| 47 | 47 |
| 48 sessions::StatusController* status = work_session_->status_controller(); | 48 sessions::StatusController* status = |
| 49 work_session_->mutable_status_controller(); |
| 49 sessions::ScopedModelSafeGroupRestriction r(status, group); | 50 sessions::ScopedModelSafeGroupRestriction r(status, group); |
| 50 WorkCallback c = base::Bind( | 51 WorkCallback c = base::Bind( |
| 51 &ModelChangingSyncerCommand::StartChangingModel, | 52 &ModelChangingSyncerCommand::StartChangingModel, |
| 52 // We wait until the callback is executed. So it is safe to use | 53 // We wait until the callback is executed. So it is safe to use |
| 53 // unretained. | 54 // unretained. |
| 54 base::Unretained(this)); | 55 base::Unretained(this)); |
| 55 | 56 |
| 56 // TODO(lipalani): Check the return value for an unrecoverable error. | 57 // TODO(lipalani): Check the return value for an unrecoverable error. |
| 57 ignore_result(worker->DoWorkAndWaitUntilDone(c)); | 58 ignore_result(worker->DoWorkAndWaitUntilDone(c)); |
| 58 | 59 |
| 59 } | 60 } |
| 60 } | 61 } |
| 61 | 62 |
| 62 bool ModelChangingSyncerCommand::ModelNeutralExecuteImpl( | 63 bool ModelChangingSyncerCommand::ModelNeutralExecuteImpl( |
| 63 sessions::SyncSession* session) { | 64 sessions::SyncSession* session) { |
| 64 return true; | 65 return true; |
| 65 } | 66 } |
| 66 | 67 |
| 67 } // namespace browser_sync | 68 } // namespace browser_sync |
| OLD | NEW |