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/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "sql/statement.h" | 10 #include "sql/statement.h" |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 if (value.is_null()) { | 100 if (value.is_null()) { |
101 statement.Assign(db_->GetCachedStatement(SQL_FROM_HERE, | 101 statement.Assign(db_->GetCachedStatement(SQL_FROM_HERE, |
102 "DELETE FROM ItemTable WHERE key=?")); | 102 "DELETE FROM ItemTable WHERE key=?")); |
103 statement.BindString16(0, key); | 103 statement.BindString16(0, key); |
104 did_delete = true; | 104 did_delete = true; |
105 } else { | 105 } else { |
106 statement.Assign(db_->GetCachedStatement(SQL_FROM_HERE, | 106 statement.Assign(db_->GetCachedStatement(SQL_FROM_HERE, |
107 "INSERT INTO ItemTable VALUES (?,?)")); | 107 "INSERT INTO ItemTable VALUES (?,?)")); |
108 statement.BindString16(0, key); | 108 statement.BindString16(0, key); |
109 statement.BindBlob(1, value.string().data(), | 109 statement.BindBlob(1, value.string().data(), |
110 value.string().length() * sizeof(char16)); | 110 value.string().length() * sizeof(base::char16)); |
111 known_to_be_empty_ = false; | 111 known_to_be_empty_ = false; |
112 did_insert = true; | 112 did_insert = true; |
113 } | 113 } |
114 DCHECK(statement.is_valid()); | 114 DCHECK(statement.is_valid()); |
115 statement.Run(); | 115 statement.Run(); |
116 } | 116 } |
117 | 117 |
118 if (!known_to_be_empty_ && did_delete && !did_insert) { | 118 if (!known_to_be_empty_ && did_delete && !did_insert) { |
119 sql::Statement statement(db_->GetCachedStatement(SQL_FROM_HERE, | 119 sql::Statement statement(db_->GetCachedStatement(SQL_FROM_HERE, |
120 "SELECT count(key) from ItemTable")); | 120 "SELECT count(key) from ItemTable")); |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 CreateTableV2() && | 286 CreateTableV2() && |
287 CommitChanges(false, values) && | 287 CommitChanges(false, values) && |
288 migration.Commit(); | 288 migration.Commit(); |
289 } | 289 } |
290 | 290 |
291 void DOMStorageDatabase::Close() { | 291 void DOMStorageDatabase::Close() { |
292 db_.reset(NULL); | 292 db_.reset(NULL); |
293 } | 293 } |
294 | 294 |
295 } // namespace content | 295 } // namespace content |
OLD | NEW |