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 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
417 // the objectStore. It only needs to be kept alive by virtue of being | 417 // the objectStore. It only needs to be kept alive by virtue of being |
418 // a listener on an IDBRequest object, in the same way that JavaScript | 418 // a listener on an IDBRequest object, in the same way that JavaScript |
419 // cursor success handlers are kept alive. | 419 // cursor success handlers are kept alive. |
420 class IndexPopulator final : public EventListener { | 420 class IndexPopulator final : public EventListener { |
421 public: | 421 public: |
422 static PassRefPtr<IndexPopulator> create(ScriptState* scriptState, IDBDataba
se* database, int64_t transactionId, int64_t objectStoreId, const IDBIndexMetada
ta& indexMetadata) | 422 static PassRefPtr<IndexPopulator> create(ScriptState* scriptState, IDBDataba
se* database, int64_t transactionId, int64_t objectStoreId, const IDBIndexMetada
ta& indexMetadata) |
423 { | 423 { |
424 return adoptRef(new IndexPopulator(scriptState, database, transactionId,
objectStoreId, indexMetadata)); | 424 return adoptRef(new IndexPopulator(scriptState, database, transactionId,
objectStoreId, indexMetadata)); |
425 } | 425 } |
426 | 426 |
427 virtual bool operator==(const EventListener& other) override | 427 bool operator==(const EventListener& other) override |
428 { | 428 { |
429 return this == &other; | 429 return this == &other; |
430 } | 430 } |
431 | 431 |
432 private: | 432 private: |
433 IndexPopulator(ScriptState* scriptState, IDBDatabase* database, int64_t tran
sactionId, int64_t objectStoreId, const IDBIndexMetadata& indexMetadata) | 433 IndexPopulator(ScriptState* scriptState, IDBDatabase* database, int64_t tran
sactionId, int64_t objectStoreId, const IDBIndexMetadata& indexMetadata) |
434 : EventListener(CPPEventListenerType) | 434 : EventListener(CPPEventListenerType) |
435 , m_scriptState(scriptState) | 435 , m_scriptState(scriptState) |
436 , m_database(database) | 436 , m_database(database) |
437 , m_transactionId(transactionId) | 437 , m_transactionId(transactionId) |
438 , m_objectStoreId(objectStoreId) | 438 , m_objectStoreId(objectStoreId) |
439 , m_indexMetadata(indexMetadata) | 439 , m_indexMetadata(indexMetadata) |
440 { | 440 { |
441 } | 441 } |
442 | 442 |
443 virtual void handleEvent(ExecutionContext* executionContext, Event* event) o
verride | 443 void handleEvent(ExecutionContext* executionContext, Event* event) override |
444 { | 444 { |
445 ASSERT(m_scriptState->executionContext() == executionContext); | 445 ASSERT(m_scriptState->executionContext() == executionContext); |
446 ASSERT(event->type() == EventTypeNames::success); | 446 ASSERT(event->type() == EventTypeNames::success); |
447 EventTarget* target = event->target(); | 447 EventTarget* target = event->target(); |
448 IDBRequest* request = static_cast<IDBRequest*>(target); | 448 IDBRequest* request = static_cast<IDBRequest*>(target); |
449 | 449 |
450 if (!m_database->backend()) // If database is stopped? | 450 if (!m_database->backend()) // If database is stopped? |
451 return; | 451 return; |
452 | 452 |
453 IDBAny* cursorAny = request->resultAsAny(); | 453 IDBAny* cursorAny = request->resultAsAny(); |
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
744 } | 744 } |
745 return IDBIndexMetadata::InvalidId; | 745 return IDBIndexMetadata::InvalidId; |
746 } | 746 } |
747 | 747 |
748 WebIDBDatabase* IDBObjectStore::backendDB() const | 748 WebIDBDatabase* IDBObjectStore::backendDB() const |
749 { | 749 { |
750 return m_transaction->backendDB(); | 750 return m_transaction->backendDB(); |
751 } | 751 } |
752 | 752 |
753 } // namespace blink | 753 } // namespace blink |
OLD | NEW |