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 GarbageCollectedFinalized<IDBObserverCha
nges>, public ScriptWrappable { | 20 class IDBObserverChanges final : public GarbageCollected<IDBObserverChanges>, pu
blic ScriptWrappable { |
21 DEFINE_WRAPPERTYPEINFO(); | 21 DEFINE_WRAPPERTYPEINFO(); |
22 | |
23 public: | 22 public: |
24 static IDBObserverChanges* create(IDBDatabase*, const WebVector<WebIDBObserv
ation>&, const WebVector<int32_t>& observationIndex); | 23 static IDBObserverChanges* create(IDBDatabase*, const WebVector<WebIDBObserv
ation>&, const WebVector<int32_t>& observationIndex); |
25 | 24 |
26 DECLARE_TRACE(); | 25 DECLARE_TRACE(); |
27 | 26 |
28 // Implement IDL | 27 // Implement IDL |
29 IDBTransaction* transaction() const { return m_transaction.get(); } | 28 IDBTransaction* transaction() const { return m_transaction.get(); } |
30 IDBDatabase* database() const { return m_database.get(); } | 29 IDBDatabase* database() const { return m_database.get(); } |
31 ScriptValue records(ScriptState*); | 30 ScriptValue records(ScriptState*); |
32 | 31 |
33 private: | 32 private: |
34 IDBObserverChanges(IDBDatabase*, const WebVector<WebIDBObservation>&, const
WebVector<int32_t>& observationIndex); | 33 IDBObserverChanges(IDBDatabase*, const WebVector<WebIDBObservation>&, const
WebVector<int32_t>& observationIndex); |
35 | 34 |
36 void extractChanges(const WebVector<WebIDBObservation>&, const WebVector<int
32_t>& observationIndex); | 35 void extractChanges(const WebVector<WebIDBObservation>&, const WebVector<int
32_t>& observationIndex); |
37 | 36 |
38 Member<IDBDatabase> m_database; | 37 Member<IDBDatabase> m_database; |
39 Member<IDBTransaction> m_transaction; | 38 Member<IDBTransaction> m_transaction; |
40 // Map objectStoreId to IDBObservation list. | 39 // Map objectStoreId to IDBObservation list. |
41 HeapHashMap<int64_t, HeapVector<Member<IDBObservation>>> m_records; | 40 HeapHashMap<int64_t, HeapVector<Member<IDBObservation>>> m_records; |
42 }; | 41 }; |
43 | 42 |
44 } // namespace blink | 43 } // namespace blink |
45 | 44 |
46 #endif // IDBObserverChanges_h | 45 #endif // IDBObserverChanges_h |
OLD | NEW |