OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "sync/internal_api/sync_rollback_manager.h" | 5 #include "sync/internal_api/sync_rollback_manager.h" |
6 | 6 |
7 #include "sync/internal_api/public/base/model_type.h" | 7 #include "sync/internal_api/public/base/model_type.h" |
8 #include "sync/internal_api/public/read_node.h" | 8 #include "sync/internal_api/public/read_node.h" |
9 #include "sync/internal_api/public/read_transaction.h" | 9 #include "sync/internal_api/public/read_transaction.h" |
10 #include "sync/internal_api/public/util/syncer_error.h" | 10 #include "sync/internal_api/public/util/syncer_error.h" |
11 #include "sync/internal_api/public/write_transaction.h" | 11 #include "sync/internal_api/public/write_transaction.h" |
12 #include "sync/syncable/directory.h" | 12 #include "sync/syncable/directory.h" |
13 #include "sync/syncable/mutable_entry.h" | 13 #include "sync/syncable/mutable_entry.h" |
| 14 #include "url/gurl.h" |
14 | 15 |
15 namespace syncer { | 16 namespace syncer { |
16 | 17 |
17 SyncRollbackManager::SyncRollbackManager() | 18 SyncRollbackManager::SyncRollbackManager() |
18 : change_delegate_(NULL) { | 19 : change_delegate_(NULL) { |
19 } | 20 } |
20 | 21 |
21 SyncRollbackManager::~SyncRollbackManager() { | 22 SyncRollbackManager::~SyncRollbackManager() { |
22 } | 23 } |
23 | 24 |
24 void SyncRollbackManager::Init( | 25 void SyncRollbackManager::Init( |
25 const base::FilePath& database_location, | 26 const base::FilePath& database_location, |
26 const WeakHandle<JsEventHandler>& event_handler, | 27 const WeakHandle<JsEventHandler>& event_handler, |
27 const std::string& sync_server_and_path, | 28 const GURL& service_url, |
28 int sync_server_port, | 29 scoped_ptr<HttpPostProviderFactory> post_factory, |
29 bool use_ssl, | 30 const std::vector<scoped_refptr<ModelSafeWorker> >& workers, |
30 scoped_ptr<HttpPostProviderFactory> post_factory, | 31 ExtensionsActivity* extensions_activity, |
31 const std::vector<scoped_refptr<ModelSafeWorker> >& workers, | 32 SyncManager::ChangeDelegate* change_delegate, |
32 ExtensionsActivity* extensions_activity, | 33 const SyncCredentials& credentials, |
33 SyncManager::ChangeDelegate* change_delegate, | 34 const std::string& invalidator_client_id, |
34 const SyncCredentials& credentials, | 35 const std::string& restored_key_for_bootstrapping, |
35 const std::string& invalidator_client_id, | 36 const std::string& restored_keystore_key_for_bootstrapping, |
36 const std::string& restored_key_for_bootstrapping, | 37 InternalComponentsFactory* internal_components_factory, |
37 const std::string& restored_keystore_key_for_bootstrapping, | 38 Encryptor* encryptor, |
38 InternalComponentsFactory* internal_components_factory, | 39 scoped_ptr<UnrecoverableErrorHandler> unrecoverable_error_handler, |
39 Encryptor* encryptor, | 40 ReportUnrecoverableErrorFunction report_unrecoverable_error_function, |
40 scoped_ptr<UnrecoverableErrorHandler> unrecoverable_error_handler, | 41 CancelationSignal* cancelation_signal) { |
41 ReportUnrecoverableErrorFunction | |
42 report_unrecoverable_error_function, | |
43 CancelationSignal* cancelation_signal) { | |
44 if (SyncRollbackManagerBase::InitInternal( | 42 if (SyncRollbackManagerBase::InitInternal( |
45 database_location, | 43 database_location, |
46 internal_components_factory, | 44 internal_components_factory, |
47 unrecoverable_error_handler.Pass(), | 45 unrecoverable_error_handler.Pass(), |
48 report_unrecoverable_error_function)) { | 46 report_unrecoverable_error_function)) { |
49 change_delegate_ = change_delegate; | 47 change_delegate_ = change_delegate; |
50 | 48 |
51 for (size_t i = 0; i < workers.size(); ++i) { | 49 for (size_t i = 0; i < workers.size(); ++i) { |
52 ModelSafeGroup group = workers[i]->GetModelSafeGroup(); | 50 ModelSafeGroup group = workers[i]->GetModelSafeGroup(); |
53 CHECK(workers_.find(group) == workers_.end()); | 51 CHECK(workers_.find(group) == workers_.end()); |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 } | 129 } |
132 | 130 |
133 void SyncRollbackManager::NotifyRollbackDone() { | 131 void SyncRollbackManager::NotifyRollbackDone() { |
134 SyncProtocolError error; | 132 SyncProtocolError error; |
135 error.action = ROLLBACK_DONE; | 133 error.action = ROLLBACK_DONE; |
136 FOR_EACH_OBSERVER(SyncManager::Observer, *GetObservers(), | 134 FOR_EACH_OBSERVER(SyncManager::Observer, *GetObservers(), |
137 OnActionableError(error)); | 135 OnActionableError(error)); |
138 } | 136 } |
139 | 137 |
140 } // namespace syncer | 138 } // namespace syncer |
OLD | NEW |