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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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) { | |
michaeln
2016/12/05 22:42:53
i think you need to check IsOpen() here
ssid
2016/12/08 18:09:47
Done.
| |
141 db_->ReportMemoryUsage(pmd, name); | |
142 } | |
143 | |
138 bool DOMStorageDatabase::LazyOpen(bool create_if_needed) { | 144 bool DOMStorageDatabase::LazyOpen(bool create_if_needed) { |
139 if (failed_to_open_) { | 145 if (failed_to_open_) { |
140 // Don't try to open a database that we know has failed | 146 // Don't try to open a database that we know has failed |
141 // already. | 147 // already. |
142 return false; | 148 return false; |
143 } | 149 } |
144 | 150 |
145 if (IsOpen()) | 151 if (IsOpen()) |
146 return true; | 152 return true; |
147 | 153 |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
294 CreateTableV2() && | 300 CreateTableV2() && |
295 CommitChanges(false, values) && | 301 CommitChanges(false, values) && |
296 migration.Commit(); | 302 migration.Commit(); |
297 } | 303 } |
298 | 304 |
299 void DOMStorageDatabase::Close() { | 305 void DOMStorageDatabase::Close() { |
300 db_.reset(NULL); | 306 db_.reset(NULL); |
301 } | 307 } |
302 | 308 |
303 } // namespace content | 309 } // namespace content |
OLD | NEW |