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 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 ASSERT(!blobInfo->size()); | 296 ASSERT(!blobInfo->size()); |
297 m_pendingCursor->close(); | 297 m_pendingCursor->close(); |
298 m_pendingCursor.clear(); | 298 m_pendingCursor.clear(); |
299 } | 299 } |
300 | 300 |
301 ASSERT(!m_blobInfo.get()); | 301 ASSERT(!m_blobInfo.get()); |
302 m_blobInfo = blobInfo; | 302 m_blobInfo = blobInfo; |
303 onSuccessInternal(IDBAny::create(valueBuffer, m_blobInfo.get())); | 303 onSuccessInternal(IDBAny::create(valueBuffer, m_blobInfo.get())); |
304 } | 304 } |
305 | 305 |
306 #ifndef NDEBUG | 306 #if ENABLE(ASSERT) |
307 static IDBObjectStore* effectiveObjectStore(IDBAny* source) | 307 static IDBObjectStore* effectiveObjectStore(IDBAny* source) |
308 { | 308 { |
309 if (source->type() == IDBAny::IDBObjectStoreType) | 309 if (source->type() == IDBAny::IDBObjectStoreType) |
310 return source->idbObjectStore(); | 310 return source->idbObjectStore(); |
311 if (source->type() == IDBAny::IDBIndexType) | 311 if (source->type() == IDBAny::IDBIndexType) |
312 return source->idbIndex()->objectStore(); | 312 return source->idbIndex()->objectStore(); |
313 | 313 |
314 ASSERT_NOT_REACHED(); | 314 ASSERT_NOT_REACHED(); |
315 return 0; | 315 return 0; |
316 } | 316 } |
317 #endif | 317 #endif |
318 | 318 |
319 void IDBRequest::onSuccess(PassRefPtr<SharedBuffer> prpValueBuffer, PassOwnPtr<V
ector<blink::WebBlobInfo> > blobInfo, IDBKey* prpPrimaryKey, const IDBKeyPath& k
eyPath) | 319 void IDBRequest::onSuccess(PassRefPtr<SharedBuffer> prpValueBuffer, PassOwnPtr<V
ector<blink::WebBlobInfo> > blobInfo, IDBKey* prpPrimaryKey, const IDBKeyPath& k
eyPath) |
320 { | 320 { |
321 IDB_TRACE("IDBRequest::onSuccess(SharedBuffer, IDBKey, IDBKeyPath)"); | 321 IDB_TRACE("IDBRequest::onSuccess(SharedBuffer, IDBKey, IDBKeyPath)"); |
322 if (!shouldEnqueueEvent()) | 322 if (!shouldEnqueueEvent()) |
323 return; | 323 return; |
324 | 324 |
325 #ifndef NDEBUG | |
326 ASSERT(keyPath == effectiveObjectStore(m_source)->metadata().keyPath); | 325 ASSERT(keyPath == effectiveObjectStore(m_source)->metadata().keyPath); |
327 #endif | |
328 | 326 |
329 RefPtr<SharedBuffer> valueBuffer = prpValueBuffer; | 327 RefPtr<SharedBuffer> valueBuffer = prpValueBuffer; |
330 IDBKey* primaryKey = prpPrimaryKey; | 328 IDBKey* primaryKey = prpPrimaryKey; |
331 ASSERT(!m_blobInfo.get()); | 329 ASSERT(!m_blobInfo.get()); |
332 m_blobInfo = blobInfo; | 330 m_blobInfo = blobInfo; |
333 | 331 |
334 #ifndef NDEBUG | 332 #if ENABLE(ASSERT) |
335 assertPrimaryKeyValidOrInjectable(m_scriptState.get(), valueBuffer, m_blobIn
fo.get(), primaryKey, keyPath); | 333 assertPrimaryKeyValidOrInjectable(m_scriptState.get(), valueBuffer, m_blobIn
fo.get(), primaryKey, keyPath); |
336 #endif | 334 #endif |
337 | 335 |
338 onSuccessInternal(IDBAny::create(valueBuffer, m_blobInfo.get(), primaryKey,
keyPath)); | 336 onSuccessInternal(IDBAny::create(valueBuffer, m_blobInfo.get(), primaryKey,
keyPath)); |
339 } | 337 } |
340 | 338 |
341 void IDBRequest::onSuccess(int64_t value) | 339 void IDBRequest::onSuccess(int64_t value) |
342 { | 340 { |
343 IDB_TRACE("IDBRequest::onSuccess(int64_t)"); | 341 IDB_TRACE("IDBRequest::onSuccess(int64_t)"); |
344 if (!shouldEnqueueEvent()) | 342 if (!shouldEnqueueEvent()) |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
540 | 538 |
541 void IDBRequest::dequeueEvent(Event* event) | 539 void IDBRequest::dequeueEvent(Event* event) |
542 { | 540 { |
543 for (size_t i = 0; i < m_enqueuedEvents.size(); ++i) { | 541 for (size_t i = 0; i < m_enqueuedEvents.size(); ++i) { |
544 if (m_enqueuedEvents[i].get() == event) | 542 if (m_enqueuedEvents[i].get() == event) |
545 m_enqueuedEvents.remove(i); | 543 m_enqueuedEvents.remove(i); |
546 } | 544 } |
547 } | 545 } |
548 | 546 |
549 } // namespace WebCore | 547 } // namespace WebCore |
OLD | NEW |