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