Chromium Code Reviews| Index: third_party/WebKit/Source/modules/indexeddb/IDBObserver.h |
| diff --git a/third_party/WebKit/Source/modules/indexeddb/IDBObserver.h b/third_party/WebKit/Source/modules/indexeddb/IDBObserver.h |
| index c85005677b75b4d05a78f5a7a8a103eb79d55a47..8f7a83c8748c0ae86dda842742d2f23141d01b75 100644 |
| --- a/third_party/WebKit/Source/modules/indexeddb/IDBObserver.h |
| +++ b/third_party/WebKit/Source/modules/indexeddb/IDBObserver.h |
| @@ -8,7 +8,9 @@ |
| #include "bindings/core/v8/ScriptWrappable.h" |
| #include "modules/ModulesExport.h" |
| #include "platform/heap/Handle.h" |
| -#include <set> |
| +#include "public/platform/WebVector.h" |
| +#include "public/platform/modules/indexeddb/WebIDBTypes.h" |
| +#include <bitset> |
| namespace blink { |
| @@ -17,6 +19,7 @@ class IDBDatabase; |
| class IDBObserverCallback; |
| class IDBObserverInit; |
| class IDBTransaction; |
| +struct WebIDBObservation; |
| class MODULES_EXPORT IDBObserver final : public GarbageCollectedFinalized<IDBObserver>, public ScriptWrappable { |
| DEFINE_WRAPPERTYPEINFO(); |
| @@ -25,10 +28,21 @@ public: |
| static IDBObserver* create(IDBObserverCallback&, const IDBObserverInit&); |
| ~IDBObserver(); |
| - // API methods |
| + |
| + void removeObserver(int32_t id); |
| + void onChange(int32_t id, const WebVector<WebIDBObservation>&, const WebVector<int32_t>& observationIndex); |
| + |
| + bool transaction() const { return m_transaction; } |
| + bool noRecords() const { return m_noRecords; } |
| + bool values() const { return m_values; } |
| + std::bitset<WebIDBOperationTypeCount> operationTypes() const |
|
jsbell
2016/07/18 23:38:57
Return a reference, rather than a copy.
palakj1
2016/07/19 03:53:11
Done
|
| + { |
| + return m_operationTypes; |
|
jsbell
2016/07/18 23:38:57
You can put this all on one line.
palakj1
2016/07/19 03:53:11
Done
|
| + } |
| + |
| + // Implement the IDBObserver IDL. |
| void observe(IDBDatabase*, IDBTransaction*, ExceptionState&); |
| void unobserve(IDBDatabase*, ExceptionState&); |
| - void removeObserver(int32_t id); |
| DECLARE_TRACE(); |
| @@ -39,7 +53,9 @@ private: |
| bool m_transaction; |
| bool m_values; |
| bool m_noRecords; |
| - std::set<int32_t> m_observerIds; |
| + // Operation types and corresponding bits are add(0), put(1), delete(2), clear(3). |
|
jsbell
2016/07/18 23:38:57
Can you reference WebIDBOperationType in the comme
palakj1
2016/07/19 03:53:11
Done
|
| + std::bitset<WebIDBOperationTypeCount> m_operationTypes; |
| + HeapHashMap<int32_t, WeakMember<IDBDatabase>> m_observerIds; |
| }; |
| } // namespace blink |