tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

PBackgroundIDBSharedTypes.ipdlh (5559B)


      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 PBackgroundIDBDatabaseFile;
      6 
      7 include DOMTypes;
      8 include IPCBlob;
      9 include ProtocolTypes;
     10 
     11 include "mozilla/dom/indexedDB/SerializationHelpers.h";
     12 include "mozilla/dom/quota/SerializationHelpers.h";
     13 
     14 using struct mozilla::null_t from "mozilla/ipc/IPCCore.h";
     15 
     16 using struct mozilla::void_t from "mozilla/ipc/IPCCore.h";
     17 
     18 using mozilla::dom::IDBCursor::Direction
     19   from "mozilla/dom/IDBCursor.h";
     20 
     21 using mozilla::dom::indexedDB::StructuredCloneFileBase::FileType
     22   from "mozilla/dom/IndexedDatabase.h";
     23 
     24 using class mozilla::dom::indexedDB::Key
     25   from "mozilla/dom/indexedDB/Key.h";
     26 
     27 using class mozilla::dom::indexedDB::KeyPath
     28   from "mozilla/dom/indexedDB/KeyPath.h";
     29 
     30 using mozilla::dom::quota::PersistenceType
     31   from "mozilla/dom/quota/PersistenceType.h";
     32 
     33 [MoveOnly=data] using mozilla::SerializedStructuredCloneBuffer
     34   from "mozilla/ipc/SerializedStructuredCloneBuffer.h";
     35 
     36 namespace mozilla {
     37 namespace dom {
     38 namespace indexedDB {
     39 
     40 struct SerializedKeyRange
     41 {
     42   Key lower;
     43   Key upper;
     44   bool lowerOpen;
     45   bool upperOpen;
     46   bool isOnly;
     47 };
     48 
     49 union NullableBlob
     50 {
     51   null_t;
     52   IPCBlob;
     53 };
     54 
     55 struct SerializedStructuredCloneFile
     56 {
     57   NullableBlob file;
     58   FileType type;
     59 };
     60 
     61 struct SerializedStructuredCloneReadInfo
     62 {
     63   SerializedStructuredCloneBuffer data;
     64   SerializedStructuredCloneFile[] files;
     65   bool hasPreprocessInfo;
     66 };
     67 
     68 struct SerializedStructuredCloneWriteInfo
     69 {
     70   SerializedStructuredCloneBuffer data;
     71   uint64_t offsetToKeyProp;
     72 };
     73 
     74 struct IndexUpdateInfo
     75 {
     76   int64_t indexId;
     77   Key value;
     78   Key localizedValue;
     79 };
     80 
     81 struct DatabaseMetadata
     82 {
     83   nsString name;
     84   uint64_t version;
     85   PersistenceType persistenceType;
     86 };
     87 
     88 struct ObjectStoreMetadata
     89 {
     90   int64_t id;
     91   nsString name;
     92   KeyPath keyPath;
     93   bool autoIncrement;
     94 };
     95 
     96 struct IndexMetadata
     97 {
     98   int64_t id;
     99   nsString name;
    100   KeyPath keyPath;
    101   nsCString locale;
    102   bool unique;
    103   bool multiEntry;
    104   bool autoLocale;
    105 };
    106 
    107 struct DatabaseSpec
    108 {
    109   DatabaseMetadata metadata;
    110   ObjectStoreSpec[] objectStores;
    111 };
    112 
    113 struct ObjectStoreSpec
    114 {
    115   ObjectStoreMetadata metadata;
    116   IndexMetadata[] indexes;
    117 };
    118 
    119 struct CommonOpenCursorParams
    120 {
    121   int64_t objectStoreId;
    122   SerializedKeyRange? optionalKeyRange;
    123   Direction direction;
    124 };
    125 
    126 struct ObjectStoreOpenCursorParams
    127 {
    128   CommonOpenCursorParams commonParams;
    129 };
    130 
    131 struct ObjectStoreOpenKeyCursorParams
    132 {
    133   CommonOpenCursorParams commonParams;
    134 };
    135 
    136 struct CommonIndexOpenCursorParams
    137 {
    138   CommonOpenCursorParams commonParams;
    139   int64_t indexId;
    140 };
    141 
    142 struct IndexOpenCursorParams
    143 {
    144   CommonIndexOpenCursorParams commonIndexParams;
    145 };
    146 
    147 struct IndexOpenKeyCursorParams
    148 {
    149   CommonIndexOpenCursorParams commonIndexParams;
    150 };
    151 
    152 // TODO: Actually, using a union here is not very nice, unless IPDL supported
    153 // struct inheritance. Alternatively, if IPDL supported enums, we could merge
    154 // the subtypes into one. Using a plain integer for discriminating the
    155 // subtypes would be too error-prone.
    156 union OpenCursorParams
    157 {
    158   ObjectStoreOpenCursorParams;
    159   ObjectStoreOpenKeyCursorParams;
    160   IndexOpenCursorParams;
    161   IndexOpenKeyCursorParams;
    162 };
    163 
    164 struct FileAddInfo
    165 {
    166   PBackgroundIDBDatabaseFile file;
    167   FileType type;
    168 };
    169 
    170 struct ObjectStoreAddPutParams
    171 {
    172   int64_t objectStoreId;
    173   SerializedStructuredCloneWriteInfo cloneInfo;
    174   Key key;
    175   IndexUpdateInfo[] indexUpdateInfos;
    176   FileAddInfo[] fileAddInfos;
    177 };
    178 
    179 struct ObjectStoreAddParams
    180 {
    181   ObjectStoreAddPutParams commonParams;
    182 };
    183 
    184 struct ObjectStorePutParams
    185 {
    186   ObjectStoreAddPutParams commonParams;
    187 };
    188 
    189 struct ObjectStoreGetParams
    190 {
    191   int64_t objectStoreId;
    192   SerializedKeyRange keyRange;
    193 };
    194 
    195 struct ObjectStoreGetKeyParams
    196 {
    197   int64_t objectStoreId;
    198   SerializedKeyRange keyRange;
    199 };
    200 
    201 struct ObjectStoreGetAllParams
    202 {
    203   int64_t objectStoreId;
    204   SerializedKeyRange? optionalKeyRange;
    205   uint32_t limit;
    206 };
    207 
    208 struct ObjectStoreGetAllKeysParams
    209 {
    210   int64_t objectStoreId;
    211   SerializedKeyRange? optionalKeyRange;
    212   uint32_t limit;
    213 };
    214 
    215 struct ObjectStoreDeleteParams
    216 {
    217   int64_t objectStoreId;
    218   SerializedKeyRange keyRange;
    219 };
    220 
    221 struct ObjectStoreClearParams
    222 {
    223   int64_t objectStoreId;
    224 };
    225 
    226 struct ObjectStoreCountParams
    227 {
    228   int64_t objectStoreId;
    229   SerializedKeyRange? optionalKeyRange;
    230 };
    231 
    232 struct IndexGetParams
    233 {
    234   int64_t objectStoreId;
    235   int64_t indexId;
    236   SerializedKeyRange keyRange;
    237 };
    238 
    239 struct IndexGetKeyParams
    240 {
    241   int64_t objectStoreId;
    242   int64_t indexId;
    243   SerializedKeyRange keyRange;
    244 };
    245 
    246 struct IndexGetAllParams
    247 {
    248   int64_t objectStoreId;
    249   int64_t indexId;
    250   SerializedKeyRange? optionalKeyRange;
    251   uint32_t limit;
    252 };
    253 
    254 struct IndexGetAllKeysParams
    255 {
    256   int64_t objectStoreId;
    257   int64_t indexId;
    258   SerializedKeyRange? optionalKeyRange;
    259   uint32_t limit;
    260 };
    261 
    262 struct IndexCountParams
    263 {
    264   int64_t objectStoreId;
    265   int64_t indexId;
    266   SerializedKeyRange? optionalKeyRange;
    267 };
    268 
    269 union RequestParams
    270 {
    271   ObjectStoreAddParams;
    272   ObjectStorePutParams;
    273   ObjectStoreGetParams;
    274   ObjectStoreGetKeyParams;
    275   ObjectStoreGetAllParams;
    276   ObjectStoreGetAllKeysParams;
    277   ObjectStoreDeleteParams;
    278   ObjectStoreClearParams;
    279   ObjectStoreCountParams;
    280   IndexGetParams;
    281   IndexGetKeyParams;
    282   IndexGetAllParams;
    283   IndexGetAllKeysParams;
    284   IndexCountParams;
    285 };
    286 
    287 struct LoggingInfo
    288 {
    289   nsID backgroundChildLoggingId;
    290   int64_t nextTransactionSerialNumber;
    291   int64_t nextVersionChangeTransactionSerialNumber;
    292   uint64_t nextRequestSerialNumber;
    293 };
    294 
    295 } // namespace indexedDB
    296 } // namespace dom
    297 } // namespace mozilla