Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(169)

Side by Side Diff: third_party/WebKit/Source/modules/indexeddb/IDBObjectStore.cpp

Issue 2314933005: Align IndexedDB metadata rollback on transaction abort to spec. (Closed)
Patch Set: Add failing tests. Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 746 matching lines...) Expand 10 before | Expand all | Expand 10 after
757 if (!backendDB()) { 757 if (!backendDB()) {
758 exceptionState.throwDOMException(InvalidStateError, IDBDatabase::databas eClosedErrorMessage); 758 exceptionState.throwDOMException(InvalidStateError, IDBDatabase::databas eClosedErrorMessage);
759 return nullptr; 759 return nullptr;
760 } 760 }
761 761
762 IDBRequest* request = IDBRequest::create(scriptState, IDBAny::create(this), m_transaction.get()); 762 IDBRequest* request = IDBRequest::create(scriptState, IDBAny::create(this), m_transaction.get());
763 backendDB()->count(m_transaction->id(), id(), IDBIndexMetadata::InvalidId, k eyRange, WebIDBCallbacksImpl::create(request).release()); 763 backendDB()->count(m_transaction->id(), id(), IDBIndexMetadata::InvalidId, k eyRange, WebIDBCallbacksImpl::create(request).release());
764 return request; 764 return request;
765 } 765 }
766 766
767 void IDBObjectStore::abort() 767 void IDBObjectStore::versionChangeTransactionAborted()
768 { 768 {
769 for (auto& index : m_createdIndexes) 769 for (auto& index : m_createdIndexes)
770 index->markDeleted(); 770 index->markDeleted();
771 } 771 }
772 772
773 void IDBObjectStore::transactionFinished() 773 void IDBObjectStore::transactionFinished()
774 { 774 {
775 ASSERT(m_transaction->isFinished()); 775 ASSERT(m_transaction->isFinished());
776 776
777 // Break reference cycles. 777 // Break reference cycles.
778 // TODO(jsbell): This can be removed c/o Oilpan. 778 // TODO(jsbell): This can be removed c/o Oilpan.
779 m_indexMap.clear(); 779 m_indexMap.clear();
780 m_createdIndexes.clear(); 780 m_createdIndexes.clear();
781 } 781 }
782 782
783 void IDBObjectStore::rollbackMetadata(const IDBObjectStoreMetadata& previousMeta data)
784 {
785 DCHECK(m_metadata.id == previousMetadata.id);
786 m_metadata = previousMetadata;
787 }
788
789
783 int64_t IDBObjectStore::findIndexId(const String& name) const 790 int64_t IDBObjectStore::findIndexId(const String& name) const
784 { 791 {
785 for (const auto& it : m_metadata.indexes) { 792 for (const auto& it : m_metadata.indexes) {
786 if (it.value.name == name) { 793 if (it.value.name == name) {
787 ASSERT(it.key != IDBIndexMetadata::InvalidId); 794 ASSERT(it.key != IDBIndexMetadata::InvalidId);
788 return it.key; 795 return it.key;
789 } 796 }
790 } 797 }
791 return IDBIndexMetadata::InvalidId; 798 return IDBIndexMetadata::InvalidId;
792 } 799 }
793 800
794 WebIDBDatabase* IDBObjectStore::backendDB() const 801 WebIDBDatabase* IDBObjectStore::backendDB() const
795 { 802 {
796 return m_transaction->backendDB(); 803 return m_transaction->backendDB();
797 } 804 }
798 805
799 } // namespace blink 806 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698