[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
andreip at google.com
andreip at google.com
Wed Dec 22 12:19:56 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit 829915196e7aa6a22dba14d7ec1c3f2c02c063f5
Author: andreip at google.com <andreip at google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Thu Aug 19 14:53:51 2010 +0000
2010-08-19 Andrei Popescu <andreip at google.com>
Reviewed by Jeremy Orlow.
[IndexedDB] Abort idle IDBTransactions when the JS context they were created in finishes execution.
https://bugs.webkit.org/show_bug.cgi?id=44101
* storage/indexeddb/resources/shared.js:
(unexpectedErrorCallback):
* storage/indexeddb/script-tests/transaction-basics.js: Added.
(abortCallback):
(createTransactionCallback):
(test):
* storage/indexeddb/transaction-basics-expected.txt: Added.
* storage/indexeddb/transaction-basics.html: Added.
2010-08-19 Andrei Popescu <andreip at google.com>
Reviewed by Jeremy Orlow.
[IndexedDB] Abort idle IDBTransactions when the JS context they were created in finishes execution.
https://bugs.webkit.org/show_bug.cgi?id=44101
This change also introduces the TransactionCoordinator, which will be used
to schedule transactions for execution.
Test: storage/indexeddb/transaction-basics.html
* WebCore.gypi:
* bindings/v8/V8DOMWrapper.cpp:
(WebCore::V8DOMWrapper::convertEventTargetToV8Object):
* bindings/v8/V8Proxy.cpp:
(WebCore::V8Proxy::runScript):
(WebCore::V8Proxy::callFunction):
(WebCore::V8Proxy::didLeaveScriptContext):
* bindings/v8/V8Proxy.h:
* dom/EventTarget.cpp:
(WebCore::EventTarget::toIDBTransaction):
* dom/EventTarget.h:
* page/PageGroup.h:
(WebCore::PageGroup::hasIDBFactory):
* storage/IDBAbortEvent.cpp: Added.
(WebCore::IDBAbortEvent::create):
(WebCore::IDBAbortEvent::IDBAbortEvent):
(WebCore::IDBAbortEvent::~IDBAbortEvent):
* storage/IDBAbortEvent.h: Added.
(WebCore::IDBAbortEvent::isIDBAbortEvent):
* storage/IDBDatabase.cpp:
(WebCore::IDBDatabase::transaction):
* storage/IDBDatabaseBackendImpl.cpp:
(WebCore::IDBDatabaseBackendImpl::IDBDatabaseBackendImpl):
(WebCore::IDBDatabaseBackendImpl::transaction):
* storage/IDBDatabaseBackendImpl.h:
(WebCore::IDBDatabaseBackendImpl::create):
* storage/IDBDatabaseBackendInterface.h:
* storage/IDBFactoryBackendImpl.cpp:
(WebCore::IDBFactoryBackendImpl::IDBFactoryBackendImpl):
(WebCore::IDBFactoryBackendImpl::open):
(WebCore::IDBFactoryBackendImpl::abortPendingTransactions):
* storage/IDBFactoryBackendImpl.h:
* storage/IDBFactoryBackendInterface.h:
* storage/IDBPendingTransactionMonitor.cpp: Added.
(WebCore::IDBPendingTransactionMonitor::addPendingTransaction):
(WebCore::IDBPendingTransactionMonitor::removePendingTransaction):
(WebCore::IDBPendingTransactionMonitor::clearPendingTransactions):
(WebCore::IDBPendingTransactionMonitor::pendingTransactions):
* storage/IDBPendingTransactionMonitor.h: Added.
* storage/IDBTransaction.cpp:
(WebCore::IDBTransaction::IDBTransaction):
(WebCore::IDBTransaction::onAbort):
(WebCore::IDBTransaction::id):
(WebCore::IDBTransaction::stop):
(WebCore::IDBTransaction::timerFired):
* storage/IDBTransaction.h:
* storage/IDBTransactionBackendInterface.h:
* storage/IDBTransactionCallbacks.h: Added.
(WebCore::IDBTransactionCallbacks::~IDBTransactionCallbacks):
* storage/IDBTransactionCoordinator.cpp: Added.
(WebCore::IDBTransactionBackendImpl::~IDBTransactionBackendImpl):
(WebCore::IDBTransactionBackendImpl::create):
(WebCore::IDBTransactionBackendImpl::IDBTransactionBackendImpl):
(WebCore::IDBTransactionBackendImpl::objectStore):
(WebCore::IDBTransactionBackendImpl::mode):
(WebCore::IDBTransactionBackendImpl::scheduleTask):
(WebCore::IDBTransactionBackendImpl::abort):
(WebCore::IDBTransactionBackendImpl::sqliteDatabase):
(WebCore::IDBTransactionBackendImpl::id):
(WebCore::IDBTransactionBackendImpl::setCallbacks):
(WebCore::IDBTransactionCoordinator::IDBTransactionCoordinator):
(WebCore::IDBTransactionCoordinator::~IDBTransactionCoordinator):
(WebCore::IDBTransactionCoordinator::createTransaction):
(WebCore::IDBTransactionCoordinator::abort):
* storage/IDBTransactionCoordinator.h: Added.
(WebCore::IDBTransactionCoordinator::create):
2010-08-19 Andrei Popescu <andreip at google.com>
Reviewed by Jeremy Orlow.
[IndexedDB] Abort idle IDBTransactions when the JS context they were created in finishes execution.
https://bugs.webkit.org/show_bug.cgi?id=44101
* WebKit.gyp:
* public/WebIDBDatabase.h:
(WebKit::WebIDBDatabase::transaction):
* public/WebIDBFactory.h:
(WebKit::WebIDBFactory::abortPendingTransactions):
* public/WebIDBTransaction.h: Added.
(WebKit::WebIDBTransaction::~WebIDBTransaction):
(WebKit::WebIDBTransaction::mode):
(WebKit::WebIDBTransaction::objectStore):
(WebKit::WebIDBTransaction::abort):
(WebKit::WebIDBTransaction::id):
(WebKit::WebIDBTransaction::setCallbacks):
* public/WebIDBTransactionCallbacks.h: Added.
(WebKit::WebIDBTransactionCallbacks::~WebIDBTransactionCallbacks):
(WebKit::WebIDBTransactionCallbacks::onAbort):
(WebKit::WebIDBTransactionCallbacks::id):
* src/IDBDatabaseProxy.cpp:
(WebCore::IDBDatabaseProxy::transaction):
* src/IDBFactoryBackendProxy.cpp:
(WebCore::IDBFactoryBackendProxy::abortPendingTransactions):
* src/IDBFactoryBackendProxy.h:
* src/IDBTransactionBackendProxy.cpp: Added.
(WebCore::IDBTransactionBackendProxy::create):
(WebCore::IDBTransactionBackendProxy::IDBTransactionBackendProxy):
(WebCore::IDBTransactionBackendProxy::~IDBTransactionBackendProxy):
(WebCore::IDBTransactionBackendProxy::objectStore):
(WebCore::IDBTransactionBackendProxy::mode):
(WebCore::IDBTransactionBackendProxy::abort):
(WebCore::IDBTransactionBackendProxy::scheduleTask):
(WebCore::IDBTransactionBackendProxy::sqliteDatabase):
(WebCore::IDBTransactionBackendProxy::id):
(WebCore::IDBTransactionBackendProxy::setCallbacks):
* src/IDBTransactionBackendProxy.h: Added.
* src/IDBTransactionCallbacksProxy.cpp: Added.
(WebCore::IDBTransactionCallbacksProxy::create):
(WebCore::IDBTransactionCallbacksProxy::IDBTransactionCallbacksProxy):
(WebCore::IDBTransactionCallbacksProxy::~IDBTransactionCallbacksProxy):
(WebCore::IDBTransactionCallbacksProxy::onAbort):
(WebCore::IDBTransactionCallbacksProxy::id):
* src/IDBTransactionCallbacksProxy.h: Added.
* src/WebDOMStringList.cpp:
(WebKit::WebDOMStringList::length):
* src/WebIDBDatabaseImpl.cpp:
(WebKit::WebIDBDatabaseImpl::transaction):
* src/WebIDBDatabaseImpl.h:
* src/WebIDBFactoryImpl.cpp:
(WebKit::WebIDBFactoryImpl::abortPendingTransactions):
* src/WebIDBFactoryImpl.h:
* src/WebIDBTransactionCallbacksImpl.cpp: Added.
(WebCore::WebIDBTransactionCallbacksImpl::WebIDBTransactionCallbacksImpl):
(WebCore::WebIDBTransactionCallbacksImpl::~WebIDBTransactionCallbacksImpl):
(WebCore::WebIDBTransactionCallbacksImpl::onAbort):
(WebCore::WebIDBTransactionCallbacksImpl::id):
* src/WebIDBTransactionCallbacksImpl.h: Added.
* src/WebIDBTransactionImpl.cpp: Added.
(WebKit::WebIDBTransactionImpl::WebIDBTransactionImpl):
(WebKit::WebIDBTransactionImpl::~WebIDBTransactionImpl):
(WebKit::WebIDBTransactionImpl::mode):
(WebKit::WebIDBTransactionImpl::objectStore):
(WebKit::WebIDBTransactionImpl::abort):
(WebKit::WebIDBTransactionImpl::id):
(WebKit::WebIDBTransactionImpl::setCallbacks):
* src/WebIDBTransactionImpl.h: Added.
(WebKit::):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@65670 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 30c00e6..2edf86d 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,19 @@
+2010-08-19 Andrei Popescu <andreip at google.com>
+
+ Reviewed by Jeremy Orlow.
+
+ [IndexedDB] Abort idle IDBTransactions when the JS context they were created in finishes execution.
+ https://bugs.webkit.org/show_bug.cgi?id=44101
+
+ * storage/indexeddb/resources/shared.js:
+ (unexpectedErrorCallback):
+ * storage/indexeddb/script-tests/transaction-basics.js: Added.
+ (abortCallback):
+ (createTransactionCallback):
+ (test):
+ * storage/indexeddb/transaction-basics-expected.txt: Added.
+ * storage/indexeddb/transaction-basics.html: Added.
+
2010-08-18 Jeremy Orlow <jorlow at chromium.org>
Implement persistance for IndexedDB ObjectStores
diff --git a/LayoutTests/storage/indexeddb/resources/shared.js b/LayoutTests/storage/indexeddb/resources/shared.js
index 6769ed2..9f5e11f 100644
--- a/LayoutTests/storage/indexeddb/resources/shared.js
+++ b/LayoutTests/storage/indexeddb/resources/shared.js
@@ -35,6 +35,12 @@ function verifySuccessEvent(event)
verifyEventCommon(event);
}
+function verifyAbortEvent(event)
+{
+ debug("Abort event fired:");
+ shouldBeEqualToString("event.type", "abort");
+}
+
function verifyResult(result)
{
shouldBeTrue("'onsuccess' in result");
@@ -59,4 +65,3 @@ function deleteAllObjectStores(db)
for (var i = 0; i < objectStores.length; ++i)
db.removeObjectStore(objectStores[i]);
}
-
diff --git a/LayoutTests/storage/indexeddb/script-tests/transaction-basics.js b/LayoutTests/storage/indexeddb/script-tests/transaction-basics.js
new file mode 100644
index 0000000..3b295ea
--- /dev/null
+++ b/LayoutTests/storage/indexeddb/script-tests/transaction-basics.js
@@ -0,0 +1,31 @@
+description("Test IndexedDB transaction basics.");
+if (window.layoutTestController)
+ layoutTestController.waitUntilDone();
+
+function abortCallback()
+{
+ verifyAbortEvent(event);
+ done();
+}
+
+function createTransactionCallback()
+{
+ verifySuccessEvent(event);
+ transaction = evalAndLog("event.result.transaction()");
+ transaction.onabort = abortCallback;
+}
+
+function test()
+{
+ shouldBeTrue("'indexedDB' in window");
+ shouldBeFalse("indexedDB == null");
+
+ result = evalAndLog("indexedDB.open('name', 'description')");
+ verifyResult(result);
+ result.onsuccess = createTransactionCallback;
+ result.onerror = unexpectedErrorCallback;
+}
+
+test();
+
+var successfullyParsed = true;
diff --git a/LayoutTests/storage/indexeddb/transaction-basics-expected.txt b/LayoutTests/storage/indexeddb/transaction-basics-expected.txt
new file mode 100644
index 0000000..3608374
--- /dev/null
+++ b/LayoutTests/storage/indexeddb/transaction-basics-expected.txt
@@ -0,0 +1,32 @@
+Test IndexedDB transaction basics.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS 'indexedDB' in window is true
+PASS indexedDB == null is false
+indexedDB.open('name', 'description')
+PASS 'onsuccess' in result is true
+PASS 'onerror' in result is true
+PASS 'abort' in result is true
+PASS 'readyState' in result is true
+An event should fire shortly...
+
+Success event fired:
+PASS 'result' in event is true
+PASS 'code' in event is false
+PASS 'message' in event is false
+PASS 'source' in event is true
+PASS event.source != null is true
+PASS 'onsuccess' in event.target is true
+PASS 'onerror' in event.target is true
+PASS 'abort' in event.target is true
+PASS 'readyState' in event.target is true
+PASS event.target.readyState is event.target.DONE
+
+event.result.transaction()
+Abort event fired:
+PASS event.type is "abort"
+PASS successfullyParsed is true
+
+TEST COMPLETE
diff --git a/LayoutTests/storage/indexeddb/transaction-basics.html b/LayoutTests/storage/indexeddb/transaction-basics.html
new file mode 100644
index 0000000..a7238f6
--- /dev/null
+++ b/LayoutTests/storage/indexeddb/transaction-basics.html
@@ -0,0 +1,13 @@
+<html>
+<head>
+<link rel="stylesheet" href="../../fast/js/resources/js-test-style.css">
+<script src="../../fast/js/resources/js-test-pre.js"></script>
+<script src="../../fast/js/resources/js-test-post-function.js"></script>
+<script src="resources/shared.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script src="script-tests/transaction-basics.js"></script>
+</body>
+</html>
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 5a71146..7fe359f 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,82 @@
+2010-08-19 Andrei Popescu <andreip at google.com>
+
+ Reviewed by Jeremy Orlow.
+
+ [IndexedDB] Abort idle IDBTransactions when the JS context they were created in finishes execution.
+ https://bugs.webkit.org/show_bug.cgi?id=44101
+
+ This change also introduces the TransactionCoordinator, which will be used
+ to schedule transactions for execution.
+
+ Test: storage/indexeddb/transaction-basics.html
+
+ * WebCore.gypi:
+ * bindings/v8/V8DOMWrapper.cpp:
+ (WebCore::V8DOMWrapper::convertEventTargetToV8Object):
+ * bindings/v8/V8Proxy.cpp:
+ (WebCore::V8Proxy::runScript):
+ (WebCore::V8Proxy::callFunction):
+ (WebCore::V8Proxy::didLeaveScriptContext):
+ * bindings/v8/V8Proxy.h:
+ * dom/EventTarget.cpp:
+ (WebCore::EventTarget::toIDBTransaction):
+ * dom/EventTarget.h:
+ * page/PageGroup.h:
+ (WebCore::PageGroup::hasIDBFactory):
+ * storage/IDBAbortEvent.cpp: Added.
+ (WebCore::IDBAbortEvent::create):
+ (WebCore::IDBAbortEvent::IDBAbortEvent):
+ (WebCore::IDBAbortEvent::~IDBAbortEvent):
+ * storage/IDBAbortEvent.h: Added.
+ (WebCore::IDBAbortEvent::isIDBAbortEvent):
+ * storage/IDBDatabase.cpp:
+ (WebCore::IDBDatabase::transaction):
+ * storage/IDBDatabaseBackendImpl.cpp:
+ (WebCore::IDBDatabaseBackendImpl::IDBDatabaseBackendImpl):
+ (WebCore::IDBDatabaseBackendImpl::transaction):
+ * storage/IDBDatabaseBackendImpl.h:
+ (WebCore::IDBDatabaseBackendImpl::create):
+ * storage/IDBDatabaseBackendInterface.h:
+ * storage/IDBFactoryBackendImpl.cpp:
+ (WebCore::IDBFactoryBackendImpl::IDBFactoryBackendImpl):
+ (WebCore::IDBFactoryBackendImpl::open):
+ (WebCore::IDBFactoryBackendImpl::abortPendingTransactions):
+ * storage/IDBFactoryBackendImpl.h:
+ * storage/IDBFactoryBackendInterface.h:
+ * storage/IDBPendingTransactionMonitor.cpp: Added.
+ (WebCore::IDBPendingTransactionMonitor::addPendingTransaction):
+ (WebCore::IDBPendingTransactionMonitor::removePendingTransaction):
+ (WebCore::IDBPendingTransactionMonitor::clearPendingTransactions):
+ (WebCore::IDBPendingTransactionMonitor::pendingTransactions):
+ * storage/IDBPendingTransactionMonitor.h: Added.
+ * storage/IDBTransaction.cpp:
+ (WebCore::IDBTransaction::IDBTransaction):
+ (WebCore::IDBTransaction::onAbort):
+ (WebCore::IDBTransaction::id):
+ (WebCore::IDBTransaction::stop):
+ (WebCore::IDBTransaction::timerFired):
+ * storage/IDBTransaction.h:
+ * storage/IDBTransactionBackendInterface.h:
+ * storage/IDBTransactionCallbacks.h: Added.
+ (WebCore::IDBTransactionCallbacks::~IDBTransactionCallbacks):
+ * storage/IDBTransactionCoordinator.cpp: Added.
+ (WebCore::IDBTransactionBackendImpl::~IDBTransactionBackendImpl):
+ (WebCore::IDBTransactionBackendImpl::create):
+ (WebCore::IDBTransactionBackendImpl::IDBTransactionBackendImpl):
+ (WebCore::IDBTransactionBackendImpl::objectStore):
+ (WebCore::IDBTransactionBackendImpl::mode):
+ (WebCore::IDBTransactionBackendImpl::scheduleTask):
+ (WebCore::IDBTransactionBackendImpl::abort):
+ (WebCore::IDBTransactionBackendImpl::sqliteDatabase):
+ (WebCore::IDBTransactionBackendImpl::id):
+ (WebCore::IDBTransactionBackendImpl::setCallbacks):
+ (WebCore::IDBTransactionCoordinator::IDBTransactionCoordinator):
+ (WebCore::IDBTransactionCoordinator::~IDBTransactionCoordinator):
+ (WebCore::IDBTransactionCoordinator::createTransaction):
+ (WebCore::IDBTransactionCoordinator::abort):
+ * storage/IDBTransactionCoordinator.h: Added.
+ (WebCore::IDBTransactionCoordinator::create):
+
2010-08-19 Pavel Feldman <pfeldman at chromium.org>
Reviewed by Yury Semikhatsky.
diff --git a/WebCore/WebCore.gypi b/WebCore/WebCore.gypi
index 3dff25d..26557d7 100644
--- a/WebCore/WebCore.gypi
+++ b/WebCore/WebCore.gypi
@@ -3567,6 +3567,8 @@
'storage/FileEntry.h',
'storage/FileSystemCallback.h',
'storage/Flags.h',
+ 'storage/IDBAbortEvent.cpp',
+ 'storage/IDBAbortEvent.h',
'storage/IDBAny.cpp',
'storage/IDBAny.h',
'storage/IDBCallbacks.h',
@@ -3609,13 +3611,20 @@
'storage/IDBObjectStoreBackendImpl.cpp',
'storage/IDBObjectStoreBackendImpl.h',
'storage/IDBObjectStoreBackendInterface.h',
+ 'storage/IDBPendingTransactionMonitor.cpp',
+ 'storage/IDBPendingTransactionMonitor.h',
'storage/IDBRequest.cpp',
'storage/IDBRequest.h',
'storage/IDBSuccessEvent.cpp',
'storage/IDBSuccessEvent.h',
'storage/IDBTransaction.cpp',
'storage/IDBTransaction.h',
+ 'storage/IDBTransactionBackendImpl.cpp',
+ 'storage/IDBTransactionBackendImpl.h',
'storage/IDBTransactionBackendInterface.h',
+ 'storage/IDBTransactionCallbacks.h',
+ 'storage/IDBTransactionCoordinator.cpp',
+ 'storage/IDBTransactionCoordinator.h',
'storage/LocalStorageTask.cpp',
'storage/LocalStorageTask.h',
'storage/LocalStorageThread.cpp',
diff --git a/WebCore/bindings/v8/V8DOMWrapper.cpp b/WebCore/bindings/v8/V8DOMWrapper.cpp
index 8a72a3a..9e44b56 100644
--- a/WebCore/bindings/v8/V8DOMWrapper.cpp
+++ b/WebCore/bindings/v8/V8DOMWrapper.cpp
@@ -51,6 +51,7 @@
#include "V8HTMLCollection.h"
#include "V8HTMLDocument.h"
#include "V8IDBRequest.h"
+#include "V8IDBTransaction.h"
#include "V8IsolatedContext.h"
#include "V8Location.h"
#include "V8MessageChannel.h"
@@ -382,6 +383,8 @@ v8::Handle<v8::Value> V8DOMWrapper::convertEventTargetToV8Object(EventTarget* ta
#if ENABLE(INDEXED_DATABASE)
if (IDBRequest* idbRequest = target->toIDBRequest())
return toV8(idbRequest);
+ if (IDBTransaction* idbTransaction = target->toIDBTransaction())
+ return toV8(idbTransaction);
#endif
#if ENABLE(WEB_SOCKETS)
diff --git a/WebCore/bindings/v8/V8Proxy.cpp b/WebCore/bindings/v8/V8Proxy.cpp
index 3f72112..b239465 100644
--- a/WebCore/bindings/v8/V8Proxy.cpp
+++ b/WebCore/bindings/v8/V8Proxy.cpp
@@ -37,6 +37,8 @@
#include "DocumentLoader.h"
#include "Frame.h"
#include "FrameLoaderClient.h"
+#include "IDBFactoryBackendInterface.h"
+#include "IDBPendingTransactionMonitor.h"
#include "InspectorTimelineAgent.h"
#include "Page.h"
#include "PageGroup.h"
@@ -459,7 +461,7 @@ v8::Local<v8::Value> V8Proxy::runScript(v8::Handle<v8::Script> script, bool isIn
}
// Release the storage mutex if applicable.
- releaseStorageMutex();
+ didLeaveScriptContext();
if (handleOutOfMemory())
ASSERT(result.IsEmpty());
@@ -532,7 +534,7 @@ v8::Local<v8::Value> V8Proxy::callFunction(v8::Handle<v8::Function> function, v8
}
// Release the storage mutex if applicable.
- releaseStorageMutex();
+ didLeaveScriptContext();
if (v8::V8::IsDead())
handleFatalErrorInV8();
@@ -641,16 +643,24 @@ void V8Proxy::disconnectFrame()
{
}
-void V8Proxy::releaseStorageMutex()
+void V8Proxy::didLeaveScriptContext()
{
+ Page* page = m_frame->page();
+ if (!page)
+ return;
+ // If we've just left a script context and indexed database has been
+ // instantiated, we must let its transaction coordinator know so it can terminate
+ // any not-yet-started transactions.
+ if (IDBPendingTransactionMonitor::hasPendingTransactions()) {
+ ASSERT(page->group().hasIDBFactory());
+ page->group().idbFactory()->abortPendingTransactions(IDBPendingTransactionMonitor::pendingTransactions());
+ IDBPendingTransactionMonitor::clearPendingTransactions();
+ }
// If we've just left a top level script context and local storage has been
// instantiated, we must ensure that any storage locks have been freed.
// Per http://dev.w3.org/html5/spec/Overview.html#storage-mutex
if (m_recursion != 0)
return;
- Page* page = m_frame->page();
- if (!page)
- return;
if (page->group().hasLocalStorage())
page->group().localStorage()->unlock();
}
diff --git a/WebCore/bindings/v8/V8Proxy.h b/WebCore/bindings/v8/V8Proxy.h
index 0eefa22..7b4d6f6 100644
--- a/WebCore/bindings/v8/V8Proxy.h
+++ b/WebCore/bindings/v8/V8Proxy.h
@@ -338,9 +338,7 @@ namespace WebCore {
static void reportUnsafeAccessTo(Frame* target, DelayReporting delay);
private:
- // If m_recursionCount is 0, let LocalStorage know so we can release
- // the storage mutex.
- void releaseStorageMutex();
+ void didLeaveScriptContext();
void resetIsolatedWorlds();
diff --git a/WebCore/dom/EventTarget.cpp b/WebCore/dom/EventTarget.cpp
index 7fa53f3..effd2a2 100644
--- a/WebCore/dom/EventTarget.cpp
+++ b/WebCore/dom/EventTarget.cpp
@@ -174,6 +174,10 @@ IDBRequest* EventTarget::toIDBRequest()
{
return 0;
}
+IDBTransaction* EventTarget::toIDBTransaction()
+{
+ return 0;
+}
#endif
bool EventTarget::addEventListener(const AtomicString& eventType, PassRefPtr<EventListener> listener, bool useCapture)
diff --git a/WebCore/dom/EventTarget.h b/WebCore/dom/EventTarget.h
index bf6a9c2..b2985f7 100644
--- a/WebCore/dom/EventTarget.h
+++ b/WebCore/dom/EventTarget.h
@@ -50,6 +50,7 @@ namespace WebCore {
class FileReader;
class FileWriter;
class IDBRequest;
+ class IDBTransaction;
class MessagePort;
class Node;
class Notification;
@@ -129,6 +130,7 @@ namespace WebCore {
#if ENABLE(INDEXED_DATABASE)
virtual IDBRequest* toIDBRequest();
+ virtual IDBTransaction* toIDBTransaction();
#endif
virtual ScriptExecutionContext* scriptExecutionContext() const = 0;
diff --git a/WebCore/page/PageGroup.h b/WebCore/page/PageGroup.h
index 6a3518e..fcad773 100644
--- a/WebCore/page/PageGroup.h
+++ b/WebCore/page/PageGroup.h
@@ -74,6 +74,7 @@ namespace WebCore {
#endif
#if ENABLE(INDEXED_DATABASE)
IDBFactoryBackendInterface* idbFactory();
+ bool hasIDBFactory() { return m_factoryBackend; }
#endif
void addUserScriptToWorld(DOMWrapperWorld*, const String& source, const KURL&,
diff --git a/WebCore/storage/IDBAbortEvent.cpp b/WebCore/storage/IDBAbortEvent.cpp
new file mode 100644
index 0000000..21760f8
--- /dev/null
+++ b/WebCore/storage/IDBAbortEvent.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 "IDBAbortEvent.h"
+
+#if ENABLE(INDEXED_DATABASE)
+
+#include "EventNames.h"
+#include "IDBAny.h"
+
+namespace WebCore {
+
+PassRefPtr<IDBAbortEvent> IDBAbortEvent::create()
+{
+ return adoptRef(new IDBAbortEvent());
+}
+
+IDBAbortEvent::IDBAbortEvent()
+ : IDBEvent(eventNames().abortEvent, 0) // FIXME: set the source to the transaction
+{
+}
+
+IDBAbortEvent::~IDBAbortEvent()
+{
+}
+
+} // namespace WebCore
+
+#endif
diff --git a/WebCore/storage/IDBAbortEvent.h b/WebCore/storage/IDBAbortEvent.h
new file mode 100644
index 0000000..bdc2202
--- /dev/null
+++ b/WebCore/storage/IDBAbortEvent.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 IDBAbortEvent_h
+#define IDBAbortEvent_h
+
+#if ENABLE(INDEXED_DATABASE)
+
+#include "IDBEvent.h"
+#include "PlatformString.h"
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefPtr.h>
+
+namespace WebCore {
+
+class IDBAbortEvent : public IDBEvent {
+public:
+ static PassRefPtr<IDBAbortEvent> create();
+ // FIXME: Need to allow creation of these events from JS.
+ virtual ~IDBAbortEvent();
+
+ virtual bool isIDBAbortEvent() const { return true; }
+
+private:
+ IDBAbortEvent();
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(INDEXED_DATABASE)
+
+#endif // IDBAbortEvent_h
diff --git a/WebCore/storage/IDBDatabase.cpp b/WebCore/storage/IDBDatabase.cpp
index b00695b..1d88b34 100644
--- a/WebCore/storage/IDBDatabase.cpp
+++ b/WebCore/storage/IDBDatabase.cpp
@@ -75,8 +75,10 @@ PassRefPtr<IDBTransaction> IDBDatabase::transaction(ScriptExecutionContext* cont
// We need to create a new transaction synchronously. Locks are acquired asynchronously. Operations
// can be queued against the transaction at any point. They will start executing as soon as the
// appropriate locks have been acquired.
+ // Also note that each backend object corresponds to exactly one IDBTransaction object.
RefPtr<IDBTransactionBackendInterface> transactionBackend = m_backend->transaction(storeNames, mode, timeout);
- RefPtr<IDBTransaction> transaction = IDBTransaction::create(context, transactionBackend.release(), this);
+ RefPtr<IDBTransaction> transaction = IDBTransaction::create(context, transactionBackend, this);
+ transactionBackend->setCallbacks(transaction.get());
return transaction.release();
}
diff --git a/WebCore/storage/IDBDatabaseBackendImpl.cpp b/WebCore/storage/IDBDatabaseBackendImpl.cpp
index 3acf2a5..d6b6310 100644
--- a/WebCore/storage/IDBDatabaseBackendImpl.cpp
+++ b/WebCore/storage/IDBDatabaseBackendImpl.cpp
@@ -29,6 +29,7 @@
#include "DOMStringList.h"
#include "IDBDatabaseException.h"
#include "IDBObjectStoreBackendImpl.h"
+#include "IDBTransactionCoordinator.h"
#include "SQLiteDatabase.h"
#include "SQLiteStatement.h"
@@ -83,10 +84,11 @@ static bool setMetaData(SQLiteDatabase* sqliteDatabase, const String& name, cons
return true;
}
-IDBDatabaseBackendImpl::IDBDatabaseBackendImpl(const String& name, const String& description, PassOwnPtr<SQLiteDatabase> sqliteDatabase)
+IDBDatabaseBackendImpl::IDBDatabaseBackendImpl(const String& name, const String& description, PassOwnPtr<SQLiteDatabase> sqliteDatabase, IDBTransactionCoordinator* coordinator)
: m_sqliteDatabase(sqliteDatabase)
, m_name(name)
, m_version("")
+ , m_transactionCoordinator(coordinator)
{
ASSERT(!m_name.isNull());
@@ -170,11 +172,9 @@ void IDBDatabaseBackendImpl::removeObjectStore(const String& name, PassRefPtr<ID
callbacks->onSuccess();
}
-PassRefPtr<IDBTransactionBackendInterface> IDBDatabaseBackendImpl::transaction(DOMStringList*, unsigned short, unsigned long)
+PassRefPtr<IDBTransactionBackendInterface> IDBDatabaseBackendImpl::transaction(DOMStringList* objectStores, unsigned short mode, unsigned long timeout)
{
- // FIXME: Ask the transaction manager for a new IDBTransactionBackendImpl.
- ASSERT_NOT_REACHED();
- return 0;
+ return m_transactionCoordinator->createTransaction(objectStores, mode, timeout);
}
void IDBDatabaseBackendImpl::loadObjectStores()
diff --git a/WebCore/storage/IDBDatabaseBackendImpl.h b/WebCore/storage/IDBDatabaseBackendImpl.h
index c8c5a91..8d32e27 100644
--- a/WebCore/storage/IDBDatabaseBackendImpl.h
+++ b/WebCore/storage/IDBDatabaseBackendImpl.h
@@ -35,13 +35,14 @@
namespace WebCore {
+class IDBTransactionCoordinator;
class SQLiteDatabase;
class IDBDatabaseBackendImpl : public IDBDatabaseBackendInterface {
public:
- static PassRefPtr<IDBDatabaseBackendImpl> create(const String& name, const String& description, PassOwnPtr<SQLiteDatabase> database)
+ static PassRefPtr<IDBDatabaseBackendImpl> create(const String& name, const String& description, PassOwnPtr<SQLiteDatabase> database, IDBTransactionCoordinator* coordinator)
{
- return adoptRef(new IDBDatabaseBackendImpl(name, description, database));
+ return adoptRef(new IDBDatabaseBackendImpl(name, description, database, coordinator));
}
virtual ~IDBDatabaseBackendImpl();
@@ -59,18 +60,19 @@ public:
virtual void removeObjectStore(const String& name, PassRefPtr<IDBCallbacks>);
virtual PassRefPtr<IDBTransactionBackendInterface> transaction(DOMStringList* storeNames, unsigned short mode, unsigned long timeout);
private:
- IDBDatabaseBackendImpl(const String& name, const String& description, PassOwnPtr<SQLiteDatabase> database);
+ IDBDatabaseBackendImpl(const String& name, const String& description, PassOwnPtr<SQLiteDatabase> database, IDBTransactionCoordinator*);
void loadObjectStores();
OwnPtr<SQLiteDatabase> m_sqliteDatabase;
-
String m_name;
String m_description;
String m_version;
typedef HashMap<String, RefPtr<IDBObjectStoreBackendInterface> > ObjectStoreMap;
ObjectStoreMap m_objectStores;
+
+ RefPtr<IDBTransactionCoordinator> m_transactionCoordinator;
};
} // namespace WebCore
diff --git a/WebCore/storage/IDBDatabaseBackendInterface.h b/WebCore/storage/IDBDatabaseBackendInterface.h
index ac12bf1..9e35369 100644
--- a/WebCore/storage/IDBDatabaseBackendInterface.h
+++ b/WebCore/storage/IDBDatabaseBackendInterface.h
@@ -39,6 +39,7 @@ class Frame;
class IDBCallbacks;
class IDBObjectStoreBackendInterface;
class IDBTransactionBackendInterface;
+class IDBTransactionCallbacks;
// This class is shared by IDBDatabase (async) and IDBDatabaseSync (sync).
// This is implemented by IDBDatabaseBackendImpl and optionally others (in order to proxy
diff --git a/WebCore/storage/IDBFactoryBackendImpl.cpp b/WebCore/storage/IDBFactoryBackendImpl.cpp
index 5af33e7..29e8b60 100644
--- a/WebCore/storage/IDBFactoryBackendImpl.cpp
+++ b/WebCore/storage/IDBFactoryBackendImpl.cpp
@@ -33,6 +33,7 @@
#include "FileSystem.h"
#include "IDBDatabaseBackendImpl.h"
#include "IDBDatabaseException.h"
+#include "IDBTransactionCoordinator.h"
#include "SQLiteDatabase.h"
#include "SecurityOrigin.h"
#include <wtf/Threading.h>
@@ -42,7 +43,8 @@
namespace WebCore {
-IDBFactoryBackendImpl::IDBFactoryBackendImpl()
+IDBFactoryBackendImpl::IDBFactoryBackendImpl()
+ : m_transactionCoordinator(IDBTransactionCoordinator::create())
{
}
@@ -124,11 +126,17 @@ void IDBFactoryBackendImpl::open(const String& name, const String& description,
return;
}
- RefPtr<IDBDatabaseBackendImpl> databaseBackend = IDBDatabaseBackendImpl::create(name, description, sqliteDatabase.release());
+ RefPtr<IDBDatabaseBackendImpl> databaseBackend = IDBDatabaseBackendImpl::create(name, description, sqliteDatabase.release(), m_transactionCoordinator.get());
callbacks->onSuccess(databaseBackend.get());
m_databaseBackendMap.set(name, databaseBackend.release());
}
+void IDBFactoryBackendImpl::abortPendingTransactions(const Vector<int>& pendingIDs)
+{
+ for (size_t i = 0; i < pendingIDs.size(); ++i)
+ m_transactionCoordinator->abort(pendingIDs.at(i));
+}
+
} // namespace WebCore
#endif // ENABLE(INDEXED_DATABASE)
diff --git a/WebCore/storage/IDBFactoryBackendImpl.h b/WebCore/storage/IDBFactoryBackendImpl.h
index e87ea39..c9a33da 100644
--- a/WebCore/storage/IDBFactoryBackendImpl.h
+++ b/WebCore/storage/IDBFactoryBackendImpl.h
@@ -37,7 +37,9 @@
namespace WebCore {
class DOMStringList;
+
class IDBDatabaseBackendImpl;
+class IDBTransactionCoordinator;
class IDBFactoryBackendImpl : public IDBFactoryBackendInterface {
public:
@@ -48,12 +50,14 @@ public:
virtual ~IDBFactoryBackendImpl();
virtual void open(const String& name, const String& description, PassRefPtr<IDBCallbacks>, PassRefPtr<SecurityOrigin>, Frame*);
+ virtual void abortPendingTransactions(const Vector<int>& pendingIDs);
private:
IDBFactoryBackendImpl();
typedef HashMap<String, RefPtr<IDBDatabaseBackendImpl> > IDBDatabaseBackendMap;
IDBDatabaseBackendMap m_databaseBackendMap;
+ RefPtr<IDBTransactionCoordinator> m_transactionCoordinator;
// We only create one instance of this class at a time.
static IDBFactoryBackendImpl* idbFactoryBackendImpl;
diff --git a/WebCore/storage/IDBFactoryBackendInterface.h b/WebCore/storage/IDBFactoryBackendInterface.h
index ba18098..c052bc2 100644
--- a/WebCore/storage/IDBFactoryBackendInterface.h
+++ b/WebCore/storage/IDBFactoryBackendInterface.h
@@ -32,6 +32,7 @@
#include "IDBCallbacks.h"
#include "PlatformString.h"
#include <wtf/Threading.h>
+#include <wtf/Vector.h>
#if ENABLE(INDEXED_DATABASE)
@@ -51,6 +52,7 @@ public:
virtual ~IDBFactoryBackendInterface() { }
virtual void open(const String& name, const String& description, PassRefPtr<IDBCallbacks>, PassRefPtr<SecurityOrigin>, Frame*) = 0;
+ virtual void abortPendingTransactions(const Vector<int>& ids) = 0;
};
} // namespace WebCore
diff --git a/WebCore/storage/IDBPendingTransactionMonitor.cpp b/WebCore/storage/IDBPendingTransactionMonitor.cpp
new file mode 100644
index 0000000..d026099
--- /dev/null
+++ b/WebCore/storage/IDBPendingTransactionMonitor.cpp
@@ -0,0 +1,72 @@
+/*
+ * 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.
+ *
+ * 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 "IDBPendingTransactionMonitor.h"
+
+#if ENABLE(INDEXED_DATABASE)
+
+namespace WebCore {
+
+Vector<int>* IDBPendingTransactionMonitor::m_ids = 0;
+
+bool IDBPendingTransactionMonitor::hasPendingTransactions()
+{
+ return m_ids && m_ids->size();
+}
+
+void IDBPendingTransactionMonitor::addPendingTransaction(int id)
+{
+ if (!m_ids)
+ m_ids = new Vector<int>();
+ m_ids->append(id);
+}
+
+void IDBPendingTransactionMonitor::removePendingTransaction(int id)
+{
+ m_ids->remove(id);
+ if (!m_ids->size()) {
+ delete m_ids;
+ m_ids = 0;
+ }
+}
+
+void IDBPendingTransactionMonitor::clearPendingTransactions()
+{
+ if (!m_ids)
+ return;
+
+ m_ids->clear();
+ delete m_ids;
+ m_ids = 0;
+}
+
+const Vector<int>& IDBPendingTransactionMonitor::pendingTransactions()
+{
+ return *m_ids;
+}
+
+};
+#endif // ENABLE(INDEXED_DATABASE)
diff --git a/WebCore/storage/IDBPendingTransactionMonitor.h b/WebCore/storage/IDBPendingTransactionMonitor.h
new file mode 100644
index 0000000..00e833a
--- /dev/null
+++ b/WebCore/storage/IDBPendingTransactionMonitor.h
@@ -0,0 +1,63 @@
+/*
+ * 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.
+ *
+ * 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 IDBPendingTransactionMonitor_h
+#define IDBPendingTransactionMonitor_h
+
+#if ENABLE(INDEXED_DATABASE)
+
+#include <wtf/Noncopyable.h>
+#include <wtf/Vector.h>
+
+namespace WebCore {
+
+// This class keeps track of the transactions created during the current
+// Javascript execution context. A transaction is 'pending' if no asynchronous
+// operation is currently queued for it (e.g. an IDBObjectStore::put() or similar).
+// All pending transactions are aborted as soon as execution returns from
+// the script engine.
+//
+// FIXME: move the vector of transaction IDs to TLS. Keeping it static
+// will not work once we add support for workers. Another possible
+// solution is to keep the vector in the ScriptExecutionContext.
+class IDBPendingTransactionMonitor : public Noncopyable {
+public:
+ static bool hasPendingTransactions();
+ static void addPendingTransaction(int id);
+ static void removePendingTransaction(int id);
+ static void clearPendingTransactions();
+ static const Vector<int>& pendingTransactions();
+
+private:
+ IDBPendingTransactionMonitor();
+
+ static Vector<int>* m_ids;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(INDEXED_DATABASE)
+
+#endif // IDBPendingTransactionMonitor_h
diff --git a/WebCore/storage/IDBTransaction.cpp b/WebCore/storage/IDBTransaction.cpp
index 1bc059a..4e93378 100644
--- a/WebCore/storage/IDBTransaction.cpp
+++ b/WebCore/storage/IDBTransaction.cpp
@@ -1,3 +1,28 @@
+/*
+ * 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.
+ *
+ * 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 "IDBTransaction.h"
@@ -5,9 +30,11 @@
#include "Event.h"
#include "EventException.h"
+#include "IDBAbortEvent.h"
#include "IDBDatabase.h"
#include "IDBObjectStore.h"
#include "IDBObjectStoreBackendInterface.h"
+#include "IDBPendingTransactionMonitor.h"
#include "ScriptExecutionContext.h"
namespace WebCore {
@@ -16,7 +43,10 @@ IDBTransaction::IDBTransaction(ScriptExecutionContext* context, PassRefPtr<IDBTr
: ActiveDOMObject(context, this)
, m_backend(backend)
, m_database(db)
+ , m_stopped(false)
+ , m_timer(this, &IDBTransaction::timerFired)
{
+ IDBPendingTransactionMonitor::addPendingTransaction(m_backend->id());
}
IDBTransaction::~IDBTransaction()
@@ -50,6 +80,22 @@ ScriptExecutionContext* IDBTransaction::scriptExecutionContext() const
return ActiveDOMObject::scriptExecutionContext();
}
+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();
+}
+
+int IDBTransaction::id() const
+{
+ return m_backend->id();
+}
+
bool IDBTransaction::canSuspend() const
{
// We may be in the middle of a transaction so we cannot suspend our object.
@@ -57,6 +103,15 @@ bool IDBTransaction::canSuspend() const
return false;
}
+void IDBTransaction::stop()
+{
+ if (!m_stopped) {
+ // The document is getting detached. Abort!
+ m_stopped = true;
+ m_backend->abort();
+ }
+}
+
EventTargetData* IDBTransaction::eventTargetData()
{
return &m_eventTargetData;
@@ -67,6 +122,14 @@ EventTargetData* IDBTransaction::ensureEventTargetData()
return &m_eventTargetData;
}
+void IDBTransaction::timerFired(Timer<IDBTransaction>* transaction)
+{
+ ASSERT(m_selfRef);
+
+ RefPtr<IDBTransaction> selfRef = m_selfRef.release();
+ dispatchEvent(IDBAbortEvent::create());
+}
+
}
#endif // ENABLE(INDEXED_DATABASE)
diff --git a/WebCore/storage/IDBTransaction.h b/WebCore/storage/IDBTransaction.h
index 2e3167c..3c7f9dd 100644
--- a/WebCore/storage/IDBTransaction.h
+++ b/WebCore/storage/IDBTransaction.h
@@ -34,13 +34,16 @@
#include "EventNames.h"
#include "EventTarget.h"
#include "IDBTransactionBackendInterface.h"
+#include "IDBTransactionCallbacks.h"
+#include "Timer.h"
+#include <wtf/RefCounted.h>
namespace WebCore {
class IDBDatabase;
class IDBObjectStore;
-class IDBTransaction : public EventTarget, public ActiveDOMObject {
+class IDBTransaction : public IDBTransactionCallbacks, public EventTarget, public ActiveDOMObject {
public:
static PassRefPtr<IDBTransaction> create(ScriptExecutionContext* context, PassRefPtr<IDBTransactionBackendInterface> backend, IDBDatabase* db)
{
@@ -63,12 +66,20 @@ public:
DEFINE_ATTRIBUTE_EVENT_LISTENER(complete);
DEFINE_ATTRIBUTE_EVENT_LISTENER(timeout);
+ // IDBTransactionCallbacks
+ virtual void onAbort();
+ virtual int id() const;
+
// EventTarget
virtual IDBTransaction* toIDBTransaction() { return this; }
// ActiveDOMObject
virtual ScriptExecutionContext* scriptExecutionContext() const;
virtual bool canSuspend() const;
+ virtual void stop();
+
+ using RefCounted<IDBTransactionCallbacks>::ref;
+ using RefCounted<IDBTransactionCallbacks>::deref;
private:
IDBTransaction(ScriptExecutionContext*, PassRefPtr<IDBTransactionBackendInterface>, IDBDatabase*);
@@ -79,9 +90,15 @@ private:
virtual EventTargetData* eventTargetData();
virtual EventTargetData* ensureEventTargetData();
+ void timerFired(Timer<IDBTransaction>*);
+
EventTargetData m_eventTargetData;
RefPtr<IDBTransactionBackendInterface> m_backend;
RefPtr<IDBDatabase> m_database;
+
+ bool m_stopped;
+ Timer<IDBTransaction> m_timer;
+ RefPtr<IDBTransaction> m_selfRef; // This is set to us iff there's an event pending.
};
} // namespace WebCore
diff --git a/WebCore/storage/IDBTransactionBackendImpl.cpp b/WebCore/storage/IDBTransactionBackendImpl.cpp
new file mode 100755
index 0000000..6ec954b
--- /dev/null
+++ b/WebCore/storage/IDBTransactionBackendImpl.cpp
@@ -0,0 +1,43 @@
+#include "config.h"
+#include "IDBTransactionBackendImpl.h"
+
+#if ENABLE(INDEXED_DATABASE)
+
+namespace WebCore {
+
+PassRefPtr<IDBTransactionBackendInterface> IDBTransactionBackendImpl::create(DOMStringList* objectStores, unsigned short mode, unsigned long timeout, int id)
+{
+ return adoptRef(new IDBTransactionBackendImpl(objectStores, mode, timeout, id));
+}
+
+IDBTransactionBackendImpl::IDBTransactionBackendImpl(DOMStringList* objectStores, unsigned short mode, unsigned long timeout, int id)
+ : m_objectStoreNames(objectStores)
+ , m_mode(mode)
+ , m_timeout(timeout)
+ , m_id(id)
+ , m_aborted(false)
+{
+}
+
+PassRefPtr<IDBObjectStoreBackendInterface> IDBTransactionBackendImpl::objectStore(const String& name)
+{
+ // FIXME: implement.
+ ASSERT_NOT_REACHED();
+ return 0;
+}
+
+void IDBTransactionBackendImpl::scheduleTask(PassOwnPtr<ScriptExecutionContext::Task>)
+{
+ // FIXME: implement.
+ ASSERT_NOT_REACHED();
+}
+
+void IDBTransactionBackendImpl::abort()
+{
+ m_aborted = true;
+ m_callbacks->onAbort();
+}
+
+};
+
+#endif // ENABLE(INDEXED_DATABASE)
diff --git a/WebCore/storage/IDBTransactionBackendImpl.h b/WebCore/storage/IDBTransactionBackendImpl.h
new file mode 100755
index 0000000..30b2416
--- /dev/null
+++ b/WebCore/storage/IDBTransactionBackendImpl.h
@@ -0,0 +1,65 @@
+/*
+ * 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.
+ *
+ * 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 IDBTransactionBackendImpl_h
+#define IDBTransactionBackendImpl_h
+
+#if ENABLE(INDEXED_DATABASE)
+
+#include "DOMStringList.h"
+#include "IDBTransactionBackendInterface.h"
+#include "IDBTransactionCallbacks.h"
+#include <wtf/RefPtr.h>
+
+namespace WebCore {
+
+class IDBTransactionBackendImpl : public IDBTransactionBackendInterface {
+public:
+ static PassRefPtr<IDBTransactionBackendInterface> create(DOMStringList* objectStores, unsigned short mode, unsigned long timeout, int id);
+ virtual ~IDBTransactionBackendImpl() { }
+
+ virtual PassRefPtr<IDBObjectStoreBackendInterface> objectStore(const String& name);
+ virtual unsigned short mode() const { return m_mode; }
+ virtual void scheduleTask(PassOwnPtr<ScriptExecutionContext::Task>);
+ virtual void abort();
+ virtual int id() const { return m_id; }
+ virtual void setCallbacks(IDBTransactionCallbacks* callbacks) { m_callbacks = callbacks; }
+
+private:
+ IDBTransactionBackendImpl(DOMStringList* objectStores, unsigned short mode, unsigned long timeout, int id);
+
+ RefPtr<DOMStringList> m_objectStoreNames;
+ unsigned short m_mode;
+ unsigned long m_timeout;
+ int m_id;
+ bool m_aborted;
+ RefPtr<IDBTransactionCallbacks> m_callbacks;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(INDEXED_DATABASE)
+
+#endif // IDBTransactionBackendImpl_h
diff --git a/WebCore/storage/IDBTransactionBackendInterface.h b/WebCore/storage/IDBTransactionBackendInterface.h
index dff2bd7..39651f1 100644
--- a/WebCore/storage/IDBTransactionBackendInterface.h
+++ b/WebCore/storage/IDBTransactionBackendInterface.h
@@ -37,6 +37,7 @@
namespace WebCore {
class IDBObjectStoreBackendInterface;
+class IDBTransactionCallbacks;
class SQLiteDatabase;
// This class is shared by IDBTransaction (async) and IDBTransactionSync (sync).
@@ -51,7 +52,8 @@ public:
virtual unsigned short mode() const = 0;
virtual void scheduleTask(PassOwnPtr<ScriptExecutionContext::Task>) = 0;
virtual void abort() = 0;
- virtual SQLiteDatabase* sqliteDatabase() = 0;
+ virtual int id() const = 0;
+ virtual void setCallbacks(IDBTransactionCallbacks*) = 0;
};
} // namespace WebCore
diff --git a/WebCore/storage/IDBTransactionCallbacks.h b/WebCore/storage/IDBTransactionCallbacks.h
new file mode 100644
index 0000000..38181fc
--- /dev/null
+++ b/WebCore/storage/IDBTransactionCallbacks.h
@@ -0,0 +1,52 @@
+/*
+ * 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 IDBTransactionCallbacks_h
+#define IDBTransactionCallbacks_h
+
+#if ENABLE(INDEXED_DATABASE)
+
+#include "SerializedScriptValue.h"
+#include <wtf/RefCounted.h>
+
+namespace WebCore {
+
+class IDBTransactionCallbacks : public RefCounted<IDBTransactionCallbacks> {
+public:
+ virtual ~IDBTransactionCallbacks() { }
+
+ virtual void onAbort() = 0;
+ virtual int id() const = 0;
+ // FIXME: add the rest
+};
+
+} // namespace WebCore
+
+#endif
+
+#endif // IDBTransactionCallbacks_h
diff --git a/WebCore/storage/IDBTransactionCoordinator.cpp b/WebCore/storage/IDBTransactionCoordinator.cpp
new file mode 100644
index 0000000..8e4d256
--- /dev/null
+++ b/WebCore/storage/IDBTransactionCoordinator.cpp
@@ -0,0 +1,68 @@
+/*
+ * 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.
+ *
+ * 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 "IDBTransactionCoordinator.h"
+
+#if ENABLE(INDEXED_DATABASE)
+
+#include "IDBObjectStore.h"
+#include "IDBObjectStoreBackendInterface.h"
+#include "IDBTransactionBackendImpl.h"
+#include "ScriptExecutionContext.h"
+
+namespace WebCore {
+
+IDBTransactionCoordinator::IDBTransactionCoordinator()
+ : m_nextID(0)
+{
+}
+
+IDBTransactionCoordinator::~IDBTransactionCoordinator()
+{
+}
+
+PassRefPtr<IDBTransactionBackendInterface> IDBTransactionCoordinator::createTransaction(DOMStringList* objectStores, unsigned short mode, unsigned long timeout)
+{
+ RefPtr<IDBTransactionBackendInterface> transaction = IDBTransactionBackendImpl::create(objectStores, mode, timeout, ++m_nextID);
+ m_transactionQueue.add(transaction.get());
+ m_idMap.add(m_nextID, transaction);
+ return transaction.release();
+}
+
+void IDBTransactionCoordinator::abort(int id)
+{
+ ASSERT(m_idMap.contains(id));
+ RefPtr<IDBTransactionBackendInterface> transaction = m_idMap.get(id);
+ ASSERT(transaction);
+ m_transactionQueue.remove(transaction.get());
+ m_idMap.remove(id);
+ transaction->abort();
+ // FIXME: this will change once we have transactions actually running.
+}
+
+};
+
+#endif // ENABLE(INDEXED_DATABASE)
diff --git a/WebCore/storage/IDBTransactionCoordinator.h b/WebCore/storage/IDBTransactionCoordinator.h
new file mode 100644
index 0000000..9856ad7
--- /dev/null
+++ b/WebCore/storage/IDBTransactionCoordinator.h
@@ -0,0 +1,71 @@
+/*
+ * 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.
+ *
+ * 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 IDBTransactionCoordinator_h
+#define IDBTransactionCoordinator_h
+
+#if ENABLE(INDEXED_DATABASE)
+
+#include "DOMStringList.h"
+#include "IDBTransactionBackendInterface.h"
+#include <wtf/ListHashSet.h>
+#include <wtf/RefPtr.h>
+
+namespace WebCore {
+
+class IDBTransactionCallbacks;
+
+// This class manages transactions as follows. Requests for new transactions are
+// always satisfied and the new transaction is placed in a queue.
+// Transactions are not actually started until the first operation is issued.
+// Each transaction executes in a separate thread and is committed automatically
+// when there are no more operations issued in its context.
+// When starting, a transaction will attempt to lock all the object stores in its
+// scope. If this does not happen within a given timeout, an exception is raised.
+// The Coordinator maintains a pool of threads. If there are no threads available
+// the next transaction in the queue will have to wait until a thread becomes
+// available.
+class IDBTransactionCoordinator : public RefCounted<IDBTransactionCoordinator> {
+public:
+ static PassRefPtr<IDBTransactionCoordinator> create() { return adoptRef(new IDBTransactionCoordinator()); }
+ virtual ~IDBTransactionCoordinator();
+
+ PassRefPtr<IDBTransactionBackendInterface> createTransaction(DOMStringList* objectStores, unsigned short mode, unsigned long timeout);
+ void abort(int transactionId);
+
+private:
+ IDBTransactionCoordinator();
+
+ ListHashSet<IDBTransactionBackendInterface*> m_transactionQueue;
+ typedef HashMap<int, RefPtr<IDBTransactionBackendInterface> > IdToTransactionMap;
+ IdToTransactionMap m_idMap;
+ int m_nextID;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(INDEXED_DATABASE)
+
+#endif // IDBTransactionCoordinator_h
diff --git a/WebKit/chromium/ChangeLog b/WebKit/chromium/ChangeLog
index 93479f4..128e759 100644
--- a/WebKit/chromium/ChangeLog
+++ b/WebKit/chromium/ChangeLog
@@ -1,3 +1,75 @@
+2010-08-19 Andrei Popescu <andreip at google.com>
+
+ Reviewed by Jeremy Orlow.
+
+ [IndexedDB] Abort idle IDBTransactions when the JS context they were created in finishes execution.
+ https://bugs.webkit.org/show_bug.cgi?id=44101
+
+ * WebKit.gyp:
+ * public/WebIDBDatabase.h:
+ (WebKit::WebIDBDatabase::transaction):
+ * public/WebIDBFactory.h:
+ (WebKit::WebIDBFactory::abortPendingTransactions):
+ * public/WebIDBTransaction.h: Added.
+ (WebKit::WebIDBTransaction::~WebIDBTransaction):
+ (WebKit::WebIDBTransaction::mode):
+ (WebKit::WebIDBTransaction::objectStore):
+ (WebKit::WebIDBTransaction::abort):
+ (WebKit::WebIDBTransaction::id):
+ (WebKit::WebIDBTransaction::setCallbacks):
+ * public/WebIDBTransactionCallbacks.h: Added.
+ (WebKit::WebIDBTransactionCallbacks::~WebIDBTransactionCallbacks):
+ (WebKit::WebIDBTransactionCallbacks::onAbort):
+ (WebKit::WebIDBTransactionCallbacks::id):
+ * src/IDBDatabaseProxy.cpp:
+ (WebCore::IDBDatabaseProxy::transaction):
+ * src/IDBFactoryBackendProxy.cpp:
+ (WebCore::IDBFactoryBackendProxy::abortPendingTransactions):
+ * src/IDBFactoryBackendProxy.h:
+ * src/IDBTransactionBackendProxy.cpp: Added.
+ (WebCore::IDBTransactionBackendProxy::create):
+ (WebCore::IDBTransactionBackendProxy::IDBTransactionBackendProxy):
+ (WebCore::IDBTransactionBackendProxy::~IDBTransactionBackendProxy):
+ (WebCore::IDBTransactionBackendProxy::objectStore):
+ (WebCore::IDBTransactionBackendProxy::mode):
+ (WebCore::IDBTransactionBackendProxy::abort):
+ (WebCore::IDBTransactionBackendProxy::scheduleTask):
+ (WebCore::IDBTransactionBackendProxy::sqliteDatabase):
+ (WebCore::IDBTransactionBackendProxy::id):
+ (WebCore::IDBTransactionBackendProxy::setCallbacks):
+ * src/IDBTransactionBackendProxy.h: Added.
+ * src/IDBTransactionCallbacksProxy.cpp: Added.
+ (WebCore::IDBTransactionCallbacksProxy::create):
+ (WebCore::IDBTransactionCallbacksProxy::IDBTransactionCallbacksProxy):
+ (WebCore::IDBTransactionCallbacksProxy::~IDBTransactionCallbacksProxy):
+ (WebCore::IDBTransactionCallbacksProxy::onAbort):
+ (WebCore::IDBTransactionCallbacksProxy::id):
+ * src/IDBTransactionCallbacksProxy.h: Added.
+ * src/WebDOMStringList.cpp:
+ (WebKit::WebDOMStringList::length):
+ * src/WebIDBDatabaseImpl.cpp:
+ (WebKit::WebIDBDatabaseImpl::transaction):
+ * src/WebIDBDatabaseImpl.h:
+ * src/WebIDBFactoryImpl.cpp:
+ (WebKit::WebIDBFactoryImpl::abortPendingTransactions):
+ * src/WebIDBFactoryImpl.h:
+ * src/WebIDBTransactionCallbacksImpl.cpp: Added.
+ (WebCore::WebIDBTransactionCallbacksImpl::WebIDBTransactionCallbacksImpl):
+ (WebCore::WebIDBTransactionCallbacksImpl::~WebIDBTransactionCallbacksImpl):
+ (WebCore::WebIDBTransactionCallbacksImpl::onAbort):
+ (WebCore::WebIDBTransactionCallbacksImpl::id):
+ * src/WebIDBTransactionCallbacksImpl.h: Added.
+ * src/WebIDBTransactionImpl.cpp: Added.
+ (WebKit::WebIDBTransactionImpl::WebIDBTransactionImpl):
+ (WebKit::WebIDBTransactionImpl::~WebIDBTransactionImpl):
+ (WebKit::WebIDBTransactionImpl::mode):
+ (WebKit::WebIDBTransactionImpl::objectStore):
+ (WebKit::WebIDBTransactionImpl::abort):
+ (WebKit::WebIDBTransactionImpl::id):
+ (WebKit::WebIDBTransactionImpl::setCallbacks):
+ * src/WebIDBTransactionImpl.h: Added.
+ (WebKit::):
+
2010-08-19 Pavel Feldman <pfeldman at chromium.org>
Reviewed by Yury Semikhatsky.
diff --git a/WebKit/chromium/WebKit.gyp b/WebKit/chromium/WebKit.gyp
index 4d93071..c46d431 100644
--- a/WebKit/chromium/WebKit.gyp
+++ b/WebKit/chromium/WebKit.gyp
@@ -196,6 +196,8 @@
'public/WebIDBKey.h',
'public/WebIDBKeyPath.h',
'public/WebIDBObjectStore.h',
+ 'public/WebIDBTransaction.h',
+ 'public/WebIDBTransactionCallbacks.h',
'public/WebInputElement.h',
'public/WebInputEvent.h',
'public/WebKit.h',
@@ -347,6 +349,10 @@
'src/IDBIndexBackendProxy.h',
'src/IDBObjectStoreProxy.cpp',
'src/IDBObjectStoreProxy.h',
+ 'src/IDBTransactionBackendProxy.cpp',
+ 'src/IDBTransactionBackendProxy.h',
+ 'src/IDBTransactionCallbacksProxy.cpp',
+ 'src/IDBTransactionCallbacksProxy.h',
'src/InspectorClientImpl.cpp',
'src/InspectorClientImpl.h',
'src/InspectorFrontendClientImpl.cpp',
@@ -457,6 +463,10 @@
'src/WebIDBKeyRange.cpp',
'src/WebIDBObjectStoreImpl.cpp',
'src/WebIDBObjectStoreImpl.h',
+ 'src/WebIDBTransactionImpl.cpp',
+ 'src/WebIDBTransactionImpl.h',
+ 'src/WebIDBTransactionCallbacksImpl.cpp',
+ 'src/WebIDBTransactionCallbacksImpl.h',
'src/WebImageCG.cpp',
'src/WebImageDecoder.cpp',
'src/WebImageSkia.cpp',
diff --git a/WebKit/chromium/public/WebIDBDatabase.h b/WebKit/chromium/public/WebIDBDatabase.h
index b0d6086..6e494ce 100644
--- a/WebKit/chromium/public/WebIDBDatabase.h
+++ b/WebKit/chromium/public/WebIDBDatabase.h
@@ -34,6 +34,7 @@ namespace WebKit {
class WebFrame;
class WebIDBCallbacks;
class WebIDBObjectStore;
+class WebIDBTransaction;
// See comment in WebIndexedDatabase for a high level overview of these classes.
class WebIDBDatabase {
@@ -74,6 +75,13 @@ public:
{
WEBKIT_ASSERT_NOT_REACHED();
}
+ // Transfers ownership of the WebIDBTransaction to the caller.
+ virtual WebIDBTransaction* transaction(const WebDOMStringList& names, unsigned short mode, unsigned long timeout)
+ {
+ WEBKIT_ASSERT_NOT_REACHED();
+ return 0;
+ }
+
};
} // namespace WebKit
diff --git a/WebKit/chromium/public/WebIDBFactory.h b/WebKit/chromium/public/WebIDBFactory.h
index 5eb6f58..7c070a2 100755
--- a/WebKit/chromium/public/WebIDBFactory.h
+++ b/WebKit/chromium/public/WebIDBFactory.h
@@ -34,12 +34,12 @@
#include "WebIDBCallbacks.h"
#include "WebSecurityOrigin.h"
#include "WebString.h"
+#include "WebVector.h"
namespace WebKit {
class WebFrame;
class WebIDBDatabase;
-class WebString;
class WebSecurityOrigin;
// The entry point into the IndexedDatabase API. These classes match their Foo and
@@ -63,6 +63,8 @@ public:
{
open(name, description, callbacks, origin, webFrame);
}
+
+ virtual void abortPendingTransactions(const WebVector<int>& pendingIDs) { WEBKIT_ASSERT_NOT_REACHED(); }
};
} // namespace WebKit
diff --git a/WebKit/chromium/public/WebIDBTransaction.h b/WebKit/chromium/public/WebIDBTransaction.h
new file mode 100644
index 0000000..0369b89
--- /dev/null
+++ b/WebKit/chromium/public/WebIDBTransaction.h
@@ -0,0 +1,62 @@
+/*
+ * 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.
+ *
+ * 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 WebIDBTransaction_h
+#define WebIDBTransaction_h
+
+#include "WebString.h"
+
+namespace WebKit {
+
+class WebIDBObjectStore;
+class WebIDBTransactionCallbacks;
+
+// See comment in WebIndexedDatabase for a high level overview of these classes.
+class WebIDBTransaction {
+public:
+ virtual ~WebIDBTransaction() { }
+
+ virtual int mode() const
+ {
+ WEBKIT_ASSERT_NOT_REACHED();
+ return 0;
+ }
+ virtual WebIDBObjectStore* objectStore(const WebString& name)
+ {
+ WEBKIT_ASSERT_NOT_REACHED();
+ return 0;
+ }
+ virtual void abort() { WEBKIT_ASSERT_NOT_REACHED(); }
+ virtual int id() const
+ {
+ WEBKIT_ASSERT_NOT_REACHED();
+ return 0;
+ }
+ virtual void setCallbacks(WebIDBTransactionCallbacks*) { WEBKIT_ASSERT_NOT_REACHED(); }
+};
+
+} // namespace WebKit
+
+#endif // WebIDBTransaction_h
diff --git a/WebKit/chromium/public/WebIDBTransactionCallbacks.h b/WebKit/chromium/public/WebIDBTransactionCallbacks.h
new file mode 100644
index 0000000..4b92217
--- /dev/null
+++ b/WebKit/chromium/public/WebIDBTransactionCallbacks.h
@@ -0,0 +1,46 @@
+/*
+ * 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.
+ *
+ * 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 WebIDBTransactionCallbacks_h
+#define WebIDBTransactionCallbacks_h
+
+#include "WebCommon.h"
+
+namespace WebKit {
+class WebIDBTransactionCallbacks {
+public:
+ virtual ~WebIDBTransactionCallbacks() { }
+
+ virtual void onAbort() { WEBKIT_ASSERT_NOT_REACHED(); }
+ virtual int id() const
+ {
+ WEBKIT_ASSERT_NOT_REACHED();
+ return 0;
+ }
+};
+
+} // namespace WebKit
+
+#endif // WebIDBTransactionCallbacks_h
diff --git a/WebKit/chromium/src/IDBDatabaseProxy.cpp b/WebKit/chromium/src/IDBDatabaseProxy.cpp
index d11d182..9aa2977 100644
--- a/WebKit/chromium/src/IDBDatabaseProxy.cpp
+++ b/WebKit/chromium/src/IDBDatabaseProxy.cpp
@@ -29,12 +29,14 @@
#include "DOMStringList.h"
#include "IDBCallbacks.h"
#include "IDBObjectStoreProxy.h"
-#include "IDBTransactionBackendInterface.h"
+#include "IDBTransactionBackendProxy.h"
+#include "WebDOMStringList.h"
#include "WebFrameImpl.h"
#include "WebIDBCallbacksImpl.h"
#include "WebIDBDatabase.h"
#include "WebIDBDatabaseError.h"
#include "WebIDBObjectStore.h"
+#include "WebIDBTransaction.h"
#if ENABLE(INDEXED_DATABASE)
@@ -94,9 +96,9 @@ void IDBDatabaseProxy::removeObjectStore(const String& name, PassRefPtr<IDBCallb
PassRefPtr<IDBTransactionBackendInterface> IDBDatabaseProxy::transaction(DOMStringList* storeNames, unsigned short mode, unsigned long timeout)
{
- // FIXME: plumb to the browser process, etc etc.
- ASSERT_NOT_REACHED();
- return 0;
+ WebKit::WebDOMStringList names(storeNames);
+ WebKit::WebIDBTransaction* transaction = m_webIDBDatabase->transaction(names, mode, timeout);
+ return IDBTransactionBackendProxy::create(transaction);
}
} // namespace WebCore
diff --git a/WebKit/chromium/src/IDBFactoryBackendProxy.cpp b/WebKit/chromium/src/IDBFactoryBackendProxy.cpp
index 44cbb40..114e7e1 100755
--- a/WebKit/chromium/src/IDBFactoryBackendProxy.cpp
+++ b/WebKit/chromium/src/IDBFactoryBackendProxy.cpp
@@ -39,6 +39,7 @@
#include "WebIDBFactory.h"
#include "WebKit.h"
#include "WebKitClient.h"
+#include "WebVector.h"
#if ENABLE(INDEXED_DATABASE)
@@ -64,6 +65,14 @@ void IDBFactoryBackendProxy::open(const String& name, const String& description,
m_webIDBFactory->open(name, description, new WebIDBCallbacksImpl(callbacks), origin, webFrame);
}
+void IDBFactoryBackendProxy::abortPendingTransactions(const Vector<int>& pendingIDs)
+{
+ ASSERT(pendingIDs.size());
+ WebKit::WebVector<int> ids = pendingIDs;
+
+ m_webIDBFactory->abortPendingTransactions(ids);
+}
+
} // namespace WebCore
#endif // ENABLE(INDEXED_DATABASE)
diff --git a/WebKit/chromium/src/IDBFactoryBackendProxy.h b/WebKit/chromium/src/IDBFactoryBackendProxy.h
index 969a9d7..9efc7af 100755
--- a/WebKit/chromium/src/IDBFactoryBackendProxy.h
+++ b/WebKit/chromium/src/IDBFactoryBackendProxy.h
@@ -46,6 +46,7 @@ public:
PassRefPtr<DOMStringList> databases(void) const;
virtual void open(const String& name, const String& description, PassRefPtr<IDBCallbacks>, PassRefPtr<SecurityOrigin>, Frame*);
+ virtual void abortPendingTransactions(const Vector<int>& pendingIDs);
private:
IDBFactoryBackendProxy();
diff --git a/WebKit/chromium/src/IDBTransactionBackendProxy.cpp b/WebKit/chromium/src/IDBTransactionBackendProxy.cpp
new file mode 100644
index 0000000..be6b058
--- /dev/null
+++ b/WebKit/chromium/src/IDBTransactionBackendProxy.cpp
@@ -0,0 +1,91 @@
+/*
+ * 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.
+ *
+ * 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 "IDBTransactionBackendProxy.h"
+
+#if ENABLE(INDEXED_DATABASE)
+
+#include "IDBObjectStoreProxy.h"
+#include "IDBTransactionCallbacks.h"
+#include "WebIDBDatabaseError.h"
+#include "WebIDBObjectStore.h"
+#include "WebIDBTransaction.h"
+#include "WebIDBTransactionCallbacksImpl.h"
+
+namespace WebCore {
+
+PassRefPtr<IDBTransactionBackendInterface> IDBTransactionBackendProxy::create(PassOwnPtr<WebKit::WebIDBTransaction> transaction)
+{
+ return adoptRef(new IDBTransactionBackendProxy(transaction));
+}
+
+IDBTransactionBackendProxy::IDBTransactionBackendProxy(PassOwnPtr<WebKit::WebIDBTransaction> transaction)
+ : m_webIDBTransaction(transaction)
+{
+}
+
+IDBTransactionBackendProxy::~IDBTransactionBackendProxy()
+{
+}
+
+PassRefPtr<IDBObjectStoreBackendInterface> IDBTransactionBackendProxy::objectStore(const String& name)
+{
+ WebKit::WebIDBObjectStore* objectStore = m_webIDBTransaction->objectStore(name);
+ if (!objectStore)
+ return 0;
+ return IDBObjectStoreProxy::create(objectStore);
+}
+
+unsigned short IDBTransactionBackendProxy::mode() const
+{
+ return m_webIDBTransaction->mode();
+}
+
+void IDBTransactionBackendProxy::abort()
+{
+ m_webIDBTransaction->abort();
+}
+
+void IDBTransactionBackendProxy::scheduleTask(PassOwnPtr<ScriptExecutionContext::Task>)
+{
+ // This should never be reached as it's the impl objects who get to
+ // execute tasks in the browser process.
+ ASSERT_NOT_REACHED();
+}
+
+int IDBTransactionBackendProxy::id() const
+{
+ return m_webIDBTransaction->id();
+}
+
+void IDBTransactionBackendProxy::setCallbacks(IDBTransactionCallbacks* callbacks)
+{
+ m_webIDBTransaction->setCallbacks(new WebIDBTransactionCallbacksImpl(callbacks));
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(INDEXED_DATABASE)
diff --git a/WebKit/chromium/src/IDBTransactionBackendProxy.h b/WebKit/chromium/src/IDBTransactionBackendProxy.h
new file mode 100644
index 0000000..d62b8ff
--- /dev/null
+++ b/WebKit/chromium/src/IDBTransactionBackendProxy.h
@@ -0,0 +1,62 @@
+/*
+ * 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.
+ *
+ * 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 IDBTransactionBackendProxy_h
+#define IDBTransactionBackendProxy_h
+
+#include "IDBTransactionBackendInterface.h"
+
+#if ENABLE(INDEXED_DATABASE)
+
+#include <wtf/OwnPtr.h>
+#include <wtf/PassOwnPtr.h>
+
+namespace WebKit { class WebIDBTransaction; }
+
+namespace WebCore {
+
+class IDBTransactionBackendProxy : public IDBTransactionBackendInterface {
+public:
+ static PassRefPtr<IDBTransactionBackendInterface> create(PassOwnPtr<WebKit::WebIDBTransaction>);
+ virtual ~IDBTransactionBackendProxy();
+
+ virtual PassRefPtr<IDBObjectStoreBackendInterface> objectStore(const String& name);
+ virtual unsigned short mode() const;
+ virtual void abort();
+ virtual void scheduleTask(PassOwnPtr<ScriptExecutionContext::Task>);
+ virtual int id() const;
+ virtual void setCallbacks(IDBTransactionCallbacks*);
+
+private:
+ IDBTransactionBackendProxy(PassOwnPtr<WebKit::WebIDBTransaction>);
+
+ OwnPtr<WebKit::WebIDBTransaction> m_webIDBTransaction;
+};
+
+} // namespace WebCore
+
+#endif
+
+#endif // IDBTransactionBackendProxy_h
diff --git a/WebKit/chromium/src/IDBTransactionCallbacksProxy.cpp b/WebKit/chromium/src/IDBTransactionCallbacksProxy.cpp
new file mode 100644
index 0000000..be7d44f
--- /dev/null
+++ b/WebKit/chromium/src/IDBTransactionCallbacksProxy.cpp
@@ -0,0 +1,65 @@
+/*
+ * 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 "IDBTransactionCallbacksProxy.h"
+
+#include "WebIDBTransactionCallbacks.h"
+
+#if ENABLE(INDEXED_DATABASE)
+
+namespace WebCore {
+
+PassRefPtr<IDBTransactionCallbacksProxy> IDBTransactionCallbacksProxy::create(PassOwnPtr<WebKit::WebIDBTransactionCallbacks> callbacks)
+{
+ return adoptRef(new IDBTransactionCallbacksProxy(callbacks));
+}
+
+IDBTransactionCallbacksProxy::IDBTransactionCallbacksProxy(PassOwnPtr<WebKit::WebIDBTransactionCallbacks> callbacks)
+ : m_callbacks(callbacks)
+{
+}
+
+IDBTransactionCallbacksProxy::~IDBTransactionCallbacksProxy()
+{
+}
+
+void IDBTransactionCallbacksProxy::onAbort()
+{
+ m_callbacks->onAbort();
+ m_callbacks.clear();
+}
+
+int IDBTransactionCallbacksProxy::id() const
+{
+ return m_callbacks->id();
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(INDEXED_DATABASE)
diff --git a/WebKit/chromium/src/IDBTransactionCallbacksProxy.h b/WebKit/chromium/src/IDBTransactionCallbacksProxy.h
new file mode 100644
index 0000000..821eff4
--- /dev/null
+++ b/WebKit/chromium/src/IDBTransactionCallbacksProxy.h
@@ -0,0 +1,63 @@
+/*
+ * 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 IDBTransactionCallbacksProxy_h
+#define IDBTransactionCallbacksProxy_h
+
+#include "IDBTransactionCallbacks.h"
+
+#if ENABLE(INDEXED_DATABASE)
+
+#include <wtf/PassOwnPtr.h>
+#include <wtf/PassRefPtr.h>
+
+namespace WebKit { class WebIDBTransactionCallbacks; }
+
+namespace WebCore {
+
+class IDBTransactionCallbacksProxy : public IDBTransactionCallbacks {
+public:
+ static PassRefPtr<IDBTransactionCallbacksProxy> create(PassOwnPtr<WebKit::WebIDBTransactionCallbacks>);
+ virtual ~IDBTransactionCallbacksProxy();
+
+ virtual void onAbort();
+ virtual int id() const;
+ // FIXME: implement onComplete().
+
+private:
+ IDBTransactionCallbacksProxy(PassOwnPtr<WebKit::WebIDBTransactionCallbacks>);
+
+ OwnPtr<WebKit::WebIDBTransactionCallbacks> m_callbacks;
+};
+
+
+} // namespace WebCore
+
+#endif
+
+#endif // IDBTransactionCallbacksProxy_h
diff --git a/WebKit/chromium/src/WebDOMStringList.cpp b/WebKit/chromium/src/WebDOMStringList.cpp
index 4be7fab..dc82331 100644
--- a/WebKit/chromium/src/WebDOMStringList.cpp
+++ b/WebKit/chromium/src/WebDOMStringList.cpp
@@ -60,6 +60,8 @@ void WebDOMStringList::append(const WebString& string)
unsigned WebDOMStringList::length() const
{
+ if (m_private.isNull())
+ return 0;
return m_private->length();
}
diff --git a/WebKit/chromium/src/WebIDBDatabaseImpl.cpp b/WebKit/chromium/src/WebIDBDatabaseImpl.cpp
index 8c8e30a..bd3600f 100644
--- a/WebKit/chromium/src/WebIDBDatabaseImpl.cpp
+++ b/WebKit/chromium/src/WebIDBDatabaseImpl.cpp
@@ -29,8 +29,10 @@
#include "DOMStringList.h"
#include "IDBCallbacksProxy.h"
#include "IDBDatabaseBackendInterface.h"
+#include "IDBTransactionBackendInterface.h"
#include "WebIDBCallbacks.h"
#include "WebIDBObjectStoreImpl.h"
+#include "WebIDBTransactionImpl.h"
#if ENABLE(INDEXED_DATABASE)
@@ -85,6 +87,15 @@ void WebIDBDatabaseImpl::removeObjectStore(const WebString& name, WebIDBCallback
m_databaseBackend->removeObjectStore(name, IDBCallbacksProxy::create(callbacks));
}
+WebIDBTransaction* WebIDBDatabaseImpl::transaction(const WebDOMStringList& names, unsigned short mode, unsigned long timeout)
+{
+ RefPtr<DOMStringList> nameList = PassRefPtr<DOMStringList>(names);
+ RefPtr<IDBTransactionBackendInterface> transaction = m_databaseBackend->transaction(nameList.get(), mode, timeout);
+ if (!transaction)
+ return 0;
+ return new WebIDBTransactionImpl(transaction);
+}
+
} // namespace WebCore
#endif // ENABLE(INDEXED_DATABASE)
diff --git a/WebKit/chromium/src/WebIDBDatabaseImpl.h b/WebKit/chromium/src/WebIDBDatabaseImpl.h
index 46a6609..9ae74e0 100644
--- a/WebKit/chromium/src/WebIDBDatabaseImpl.h
+++ b/WebKit/chromium/src/WebIDBDatabaseImpl.h
@@ -36,6 +36,7 @@ namespace WebCore { class IDBDatabaseBackendInterface; }
namespace WebKit {
class WebIDBObjectStore;
+class WebIDBTransaction;
// See comment in WebIndexedDatabase for a high level overview these classes.
class WebIDBDatabaseImpl : public WebIDBDatabase {
@@ -51,6 +52,7 @@ public:
virtual void createObjectStore(const WebString& name, const WebString& keyPath, bool autoIncrement, WebIDBCallbacks* callbacks);
virtual WebIDBObjectStore* objectStore(const WebString& name, unsigned short mode);
virtual void removeObjectStore(const WebString& name, WebIDBCallbacks* callbacks);
+ virtual WebIDBTransaction* transaction(const WebDOMStringList& names, unsigned short mode, unsigned long timeout);
private:
WTF::RefPtr<WebCore::IDBDatabaseBackendInterface> m_databaseBackend;
diff --git a/WebKit/chromium/src/WebIDBFactoryImpl.cpp b/WebKit/chromium/src/WebIDBFactoryImpl.cpp
index 5ac89f4..564be36 100755
--- a/WebKit/chromium/src/WebIDBFactoryImpl.cpp
+++ b/WebKit/chromium/src/WebIDBFactoryImpl.cpp
@@ -63,6 +63,15 @@ void WebIDBFactoryImpl::open(const WebString& name, const WebString& description
m_idbFactoryBackend->open(name, description, IDBCallbacksProxy::create(callbacks), origin, 0);
}
+void WebIDBFactoryImpl::abortPendingTransactions(const WebVector<int>& pendingIDs)
+{
+ WTF::Vector<int> ids(pendingIDs.size());
+ for (size_t i = 0; i < pendingIDs.size(); ++i)
+ ids[i] = pendingIDs[i];
+
+ m_idbFactoryBackend->abortPendingTransactions(ids);
+}
+
} // namespace WebKit
#endif // ENABLE(INDEXED_DATABASE)
diff --git a/WebKit/chromium/src/WebIDBFactoryImpl.h b/WebKit/chromium/src/WebIDBFactoryImpl.h
index c9ec9a3..aeab478 100755
--- a/WebKit/chromium/src/WebIDBFactoryImpl.h
+++ b/WebKit/chromium/src/WebIDBFactoryImpl.h
@@ -43,6 +43,7 @@ public:
virtual ~WebIDBFactoryImpl();
virtual void open(const WebString& name, const WebString& description, WebIDBCallbacks*, const WebSecurityOrigin&, WebFrame*);
+ virtual void abortPendingTransactions(const WebVector<int>& pendingIDs);
private:
WTF::RefPtr<WebCore::IDBFactoryBackendInterface> m_idbFactoryBackend;
diff --git a/WebKit/chromium/src/WebIDBTransactionCallbacksImpl.cpp b/WebKit/chromium/src/WebIDBTransactionCallbacksImpl.cpp
new file mode 100644
index 0000000..264ddc5
--- /dev/null
+++ b/WebKit/chromium/src/WebIDBTransactionCallbacksImpl.cpp
@@ -0,0 +1,56 @@
+/*
+ * 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.
+ *
+ * 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 "WebIDBTransactionCallbacksImpl.h"
+
+#if ENABLE(INDEXED_DATABASE)
+
+#include "IDBTransactionCallbacks.h"
+
+namespace WebCore {
+
+WebIDBTransactionCallbacksImpl::WebIDBTransactionCallbacksImpl(PassRefPtr<IDBTransactionCallbacks> callbacks)
+ : m_callbacks(callbacks)
+{
+}
+
+WebIDBTransactionCallbacksImpl::~WebIDBTransactionCallbacksImpl()
+{
+}
+
+void WebIDBTransactionCallbacksImpl::onAbort()
+{
+ m_callbacks->onAbort();
+}
+
+int WebIDBTransactionCallbacksImpl::id() const
+{
+ return m_callbacks->id();
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(INDEXED_DATABASE)
diff --git a/WebKit/chromium/src/WebIDBTransactionCallbacksImpl.h b/WebKit/chromium/src/WebIDBTransactionCallbacksImpl.h
new file mode 100644
index 0000000..398a679
--- /dev/null
+++ b/WebKit/chromium/src/WebIDBTransactionCallbacksImpl.h
@@ -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.
+ *
+ * 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 WebIDBTransactionCallbacksImpl_h
+#define WebIDBTransactionCallbacksImpl_h
+
+#if ENABLE(INDEXED_DATABASE)
+
+#include "WebIDBTransactionCallbacks.h"
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefPtr.h>
+
+namespace WebCore {
+
+class IDBTransactionCallbacks;
+
+class WebIDBTransactionCallbacksImpl : public WebKit::WebIDBTransactionCallbacks {
+public:
+ WebIDBTransactionCallbacksImpl(PassRefPtr<IDBTransactionCallbacks>);
+ virtual ~WebIDBTransactionCallbacksImpl();
+
+ virtual void onAbort();
+ virtual int id() const;
+
+private:
+ RefPtr<IDBTransactionCallbacks> m_callbacks;
+};
+
+} // namespace WebCore
+
+#endif
+
+#endif // WebIDBTransactionCallbacksImpl_h
diff --git a/WebKit/chromium/src/WebIDBTransactionImpl.cpp b/WebKit/chromium/src/WebIDBTransactionImpl.cpp
new file mode 100644
index 0000000..0dc9702
--- /dev/null
+++ b/WebKit/chromium/src/WebIDBTransactionImpl.cpp
@@ -0,0 +1,80 @@
+/*
+ * 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.
+ *
+ * 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 "WebIDBTransactionImpl.h"
+
+#if ENABLE(INDEXED_DATABASE)
+
+#include "IDBTransaction.h"
+#include "IDBTransactionCallbacksProxy.h"
+#include "WebIDBObjectStoreImpl.h"
+#include "WebIDBTransactionCallbacks.h"
+
+using namespace WebCore;
+
+namespace WebKit {
+
+WebIDBTransactionImpl::WebIDBTransactionImpl(PassRefPtr<IDBTransactionBackendInterface> backend)
+ : m_backend(backend)
+{
+}
+
+WebIDBTransactionImpl::~WebIDBTransactionImpl()
+{
+}
+
+int WebIDBTransactionImpl::mode() const
+{
+ return m_backend->mode();
+}
+
+WebIDBObjectStore* WebIDBTransactionImpl::objectStore(const WebString& name)
+{
+ RefPtr<IDBObjectStoreBackendInterface> objectStore = m_backend->objectStore(name);
+ if (!objectStore)
+ return 0;
+ return new WebIDBObjectStoreImpl(objectStore);
+}
+
+void WebIDBTransactionImpl::abort()
+{
+ m_backend->abort();
+}
+
+int WebIDBTransactionImpl::id() const
+{
+ return m_backend->id();
+}
+
+void WebIDBTransactionImpl::setCallbacks(WebIDBTransactionCallbacks* callbacks)
+{
+ RefPtr<IDBTransactionCallbacks> idbCallbacks = IDBTransactionCallbacksProxy::create(callbacks);
+ m_backend->setCallbacks(idbCallbacks.get());
+}
+
+} // namespace WebKit
+
+#endif // ENABLE(INDEXED_DATABASE)
diff --git a/WebKit/chromium/src/WebIDBTransactionImpl.h b/WebKit/chromium/src/WebIDBTransactionImpl.h
new file mode 100644
index 0000000..a9bde68
--- /dev/null
+++ b/WebKit/chromium/src/WebIDBTransactionImpl.h
@@ -0,0 +1,60 @@
+/*
+ * 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.
+ *
+ * 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 WebIDBTransactionImpl_h
+#define WebIDBTransactionImpl_h
+
+#if ENABLE(INDEXED_DATABASE)
+
+#include "WebCommon.h"
+#include "WebIDBTransaction.h"
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefPtr.h>
+
+namespace WebCore { class IDBTransactionBackendInterface; }
+
+namespace WebKit {
+
+// See comment in WebIndexedDatabase for a high level overview these classes.
+class WebIDBTransactionImpl: public WebIDBTransaction {
+public:
+ WebIDBTransactionImpl(WTF::PassRefPtr<WebCore::IDBTransactionBackendInterface>);
+ virtual ~WebIDBTransactionImpl();
+
+ virtual int mode() const;
+ virtual WebIDBObjectStore* objectStore(const WebString& name);
+ virtual void abort();
+ virtual int id() const;
+ virtual void setCallbacks(WebIDBTransactionCallbacks*);
+
+private:
+ WTF::RefPtr<WebCore::IDBTransactionBackendInterface> m_backend;
+};
+
+} // namespace WebKit
+
+#endif // ENABLE(INDEXED_DATABASE)
+
+#endif // WebIDBTransactionImpl_h
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list