Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 121 if (statement.Step()) | 121 if (statement.Step()) |
| 122 known_to_be_empty_ = statement.ColumnInt(0) == 0; | 122 known_to_be_empty_ = statement.ColumnInt(0) == 0; |
| 123 } | 123 } |
| 124 | 124 |
| 125 bool success = transaction.Commit(); | 125 bool success = transaction.Commit(); |
| 126 if (!success) | 126 if (!success) |
| 127 known_to_be_empty_ = old_known_to_be_empty; | 127 known_to_be_empty_ = old_known_to_be_empty; |
| 128 return success; | 128 return success; |
| 129 } | 129 } |
| 130 | 130 |
| 131 void DOMStorageDatabase::TrimDatabase() { | |
| 132 // We hit this case only on aggressive purging. | |
| 133 db_->TrimMemory(true /* aggressively */); | |
|
michaeln
2016/05/09 21:50:31
This needs to have a test for IsOpen() or an asser
ssid
2016/05/10 02:04:16
Fixed.
| |
| 134 } | |
| 135 | |
| 131 bool DOMStorageDatabase::LazyOpen(bool create_if_needed) { | 136 bool DOMStorageDatabase::LazyOpen(bool create_if_needed) { |
| 132 if (failed_to_open_) { | 137 if (failed_to_open_) { |
| 133 // Don't try to open a database that we know has failed | 138 // Don't try to open a database that we know has failed |
| 134 // already. | 139 // already. |
| 135 return false; | 140 return false; |
| 136 } | 141 } |
| 137 | 142 |
| 138 if (IsOpen()) | 143 if (IsOpen()) |
| 139 return true; | 144 return true; |
| 140 | 145 |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 288 CreateTableV2() && | 293 CreateTableV2() && |
| 289 CommitChanges(false, values) && | 294 CommitChanges(false, values) && |
| 290 migration.Commit(); | 295 migration.Commit(); |
| 291 } | 296 } |
| 292 | 297 |
| 293 void DOMStorageDatabase::Close() { | 298 void DOMStorageDatabase::Close() { |
| 294 db_.reset(NULL); | 299 db_.reset(NULL); |
| 295 } | 300 } |
| 296 | 301 |
| 297 } // namespace content | 302 } // namespace content |
| OLD | NEW |