Modified: trunk/Source/WebCore/Modules/indexeddb/IDBRequest.h (190579 => 190580)
--- trunk/Source/WebCore/Modules/indexeddb/IDBRequest.h 2015-10-05 21:21:18 UTC (rev 190579)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBRequest.h 2015-10-05 21:29:13 UTC (rev 190580)
@@ -44,6 +44,13 @@
typedef int ExceptionCode;
+// Defined in the IDL
+enum class IDBRequestReadyState {
+ Pending = 1,
+ Done = 2,
+ DeprecatedEarlyDeath = 3, // FIXME: https://bugs.webkit.org/show_bug.cgi?id=149117 - Remove this when removing LegacyIDB
+};
+
class IDBRequest : public ScriptWrappable, public EventTargetWithInlineData, public ActiveDOMObject {
public:
virtual ~IDBRequest() { }
@@ -54,13 +61,6 @@
virtual RefPtr<IDBAny> source() const = 0;
virtual RefPtr<IDBTransaction> transaction() const = 0;
- // Defined in the IDL
- enum ReadyState {
- PENDING = 1,
- DONE = 2,
- EarlyDeath = 3
- };
-
virtual const String& readyState() const = 0;
protected:
Modified: trunk/Source/WebCore/Modules/indexeddb/legacy/LegacyRequest.cpp (190579 => 190580)
--- trunk/Source/WebCore/Modules/indexeddb/legacy/LegacyRequest.cpp 2015-10-05 21:21:18 UTC (rev 190579)
+++ trunk/Source/WebCore/Modules/indexeddb/legacy/LegacyRequest.cpp 2015-10-05 21:29:13 UTC (rev 190580)
@@ -76,7 +76,7 @@
, m_errorCode(0)
, m_contextStopped(false)
, m_transaction(transaction)
- , m_readyState(PENDING)
+ , m_readyState(IDBRequestReadyState::Pending)
, m_requestAborted(false)
, m_source(source)
, m_taskType(taskType)
@@ -97,7 +97,7 @@
RefPtr<IDBAny> LegacyRequest::result(ExceptionCode& ec) const
{
- if (m_readyState != DONE) {
+ if (m_readyState != IDBRequestReadyState::Done) {
ec = IDBDatabaseException::InvalidStateError;
return 0;
}
@@ -106,7 +106,7 @@
RefPtr<DOMError> LegacyRequest::error(ExceptionCode& ec) const
{
- if (m_readyState != DONE) {
+ if (m_readyState != IDBRequestReadyState::Done) {
ec = IDBDatabaseException::InvalidStateError;
return 0;
}
@@ -115,7 +115,7 @@
unsigned short LegacyRequest::errorCode(ExceptionCode& ec) const
{
- if (m_readyState != DONE) {
+ if (m_readyState != IDBRequestReadyState::Done) {
ec = IDBDatabaseException::InvalidStateError;
return 0;
}
@@ -134,11 +134,11 @@
const String& LegacyRequest::readyState() const
{
- ASSERT(m_readyState == PENDING || m_readyState == DONE);
+ ASSERT(m_readyState == IDBRequestReadyState::Pending || m_readyState == IDBRequestReadyState::Done);
DEPRECATED_DEFINE_STATIC_LOCAL(AtomicString, pending, ("pending", AtomicString::ConstructFromLiteral));
DEPRECATED_DEFINE_STATIC_LOCAL(AtomicString, done, ("done", AtomicString::ConstructFromLiteral));
- if (m_readyState == PENDING)
+ if (m_readyState == IDBRequestReadyState::Pending)
return pending;
return done;
@@ -146,8 +146,8 @@
void LegacyRequest::markEarlyDeath()
{
- ASSERT(m_readyState == PENDING);
- m_readyState = EarlyDeath;
+ ASSERT(m_readyState == IDBRequestReadyState::Pending);
+ m_readyState = IDBRequestReadyState::DeprecatedEarlyDeath;
if (m_transaction)
m_transaction->unregisterRequest(this);
}
@@ -157,8 +157,8 @@
ASSERT(!m_requestAborted);
if (m_contextStopped || !scriptExecutionContext())
return;
- ASSERT(m_readyState == PENDING || m_readyState == DONE);
- if (m_readyState == DONE)
+ ASSERT(m_readyState == IDBRequestReadyState::Pending || m_readyState == IDBRequestReadyState::Done);
+ if (m_readyState == IDBRequestReadyState::Done)
return;
// Enqueued events may be the only reference to this object.
@@ -181,7 +181,7 @@
void LegacyRequest::setCursorDetails(IndexedDB::CursorType cursorType, IndexedDB::CursorDirection direction)
{
- ASSERT(m_readyState == PENDING);
+ ASSERT(m_readyState == IDBRequestReadyState::Pending);
ASSERT(!m_pendingCursor);
m_cursorType = cursorType;
m_cursorDirection = direction;
@@ -189,7 +189,7 @@
void LegacyRequest::setPendingCursor(PassRefPtr<LegacyCursor> cursor)
{
- ASSERT(m_readyState == DONE);
+ ASSERT(m_readyState == IDBRequestReadyState::Done);
ASSERT(scriptExecutionContext());
ASSERT(m_transaction);
ASSERT(!m_pendingCursor);
@@ -197,7 +197,7 @@
m_pendingCursor = cursor;
m_result = nullptr;
- m_readyState = PENDING;
+ m_readyState = IDBRequestReadyState::Pending;
m_errorCode = 0;
m_error = nullptr;
m_errorMessage = String();
@@ -217,7 +217,7 @@
void LegacyRequest::setResultCursor(PassRefPtr<LegacyCursor> cursor, PassRefPtr<IDBKey> key, PassRefPtr<IDBKey> primaryKey, const Deprecated::ScriptValue& value)
{
- ASSERT(m_readyState == PENDING);
+ ASSERT(m_readyState == IDBRequestReadyState::Pending);
m_cursorKey = key;
m_cursorPrimaryKey = primaryKey;
m_cursorValue = value;
@@ -233,7 +233,7 @@
void LegacyRequest::finishCursor()
{
m_cursorFinished = true;
- if (m_readyState != PENDING)
+ if (m_readyState != IDBRequestReadyState::Pending)
m_hasPendingActivity = false;
}
@@ -241,10 +241,10 @@
{
if (m_contextStopped || !scriptExecutionContext())
return false;
- ASSERT(m_readyState == PENDING || m_readyState == DONE);
+ ASSERT(m_readyState == IDBRequestReadyState::Pending || m_readyState == IDBRequestReadyState::Done);
if (m_requestAborted)
return false;
- ASSERT(m_readyState == PENDING);
+ ASSERT(m_readyState == IDBRequestReadyState::Pending);
ASSERT(!m_errorCode && m_errorMessage.isNull() && !m_error && !m_result);
return true;
}
@@ -447,7 +447,7 @@
m_contextStopped = true;
m_requestState.clear();
- if (m_readyState == PENDING)
+ if (m_readyState == IDBRequestReadyState::Pending)
markEarlyDeath();
}
@@ -469,18 +469,18 @@
bool LegacyRequest::dispatchEvent(PassRefPtr<Event> event)
{
LOG(StorageAPI, "LegacyRequest::dispatchEvent");
- ASSERT(m_readyState == PENDING);
+ ASSERT(m_readyState == IDBRequestReadyState::Pending);
ASSERT(!m_contextStopped);
ASSERT(m_hasPendingActivity);
ASSERT(m_enqueuedEvents.size());
ASSERT(scriptExecutionContext());
ASSERT(event->target() == this);
- ASSERT_WITH_MESSAGE(m_readyState < DONE, "When dispatching event %s, m_readyState < DONE(%d), was %d", event->type().string().utf8().data(), DONE, m_readyState);
+ ASSERT_WITH_MESSAGE(m_readyState < IDBRequestReadyState::Done, "When dispatching event %s, m_readyState < DONE(%d), was %d", event->type().string().utf8().data(), IDBRequestReadyState::Done, m_readyState);
DOMRequestState::Scope scope(m_requestState);
if (event->type() != eventNames().blockedEvent)
- m_readyState = DONE;
+ m_readyState = IDBRequestReadyState::Done;
for (size_t i = 0; i < m_enqueuedEvents.size(); ++i) {
if (m_enqueuedEvents[i].get() == event.get())
@@ -523,7 +523,7 @@
bool dontPreventDefault = IDBEventDispatcher::dispatch(event.get(), targets);
if (m_transaction) {
- if (m_readyState == DONE)
+ if (m_readyState == IDBRequestReadyState::Done)
m_transaction->unregisterRequest(this);
// Possibly abort the transaction. This must occur after unregistering (so this request
@@ -541,7 +541,7 @@
if (cursorToNotify)
cursorToNotify->postSuccessHandlerCallback();
- if (m_readyState == DONE && (!cursorToNotify || m_cursorFinished) && event->type() != eventNames().upgradeneededEvent)
+ if (m_readyState == IDBRequestReadyState::Done && (!cursorToNotify || m_cursorFinished) && event->type() != eventNames().upgradeneededEvent)
m_hasPendingActivity = false;
return dontPreventDefault;
@@ -559,20 +559,20 @@
{
ASSERT(m_transaction);
ASSERT(m_transaction->isVersionChange());
- ASSERT(m_readyState == DONE);
+ ASSERT(m_readyState == IDBRequestReadyState::Done);
ASSERT(scriptExecutionContext());
m_transaction = nullptr;
- m_readyState = PENDING;
+ m_readyState = IDBRequestReadyState::Pending;
}
void LegacyRequest::enqueueEvent(PassRefPtr<Event> event)
{
- ASSERT(m_readyState == PENDING || m_readyState == DONE);
+ ASSERT(m_readyState == IDBRequestReadyState::Pending || m_readyState == IDBRequestReadyState::Done);
if (m_contextStopped || !scriptExecutionContext())
return;
- ASSERT_WITH_MESSAGE(m_readyState == PENDING || m_didFireUpgradeNeededEvent, "When queueing event %s, m_readyState was %d", event->type().string().utf8().data(), m_readyState);
+ ASSERT_WITH_MESSAGE(m_readyState == IDBRequestReadyState::Pending || m_didFireUpgradeNeededEvent, "When queueing event %s, m_readyState was %d", event->type().string().utf8().data(), m_readyState);
event->setTarget(this);