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

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

Issue 2125213002: [IndexedDB] Propogating changes to observers : Renderer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lifetime
Patch Set: Implements IDBObserverChanges IDL records map 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
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"
17 #include "third_party/WebKit/public/platform/modules/indexeddb/WebIDBTypes.h"
13 18
14 namespace content { 19 namespace content {
15 20
16 class CONTENT_EXPORT IndexedDBObserver { 21 class CONTENT_EXPORT IndexedDBObserver {
17 public: 22 public:
18 IndexedDBObserver(int32_t observer_id); 23 // TODO(palakj): Modify constructor to add operation_type.
24 IndexedDBObserver(int32_t observer_id,
25 std::set<int64_t> object_store_ids,
26 bool includeTransaction,
27 bool noRecords,
28 bool values);
19 ~IndexedDBObserver(); 29 ~IndexedDBObserver();
20 30
21 int32_t id() const { return observer_id_; } 31 int32_t id() const { return id_; }
32 const std::set<int64_t>& GetObjectStoreIds() const {
33 return object_store_ids_;
34 }
35 bool IsRecordingType(blink::WebIDBOperationType type) const {
36 DCHECK_NE(type, blink::WebIDBOperationTypeCount);
37 return operation_type_[type];
38 }
39 bool IsRecordingObjectStore(int64_t object_store_id) const {
40 return ContainsValue(object_store_ids_, object_store_id);
41 }
42 bool include_transaction() const { return include_transaction_; }
43 bool no_records() const { return no_records_; }
44 bool values() const { return values_; }
22 45
23 private: 46 private:
24 int32_t observer_id_; 47 int32_t id_;
48 std::set<int64_t> object_store_ids_;
49 bool include_transaction_, no_records_, values_;
50 // operation_type_ indicates whether each operation type { ADD, PUT, DELETE,
51 // CLEAR } is to be recorded or not.
52 bool operation_type_[blink::WebIDBOperationTypeCount] = {true};
Marijn Kruisselbrink 2016/07/13 17:58:44 Any particular reason why the default value for op
palakj1 2016/07/13 22:48:37 Yes. We will be initializing the values in the con
25 53
26 DISALLOW_COPY_AND_ASSIGN(IndexedDBObserver); 54 DISALLOW_COPY_AND_ASSIGN(IndexedDBObserver);
27 }; 55 };
28 56
29 } // namespace content 57 } // namespace content
30 58
31 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_OBSERVER_H_ 59 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_OBSERVER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698