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 WebIDBObserverImpl_h | 5 #ifndef WebIDBObserverImpl_h |
6 #define WebIDBObserverImpl_h | 6 #define WebIDBObserverImpl_h |
7 | 7 |
| 8 #include <bitset> |
| 9 |
8 #include "modules/indexeddb/IDBObserver.h" | 10 #include "modules/indexeddb/IDBObserver.h" |
9 #include "platform/heap/Persistent.h" | 11 #include "platform/heap/Persistent.h" |
10 #include "public/platform/modules/indexeddb/WebIDBObserver.h" | 12 #include "public/platform/modules/indexeddb/WebIDBObserver.h" |
| 13 #include "public/platform/modules/indexeddb/WebIDBTypes.h" |
11 | 14 |
12 namespace blink { | 15 namespace blink { |
13 | 16 |
14 class IDBObserver; | 17 class IDBObserver; |
15 struct WebIDBObservation; | 18 struct WebIDBObservation; |
16 | 19 |
17 class WebIDBObserverImpl final : public WebIDBObserver { | 20 class WebIDBObserverImpl final : public WebIDBObserver { |
18 USING_FAST_MALLOC(WebIDBObserverImpl); | 21 USING_FAST_MALLOC(WebIDBObserverImpl); |
19 | 22 |
20 public: | 23 public: |
21 static std::unique_ptr<WebIDBObserverImpl> create(IDBObserver*); | 24 static std::unique_ptr<WebIDBObserverImpl> create( |
| 25 IDBObserver*, |
| 26 bool transaction, |
| 27 bool values, |
| 28 bool noRecords, |
| 29 std::bitset<WebIDBOperationTypeCount> operationTypes); |
22 | 30 |
23 ~WebIDBObserverImpl() override; | 31 ~WebIDBObserverImpl() override; |
24 | 32 |
25 void setId(int32_t); | 33 void setId(int32_t); |
26 | 34 |
27 bool transaction() const { return m_observer->transaction(); } | 35 bool transaction() const { return m_transaction; } |
28 bool noRecords() const { return m_observer->noRecords(); } | 36 bool noRecords() const { return m_noRecords; } |
29 bool values() const { return m_observer->values(); } | 37 bool values() const { return m_values; } |
30 const std::bitset<WebIDBOperationTypeCount>& operationTypes() const { | 38 const std::bitset<WebIDBOperationTypeCount>& operationTypes() const { |
31 return m_observer->operationTypes(); | 39 return m_operationTypes; |
32 } | 40 } |
| 41 |
33 void onChange(const WebVector<WebIDBObservation>&, | 42 void onChange(const WebVector<WebIDBObservation>&, |
34 const WebVector<int32_t>& observationIndex); | 43 const WebVector<int32_t>& observationIndex); |
35 | 44 |
36 private: | 45 private: |
37 enum { kInvalidObserverId = -1 }; | 46 enum { kInvalidObserverId = -1 }; |
38 | 47 |
39 explicit WebIDBObserverImpl(IDBObserver*); | 48 WebIDBObserverImpl(IDBObserver*, |
| 49 bool transaction, |
| 50 bool values, |
| 51 bool noRecords, |
| 52 std::bitset<WebIDBOperationTypeCount> operationTypes); |
40 | 53 |
41 int32_t m_id; | 54 int32_t m_id; |
| 55 bool m_transaction; |
| 56 bool m_values; |
| 57 bool m_noRecords; |
| 58 // Operation type bits are set corresponding to WebIDBOperationType. |
| 59 std::bitset<WebIDBOperationTypeCount> m_operationTypes; |
42 Persistent<IDBObserver> m_observer; | 60 Persistent<IDBObserver> m_observer; |
43 }; | 61 }; |
44 | 62 |
45 } // namespace blink | 63 } // namespace blink |
46 | 64 |
47 #endif // WebIDBObserverImpl_h | 65 #endif // WebIDBObserverImpl_h |
OLD | NEW |