Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef IDBObserverChanges_h | 5 #ifndef IDBObserverChanges_h |
| 6 #define IDBObserverChanges_h | 6 #define IDBObserverChanges_h |
| 7 | 7 |
| 8 #include "bindings/core/v8/ScriptValue.h" | 8 #include "bindings/core/v8/ScriptValue.h" |
| 9 #include "bindings/core/v8/ScriptWrappable.h" | 9 #include "bindings/core/v8/ScriptWrappable.h" |
| 10 #include "modules/indexeddb/IDBDatabase.h" | 10 #include "modules/indexeddb/IDBDatabase.h" |
| 11 #include "modules/indexeddb/IDBObservation.h" | |
| 11 #include "modules/indexeddb/IDBTransaction.h" | 12 #include "modules/indexeddb/IDBTransaction.h" |
| 12 #include "platform/heap/Handle.h" | 13 #include "platform/heap/Handle.h" |
| 13 | 14 |
| 14 namespace blink { | 15 namespace blink { |
| 15 | 16 |
| 16 class ScriptState; | 17 class ScriptState; |
| 17 class IDBObserverChangesRecord; | 18 class IDBObserverChangesRecord; |
| 18 | 19 |
| 19 class IDBObserverChanges final : public GarbageCollected<IDBObserverChanges>, pu blic ScriptWrappable { | 20 class IDBObserverChanges final : public GarbageCollected<IDBObserverChanges>, pu blic ScriptWrappable { |
| 20 DEFINE_WRAPPERTYPEINFO(); | 21 DEFINE_WRAPPERTYPEINFO(); |
| 21 | 22 |
| 22 public: | 23 public: |
| 23 static IDBObserverChanges* create(IDBDatabase*, IDBTransaction*, IDBAny* rec ords); | 24 // TODO(palakj): Make this a map objectStoreName -> List<IDBObserverChanges> . |
| 25 typedef HeapVector<Member<IDBObservation>> ObjectStoreChangesMap; | |
| 26 | |
| 27 // TODO(palakj): Add IDBDatabase* to create. | |
|
Marijn Kruisselbrink
2016/07/11 23:10:40
You seemed to have resolved this TODO already?
palakj1
2016/07/13 00:43:51
removed.
| |
| 28 static IDBObserverChanges* create(IDBDatabase*, const std::vector<WebIDBObse rvation>&, const std::vector<int32_t>& observationIndex); | |
| 29 IDBObserverChanges(IDBDatabase*, const std::vector<WebIDBObservation>&, cons t std::vector<int32_t>& observationIndex); | |
| 24 | 30 |
| 25 DECLARE_TRACE(); | 31 DECLARE_TRACE(); |
| 26 | 32 |
| 27 // Implement IDL | 33 // Implement IDL |
| 28 IDBTransaction* transaction() const { return m_transaction.get(); } | 34 IDBTransaction* transaction() const { return m_transaction.get(); } |
| 29 IDBDatabase* database() const { return m_database.get(); } | 35 IDBDatabase* database() const { return m_database.get(); } |
| 30 ScriptValue records(ScriptState*); | 36 ScriptValue records(ScriptState*); |
| 31 | 37 |
| 32 private: | 38 private: |
| 33 IDBObserverChanges(IDBDatabase*, IDBTransaction*, IDBAny* records); | 39 void createMap(const std::vector<WebIDBObservation>& observations, const std ::vector<int32_t>& observationIndex); |
| 34 | 40 |
| 35 Member<IDBDatabase> m_database; | 41 Member<IDBDatabase> m_database; |
| 36 Member<IDBTransaction> m_transaction; | 42 Member<IDBTransaction> m_transaction; |
| 37 // TODO(palakj) : change to appropriate type Map<String, sequence<IDBObserve rChangesRecord>>. | 43 ObjectStoreChangesMap m_records; |
| 38 Member<IDBAny> m_records; | |
| 39 }; | 44 }; |
| 40 | 45 |
| 41 } // namespace blink | 46 } // namespace blink |
| 42 | 47 |
| 43 #endif // IDBObserverChanges_h | 48 #endif // IDBObserverChanges_h |
| OLD | NEW |