|
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- |
|
2 * vim: sw=2 ts=8 et : |
|
3 */ |
|
4 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
5 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
7 |
|
8 include protocol PLayerTransaction; |
|
9 |
|
10 namespace mozilla { |
|
11 namespace layers { |
|
12 |
|
13 /** |
|
14 * PLayer represents a layer shared across thread contexts. |
|
15 */ |
|
16 |
|
17 async protocol PLayer { |
|
18 manager PLayerTransaction; |
|
19 |
|
20 /** |
|
21 * OWNERSHIP MODEL |
|
22 * |
|
23 * Roughly speaking, the child side "actually owns" a Layer. This |
|
24 * is because the parent side is the "shadow"; when the child |
|
25 * releases a Layer, the parent's shadow is no longer meaningful. |
|
26 * |
|
27 * To implement this model, the concrete PLayerParent keeps a |
|
28 * strong ref to its Layer, so the Layer's lifetime is bound to |
|
29 * the PLayerParent's. Then, when the Layer's refcount hits 0 on |
|
30 * the child side, we send __delete__() from the child to parent. |
|
31 * The parent then releases its Layer, which results in the Layer |
|
32 * being deleted "soon" (usually immediately). |
|
33 */ |
|
34 parent: |
|
35 async __delete__(); |
|
36 }; |
|
37 |
|
38 } // layers |
|
39 } // mozilla |