no bug - Bumping Firefox l10n changesets r=release a=l10n-bump DONTBUILD CLOSED TREE
[gecko.git] / dom / localstorage / PBackgroundLSSnapshot.ipdl
blob45c744c840cc970940eccda2fee914c99d33fd2a
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";
15 namespace mozilla {
16 namespace dom {
18 struct LSSetItemInfo
20   nsString key;
21   LSValue value;
24 struct LSRemoveItemInfo
26   nsString key;
29 struct LSClearInfo
33 /**
34  * Union of LocalStorage mutation types.
35  */
36 union LSWriteInfo
38   LSSetItemInfo;
39   LSRemoveItemInfo;
40   LSClearInfo;
43 struct LSSetItemAndNotifyInfo
45   nsString key;
46   LSValue oldValue;
47   LSValue value;
50 struct LSRemoveItemAndNotifyInfo
52   nsString key;
53   LSValue oldValue;
56 /**
57  * Union of LocalStorage mutation types.
58  */
59 union LSWriteAndNotifyInfo
61   LSSetItemAndNotifyInfo;
62   LSRemoveItemAndNotifyInfo;
63   LSClearInfo;
66 [ManualDealloc, ChildImpl=virtual, ParentImpl=virtual]
67 sync protocol PBackgroundLSSnapshot
69   manager PBackgroundLSDatabase;
71 parent:
72   async DeleteMe();
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);
86   async AsyncFinish();
88   // A synchronous finish. This should only be used by the snapshotting code to
89   // end an explicit snapshot.
90   sync SyncFinish();
92   async Loaded();
94   /**
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.
98    *
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.
103    */
104   sync LoadValueAndMoreItems(nsString key)
105     returns (LSValue value, LSItemInfo[] itemInfos);
107   /**
108    * Invoked on demand to load all keys in in their canonical order if they
109    * didn't fit into the initial snapshot prefill.
110    *
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.
115    */
116   sync LoadKeys()
117     returns (nsString[] keys);
119   /**
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.
130    */
131   sync IncreasePeakUsage(int64_t minSize)
132     returns (int64_t size);
134 child:
135   /**
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.
140    *
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.
146    */
147   async MarkDirty();
149   async __delete__();
152 } // namespace dom
153 } // namespace mozilla