Changeset 125730 in webkit
- Timestamp:
- Aug 15, 2012, 5:57:53 PM (14 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 9 edited
-
ChangeLog (modified) (1 diff)
-
Modules/indexeddb/IDBAny.cpp (modified) (2 diffs)
-
Modules/indexeddb/IDBAny.h (modified) (3 diffs)
-
Modules/indexeddb/IDBIndex.h (modified) (1 diff)
-
Modules/indexeddb/IDBIndex.idl (modified) (1 diff)
-
Modules/indexeddb/IDBKeyPath.cpp (modified) (1 diff)
-
Modules/indexeddb/IDBKeyPath.h (modified) (2 diffs)
-
Modules/indexeddb/IDBObjectStore.h (modified) (1 diff)
-
Modules/indexeddb/IDBObjectStore.idl (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r125729 r125730 1 2012-08-15 Alec Flett <alecflett@chromium.org> 2 3 IndexedDB: IDB*::keyPath should return IDBKeyPath, not IDBAny 4 https://bugs.webkit.org/show_bug.cgi?id=92434 5 6 Reviewed by Tony Chang. 7 8 Clean up IDBKeyPath conversion to IDBAny objects. This gets rid of 9 some implicit conversion from IDBKeyPath to IDBAny. 10 11 No new tests, just changing method signatures. 12 13 * Modules/indexeddb/IDBAny.cpp: 14 (WebCore::IDBAny::set): 15 (WebCore): 16 * Modules/indexeddb/IDBAny.h: 17 (WebCore): 18 (WebCore::IDBAny::create): 19 (IDBAny): 20 * Modules/indexeddb/IDBIndex.h: 21 (WebCore::IDBIndex::keyPathAny): 22 (WebCore::IDBIndex::keyPath): 23 * Modules/indexeddb/IDBIndex.idl: 24 * Modules/indexeddb/IDBKeyPath.cpp: 25 * Modules/indexeddb/IDBKeyPath.h: 26 * Modules/indexeddb/IDBObjectStore.h: 27 (WebCore::IDBObjectStore::keyPathAny): 28 (WebCore::IDBObjectStore::keyPath): 29 * Modules/indexeddb/IDBObjectStore.idl: 30 1 31 2012-08-15 Ryosuke Niwa <rniwa@webkit.org> 2 32 -
trunk/Source/WebCore/Modules/indexeddb/IDBAny.cpp
r117817 r125730 33 33 #include "IDBFactory.h" 34 34 #include "IDBIndex.h" 35 #include "IDBKeyPath.h" 35 36 #include "IDBObjectStore.h" 36 37 #include "SerializedScriptValue.h" … … 208 209 } 209 210 211 void IDBAny::set(const IDBKeyPath& value) 212 { 213 ASSERT(m_type == UndefinedType); 214 switch (value.type()) { 215 case IDBKeyPath::NullType: 216 m_type = NullType; 217 break; 218 case IDBKeyPath::StringType: 219 m_type = StringType; 220 m_string = value.string(); 221 break; 222 case IDBKeyPath::ArrayType: 223 RefPtr<DOMStringList> keyPaths = DOMStringList::create(); 224 for (Vector<String>::const_iterator it = value.array().begin(); it != value.array().end(); ++it) 225 keyPaths->append(*it); 226 m_type = DOMStringListType; 227 m_domStringList = keyPaths.release(); 228 break; 229 } 230 } 231 210 232 void IDBAny::set(const String& value) 211 233 { -
trunk/Source/WebCore/Modules/indexeddb/IDBAny.h
r117817 r125730 43 43 class IDBIndex; 44 44 class IDBKey; 45 class IDBKeyPath; 45 46 class IDBObjectStore; 46 47 class IDBTransaction; … … 57 58 RefPtr<IDBAny> any = IDBAny::createInvalid(); 58 59 any->set(idbObject); 60 return any.release(); 61 } 62 static PassRefPtr<IDBAny> create(const IDBKeyPath& keyPath) 63 { 64 RefPtr<IDBAny> any = IDBAny::createInvalid(); 65 any->set(keyPath); 59 66 return any.release(); 60 67 } … … 110 117 void set(PassRefPtr<IDBTransaction>); 111 118 void set(PassRefPtr<SerializedScriptValue>); 119 void set(const IDBKeyPath&); 112 120 void set(const String&); 113 121 -
trunk/Source/WebCore/Modules/indexeddb/IDBIndex.h
r121059 r125730 54 54 const String name() const { return m_metadata.name; } 55 55 PassRefPtr<IDBObjectStore> objectStore() const { return m_objectStore; } 56 PassRefPtr<IDBAny> keyPath() const { return m_metadata.keyPath; } 56 PassRefPtr<IDBAny> keyPathAny() const { return IDBAny::create(m_metadata.keyPath); } 57 const IDBKeyPath keyPath() const { return m_metadata.keyPath; } 57 58 bool unique() const { return m_metadata.unique; } 58 59 bool multiEntry() const { return m_metadata.multiEntry; } -
trunk/Source/WebCore/Modules/indexeddb/IDBIndex.idl
r121714 r125730 31 31 readonly attribute DOMString name; 32 32 readonly attribute IDBObjectStore objectStore; 33 readonly attribute IDBAny keyPath;33 readonly attribute [ImplementedAs=keyPathAny] IDBAny keyPath; 34 34 readonly attribute boolean unique; 35 35 readonly attribute boolean multiEntry; -
trunk/Source/WebCore/Modules/indexeddb/IDBKeyPath.cpp
r123843 r125730 220 220 } 221 221 222 IDBKeyPath::operator PassRefPtr<IDBAny>() const223 {224 switch (m_type) {225 case NullType:226 return IDBAny::createNull();227 case StringType:228 return IDBAny::createString(m_string);229 case ArrayType:230 RefPtr<DOMStringList> keyPaths = DOMStringList::create();231 for (Vector<String>::const_iterator it = m_array.begin(); it != m_array.end(); ++it)232 keyPaths->append(*it);233 return IDBAny::create(static_cast<PassRefPtr<DOMStringList> >(keyPaths));234 }235 ASSERT_NOT_REACHED();236 return 0;237 }238 239 bool IDBKeyPath::operator==(PassRefPtr<IDBAny> other) const240 {241 if (!isValid())242 return false;243 244 switch (m_type) {245 case NullType:246 return other->type() == IDBAny::NullType;247 case StringType:248 return other->type() == IDBAny::StringType && other->string() == string();249 case ArrayType:250 if (other->type() != IDBAny::DOMStringListType)251 return false;252 253 RefPtr<DOMStringList> otherList = other->domStringList();254 for (size_t i = 0; i < m_array.size(); ++i) {255 if (otherList->item(i) != m_array[i])256 return false;257 }258 return true;259 }260 ASSERT_NOT_REACHED();261 return false;262 }263 264 222 bool IDBKeyPath::operator==(const IDBKeyPath& other) const 265 223 { -
trunk/Source/WebCore/Modules/indexeddb/IDBKeyPath.h
r123843 r125730 29 29 #if ENABLE(INDEXED_DATABASE) 30 30 31 #include "IDBAny.h"32 31 #include "PlatformString.h" 33 32 #include <wtf/Vector.h> … … 72 71 bool isNull() const { return m_type == NullType; } 73 72 bool isValid() const; 74 operator PassRefPtr<IDBAny>() const;75 bool operator==(PassRefPtr<IDBAny> other) const;76 73 bool operator==(const IDBKeyPath& other) const; 77 74 -
trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.h
r125728 r125730 59 59 // Implement the IDBObjectStore IDL 60 60 const String name() const { return m_metadata.name; } 61 PassRefPtr<IDBAny> keyPath() const { return m_metadata.keyPath; } 61 PassRefPtr<IDBAny> keyPathAny() const { return IDBAny::create(m_metadata.keyPath); } 62 const IDBKeyPath keyPath() const { return m_metadata.keyPath; } 62 63 PassRefPtr<DOMStringList> indexNames() const; 63 64 PassRefPtr<IDBTransaction> transaction() const { return m_transaction; } -
trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.idl
r125728 r125730 30 30 ] IDBObjectStore { 31 31 readonly attribute [TreatReturnedNullStringAs=Null] DOMString name; 32 readonly attribute IDBAny keyPath;32 readonly attribute [ImplementedAs=keyPathAny] IDBAny keyPath; 33 33 readonly attribute DOMStringList indexNames; 34 34 readonly attribute IDBTransaction transaction;
Note:
See TracChangeset
for help on using the changeset viewer.