1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use ipc_channel::ipc::IpcSender;
use malloc_size_of_derive::MallocSizeOf;
use serde::{Deserialize, Serialize};
use servo_url::ServoUrl;
#[derive(Clone, Copy, Debug, Deserialize, MallocSizeOf, Serialize)]
pub enum StorageType {
Session,
Local,
}
/// Request operations on the storage data associated with a particular url
#[derive(Debug, Deserialize, Serialize)]
pub enum StorageThreadMsg {
/// gets the number of key/value pairs present in the associated storage data
Length(IpcSender<usize>, ServoUrl, StorageType),
/// gets the name of the key at the specified index in the associated storage data
Key(IpcSender<Option<String>>, ServoUrl, StorageType, u32),
/// Gets the available keys in the associated storage data
Keys(IpcSender<Vec<String>>, ServoUrl, StorageType),
/// gets the value associated with the given key in the associated storage data
GetItem(IpcSender<Option<String>>, ServoUrl, StorageType, String),
/// sets the value of the given key in the associated storage data
SetItem(
IpcSender<Result<(bool, Option<String>), ()>>,
ServoUrl,
StorageType,
String,
String,
),
/// removes the key/value pair for the given key in the associated storage data
RemoveItem(IpcSender<Option<String>>, ServoUrl, StorageType, String),
/// clears the associated storage data by removing all the key/value pairs
Clear(IpcSender<bool>, ServoUrl, StorageType),
/// send a reply when done cleaning up thread resources and then shut it down
Exit(IpcSender<()>),
}
|