[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
jorlow at chromium.org
jorlow at chromium.org
Wed Dec 22 12:58:43 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit 2dc1aa6527e7b2f7b6c5b8ce7a6099801961174a
Author: jorlow at chromium.org <jorlow at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Fri Sep 3 12:53:44 2010 +0000
2010-08-31 Jeremy Orlow <jorlow at chromium.org>
Reviewed by Steve Block.
IDBCursor.continue() should reuse the .openCursor's IDBRequest object
https://bugs.webkit.org/show_bug.cgi?id=44953
* storage/indexeddb/objectstore-cursor.html:
2010-08-31 Jeremy Orlow <jorlow at chromium.org>
Reviewed by Steve Block.
IDBCursor.continue() should reuse the .openCursor's IDBRequest object
https://bugs.webkit.org/show_bug.cgi?id=44953
This is to match the spec. This requires a modification to IDBRequest so
that multiple events can be queued up.
Note that the initial state for IDBRequest was removed from the spec.
Test: modified existing test to verify new behavior.
* storage/IDBAny.cpp:
(WebCore::IDBAny::createInvalid):
(WebCore::IDBAny::createNull):
(WebCore::IDBAny::setNull):
* storage/IDBAny.h:
(WebCore::IDBAny::create):
* storage/IDBCursor.cpp:
(WebCore::IDBCursor::IDBCursor):
(WebCore::IDBCursor::continueFunction):
* storage/IDBCursor.h:
(WebCore::IDBCursor::create):
* storage/IDBCursor.idl:
* storage/IDBRequest.cpp:
(WebCore::IDBRequest::IDBRequest):
(WebCore::IDBRequest::~IDBRequest):
(WebCore::IDBRequest::resetReadyState):
(WebCore::IDBRequest::onError):
(WebCore::IDBRequest::onSuccess):
(WebCore::IDBRequest::abort):
(WebCore::IDBRequest::timerFired):
(WebCore::IDBRequest::scheduleEvent):
* storage/IDBRequest.h:
* storage/IDBRequest.idl:
2010-08-31 Jeremy Orlow <jorlow at chromium.org>
Reviewed by Steve Block.
IDBCursor.continue() should reuse the .openCursor's IDBRequest object
https://bugs.webkit.org/show_bug.cgi?id=44953
* src/WebIDBCallbacksImpl.cpp:
(WebCore::WebIDBCallbacksImpl::onError):
(WebCore::WebIDBCallbacksImpl::onSuccess):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@66726 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index a8b2ccf..0f5a260 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,12 @@
+2010-08-31 Jeremy Orlow <jorlow at chromium.org>
+
+ Reviewed by Steve Block.
+
+ IDBCursor.continue() should reuse the .openCursor's IDBRequest object
+ https://bugs.webkit.org/show_bug.cgi?id=44953
+
+ * storage/indexeddb/objectstore-cursor.html:
+
2010-09-03 Anton Muhin <antonm at chromium.org>
Unreviewed fix, updating Chromium's exectations.
diff --git a/LayoutTests/storage/indexeddb/objectstore-cursor.html b/LayoutTests/storage/indexeddb/objectstore-cursor.html
index bc69b43..25e9456 100644
--- a/LayoutTests/storage/indexeddb/objectstore-cursor.html
+++ b/LayoutTests/storage/indexeddb/objectstore-cursor.html
@@ -195,10 +195,7 @@ function cursorIteration()
window.expectedIndex = ascending ? expectedIndex+1 : expectedIndex-1;
testWithinBounds();
- request = event.result.continue();
- // FIXME: The spec says we should not return an IDBRequest and instead re-use the original request.
- request.onsuccess = cursorIteration;
- request.onerror = unexpectedErrorCallback;
+ event.result.continue();
}
openDatabase(); // The first step.
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 0e25909..7bf67b9 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,41 @@
+2010-08-31 Jeremy Orlow <jorlow at chromium.org>
+
+ Reviewed by Steve Block.
+
+ IDBCursor.continue() should reuse the .openCursor's IDBRequest object
+ https://bugs.webkit.org/show_bug.cgi?id=44953
+
+ This is to match the spec. This requires a modification to IDBRequest so
+ that multiple events can be queued up.
+
+ Note that the initial state for IDBRequest was removed from the spec.
+
+ Test: modified existing test to verify new behavior.
+
+ * storage/IDBAny.cpp:
+ (WebCore::IDBAny::createInvalid):
+ (WebCore::IDBAny::createNull):
+ (WebCore::IDBAny::setNull):
+ * storage/IDBAny.h:
+ (WebCore::IDBAny::create):
+ * storage/IDBCursor.cpp:
+ (WebCore::IDBCursor::IDBCursor):
+ (WebCore::IDBCursor::continueFunction):
+ * storage/IDBCursor.h:
+ (WebCore::IDBCursor::create):
+ * storage/IDBCursor.idl:
+ * storage/IDBRequest.cpp:
+ (WebCore::IDBRequest::IDBRequest):
+ (WebCore::IDBRequest::~IDBRequest):
+ (WebCore::IDBRequest::resetReadyState):
+ (WebCore::IDBRequest::onError):
+ (WebCore::IDBRequest::onSuccess):
+ (WebCore::IDBRequest::abort):
+ (WebCore::IDBRequest::timerFired):
+ (WebCore::IDBRequest::scheduleEvent):
+ * storage/IDBRequest.h:
+ * storage/IDBRequest.idl:
+
2010-09-03 Bharathwaaj Srinivasan <bharathwaaj.s at gmail.com>
Reviewed by Xan Lopez.
diff --git a/WebCore/storage/IDBAny.cpp b/WebCore/storage/IDBAny.cpp
index 93d2633..7303fd6 100644
--- a/WebCore/storage/IDBAny.cpp
+++ b/WebCore/storage/IDBAny.cpp
@@ -37,11 +37,18 @@
namespace WebCore {
-PassRefPtr<IDBAny> IDBAny::create()
+PassRefPtr<IDBAny> IDBAny::createInvalid()
{
return adoptRef(new IDBAny());
}
+PassRefPtr<IDBAny> IDBAny::createNull()
+{
+ RefPtr<IDBAny> idbAny = adoptRef(new IDBAny());
+ idbAny->setNull();
+ return idbAny.release();
+}
+
IDBAny::IDBAny()
: m_type(UndefinedType)
{
@@ -93,7 +100,7 @@ PassRefPtr<SerializedScriptValue> IDBAny::serializedScriptValue()
return m_serializedScriptValue;
}
-void IDBAny::set()
+void IDBAny::setNull()
{
ASSERT(m_type == UndefinedType);
m_type = NullType;
diff --git a/WebCore/storage/IDBAny.h b/WebCore/storage/IDBAny.h
index 950660a..9066e13 100644
--- a/WebCore/storage/IDBAny.h
+++ b/WebCore/storage/IDBAny.h
@@ -44,11 +44,19 @@ class SerializedScriptValue;
class IDBAny : public RefCounted<IDBAny> {
public:
- static PassRefPtr<IDBAny> create();
+ static PassRefPtr<IDBAny> createInvalid();
+ static PassRefPtr<IDBAny> createNull();
template<typename T>
static PassRefPtr<IDBAny> create(T* idbObject)
{
- RefPtr<IDBAny> any = IDBAny::create();
+ RefPtr<IDBAny> any = IDBAny::createInvalid();
+ any->set(idbObject);
+ return any.release();
+ }
+ template<typename T>
+ static PassRefPtr<IDBAny> create(PassRefPtr<T> idbObject)
+ {
+ RefPtr<IDBAny> any = IDBAny::createInvalid();
any->set(idbObject);
return any.release();
}
@@ -77,7 +85,7 @@ public:
PassRefPtr<SerializedScriptValue> serializedScriptValue();
// Set can only be called once.
- void set(); // For "null".
+ void setNull();
void set(PassRefPtr<IDBCursor>);
void set(PassRefPtr<IDBDatabase>);
void set(PassRefPtr<IDBFactory>);
diff --git a/WebCore/storage/IDBCursor.cpp b/WebCore/storage/IDBCursor.cpp
index ae0d127..52945f8 100644
--- a/WebCore/storage/IDBCursor.cpp
+++ b/WebCore/storage/IDBCursor.cpp
@@ -38,8 +38,9 @@
namespace WebCore {
-IDBCursor::IDBCursor(PassRefPtr<IDBCursorBackendInterface> backend)
+IDBCursor::IDBCursor(PassRefPtr<IDBCursorBackendInterface> backend, IDBRequest* request)
: m_backend(backend)
+ , m_request(request)
{
}
@@ -69,11 +70,13 @@ PassRefPtr<IDBRequest> IDBCursor::update(ScriptExecutionContext* context, PassRe
return request.release();
}
-PassRefPtr<IDBRequest> IDBCursor::continueFunction(ScriptExecutionContext* context, PassRefPtr<IDBKey> key)
+void IDBCursor::continueFunction(PassRefPtr<IDBKey> key)
{
- RefPtr<IDBRequest> request = IDBRequest::create(context, IDBAny::create(this));
- m_backend->continueFunction(key, request);
- return request.release();
+ // FIXME: We're not using the context from when continue was called, which means the callback
+ // will be on the original context openCursor was called on. Is this right?
+ if (m_request->resetReadyState())
+ m_backend->continueFunction(key, m_request);
+ // FIXME: Else throw?
}
PassRefPtr<IDBRequest> IDBCursor::remove(ScriptExecutionContext* context)
diff --git a/WebCore/storage/IDBCursor.h b/WebCore/storage/IDBCursor.h
index ccce001..0c438c4 100644
--- a/WebCore/storage/IDBCursor.h
+++ b/WebCore/storage/IDBCursor.h
@@ -31,7 +31,6 @@
#include <wtf/PassRefPtr.h>
#include <wtf/RefCounted.h>
#include <wtf/RefPtr.h>
-#include <wtf/Threading.h>
namespace WebCore {
@@ -43,7 +42,7 @@ class IDBRequest;
class ScriptExecutionContext;
class SerializedScriptValue;
-class IDBCursor : public ThreadSafeShared<IDBCursor> {
+class IDBCursor : public RefCounted<IDBCursor> {
public:
enum Direction {
NEXT = 0,
@@ -51,24 +50,25 @@ public:
PREV = 2,
PREV_NO_DUPLICATE = 3,
};
- static PassRefPtr<IDBCursor> create(PassRefPtr<IDBCursorBackendInterface> backend)
+ static PassRefPtr<IDBCursor> create(PassRefPtr<IDBCursorBackendInterface> backend, IDBRequest* request)
{
- return adoptRef(new IDBCursor(backend));
+ return adoptRef(new IDBCursor(backend, request));
}
- virtual ~IDBCursor();
+ ~IDBCursor();
// Implement the IDL
- virtual unsigned short direction() const;
- virtual PassRefPtr<IDBKey> key() const;
- virtual PassRefPtr<IDBAny> value() const;
- virtual PassRefPtr<IDBRequest> update(ScriptExecutionContext*, PassRefPtr<SerializedScriptValue>);
- virtual PassRefPtr<IDBRequest> continueFunction(ScriptExecutionContext*, PassRefPtr<IDBKey> = 0);
- virtual PassRefPtr<IDBRequest> remove(ScriptExecutionContext*);
+ unsigned short direction() const;
+ PassRefPtr<IDBKey> key() const;
+ PassRefPtr<IDBAny> value() const;
+ PassRefPtr<IDBRequest> update(ScriptExecutionContext*, PassRefPtr<SerializedScriptValue>);
+ void continueFunction(PassRefPtr<IDBKey> = 0);
+ PassRefPtr<IDBRequest> remove(ScriptExecutionContext*);
private:
- explicit IDBCursor(PassRefPtr<IDBCursorBackendInterface>);
+ explicit IDBCursor(PassRefPtr<IDBCursorBackendInterface>, IDBRequest*);
RefPtr<IDBCursorBackendInterface> m_backend;
+ RefPtr<IDBRequest> m_request;
};
} // namespace WebCore
diff --git a/WebCore/storage/IDBCursor.idl b/WebCore/storage/IDBCursor.idl
index 3702ef3..232842b 100644
--- a/WebCore/storage/IDBCursor.idl
+++ b/WebCore/storage/IDBCursor.idl
@@ -38,7 +38,7 @@ module storage {
readonly attribute IDBAny value;
[CallWith=ScriptExecutionContext] IDBRequest update(in SerializedScriptValue value);
- [CallWith=ScriptExecutionContext, ImplementationFunction=continueFunction] IDBRequest continue(in [Optional] IDBKey key);
+ [ImplementationFunction=continueFunction] void continue(in [Optional] IDBKey key);
[CallWith=ScriptExecutionContext] IDBRequest remove();
};
}
diff --git a/WebCore/storage/IDBRequest.cpp b/WebCore/storage/IDBRequest.cpp
index 94ef7e5..3513c17 100644
--- a/WebCore/storage/IDBRequest.cpp
+++ b/WebCore/storage/IDBRequest.cpp
@@ -48,71 +48,72 @@ namespace WebCore {
IDBRequest::IDBRequest(ScriptExecutionContext* context, PassRefPtr<IDBAny> source)
: ActiveDOMObject(context, this)
, m_source(source)
- , m_result(IDBAny::create())
, m_timer(this, &IDBRequest::timerFired)
, m_aborted(false)
- , m_readyState(INITIAL)
+ , m_readyState(LOADING)
{
}
IDBRequest::~IDBRequest()
{
- if (m_readyState != DONE)
- abort();
+ abort();
+}
+
+bool IDBRequest::resetReadyState()
+{
+ if (m_aborted)
+ return false;
+ ASSERT(m_readyState == DONE);
+ m_readyState = LOADING;
+ return true;
}
void IDBRequest::onError(PassRefPtr<IDBDatabaseError> error)
{
- onEventCommon();
- m_error = error;
+ scheduleEvent(0, error);
}
void IDBRequest::onSuccess()
{
- onEventCommon();
- m_result->set();
+ scheduleEvent(IDBAny::createNull(), 0);
}
void IDBRequest::onSuccess(PassRefPtr<IDBCursorBackendInterface> backend)
{
- onEventCommon();
- m_result->set(IDBCursor::create(backend));
+ scheduleEvent(IDBAny::create(IDBCursor::create(backend, this)), 0);
}
void IDBRequest::onSuccess(PassRefPtr<IDBDatabaseBackendInterface> backend)
{
- onEventCommon();
- m_result->set(IDBDatabase::create(backend));
+ scheduleEvent(IDBAny::create(IDBDatabase::create(backend)), 0);
}
void IDBRequest::onSuccess(PassRefPtr<IDBIndexBackendInterface> backend)
{
- onEventCommon();
- m_result->set(IDBIndex::create(backend));
+ scheduleEvent(IDBAny::create(IDBIndex::create(backend)), 0);
}
void IDBRequest::onSuccess(PassRefPtr<IDBKey> idbKey)
{
- onEventCommon();
- m_result->set(idbKey);
+ scheduleEvent(IDBAny::create(idbKey), 0);
}
void IDBRequest::onSuccess(PassRefPtr<IDBObjectStoreBackendInterface> backend)
{
- onEventCommon();
- m_result->set(IDBObjectStore::create(backend));
+ scheduleEvent(IDBAny::create(IDBObjectStore::create(backend)), 0);
}
void IDBRequest::onSuccess(PassRefPtr<SerializedScriptValue> serializedScriptValue)
{
- onEventCommon();
- m_result->set(serializedScriptValue);
+ scheduleEvent(IDBAny::create(serializedScriptValue), 0);
}
void IDBRequest::abort()
{
m_timer.stop();
m_aborted = true;
+ m_pendingEvents.clear();
+
// FIXME: This should cancel any pending work being done in the backend.
}
@@ -140,38 +141,47 @@ EventTargetData* IDBRequest::ensureEventTargetData()
void IDBRequest::timerFired(Timer<IDBRequest>*)
{
- ASSERT(m_readyState == DONE);
ASSERT(m_selfRef);
ASSERT(!m_aborted);
+ ASSERT(m_pendingEvents.size());
// We need to keep self-referencing ourself, otherwise it's possible we'll be deleted.
// But in some cases, suspend() could be called while we're dispatching an event, so we
// need to make sure that resume() doesn't re-start the timer based on m_selfRef being set.
RefPtr<IDBRequest> selfRef = m_selfRef.release();
- if (m_error) {
- ASSERT(m_result->type() == IDBAny::UndefinedType);
- dispatchEvent(IDBErrorEvent::create(m_source, *m_error));
- } else {
- ASSERT(m_result->type() != IDBAny::UndefinedType);
- dispatchEvent(IDBSuccessEvent::create(m_source, m_result));
+ Vector<PendingEvent> pendingEvents;
+ pendingEvents.swap(m_pendingEvents);
+ for (size_t i = 0; i < pendingEvents.size(); ++i) {
+ PendingEvent pendingEvent = pendingEvents[i];
+ if (pendingEvent.m_error) {
+ ASSERT(!pendingEvent.m_result);
+ dispatchEvent(IDBErrorEvent::create(m_source, *pendingEvent.m_error));
+ } else {
+ ASSERT(pendingEvent.m_result->type() != IDBAny::UndefinedType);
+ dispatchEvent(IDBSuccessEvent::create(m_source, pendingEvent.m_result));
+ }
}
}
-void IDBRequest::onEventCommon()
+void IDBRequest::scheduleEvent(PassRefPtr<IDBAny> result, PassRefPtr<IDBDatabaseError> error)
{
ASSERT(m_readyState < DONE);
- ASSERT(m_result->type() == IDBAny::UndefinedType);
- ASSERT(!m_error);
- ASSERT(!m_selfRef);
- ASSERT(!m_timer.isActive());
+ ASSERT(!!m_selfRef == m_timer.isActive());
if (m_aborted)
return;
+ PendingEvent pendingEvent;
+ pendingEvent.m_result = result;
+ pendingEvent.m_error = error;
+ m_pendingEvents.append(pendingEvent);
+
m_readyState = DONE;
- m_selfRef = this;
- m_timer.startOneShot(0);
+ if (!m_timer.isActive()) {
+ m_selfRef = this;
+ m_timer.startOneShot(0);
+ }
}
} // namespace WebCore
diff --git a/WebCore/storage/IDBRequest.h b/WebCore/storage/IDBRequest.h
index ddfdcf3..9b0ea7e 100644
--- a/WebCore/storage/IDBRequest.h
+++ b/WebCore/storage/IDBRequest.h
@@ -38,6 +38,7 @@
#include "IDBAny.h"
#include "IDBCallbacks.h"
#include "Timer.h"
+#include <wtf/Vector.h>
namespace WebCore {
@@ -49,16 +50,15 @@ public:
// Defined in the IDL
void abort();
enum ReadyState {
- INITIAL = 0,
LOADING = 1,
DONE = 2
};
unsigned short readyState() const { return m_readyState; }
- PassRefPtr<IDBDatabaseError> error() const { return m_error; }
- PassRefPtr<IDBAny> result() { return m_result; }
DEFINE_ATTRIBUTE_EVENT_LISTENER(success);
DEFINE_ATTRIBUTE_EVENT_LISTENER(error);
+ bool resetReadyState();
+
// IDBCallbacks
virtual void onError(PassRefPtr<IDBDatabaseError>);
virtual void onSuccess(); // For "null".
@@ -83,7 +83,7 @@ private:
IDBRequest(ScriptExecutionContext*, PassRefPtr<IDBAny> source);
void timerFired(Timer<IDBRequest>*);
- void onEventCommon();
+ void scheduleEvent(PassRefPtr<IDBAny> result, PassRefPtr<IDBDatabaseError>);
// EventTarget
virtual void refEventTarget() { ref(); }
@@ -93,8 +93,11 @@ private:
RefPtr<IDBAny> m_source;
- RefPtr<IDBAny> m_result;
- RefPtr<IDBDatabaseError> m_error;
+ struct PendingEvent {
+ RefPtr<IDBAny> m_result;
+ RefPtr<IDBDatabaseError> m_error;
+ };
+ Vector<PendingEvent> m_pendingEvents;
// Used to fire events asynchronously.
Timer<IDBRequest> m_timer;
diff --git a/WebCore/storage/IDBRequest.idl b/WebCore/storage/IDBRequest.idl
index 9d7e0e4..3036b6b 100644
--- a/WebCore/storage/IDBRequest.idl
+++ b/WebCore/storage/IDBRequest.idl
@@ -35,15 +35,10 @@ module storage {
void abort();
// States
- const unsigned short INITIAL = 0;
const unsigned short LOADING = 1;
const unsigned short DONE = 2;
readonly attribute unsigned short readyState;
- // Possible results
- readonly attribute IDBDatabaseError error;
- readonly attribute IDBAny result;
-
// Events
attribute EventListener onsuccess;
attribute EventListener onerror;
diff --git a/WebKit/chromium/ChangeLog b/WebKit/chromium/ChangeLog
index a70f473..9e00302 100644
--- a/WebKit/chromium/ChangeLog
+++ b/WebKit/chromium/ChangeLog
@@ -1,3 +1,14 @@
+2010-08-31 Jeremy Orlow <jorlow at chromium.org>
+
+ Reviewed by Steve Block.
+
+ IDBCursor.continue() should reuse the .openCursor's IDBRequest object
+ https://bugs.webkit.org/show_bug.cgi?id=44953
+
+ * src/WebIDBCallbacksImpl.cpp:
+ (WebCore::WebIDBCallbacksImpl::onError):
+ (WebCore::WebIDBCallbacksImpl::onSuccess):
+
2010-09-02 Yury Semikhatsky <yurys at chromium.org>
Reviewed by Pavel Feldman.
diff --git a/WebKit/chromium/src/WebIDBCallbacksImpl.cpp b/WebKit/chromium/src/WebIDBCallbacksImpl.cpp
index e543123..fe67789 100644
--- a/WebKit/chromium/src/WebIDBCallbacksImpl.cpp
+++ b/WebKit/chromium/src/WebIDBCallbacksImpl.cpp
@@ -57,49 +57,41 @@ WebIDBCallbacksImpl::~WebIDBCallbacksImpl()
void WebIDBCallbacksImpl::onError(const WebKit::WebIDBDatabaseError& error)
{
m_callbacks->onError(error);
- m_callbacks.clear();
}
void WebIDBCallbacksImpl::onSuccess()
{
m_callbacks->onSuccess();
- m_callbacks.clear();
}
void WebIDBCallbacksImpl::onSuccess(WebKit::WebIDBCursor* cursor)
{
m_callbacks->onSuccess(IDBCursorBackendProxy::create(cursor));
- m_callbacks.clear();
}
void WebIDBCallbacksImpl::onSuccess(WebKit::WebIDBDatabase* webKitInstance)
{
m_callbacks->onSuccess(IDBDatabaseProxy::create(webKitInstance));
- m_callbacks.clear();
}
void WebIDBCallbacksImpl::onSuccess(const WebKit::WebIDBKey& key)
{
m_callbacks->onSuccess(key);
- m_callbacks.clear();
}
void WebIDBCallbacksImpl::onSuccess(WebKit::WebIDBIndex* webKitInstance)
{
m_callbacks->onSuccess(IDBIndexBackendProxy::create(webKitInstance));
- m_callbacks.clear();
}
void WebIDBCallbacksImpl::onSuccess(WebKit::WebIDBObjectStore* webKitInstance)
{
m_callbacks->onSuccess(IDBObjectStoreProxy::create(webKitInstance));
- m_callbacks.clear();
}
void WebIDBCallbacksImpl::onSuccess(const WebKit::WebSerializedScriptValue& serializedScriptValue)
{
m_callbacks->onSuccess(serializedScriptValue);
- m_callbacks.clear();
}
} // namespace WebCore
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list