| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/indexed_db/indexed_db_factory_impl.h" | 5 #include "content/browser/indexed_db/indexed_db_factory_impl.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 return; | 255 return; |
| 256 } | 256 } |
| 257 if (!base::ContainsValue(names, name)) { | 257 if (!base::ContainsValue(names, name)) { |
| 258 const int64_t version = 0; | 258 const int64_t version = 0; |
| 259 callbacks->OnSuccess(version); | 259 callbacks->OnSuccess(version); |
| 260 backing_store = NULL; | 260 backing_store = NULL; |
| 261 ReleaseBackingStore(origin, false /* immediate */); | 261 ReleaseBackingStore(origin, false /* immediate */); |
| 262 return; | 262 return; |
| 263 } | 263 } |
| 264 | 264 |
| 265 scoped_refptr<IndexedDBDatabase> database = IndexedDBDatabase::Create( | 265 scoped_refptr<IndexedDBDatabase> database; |
| 266 name, backing_store.get(), this, unique_identifier, &s); | 266 std::tie(database, s) = IndexedDBDatabase::Create(name, backing_store.get(), |
| 267 this, unique_identifier); |
| 267 if (!database.get()) { | 268 if (!database.get()) { |
| 268 IndexedDBDatabaseError error( | 269 IndexedDBDatabaseError error( |
| 269 blink::WebIDBDatabaseExceptionUnknownError, | 270 blink::WebIDBDatabaseExceptionUnknownError, |
| 270 ASCIIToUTF16( | 271 ASCIIToUTF16( |
| 271 "Internal error creating database backend for " | 272 "Internal error creating database backend for " |
| 272 "indexedDB.deleteDatabase.")); | 273 "indexedDB.deleteDatabase.")); |
| 273 callbacks->OnError(error); | 274 callbacks->OnError(error); |
| 274 if (s.IsCorruption()) { | 275 if (s.IsCorruption()) { |
| 275 backing_store = NULL; | 276 backing_store = NULL; |
| 276 HandleBackingStoreCorruption(origin, error); | 277 HandleBackingStoreCorruption(origin, error); |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 429 ASCIIToUTF16( | 430 ASCIIToUTF16( |
| 430 "Internal error opening backing store" | 431 "Internal error opening backing store" |
| 431 " for indexedDB.open.")); | 432 " for indexedDB.open.")); |
| 432 connection->callbacks->OnError(error); | 433 connection->callbacks->OnError(error); |
| 433 if (s.IsCorruption()) { | 434 if (s.IsCorruption()) { |
| 434 HandleBackingStoreCorruption(origin, error); | 435 HandleBackingStoreCorruption(origin, error); |
| 435 } | 436 } |
| 436 return; | 437 return; |
| 437 } | 438 } |
| 438 | 439 |
| 439 database = IndexedDBDatabase::Create( | 440 std::tie(database, s) = IndexedDBDatabase::Create(name, backing_store.get(), |
| 440 name, backing_store.get(), this, unique_identifier, &s); | 441 this, unique_identifier); |
| 441 if (!database.get()) { | 442 if (!database.get()) { |
| 442 DLOG(ERROR) << "Unable to create the database"; | 443 DLOG(ERROR) << "Unable to create the database"; |
| 443 IndexedDBDatabaseError error(blink::WebIDBDatabaseExceptionUnknownError, | 444 IndexedDBDatabaseError error(blink::WebIDBDatabaseExceptionUnknownError, |
| 444 ASCIIToUTF16( | 445 ASCIIToUTF16( |
| 445 "Internal error creating " | 446 "Internal error creating " |
| 446 "database backend for " | 447 "database backend for " |
| 447 "indexedDB.open.")); | 448 "indexedDB.open.")); |
| 448 connection->callbacks->OnError(error); | 449 connection->callbacks->OnError(error); |
| 449 if (s.IsCorruption()) { | 450 if (s.IsCorruption()) { |
| 450 backing_store = NULL; // Closes the LevelDB so that it can be deleted | 451 backing_store = NULL; // Closes the LevelDB so that it can be deleted |
| (...skipping 25 matching lines...) Expand all Loading... |
| 476 size_t count(0); | 477 size_t count(0); |
| 477 | 478 |
| 478 OriginDBs range = GetOpenDatabasesForOrigin(origin); | 479 OriginDBs range = GetOpenDatabasesForOrigin(origin); |
| 479 for (OriginDBMapIterator it = range.first; it != range.second; ++it) | 480 for (OriginDBMapIterator it = range.first; it != range.second; ++it) |
| 480 count += it->second->ConnectionCount(); | 481 count += it->second->ConnectionCount(); |
| 481 | 482 |
| 482 return count; | 483 return count; |
| 483 } | 484 } |
| 484 | 485 |
| 485 } // namespace content | 486 } // namespace content |
| OLD | NEW |