Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(348)

Side by Side Diff: Source/modules/indexeddb/IDBCursor.cpp

Issue 1003713002: [bindings] Rename IDBBindingUtilities.cpp to V8BindingForModules.cpp (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 10 matching lines...) Expand all
21 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 21 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
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/IDBCursor.h" 27 #include "modules/indexeddb/IDBCursor.h"
28 28
29 #include "bindings/core/v8/ExceptionState.h" 29 #include "bindings/core/v8/ExceptionState.h"
30 #include "bindings/core/v8/ScriptState.h" 30 #include "bindings/core/v8/ScriptState.h"
31 #include "bindings/modules/v8/IDBBindingUtilities.h" 31 #include "bindings/modules/v8/ToV8ForModules.h"
32 #include "bindings/modules/v8/V8BindingForModules.h"
32 #include "core/dom/ExceptionCode.h" 33 #include "core/dom/ExceptionCode.h"
33 #include "core/inspector/ScriptCallStack.h" 34 #include "core/inspector/ScriptCallStack.h"
34 #include "modules/IndexedDBNames.h" 35 #include "modules/IndexedDBNames.h"
35 #include "modules/indexeddb/IDBAny.h" 36 #include "modules/indexeddb/IDBAny.h"
36 #include "modules/indexeddb/IDBDatabase.h" 37 #include "modules/indexeddb/IDBDatabase.h"
37 #include "modules/indexeddb/IDBObjectStore.h" 38 #include "modules/indexeddb/IDBObjectStore.h"
38 #include "modules/indexeddb/IDBTracing.h" 39 #include "modules/indexeddb/IDBTracing.h"
39 #include "modules/indexeddb/IDBTransaction.h" 40 #include "modules/indexeddb/IDBTransaction.h"
40 #include "modules/indexeddb/WebIDBCallbacksImpl.h" 41 #include "modules/indexeddb/WebIDBCallbacksImpl.h"
41 #include "public/platform/WebIDBDatabase.h" 42 #include "public/platform/WebIDBDatabase.h"
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 } 142 }
142 143
143 m_request->setPendingCursor(this); 144 m_request->setPendingCursor(this);
144 m_gotValue = false; 145 m_gotValue = false;
145 m_backend->advance(count, WebIDBCallbacksImpl::create(m_request).leakPtr()); 146 m_backend->advance(count, WebIDBCallbacksImpl::create(m_request).leakPtr());
146 } 147 }
147 148
148 void IDBCursor::continueFunction(ScriptState* scriptState, const ScriptValue& ke yValue, ExceptionState& exceptionState) 149 void IDBCursor::continueFunction(ScriptState* scriptState, const ScriptValue& ke yValue, ExceptionState& exceptionState)
149 { 150 {
150 IDB_TRACE("IDBCursor::continue"); 151 IDB_TRACE("IDBCursor::continue");
151 IDBKey* key = keyValue.isUndefined() || keyValue.isNull() ? nullptr : script ValueToIDBKey(scriptState->isolate(), keyValue); 152 IDBKey* key = keyValue.isUndefined() || keyValue.isNull() ? nullptr : script _value_cast<IDBKey*>(keyValue, scriptState->isolate(), exceptionState);
152 if (key && !key->isValid()) { 153 if (key && !key->isValid()) {
153 exceptionState.throwDOMException(DataError, IDBDatabase::notValidKeyErro rMessage); 154 exceptionState.throwDOMException(DataError, IDBDatabase::notValidKeyErro rMessage);
154 return; 155 return;
155 } 156 }
156 continueFunction(key, 0, exceptionState); 157 continueFunction(key, 0, exceptionState);
157 } 158 }
158 159
159 void IDBCursor::continuePrimaryKey(ScriptState* scriptState, const ScriptValue& keyValue, const ScriptValue& primaryKeyValue, ExceptionState& exceptionState) 160 void IDBCursor::continuePrimaryKey(ScriptState* scriptState, const ScriptValue& keyValue, const ScriptValue& primaryKeyValue, ExceptionState& exceptionState)
160 { 161 {
161 IDB_TRACE("IDBCursor::continuePrimaryKey"); 162 IDB_TRACE("IDBCursor::continuePrimaryKey");
162 IDBKey* key = scriptValueToIDBKey(scriptState->isolate(), keyValue); 163 IDBKey* key = script_value_cast<IDBKey*>(keyValue, scriptState->isolate(), e xceptionState);
163 IDBKey* primaryKey = scriptValueToIDBKey(scriptState->isolate(), primaryKeyV alue); 164 IDBKey* primaryKey = script_value_cast<IDBKey*>(primaryKeyValue, scriptState ->isolate(), exceptionState);
164 if (!key->isValid() || !primaryKey->isValid()) { 165 if (!key->isValid() || !primaryKey->isValid()) {
165 exceptionState.throwDOMException(DataError, IDBDatabase::notValidKeyErro rMessage); 166 exceptionState.throwDOMException(DataError, IDBDatabase::notValidKeyErro rMessage);
166 return; 167 return;
167 } 168 }
168 continueFunction(key, primaryKey, exceptionState); 169 continueFunction(key, primaryKey, exceptionState);
169 } 170 }
170 171
171 void IDBCursor::continueFunction(IDBKey* key, IDBKey* primaryKey, ExceptionState & exceptionState) 172 void IDBCursor::continueFunction(IDBKey* key, IDBKey* primaryKey, ExceptionState & exceptionState)
172 { 173 {
173 ASSERT(!primaryKey || (key && primaryKey)); 174 ASSERT(!primaryKey || (key && primaryKey));
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 void IDBCursor::close() 269 void IDBCursor::close()
269 { 270 {
270 m_blobs.clear(); 271 m_blobs.clear();
271 m_request.clear(); 272 m_request.clear();
272 m_backend.clear(); 273 m_backend.clear();
273 } 274 }
274 275
275 ScriptValue IDBCursor::key(ScriptState* scriptState) 276 ScriptValue IDBCursor::key(ScriptState* scriptState)
276 { 277 {
277 m_keyDirty = false; 278 m_keyDirty = false;
278 return idbKeyToScriptValue(scriptState, m_key); 279 return ScriptValue::from(scriptState, m_key);
279 } 280 }
280 281
281 ScriptValue IDBCursor::primaryKey(ScriptState* scriptState) 282 ScriptValue IDBCursor::primaryKey(ScriptState* scriptState)
282 { 283 {
283 m_primaryKeyDirty = false; 284 m_primaryKeyDirty = false;
284 return idbKeyToScriptValue(scriptState, m_primaryKey); 285 return ScriptValue::from(scriptState, m_primaryKey);
285 } 286 }
286 287
287 ScriptValue IDBCursor::value(ScriptState* scriptState) 288 ScriptValue IDBCursor::value(ScriptState* scriptState)
288 { 289 {
289 ASSERT(isCursorWithValue()); 290 ASSERT(isCursorWithValue());
290 291
291 IDBObjectStore* objectStore = effectiveObjectStore(); 292 IDBObjectStore* objectStore = effectiveObjectStore();
292 const IDBObjectStoreMetadata& metadata = objectStore->metadata(); 293 const IDBObjectStoreMetadata& metadata = objectStore->metadata();
293 IDBAny* value; 294 IDBAny* value;
294 if (metadata.autoIncrement && !metadata.keyPath.isNull()) { 295 if (metadata.autoIncrement && !metadata.keyPath.isNull()) {
295 value = IDBAny::create(m_value, m_blobs->getInfo(), m_primaryKey, metada ta.keyPath); 296 value = IDBAny::create(m_value, m_blobs->getInfo(), m_primaryKey, metada ta.keyPath);
296 #if ENABLE(ASSERT) 297 #if ENABLE(ASSERT)
297 assertPrimaryKeyValidOrInjectable(scriptState, m_value, m_blobs->getInfo (), m_primaryKey, metadata.keyPath); 298 assertPrimaryKeyValidOrInjectable(scriptState, m_value, m_blobs->getInfo (), m_primaryKey, metadata.keyPath);
298 #endif 299 #endif
299 } else { 300 } else {
300 value = IDBAny::create(m_value, m_blobs->getInfo()); 301 value = IDBAny::create(m_value, m_blobs->getInfo());
301 } 302 }
302 303
303 m_valueDirty = false; 304 m_valueDirty = false;
304 ScriptValue scriptValue = idbAnyToScriptValue(scriptState, value); 305 ScriptValue scriptValue = ScriptValue::from(scriptState, value);
305 return scriptValue; 306 return scriptValue;
306 } 307 }
307 308
308 ScriptValue IDBCursor::source(ScriptState* scriptState) const 309 ScriptValue IDBCursor::source(ScriptState* scriptState) const
309 { 310 {
310 return idbAnyToScriptValue(scriptState, m_source); 311 return ScriptValue::from(scriptState, m_source);
311 } 312 }
312 313
313 void IDBCursor::setValueReady(IDBKey* key, IDBKey* primaryKey, PassRefPtr<Shared Buffer> value, PassOwnPtr<IDBRequest::IDBBlobHolder> blobs) 314 void IDBCursor::setValueReady(IDBKey* key, IDBKey* primaryKey, PassRefPtr<Shared Buffer> value, PassOwnPtr<IDBRequest::IDBBlobHolder> blobs)
314 { 315 {
315 m_key = key; 316 m_key = key;
316 m_keyDirty = true; 317 m_keyDirty = true;
317 318
318 m_primaryKey = primaryKey; 319 m_primaryKey = primaryKey;
319 m_primaryKeyDirty = true; 320 m_primaryKeyDirty = true;
320 321
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 case WebIDBCursorDirectionPrevNoDuplicate: 372 case WebIDBCursorDirectionPrevNoDuplicate:
372 return IndexedDBNames::prevunique; 373 return IndexedDBNames::prevunique;
373 374
374 default: 375 default:
375 ASSERT_NOT_REACHED(); 376 ASSERT_NOT_REACHED();
376 return IndexedDBNames::next; 377 return IndexedDBNames::next;
377 } 378 }
378 } 379 }
379 380
380 } // namespace blink 381 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698