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