Chromium Code Reviews| 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 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 264 | 264 |
| 265 void IndexedDBDatabase::CreateObjectStore(int64 transaction_id, | 265 void IndexedDBDatabase::CreateObjectStore(int64 transaction_id, |
| 266 int64 object_store_id, | 266 int64 object_store_id, |
| 267 const base::string16& name, | 267 const base::string16& name, |
| 268 const IndexedDBKeyPath& key_path, | 268 const IndexedDBKeyPath& key_path, |
| 269 bool auto_increment) { | 269 bool auto_increment) { |
| 270 IDB_TRACE("IndexedDBDatabase::CreateObjectStore"); | 270 IDB_TRACE("IndexedDBDatabase::CreateObjectStore"); |
| 271 IndexedDBTransaction* transaction = GetTransaction(transaction_id); | 271 IndexedDBTransaction* transaction = GetTransaction(transaction_id); |
| 272 if (!transaction) | 272 if (!transaction) |
| 273 return; | 273 return; |
| 274 DCHECK_EQ(transaction->mode(), indexed_db::TRANSACTION_VERSION_CHANGE); | 274 DCHECK_EQ(transaction->mode(), blink::WebIDBTransactionModeVersionChange); |
| 275 | 275 |
| 276 if (ContainsKey(metadata_.object_stores, object_store_id)) { | 276 if (ContainsKey(metadata_.object_stores, object_store_id)) { |
| 277 DLOG(ERROR) << "Invalid object_store_id"; | 277 DLOG(ERROR) << "Invalid object_store_id"; |
| 278 return; | 278 return; |
| 279 } | 279 } |
| 280 | 280 |
| 281 // Store creation is done synchronously, as it may be followed by | 281 // Store creation is done synchronously, as it may be followed by |
| 282 // index creation (also sync) since preemptive OpenCursor/SetIndexKeys | 282 // index creation (also sync) since preemptive OpenCursor/SetIndexKeys |
| 283 // may follow. | 283 // may follow. |
| 284 IndexedDBObjectStoreMetadata object_store_metadata( | 284 IndexedDBObjectStoreMetadata object_store_metadata( |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 313 this, | 313 this, |
| 314 object_store_id)); | 314 object_store_id)); |
| 315 } | 315 } |
| 316 | 316 |
| 317 void IndexedDBDatabase::DeleteObjectStore(int64 transaction_id, | 317 void IndexedDBDatabase::DeleteObjectStore(int64 transaction_id, |
| 318 int64 object_store_id) { | 318 int64 object_store_id) { |
| 319 IDB_TRACE("IndexedDBDatabase::DeleteObjectStore"); | 319 IDB_TRACE("IndexedDBDatabase::DeleteObjectStore"); |
| 320 IndexedDBTransaction* transaction = GetTransaction(transaction_id); | 320 IndexedDBTransaction* transaction = GetTransaction(transaction_id); |
| 321 if (!transaction) | 321 if (!transaction) |
| 322 return; | 322 return; |
| 323 DCHECK_EQ(transaction->mode(), indexed_db::TRANSACTION_VERSION_CHANGE); | 323 DCHECK_EQ(transaction->mode(), blink::WebIDBTransactionModeVersionChange); |
| 324 | 324 |
| 325 if (!ValidateObjectStoreId(object_store_id)) | 325 if (!ValidateObjectStoreId(object_store_id)) |
| 326 return; | 326 return; |
| 327 | 327 |
| 328 transaction->ScheduleTask( | 328 transaction->ScheduleTask( |
| 329 base::Bind(&IndexedDBDatabase::DeleteObjectStoreOperation, | 329 base::Bind(&IndexedDBDatabase::DeleteObjectStoreOperation, |
| 330 this, | 330 this, |
| 331 object_store_id)); | 331 object_store_id)); |
| 332 } | 332 } |
| 333 | 333 |
| 334 void IndexedDBDatabase::CreateIndex(int64 transaction_id, | 334 void IndexedDBDatabase::CreateIndex(int64 transaction_id, |
| 335 int64 object_store_id, | 335 int64 object_store_id, |
| 336 int64 index_id, | 336 int64 index_id, |
| 337 const base::string16& name, | 337 const base::string16& name, |
| 338 const IndexedDBKeyPath& key_path, | 338 const IndexedDBKeyPath& key_path, |
| 339 bool unique, | 339 bool unique, |
| 340 bool multi_entry) { | 340 bool multi_entry) { |
| 341 IDB_TRACE("IndexedDBDatabase::CreateIndex"); | 341 IDB_TRACE("IndexedDBDatabase::CreateIndex"); |
| 342 IndexedDBTransaction* transaction = GetTransaction(transaction_id); | 342 IndexedDBTransaction* transaction = GetTransaction(transaction_id); |
| 343 if (!transaction) | 343 if (!transaction) |
| 344 return; | 344 return; |
| 345 DCHECK_EQ(transaction->mode(), indexed_db::TRANSACTION_VERSION_CHANGE); | 345 DCHECK_EQ(transaction->mode(), blink::WebIDBTransactionModeVersionChange); |
| 346 | 346 |
| 347 if (!ValidateObjectStoreIdAndNewIndexId(object_store_id, index_id)) | 347 if (!ValidateObjectStoreIdAndNewIndexId(object_store_id, index_id)) |
| 348 return; | 348 return; |
| 349 | 349 |
| 350 // Index creation is done synchronously since preemptive | 350 // Index creation is done synchronously since preemptive |
| 351 // OpenCursor/SetIndexKeys may follow. | 351 // OpenCursor/SetIndexKeys may follow. |
| 352 const IndexedDBIndexMetadata index_metadata( | 352 const IndexedDBIndexMetadata index_metadata( |
| 353 name, index_id, key_path, unique, multi_entry); | 353 name, index_id, key_path, unique, multi_entry); |
| 354 | 354 |
| 355 if (!backing_store_->CreateIndex(transaction->BackingStoreTransaction(), | 355 if (!backing_store_->CreateIndex(transaction->BackingStoreTransaction(), |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 385 RemoveIndex(object_store_id, index_id); | 385 RemoveIndex(object_store_id, index_id); |
| 386 } | 386 } |
| 387 | 387 |
| 388 void IndexedDBDatabase::DeleteIndex(int64 transaction_id, | 388 void IndexedDBDatabase::DeleteIndex(int64 transaction_id, |
| 389 int64 object_store_id, | 389 int64 object_store_id, |
| 390 int64 index_id) { | 390 int64 index_id) { |
| 391 IDB_TRACE("IndexedDBDatabase::DeleteIndex"); | 391 IDB_TRACE("IndexedDBDatabase::DeleteIndex"); |
| 392 IndexedDBTransaction* transaction = GetTransaction(transaction_id); | 392 IndexedDBTransaction* transaction = GetTransaction(transaction_id); |
| 393 if (!transaction) | 393 if (!transaction) |
| 394 return; | 394 return; |
| 395 DCHECK_EQ(transaction->mode(), indexed_db::TRANSACTION_VERSION_CHANGE); | 395 DCHECK_EQ(transaction->mode(), blink::WebIDBTransactionModeVersionChange); |
| 396 | 396 |
| 397 if (!ValidateObjectStoreIdAndIndexId(object_store_id, index_id)) | 397 if (!ValidateObjectStoreIdAndIndexId(object_store_id, index_id)) |
| 398 return; | 398 return; |
| 399 | 399 |
| 400 transaction->ScheduleTask( | 400 transaction->ScheduleTask( |
| 401 base::Bind(&IndexedDBDatabase::DeleteIndexOperation, | 401 base::Bind(&IndexedDBDatabase::DeleteIndexOperation, |
| 402 this, | 402 this, |
| 403 object_store_id, | 403 object_store_id, |
| 404 index_id)); | 404 index_id)); |
| 405 } | 405 } |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 523 key = &key_range->lower(); | 523 key = &key_range->lower(); |
| 524 } else { | 524 } else { |
| 525 if (index_id == IndexedDBIndexMetadata::kInvalidId) { | 525 if (index_id == IndexedDBIndexMetadata::kInvalidId) { |
| 526 DCHECK_NE(cursor_type, indexed_db::CURSOR_KEY_ONLY); | 526 DCHECK_NE(cursor_type, indexed_db::CURSOR_KEY_ONLY); |
| 527 // ObjectStore Retrieval Operation | 527 // ObjectStore Retrieval Operation |
| 528 backing_store_cursor = backing_store_->OpenObjectStoreCursor( | 528 backing_store_cursor = backing_store_->OpenObjectStoreCursor( |
| 529 transaction->BackingStoreTransaction(), | 529 transaction->BackingStoreTransaction(), |
| 530 id(), | 530 id(), |
| 531 object_store_id, | 531 object_store_id, |
| 532 *key_range, | 532 *key_range, |
| 533 indexed_db::CURSOR_NEXT, | 533 blink::WebIDBCursorDirectionNext, |
| 534 &s); | 534 &s); |
| 535 } else if (cursor_type == indexed_db::CURSOR_KEY_ONLY) { | 535 } else if (cursor_type == indexed_db::CURSOR_KEY_ONLY) { |
| 536 // Index Value Retrieval Operation | 536 // Index Value Retrieval Operation |
| 537 backing_store_cursor = backing_store_->OpenIndexKeyCursor( | 537 backing_store_cursor = backing_store_->OpenIndexKeyCursor( |
| 538 transaction->BackingStoreTransaction(), | 538 transaction->BackingStoreTransaction(), |
| 539 id(), | 539 id(), |
| 540 object_store_id, | 540 object_store_id, |
| 541 index_id, | 541 index_id, |
| 542 *key_range, | 542 *key_range, |
| 543 indexed_db::CURSOR_NEXT, | 543 blink::WebIDBCursorDirectionNext, |
| 544 &s); | 544 &s); |
| 545 } else { | 545 } else { |
| 546 // Index Referenced Value Retrieval Operation | 546 // Index Referenced Value Retrieval Operation |
| 547 backing_store_cursor = backing_store_->OpenIndexCursor( | 547 backing_store_cursor = backing_store_->OpenIndexCursor( |
| 548 transaction->BackingStoreTransaction(), | 548 transaction->BackingStoreTransaction(), |
| 549 id(), | 549 id(), |
| 550 object_store_id, | 550 object_store_id, |
| 551 index_id, | 551 index_id, |
| 552 *key_range, | 552 *key_range, |
| 553 indexed_db::CURSOR_NEXT, | 553 blink::WebIDBCursorDirectionNext, |
| 554 &s); | 554 &s); |
| 555 } | 555 } |
| 556 | 556 |
| 557 if (!s.ok()) { | 557 if (!s.ok()) { |
| 558 DLOG(ERROR) << "Unable to open cursor operation: " << s.ToString(); | 558 DLOG(ERROR) << "Unable to open cursor operation: " << s.ToString(); |
| 559 IndexedDBDatabaseError error(blink::WebIDBDatabaseExceptionUnknownError, | 559 IndexedDBDatabaseError error(blink::WebIDBDatabaseExceptionUnknownError, |
| 560 "Internal error deleting data in range"); | 560 "Internal error deleting data in range"); |
| 561 if (leveldb_env::IsCorruption(s)) { | 561 if (leveldb_env::IsCorruption(s)) { |
| 562 factory_->HandleBackingStoreCorruption(backing_store_->origin_url(), | 562 factory_->HandleBackingStoreCorruption(backing_store_->origin_url(), |
| 563 error); | 563 error); |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 700 static_cast<int64>(floor(key.number())) + 1, | 700 static_cast<int64>(floor(key.number())) + 1, |
| 701 check_current); | 701 check_current); |
| 702 } | 702 } |
| 703 | 703 |
| 704 struct IndexedDBDatabase::PutOperationParams { | 704 struct IndexedDBDatabase::PutOperationParams { |
| 705 PutOperationParams() {} | 705 PutOperationParams() {} |
| 706 int64 object_store_id; | 706 int64 object_store_id; |
| 707 IndexedDBValue value; | 707 IndexedDBValue value; |
| 708 ScopedVector<webkit_blob::BlobDataHandle> handles; | 708 ScopedVector<webkit_blob::BlobDataHandle> handles; |
| 709 scoped_ptr<IndexedDBKey> key; | 709 scoped_ptr<IndexedDBKey> key; |
| 710 IndexedDBDatabase::PutMode put_mode; | 710 blink::WebIDBPutMode put_mode; |
| 711 scoped_refptr<IndexedDBCallbacks> callbacks; | 711 scoped_refptr<IndexedDBCallbacks> callbacks; |
| 712 std::vector<IndexKeys> index_keys; | 712 std::vector<IndexKeys> index_keys; |
| 713 | 713 |
| 714 private: | 714 private: |
| 715 DISALLOW_COPY_AND_ASSIGN(PutOperationParams); | 715 DISALLOW_COPY_AND_ASSIGN(PutOperationParams); |
| 716 }; | 716 }; |
| 717 | 717 |
| 718 void IndexedDBDatabase::Put(int64 transaction_id, | 718 void IndexedDBDatabase::Put(int64 transaction_id, |
| 719 int64 object_store_id, | 719 int64 object_store_id, |
| 720 IndexedDBValue* value, | 720 IndexedDBValue* value, |
| 721 ScopedVector<webkit_blob::BlobDataHandle>* handles, | 721 ScopedVector<webkit_blob::BlobDataHandle>* handles, |
| 722 scoped_ptr<IndexedDBKey> key, | 722 scoped_ptr<IndexedDBKey> key, |
| 723 PutMode put_mode, | 723 blink::WebIDBPutMode put_mode, |
| 724 scoped_refptr<IndexedDBCallbacks> callbacks, | 724 scoped_refptr<IndexedDBCallbacks> callbacks, |
| 725 const std::vector<IndexKeys>& index_keys) { | 725 const std::vector<IndexKeys>& index_keys) { |
| 726 IDB_TRACE("IndexedDBDatabase::Put"); | 726 IDB_TRACE("IndexedDBDatabase::Put"); |
| 727 IndexedDBTransaction* transaction = GetTransaction(transaction_id); | 727 IndexedDBTransaction* transaction = GetTransaction(transaction_id); |
| 728 if (!transaction) | 728 if (!transaction) |
| 729 return; | 729 return; |
| 730 DCHECK_NE(transaction->mode(), indexed_db::TRANSACTION_READ_ONLY); | 730 DCHECK_NE(transaction->mode(), blink::WebIDBTransactionModeReadOnly); |
| 731 | 731 |
| 732 if (!ValidateObjectStoreId(object_store_id)) | 732 if (!ValidateObjectStoreId(object_store_id)) |
| 733 return; | 733 return; |
| 734 | 734 |
| 735 DCHECK(key); | 735 DCHECK(key); |
| 736 DCHECK(value); | 736 DCHECK(value); |
| 737 scoped_ptr<PutOperationParams> params(new PutOperationParams()); | 737 scoped_ptr<PutOperationParams> params(new PutOperationParams()); |
| 738 params->object_store_id = object_store_id; | 738 params->object_store_id = object_store_id; |
| 739 params->value.swap(*value); | 739 params->value.swap(*value); |
| 740 params->handles.swap(*handles); | 740 params->handles.swap(*handles); |
| 741 params->key = key.Pass(); | 741 params->key = key.Pass(); |
| 742 params->put_mode = put_mode; | 742 params->put_mode = put_mode; |
| 743 params->callbacks = callbacks; | 743 params->callbacks = callbacks; |
| 744 params->index_keys = index_keys; | 744 params->index_keys = index_keys; |
| 745 transaction->ScheduleTask(base::Bind( | 745 transaction->ScheduleTask(base::Bind( |
| 746 &IndexedDBDatabase::PutOperation, this, base::Passed(¶ms))); | 746 &IndexedDBDatabase::PutOperation, this, base::Passed(¶ms))); |
| 747 } | 747 } |
| 748 | 748 |
| 749 void IndexedDBDatabase::PutOperation(scoped_ptr<PutOperationParams> params, | 749 void IndexedDBDatabase::PutOperation(scoped_ptr<PutOperationParams> params, |
| 750 IndexedDBTransaction* transaction) { | 750 IndexedDBTransaction* transaction) { |
| 751 IDB_TRACE("IndexedDBDatabase::PutOperation"); | 751 IDB_TRACE("IndexedDBDatabase::PutOperation"); |
| 752 DCHECK_NE(transaction->mode(), indexed_db::TRANSACTION_READ_ONLY); | 752 DCHECK_NE(transaction->mode(), blink::WebIDBTransactionModeReadOnly); |
| 753 bool key_was_generated = false; | 753 bool key_was_generated = false; |
| 754 | 754 |
| 755 DCHECK(metadata_.object_stores.find(params->object_store_id) != | 755 DCHECK(metadata_.object_stores.find(params->object_store_id) != |
| 756 metadata_.object_stores.end()); | 756 metadata_.object_stores.end()); |
| 757 const IndexedDBObjectStoreMetadata& object_store = | 757 const IndexedDBObjectStoreMetadata& object_store = |
| 758 metadata_.object_stores[params->object_store_id]; | 758 metadata_.object_stores[params->object_store_id]; |
| 759 DCHECK(object_store.auto_increment || params->key->IsValid()); | 759 DCHECK(object_store.auto_increment || params->key->IsValid()); |
| 760 | 760 |
| 761 scoped_ptr<IndexedDBKey> key; | 761 scoped_ptr<IndexedDBKey> key; |
| 762 if (params->put_mode != IndexedDBDatabase::CURSOR_UPDATE && | 762 if (params->put_mode != blink::WebIDBPutModeCursorUpdate && |
| 763 object_store.auto_increment && !params->key->IsValid()) { | 763 object_store.auto_increment && !params->key->IsValid()) { |
| 764 scoped_ptr<IndexedDBKey> auto_inc_key = GenerateKey( | 764 scoped_ptr<IndexedDBKey> auto_inc_key = GenerateKey( |
| 765 backing_store_.get(), transaction, id(), params->object_store_id); | 765 backing_store_.get(), transaction, id(), params->object_store_id); |
| 766 key_was_generated = true; | 766 key_was_generated = true; |
| 767 if (!auto_inc_key->IsValid()) { | 767 if (!auto_inc_key->IsValid()) { |
| 768 params->callbacks->OnError( | 768 params->callbacks->OnError( |
| 769 IndexedDBDatabaseError(blink::WebIDBDatabaseExceptionConstraintError, | 769 IndexedDBDatabaseError(blink::WebIDBDatabaseExceptionConstraintError, |
| 770 "Maximum key generator value reached.")); | 770 "Maximum key generator value reached.")); |
| 771 return; | 771 return; |
| 772 } | 772 } |
| 773 key = auto_inc_key.Pass(); | 773 key = auto_inc_key.Pass(); |
| 774 } else { | 774 } else { |
| 775 key = params->key.Pass(); | 775 key = params->key.Pass(); |
| 776 } | 776 } |
| 777 | 777 |
| 778 DCHECK(key->IsValid()); | 778 DCHECK(key->IsValid()); |
| 779 | 779 |
| 780 IndexedDBBackingStore::RecordIdentifier record_identifier; | 780 IndexedDBBackingStore::RecordIdentifier record_identifier; |
| 781 if (params->put_mode == IndexedDBDatabase::ADD_ONLY) { | 781 if (params->put_mode == blink::WebIDBPutModeAddOnly) { |
| 782 bool found = false; | 782 bool found = false; |
| 783 leveldb::Status s = backing_store_->KeyExistsInObjectStore( | 783 leveldb::Status s = backing_store_->KeyExistsInObjectStore( |
| 784 transaction->BackingStoreTransaction(), | 784 transaction->BackingStoreTransaction(), |
| 785 id(), | 785 id(), |
| 786 params->object_store_id, | 786 params->object_store_id, |
| 787 *key, | 787 *key, |
| 788 &record_identifier, | 788 &record_identifier, |
| 789 &found); | 789 &found); |
| 790 if (!s.ok()) { | 790 if (!s.ok()) { |
| 791 IndexedDBDatabaseError error(blink::WebIDBDatabaseExceptionUnknownError, | 791 IndexedDBDatabaseError error(blink::WebIDBDatabaseExceptionUnknownError, |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 853 for (size_t i = 0; i < index_writers.size(); ++i) { | 853 for (size_t i = 0; i < index_writers.size(); ++i) { |
| 854 IndexWriter* index_writer = index_writers[i]; | 854 IndexWriter* index_writer = index_writers[i]; |
| 855 index_writer->WriteIndexKeys(record_identifier, | 855 index_writer->WriteIndexKeys(record_identifier, |
| 856 backing_store_.get(), | 856 backing_store_.get(), |
| 857 transaction->BackingStoreTransaction(), | 857 transaction->BackingStoreTransaction(), |
| 858 id(), | 858 id(), |
| 859 params->object_store_id); | 859 params->object_store_id); |
| 860 } | 860 } |
| 861 | 861 |
| 862 if (object_store.auto_increment && | 862 if (object_store.auto_increment && |
| 863 params->put_mode != IndexedDBDatabase::CURSOR_UPDATE && | 863 params->put_mode != blink::WebIDBPutModeCursorUpdate && |
| 864 key->type() == WebIDBKeyTypeNumber) { | 864 key->type() == WebIDBKeyTypeNumber) { |
| 865 leveldb::Status s = UpdateKeyGenerator(backing_store_.get(), | 865 leveldb::Status s = UpdateKeyGenerator(backing_store_.get(), |
| 866 transaction, | 866 transaction, |
| 867 id(), | 867 id(), |
| 868 params->object_store_id, | 868 params->object_store_id, |
| 869 *key, | 869 *key, |
| 870 !key_was_generated); | 870 !key_was_generated); |
| 871 if (!s.ok()) { | 871 if (!s.ok()) { |
| 872 IndexedDBDatabaseError error(blink::WebIDBDatabaseExceptionUnknownError, | 872 IndexedDBDatabaseError error(blink::WebIDBDatabaseExceptionUnknownError, |
| 873 "Internal error updating key generator."); | 873 "Internal error updating key generator."); |
| 874 params->callbacks->OnError(error); | 874 params->callbacks->OnError(error); |
| 875 if (leveldb_env::IsCorruption(s)) | 875 if (leveldb_env::IsCorruption(s)) |
| 876 factory_->HandleBackingStoreCorruption(backing_store_->origin_url(), | 876 factory_->HandleBackingStoreCorruption(backing_store_->origin_url(), |
| 877 error); | 877 error); |
| 878 return; | 878 return; |
| 879 } | 879 } |
| 880 } | 880 } |
| 881 | 881 |
| 882 params->callbacks->OnSuccess(*key); | 882 params->callbacks->OnSuccess(*key); |
| 883 } | 883 } |
| 884 | 884 |
| 885 void IndexedDBDatabase::SetIndexKeys(int64 transaction_id, | 885 void IndexedDBDatabase::SetIndexKeys(int64 transaction_id, |
| 886 int64 object_store_id, | 886 int64 object_store_id, |
| 887 scoped_ptr<IndexedDBKey> primary_key, | 887 scoped_ptr<IndexedDBKey> primary_key, |
| 888 const std::vector<IndexKeys>& index_keys) { | 888 const std::vector<IndexKeys>& index_keys) { |
| 889 IDB_TRACE("IndexedDBDatabase::SetIndexKeys"); | 889 IDB_TRACE("IndexedDBDatabase::SetIndexKeys"); |
| 890 IndexedDBTransaction* transaction = GetTransaction(transaction_id); | 890 IndexedDBTransaction* transaction = GetTransaction(transaction_id); |
| 891 if (!transaction) | 891 if (!transaction) |
| 892 return; | 892 return; |
| 893 DCHECK_EQ(transaction->mode(), indexed_db::TRANSACTION_VERSION_CHANGE); | 893 DCHECK_EQ(transaction->mode(), blink::WebIDBTransactionModeVersionChange); |
| 894 | 894 |
| 895 // TODO(alecflett): This method could be asynchronous, but we need to | 895 // TODO(alecflett): This method could be asynchronous, but we need to |
| 896 // evaluate if it's worth the extra complexity. | 896 // evaluate if it's worth the extra complexity. |
| 897 IndexedDBBackingStore::RecordIdentifier record_identifier; | 897 IndexedDBBackingStore::RecordIdentifier record_identifier; |
| 898 bool found = false; | 898 bool found = false; |
| 899 leveldb::Status s = backing_store_->KeyExistsInObjectStore( | 899 leveldb::Status s = backing_store_->KeyExistsInObjectStore( |
| 900 transaction->BackingStoreTransaction(), | 900 transaction->BackingStoreTransaction(), |
| 901 metadata_.id, | 901 metadata_.id, |
| 902 object_store_id, | 902 object_store_id, |
| 903 *primary_key, | 903 *primary_key, |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 958 } | 958 } |
| 959 } | 959 } |
| 960 | 960 |
| 961 void IndexedDBDatabase::SetIndexesReady(int64 transaction_id, | 961 void IndexedDBDatabase::SetIndexesReady(int64 transaction_id, |
| 962 int64, | 962 int64, |
| 963 const std::vector<int64>& index_ids) { | 963 const std::vector<int64>& index_ids) { |
| 964 IDB_TRACE("IndexedDBDatabase::SetIndexesReady"); | 964 IDB_TRACE("IndexedDBDatabase::SetIndexesReady"); |
| 965 IndexedDBTransaction* transaction = GetTransaction(transaction_id); | 965 IndexedDBTransaction* transaction = GetTransaction(transaction_id); |
| 966 if (!transaction) | 966 if (!transaction) |
| 967 return; | 967 return; |
| 968 DCHECK_EQ(transaction->mode(), indexed_db::TRANSACTION_VERSION_CHANGE); | 968 DCHECK_EQ(transaction->mode(), blink::WebIDBTransactionModeVersionChange); |
| 969 | 969 |
| 970 transaction->ScheduleTask( | 970 transaction->ScheduleTask( |
| 971 IndexedDBDatabase::PREEMPTIVE_TASK, | 971 blink::WebIDBTaskTypePreemptive, |
| 972 base::Bind(&IndexedDBDatabase::SetIndexesReadyOperation, | 972 base::Bind(&IndexedDBDatabase::SetIndexesReadyOperation, |
| 973 this, | 973 this, |
| 974 index_ids.size())); | 974 index_ids.size())); |
| 975 } | 975 } |
| 976 | 976 |
| 977 void IndexedDBDatabase::SetIndexesReadyOperation( | 977 void IndexedDBDatabase::SetIndexesReadyOperation( |
| 978 size_t index_count, | 978 size_t index_count, |
| 979 IndexedDBTransaction* transaction) { | 979 IndexedDBTransaction* transaction) { |
| 980 IDB_TRACE("IndexedDBDatabase::SetIndexesReadyOperation"); | 980 IDB_TRACE("IndexedDBDatabase::SetIndexesReadyOperation"); |
| 981 for (size_t i = 0; i < index_count; ++i) | 981 for (size_t i = 0; i < index_count; ++i) |
| 982 transaction->DidCompletePreemptiveEvent(); | 982 transaction->DidCompletePreemptiveEvent(); |
| 983 } | 983 } |
| 984 | 984 |
| 985 struct IndexedDBDatabase::OpenCursorOperationParams { | 985 struct IndexedDBDatabase::OpenCursorOperationParams { |
| 986 OpenCursorOperationParams() {} | 986 OpenCursorOperationParams() {} |
| 987 int64 object_store_id; | 987 int64 object_store_id; |
| 988 int64 index_id; | 988 int64 index_id; |
| 989 scoped_ptr<IndexedDBKeyRange> key_range; | 989 scoped_ptr<IndexedDBKeyRange> key_range; |
| 990 indexed_db::CursorDirection direction; | 990 blink::WebIDBCursorDirection direction; |
| 991 indexed_db::CursorType cursor_type; | 991 indexed_db::CursorType cursor_type; |
| 992 IndexedDBDatabase::TaskType task_type; | 992 blink::WebIDBTaskType task_type; |
| 993 scoped_refptr<IndexedDBCallbacks> callbacks; | 993 scoped_refptr<IndexedDBCallbacks> callbacks; |
| 994 | 994 |
| 995 private: | 995 private: |
| 996 DISALLOW_COPY_AND_ASSIGN(OpenCursorOperationParams); | 996 DISALLOW_COPY_AND_ASSIGN(OpenCursorOperationParams); |
| 997 }; | 997 }; |
| 998 | 998 |
| 999 void IndexedDBDatabase::OpenCursor( | 999 void IndexedDBDatabase::OpenCursor( |
| 1000 int64 transaction_id, | 1000 int64 transaction_id, |
| 1001 int64 object_store_id, | 1001 int64 object_store_id, |
| 1002 int64 index_id, | 1002 int64 index_id, |
| 1003 scoped_ptr<IndexedDBKeyRange> key_range, | 1003 scoped_ptr<IndexedDBKeyRange> key_range, |
| 1004 indexed_db::CursorDirection direction, | 1004 blink::WebIDBCursorDirection direction, |
| 1005 bool key_only, | 1005 bool key_only, |
| 1006 TaskType task_type, | 1006 blink::WebIDBTaskType task_type, |
| 1007 scoped_refptr<IndexedDBCallbacks> callbacks) { | 1007 scoped_refptr<IndexedDBCallbacks> callbacks) { |
| 1008 IDB_TRACE("IndexedDBDatabase::OpenCursor"); | 1008 IDB_TRACE("IndexedDBDatabase::OpenCursor"); |
| 1009 IndexedDBTransaction* transaction = GetTransaction(transaction_id); | 1009 IndexedDBTransaction* transaction = GetTransaction(transaction_id); |
| 1010 if (!transaction) | 1010 if (!transaction) |
| 1011 return; | 1011 return; |
| 1012 | 1012 |
| 1013 if (!ValidateObjectStoreIdAndOptionalIndexId(object_store_id, index_id)) | 1013 if (!ValidateObjectStoreIdAndOptionalIndexId(object_store_id, index_id)) |
| 1014 return; | 1014 return; |
| 1015 | 1015 |
| 1016 scoped_ptr<OpenCursorOperationParams> params(new OpenCursorOperationParams()); | 1016 scoped_ptr<OpenCursorOperationParams> params(new OpenCursorOperationParams()); |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 1028 | 1028 |
| 1029 void IndexedDBDatabase::OpenCursorOperation( | 1029 void IndexedDBDatabase::OpenCursorOperation( |
| 1030 scoped_ptr<OpenCursorOperationParams> params, | 1030 scoped_ptr<OpenCursorOperationParams> params, |
| 1031 IndexedDBTransaction* transaction) { | 1031 IndexedDBTransaction* transaction) { |
| 1032 IDB_TRACE("IndexedDBDatabase::OpenCursorOperation"); | 1032 IDB_TRACE("IndexedDBDatabase::OpenCursorOperation"); |
| 1033 | 1033 |
| 1034 // The frontend has begun indexing, so this pauses the transaction | 1034 // The frontend has begun indexing, so this pauses the transaction |
| 1035 // until the indexing is complete. This can't happen any earlier | 1035 // until the indexing is complete. This can't happen any earlier |
| 1036 // because we don't want to switch to early mode in case multiple | 1036 // because we don't want to switch to early mode in case multiple |
| 1037 // indexes are being created in a row, with Put()'s in between. | 1037 // indexes are being created in a row, with Put()'s in between. |
| 1038 if (params->task_type == IndexedDBDatabase::PREEMPTIVE_TASK) | 1038 if (params->task_type == blink::WebIDBTaskTypePreemptive) |
| 1039 transaction->AddPreemptiveEvent(); | 1039 transaction->AddPreemptiveEvent(); |
| 1040 | 1040 |
| 1041 leveldb::Status s; | 1041 leveldb::Status s; |
| 1042 scoped_ptr<IndexedDBBackingStore::Cursor> backing_store_cursor; | 1042 scoped_ptr<IndexedDBBackingStore::Cursor> backing_store_cursor; |
| 1043 if (params->index_id == IndexedDBIndexMetadata::kInvalidId) { | 1043 if (params->index_id == IndexedDBIndexMetadata::kInvalidId) { |
| 1044 if (params->cursor_type == indexed_db::CURSOR_KEY_ONLY) { | 1044 if (params->cursor_type == indexed_db::CURSOR_KEY_ONLY) { |
| 1045 DCHECK_EQ(params->task_type, IndexedDBDatabase::NORMAL_TASK); | 1045 DCHECK_EQ(params->task_type, blink::WebIDBTaskTypeNormal); |
| 1046 backing_store_cursor = backing_store_->OpenObjectStoreKeyCursor( | 1046 backing_store_cursor = backing_store_->OpenObjectStoreKeyCursor( |
| 1047 transaction->BackingStoreTransaction(), | 1047 transaction->BackingStoreTransaction(), |
| 1048 id(), | 1048 id(), |
| 1049 params->object_store_id, | 1049 params->object_store_id, |
| 1050 *params->key_range, | 1050 *params->key_range, |
| 1051 params->direction, | 1051 params->direction, |
| 1052 &s); | 1052 &s); |
| 1053 } else { | 1053 } else { |
| 1054 backing_store_cursor = backing_store_->OpenObjectStoreCursor( | 1054 backing_store_cursor = backing_store_->OpenObjectStoreCursor( |
| 1055 transaction->BackingStoreTransaction(), | 1055 transaction->BackingStoreTransaction(), |
| 1056 id(), | 1056 id(), |
| 1057 params->object_store_id, | 1057 params->object_store_id, |
| 1058 *params->key_range, | 1058 *params->key_range, |
| 1059 params->direction, | 1059 params->direction, |
| 1060 &s); | 1060 &s); |
| 1061 } | 1061 } |
| 1062 } else { | 1062 } else { |
| 1063 DCHECK_EQ(params->task_type, IndexedDBDatabase::NORMAL_TASK); | 1063 DCHECK_EQ(params->task_type, blink::WebIDBTaskTypeNormal); |
| 1064 if (params->cursor_type == indexed_db::CURSOR_KEY_ONLY) { | 1064 if (params->cursor_type == indexed_db::CURSOR_KEY_ONLY) { |
| 1065 backing_store_cursor = backing_store_->OpenIndexKeyCursor( | 1065 backing_store_cursor = backing_store_->OpenIndexKeyCursor( |
| 1066 transaction->BackingStoreTransaction(), | 1066 transaction->BackingStoreTransaction(), |
| 1067 id(), | 1067 id(), |
| 1068 params->object_store_id, | 1068 params->object_store_id, |
| 1069 params->index_id, | 1069 params->index_id, |
| 1070 *params->key_range, | 1070 *params->key_range, |
| 1071 params->direction, | 1071 params->direction, |
| 1072 &s); | 1072 &s); |
| 1073 } else { | 1073 } else { |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1138 uint32 count = 0; | 1138 uint32 count = 0; |
| 1139 scoped_ptr<IndexedDBBackingStore::Cursor> backing_store_cursor; | 1139 scoped_ptr<IndexedDBBackingStore::Cursor> backing_store_cursor; |
| 1140 | 1140 |
| 1141 leveldb::Status s; | 1141 leveldb::Status s; |
| 1142 if (index_id == IndexedDBIndexMetadata::kInvalidId) { | 1142 if (index_id == IndexedDBIndexMetadata::kInvalidId) { |
| 1143 backing_store_cursor = backing_store_->OpenObjectStoreKeyCursor( | 1143 backing_store_cursor = backing_store_->OpenObjectStoreKeyCursor( |
| 1144 transaction->BackingStoreTransaction(), | 1144 transaction->BackingStoreTransaction(), |
| 1145 id(), | 1145 id(), |
| 1146 object_store_id, | 1146 object_store_id, |
| 1147 *key_range, | 1147 *key_range, |
| 1148 indexed_db::CURSOR_NEXT, | 1148 blink::WebIDBCursorDirectionNext, |
| 1149 &s); | 1149 &s); |
| 1150 } else { | 1150 } else { |
| 1151 backing_store_cursor = backing_store_->OpenIndexKeyCursor( | 1151 backing_store_cursor = backing_store_->OpenIndexKeyCursor( |
| 1152 transaction->BackingStoreTransaction(), | 1152 transaction->BackingStoreTransaction(), |
| 1153 id(), | 1153 id(), |
| 1154 object_store_id, | 1154 object_store_id, |
| 1155 index_id, | 1155 index_id, |
| 1156 *key_range, | 1156 *key_range, |
| 1157 indexed_db::CURSOR_NEXT, | 1157 blink::WebIDBCursorDirectionNext, |
| 1158 &s); | 1158 &s); |
| 1159 } | 1159 } |
| 1160 if (!s.ok()) { | 1160 if (!s.ok()) { |
| 1161 DLOG(ERROR) << "Unable perform count operation: " << s.ToString(); | 1161 DLOG(ERROR) << "Unable perform count operation: " << s.ToString(); |
| 1162 IndexedDBDatabaseError error(blink::WebIDBDatabaseExceptionUnknownError, | 1162 IndexedDBDatabaseError error(blink::WebIDBDatabaseExceptionUnknownError, |
| 1163 "Internal error performing count operation"); | 1163 "Internal error performing count operation"); |
| 1164 if (leveldb_env::IsCorruption(s)) { | 1164 if (leveldb_env::IsCorruption(s)) { |
| 1165 factory_->HandleBackingStoreCorruption(backing_store_->origin_url(), | 1165 factory_->HandleBackingStoreCorruption(backing_store_->origin_url(), |
| 1166 error); | 1166 error); |
| 1167 } | 1167 } |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 1182 | 1182 |
| 1183 void IndexedDBDatabase::DeleteRange( | 1183 void IndexedDBDatabase::DeleteRange( |
| 1184 int64 transaction_id, | 1184 int64 transaction_id, |
| 1185 int64 object_store_id, | 1185 int64 object_store_id, |
| 1186 scoped_ptr<IndexedDBKeyRange> key_range, | 1186 scoped_ptr<IndexedDBKeyRange> key_range, |
| 1187 scoped_refptr<IndexedDBCallbacks> callbacks) { | 1187 scoped_refptr<IndexedDBCallbacks> callbacks) { |
| 1188 IDB_TRACE("IndexedDBDatabase::DeleteRange"); | 1188 IDB_TRACE("IndexedDBDatabase::DeleteRange"); |
| 1189 IndexedDBTransaction* transaction = GetTransaction(transaction_id); | 1189 IndexedDBTransaction* transaction = GetTransaction(transaction_id); |
| 1190 if (!transaction) | 1190 if (!transaction) |
| 1191 return; | 1191 return; |
| 1192 DCHECK_NE(transaction->mode(), indexed_db::TRANSACTION_READ_ONLY); | 1192 DCHECK_NE(transaction->mode(), blink::WebIDBTransactionModeReadOnly); |
| 1193 | 1193 |
| 1194 if (!ValidateObjectStoreId(object_store_id)) | 1194 if (!ValidateObjectStoreId(object_store_id)) |
| 1195 return; | 1195 return; |
| 1196 | 1196 |
| 1197 transaction->ScheduleTask(base::Bind(&IndexedDBDatabase::DeleteRangeOperation, | 1197 transaction->ScheduleTask(base::Bind(&IndexedDBDatabase::DeleteRangeOperation, |
| 1198 this, | 1198 this, |
| 1199 object_store_id, | 1199 object_store_id, |
| 1200 base::Passed(&key_range), | 1200 base::Passed(&key_range), |
| 1201 callbacks)); | 1201 callbacks)); |
| 1202 } | 1202 } |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 1227 callbacks->OnSuccess(); | 1227 callbacks->OnSuccess(); |
| 1228 } | 1228 } |
| 1229 | 1229 |
| 1230 void IndexedDBDatabase::Clear(int64 transaction_id, | 1230 void IndexedDBDatabase::Clear(int64 transaction_id, |
| 1231 int64 object_store_id, | 1231 int64 object_store_id, |
| 1232 scoped_refptr<IndexedDBCallbacks> callbacks) { | 1232 scoped_refptr<IndexedDBCallbacks> callbacks) { |
| 1233 IDB_TRACE("IndexedDBDatabase::Clear"); | 1233 IDB_TRACE("IndexedDBDatabase::Clear"); |
| 1234 IndexedDBTransaction* transaction = GetTransaction(transaction_id); | 1234 IndexedDBTransaction* transaction = GetTransaction(transaction_id); |
| 1235 if (!transaction) | 1235 if (!transaction) |
| 1236 return; | 1236 return; |
| 1237 DCHECK_NE(transaction->mode(), indexed_db::TRANSACTION_READ_ONLY); | 1237 DCHECK_NE(transaction->mode(), blink::WebIDBTransactionModeReadOnly); |
| 1238 | 1238 |
| 1239 if (!ValidateObjectStoreId(object_store_id)) | 1239 if (!ValidateObjectStoreId(object_store_id)) |
| 1240 return; | 1240 return; |
| 1241 | 1241 |
| 1242 transaction->ScheduleTask(base::Bind( | 1242 transaction->ScheduleTask(base::Bind( |
| 1243 &IndexedDBDatabase::ClearOperation, this, object_store_id, callbacks)); | 1243 &IndexedDBDatabase::ClearOperation, this, object_store_id, callbacks)); |
| 1244 } | 1244 } |
| 1245 | 1245 |
| 1246 void IndexedDBDatabase::ClearOperation( | 1246 void IndexedDBDatabase::ClearOperation( |
| 1247 int64 object_store_id, | 1247 int64 object_store_id, |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1328 new PendingSuccessCall(callbacks, connection.get(), version)); | 1328 new PendingSuccessCall(callbacks, connection.get(), version)); |
| 1329 callbacks->OnUpgradeNeeded(old_version, connection.Pass(), metadata()); | 1329 callbacks->OnUpgradeNeeded(old_version, connection.Pass(), metadata()); |
| 1330 } | 1330 } |
| 1331 | 1331 |
| 1332 void IndexedDBDatabase::TransactionFinished(IndexedDBTransaction* transaction, | 1332 void IndexedDBDatabase::TransactionFinished(IndexedDBTransaction* transaction, |
| 1333 bool committed) { | 1333 bool committed) { |
| 1334 DCHECK(transactions_.find(transaction->id()) != transactions_.end()); | 1334 DCHECK(transactions_.find(transaction->id()) != transactions_.end()); |
| 1335 DCHECK_EQ(transactions_[transaction->id()], transaction); | 1335 DCHECK_EQ(transactions_[transaction->id()], transaction); |
| 1336 transactions_.erase(transaction->id()); | 1336 transactions_.erase(transaction->id()); |
| 1337 | 1337 |
| 1338 if (transaction->mode() == indexed_db::TRANSACTION_VERSION_CHANGE) { | 1338 if (transaction->mode() == blink::WebIDBTransactionModeVersionChange) { |
| 1339 if (pending_second_half_open_) { | 1339 if (pending_second_half_open_) { |
| 1340 if (committed) { | 1340 if (committed) { |
| 1341 DCHECK_EQ(pending_second_half_open_->version(), metadata_.int_version); | 1341 DCHECK_EQ(pending_second_half_open_->version(), metadata_.int_version); |
| 1342 DCHECK(metadata_.id != kInvalidId); | 1342 DCHECK(metadata_.id != kInvalidId); |
| 1343 | 1343 |
| 1344 // Connection was already minted for OnUpgradeNeeded callback. | 1344 // Connection was already minted for OnUpgradeNeeded callback. |
| 1345 scoped_ptr<IndexedDBConnection> connection; | 1345 scoped_ptr<IndexedDBConnection> connection; |
| 1346 pending_second_half_open_->callbacks()->OnSuccess(connection.Pass(), | 1346 pending_second_half_open_->callbacks()->OnSuccess(connection.Pass(), |
| 1347 this->metadata()); | 1347 this->metadata()); |
| 1348 } else { | 1348 } else { |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1429 OpenConnection(pending_open_calls.front()); | 1429 OpenConnection(pending_open_calls.front()); |
| 1430 pending_open_calls.pop_front(); | 1430 pending_open_calls.pop_front(); |
| 1431 } | 1431 } |
| 1432 } | 1432 } |
| 1433 } | 1433 } |
| 1434 | 1434 |
| 1435 void IndexedDBDatabase::CreateTransaction( | 1435 void IndexedDBDatabase::CreateTransaction( |
| 1436 int64 transaction_id, | 1436 int64 transaction_id, |
| 1437 IndexedDBConnection* connection, | 1437 IndexedDBConnection* connection, |
| 1438 const std::vector<int64>& object_store_ids, | 1438 const std::vector<int64>& object_store_ids, |
| 1439 uint16 mode) { | 1439 uint16 mode) { |
|
jsbell
2014/06/11 16:42:01
Can you change this to use blink::WebIDBTransactio
Pritam Nikam
2014/06/12 11:19:20
Done.
| |
| 1440 | 1440 |
| 1441 IDB_TRACE("IndexedDBDatabase::CreateTransaction"); | 1441 IDB_TRACE("IndexedDBDatabase::CreateTransaction"); |
| 1442 DCHECK(connections_.count(connection)); | 1442 DCHECK(connections_.count(connection)); |
| 1443 DCHECK(transactions_.find(transaction_id) == transactions_.end()); | 1443 DCHECK(transactions_.find(transaction_id) == transactions_.end()); |
| 1444 if (transactions_.find(transaction_id) != transactions_.end()) | 1444 if (transactions_.find(transaction_id) != transactions_.end()) |
| 1445 return; | 1445 return; |
| 1446 | 1446 |
| 1447 // The transaction will add itself to this database's coordinator, which | 1447 // The transaction will add itself to this database's coordinator, which |
| 1448 // manages the lifetime of the object. | 1448 // manages the lifetime of the object. |
| 1449 TransactionCreated(new IndexedDBTransaction( | 1449 TransactionCreated(new IndexedDBTransaction( |
| 1450 transaction_id, | 1450 transaction_id, |
| 1451 connection->callbacks(), | 1451 connection->callbacks(), |
| 1452 std::set<int64>(object_store_ids.begin(), object_store_ids.end()), | 1452 std::set<int64>(object_store_ids.begin(), object_store_ids.end()), |
| 1453 static_cast<indexed_db::TransactionMode>(mode), | 1453 static_cast<blink::WebIDBTransactionMode>(mode), |
|
jsbell
2014/06/11 16:42:01
... and then this cast can go away.
Pritam Nikam
2014/06/12 11:19:20
Done.
| |
| 1454 this, | 1454 this, |
| 1455 new IndexedDBBackingStore::Transaction(backing_store_))); | 1455 new IndexedDBBackingStore::Transaction(backing_store_))); |
| 1456 } | 1456 } |
| 1457 | 1457 |
| 1458 void IndexedDBDatabase::TransactionCreated(IndexedDBTransaction* transaction) { | 1458 void IndexedDBDatabase::TransactionCreated(IndexedDBTransaction* transaction) { |
| 1459 transactions_[transaction->id()] = transaction; | 1459 transactions_[transaction->id()] = transaction; |
| 1460 } | 1460 } |
| 1461 | 1461 |
| 1462 bool IndexedDBDatabase::IsOpenConnectionBlocked() const { | 1462 bool IndexedDBDatabase::IsOpenConnectionBlocked() const { |
| 1463 return !pending_delete_calls_.empty() || | 1463 return !pending_delete_calls_.empty() || |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1596 void IndexedDBDatabase::RunVersionChangeTransactionFinal( | 1596 void IndexedDBDatabase::RunVersionChangeTransactionFinal( |
| 1597 scoped_refptr<IndexedDBCallbacks> callbacks, | 1597 scoped_refptr<IndexedDBCallbacks> callbacks, |
| 1598 scoped_ptr<IndexedDBConnection> connection, | 1598 scoped_ptr<IndexedDBConnection> connection, |
| 1599 int64 transaction_id, | 1599 int64 transaction_id, |
| 1600 int64 requested_version) { | 1600 int64 requested_version) { |
| 1601 | 1601 |
| 1602 std::vector<int64> object_store_ids; | 1602 std::vector<int64> object_store_ids; |
| 1603 CreateTransaction(transaction_id, | 1603 CreateTransaction(transaction_id, |
| 1604 connection.get(), | 1604 connection.get(), |
| 1605 object_store_ids, | 1605 object_store_ids, |
| 1606 indexed_db::TRANSACTION_VERSION_CHANGE); | 1606 blink::WebIDBTransactionModeVersionChange); |
| 1607 | 1607 |
| 1608 transactions_[transaction_id]->ScheduleTask( | 1608 transactions_[transaction_id]->ScheduleTask( |
| 1609 base::Bind(&IndexedDBDatabase::VersionChangeOperation, | 1609 base::Bind(&IndexedDBDatabase::VersionChangeOperation, |
| 1610 this, | 1610 this, |
| 1611 requested_version, | 1611 requested_version, |
| 1612 callbacks, | 1612 callbacks, |
| 1613 base::Passed(&connection))); | 1613 base::Passed(&connection))); |
| 1614 DCHECK(!pending_second_half_open_); | 1614 DCHECK(!pending_second_half_open_); |
| 1615 } | 1615 } |
| 1616 | 1616 |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1743 const base::string16& previous_version, | 1743 const base::string16& previous_version, |
| 1744 int64 previous_int_version, | 1744 int64 previous_int_version, |
| 1745 IndexedDBTransaction* transaction) { | 1745 IndexedDBTransaction* transaction) { |
| 1746 IDB_TRACE("IndexedDBDatabase::VersionChangeAbortOperation"); | 1746 IDB_TRACE("IndexedDBDatabase::VersionChangeAbortOperation"); |
| 1747 DCHECK(!transaction); | 1747 DCHECK(!transaction); |
| 1748 metadata_.version = previous_version; | 1748 metadata_.version = previous_version; |
| 1749 metadata_.int_version = previous_int_version; | 1749 metadata_.int_version = previous_int_version; |
| 1750 } | 1750 } |
| 1751 | 1751 |
| 1752 } // namespace content | 1752 } // namespace content |
| OLD | NEW |