PBackgroundIDBRequest.ipdl (3492B)
1 /* This Source Code Form is subject to the terms of the Mozilla Public 2 * License, v. 2.0. If a copy of the MPL was not distributed with this file, 3 * You can obtain one at http://mozilla.org/MPL/2.0/. */ 4 5 include protocol PBackgroundIDBTransaction; 6 include protocol PBackgroundIDBVersionChangeTransaction; 7 8 include PBackgroundIDBSharedTypes; 9 10 include "mozilla/dom/indexedDB/SerializationHelpers.h"; 11 include "mozilla/dom/indexedDB/ActorsChild.h"; 12 13 using struct mozilla::void_t from "mozilla/ipc/IPCCore.h"; 14 15 using class mozilla::dom::indexedDB::Key 16 from "mozilla/dom/indexedDB/Key.h"; 17 18 namespace mozilla { 19 namespace dom { 20 namespace indexedDB { 21 22 struct ObjectStoreAddResponse 23 { 24 Key key; 25 }; 26 27 struct ObjectStorePutResponse 28 { 29 Key key; 30 }; 31 32 struct ObjectStoreGetResponse 33 { 34 SerializedStructuredCloneReadInfo cloneInfo; 35 }; 36 37 struct ObjectStoreGetKeyResponse 38 { 39 Key key; 40 }; 41 42 struct ObjectStoreGetAllResponse 43 { 44 SerializedStructuredCloneReadInfo[] cloneInfos; 45 }; 46 47 struct ObjectStoreGetAllKeysResponse 48 { 49 Key[] keys; 50 }; 51 52 struct ObjectStoreDeleteResponse 53 { }; 54 55 struct ObjectStoreClearResponse 56 { }; 57 58 struct ObjectStoreCountResponse 59 { 60 uint64_t count; 61 }; 62 63 struct IndexGetResponse 64 { 65 SerializedStructuredCloneReadInfo cloneInfo; 66 }; 67 68 struct IndexGetKeyResponse 69 { 70 Key key; 71 }; 72 73 struct IndexGetAllResponse 74 { 75 SerializedStructuredCloneReadInfo[] cloneInfos; 76 }; 77 78 struct IndexGetAllKeysResponse 79 { 80 Key[] keys; 81 }; 82 83 struct IndexCountResponse 84 { 85 uint64_t count; 86 }; 87 88 union RequestResponse 89 { 90 nsresult; 91 ObjectStoreGetResponse; 92 ObjectStoreGetKeyResponse; 93 ObjectStoreAddResponse; 94 ObjectStorePutResponse; 95 ObjectStoreDeleteResponse; 96 ObjectStoreClearResponse; 97 ObjectStoreCountResponse; 98 ObjectStoreGetAllResponse; 99 ObjectStoreGetAllKeysResponse; 100 IndexGetResponse; 101 IndexGetKeyResponse; 102 IndexGetAllResponse; 103 IndexGetAllKeysResponse; 104 IndexCountResponse; 105 }; 106 107 struct PreprocessInfo 108 { 109 SerializedStructuredCloneFile[] files; 110 }; 111 112 struct ObjectStoreGetPreprocessParams 113 { 114 PreprocessInfo preprocessInfo; 115 }; 116 117 struct ObjectStoreGetAllPreprocessParams 118 { 119 PreprocessInfo[] preprocessInfos; 120 }; 121 122 union PreprocessParams 123 { 124 ObjectStoreGetPreprocessParams; 125 ObjectStoreGetAllPreprocessParams; 126 }; 127 128 struct ObjectStoreGetPreprocessResponse 129 { 130 }; 131 132 struct ObjectStoreGetAllPreprocessResponse 133 { 134 }; 135 136 // The nsresult is used if an error occurs for any preprocess request type. 137 // The specific response types are sent on success. 138 union PreprocessResponse 139 { 140 nsresult; 141 ObjectStoreGetPreprocessResponse; 142 ObjectStoreGetAllPreprocessResponse; 143 }; 144 145 [ManualDealloc, ChildImpl="indexedDB::BackgroundRequestChild", ParentImpl=virtual] 146 protocol PBackgroundIDBRequest 147 { 148 manager PBackgroundIDBTransaction or PBackgroundIDBVersionChangeTransaction; 149 150 parent: 151 async Continue(PreprocessResponse response); 152 153 child: 154 async __delete__(RequestResponse response); 155 156 // Preprocess is used in cases where response processing needs to do something 157 // asynchronous off of the child actor's thread before returning the actual 158 // result to user code. This is necessary because RequestResponse processing 159 // occurs in __delete__ and the PBackgroundIDBRequest implementations' 160 // life-cycles are controlled by IPC and are not otherwise reference counted. 161 // By introducing the (optional) Preprocess/Continue steps reference counting 162 // or the introduction of additional runnables are avoided. 163 async Preprocess(PreprocessParams params); 164 }; 165 166 } // namespace indexedDB 167 } // namespace dom 168 } // namespace mozilla