Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(60)

Side by Side Diff: components/sync/syncable/directory_backing_store.cc

Issue 2452713003: [Sync] Implement MemoryDumpProvider. (Closed)
Patch Set: Fix presumit; fix Windows; git cl format Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 1699 matching lines...) Expand 10 before | Expand all | Expand 10 after
1710 1710
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(
1721 base::trace_event::MemoryAllocatorDump* mad) {
1722 return db_ && db_->ReportMemoryUsage(mad);
1723 }
1724
1720 bool DirectoryBackingStore::UpdatePageSizeIfNecessary() { 1725 bool DirectoryBackingStore::UpdatePageSizeIfNecessary() {
1721 int page_size; 1726 int page_size;
1722 if (!GetDatabasePageSize(&page_size)) 1727 if (!GetDatabasePageSize(&page_size))
1723 return false; 1728 return false;
1724 if (page_size == kCurrentPageSizeKB) 1729 if (page_size == kCurrentPageSizeKB)
1725 return true; 1730 return true;
1726 std::string update_page_size = base::StringPrintf( 1731 std::string update_page_size = base::StringPrintf(
1727 "PRAGMA page_size=%i;", kCurrentPageSizeKB); 1732 "PRAGMA page_size=%i;", kCurrentPageSizeKB);
1728 if (!db_->Execute(update_page_size.c_str()) || !Vacuum()) 1733 if (!db_->Execute(update_page_size.c_str()) || !Vacuum())
1729 return false; 1734 return false;
(...skipping 30 matching lines...) Expand all
1760 DCHECK(CalledOnValidThread()); 1765 DCHECK(CalledOnValidThread());
1761 DCHECK(!catastrophic_error_handler.is_null()); 1766 DCHECK(!catastrophic_error_handler.is_null());
1762 catastrophic_error_handler_ = catastrophic_error_handler; 1767 catastrophic_error_handler_ = catastrophic_error_handler;
1763 sql::Connection::ErrorCallback error_callback = 1768 sql::Connection::ErrorCallback error_callback =
1764 base::Bind(&OnSqliteError, catastrophic_error_handler_); 1769 base::Bind(&OnSqliteError, catastrophic_error_handler_);
1765 db_->set_error_callback(error_callback); 1770 db_->set_error_callback(error_callback);
1766 } 1771 }
1767 1772
1768 } // namespace syncable 1773 } // namespace syncable
1769 } // namespace syncer 1774 } // namespace syncer
OLDNEW
« no previous file with comments | « components/sync/syncable/directory_backing_store.h ('k') | components/sync/syncable/entry_kernel.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698