Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(950)

Side by Side Diff: content/browser/indexed_db/indexed_db_observer.h

Issue 2160163002: [IndexedDB] Propogating Changes to Observer : Browser (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Browser changes Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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 CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_OBSERVER_H_
6 #define CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_OBSERVER_H_
7
8 #include <stddef.h>
9 #include <stdint.h>
10
11 #include <bitset>
12 #include <set>
13
14 #include "base/macros.h"
15 #include "base/stl_util.h"
16 #include "content/common/content_export.h"
17 #include "third_party/WebKit/public/platform/modules/indexeddb/WebIDBTypes.h"
18
19 namespace content {
20
21 class CONTENT_EXPORT IndexedDBObserver {
22 public:
23 struct Options {
24 bool include_transaction;
25 bool no_records;
26 bool values;
27 // Each bit in operation type corresponds to blink::WebIDBOperationType
28 // values.
29 std::bitset<blink::WebIDBOperationTypeCount> operation_types;
30
31 explicit Options(bool include_transaction,
32 bool no_records,
33 bool values,
34 unsigned short types);
35 Options(const Options&);
36 ~Options();
37 };
38 IndexedDBObserver(int32_t observer_id,
39 std::set<int64_t> object_store_ids,
40 Options options);
41 ~IndexedDBObserver();
42
43 int32_t id() const { return id_; }
44 const std::set<int64_t>& object_store_ids() const {
45 return object_store_ids_;
46 }
47
48 bool IsRecordingType(blink::WebIDBOperationType type) const {
49 DCHECK_NE(type, blink::WebIDBOperationTypeCount);
50 return options_.operation_types[type];
51 }
52 bool IsRecordingObjectStore(int64_t object_store_id) const {
53 return ContainsValue(object_store_ids_, object_store_id);
54 }
55 bool include_transaction() const { return options_.include_transaction; }
56 bool no_records() const { return options_.no_records; }
57 bool values() const { return options_.values; }
58
59 private:
60 int32_t id_;
61 std::set<int64_t> object_store_ids_;
62 Options options_;
63
64 DISALLOW_COPY_AND_ASSIGN(IndexedDBObserver);
65 };
66
67 } // namespace content
68
69 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_OBSERVER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698