OLD | NEW |
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 "sync/syncable/directory_backing_store.h" | 5 #include "sync/syncable/directory_backing_store.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 | 8 |
9 #include "base/base64.h" | 9 #include "base/base64.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 1710 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1721 return needs_metas_column_refresh_ || needs_share_info_column_refresh_; | 1721 return needs_metas_column_refresh_ || needs_share_info_column_refresh_; |
1722 } | 1722 } |
1723 | 1723 |
1724 void DirectoryBackingStore::ResetAndCreateConnection() { | 1724 void DirectoryBackingStore::ResetAndCreateConnection() { |
1725 db_.reset(new sql::Connection()); | 1725 db_.reset(new sql::Connection()); |
1726 db_->set_histogram_tag("SyncDirectory"); | 1726 db_->set_histogram_tag("SyncDirectory"); |
1727 db_->set_exclusive_locking(); | 1727 db_->set_exclusive_locking(); |
1728 db_->set_cache_size(32); | 1728 db_->set_cache_size(32); |
1729 db_->set_page_size(database_page_size_); | 1729 db_->set_page_size(database_page_size_); |
1730 | 1730 |
1731 // TODO(shess): Sync corruption tests interact poorly with mmap, disable for | 1731 // TODO(shess): The current mitigation for http://crbug.com/537742 stores |
1732 // now. http://crbug.com/533682 | 1732 // state in the meta table, which this database does not use. |
1733 db_->set_mmap_disabled(); | 1733 db_->set_mmap_disabled(); |
| 1734 |
1734 if (!catastrophic_error_handler_.is_null()) | 1735 if (!catastrophic_error_handler_.is_null()) |
1735 SetCatastrophicErrorHandler(catastrophic_error_handler_); | 1736 SetCatastrophicErrorHandler(catastrophic_error_handler_); |
1736 } | 1737 } |
1737 | 1738 |
1738 void DirectoryBackingStore::SetCatastrophicErrorHandler( | 1739 void DirectoryBackingStore::SetCatastrophicErrorHandler( |
1739 const base::Closure& catastrophic_error_handler) { | 1740 const base::Closure& catastrophic_error_handler) { |
1740 DCHECK(CalledOnValidThread()); | 1741 DCHECK(CalledOnValidThread()); |
1741 DCHECK(!catastrophic_error_handler.is_null()); | 1742 DCHECK(!catastrophic_error_handler.is_null()); |
1742 catastrophic_error_handler_ = catastrophic_error_handler; | 1743 catastrophic_error_handler_ = catastrophic_error_handler; |
1743 sql::Connection::ErrorCallback error_callback = | 1744 sql::Connection::ErrorCallback error_callback = |
1744 base::Bind(&OnSqliteError, catastrophic_error_handler_); | 1745 base::Bind(&OnSqliteError, catastrophic_error_handler_); |
1745 db_->set_error_callback(error_callback); | 1746 db_->set_error_callback(error_callback); |
1746 } | 1747 } |
1747 | 1748 |
1748 } // namespace syncable | 1749 } // namespace syncable |
1749 } // namespace syncer | 1750 } // namespace syncer |
OLD | NEW |