summaryrefslogtreecommitdiffstats
path: root/WebCore/storage/IDBCallbacks.h
diff options
context:
space:
mode:
authorKristian Monsen <kristianm@google.com>2010-05-21 16:53:46 +0100
committerKristian Monsen <kristianm@google.com>2010-05-25 10:24:15 +0100
commit6c2af9490927c3c5959b5cb07461b646f8b32f6c (patch)
treef7111b9b22befab472616c1d50ec94eb50f1ec8c /WebCore/storage/IDBCallbacks.h
parenta149172322a9067c14e8b474a53e63649aa17cad (diff)
downloadexternal_webkit-6c2af9490927c3c5959b5cb07461b646f8b32f6c.zip
external_webkit-6c2af9490927c3c5959b5cb07461b646f8b32f6c.tar.gz
external_webkit-6c2af9490927c3c5959b5cb07461b646f8b32f6c.tar.bz2
Merge WebKit at r59636: Initial merge by git
Change-Id: I59b289c4e6b18425f06ce41cc9d34c522515de91
Diffstat (limited to 'WebCore/storage/IDBCallbacks.h')
-rw-r--r--WebCore/storage/IDBCallbacks.h64
1 files changed, 6 insertions, 58 deletions
diff --git a/WebCore/storage/IDBCallbacks.h b/WebCore/storage/IDBCallbacks.h
index ce0d20d..74c11d8 100644
--- a/WebCore/storage/IDBCallbacks.h
+++ b/WebCore/storage/IDBCallbacks.h
@@ -29,74 +29,22 @@
#ifndef IDBCallbacks_h
#define IDBCallbacks_h
-#include "ActiveDOMObject.h"
+#include "IDBDatabase.h"
#include "IDBDatabaseError.h"
-#include "Timer.h"
-#include <wtf/PassRefPtr.h>
+#include "SerializedScriptValue.h"
#include <wtf/RefCounted.h>
#if ENABLE(INDEXED_DATABASE)
namespace WebCore {
-// All IndexedDB callbacks must implement this class. It handles the asynchronous firing of
-// the callbacks.
-template <typename ResultType>
-class IDBCallbacks : public RefCounted<IDBCallbacks<ResultType> >, public ActiveDOMObject {
+class IDBCallbacks : public RefCounted<IDBCallbacks> {
public:
- IDBCallbacks(ScriptExecutionContext* scriptExecutionContext, void* upcastPointer)
- : ActiveDOMObject(scriptExecutionContext, upcastPointer)
- , m_timer(this, &IDBCallbacks::timerFired)
- {
- }
-
virtual ~IDBCallbacks() { }
- void onSuccess(PassRefPtr<ResultType> result)
- {
- ASSERT(!m_result);
- ASSERT(!m_error);
- m_result = result;
- ASSERT(m_result);
-
- ASSERT(!m_timer.isActive());
- m_selfRef = this;
- m_timer.startOneShot(0);
- }
-
- void onError(PassRefPtr<IDBDatabaseError> error)
- {
- ASSERT(!m_result);
- ASSERT(!m_error);
- m_error = error;
- ASSERT(m_error);
-
- ASSERT(!m_timer.isActive());
- m_selfRef = this;
- m_timer.startOneShot(0);
- }
-
-protected:
- virtual void onSuccessAsync(PassRefPtr<ResultType>) = 0;
- virtual void onErrorAsync(PassRefPtr<IDBDatabaseError>) = 0;
-
- void timerFired(Timer<IDBCallbacks>*)
- {
- if (m_result) {
- onSuccessAsync(m_result);
- m_result = 0;
- } else {
- onErrorAsync(m_error);
- m_error = 0;
- }
- m_selfRef = 0; // May trigger a delete immediately.
- }
-
-private:
- Timer<IDBCallbacks> m_timer;
- RefPtr<IDBCallbacks> m_selfRef;
- RefPtr<ResultType> m_result;
- RefPtr<IDBDatabaseError> m_error;
+ virtual void onError(PassRefPtr<IDBDatabaseError>) = 0;
+ virtual void onSuccess(PassRefPtr<IDBDatabase>) = 0;
+ virtual void onSuccess(PassRefPtr<SerializedScriptValue>) = 0;
};
} // namespace WebCore