Changeset 65879 in webkit
- Timestamp:
- Aug 24, 2010 2:05:38 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r65878 r65879 1 2010-08-24 Andrei Popescu <andreip@dhcp-172-16-14-12.lon.corp.google.com> 2 3 Reviewed by Jeremy Orlow. 4 5 Implement IDBTransaction::objectStore 6 7 [IndexedDB] IDBTransaction is missing the implementation for objectStore method 8 https://bugs.webkit.org/show_bug.cgi?id=44446 9 10 * storage/indexeddb/script-tests/transaction-basics.js: 11 (test): 12 (openSuccess): 13 (createSuccess): 14 (abortCallback): 15 * storage/indexeddb/transaction-basics-expected.txt: 16 1 17 2010-08-24 Andreas Kling <andreas.kling@nokia.com> 2 18 -
trunk/LayoutTests/storage/indexeddb/script-tests/transaction-basics.js
r65670 r65879 2 2 if (window.layoutTestController) 3 3 layoutTestController.waitUntilDone(); 4 5 function abortCallback()6 {7 verifyAbortEvent(event);8 done();9 }10 11 function createTransactionCallback()12 {13 verifySuccessEvent(event);14 transaction = evalAndLog("event.result.transaction()");15 transaction.onabort = abortCallback;16 }17 4 18 5 function test() … … 23 10 result = evalAndLog("indexedDB.open('name', 'description')"); 24 11 verifyResult(result); 25 result.onsuccess = createTransactionCallback;12 result.onsuccess = openSuccess; 26 13 result.onerror = unexpectedErrorCallback; 14 } 15 16 function openSuccess() 17 { 18 debug("createObjectStoreCallback():"); 19 verifySuccessEvent(event); 20 db = evalAndLog("db = event.result"); 21 22 deleteAllObjectStores(db); 23 24 result = evalAndLog("db.createObjectStore('storeName', null)"); 25 verifyResult(result); 26 result.onsuccess = createSuccess; 27 result.onerror = unexpectedErrorCallback; 28 } 29 30 function createSuccess() 31 { 32 verifySuccessEvent(event); 33 transaction = evalAndLog("db.transaction()"); 34 transaction.onabort = abortCallback; 35 var store = evalAndLog("store = transaction.objectStore('storeName')"); 36 shouldBeEqualToString("store.name", "storeName"); 37 } 38 39 function abortCallback() 40 { 41 verifyAbortEvent(event); 42 done(); 27 43 } 28 44 -
trunk/LayoutTests/storage/indexeddb/transaction-basics-expected.txt
r65670 r65879 7 7 PASS indexedDB == null is false 8 8 indexedDB.open('name', 'description') 9 PASS 'onsuccess' in result is true 10 PASS 'onerror' in result is true 11 PASS 'abort' in result is true 12 PASS 'readyState' in result is true 13 An event should fire shortly... 14 15 createObjectStoreCallback(): 16 Success event fired: 17 PASS 'result' in event is true 18 PASS 'code' in event is false 19 PASS 'message' in event is false 20 PASS 'source' in event is true 21 PASS event.source != null is true 22 PASS 'onsuccess' in event.target is true 23 PASS 'onerror' in event.target is true 24 PASS 'abort' in event.target is true 25 PASS 'readyState' in event.target is true 26 PASS event.target.readyState is event.target.DONE 27 28 db = event.result 29 db.createObjectStore('storeName', null) 9 30 PASS 'onsuccess' in result is true 10 31 PASS 'onerror' in result is true … … 25 46 PASS event.target.readyState is event.target.DONE 26 47 27 event.result.transaction() 48 db.transaction() 49 store = transaction.objectStore('storeName') 50 PASS store.name is "storeName" 28 51 Abort event fired: 29 52 PASS event.type is "abort" -
trunk/WebCore/ChangeLog
r65878 r65879 1 2010-08-24 Andrei Popescu <andreip@dhcp-172-16-14-12.lon.corp.google.com> 2 3 Reviewed by Jeremy Orlow. 4 5 [IndexedDB] IDBTransaction is missing the implementation for objectStore method 6 https://bugs.webkit.org/show_bug.cgi?id=44446 7 8 * storage/IDBDatabaseBackendImpl.cpp: 9 (WebCore::IDBDatabaseBackendImpl::transaction): 10 * storage/IDBTransactionBackendImpl.cpp: 11 (WebCore::IDBTransactionBackendImpl::create): 12 (WebCore::IDBTransactionBackendImpl::IDBTransactionBackendImpl): 13 (WebCore::IDBTransactionBackendImpl::objectStore): 14 * storage/IDBTransactionBackendImpl.h: 15 * storage/IDBTransactionCoordinator.cpp: 16 (WebCore::IDBTransactionCoordinator::createTransaction): 17 * storage/IDBTransactionCoordinator.h: 18 1 19 2010-08-24 Andreas Kling <andreas.kling@nokia.com> 2 20 -
trunk/WebCore/storage/IDBDatabaseBackendImpl.cpp
r65673 r65879 175 175 PassRefPtr<IDBTransactionBackendInterface> IDBDatabaseBackendImpl::transaction(DOMStringList* objectStores, unsigned short mode, unsigned long timeout) 176 176 { 177 return m_transactionCoordinator->createTransaction(objectStores, mode, timeout );177 return m_transactionCoordinator->createTransaction(objectStores, mode, timeout, this); 178 178 } 179 179 -
trunk/WebCore/storage/IDBTransactionBackendImpl.cpp
r65670 r65879 1 /* 2 * Copyright (C) 2010 Google Inc. All rights reserved. 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 8 * 1. Redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer. 10 * 2. Redistributions in binary form must reproduce the above copyright 11 * notice, this list of conditions and the following disclaimer in the 12 * documentation and/or other materials provided with the distribution. 13 * 14 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY 15 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY 18 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 */ 25 1 26 #include "config.h" 2 27 #include "IDBTransactionBackendImpl.h" … … 4 29 #if ENABLE(INDEXED_DATABASE) 5 30 31 #include "IDBDatabaseBackendImpl.h" 32 #include "SQLiteDatabase.h" 33 6 34 namespace WebCore { 7 35 8 PassRefPtr<IDBTransactionBackendInterface> IDBTransactionBackendImpl::create(DOMStringList* objectStores, unsigned short mode, unsigned long timeout, int id )36 PassRefPtr<IDBTransactionBackendInterface> IDBTransactionBackendImpl::create(DOMStringList* objectStores, unsigned short mode, unsigned long timeout, int id, IDBDatabaseBackendImpl* database) 9 37 { 10 return adoptRef(new IDBTransactionBackendImpl(objectStores, mode, timeout, id ));38 return adoptRef(new IDBTransactionBackendImpl(objectStores, mode, timeout, id, database)); 11 39 } 12 40 13 IDBTransactionBackendImpl::IDBTransactionBackendImpl(DOMStringList* objectStores, unsigned short mode, unsigned long timeout, int id )41 IDBTransactionBackendImpl::IDBTransactionBackendImpl(DOMStringList* objectStores, unsigned short mode, unsigned long timeout, int id, IDBDatabaseBackendImpl* database) 14 42 : m_objectStoreNames(objectStores) 15 43 , m_mode(mode) … … 17 45 , m_id(id) 18 46 , m_aborted(false) 47 , m_database(database) 19 48 { 20 49 } … … 22 51 PassRefPtr<IDBObjectStoreBackendInterface> IDBTransactionBackendImpl::objectStore(const String& name) 23 52 { 24 // FIXME: implement. 25 ASSERT_NOT_REACHED(); 26 return 0; 53 return m_database->objectStore(name, 0); // FIXME: remove mode param. 27 54 } 28 55 -
trunk/WebCore/storage/IDBTransactionBackendImpl.h
r65670 r65879 36 36 namespace WebCore { 37 37 38 class IDBDatabaseBackendImpl; 39 38 40 class IDBTransactionBackendImpl : public IDBTransactionBackendInterface { 39 41 public: 40 static PassRefPtr<IDBTransactionBackendInterface> create(DOMStringList* objectStores, unsigned short mode, unsigned long timeout, int id );42 static PassRefPtr<IDBTransactionBackendInterface> create(DOMStringList* objectStores, unsigned short mode, unsigned long timeout, int id, IDBDatabaseBackendImpl*); 41 43 virtual ~IDBTransactionBackendImpl() { } 42 44 … … 49 51 50 52 private: 51 IDBTransactionBackendImpl(DOMStringList* objectStores, unsigned short mode, unsigned long timeout, int id );53 IDBTransactionBackendImpl(DOMStringList* objectStores, unsigned short mode, unsigned long timeout, int id, IDBDatabaseBackendImpl*); 52 54 53 55 RefPtr<DOMStringList> m_objectStoreNames; … … 57 59 bool m_aborted; 58 60 RefPtr<IDBTransactionCallbacks> m_callbacks; 61 RefPtr<IDBDatabaseBackendImpl> m_database; 59 62 }; 60 63 -
trunk/WebCore/storage/IDBTransactionCoordinator.cpp
r65670 r65879 29 29 #if ENABLE(INDEXED_DATABASE) 30 30 31 #include "IDB ObjectStore.h"31 #include "IDBDatabaseBackendImpl.h" 32 32 #include "IDBObjectStoreBackendInterface.h" 33 33 #include "IDBTransactionBackendImpl.h" 34 #include "SQLiteDatabase.h" 34 35 #include "ScriptExecutionContext.h" 35 36 … … 45 46 } 46 47 47 PassRefPtr<IDBTransactionBackendInterface> IDBTransactionCoordinator::createTransaction(DOMStringList* objectStores, unsigned short mode, unsigned long timeout )48 PassRefPtr<IDBTransactionBackendInterface> IDBTransactionCoordinator::createTransaction(DOMStringList* objectStores, unsigned short mode, unsigned long timeout, IDBDatabaseBackendImpl* database) 48 49 { 49 RefPtr<IDBTransactionBackendInterface> transaction = IDBTransactionBackendImpl::create(objectStores, mode, timeout, ++m_nextID );50 RefPtr<IDBTransactionBackendInterface> transaction = IDBTransactionBackendImpl::create(objectStores, mode, timeout, ++m_nextID, database); 50 51 m_transactionQueue.add(transaction.get()); 51 52 m_idMap.add(m_nextID, transaction); -
trunk/WebCore/storage/IDBTransactionCoordinator.h
r65670 r65879 37 37 38 38 class IDBTransactionCallbacks; 39 class IDBDatabaseBackendImpl; 39 40 40 41 // This class manages transactions as follows. Requests for new transactions are … … 48 49 // the next transaction in the queue will have to wait until a thread becomes 49 50 // available. 51 // Transactions are executed in the order the were created. 50 52 class IDBTransactionCoordinator : public RefCounted<IDBTransactionCoordinator> { 51 53 public: … … 53 55 virtual ~IDBTransactionCoordinator(); 54 56 55 PassRefPtr<IDBTransactionBackendInterface> createTransaction(DOMStringList* objectStores, unsigned short mode, unsigned long timeout );57 PassRefPtr<IDBTransactionBackendInterface> createTransaction(DOMStringList* objectStores, unsigned short mode, unsigned long timeout, IDBDatabaseBackendImpl*); 56 58 void abort(int transactionId); 57 59
Note: See TracChangeset
for help on using the changeset viewer.