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

Unified Diff: third_party/WebKit/Source/modules/indexeddb/indexed_db.mojom

Issue 1963293002: Replacing Indexed DB Chromium IPC with Mojo Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Refactoring after Passing URLRequestContextGetter. Created 4 years, 4 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: third_party/WebKit/Source/modules/indexeddb/indexed_db.mojom
diff --git a/third_party/WebKit/Source/modules/indexeddb/indexed_db.mojom b/third_party/WebKit/Source/modules/indexeddb/indexed_db.mojom
new file mode 100644
index 0000000000000000000000000000000000000000..21a58aa5ff203eb745ee61675fcb5822b9608d00
--- /dev/null
+++ b/third_party/WebKit/Source/modules/indexeddb/indexed_db.mojom
@@ -0,0 +1,250 @@
+// 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.
+
+module indexed_db.mojom;
+
+import "url/mojo/origin.mojom";
+
+enum KeyPathType {
+ NONE,
+ STRING,
+ ARRAY,
+};
+
+enum CursorDirection {
+ Next,
+ NextNoDuplicate,
+ Prev,
+ PrevNoDuplicate,
+ Last = PrevNoDuplicate,
+};
+
+enum PutMode {
+ AddOrUpdate,
+ AddOnly,
+ CursorUpdate,
+ Last = CursorUpdate,
+};
+
+enum TaskType {
+ Normal,
+ Preemptive,
+ Last = Preemptive,
+};
+
+enum DataLoss {
+ None,
+ Total,
+};
+
+enum KeyType {
+ Invalid,
+ Array,
+ Binary,
+ String,
+ Date,
+ Number,
+};
+
+enum TransactionMode {
+ ReadOnly,
+ ReadWrite,
+ VersionChange,
+};
+
+union KeyPathData {
+ string str;
+ array<string> arr;
+};
+
+union KeyData {
+ array<Key> array_data;
+ array<uint8> binary_data;
+ string string_data;
+ double date;
+ double number;
+};
+
+struct DataLossInfo {
+ DataLoss status;
+ string message;
+};
+
+// TODO(cmumford): Can we make KeyPath a union, and pass a NULL value for type none?
+struct KeyPath {
+ KeyPathType type;
+ KeyPathData data;
+};
+
+struct Key {
+ KeyData data;
+ KeyType type;
+};
+
+struct KeyRange {
+ Key upper;
+ Key lower;
+ bool upper_open;
+ bool lower_open;
+};
+
+struct BlobInfo {
+ bool is_file;
+ string uuid;
+ string type; // MIME type
+ int64 size;
+ string file_path; // Only for File
+ string file_name; // Only for File
+ double last_modified; // Only for File
+};
+
+struct IndexMetadata {
+ string name;
+ KeyPath key_path;
+ bool unique = false;
+ bool multi_entry = false;
+ int64 id;
+};
+
+struct ObjectStoreMetadata {
+ string name;
+ KeyPath key_path;
+ bool auto_increment = false;
+ int64 id;
+ int64 max_index_id;
+ map<int64, IndexMetadata> indexes;
+};
+
+struct Value {
+ array<int8> data;
+ array<BlobInfo> blob_info;
+ // The auto-generated primary key and key path. Both are set when IDB is
+ // generating keys (and not JavaScript). Optional; If set then a property
+ // named |key_path| will be set to |primary_key| on the deserialized |data|
+ // object before calling the event handler.
+ Key primary_key;
+ KeyPath key_path;
+};
+
+struct DatabaseMetadata {
+
+ const int64 NoVersion = -1;
+
+ string name;
+ int64 version;
+ int64 id;
+ int64 max_object_store_id;
+ map<int64, ObjectStoreMetadata> object_stores;
+};
+
+struct ErrorInfo {
+ int16 code;
+ string message;
+};
+
+union GetResult {
+ ErrorInfo error;
+};
+
+// Data for a newly opened database connection.
+struct DatabaseOpenData {
+ Database database;
+ DatabaseMetadata metadata;
+};
+
+union OpenResult {
+ DatabaseOpenData data;
+ ErrorInfo error;
+};
+
+// An observer that lives for the lifetime of an open database connection. Used
+// by the server to send unsolicited messages to the client.
+interface DatabaseObserver {
+ OnTransactionAborted(int64 host_transaction_id, ErrorInfo error);
+ OnTransactionCompleted(int64 host_transaction_id);
+ OnForcedClosed();
+ OnVersionChange(int64 old_version, int64 new_version);
+};
+
+// Used during database open and delete. Maps to IDBOpenDBRequest.
+interface OpenRequestObserver {
+ OnBlocked(int64 old_version);
+ OnUpgradeNeeded(int64 old_version, Database database, DatabaseMetadata metadata, DataLossInfo dataLoss);
+};
+
+interface DatabaseFactory {
+
+ Open(string name, int64 version, int64 transaction_id,
+ url.mojom.Origin origin, OpenRequestObserver open_observer,
+ DatabaseObserver database_observer)
+ => (OpenResult out);
+
+ GetDatabaseNames(url.mojom.Origin origin);
+
+ DeleteDatabase(string name, url.mojom.Origin origin);
+};
+
+interface Database {
+
+ const int64 minimumIndexId = 30;
+
+ CreateObjectStore(int64 transaction_id, int64 object_store_id, string name,
+ KeyPath key_path, bool auto_increment);
+
+ Close();
+
+ DeleteObjectStore(int64 transaction_id, int64 object_store_id);
+
+ CreateTransaction(int64 transaction_id, array<int64> scope,
+ TransactionMode transaction_mode);
+
+ VersionChangeIgnored();
+
+ Abort(int64 transaction_id);
+
+ Commit(int64 transaction_id);
+
+ Get(int64 transaction_id, int64 object_store_id, int64 index_id,
+ KeyRange key_range, bool key_only) => (GetResult out);
+
+ GetAll(int64 transaction_id, int64 object_store_id, int64 index_id,
+ KeyRange key_range, int64 max_count, bool key_only);
+
+ Put(int64 transaction_id, int64 object_store_id, array<int8> value,
+ array<BlobInfo> blob_info, Key key, PutMode put_mode,
+ array<int64> index_ids, array<array<Key>> index_keys);
+
+ DeleteRange(int64 transaction_id, int64 object_store_id, KeyRange key_range);
+
+ Clear(int64 transaction_id, int64 object_store_id);
+
+ CreateIndex(int64 transaction_id, int64 object_store_id, int64 index_id,
+ string name, KeyPath key_path, bool unique, bool multi_entry);
+
+ DeleteIndex(int64 transaction_id, int64 object_store_id, int64 index_id);
+
+ SetIndexKeys(int64 transaction_id, int64 object_store_id, Key primary_key,
+ array<int64> index_ids, array<array<Key>> index_keys);
+
+ SetIndexesReady(int64 transaction_id, int64 object_store_id,
+ array<int64> index_ids);
+
+ OpenCursor(int64 transaction_id, int64 object_store_id, int64 index_id,
+ KeyRange key_range, CursorDirection direction, bool key_only,
+ TaskType task_type);
+
+ Count(int64 transaction_id, int64 object_store_id, int64 index_id,
+ KeyRange key_range);
+
+ AckReceivedBlobs(array<string> uuids);
+};
+
+interface Cursor {
+
+ Advance(uint32 count);
+
+ ContinueFunction(Key key, Key primary_key);
+
+ PostSuccessHandlerCallback();
+};

Powered by Google App Engine
This is Rietveld 408576698