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

Side by Side Diff: sync/internal_api/sync_backup_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_backup_manager.h" 5 #include "sync/internal_api/sync_backup_manager.h"
6 6
7 #include "sync/internal_api/public/read_node.h" 7 #include "sync/internal_api/public/read_node.h"
8 #include "sync/internal_api/public/write_transaction.h" 8 #include "sync/internal_api/public/write_transaction.h"
9 #include "sync/syncable/directory.h" 9 #include "sync/syncable/directory.h"
10 #include "sync/syncable/mutable_entry.h" 10 #include "sync/syncable/mutable_entry.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 use_ssl, post_factory.Pass(), 43 use_ssl, post_factory.Pass(),
44 workers, extensions_activity, change_delegate, 44 workers, extensions_activity, change_delegate,
45 credentials, invalidator_client_id, 45 credentials, invalidator_client_id,
46 restored_key_for_bootstrapping, 46 restored_key_for_bootstrapping,
47 restored_keystore_key_for_bootstrapping, 47 restored_keystore_key_for_bootstrapping,
48 internal_components_factory, encryptor, 48 internal_components_factory, encryptor,
49 unrecoverable_error_handler.Pass(), 49 unrecoverable_error_handler.Pass(),
50 report_unrecoverable_error_function, 50 report_unrecoverable_error_function,
51 cancelation_signal); 51 cancelation_signal);
52 52
53 GetUserShare()->directory->CollectMetaHandleCounts( 53 if (initialized()) {
Nicolas Zea 2014/07/02 18:48:07 nit: I find it clear to do if (!initialized()) ret
haitaol1 2014/07/02 21:42:18 Done.
54 GetUserShare()->directory->CollectMetaHandleCounts(
54 &status_.num_entries_by_type, 55 &status_.num_entries_by_type,
55 &status_.num_to_delete_entries_by_type); 56 &status_.num_to_delete_entries_by_type);
56 57
57 HideSyncPreference(PRIORITY_PREFERENCES); 58 HideSyncPreference(PRIORITY_PREFERENCES);
58 HideSyncPreference(PREFERENCES); 59 HideSyncPreference(PREFERENCES);
60 }
59 } 61 }
60 62
61 void SyncBackupManager::SaveChanges() { 63 void SyncBackupManager::SaveChanges() {
62 NormalizeEntries(); 64 if (initialized()) {
63 GetUserShare()->directory->SaveChanges(); 65 NormalizeEntries();
66 GetUserShare()->directory->SaveChanges();
67 }
64 } 68 }
65 69
66 SyncStatus SyncBackupManager::GetDetailedStatus() const { 70 SyncStatus SyncBackupManager::GetDetailedStatus() const {
67 return status_; 71 return status_;
68 } 72 }
69 73
70 ModelTypeSet SyncBackupManager::HandleTransactionEndingChangeEvent( 74 ModelTypeSet SyncBackupManager::HandleTransactionEndingChangeEvent(
71 const syncable::ImmutableWriteTransactionInfo& write_transaction_info, 75 const syncable::ImmutableWriteTransactionInfo& write_transaction_info,
72 syncable::BaseTransaction* trans) { 76 syncable::BaseTransaction* trans) {
73 ModelTypeSet types; 77 ModelTypeSet types;
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 154
151 void SyncBackupManager::UnregisterDirectoryTypeDebugInfoObserver( 155 void SyncBackupManager::UnregisterDirectoryTypeDebugInfoObserver(
152 syncer::TypeDebugInfoObserver* observer) {} 156 syncer::TypeDebugInfoObserver* observer) {}
153 157
154 bool SyncBackupManager::HasDirectoryTypeDebugInfoObserver( 158 bool SyncBackupManager::HasDirectoryTypeDebugInfoObserver(
155 syncer::TypeDebugInfoObserver* observer) { return false; } 159 syncer::TypeDebugInfoObserver* observer) { return false; }
156 160
157 void SyncBackupManager::RequestEmitDebugInfo() {} 161 void SyncBackupManager::RequestEmitDebugInfo() {}
158 162
159 } // namespace syncer 163 } // namespace syncer
OLDNEW
« no previous file with comments | « no previous file | sync/internal_api/sync_backup_manager_unittest.cc » ('j') | sync/internal_api/sync_backup_manager_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698