Chromium Code Reviews| Index: content/browser/indexed_db/indexed_db_observer.h |
| diff --git a/content/browser/indexed_db/indexed_db_observer.h b/content/browser/indexed_db/indexed_db_observer.h |
| index f7bd95985a3b280865f63303b9e44faaf4578ff7..efb0d1244b3340a871f710b81df0c9d97bb27fb6 100644 |
| --- a/content/browser/indexed_db/indexed_db_observer.h |
| +++ b/content/browser/indexed_db/indexed_db_observer.h |
| @@ -8,20 +8,57 @@ |
| #include <stddef.h> |
| #include <stdint.h> |
| +#include <bitset> |
| +#include <set> |
| + |
| #include "base/macros.h" |
| +#include "base/stl_util.h" |
| #include "content/common/content_export.h" |
| +#include "third_party/WebKit/public/platform/modules/indexeddb/WebIDBTypes.h" |
| namespace content { |
| class CONTENT_EXPORT IndexedDBObserver { |
| public: |
| - IndexedDBObserver(int32_t observer_id); |
| + struct Options { |
| + bool include_transaction; |
| + bool no_records; |
| + bool values; |
| + // Operation types and corresponding bits are add(0), put(1), delete(2), |
|
jsbell
2016/07/18 23:38:57
Change the comment to reference WebIDBOperationTyp
palakj1
2016/07/19 03:53:11
Done.
|
| + // clear(3). |
| + std::bitset<blink::WebIDBOperationTypeCount> operation_types; |
| + |
| + explicit Options(bool include_transaction, |
| + bool no_records, |
| + bool values, |
| + unsigned short types); |
| + Options(const Options&); |
| + ~Options(); |
| + }; |
| + IndexedDBObserver(int32_t observer_id, |
| + std::set<int64_t> object_store_ids, |
| + Options options); |
| ~IndexedDBObserver(); |
| - int32_t id() const { return observer_id_; } |
| + int32_t id() const { return id_; } |
| + const std::set<int64_t>& GetObjectStoreIds() const { |
|
jsbell
2016/07/18 23:38:57
Since it's a simple accessor, could be named: obje
palakj1
2016/07/19 03:53:11
Done
|
| + return object_store_ids_; |
| + } |
| + bool IsRecordingType(blink::WebIDBOperationType type) const { |
| + DCHECK_NE(type, blink::WebIDBOperationTypeCount); |
| + return options_.operation_types[type]; |
| + } |
| + bool IsRecordingObjectStore(int64_t object_store_id) const { |
| + return ContainsValue(object_store_ids_, object_store_id); |
| + } |
| + bool include_transaction() const { return options_.include_transaction; } |
| + bool no_records() const { return options_.no_records; } |
| + bool values() const { return options_.values; } |
| private: |
| - int32_t observer_id_; |
| + int32_t id_; |
| + std::set<int64_t> object_store_ids_; |
| + Options options_; |
| DISALLOW_COPY_AND_ASSIGN(IndexedDBObserver); |
| }; |