Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(366)

Side by Side Diff: third_party/WebKit/Source/modules/indexeddb/IDBObserverChanges.h

Issue 2601983002: [IndexedDB] Adding transaction and value support to observers (Closed)
Patch Set: added comments and bug link Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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(
26 const WebVector<WebIDBObservation>&, 26 IDBDatabase*,
27 const WebVector<int32_t>& observationIndex); 27 const WebVector<WebIDBObservation>&,
28 const WebVector<int32_t>& observationIndices);
29 static IDBObserverChanges* create(
30 IDBDatabase*,
31 IDBTransaction*,
32 const WebVector<WebIDBObservation>&,
33 const WebVector<int32_t>& observationIndices);
28 34
29 DECLARE_TRACE(); 35 DECLARE_TRACE();
30 36
31 // Implement IDL 37 // Implement IDL
32 IDBTransaction* transaction() const { return m_transaction.get(); } 38 IDBTransaction* transaction() const { return m_transaction.get(); }
33 IDBDatabase* database() const { return m_database.get(); } 39 IDBDatabase* database() const { return m_database.get(); }
34 ScriptValue records(ScriptState*); 40 ScriptValue records(ScriptState*);
35 41
36 private: 42 private:
37 IDBObserverChanges(IDBDatabase*, 43 IDBObserverChanges(IDBDatabase*,
44 IDBTransaction*,
38 const WebVector<WebIDBObservation>&, 45 const WebVector<WebIDBObservation>&,
39 const WebVector<int32_t>& observationIndex); 46 const WebVector<int32_t>& observationIndices);
40 47
41 void extractChanges(const WebVector<WebIDBObservation>&, 48 void extractChanges(const WebVector<WebIDBObservation>&,
42 const WebVector<int32_t>& observationIndex); 49 const WebVector<int32_t>& observationIndices);
43 50
44 Member<IDBDatabase> m_database; 51 Member<IDBDatabase> m_database;
45 Member<IDBTransaction> m_transaction; 52 Member<IDBTransaction> m_transaction;
46 // Map objectStoreId to IDBObservation list. 53 // Map objectStoreId to IDBObservation list.
47 HeapHashMap<int64_t, HeapVector<Member<IDBObservation>>> m_records; 54 HeapHashMap<int64_t, HeapVector<Member<IDBObservation>>> m_records;
48 }; 55 };
49 56
50 } // namespace blink 57 } // namespace blink
51 58
52 #endif // IDBObserverChanges_h 59 #endif // IDBObserverChanges_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698