| 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 IDBObserver_h | 5 #ifndef IDBObserver_h |
| 6 #define IDBObserver_h | 6 #define IDBObserver_h |
| 7 | 7 |
| 8 #include "bindings/core/v8/ScriptState.h" | 8 #include "bindings/core/v8/ScriptState.h" |
| 9 #include "bindings/core/v8/ScriptWrappable.h" | 9 #include "bindings/core/v8/ScriptWrappable.h" |
| 10 #include "modules/ModulesExport.h" | 10 #include "modules/ModulesExport.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 class IDBObserverInit; | 21 class IDBObserverInit; |
| 22 class IDBTransaction; | 22 class IDBTransaction; |
| 23 struct WebIDBObservation; | 23 struct WebIDBObservation; |
| 24 | 24 |
| 25 class MODULES_EXPORT IDBObserver final | 25 class MODULES_EXPORT IDBObserver final |
| 26 : public GarbageCollectedFinalized<IDBObserver>, | 26 : public GarbageCollectedFinalized<IDBObserver>, |
| 27 public ScriptWrappable { | 27 public ScriptWrappable { |
| 28 DEFINE_WRAPPERTYPEINFO(); | 28 DEFINE_WRAPPERTYPEINFO(); |
| 29 | 29 |
| 30 public: | 30 public: |
| 31 static IDBObserver* create(ScriptState*, | 31 static IDBObserver* create(IDBObserverCallback*, const IDBObserverInit&); |
| 32 IDBObserverCallback*, | |
| 33 const IDBObserverInit&); | |
| 34 | 32 |
| 35 void removeObserver(int32_t id); | 33 void removeObserver(int32_t id); |
| 36 void onChange(int32_t id, | 34 void onChange(int32_t id, |
| 37 const WebVector<WebIDBObservation>&, | 35 const WebVector<WebIDBObservation>&, |
| 38 const WebVector<int32_t>& observationIndex); | 36 const WebVector<int32_t>& observationIndex); |
| 39 | 37 |
| 40 bool transaction() const { return m_transaction; } | 38 bool transaction() const { return m_transaction; } |
| 41 bool noRecords() const { return m_noRecords; } | 39 bool noRecords() const { return m_noRecords; } |
| 42 bool values() const { return m_values; } | 40 bool values() const { return m_values; } |
| 43 const std::bitset<WebIDBOperationTypeCount>& operationTypes() const { | 41 const std::bitset<WebIDBOperationTypeCount>& operationTypes() const { |
| 44 return m_operationTypes; | 42 return m_operationTypes; |
| 45 } | 43 } |
| 46 | 44 |
| 47 // Implement the IDBObserver IDL. | 45 // Implement the IDBObserver IDL. |
| 48 void observe(IDBDatabase*, IDBTransaction*, ExceptionState&); | 46 void observe(IDBDatabase*, IDBTransaction*, ExceptionState&); |
| 49 void unobserve(IDBDatabase*, ExceptionState&); | 47 void unobserve(IDBDatabase*, ExceptionState&); |
| 50 | 48 |
| 51 DECLARE_TRACE(); | 49 DECLARE_TRACE(); |
| 52 | 50 |
| 53 private: | 51 private: |
| 54 IDBObserver(ScriptState*, IDBObserverCallback*, const IDBObserverInit&); | 52 IDBObserver(IDBObserverCallback*, const IDBObserverInit&); |
| 55 | 53 |
| 56 RefPtr<ScriptState> m_scriptState; | |
| 57 Member<IDBObserverCallback> m_callback; | 54 Member<IDBObserverCallback> m_callback; |
| 58 bool m_transaction; | 55 bool m_transaction; |
| 59 bool m_values; | 56 bool m_values; |
| 60 bool m_noRecords; | 57 bool m_noRecords; |
| 61 // Operation type bits are set corresponding to WebIDBOperationType. | 58 // Operation type bits are set corresponding to WebIDBOperationType. |
| 62 std::bitset<WebIDBOperationTypeCount> m_operationTypes; | 59 std::bitset<WebIDBOperationTypeCount> m_operationTypes; |
| 63 HeapHashMap<int32_t, WeakMember<IDBDatabase>> m_observerIds; | 60 HeapHashMap<int32_t, WeakMember<IDBDatabase>> m_observerIds; |
| 64 }; | 61 }; |
| 65 | 62 |
| 66 } // namespace blink | 63 } // namespace blink |
| 67 | 64 |
| 68 #endif // IDBObserver_h | 65 #endif // IDBObserver_h |
| OLD | NEW |