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

Side by Side Diff: components/sync/syncable/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
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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/directory_backing_store.h" 5 #include "components/sync/syncable/directory_backing_store.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <limits> 9 #include <limits>
10 #include <unordered_set> 10 #include <unordered_set>
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 sql::Connection* db) 276 sql::Connection* db)
277 : dir_name_(dir_name), 277 : dir_name_(dir_name),
278 database_page_size_(kCurrentPageSizeKB), 278 database_page_size_(kCurrentPageSizeKB),
279 db_(db), 279 db_(db),
280 needs_metas_column_refresh_(false), 280 needs_metas_column_refresh_(false),
281 needs_share_info_column_refresh_(false) { 281 needs_share_info_column_refresh_(false) {
282 DCHECK(base::ThreadTaskRunnerHandle::IsSet()); 282 DCHECK(base::ThreadTaskRunnerHandle::IsSet());
283 } 283 }
284 284
285 DirectoryBackingStore::~DirectoryBackingStore() { 285 DirectoryBackingStore::~DirectoryBackingStore() {
286 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
286 } 287 }
287 288
288 bool DirectoryBackingStore::DeleteEntries(EntryTable from, 289 bool DirectoryBackingStore::DeleteEntries(EntryTable from,
289 const MetahandleSet& handles) { 290 const MetahandleSet& handles) {
290 if (handles.empty()) 291 if (handles.empty())
291 return true; 292 return true;
292 293
293 sql::Statement statement; 294 sql::Statement statement;
294 // Call GetCachedStatement() separately to get different statements for 295 // Call GetCachedStatement() separately to get different statements for
295 // different tables. 296 // different tables.
(...skipping 13 matching lines...) Expand all
309 statement.BindInt64(0, *i); 310 statement.BindInt64(0, *i);
310 if (!statement.Run()) 311 if (!statement.Run())
311 return false; 312 return false;
312 statement.Reset(true); 313 statement.Reset(true);
313 } 314 }
314 return true; 315 return true;
315 } 316 }
316 317
317 bool DirectoryBackingStore::SaveChanges( 318 bool DirectoryBackingStore::SaveChanges(
318 const Directory::SaveChangesSnapshot& snapshot) { 319 const Directory::SaveChangesSnapshot& snapshot) {
319 DCHECK(CalledOnValidThread()); 320 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
320 DCHECK(db_->is_open()); 321 DCHECK(db_->is_open());
321 322
322 // Back out early if there is nothing to write. 323 // Back out early if there is nothing to write.
323 bool save_info = 324 bool save_info =
324 (Directory::KERNEL_SHARE_INFO_DIRTY == snapshot.kernel_info_status); 325 (Directory::KERNEL_SHARE_INFO_DIRTY == snapshot.kernel_info_status);
325 if (!snapshot.HasUnsavedMetahandleChanges() && !save_info) { 326 if (!snapshot.HasUnsavedMetahandleChanges() && !save_info) {
326 return true; 327 return true;
327 } 328 }
328 329
329 sql::Transaction transaction(db_.get()); 330 sql::Transaction transaction(db_.get());
(...skipping 1467 matching lines...) Expand 10 before | Expand all | Expand 10 after
1797 1798
1798 // This db does not use [meta] table, store mmap status data elsewhere. 1799 // This db does not use [meta] table, store mmap status data elsewhere.
1799 db_->set_mmap_alt_status(); 1800 db_->set_mmap_alt_status();
1800 1801
1801 if (!catastrophic_error_handler_.is_null()) 1802 if (!catastrophic_error_handler_.is_null())
1802 SetCatastrophicErrorHandler(catastrophic_error_handler_); 1803 SetCatastrophicErrorHandler(catastrophic_error_handler_);
1803 } 1804 }
1804 1805
1805 void DirectoryBackingStore::SetCatastrophicErrorHandler( 1806 void DirectoryBackingStore::SetCatastrophicErrorHandler(
1806 const base::Closure& catastrophic_error_handler) { 1807 const base::Closure& catastrophic_error_handler) {
1807 DCHECK(CalledOnValidThread()); 1808 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
1808 DCHECK(!catastrophic_error_handler.is_null()); 1809 DCHECK(!catastrophic_error_handler.is_null());
1809 catastrophic_error_handler_ = catastrophic_error_handler; 1810 catastrophic_error_handler_ = catastrophic_error_handler;
1810 sql::Connection::ErrorCallback error_callback = 1811 sql::Connection::ErrorCallback error_callback =
1811 base::Bind(&OnSqliteError, catastrophic_error_handler_); 1812 base::Bind(&OnSqliteError, catastrophic_error_handler_);
1812 db_->set_error_callback(error_callback); 1813 db_->set_error_callback(error_callback);
1813 } 1814 }
1814 1815
1815 } // namespace syncable 1816 } // namespace syncable
1816 } // namespace syncer 1817 } // namespace syncer
OLDNEW
« no previous file with comments | « components/sync/syncable/directory_backing_store.h ('k') | components/sync/syncable/on_disk_directory_backing_store.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698