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/. */
5 include protocol PBackground;
6 include protocol PBackgroundLSDatabase;
8 include PBackgroundLSSharedTypes;
10 include "mozilla/dom/localstorage/SerializationHelpers.h";
12 using mozilla::dom::LSValue
13 from "mozilla/dom/LSValue.h";
24 struct LSRemoveItemInfo
34 * Union of LocalStorage mutation types.
43 struct LSSetItemAndNotifyInfo
50 struct LSRemoveItemAndNotifyInfo
57 * Union of LocalStorage mutation types.
59 union LSWriteAndNotifyInfo
61 LSSetItemAndNotifyInfo;
62 LSRemoveItemAndNotifyInfo;
66 [ManualDealloc, ChildImpl=virtual, ParentImpl=virtual]
67 sync protocol PBackgroundLSSnapshot
69 manager PBackgroundLSDatabase;
74 async AsyncCheckpoint(LSWriteInfo[] writeInfos);
76 async AsyncCheckpointAndNotify(LSWriteAndNotifyInfo[] writeAndNotifyInfos);
78 // A synchronous checkpoint. This should only be used by the snapshotting code
79 // to checkpoint an explicit snapshot.
80 sync SyncCheckpoint(LSWriteInfo[] writeInfos);
82 // A synchronous checkpoint and notify. This should only be used by the
83 // snapshotting code to checkpoint and notify an explicit snapshot.
84 sync SyncCheckpointAndNotify(LSWriteAndNotifyInfo[] writeAndNotifyInfos);
88 // A synchronous finish. This should only be used by the snapshotting code to
89 // end an explicit snapshot.
95 * Invoked on demand to load an item that didn't fit into the initial
96 * snapshot prefill and also some additional key/value pairs to lower down
97 * the need to use this synchronous message again.
99 * This needs to be synchronous because LocalStorage's semantics are
100 * synchronous. Note that the Snapshot in the PBackground parent already
101 * has the answers to this request immediately available without needing to
102 * consult any other threads or perform any I/O.
104 sync LoadValueAndMoreItems(nsString key)
105 returns (LSValue value, LSItemInfo[] itemInfos);
108 * Invoked on demand to load all keys in in their canonical order if they
109 * didn't fit into the initial snapshot prefill.
111 * This needs to be synchronous because LocalStorage's semantics are
112 * synchronous. Note that the Snapshot in the PBackground parent already
113 * has the answers to this request immediately available without needing to
114 * consult any other threads or perform any I/O.
117 returns (nsString[] keys);
120 * This needs to be synchronous because LocalStorage's semantics are
121 * synchronous. Note that the Snapshot in the PBackground parent typically
122 * doesn't need to consult any other threads or perform any I/O to handle
123 * this request. However, it has to call a quota manager method that can
124 * potentially do I/O directly on the PBackground thread. It can only happen
125 * rarely in a storage pressure (low storage space) situation. Specifically,
126 * after we get a list of origin directories for eviction, we will delete
127 * them directly on the PBackground thread. This doesn't cause any
128 * performance problems, but avoiding I/O completely might need to be done as
129 * a futher optimization.
131 sync IncreasePeakUsage(int64_t minSize)
132 returns (int64_t size);
136 * Compels the child LSSnapshot to Checkpoint() and Finish(), effectively
137 * compelling the snapshot to flush any issued mutations and close itself.
138 * The child LSSnapshot does that either immediately if it's just waiting
139 * to be reused or when it gets into a stable state.
141 * This message is expected to be sent in the following two cases only:
142 * 1. The state of the underlying Datastore starts to differ from the state
143 * captured at the time of snapshot creation.
144 * 2. The last private browsing context exits. And in that case we expect
145 * all private browsing globals to already have been destroyed.
153 } // namespace mozilla