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 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
303 DOMRequestState requestState(context); | 303 DOMRequestState requestState(context); |
304 return idbKeyToScriptValue(&requestState, m_primaryKey); | 304 return idbKeyToScriptValue(&requestState, m_primaryKey); |
305 } | 305 } |
306 | 306 |
307 ScriptValue IDBCursor::value(ScriptExecutionContext* context) | 307 ScriptValue IDBCursor::value(ScriptExecutionContext* context) |
308 { | 308 { |
309 ASSERT(!isKeyCursor()); | 309 ASSERT(!isKeyCursor()); |
310 | 310 |
311 m_valueDirty = false; | 311 m_valueDirty = false; |
312 DOMRequestState requestState(context); | 312 DOMRequestState requestState(context); |
313 ScriptValue value = deserializeIDBValueBuffer(&requestState, m_value); | 313 ScriptValue value = deserializeIDBValueBuffer(&requestState, m_value, &m_blo bInfo); |
314 RefPtr<IDBObjectStore> objectStore = effectiveObjectStore(); | 314 RefPtr<IDBObjectStore> objectStore = effectiveObjectStore(); |
315 const IDBObjectStoreMetadata metadata = objectStore->metadata(); | 315 const IDBObjectStoreMetadata metadata = objectStore->metadata(); |
316 if (metadata.autoIncrement && !metadata.keyPath.isNull()) { | 316 if (metadata.autoIncrement && !metadata.keyPath.isNull()) { |
317 #ifndef NDEBUG | 317 #ifndef NDEBUG |
318 RefPtr<IDBKey> expectedKey = createIDBKeyFromScriptValueAndKeyPath(&requ estState, value, metadata.keyPath); | 318 RefPtr<IDBKey> expectedKey = createIDBKeyFromScriptValueAndKeyPath(&requ estState, value, metadata.keyPath); |
319 ASSERT(!expectedKey || expectedKey->isEqual(m_primaryKey.get())); | 319 ASSERT(!expectedKey || expectedKey->isEqual(m_primaryKey.get())); |
320 #endif | 320 #endif |
321 bool injected = injectIDBKeyIntoScriptValue(&requestState, m_primaryKey, value, metadata.keyPath); | 321 bool injected = injectIDBKeyIntoScriptValue(&requestState, m_primaryKey, value, metadata.keyPath); |
322 ASSERT_UNUSED(injected, injected); | 322 ASSERT_UNUSED(injected, injected); |
323 } | 323 } |
324 | 324 |
325 return value; | 325 return value; |
326 } | 326 } |
327 | 327 |
328 void IDBCursor::setValueReady(PassRefPtr<IDBKey> key, PassRefPtr<IDBKey> primary Key, PassRefPtr<SharedBuffer> value) | 328 void IDBCursor::setValueReady(PassRefPtr<IDBKey> key, PassRefPtr<IDBKey> primary Key, PassRefPtr<SharedBuffer> value, Vector<BlobInfo>& blobInfo) |
329 { | 329 { |
330 m_key = key; | 330 m_key = key; |
331 m_keyDirty = true; | 331 m_keyDirty = true; |
332 | 332 |
333 m_primaryKey = primaryKey; | 333 m_primaryKey = primaryKey; |
334 m_primaryKeyDirty = true; | 334 m_primaryKeyDirty = true; |
335 | 335 |
336 if (!isKeyCursor()) { | 336 if (!isKeyCursor()) { |
337 m_value = value; | 337 m_value = value; |
338 m_blobInfo.clear(); | |
339 m_blobInfo.swap(blobInfo); | |
jsbell
2013/09/12 22:52:17
I'm waffling on OwnPtr<Vector> vs. swapping here.
ericu
2013/11/20 23:06:08
Switched to OwnPtr.
| |
338 m_valueDirty = true; | 340 m_valueDirty = true; |
339 } | 341 } |
340 | 342 |
341 m_gotValue = true; | 343 m_gotValue = true; |
342 } | 344 } |
343 | 345 |
344 PassRefPtr<IDBObjectStore> IDBCursor::effectiveObjectStore() | 346 PassRefPtr<IDBObjectStore> IDBCursor::effectiveObjectStore() |
345 { | 347 { |
346 if (m_source->type() == IDBAny::IDBObjectStoreType) | 348 if (m_source->type() == IDBAny::IDBObjectStoreType) |
347 return m_source->idbObjectStore(); | 349 return m_source->idbObjectStore(); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
386 case IndexedDB::CursorPrevNoDuplicate: | 388 case IndexedDB::CursorPrevNoDuplicate: |
387 return IDBCursor::directionPrevUnique(); | 389 return IDBCursor::directionPrevUnique(); |
388 | 390 |
389 default: | 391 default: |
390 ASSERT_NOT_REACHED(); | 392 ASSERT_NOT_REACHED(); |
391 return IDBCursor::directionNext(); | 393 return IDBCursor::directionNext(); |
392 } | 394 } |
393 } | 395 } |
394 | 396 |
395 } // namespace WebCore | 397 } // namespace WebCore |
OLD | NEW |