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

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
« no previous file with comments | « no previous file | sync/internal_api/sync_backup_manager_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 if (!initialized())
54 return;
55
53 GetUserShare()->directory->CollectMetaHandleCounts( 56 GetUserShare()->directory->CollectMetaHandleCounts(
54 &status_.num_entries_by_type, 57 &status_.num_entries_by_type,
55 &status_.num_to_delete_entries_by_type); 58 &status_.num_to_delete_entries_by_type);
56 59
57 HideSyncPreference(PRIORITY_PREFERENCES); 60 HideSyncPreference(PRIORITY_PREFERENCES);
58 HideSyncPreference(PREFERENCES); 61 HideSyncPreference(PREFERENCES);
59 } 62 }
60 63
61 void SyncBackupManager::SaveChanges() { 64 void SyncBackupManager::SaveChanges() {
62 NormalizeEntries(); 65 if (initialized()) {
63 GetUserShare()->directory->SaveChanges(); 66 NormalizeEntries();
67 GetUserShare()->directory->SaveChanges();
68 }
64 } 69 }
65 70
66 SyncStatus SyncBackupManager::GetDetailedStatus() const { 71 SyncStatus SyncBackupManager::GetDetailedStatus() const {
67 return status_; 72 return status_;
68 } 73 }
69 74
70 ModelTypeSet SyncBackupManager::HandleTransactionEndingChangeEvent( 75 ModelTypeSet SyncBackupManager::HandleTransactionEndingChangeEvent(
71 const syncable::ImmutableWriteTransactionInfo& write_transaction_info, 76 const syncable::ImmutableWriteTransactionInfo& write_transaction_info,
72 syncable::BaseTransaction* trans) { 77 syncable::BaseTransaction* trans) {
73 ModelTypeSet types; 78 ModelTypeSet types;
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 155
151 void SyncBackupManager::UnregisterDirectoryTypeDebugInfoObserver( 156 void SyncBackupManager::UnregisterDirectoryTypeDebugInfoObserver(
152 syncer::TypeDebugInfoObserver* observer) {} 157 syncer::TypeDebugInfoObserver* observer) {}
153 158
154 bool SyncBackupManager::HasDirectoryTypeDebugInfoObserver( 159 bool SyncBackupManager::HasDirectoryTypeDebugInfoObserver(
155 syncer::TypeDebugInfoObserver* observer) { return false; } 160 syncer::TypeDebugInfoObserver* observer) { return false; }
156 161
157 void SyncBackupManager::RequestEmitDebugInfo() {} 162 void SyncBackupManager::RequestEmitDebugInfo() {}
158 163
159 } // namespace syncer 164 } // namespace syncer
OLDNEW
« no previous file with comments | « no previous file | sync/internal_api/sync_backup_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698