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

Unified Diff: content/common/leveldb_wrapper.mojom

Issue 2593503005: Don't abuse LevelDBObserver interface to pass GetAll result. (Closed)
Patch Set: modify sanity_check test to give async callbacks a chance to cause problems Created 4 years 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/common/leveldb_wrapper.mojom
diff --git a/content/common/leveldb_wrapper.mojom b/content/common/leveldb_wrapper.mojom
index 6295be0b9789a4075e1a7195e418557acb6022c6..e099618c3727e8a5442c9cf388ebf0aaecc61dff 100644
--- a/content/common/leveldb_wrapper.mojom
+++ b/content/common/leveldb_wrapper.mojom
@@ -15,11 +15,6 @@ interface LevelDBObserver {
string source);
KeyDeleted(array<uint8> key, array<uint8> old_value, string source);
AllDeleted(string source);
-
- // Since the GetAll call is synchronous, observers need this asynchronously
- // delivered notification to avoid applying changes to the returned array
- // that it already contains.
- GetAllComplete(string source);
};
struct KeyValue {
@@ -27,6 +22,16 @@ struct KeyValue {
array<uint8> value;
};
+// Since the GetAll call is synchronous, LevelDBWrapper users need this
+// asynchronously delivered notification to avoid applying changes to the
+// returned array that it already contains. This is not sent over the
+// normal LevelDBObserver interface as there can be many observers and
+// only the connection that made the GetAll call needs to be notified of
+// its completion.
+interface LevelDBWrapperGetAllCallback {
+ Complete(bool success);
+};
+
// A wrapper around leveldb that supports giving notifications when values
// change.
interface LevelDBWrapper {
@@ -48,6 +53,6 @@ interface LevelDBWrapper {
// Only used with small databases. Returns all key/value pairs.
[Sync]
- GetAll(string source)
+ GetAll(associated LevelDBWrapperGetAllCallback complete_callback)
=> (leveldb.mojom.DatabaseError status, array<KeyValue> data);
};

Powered by Google App Engine
This is Rietveld 408576698