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

Unified 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 side-by-side diff with in-line comments
Download patch
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
new file mode 100644
index 0000000000000000000000000000000000000000..c156a4e85ec5564f4f783bc5e797fcfb6bfd0b43
--- /dev/null
+++ b/content/browser/indexed_db/indexed_db_observer.h
@@ -0,0 +1,69 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_OBSERVER_H_
+#define CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_OBSERVER_H_
+
+#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:
+ struct Options {
+ bool include_transaction;
+ bool no_records;
+ bool values;
+ // Each bit in operation type corresponds to blink::WebIDBOperationType
+ // values.
+ 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 id_; }
+ const std::set<int64_t>& object_store_ids() const {
+ 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 id_;
+ std::set<int64_t> object_store_ids_;
+ Options options_;
+
+ DISALLOW_COPY_AND_ASSIGN(IndexedDBObserver);
+};
+
+} // namespace content
+
+#endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_OBSERVER_H_

Powered by Google App Engine
This is Rietveld 408576698