Index: third_party/WebKit/Source/modules/indexeddb/IDBCursor.cpp |
diff --git a/third_party/WebKit/Source/modules/indexeddb/IDBCursor.cpp b/third_party/WebKit/Source/modules/indexeddb/IDBCursor.cpp |
index c168f0a2ff7fe983074cb31fdf4c940e3dbd2c44..9df92a0c2c368d0d441033e84c270de1c112c312 100644 |
--- a/third_party/WebKit/Source/modules/indexeddb/IDBCursor.cpp |
+++ b/third_party/WebKit/Source/modules/indexeddb/IDBCursor.cpp |
@@ -34,27 +34,26 @@ |
#include "core/dom/ExceptionCode.h" |
#include "modules/IndexedDBNames.h" |
#include "modules/indexeddb/IDBAny.h" |
+#include "modules/indexeddb/IDBCursorProxy.h" |
#include "modules/indexeddb/IDBDatabase.h" |
+#include "modules/indexeddb/IDBDatabaseProxy.h" |
#include "modules/indexeddb/IDBObjectStore.h" |
#include "modules/indexeddb/IDBTracing.h" |
#include "modules/indexeddb/IDBTransaction.h" |
-#include "modules/indexeddb/WebIDBCallbacksImpl.h" |
-#include "public/platform/modules/indexeddb/WebIDBDatabase.h" |
#include "public/platform/modules/indexeddb/WebIDBKeyRange.h" |
#include <limits> |
#include <memory> |
-using blink::WebIDBCursor; |
-using blink::WebIDBDatabase; |
- |
namespace blink { |
-IDBCursor* IDBCursor::create(std::unique_ptr<WebIDBCursor> backend, WebIDBCursorDirection direction, IDBRequest* request, IDBAny* source, IDBTransaction* transaction) |
+using indexed_db::mojom::blink::CursorDirection; |
+ |
+IDBCursor* IDBCursor::create(std::unique_ptr<IDBCursorProxy> backend, CursorDirection direction, IDBRequest* request, IDBAny* source, IDBTransaction* transaction) |
{ |
return new IDBCursor(std::move(backend), direction, request, source, transaction); |
} |
-IDBCursor::IDBCursor(std::unique_ptr<WebIDBCursor> backend, WebIDBCursorDirection direction, IDBRequest* request, IDBAny* source, IDBTransaction* transaction) |
+IDBCursor::IDBCursor(std::unique_ptr<IDBCursorProxy> backend, CursorDirection direction, IDBRequest* request, IDBAny* source, IDBTransaction* transaction) |
: m_backend(std::move(backend)) |
, m_request(request) |
, m_direction(direction) |
@@ -120,7 +119,7 @@ IDBRequest* IDBCursor::update(ScriptState* scriptState, const ScriptValue& value |
} |
IDBObjectStore* objectStore = effectiveObjectStore(); |
- return objectStore->put(scriptState, WebIDBPutModeCursorUpdate, IDBAny::create(this), value, m_primaryKey, exceptionState); |
+ return objectStore->put(scriptState, indexed_db::mojom::blink::PutMode::CursorUpdate, IDBAny::create(this), value, m_primaryKey, exceptionState); |
} |
void IDBCursor::advance(unsigned count, ExceptionState& exceptionState) |
@@ -149,7 +148,7 @@ void IDBCursor::advance(unsigned count, ExceptionState& exceptionState) |
m_request->setPendingCursor(this); |
m_gotValue = false; |
- m_backend->advance(count, WebIDBCallbacksImpl::create(m_request).release()); |
+ m_backend->Advance(count); |
} |
void IDBCursor::continueFunction(ScriptState* scriptState, const ScriptValue& keyValue, ExceptionState& exceptionState) |
@@ -172,7 +171,7 @@ void IDBCursor::continuePrimaryKey(ScriptState* scriptState, const ScriptValue& |
exceptionState.throwDOMException(InvalidAccessError, "The cursor's source is not an index."); |
return; |
} |
- if (m_direction != WebIDBCursorDirectionNext && m_direction != WebIDBCursorDirectionPrev) { |
+ if (m_direction != CursorDirection::Next && m_direction != CursorDirection::Prev) { |
exceptionState.throwDOMException(InvalidAccessError, "The cursor's direction is not 'next' or 'prev'."); |
return; |
} |
@@ -221,7 +220,7 @@ void IDBCursor::continueFunction(IDBKey* key, IDBKey* primaryKey, ExceptionState |
if (key) { |
ASSERT(m_key); |
- if (m_direction == WebIDBCursorDirectionNext || m_direction == WebIDBCursorDirectionNextNoDuplicate) { |
+ if (m_direction == CursorDirection::Next || m_direction == CursorDirection::NextNoDuplicate) { |
const bool ok = m_key->isLessThan(key) |
|| (primaryKey && m_key->isEqual(key) && m_primaryKey->isLessThan(primaryKey)); |
if (!ok) { |
@@ -243,7 +242,7 @@ void IDBCursor::continueFunction(IDBKey* key, IDBKey* primaryKey, ExceptionState |
// will be on the original context openCursor was called on. Is this right? |
m_request->setPendingCursor(this); |
m_gotValue = false; |
- m_backend->continueFunction(key, primaryKey, WebIDBCallbacksImpl::create(m_request).release()); |
+ m_backend->ContinueFunction(key, primaryKey); |
} |
IDBRequest* IDBCursor::deleteFunction(ScriptState* scriptState, ExceptionState& exceptionState) |
@@ -283,14 +282,14 @@ IDBRequest* IDBCursor::deleteFunction(ScriptState* scriptState, ExceptionState& |
ASSERT(!exceptionState.hadException()); |
IDBRequest* request = IDBRequest::create(scriptState, IDBAny::create(this), m_transaction.get()); |
- m_transaction->backendDB()->deleteRange(m_transaction->id(), effectiveObjectStore()->id(), keyRange, WebIDBCallbacksImpl::create(request).release()); |
+ m_transaction->backendDB()->DeleteRange(m_transaction->id(), effectiveObjectStore()->id(), keyRange); |
return request; |
} |
void IDBCursor::postSuccessHandlerCallback() |
{ |
if (m_backend) |
- m_backend->postSuccessHandlerCallback(); |
+ m_backend->PostSuccessHandlerCallback(); |
} |
void IDBCursor::close() |
@@ -371,34 +370,34 @@ bool IDBCursor::isDeleted() const |
return m_source->idbIndex()->isDeleted(); |
} |
-WebIDBCursorDirection IDBCursor::stringToDirection(const String& directionString) |
+CursorDirection IDBCursor::stringToDirection(const String& directionString) |
{ |
if (directionString == IndexedDBNames::next) |
- return WebIDBCursorDirectionNext; |
+ return CursorDirection::Next; |
if (directionString == IndexedDBNames::nextunique) |
- return WebIDBCursorDirectionNextNoDuplicate; |
+ return CursorDirection::NextNoDuplicate; |
if (directionString == IndexedDBNames::prev) |
- return WebIDBCursorDirectionPrev; |
+ return CursorDirection::Prev; |
if (directionString == IndexedDBNames::prevunique) |
- return WebIDBCursorDirectionPrevNoDuplicate; |
+ return CursorDirection::PrevNoDuplicate; |
ASSERT_NOT_REACHED(); |
- return WebIDBCursorDirectionNext; |
+ return CursorDirection::Next; |
} |
const String& IDBCursor::direction() const |
{ |
switch (m_direction) { |
- case WebIDBCursorDirectionNext: |
+ case CursorDirection::Next: |
return IndexedDBNames::next; |
- case WebIDBCursorDirectionNextNoDuplicate: |
+ case CursorDirection::NextNoDuplicate: |
return IndexedDBNames::nextunique; |
- case WebIDBCursorDirectionPrev: |
+ case CursorDirection::Prev: |
return IndexedDBNames::prev; |
- case WebIDBCursorDirectionPrevNoDuplicate: |
+ case CursorDirection::PrevNoDuplicate: |
return IndexedDBNames::prevunique; |
default: |