| 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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 // If the file doesn't exist already and we haven't been asked to create | 151 // If the file doesn't exist already and we haven't been asked to create |
| 152 // a file on disk, then we don't bother opening the database. This means | 152 // a file on disk, then we don't bother opening the database. This means |
| 153 // we wait until we absolutely need to put something onto disk before we | 153 // we wait until we absolutely need to put something onto disk before we |
| 154 // do so. | 154 // do so. |
| 155 return false; | 155 return false; |
| 156 } | 156 } |
| 157 | 157 |
| 158 db_.reset(new sql::Connection()); | 158 db_.reset(new sql::Connection()); |
| 159 db_->set_histogram_tag("DOMStorageDatabase"); | 159 db_->set_histogram_tag("DOMStorageDatabase"); |
| 160 | 160 |
| 161 // TODO(shess): The current mitigation for http://crbug.com/537742 stores | 161 // This db does not use [meta] table, store mmap status data elsewhere. |
| 162 // state in the meta table, which this database does not use. | 162 db_->set_mmap_alt_status(); |
| 163 db_->set_mmap_disabled(); | |
| 164 | 163 |
| 165 if (file_path_.empty()) { | 164 if (file_path_.empty()) { |
| 166 // This code path should only be triggered by unit tests. | 165 // This code path should only be triggered by unit tests. |
| 167 if (!db_->OpenInMemory()) { | 166 if (!db_->OpenInMemory()) { |
| 168 NOTREACHED() << "Unable to open DOM storage database in memory."; | 167 NOTREACHED() << "Unable to open DOM storage database in memory."; |
| 169 failed_to_open_ = true; | 168 failed_to_open_ = true; |
| 170 return false; | 169 return false; |
| 171 } | 170 } |
| 172 } else { | 171 } else { |
| 173 if (!db_->Open(file_path_)) { | 172 if (!db_->Open(file_path_)) { |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 CreateTableV2() && | 294 CreateTableV2() && |
| 296 CommitChanges(false, values) && | 295 CommitChanges(false, values) && |
| 297 migration.Commit(); | 296 migration.Commit(); |
| 298 } | 297 } |
| 299 | 298 |
| 300 void DOMStorageDatabase::Close() { | 299 void DOMStorageDatabase::Close() { |
| 301 db_.reset(NULL); | 300 db_.reset(NULL); |
| 302 } | 301 } |
| 303 | 302 |
| 304 } // namespace content | 303 } // namespace content |
| OLD | NEW |