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 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 // to each other, then explicitly break the cycle. | 302 // to each other, then explicitly break the cycle. |
303 if (!m_request || m_request->getResultCursor() != this) | 303 if (!m_request || m_request->getResultCursor() != this) |
304 return; | 304 return; |
305 | 305 |
306 if (!hasOneRef() || !m_request->hasOneRef()) | 306 if (!hasOneRef() || !m_request->hasOneRef()) |
307 return; | 307 return; |
308 | 308 |
309 m_request.clear(); | 309 m_request.clear(); |
310 } | 310 } |
311 | 311 |
312 ScriptValue IDBCursor::key(ExecutionContext* context) | 312 ScriptValue IDBCursor::key(NewScriptState* scriptState) |
313 { | 313 { |
314 m_keyDirty = false; | 314 m_keyDirty = false; |
315 DOMRequestState requestState(toIsolate(context)); | 315 return idbKeyToScriptValue(scriptState, m_key); |
316 return idbKeyToScriptValue(&requestState, m_key); | |
317 } | 316 } |
318 | 317 |
319 ScriptValue IDBCursor::primaryKey(ExecutionContext* context) | 318 ScriptValue IDBCursor::primaryKey(NewScriptState* scriptState) |
320 { | 319 { |
321 m_primaryKeyDirty = false; | 320 m_primaryKeyDirty = false; |
322 DOMRequestState requestState(toIsolate(context)); | 321 return idbKeyToScriptValue(scriptState, m_primaryKey); |
323 return idbKeyToScriptValue(&requestState, m_primaryKey); | |
324 } | 322 } |
325 | 323 |
326 ScriptValue IDBCursor::value(ExecutionContext* context) | 324 ScriptValue IDBCursor::value(NewScriptState* scriptState) |
327 { | 325 { |
328 ASSERT(isCursorWithValue()); | 326 ASSERT(isCursorWithValue()); |
329 | 327 |
330 DOMRequestState requestState(toIsolate(context)); | |
331 RefPtr<IDBObjectStore> objectStore = effectiveObjectStore(); | 328 RefPtr<IDBObjectStore> objectStore = effectiveObjectStore(); |
332 const IDBObjectStoreMetadata& metadata = objectStore->metadata(); | 329 const IDBObjectStoreMetadata& metadata = objectStore->metadata(); |
333 RefPtr<IDBAny> value; | 330 RefPtr<IDBAny> value; |
334 if (metadata.autoIncrement && !metadata.keyPath.isNull()) { | 331 if (metadata.autoIncrement && !metadata.keyPath.isNull()) { |
335 value = IDBAny::create(m_value, m_primaryKey, metadata.keyPath); | 332 value = IDBAny::create(m_value, m_primaryKey, metadata.keyPath); |
336 #ifndef NDEBUG | 333 #ifndef NDEBUG |
| 334 DOMRequestState requestState(scriptState->isolate()); |
337 assertPrimaryKeyValidOrInjectable(&requestState, m_value, m_primaryKey,
metadata.keyPath); | 335 assertPrimaryKeyValidOrInjectable(&requestState, m_value, m_primaryKey,
metadata.keyPath); |
338 #endif | 336 #endif |
339 } else { | 337 } else { |
340 value = IDBAny::create(m_value); | 338 value = IDBAny::create(m_value); |
341 } | 339 } |
342 | 340 |
343 m_valueDirty = false; | 341 m_valueDirty = false; |
344 return idbAnyToScriptValue(&requestState, value); | 342 return idbAnyToScriptValue(scriptState, value); |
345 } | 343 } |
346 | 344 |
347 ScriptValue IDBCursor::source(ExecutionContext* context) const | 345 ScriptValue IDBCursor::source(NewScriptState* scriptState) const |
348 { | 346 { |
349 DOMRequestState requestState(toIsolate(context)); | 347 return idbAnyToScriptValue(scriptState, m_source); |
350 return idbAnyToScriptValue(&requestState, m_source); | |
351 } | 348 } |
352 | 349 |
353 void IDBCursor::setValueReady(PassRefPtr<IDBKey> key, PassRefPtr<IDBKey> primary
Key, PassRefPtr<SharedBuffer> value) | 350 void IDBCursor::setValueReady(PassRefPtr<IDBKey> key, PassRefPtr<IDBKey> primary
Key, PassRefPtr<SharedBuffer> value) |
354 { | 351 { |
355 m_key = key; | 352 m_key = key; |
356 m_keyDirty = true; | 353 m_keyDirty = true; |
357 | 354 |
358 m_primaryKey = primaryKey; | 355 m_primaryKey = primaryKey; |
359 m_primaryKeyDirty = true; | 356 m_primaryKeyDirty = true; |
360 | 357 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
411 case WebIDBCursor::PrevNoDuplicate: | 408 case WebIDBCursor::PrevNoDuplicate: |
412 return IDBCursor::directionPrevUnique(); | 409 return IDBCursor::directionPrevUnique(); |
413 | 410 |
414 default: | 411 default: |
415 ASSERT_NOT_REACHED(); | 412 ASSERT_NOT_REACHED(); |
416 return IDBCursor::directionNext(); | 413 return IDBCursor::directionNext(); |
417 } | 414 } |
418 } | 415 } |
419 | 416 |
420 } // namespace WebCore | 417 } // namespace WebCore |
OLD | NEW |