Title: [134342] trunk/Source/WebCore
Revision
134342
Author
jsb...@chromium.org
Date
2012-11-12 19:09:31 -0800 (Mon, 12 Nov 2012)

Log Message

IndexedDB: Use sequence<> instead of DOMString[] in IDL
https://bugs.webkit.org/show_bug.cgi?id=100539

Reviewed by Adam Barth.

In the binding layer, DOMString[] is implemented as an alias for DOMStringList.
WebIDL usage is tending towards sequence<DOMString> anyway for inputs, so switch
to that. Note webkit.org/b/100537 which requires sequence<String> instead.

Covered by storage/indexeddb/transaction-basics.html and objectstore-basics.html

* Modules/indexeddb/IDBDatabase.cpp:
(WebCore::IDBDatabase::transaction): DOMStringList -> Vector<String>
* Modules/indexeddb/IDBDatabase.h:
(WebCore::IDBDatabase::transaction):
(IDBDatabase):
* Modules/indexeddb/IDBDatabase.idl: DOMString[] -> sequence<String>
* Modules/indexeddb/IDBObjectStore.cpp: Move trivial impls to header.
* Modules/indexeddb/IDBObjectStore.h:
(WebCore::IDBObjectStore::createIndex):
* Modules/indexeddb/IDBObjectStore.idl: DOMString[] -> sequence<String>

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (134341 => 134342)


--- trunk/Source/WebCore/ChangeLog	2012-11-13 02:48:40 UTC (rev 134341)
+++ trunk/Source/WebCore/ChangeLog	2012-11-13 03:09:31 UTC (rev 134342)
@@ -1,3 +1,27 @@
+2012-11-12  Joshua Bell  <jsb...@chromium.org>
+
+        IndexedDB: Use sequence<> instead of DOMString[] in IDL
+        https://bugs.webkit.org/show_bug.cgi?id=100539
+
+        Reviewed by Adam Barth.
+
+        In the binding layer, DOMString[] is implemented as an alias for DOMStringList.
+        WebIDL usage is tending towards sequence<DOMString> anyway for inputs, so switch
+        to that. Note webkit.org/b/100537 which requires sequence<String> instead.
+
+        Covered by storage/indexeddb/transaction-basics.html and objectstore-basics.html
+
+        * Modules/indexeddb/IDBDatabase.cpp:
+        (WebCore::IDBDatabase::transaction): DOMStringList -> Vector<String>
+        * Modules/indexeddb/IDBDatabase.h:
+        (WebCore::IDBDatabase::transaction):
+        (IDBDatabase):
+        * Modules/indexeddb/IDBDatabase.idl: DOMString[] -> sequence<String>
+        * Modules/indexeddb/IDBObjectStore.cpp: Move trivial impls to header.
+        * Modules/indexeddb/IDBObjectStore.h:
+        (WebCore::IDBObjectStore::createIndex):
+        * Modules/indexeddb/IDBObjectStore.idl: DOMString[] -> sequence<String>
+
 2012-11-12  Anders Carlsson  <ander...@apple.com>
 
         Remove Leopard only gradient code

Modified: trunk/Source/WebCore/Modules/indexeddb/IDBDatabase.cpp (134341 => 134342)


--- trunk/Source/WebCore/Modules/indexeddb/IDBDatabase.cpp	2012-11-13 02:48:40 UTC (rev 134341)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBDatabase.cpp	2012-11-13 03:09:31 UTC (rev 134342)
@@ -226,11 +226,9 @@
     return request;
 }
 
-PassRefPtr<IDBTransaction> IDBDatabase::transaction(ScriptExecutionContext* context, PassRefPtr<DOMStringList> prpStoreNames, const String& modeString, ExceptionCode& ec)
+PassRefPtr<IDBTransaction> IDBDatabase::transaction(ScriptExecutionContext* context, const Vector<String>& scope, const String& modeString, ExceptionCode& ec)
 {
-    RefPtr<DOMStringList> storeNames = prpStoreNames;
-    ASSERT(storeNames.get());
-    if (storeNames->isEmpty()) {
+    if (!scope.size()) {
         ec = IDBDatabaseException::IDB_INVALID_ACCESS_ERR;
         return 0;
     }
@@ -245,8 +243,8 @@
     }
 
     Vector<int64_t> objectStoreIds;
-    for (size_t i = 0; i < storeNames->length(); ++i) {
-        int64_t objectStoreId = findObjectStoreId(storeNames->item(i));
+    for (size_t i = 0; i < scope.size(); ++i) {
+        int64_t objectStoreId = findObjectStoreId(scope[i]);
         if (objectStoreId == IDBObjectStoreMetadata::InvalidId) {
             ec = IDBDatabaseException::IDB_NOT_FOUND_ERR;
             return 0;
@@ -263,7 +261,7 @@
         ASSERT(ec);
         return 0;
     }
-    RefPtr<IDBTransaction> transaction = IDBTransaction::create(context, transactionBackend, *storeNames, mode, this);
+    RefPtr<IDBTransaction> transaction = IDBTransaction::create(context, transactionBackend, scope, mode, this);
     transactionBackend->setCallbacks(transaction.get());
     return transaction.release();
 }

Modified: trunk/Source/WebCore/Modules/indexeddb/IDBDatabase.h (134341 => 134342)


--- trunk/Source/WebCore/Modules/indexeddb/IDBDatabase.h	2012-11-13 02:48:40 UTC (rev 134341)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBDatabase.h	2012-11-13 03:09:31 UTC (rev 134342)
@@ -64,7 +64,8 @@
     PassRefPtr<DOMStringList> objectStoreNames() const;
 
     PassRefPtr<IDBObjectStore> createObjectStore(const String& name, const Dictionary&, ExceptionCode&);
-    PassRefPtr<IDBTransaction> transaction(ScriptExecutionContext*, PassRefPtr<DOMStringList>, const String& mode, ExceptionCode&);
+    PassRefPtr<IDBTransaction> transaction(ScriptExecutionContext* context, PassRefPtr<DOMStringList> scope, const String& mode, ExceptionCode& ec) { return transaction(context, *scope, mode, ec); }
+    PassRefPtr<IDBTransaction> transaction(ScriptExecutionContext*, const Vector<String>&, const String& mode, ExceptionCode&);
     PassRefPtr<IDBTransaction> transaction(ScriptExecutionContext*, const String&, const String& mode, ExceptionCode&);
     void deleteObjectStore(const String& name, ExceptionCode&);
     PassRefPtr<IDBVersionChangeRequest> setVersion(ScriptExecutionContext*, const String& version, ExceptionCode&);

Modified: trunk/Source/WebCore/Modules/indexeddb/IDBDatabase.idl (134341 => 134342)


--- trunk/Source/WebCore/Modules/indexeddb/IDBDatabase.idl	2012-11-13 02:48:40 UTC (rev 134341)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBDatabase.idl	2012-11-13 03:09:31 UTC (rev 134342)
@@ -45,7 +45,7 @@
         raises (IDBDatabaseException);
     [CallWith=ScriptExecutionContext] IDBTransaction transaction(in DOMStringList storeNames, in [Optional=DefaultIsNullString] DOMString mode)
         raises (IDBDatabaseException);
-    [CallWith=ScriptExecutionContext] IDBTransaction transaction(in DOMString[] storeNames, in [Optional=DefaultIsNullString] DOMString mode)
+    [CallWith=ScriptExecutionContext] IDBTransaction transaction(in sequence<String> storeNames, in [Optional=DefaultIsNullString] DOMString mode)
         raises (IDBDatabaseException);
     [CallWith=ScriptExecutionContext] IDBTransaction transaction(in DOMString storeName, in [Optional=DefaultIsNullString] DOMString mode)
         raises (IDBDatabaseException);

Modified: trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp (134341 => 134342)


--- trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp	2012-11-13 02:48:40 UTC (rev 134341)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp	2012-11-13 03:09:31 UTC (rev 134342)
@@ -351,17 +351,6 @@
 };
 }
 
-PassRefPtr<IDBIndex> IDBObjectStore::createIndex(ScriptExecutionContext* context, const String& name, const String& keyPath, const Dictionary& options, ExceptionCode& ec)
-{
-    return createIndex(context, name, IDBKeyPath(keyPath), options, ec);
-}
-
-PassRefPtr<IDBIndex> IDBObjectStore::createIndex(ScriptExecutionContext* context, const String& name, PassRefPtr<DOMStringList> keyPath, const Dictionary& options, ExceptionCode& ec)
-{
-    return createIndex(context, name, IDBKeyPath(*keyPath), options, ec);
-}
-
-
 PassRefPtr<IDBIndex> IDBObjectStore::createIndex(ScriptExecutionContext* context, const String& name, const IDBKeyPath& keyPath, const Dictionary& options, ExceptionCode& ec)
 {
     IDB_TRACE("IDBObjectStore::createIndex");

Modified: trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.h (134341 => 134342)


--- trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.h	2012-11-13 02:48:40 UTC (rev 134341)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.h	2012-11-13 03:09:31 UTC (rev 134342)
@@ -82,8 +82,8 @@
     PassRefPtr<IDBRequest> deleteFunction(ScriptExecutionContext*, PassRefPtr<IDBKey> key, ExceptionCode&);
     PassRefPtr<IDBRequest> clear(ScriptExecutionContext*, ExceptionCode&);
 
-    PassRefPtr<IDBIndex> createIndex(ScriptExecutionContext*, const String& name, const String& keyPath, const Dictionary&, ExceptionCode&);
-    PassRefPtr<IDBIndex> createIndex(ScriptExecutionContext*, const String& name, PassRefPtr<DOMStringList> keyPath, const Dictionary&, ExceptionCode&);
+    PassRefPtr<IDBIndex> createIndex(ScriptExecutionContext* context, const String& name, const String& keyPath, const Dictionary& options, ExceptionCode& ec) { return createIndex(context, name, IDBKeyPath(keyPath), options, ec); }
+    PassRefPtr<IDBIndex> createIndex(ScriptExecutionContext* context, const String& name, const Vector<String>& keyPath, const Dictionary& options, ExceptionCode& ec) { return createIndex(context, name, IDBKeyPath(keyPath), options, ec); }
     PassRefPtr<IDBIndex> createIndex(ScriptExecutionContext*, const String&, const IDBKeyPath&, const Dictionary&, ExceptionCode&);
 
     PassRefPtr<IDBIndex> index(const String& name, ExceptionCode&);

Modified: trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.idl (134341 => 134342)


--- trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.idl	2012-11-13 02:48:40 UTC (rev 134341)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.idl	2012-11-13 03:09:31 UTC (rev 134342)
@@ -51,7 +51,7 @@
     [CallWith=ScriptExecutionContext] IDBRequest openCursor(in IDBKey key, in [Optional] DOMString direction)
         raises (IDBDatabaseException);
 
-    [CallWith=ScriptExecutionContext] IDBIndex createIndex(in DOMString name, in DOMString[] keyPath, in [Optional] Dictionary options)
+    [CallWith=ScriptExecutionContext] IDBIndex createIndex(in DOMString name, in sequence<String> keyPath, in [Optional] Dictionary options)
         raises (IDBDatabaseException);
     [CallWith=ScriptExecutionContext] IDBIndex createIndex(in DOMString name, in DOMString keyPath, in [Optional] Dictionary options)
         raises (IDBDatabaseException);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to