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 CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_OBSERVER_H_ | 5 #ifndef CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_OBSERVER_H_ |
6 #define CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_OBSERVER_H_ | 6 #define CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_OBSERVER_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
11 #include <set> | |
12 #include <vector> | |
13 | |
11 #include "base/macros.h" | 14 #include "base/macros.h" |
15 #include "base/stl_util.h" | |
12 #include "content/common/content_export.h" | 16 #include "content/common/content_export.h" |
13 | 17 |
14 namespace content { | 18 namespace content { |
15 | 19 |
16 class CONTENT_EXPORT IndexedDBObserver { | 20 class CONTENT_EXPORT IndexedDBObserver { |
17 public: | 21 public: |
18 IndexedDBObserver(int32_t observer_id); | 22 IndexedDBObserver(int32_t observer_id, std::set<int64_t> object_store_ids); |
19 ~IndexedDBObserver(); | 23 ~IndexedDBObserver(); |
20 | 24 |
21 int32_t id() const { return observer_id_; } | 25 int32_t id() const { return id_; } |
26 const std::set<int64_t>& GetObjectStoreIds() const { | |
27 return object_store_ids_; | |
28 } | |
29 bool IsRecordingType(int32_t type_index) const { | |
30 return operation_type_[type_index]; | |
cmumford
2016/07/07 21:14:21
When is operation_type_ set?
palakj1
2016/07/08 17:37:56
Sorry, this is still a wip. I should have mentione
| |
31 } | |
32 bool IsRecordingObjectStore(int32_t object_store_id) const { | |
33 return ContainsValue(object_store_ids_, object_store_id); | |
34 } | |
22 | 35 |
23 private: | 36 private: |
24 int32_t observer_id_; | 37 int32_t id_; |
38 std::set<int64_t> object_store_ids_; | |
39 // operation_type_ indicates whether each operation type { ADD, PUT, DELETE, | |
40 // CLEAR } is to be recorded or not. | |
41 bool operation_type_[4] = {false}; | |
cmumford
2016/07/07 21:14:21
using a int32_t (above in IsRecordingType) and [4]
palakj1
2016/07/08 17:37:56
Thanks. Done.
| |
25 | 42 |
26 DISALLOW_COPY_AND_ASSIGN(IndexedDBObserver); | 43 DISALLOW_COPY_AND_ASSIGN(IndexedDBObserver); |
27 }; | 44 }; |
28 | 45 |
29 } // namespace content | 46 } // namespace content |
30 | 47 |
31 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_OBSERVER_H_ | 48 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_OBSERVER_H_ |
OLD | NEW |