| 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_database.h" | 5 #include "content/browser/indexed_db/indexed_db_database.h" |
| 6 | 6 |
| 7 #include <math.h> | 7 #include <math.h> |
| 8 | 8 |
| 9 #include <limits> | 9 #include <limits> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 349 void UpgradeTransactionStarted(int64_t old_version) override { NOTREACHED(); } | 349 void UpgradeTransactionStarted(int64_t old_version) override { NOTREACHED(); } |
| 350 | 350 |
| 351 void UpgradeTransactionFinished(bool committed) override { NOTREACHED(); } | 351 void UpgradeTransactionFinished(bool committed) override { NOTREACHED(); } |
| 352 | 352 |
| 353 private: | 353 private: |
| 354 scoped_refptr<IndexedDBCallbacks> callbacks_; | 354 scoped_refptr<IndexedDBCallbacks> callbacks_; |
| 355 | 355 |
| 356 DISALLOW_COPY_AND_ASSIGN(DeleteRequest); | 356 DISALLOW_COPY_AND_ASSIGN(DeleteRequest); |
| 357 }; | 357 }; |
| 358 | 358 |
| 359 scoped_refptr<IndexedDBDatabase> IndexedDBDatabase::Create( | 359 std::tuple<scoped_refptr<IndexedDBDatabase>, leveldb::Status> |
| 360 const base::string16& name, | 360 IndexedDBDatabase::Create(const base::string16& name, |
| 361 IndexedDBBackingStore* backing_store, | 361 IndexedDBBackingStore* backing_store, |
| 362 IndexedDBFactory* factory, | 362 IndexedDBFactory* factory, |
| 363 const Identifier& unique_identifier, | 363 const Identifier& unique_identifier) { |
| 364 leveldb::Status* s) { | |
| 365 scoped_refptr<IndexedDBDatabase> database = | 364 scoped_refptr<IndexedDBDatabase> database = |
| 366 IndexedDBClassFactory::Get()->CreateIndexedDBDatabase( | 365 IndexedDBClassFactory::Get()->CreateIndexedDBDatabase( |
| 367 name, backing_store, factory, unique_identifier); | 366 name, backing_store, factory, unique_identifier); |
| 368 *s = database->OpenInternal(); | 367 leveldb::Status s = database->OpenInternal(); |
| 369 if (s->ok()) | 368 if (!s.ok()) |
| 370 return database; | 369 database = nullptr; |
| 371 else | 370 return std::tie(database, s); |
| 372 return NULL; | |
| 373 } | 371 } |
| 374 | 372 |
| 375 IndexedDBDatabase::IndexedDBDatabase(const base::string16& name, | 373 IndexedDBDatabase::IndexedDBDatabase(const base::string16& name, |
| 376 IndexedDBBackingStore* backing_store, | 374 IndexedDBBackingStore* backing_store, |
| 377 IndexedDBFactory* factory, | 375 IndexedDBFactory* factory, |
| 378 const Identifier& unique_identifier) | 376 const Identifier& unique_identifier) |
| 379 : backing_store_(backing_store), | 377 : backing_store_(backing_store), |
| 380 metadata_(name, | 378 metadata_(name, |
| 381 kInvalidId, | 379 kInvalidId, |
| 382 IndexedDBDatabaseMetadata::NO_VERSION, | 380 IndexedDBDatabaseMetadata::NO_VERSION, |
| (...skipping 1743 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2126 | 2124 |
| 2127 void IndexedDBDatabase::VersionChangeAbortOperation( | 2125 void IndexedDBDatabase::VersionChangeAbortOperation( |
| 2128 int64_t previous_version, | 2126 int64_t previous_version, |
| 2129 IndexedDBTransaction* transaction) { | 2127 IndexedDBTransaction* transaction) { |
| 2130 DCHECK(!transaction); | 2128 DCHECK(!transaction); |
| 2131 IDB_TRACE("IndexedDBDatabase::VersionChangeAbortOperation"); | 2129 IDB_TRACE("IndexedDBDatabase::VersionChangeAbortOperation"); |
| 2132 metadata_.version = previous_version; | 2130 metadata_.version = previous_version; |
| 2133 } | 2131 } |
| 2134 | 2132 |
| 2135 } // namespace content | 2133 } // namespace content |
| OLD | NEW |