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