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