| 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/IDBObservation.h" |
| 12 #include "modules/indexeddb/IDBTransaction.h" | 12 #include "modules/indexeddb/IDBTransaction.h" |
| 13 #include "platform/heap/Handle.h" | 13 #include "platform/heap/Handle.h" |
| 14 #include "public/platform/WebVector.h" | 14 #include "public/platform/WebVector.h" |
| 15 | 15 |
| 16 namespace blink { | 16 namespace blink { |
| 17 | 17 |
| 18 class ScriptState; | 18 class ScriptState; |
| 19 | 19 |
| 20 class IDBObserverChanges final : public GarbageCollected<IDBObserverChanges>, | 20 class IDBObserverChanges final : public GarbageCollected<IDBObserverChanges>, |
| 21 public ScriptWrappable { | 21 public ScriptWrappable { |
| 22 DEFINE_WRAPPERTYPEINFO(); | 22 DEFINE_WRAPPERTYPEINFO(); |
| 23 | 23 |
| 24 public: | 24 public: |
| 25 static IDBObserverChanges* create(IDBDatabase*, | 25 static IDBObserverChanges* create(IDBDatabase*, |
| 26 const WebVector<WebIDBObservation>&, | 26 const WebVector<WebIDBObservation>&, |
| 27 const WebVector<int32_t>& observationIndex); | 27 const WebVector<int32_t>& observationIndex); |
| 28 static IDBObserverChanges* create(IDBDatabase*, |
| 29 IDBTransaction*, |
| 30 const WebVector<WebIDBObservation>&, |
| 31 const WebVector<int32_t>& observationIndex); |
| 28 | 32 |
| 29 DECLARE_TRACE(); | 33 DECLARE_TRACE(); |
| 30 | 34 |
| 31 // Implement IDL | 35 // Implement IDL |
| 32 IDBTransaction* transaction() const { return m_transaction.get(); } | 36 IDBTransaction* transaction() const { return m_transaction.get(); } |
| 33 IDBDatabase* database() const { return m_database.get(); } | 37 IDBDatabase* database() const { return m_database.get(); } |
| 34 ScriptValue records(ScriptState*); | 38 ScriptValue records(ScriptState*); |
| 35 | 39 |
| 36 private: | 40 private: |
| 37 IDBObserverChanges(IDBDatabase*, | 41 IDBObserverChanges(IDBDatabase*, |
| 42 IDBTransaction*, |
| 38 const WebVector<WebIDBObservation>&, | 43 const WebVector<WebIDBObservation>&, |
| 39 const WebVector<int32_t>& observationIndex); | 44 const WebVector<int32_t>& observationIndex); |
| 40 | 45 |
| 41 void extractChanges(const WebVector<WebIDBObservation>&, | 46 void extractChanges(const WebVector<WebIDBObservation>&, |
| 42 const WebVector<int32_t>& observationIndex); | 47 const WebVector<int32_t>& observationIndex); |
| 43 | 48 |
| 44 Member<IDBDatabase> m_database; | 49 Member<IDBDatabase> m_database; |
| 45 Member<IDBTransaction> m_transaction; | 50 Member<IDBTransaction> m_transaction; |
| 46 // Map objectStoreId to IDBObservation list. | 51 // Map objectStoreId to IDBObservation list. |
| 47 HeapHashMap<int64_t, HeapVector<Member<IDBObservation>>> m_records; | 52 HeapHashMap<int64_t, HeapVector<Member<IDBObservation>>> m_records; |
| 48 }; | 53 }; |
| 49 | 54 |
| 50 } // namespace blink | 55 } // namespace blink |
| 51 | 56 |
| 52 #endif // IDBObserverChanges_h | 57 #endif // IDBObserverChanges_h |
| OLD | NEW |