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 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 backendDB()->clear(m_transaction->id(), id(), WebIDBCallbacksImpl::create(re
quest).leakPtr()); | 327 backendDB()->clear(m_transaction->id(), id(), WebIDBCallbacksImpl::create(re
quest).leakPtr()); |
328 return request; | 328 return request; |
329 } | 329 } |
330 | 330 |
331 namespace { | 331 namespace { |
332 // This class creates the index keys for a given index by extracting | 332 // This class creates the index keys for a given index by extracting |
333 // them from the SerializedScriptValue, for all the existing values in | 333 // them from the SerializedScriptValue, for all the existing values in |
334 // the objectStore. It only needs to be kept alive by virtue of being | 334 // the objectStore. It only needs to be kept alive by virtue of being |
335 // a listener on an IDBRequest object, in the same way that JavaScript | 335 // a listener on an IDBRequest object, in the same way that JavaScript |
336 // cursor success handlers are kept alive. | 336 // cursor success handlers are kept alive. |
337 class IndexPopulator FINAL : public EventListener { | 337 class IndexPopulator final : public EventListener { |
338 public: | 338 public: |
339 static PassRefPtr<IndexPopulator> create(ScriptState* scriptState, IDBDataba
se* database, int64_t transactionId, int64_t objectStoreId, const IDBIndexMetada
ta& indexMetadata) | 339 static PassRefPtr<IndexPopulator> create(ScriptState* scriptState, IDBDataba
se* database, int64_t transactionId, int64_t objectStoreId, const IDBIndexMetada
ta& indexMetadata) |
340 { | 340 { |
341 return adoptRef(new IndexPopulator(scriptState, database, transactionId,
objectStoreId, indexMetadata)); | 341 return adoptRef(new IndexPopulator(scriptState, database, transactionId,
objectStoreId, indexMetadata)); |
342 } | 342 } |
343 | 343 |
344 virtual bool operator==(const EventListener& other) OVERRIDE | 344 virtual bool operator==(const EventListener& other) override |
345 { | 345 { |
346 return this == &other; | 346 return this == &other; |
347 } | 347 } |
348 | 348 |
349 private: | 349 private: |
350 IndexPopulator(ScriptState* scriptState, IDBDatabase* database, int64_t tran
sactionId, int64_t objectStoreId, const IDBIndexMetadata& indexMetadata) | 350 IndexPopulator(ScriptState* scriptState, IDBDatabase* database, int64_t tran
sactionId, int64_t objectStoreId, const IDBIndexMetadata& indexMetadata) |
351 : EventListener(CPPEventListenerType) | 351 : EventListener(CPPEventListenerType) |
352 , m_scriptState(scriptState) | 352 , m_scriptState(scriptState) |
353 , m_database(database) | 353 , m_database(database) |
354 , m_transactionId(transactionId) | 354 , m_transactionId(transactionId) |
355 , m_objectStoreId(objectStoreId) | 355 , m_objectStoreId(objectStoreId) |
356 , m_indexMetadata(indexMetadata) | 356 , m_indexMetadata(indexMetadata) |
357 { | 357 { |
358 } | 358 } |
359 | 359 |
360 virtual void handleEvent(ExecutionContext* executionContext, Event* event) O
VERRIDE | 360 virtual void handleEvent(ExecutionContext* executionContext, Event* event) o
verride |
361 { | 361 { |
362 ASSERT(m_scriptState->executionContext() == executionContext); | 362 ASSERT(m_scriptState->executionContext() == executionContext); |
363 ASSERT(event->type() == EventTypeNames::success); | 363 ASSERT(event->type() == EventTypeNames::success); |
364 EventTarget* target = event->target(); | 364 EventTarget* target = event->target(); |
365 IDBRequest* request = static_cast<IDBRequest*>(target); | 365 IDBRequest* request = static_cast<IDBRequest*>(target); |
366 | 366 |
367 if (!m_database->backend()) // If database is stopped? | 367 if (!m_database->backend()) // If database is stopped? |
368 return; | 368 return; |
369 | 369 |
370 IDBAny* cursorAny = request->resultAsAny(); | 370 IDBAny* cursorAny = request->resultAsAny(); |
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
671 } | 671 } |
672 return IDBIndexMetadata::InvalidId; | 672 return IDBIndexMetadata::InvalidId; |
673 } | 673 } |
674 | 674 |
675 WebIDBDatabase* IDBObjectStore::backendDB() const | 675 WebIDBDatabase* IDBObjectStore::backendDB() const |
676 { | 676 { |
677 return m_transaction->backendDB(); | 677 return m_transaction->backendDB(); |
678 } | 678 } |
679 | 679 |
680 } // namespace blink | 680 } // namespace blink |
OLD | NEW |