OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 12 matching lines...) Expand all Loading... |
23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
24 */ | 24 */ |
25 | 25 |
26 #include "config.h" | 26 #include "config.h" |
27 #include "modules/indexeddb/IDBObjectStore.h" | 27 #include "modules/indexeddb/IDBObjectStore.h" |
28 | 28 |
29 #include "bindings/core/v8/ExceptionState.h" | 29 #include "bindings/core/v8/ExceptionState.h" |
30 #include "bindings/core/v8/ExceptionStatePlaceholder.h" | 30 #include "bindings/core/v8/ExceptionStatePlaceholder.h" |
31 #include "bindings/core/v8/ScriptState.h" | 31 #include "bindings/core/v8/ScriptState.h" |
32 #include "bindings/core/v8/SerializedScriptValueFactory.h" | 32 #include "bindings/core/v8/SerializedScriptValueFactory.h" |
33 #include "bindings/modules/v8/IDBBindingUtilities.h" | 33 #include "bindings/modules/v8/ToV8ForModules.h" |
| 34 #include "bindings/modules/v8/V8BindingForModules.h" |
34 #include "core/dom/DOMStringList.h" | 35 #include "core/dom/DOMStringList.h" |
35 #include "core/dom/ExceptionCode.h" | 36 #include "core/dom/ExceptionCode.h" |
36 #include "core/dom/ExecutionContext.h" | 37 #include "core/dom/ExecutionContext.h" |
37 #include "modules/indexeddb/IDBAny.h" | 38 #include "modules/indexeddb/IDBAny.h" |
38 #include "modules/indexeddb/IDBCursorWithValue.h" | 39 #include "modules/indexeddb/IDBCursorWithValue.h" |
39 #include "modules/indexeddb/IDBDatabase.h" | 40 #include "modules/indexeddb/IDBDatabase.h" |
40 #include "modules/indexeddb/IDBKeyPath.h" | 41 #include "modules/indexeddb/IDBKeyPath.h" |
41 #include "modules/indexeddb/IDBTracing.h" | 42 #include "modules/indexeddb/IDBTracing.h" |
42 #include "modules/indexeddb/WebIDBCallbacksImpl.h" | 43 #include "modules/indexeddb/WebIDBCallbacksImpl.h" |
43 #include "platform/SharedBuffer.h" | 44 #include "platform/SharedBuffer.h" |
(...skipping 21 matching lines...) Expand all Loading... |
65 } | 66 } |
66 | 67 |
67 DEFINE_TRACE(IDBObjectStore) | 68 DEFINE_TRACE(IDBObjectStore) |
68 { | 69 { |
69 visitor->trace(m_transaction); | 70 visitor->trace(m_transaction); |
70 visitor->trace(m_indexMap); | 71 visitor->trace(m_indexMap); |
71 } | 72 } |
72 | 73 |
73 ScriptValue IDBObjectStore::keyPath(ScriptState* scriptState) const | 74 ScriptValue IDBObjectStore::keyPath(ScriptState* scriptState) const |
74 { | 75 { |
75 return idbKeyPathToScriptValue(scriptState, m_metadata.keyPath); | 76 return ScriptValue::from(scriptState, m_metadata.keyPath); |
76 } | 77 } |
77 | 78 |
78 PassRefPtrWillBeRawPtr<DOMStringList> IDBObjectStore::indexNames() const | 79 PassRefPtrWillBeRawPtr<DOMStringList> IDBObjectStore::indexNames() const |
79 { | 80 { |
80 IDB_TRACE("IDBObjectStore::indexNames"); | 81 IDB_TRACE("IDBObjectStore::indexNames"); |
81 RefPtrWillBeRawPtr<DOMStringList> indexNames = DOMStringList::create(); | 82 RefPtrWillBeRawPtr<DOMStringList> indexNames = DOMStringList::create(); |
82 for (IDBObjectStoreMetadata::IndexMap::const_iterator it = m_metadata.indexe
s.begin(); it != m_metadata.indexes.end(); ++it) | 83 for (IDBObjectStoreMetadata::IndexMap::const_iterator it = m_metadata.indexe
s.begin(); it != m_metadata.indexes.end(); ++it) |
83 indexNames->append(it->value.name); | 84 indexNames->append(it->value.name); |
84 indexNames->sort(); | 85 indexNames->sort(); |
85 return indexNames.release(); | 86 return indexNames.release(); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 } | 148 } |
148 | 149 |
149 IDBRequest* IDBObjectStore::put(ScriptState* scriptState, const ScriptValue& val
ue, const ScriptValue& key, ExceptionState& exceptionState) | 150 IDBRequest* IDBObjectStore::put(ScriptState* scriptState, const ScriptValue& val
ue, const ScriptValue& key, ExceptionState& exceptionState) |
150 { | 151 { |
151 IDB_TRACE("IDBObjectStore::put"); | 152 IDB_TRACE("IDBObjectStore::put"); |
152 return put(scriptState, WebIDBPutModeAddOrUpdate, IDBAny::create(this), valu
e, key, exceptionState); | 153 return put(scriptState, WebIDBPutModeAddOrUpdate, IDBAny::create(this), valu
e, key, exceptionState); |
153 } | 154 } |
154 | 155 |
155 IDBRequest* IDBObjectStore::put(ScriptState* scriptState, WebIDBPutMode putMode,
IDBAny* source, const ScriptValue& value, const ScriptValue& keyValue, Exceptio
nState& exceptionState) | 156 IDBRequest* IDBObjectStore::put(ScriptState* scriptState, WebIDBPutMode putMode,
IDBAny* source, const ScriptValue& value, const ScriptValue& keyValue, Exceptio
nState& exceptionState) |
156 { | 157 { |
157 IDBKey* key = keyValue.isUndefined() ? nullptr : scriptValueToIDBKey(scriptS
tate->isolate(), keyValue); | 158 IDBKey* key = keyValue.isUndefined() ? nullptr : script_value_cast<IDBKey*>(
keyValue, scriptState->isolate(), exceptionState); |
158 return put(scriptState, putMode, source, value, key, exceptionState); | 159 return put(scriptState, putMode, source, value, key, exceptionState); |
159 } | 160 } |
160 | 161 |
161 IDBRequest* IDBObjectStore::put(ScriptState* scriptState, WebIDBPutMode putMode,
IDBAny* source, const ScriptValue& value, IDBKey* key, ExceptionState& exceptio
nState) | 162 IDBRequest* IDBObjectStore::put(ScriptState* scriptState, WebIDBPutMode putMode,
IDBAny* source, const ScriptValue& value, IDBKey* key, ExceptionState& exceptio
nState) |
162 { | 163 { |
163 if (isDeleted()) { | 164 if (isDeleted()) { |
164 exceptionState.throwDOMException(InvalidStateError, IDBDatabase::objectS
toreDeletedErrorMessage); | 165 exceptionState.throwDOMException(InvalidStateError, IDBDatabase::objectS
toreDeletedErrorMessage); |
165 return 0; | 166 return 0; |
166 } | 167 } |
167 if (m_transaction->isFinished() || m_transaction->isFinishing()) { | 168 if (m_transaction->isFinished() || m_transaction->isFinishing()) { |
(...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
668 } | 669 } |
669 return IDBIndexMetadata::InvalidId; | 670 return IDBIndexMetadata::InvalidId; |
670 } | 671 } |
671 | 672 |
672 WebIDBDatabase* IDBObjectStore::backendDB() const | 673 WebIDBDatabase* IDBObjectStore::backendDB() const |
673 { | 674 { |
674 return m_transaction->backendDB(); | 675 return m_transaction->backendDB(); |
675 } | 676 } |
676 | 677 |
677 } // namespace blink | 678 } // namespace blink |
OLD | NEW |