michael@0: /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- michael@0: * vim: sw=2 ts=8 et : michael@0: */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: include protocol PLayerTransaction; michael@0: michael@0: namespace mozilla { michael@0: namespace layers { michael@0: michael@0: /** michael@0: * PLayer represents a layer shared across thread contexts. michael@0: */ michael@0: michael@0: async protocol PLayer { michael@0: manager PLayerTransaction; michael@0: michael@0: /** michael@0: * OWNERSHIP MODEL michael@0: * michael@0: * Roughly speaking, the child side "actually owns" a Layer. This michael@0: * is because the parent side is the "shadow"; when the child michael@0: * releases a Layer, the parent's shadow is no longer meaningful. michael@0: * michael@0: * To implement this model, the concrete PLayerParent keeps a michael@0: * strong ref to its Layer, so the Layer's lifetime is bound to michael@0: * the PLayerParent's. Then, when the Layer's refcount hits 0 on michael@0: * the child side, we send __delete__() from the child to parent. michael@0: * The parent then releases its Layer, which results in the Layer michael@0: * being deleted "soon" (usually immediately). michael@0: */ michael@0: parent: michael@0: async __delete__(); michael@0: }; michael@0: michael@0: } // layers michael@0: } // mozilla