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

Side by Side Diff: components/sync/syncable/on_disk_directory_backing_store.cc

Issue 2915453002: Deprecate NonThreadSafe in components/sync in favor of SequenceChecker. (Closed)
Patch Set: fix comment Created 3 years, 6 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
« no previous file with comments | « components/sync/syncable/directory_backing_store.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "components/sync/syncable/on_disk_directory_backing_store.h" 5 #include "components/sync/syncable/on_disk_directory_backing_store.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/metrics/histogram_macros.h" 8 #include "base/metrics/histogram_macros.h"
9 9
10 namespace syncer { 10 namespace syncer {
(...skipping 17 matching lines...) Expand all
28 DCHECK(backing_file_path_.IsAbsolute()); 28 DCHECK(backing_file_path_.IsAbsolute());
29 } 29 }
30 30
31 OnDiskDirectoryBackingStore::~OnDiskDirectoryBackingStore() {} 31 OnDiskDirectoryBackingStore::~OnDiskDirectoryBackingStore() {}
32 32
33 DirOpenResult OnDiskDirectoryBackingStore::TryLoad( 33 DirOpenResult OnDiskDirectoryBackingStore::TryLoad(
34 Directory::MetahandlesMap* handles_map, 34 Directory::MetahandlesMap* handles_map,
35 JournalIndex* delete_journals, 35 JournalIndex* delete_journals,
36 MetahandleSet* metahandles_to_purge, 36 MetahandleSet* metahandles_to_purge,
37 Directory::KernelLoadInfo* kernel_load_info) { 37 Directory::KernelLoadInfo* kernel_load_info) {
38 DCHECK(CalledOnValidThread()); 38 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
39 39
40 if (!IsOpen()) { 40 if (!IsOpen()) {
41 if (!Open(backing_file_path_)) 41 if (!Open(backing_file_path_))
42 return FAILED_OPEN_DATABASE; 42 return FAILED_OPEN_DATABASE;
43 } 43 }
44 44
45 if (!InitializeTables()) 45 if (!InitializeTables())
46 return FAILED_OPEN_DATABASE; 46 return FAILED_OPEN_DATABASE;
47 47
48 if (!LoadEntries(handles_map, metahandles_to_purge)) 48 if (!LoadEntries(handles_map, metahandles_to_purge))
49 return FAILED_DATABASE_CORRUPT; 49 return FAILED_DATABASE_CORRUPT;
50 if (!LoadDeleteJournals(delete_journals)) 50 if (!LoadDeleteJournals(delete_journals))
51 return FAILED_DATABASE_CORRUPT; 51 return FAILED_DATABASE_CORRUPT;
52 if (!LoadInfo(kernel_load_info)) 52 if (!LoadInfo(kernel_load_info))
53 return FAILED_DATABASE_CORRUPT; 53 return FAILED_DATABASE_CORRUPT;
54 if (!VerifyReferenceIntegrity(handles_map)) 54 if (!VerifyReferenceIntegrity(handles_map))
55 return FAILED_DATABASE_CORRUPT; 55 return FAILED_DATABASE_CORRUPT;
56 56
57 return OPENED; 57 return OPENED;
58 } 58 }
59 59
60 DirOpenResult OnDiskDirectoryBackingStore::Load( 60 DirOpenResult OnDiskDirectoryBackingStore::Load(
61 Directory::MetahandlesMap* handles_map, 61 Directory::MetahandlesMap* handles_map,
62 JournalIndex* delete_journals, 62 JournalIndex* delete_journals,
63 MetahandleSet* metahandles_to_purge, 63 MetahandleSet* metahandles_to_purge,
64 Directory::KernelLoadInfo* kernel_load_info) { 64 Directory::KernelLoadInfo* kernel_load_info) {
65 DCHECK(CalledOnValidThread()); 65 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
66 DirOpenResult result = TryLoad(handles_map, delete_journals, 66 DirOpenResult result = TryLoad(handles_map, delete_journals,
67 metahandles_to_purge, kernel_load_info); 67 metahandles_to_purge, kernel_load_info);
68 if (result == OPENED) { 68 if (result == OPENED) {
69 UMA_HISTOGRAM_ENUMERATION("Sync.DirectoryOpenResult", FIRST_TRY_SUCCESS, 69 UMA_HISTOGRAM_ENUMERATION("Sync.DirectoryOpenResult", FIRST_TRY_SUCCESS,
70 RESULT_COUNT); 70 RESULT_COUNT);
71 return OPENED; 71 return OPENED;
72 } 72 }
73 73
74 ReportFirstTryOpenFailure(); 74 ReportFirstTryOpenFailure();
75 75
(...skipping 25 matching lines...) Expand all
101 // might be sqlite's fault, but it could also be a bug in sync. We crash 101 // might be sqlite's fault, but it could also be a bug in sync. We crash
102 // immediately so a developer can investigate. 102 // immediately so a developer can investigate.
103 // 103 //
104 // Developers: If you're not interested in debugging this right now, just move 104 // Developers: If you're not interested in debugging this right now, just move
105 // aside the 'Sync Data' directory in your profile. This is similar to what 105 // aside the 'Sync Data' directory in your profile. This is similar to what
106 // the code would do if this DCHECK were disabled. 106 // the code would do if this DCHECK were disabled.
107 NOTREACHED() << "Crashing to preserve corrupt sync database"; 107 NOTREACHED() << "Crashing to preserve corrupt sync database";
108 } 108 }
109 109
110 const base::FilePath& OnDiskDirectoryBackingStore::backing_file_path() const { 110 const base::FilePath& OnDiskDirectoryBackingStore::backing_file_path() const {
111 DCHECK(CalledOnValidThread()); 111 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
112 return backing_file_path_; 112 return backing_file_path_;
113 } 113 }
114 114
115 } // namespace syncable 115 } // namespace syncable
116 } // namespace syncer 116 } // namespace syncer
OLDNEW
« no previous file with comments | « components/sync/syncable/directory_backing_store.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698