Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(35)

Side by Side Diff: sync/internal_api/sync_rollback_manager.cc

Issue 363543002: Properly handle initialization failure and following manager shutdown without (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 use_ssl, post_factory.Pass(), 46 use_ssl, post_factory.Pass(),
47 workers, extensions_activity, change_delegate, 47 workers, extensions_activity, change_delegate,
48 credentials, invalidator_client_id, 48 credentials, invalidator_client_id,
49 restored_key_for_bootstrapping, 49 restored_key_for_bootstrapping,
50 restored_keystore_key_for_bootstrapping, 50 restored_keystore_key_for_bootstrapping,
51 internal_components_factory, encryptor, 51 internal_components_factory, encryptor,
52 unrecoverable_error_handler.Pass(), 52 unrecoverable_error_handler.Pass(),
53 report_unrecoverable_error_function, 53 report_unrecoverable_error_function,
54 cancelation_signal); 54 cancelation_signal);
55 55
56 if (!initialized())
57 return;
58
56 change_delegate_ = change_delegate; 59 change_delegate_ = change_delegate;
57 60
58 for (size_t i = 0; i < workers.size(); ++i) { 61 for (size_t i = 0; i < workers.size(); ++i) {
59 ModelSafeGroup group = workers[i]->GetModelSafeGroup(); 62 ModelSafeGroup group = workers[i]->GetModelSafeGroup();
60 CHECK(workers_.find(group) == workers_.end()); 63 CHECK(workers_.find(group) == workers_.end());
61 workers_[group] = workers[i]; 64 workers_[group] = workers[i];
62 } 65 }
63 66
64 rollback_ready_types_ = GetUserShare()->directory->InitialSyncEndedTypes(); 67 rollback_ready_types_ = GetUserShare()->directory->InitialSyncEndedTypes();
65 rollback_ready_types_.RetainAll(BackupTypes()); 68 rollback_ready_types_.RetainAll(BackupTypes());
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 } 140 }
138 141
139 void SyncRollbackManager::NotifyRollbackDone() { 142 void SyncRollbackManager::NotifyRollbackDone() {
140 SyncProtocolError error; 143 SyncProtocolError error;
141 error.action = ROLLBACK_DONE; 144 error.action = ROLLBACK_DONE;
142 FOR_EACH_OBSERVER(SyncManager::Observer, *GetObservers(), 145 FOR_EACH_OBSERVER(SyncManager::Observer, *GetObservers(),
143 OnActionableError(error)); 146 OnActionableError(error));
144 } 147 }
145 148
146 } // namespace syncer 149 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/internal_api/sync_backup_manager_unittest.cc ('k') | sync/internal_api/sync_rollback_manager_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698