PBackgroundLSSimpleRequest.ipdl (1673B)
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 PBackground; 6 7 include PBackgroundLSSharedTypes; 8 9 namespace mozilla { 10 namespace dom { 11 12 /** 13 * Response to a `LSSimpleRequestPreloadedParams` request indicating whether the 14 * origin was preloaded. 15 */ 16 struct LSSimpleRequestPreloadedResponse 17 { 18 bool preloaded; 19 }; 20 21 struct LSSimpleRequestGetStateResponse 22 { 23 LSItemInfo[] itemInfos; 24 }; 25 26 /** 27 * Discriminated union which can contain an error code (`nsresult`) or 28 * particular simple request response. 29 */ 30 union LSSimpleRequestResponse 31 { 32 nsresult; 33 LSSimpleRequestPreloadedResponse; 34 LSSimpleRequestGetStateResponse; 35 }; 36 37 /** 38 * Simple requests are async-only from both a protocol perspective and the 39 * manner in which they're used. In comparison, PBackgroundLSRequests are 40 * async only from a protocol perspective; they are used synchronously from the 41 * main thread via LSObject's RequestHelper mechanism. (With the caveat that 42 * nsILocalStorageManager does expose LSRequests asynchronously.) 43 * 44 * These requests use the common idiom where the arguments to the request are 45 * sent in the constructor and the result is sent in the __delete__ response. 46 * Request types are indicated by the Params variant used and those live in 47 * `PBackgroundLSSharedTypes.ipdlh`. 48 */ 49 [ManualDealloc, ChildImpl=virtual, ParentImpl=virtual] 50 protocol PBackgroundLSSimpleRequest 51 { 52 manager PBackground; 53 54 child: 55 async __delete__(LSSimpleRequestResponse response); 56 }; 57 58 } // namespace dom 59 } // namespace mozilla