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/callback_old.h" | 7 #include "base/callback_old.h" |
8 #include "chrome/browser/sync/engine/model_safe_worker.h" | 8 #include "chrome/browser/sync/engine/model_safe_worker.h" |
9 #include "chrome/browser/sync/sessions/status_controller.h" | 9 #include "chrome/browser/sync/sessions/status_controller.h" |
10 #include "chrome/browser/sync/sessions/sync_session.h" | 10 #include "chrome/browser/sync/sessions/sync_session.h" |
11 #include "chrome/browser/sync/sessions/unrecoverable_error_info.h" | |
11 | 12 |
12 namespace browser_sync { | 13 namespace browser_sync { |
14 using sessions::UnrecoverableErrorInfo; | |
13 | 15 |
14 void ModelChangingSyncerCommand::ExecuteImpl(sessions::SyncSession* session) { | 16 void ModelChangingSyncerCommand::ExecuteImpl(sessions::SyncSession* session) { |
15 work_session_ = session; | 17 work_session_ = session; |
16 if (!ModelNeutralExecuteImpl(work_session_)) { | 18 if (!ModelNeutralExecuteImpl(work_session_)) { |
17 return; | 19 return; |
18 } | 20 } |
19 | 21 |
20 // Project the list of active types (i.e., types in the routing | 22 // Project the list of active types (i.e., types in the routing |
21 // info) to a list of groups. | 23 // info) to a list of groups. |
22 // | 24 // |
(...skipping 15 matching lines...) Expand all Loading... | |
38 ModelSafeGroup group = worker->GetModelSafeGroup(); | 40 ModelSafeGroup group = worker->GetModelSafeGroup(); |
39 // Skip workers whose group isn't active. | 41 // Skip workers whose group isn't active. |
40 if (active_groups.find(group) == active_groups.end()) { | 42 if (active_groups.find(group) == active_groups.end()) { |
41 VLOG(2) << "Skipping worker for group " | 43 VLOG(2) << "Skipping worker for group " |
42 << ModelSafeGroupToString(group); | 44 << ModelSafeGroupToString(group); |
43 continue; | 45 continue; |
44 } | 46 } |
45 | 47 |
46 sessions::StatusController* status = work_session_->status_controller(); | 48 sessions::StatusController* status = work_session_->status_controller(); |
47 sessions::ScopedModelSafeGroupRestriction r(status, group); | 49 sessions::ScopedModelSafeGroupRestriction r(status, group); |
48 scoped_ptr<Callback0::Type> c(NewCallback(this, | 50 WorkCallback c = base::Bind( |
49 &ModelChangingSyncerCommand::StartChangingModel)); | 51 &ModelChangingSyncerCommand::StartChangingModel, |
50 worker->DoWorkAndWaitUntilDone(c.get()); | 52 base::Unretained(this)); |
akalin
2011/10/26 00:25:05
Add a comment saying that it's safe to use Unretai
lipalani1
2011/10/26 01:39:11
Done.
| |
53 | |
54 UnrecoverableErrorInfo error_info = worker->DoWorkAndWaitUntilDone(c); | |
akalin
2011/10/26 00:25:05
this will probably trigger a compiler warning/erro
lipalani1
2011/10/26 01:39:11
Done.
| |
55 | |
56 // TODO(lipalani): Check if there is an unrecoverable error from error_info | |
57 // and do apropriate actions. | |
51 } | 58 } |
52 } | 59 } |
53 | 60 |
54 bool ModelChangingSyncerCommand::ModelNeutralExecuteImpl( | 61 bool ModelChangingSyncerCommand::ModelNeutralExecuteImpl( |
55 sessions::SyncSession* session) { | 62 sessions::SyncSession* session) { |
56 return true; | 63 return true; |
57 } | 64 } |
58 | 65 |
59 } // namespace browser_sync | 66 } // namespace browser_sync |
OLD | NEW |