| 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 1700 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1711 // Get page size for the database. | 1711 // Get page size for the database. |
| 1712 bool DirectoryBackingStore::GetDatabasePageSize(int* page_size) { | 1712 bool DirectoryBackingStore::GetDatabasePageSize(int* page_size) { |
| 1713 sql::Statement s(db_->GetUniqueStatement("PRAGMA page_size")); | 1713 sql::Statement s(db_->GetUniqueStatement("PRAGMA page_size")); |
| 1714 if (!s.Step()) | 1714 if (!s.Step()) |
| 1715 return false; | 1715 return false; |
| 1716 *page_size = s.ColumnInt(0); | 1716 *page_size = s.ColumnInt(0); |
| 1717 return true; | 1717 return true; |
| 1718 } | 1718 } |
| 1719 | 1719 |
| 1720 bool DirectoryBackingStore::ReportMemoryUsage( | 1720 bool DirectoryBackingStore::ReportMemoryUsage( |
| 1721 base::trace_event::MemoryAllocatorDump* mad) { | 1721 base::trace_event::ProcessMemoryDump* pmd, |
| 1722 return db_ && db_->ReportMemoryUsage(mad); | 1722 const std::string& dump_name) { |
| 1723 return db_ && db_->ReportMemoryUsage(pmd, dump_name); |
| 1723 } | 1724 } |
| 1724 | 1725 |
| 1725 bool DirectoryBackingStore::UpdatePageSizeIfNecessary() { | 1726 bool DirectoryBackingStore::UpdatePageSizeIfNecessary() { |
| 1726 int page_size; | 1727 int page_size; |
| 1727 if (!GetDatabasePageSize(&page_size)) | 1728 if (!GetDatabasePageSize(&page_size)) |
| 1728 return false; | 1729 return false; |
| 1729 if (page_size == kCurrentPageSizeKB) | 1730 if (page_size == kCurrentPageSizeKB) |
| 1730 return true; | 1731 return true; |
| 1731 std::string update_page_size = base::StringPrintf( | 1732 std::string update_page_size = base::StringPrintf( |
| 1732 "PRAGMA page_size=%i;", kCurrentPageSizeKB); | 1733 "PRAGMA page_size=%i;", kCurrentPageSizeKB); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1765 DCHECK(CalledOnValidThread()); | 1766 DCHECK(CalledOnValidThread()); |
| 1766 DCHECK(!catastrophic_error_handler.is_null()); | 1767 DCHECK(!catastrophic_error_handler.is_null()); |
| 1767 catastrophic_error_handler_ = catastrophic_error_handler; | 1768 catastrophic_error_handler_ = catastrophic_error_handler; |
| 1768 sql::Connection::ErrorCallback error_callback = | 1769 sql::Connection::ErrorCallback error_callback = |
| 1769 base::Bind(&OnSqliteError, catastrophic_error_handler_); | 1770 base::Bind(&OnSqliteError, catastrophic_error_handler_); |
| 1770 db_->set_error_callback(error_callback); | 1771 db_->set_error_callback(error_callback); |
| 1771 } | 1772 } |
| 1772 | 1773 |
| 1773 } // namespace syncable | 1774 } // namespace syncable |
| 1774 } // namespace syncer | 1775 } // namespace syncer |
| OLD | NEW |