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

Side by Side Diff: content/browser/dom_storage/dom_storage_database.cc

Issue 2548063002: [tracing] Show the local storage databases under dom_storage (Closed)
Patch Set: Add IsOpen. 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "content/browser/dom_storage/dom_storage_database.h" 5 #include "content/browser/dom_storage/dom_storage_database.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/files/file_util.h" 8 #include "base/files/file_util.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "sql/statement.h" 10 #include "sql/statement.h"
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 bool success = transaction.Commit(); 128 bool success = transaction.Commit();
129 if (!success) 129 if (!success)
130 known_to_be_empty_ = old_known_to_be_empty; 130 known_to_be_empty_ = old_known_to_be_empty;
131 131
132 // Reduce the size of sqlite caches. 132 // Reduce the size of sqlite caches.
133 db_->TrimMemory(false /* aggressively */); 133 db_->TrimMemory(false /* aggressively */);
134 134
135 return success; 135 return success;
136 } 136 }
137 137
138 void DOMStorageDatabase::ReportMemoryUsage(
139 base::trace_event::ProcessMemoryDump* pmd,
140 const std::string& name) {
141 if (IsOpen())
142 db_->ReportMemoryUsage(pmd, name);
143 }
144
138 bool DOMStorageDatabase::LazyOpen(bool create_if_needed) { 145 bool DOMStorageDatabase::LazyOpen(bool create_if_needed) {
139 if (failed_to_open_) { 146 if (failed_to_open_) {
140 // Don't try to open a database that we know has failed 147 // Don't try to open a database that we know has failed
141 // already. 148 // already.
142 return false; 149 return false;
143 } 150 }
144 151
145 if (IsOpen()) 152 if (IsOpen())
146 return true; 153 return true;
147 154
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 CreateTableV2() && 301 CreateTableV2() &&
295 CommitChanges(false, values) && 302 CommitChanges(false, values) &&
296 migration.Commit(); 303 migration.Commit();
297 } 304 }
298 305
299 void DOMStorageDatabase::Close() { 306 void DOMStorageDatabase::Close() {
300 db_.reset(NULL); 307 db_.reset(NULL);
301 } 308 }
302 309
303 } // namespace content 310 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/dom_storage/dom_storage_database.h ('k') | content/browser/dom_storage/dom_storage_database_adapter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698