| 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 "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 1728 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1739 return true; | 1739 return true; |
| 1740 } | 1740 } |
| 1741 | 1741 |
| 1742 bool DirectoryBackingStore::needs_column_refresh() const { | 1742 bool DirectoryBackingStore::needs_column_refresh() const { |
| 1743 return needs_metas_column_refresh_ || needs_share_info_column_refresh_; | 1743 return needs_metas_column_refresh_ || needs_share_info_column_refresh_; |
| 1744 } | 1744 } |
| 1745 | 1745 |
| 1746 void DirectoryBackingStore::ResetAndCreateConnection() { | 1746 void DirectoryBackingStore::ResetAndCreateConnection() { |
| 1747 db_ = base::MakeUnique<sql::Connection>(); | 1747 db_ = base::MakeUnique<sql::Connection>(); |
| 1748 db_->set_histogram_tag("SyncDirectory"); | 1748 db_->set_histogram_tag("SyncDirectory"); |
| 1749 db_->set_exclusive_locking(); | |
| 1750 db_->set_cache_size(32); | 1749 db_->set_cache_size(32); |
| 1751 db_->set_page_size(database_page_size_); | 1750 db_->set_page_size(database_page_size_); |
| 1752 | 1751 |
| 1753 // TODO(shess): The current mitigation for http://crbug.com/537742 stores | 1752 // TODO(shess): The current mitigation for http://crbug.com/537742 stores |
| 1754 // state in the meta table, which this database does not use. | 1753 // state in the meta table, which this database does not use. |
| 1755 db_->set_mmap_disabled(); | 1754 db_->set_mmap_disabled(); |
| 1756 | 1755 |
| 1757 if (!catastrophic_error_handler_.is_null()) | 1756 if (!catastrophic_error_handler_.is_null()) |
| 1758 SetCatastrophicErrorHandler(catastrophic_error_handler_); | 1757 SetCatastrophicErrorHandler(catastrophic_error_handler_); |
| 1759 } | 1758 } |
| 1760 | 1759 |
| 1761 void DirectoryBackingStore::SetCatastrophicErrorHandler( | 1760 void DirectoryBackingStore::SetCatastrophicErrorHandler( |
| 1762 const base::Closure& catastrophic_error_handler) { | 1761 const base::Closure& catastrophic_error_handler) { |
| 1763 DCHECK(CalledOnValidThread()); | 1762 DCHECK(CalledOnValidThread()); |
| 1764 DCHECK(!catastrophic_error_handler.is_null()); | 1763 DCHECK(!catastrophic_error_handler.is_null()); |
| 1765 catastrophic_error_handler_ = catastrophic_error_handler; | 1764 catastrophic_error_handler_ = catastrophic_error_handler; |
| 1766 sql::Connection::ErrorCallback error_callback = | 1765 sql::Connection::ErrorCallback error_callback = |
| 1767 base::Bind(&OnSqliteError, catastrophic_error_handler_); | 1766 base::Bind(&OnSqliteError, catastrophic_error_handler_); |
| 1768 db_->set_error_callback(error_callback); | 1767 db_->set_error_callback(error_callback); |
| 1769 } | 1768 } |
| 1770 | 1769 |
| 1771 } // namespace syncable | 1770 } // namespace syncable |
| 1772 } // namespace syncer | 1771 } // namespace syncer |
| OLD | NEW |