| 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 10 matching lines...) Expand all Loading... |
| 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/ToV8ForModules.h" |
| 31 #include "bindings/modules/v8/V8BindingForModules.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" |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |