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

Unified Diff: content/common/leveldb_wrapper.mojom

Issue 1837883003: Some fleshing out the mojo based localstorage implementation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
« no previous file with comments | « content/browser/storage_partition_impl.cc ('k') | content/common/storage_partition_service.mojom » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/common/leveldb_wrapper.mojom
diff --git a/content/common/leveldb_wrapper.mojom b/content/common/leveldb_wrapper.mojom
index b3949ca855d57ca8a9f6f0cb783f3e4150c6b878..0035ebc5558fa9975704df9ea7a0fd1e5d73307a 100644
--- a/content/common/leveldb_wrapper.mojom
+++ b/content/common/leveldb_wrapper.mojom
@@ -7,19 +7,19 @@ module content.mojom;
import "components/leveldb/public/interfaces/leveldb.mojom";
// Gives information about changes to a LevelDB database.
-// The reason this is a parameter to DeleteAll and GetAll below, instead of
-// being specified when opening a LevelDBWrapper, is to avoid the client getting
-// callbacks for changes that have already been applied to its database that
-// it's fetching via GetAll or it's clearing via DeleteAll.
-// In the methods below, |source| is a user-defined string which was passed to
-// the various LevelDBWrapper methods.
// Note that observer methods are called before the callbacks for the
// LevelDBWrapper methods are run.
interface LevelDBObserver {
+ KeyAdded(array<uint8> key, array<uint8> value, string source);
KeyChanged(array<uint8> key, array<uint8> new_value, array<uint8> old_value,
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 {
@@ -31,23 +31,21 @@ struct KeyValue {
// change.
interface LevelDBWrapper {
// Sets the database entry for |key| to |value|. Returns OK on success.
- Put(array<uint8> key, array<uint8> value, string source)
- => (leveldb.DatabaseError status);
+ Put(array<uint8> key, array<uint8> value, string source) => (bool success);
// Remove the database entry (if any) for |key|. Returns OK on success, and a
// non-OK status on error. It is not an error if |key| did not exist in the
// database.
- Delete(array<uint8> key, string source) => (leveldb.DatabaseError status);
+ Delete(array<uint8> key, string source) => (bool success);
// Removes all the entries.
- DeleteAll(LevelDBObserver observer, string source)
- => (leveldb.DatabaseError status);
+ DeleteAll(string source) => (bool success);
// Returns the value of the |key|.
- Get(array<uint8> key) => (leveldb.DatabaseError status, array<uint8> value);
+ Get(array<uint8> key) => (bool success, array<uint8> value);
// Only used with small databases. Returns all key/value pairs.
[Sync]
- GetAll(LevelDBObserver observer)
+ GetAll(string source)
=> (leveldb.DatabaseError status, array<KeyValue> data);
};
« no previous file with comments | « content/browser/storage_partition_impl.cc ('k') | content/common/storage_partition_service.mojom » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698