[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
jorlow at chromium.org
jorlow at chromium.org
Wed Dec 22 14:08:14 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit df692e61269747aaa3705c87b69cb5dd729ed8ec
Author: jorlow at chromium.org <jorlow at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Mon Oct 4 23:33:39 2010 +0000
2010-10-04 Jeremy Orlow <jorlow at chromium.org>
Reviewed by Nate Chapin.
Implement IndexedDB's oncomplete and ontimeout.
https://bugs.webkit.org/show_bug.cgi?id=47106
* storage/indexeddb/resources/shared.js:
(verifyCompleteEvent):
* storage/indexeddb/transaction-basics.html:
2010-10-04 Jeremy Orlow <jorlow at chromium.org>
Reviewed by Nate Chapin.
Implement IndexedDB's oncomplete and ontimeout.
https://bugs.webkit.org/show_bug.cgi?id=47106
Add ontimeout and oncomplete to IDBTransaction and plumb
them. Test this behavior in the existing IDBTransaction-basics
test.
* WebCore.gypi:
* storage/IDBTransaction.cpp:
(WebCore::IDBTransaction::IDBTransaction):
(WebCore::IDBTransaction::mode):
(WebCore::IDBTransaction::objectStore):
(WebCore::IDBTransaction::abort):
(WebCore::IDBTransaction::onAbort):
(WebCore::IDBTransaction::onComplete):
(WebCore::IDBTransaction::onTimeout):
(WebCore::IDBTransaction::stop):
(WebCore::IDBTransaction::onAbortTimerFired):
(WebCore::IDBTransaction::onCompleteTimerFired):
(WebCore::IDBTransaction::onTimeoutTimerFired):
* storage/IDBTransaction.h:
* storage/IDBTransactionBackendImpl.cpp:
(WebCore::IDBTransactionBackendImpl::IDBTransactionBackendImpl):
(WebCore::IDBTransactionBackendImpl::commit):
* storage/IDBTransactionCallbacks.h:
2010-10-04 Jeremy Orlow <jorlow at chromium.org>
Reviewed by Nate Chapin.
Implement IndexedDB's oncomplete and ontimeout.
https://bugs.webkit.org/show_bug.cgi?id=47106
* public/WebIDBTransactionCallbacks.h:
(WebKit::WebIDBTransactionCallbacks::id):
(WebKit::WebIDBTransactionCallbacks::onAbort):
(WebKit::WebIDBTransactionCallbacks::onComplete):
(WebKit::WebIDBTransactionCallbacks::onTimeout):
* src/IDBTransactionCallbacksProxy.cpp:
(WebCore::IDBTransactionCallbacksProxy::onComplete):
(WebCore::IDBTransactionCallbacksProxy::onTimeout):
* src/IDBTransactionCallbacksProxy.h:
* src/WebIDBTransactionCallbacksImpl.cpp:
(WebCore::WebIDBTransactionCallbacksImpl::onComplete):
(WebCore::WebIDBTransactionCallbacksImpl::onTimeout):
* src/WebIDBTransactionCallbacksImpl.h:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@69052 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 2d2dd66..c3d2d0a 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,14 @@
+2010-10-04 Jeremy Orlow <jorlow at chromium.org>
+
+ Reviewed by Nate Chapin.
+
+ Implement IndexedDB's oncomplete and ontimeout.
+ https://bugs.webkit.org/show_bug.cgi?id=47106
+
+ * storage/indexeddb/resources/shared.js:
+ (verifyCompleteEvent):
+ * storage/indexeddb/transaction-basics.html:
+
2010-10-04 Enrica Casucci <enrica at apple.com>
Reviewed by Darin Adler.
diff --git a/LayoutTests/storage/indexeddb/resources/shared.js b/LayoutTests/storage/indexeddb/resources/shared.js
index ea4a525..7e11406 100644
--- a/LayoutTests/storage/indexeddb/resources/shared.js
+++ b/LayoutTests/storage/indexeddb/resources/shared.js
@@ -40,6 +40,12 @@ function verifyAbortEvent(event)
shouldBeEqualToString("event.type", "abort");
}
+function verifyCompleteEvent(event)
+{
+ debug("Complete event fired:");
+ shouldBeEqualToString("event.type", "complete");
+}
+
function verifyResult(result)
{
shouldBeTrue("'onsuccess' in result");
diff --git a/LayoutTests/storage/indexeddb/transaction-basics-expected.txt b/LayoutTests/storage/indexeddb/transaction-basics-expected.txt
index fce593b..103b8c2 100644
--- a/LayoutTests/storage/indexeddb/transaction-basics-expected.txt
+++ b/LayoutTests/storage/indexeddb/transaction-basics-expected.txt
@@ -66,6 +66,9 @@ store = transaction.objectStore('storeName')
PASS store.name is "storeName"
Abort event fired:
PASS event.type is "abort"
+Complete event fired:
+PASS event.type is "complete"
+PASS oncomplete event had fired
PASS successfullyParsed is true
TEST COMPLETE
diff --git a/LayoutTests/storage/indexeddb/transaction-basics.html b/LayoutTests/storage/indexeddb/transaction-basics.html
index 8fb6493..62363db 100644
--- a/LayoutTests/storage/indexeddb/transaction-basics.html
+++ b/LayoutTests/storage/indexeddb/transaction-basics.html
@@ -44,10 +44,18 @@ function setVersionSuccess()
window.trans = evalAndLog("trans = event.result");
shouldBeTrue("trans !== null");
trans.onabort = unexpectedAbortCallback;
+ trans.oncomplete = completeCallback;
+ window.completeEventFired = false;
deleteAllObjectStores(db, finishedDeleting);
}
+function completeCallback()
+{
+ verifyCompleteEvent(event);
+ window.completeEventFired = true;
+}
+
function finishedDeleting()
{
result = evalAndLog("db.createObjectStore('storeName', null)");
@@ -68,13 +76,22 @@ function createSuccess()
function abortCallback()
{
verifyAbortEvent(event);
- done();
+ checkForCompleteEvent();
}
-test();
+function checkForCompleteEvent()
+{
+ if (completeEventFired) {
+ testPassed("oncomplete event had fired");
+ done();
+ } else
+ setTimeout(checkForCompleteEvent, 1);
+}
var successfullyParsed = true;
+test();
+
</script>
</body>
</html>
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 2350f36..46b1f80 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,33 @@
+2010-10-04 Jeremy Orlow <jorlow at chromium.org>
+
+ Reviewed by Nate Chapin.
+
+ Implement IndexedDB's oncomplete and ontimeout.
+ https://bugs.webkit.org/show_bug.cgi?id=47106
+
+ Add ontimeout and oncomplete to IDBTransaction and plumb
+ them. Test this behavior in the existing IDBTransaction-basics
+ test.
+
+ * WebCore.gypi:
+ * storage/IDBTransaction.cpp:
+ (WebCore::IDBTransaction::IDBTransaction):
+ (WebCore::IDBTransaction::mode):
+ (WebCore::IDBTransaction::objectStore):
+ (WebCore::IDBTransaction::abort):
+ (WebCore::IDBTransaction::onAbort):
+ (WebCore::IDBTransaction::onComplete):
+ (WebCore::IDBTransaction::onTimeout):
+ (WebCore::IDBTransaction::stop):
+ (WebCore::IDBTransaction::onAbortTimerFired):
+ (WebCore::IDBTransaction::onCompleteTimerFired):
+ (WebCore::IDBTransaction::onTimeoutTimerFired):
+ * storage/IDBTransaction.h:
+ * storage/IDBTransactionBackendImpl.cpp:
+ (WebCore::IDBTransactionBackendImpl::IDBTransactionBackendImpl):
+ (WebCore::IDBTransactionBackendImpl::commit):
+ * storage/IDBTransactionCallbacks.h:
+
2010-10-04 Enrica Casucci <enrica at apple.com>
Reviewed by Darin Adler.
diff --git a/WebCore/WebCore.gypi b/WebCore/WebCore.gypi
index 9b4779e..1289507 100644
--- a/WebCore/WebCore.gypi
+++ b/WebCore/WebCore.gypi
@@ -3760,6 +3760,8 @@
'storage/IDBAny.cpp',
'storage/IDBAny.h',
'storage/IDBCallbacks.h',
+ 'storage/IDBCompleteEvent.cpp',
+ 'storage/IDBCompleteEvent.h',
'storage/IDBCursor.cpp',
'storage/IDBCursor.h',
'storage/IDBCursorBackendImpl.cpp',
@@ -3807,6 +3809,8 @@
'storage/IDBRequest.h',
'storage/IDBSuccessEvent.cpp',
'storage/IDBSuccessEvent.h',
+ 'storage/IDBTimeoutEvent.cpp',
+ 'storage/IDBTimeoutEvent.h',
'storage/IDBTransaction.cpp',
'storage/IDBTransaction.h',
'storage/IDBTransactionBackendImpl.cpp',
diff --git a/WebCore/storage/IDBCompleteEvent.cpp b/WebCore/storage/IDBCompleteEvent.cpp
new file mode 100644
index 0000000..f0ad9fc
--- /dev/null
+++ b/WebCore/storage/IDBCompleteEvent.cpp
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "IDBCompleteEvent.h"
+
+#if ENABLE(INDEXED_DATABASE)
+
+#include "EventNames.h"
+#include "IDBAny.h"
+
+namespace WebCore {
+
+PassRefPtr<IDBCompleteEvent> IDBCompleteEvent::create()
+{
+ return adoptRef(new IDBCompleteEvent());
+}
+
+IDBCompleteEvent::IDBCompleteEvent()
+ : IDBEvent(eventNames().completeEvent, 0) // FIXME: set the source to the transaction
+{
+}
+
+IDBCompleteEvent::~IDBCompleteEvent()
+{
+}
+
+} // namespace WebCore
+
+#endif
diff --git a/WebCore/storage/IDBCompleteEvent.h b/WebCore/storage/IDBCompleteEvent.h
new file mode 100644
index 0000000..c407096
--- /dev/null
+++ b/WebCore/storage/IDBCompleteEvent.h
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef IDBCompleteEvent_h
+#define IDBCompleteEvent_h
+
+#if ENABLE(INDEXED_DATABASE)
+
+#include "IDBEvent.h"
+#include "PlatformString.h"
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefPtr.h>
+
+namespace WebCore {
+
+class IDBCompleteEvent : public IDBEvent {
+public:
+ static PassRefPtr<IDBCompleteEvent> create();
+ // FIXME: Need to allow creation of these events from JS.
+ virtual ~IDBCompleteEvent();
+
+ virtual bool isIDBCompleteEvent() const { return true; }
+
+private:
+ IDBCompleteEvent();
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(INDEXED_DATABASE)
+
+#endif // IDBCompleteEvent_h
diff --git a/WebCore/storage/IDBTimeoutEvent.cpp b/WebCore/storage/IDBTimeoutEvent.cpp
new file mode 100644
index 0000000..b61ee47
--- /dev/null
+++ b/WebCore/storage/IDBTimeoutEvent.cpp
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "IDBTimeoutEvent.h"
+
+#if ENABLE(INDEXED_DATABASE)
+
+#include "EventNames.h"
+#include "IDBAny.h"
+
+namespace WebCore {
+
+PassRefPtr<IDBTimeoutEvent> IDBTimeoutEvent::create()
+{
+ return adoptRef(new IDBTimeoutEvent());
+}
+
+IDBTimeoutEvent::IDBTimeoutEvent()
+ : IDBEvent(eventNames().abortEvent, 0) // FIXME: set the source to the transaction
+{
+}
+
+IDBTimeoutEvent::~IDBTimeoutEvent()
+{
+}
+
+} // namespace WebCore
+
+#endif
diff --git a/WebCore/storage/IDBTimeoutEvent.h b/WebCore/storage/IDBTimeoutEvent.h
new file mode 100644
index 0000000..afc9ba4
--- /dev/null
+++ b/WebCore/storage/IDBTimeoutEvent.h
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef IDBTimeoutEvent_h
+#define IDBTimeoutEvent_h
+
+#if ENABLE(INDEXED_DATABASE)
+
+#include "IDBEvent.h"
+#include "PlatformString.h"
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefPtr.h>
+
+namespace WebCore {
+
+class IDBTimeoutEvent : public IDBEvent {
+public:
+ static PassRefPtr<IDBTimeoutEvent> create();
+ // FIXME: Need to allow creation of these events from JS.
+ virtual ~IDBTimeoutEvent();
+
+ virtual bool isIDBTimeoutEvent() const { return true; }
+
+private:
+ IDBTimeoutEvent();
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(INDEXED_DATABASE)
+
+#endif // IDBTimeoutEvent_h
diff --git a/WebCore/storage/IDBTransaction.cpp b/WebCore/storage/IDBTransaction.cpp
index a223b7f..1e14326 100644
--- a/WebCore/storage/IDBTransaction.cpp
+++ b/WebCore/storage/IDBTransaction.cpp
@@ -31,11 +31,13 @@
#include "Event.h"
#include "EventException.h"
#include "IDBAbortEvent.h"
+#include "IDBCompleteEvent.h"
#include "IDBDatabase.h"
#include "IDBDatabaseException.h"
#include "IDBObjectStore.h"
#include "IDBObjectStoreBackendInterface.h"
#include "IDBPendingTransactionMonitor.h"
+#include "IDBTimeoutEvent.h"
#include "ScriptExecutionContext.h"
namespace WebCore {
@@ -44,8 +46,10 @@ IDBTransaction::IDBTransaction(ScriptExecutionContext* context, PassRefPtr<IDBTr
: ActiveDOMObject(context, this)
, m_backend(backend)
, m_database(db)
- , m_stopped(false)
- , m_timer(this, &IDBTransaction::timerFired)
+ , m_mode(m_backend->mode())
+ , m_onAbortTimer(this, &IDBTransaction::onAbortTimerFired)
+ , m_onCompleteTimer(this, &IDBTransaction::onCompleteTimerFired)
+ , m_onTimeoutTimer(this, &IDBTransaction::onTimeoutTimerFired)
{
IDBPendingTransactionMonitor::addPendingTransaction(m_backend.get());
}
@@ -56,7 +60,7 @@ IDBTransaction::~IDBTransaction()
unsigned short IDBTransaction::mode() const
{
- return m_backend->mode();
+ return m_mode;
}
IDBDatabase* IDBTransaction::db()
@@ -66,6 +70,10 @@ IDBDatabase* IDBTransaction::db()
PassRefPtr<IDBObjectStore> IDBTransaction::objectStore(const String& name, const ExceptionCode&)
{
+ if (!m_backend) {
+ // FIXME: throw IDBDatabaseException::NOT_ALLOWED_ERR.
+ return 0;
+ }
RefPtr<IDBObjectStoreBackendInterface> objectStoreBackend = m_backend->objectStore(name);
if (!objectStoreBackend) {
// FIXME: throw IDBDatabaseException::NOT_ALLOWED_ERR.
@@ -77,7 +85,8 @@ PassRefPtr<IDBObjectStore> IDBTransaction::objectStore(const String& name, const
void IDBTransaction::abort()
{
- m_backend->abort();
+ if (m_backend)
+ m_backend->abort();
}
ScriptExecutionContext* IDBTransaction::scriptExecutionContext() const
@@ -87,18 +96,32 @@ ScriptExecutionContext* IDBTransaction::scriptExecutionContext() const
void IDBTransaction::onAbort()
{
- if (!m_stopped) {
- m_selfRef = this;
- m_stopped = true;
- m_timer.startOneShot(0);
- }
- // Release the backend as it holds a (circular) reference back to us.
- m_backend.clear();
+ ASSERT(!m_onAbortTimer.isActive());
+ ASSERT(!m_onCompleteTimer.isActive());
+ ASSERT(!m_onTimeoutTimer.isActive());
+ m_selfRef = this;
+ m_onAbortTimer.startOneShot(0);
+ m_backend.clear(); // Release the backend as it holds a (circular) reference back to us.
}
-int IDBTransaction::id() const
+void IDBTransaction::onComplete()
{
- return m_backend->id();
+ ASSERT(!m_onAbortTimer.isActive());
+ ASSERT(!m_onCompleteTimer.isActive());
+ ASSERT(!m_onTimeoutTimer.isActive());
+ m_selfRef = this;
+ m_onCompleteTimer.startOneShot(0);
+ m_backend.clear(); // Release the backend as it holds a (circular) reference back to us.
+}
+
+void IDBTransaction::onTimeout()
+{
+ ASSERT(!m_onAbortTimer.isActive());
+ ASSERT(!m_onCompleteTimer.isActive());
+ ASSERT(!m_onTimeoutTimer.isActive());
+ m_selfRef = this;
+ m_onTimeoutTimer.startOneShot(0);
+ m_backend.clear(); // Release the backend as it holds a (circular) reference back to us.
}
bool IDBTransaction::canSuspend() const
@@ -110,11 +133,8 @@ bool IDBTransaction::canSuspend() const
void IDBTransaction::stop()
{
- if (!m_stopped) {
- // The document is getting detached. Abort!
- m_stopped = true;
+ if (m_backend)
m_backend->abort();
- }
}
EventTargetData* IDBTransaction::eventTargetData()
@@ -127,14 +147,28 @@ EventTargetData* IDBTransaction::ensureEventTargetData()
return &m_eventTargetData;
}
-void IDBTransaction::timerFired(Timer<IDBTransaction>* transaction)
+void IDBTransaction::onAbortTimerFired(Timer<IDBTransaction>* transaction)
{
ASSERT(m_selfRef);
-
RefPtr<IDBTransaction> selfRef = m_selfRef.release();
dispatchEvent(IDBAbortEvent::create());
}
+void IDBTransaction::onCompleteTimerFired(Timer<IDBTransaction>* transaction)
+{
+ ASSERT(m_selfRef);
+ RefPtr<IDBTransaction> selfRef = m_selfRef.release();
+ dispatchEvent(IDBCompleteEvent::create());
+}
+
+
+void IDBTransaction::onTimeoutTimerFired(Timer<IDBTransaction>* transaction)
+{
+ ASSERT(m_selfRef);
+ RefPtr<IDBTransaction> selfRef = m_selfRef.release();
+ dispatchEvent(IDBTimeoutEvent::create());
+}
+
}
#endif // ENABLE(INDEXED_DATABASE)
diff --git a/WebCore/storage/IDBTransaction.h b/WebCore/storage/IDBTransaction.h
index 0d6f3ea..26c9215 100644
--- a/WebCore/storage/IDBTransaction.h
+++ b/WebCore/storage/IDBTransaction.h
@@ -69,7 +69,8 @@ public:
// IDBTransactionCallbacks
virtual void onAbort();
- virtual int id() const;
+ virtual void onComplete();
+ virtual void onTimeout();
// EventTarget
virtual IDBTransaction* toIDBTransaction() { return this; }
@@ -91,14 +92,18 @@ private:
virtual EventTargetData* eventTargetData();
virtual EventTargetData* ensureEventTargetData();
- void timerFired(Timer<IDBTransaction>*);
+ void onAbortTimerFired(Timer<IDBTransaction>*);
+ void onCompleteTimerFired(Timer<IDBTransaction>*);
+ void onTimeoutTimerFired(Timer<IDBTransaction>*);
EventTargetData m_eventTargetData;
RefPtr<IDBTransactionBackendInterface> m_backend;
RefPtr<IDBDatabase> m_database;
+ unsigned short m_mode;
- bool m_stopped;
- Timer<IDBTransaction> m_timer;
+ Timer<IDBTransaction> m_onAbortTimer;
+ Timer<IDBTransaction> m_onCompleteTimer;
+ Timer<IDBTransaction> m_onTimeoutTimer;
RefPtr<IDBTransaction> m_selfRef; // This is set to us iff there's an event pending.
};
diff --git a/WebCore/storage/IDBTransactionBackendImpl.cpp b/WebCore/storage/IDBTransactionBackendImpl.cpp
index 1757295..32a7d70 100644
--- a/WebCore/storage/IDBTransactionBackendImpl.cpp
+++ b/WebCore/storage/IDBTransactionBackendImpl.cpp
@@ -42,7 +42,7 @@ PassRefPtr<IDBTransactionBackendImpl> IDBTransactionBackendImpl::create(DOMStrin
IDBTransactionBackendImpl::IDBTransactionBackendImpl(DOMStringList* objectStores, unsigned short mode, unsigned long timeout, int id, IDBDatabaseBackendImpl* database)
: m_objectStoreNames(objectStores)
, m_mode(mode)
- , m_timeout(timeout)
+ , m_timeout(timeout) // FIXME: Implement timeout.
, m_id(id)
, m_state(Unused)
, m_database(database)
@@ -129,6 +129,7 @@ void IDBTransactionBackendImpl::commit()
m_state = Finished;
m_transaction->commit();
+ m_callbacks->onComplete();
m_database->transactionCoordinator()->didFinishTransaction(this);
}
diff --git a/WebCore/storage/IDBTransactionCallbacks.h b/WebCore/storage/IDBTransactionCallbacks.h
index 38181fc..348608d 100644
--- a/WebCore/storage/IDBTransactionCallbacks.h
+++ b/WebCore/storage/IDBTransactionCallbacks.h
@@ -41,8 +41,8 @@ public:
virtual ~IDBTransactionCallbacks() { }
virtual void onAbort() = 0;
- virtual int id() const = 0;
- // FIXME: add the rest
+ virtual void onComplete() = 0;
+ virtual void onTimeout() = 0;
};
} // namespace WebCore
diff --git a/WebKit/chromium/ChangeLog b/WebKit/chromium/ChangeLog
index f1d08a8..0e94578 100644
--- a/WebKit/chromium/ChangeLog
+++ b/WebKit/chromium/ChangeLog
@@ -1,3 +1,24 @@
+2010-10-04 Jeremy Orlow <jorlow at chromium.org>
+
+ Reviewed by Nate Chapin.
+
+ Implement IndexedDB's oncomplete and ontimeout.
+ https://bugs.webkit.org/show_bug.cgi?id=47106
+
+ * public/WebIDBTransactionCallbacks.h:
+ (WebKit::WebIDBTransactionCallbacks::id):
+ (WebKit::WebIDBTransactionCallbacks::onAbort):
+ (WebKit::WebIDBTransactionCallbacks::onComplete):
+ (WebKit::WebIDBTransactionCallbacks::onTimeout):
+ * src/IDBTransactionCallbacksProxy.cpp:
+ (WebCore::IDBTransactionCallbacksProxy::onComplete):
+ (WebCore::IDBTransactionCallbacksProxy::onTimeout):
+ * src/IDBTransactionCallbacksProxy.h:
+ * src/WebIDBTransactionCallbacksImpl.cpp:
+ (WebCore::WebIDBTransactionCallbacksImpl::onComplete):
+ (WebCore::WebIDBTransactionCallbacksImpl::onTimeout):
+ * src/WebIDBTransactionCallbacksImpl.h:
+
2010-10-04 Adam Barth <abarth at webkit.org>
Reviewed by Darin Adler.
diff --git a/WebKit/chromium/public/WebIDBTransactionCallbacks.h b/WebKit/chromium/public/WebIDBTransactionCallbacks.h
index 4b92217..508925d 100644
--- a/WebKit/chromium/public/WebIDBTransactionCallbacks.h
+++ b/WebKit/chromium/public/WebIDBTransactionCallbacks.h
@@ -33,12 +33,16 @@ class WebIDBTransactionCallbacks {
public:
virtual ~WebIDBTransactionCallbacks() { }
- virtual void onAbort() { WEBKIT_ASSERT_NOT_REACHED(); }
- virtual int id() const
- {
+ // FIXME: Remove.
+ virtual int id()
+ {
WEBKIT_ASSERT_NOT_REACHED();
return 0;
}
+
+ virtual void onAbort() { WEBKIT_ASSERT_NOT_REACHED(); }
+ virtual void onComplete() { WEBKIT_ASSERT_NOT_REACHED(); }
+ virtual void onTimeout() { WEBKIT_ASSERT_NOT_REACHED(); }
};
} // namespace WebKit
diff --git a/WebKit/chromium/src/IDBTransactionCallbacksProxy.cpp b/WebKit/chromium/src/IDBTransactionCallbacksProxy.cpp
index be7d44f..3a19fe2 100644
--- a/WebKit/chromium/src/IDBTransactionCallbacksProxy.cpp
+++ b/WebKit/chromium/src/IDBTransactionCallbacksProxy.cpp
@@ -55,9 +55,16 @@ void IDBTransactionCallbacksProxy::onAbort()
m_callbacks.clear();
}
-int IDBTransactionCallbacksProxy::id() const
+void IDBTransactionCallbacksProxy::onComplete()
{
- return m_callbacks->id();
+ m_callbacks->onComplete();
+ m_callbacks.clear();
+}
+
+void IDBTransactionCallbacksProxy::onTimeout()
+{
+ m_callbacks->onTimeout();
+ m_callbacks.clear();
}
} // namespace WebCore
diff --git a/WebKit/chromium/src/IDBTransactionCallbacksProxy.h b/WebKit/chromium/src/IDBTransactionCallbacksProxy.h
index 821eff4..891d5c9 100644
--- a/WebKit/chromium/src/IDBTransactionCallbacksProxy.h
+++ b/WebKit/chromium/src/IDBTransactionCallbacksProxy.h
@@ -46,8 +46,8 @@ public:
virtual ~IDBTransactionCallbacksProxy();
virtual void onAbort();
- virtual int id() const;
- // FIXME: implement onComplete().
+ virtual void onComplete();
+ virtual void onTimeout();
private:
IDBTransactionCallbacksProxy(PassOwnPtr<WebKit::WebIDBTransactionCallbacks>);
diff --git a/WebKit/chromium/src/WebIDBTransactionCallbacksImpl.cpp b/WebKit/chromium/src/WebIDBTransactionCallbacksImpl.cpp
index 264ddc5..96924cf 100644
--- a/WebKit/chromium/src/WebIDBTransactionCallbacksImpl.cpp
+++ b/WebKit/chromium/src/WebIDBTransactionCallbacksImpl.cpp
@@ -46,9 +46,14 @@ void WebIDBTransactionCallbacksImpl::onAbort()
m_callbacks->onAbort();
}
-int WebIDBTransactionCallbacksImpl::id() const
+void WebIDBTransactionCallbacksImpl::onComplete()
{
- return m_callbacks->id();
+ m_callbacks->onComplete();
+}
+
+void WebIDBTransactionCallbacksImpl::onTimeout()
+{
+ m_callbacks->onTimeout();
}
} // namespace WebCore
diff --git a/WebKit/chromium/src/WebIDBTransactionCallbacksImpl.h b/WebKit/chromium/src/WebIDBTransactionCallbacksImpl.h
index 398a679..89b9cbe 100644
--- a/WebKit/chromium/src/WebIDBTransactionCallbacksImpl.h
+++ b/WebKit/chromium/src/WebIDBTransactionCallbacksImpl.h
@@ -42,7 +42,8 @@ public:
virtual ~WebIDBTransactionCallbacksImpl();
virtual void onAbort();
- virtual int id() const;
+ virtual void onComplete();
+ virtual void onTimeout();
private:
RefPtr<IDBTransactionCallbacks> m_callbacks;
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list