michael@0: /* -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 8 -*- */ 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 PPluginInstance; michael@0: michael@0: michael@0: using mozilla::plugins::Buffer from "mozilla/plugins/PluginMessageUtils.h"; michael@0: using mozilla::plugins::IPCByteRanges from "mozilla/plugins/PluginMessageUtils.h"; michael@0: michael@0: using NPError from "npapi.h"; michael@0: using NPReason from "npapi.h"; michael@0: michael@0: namespace mozilla { michael@0: namespace plugins { michael@0: michael@0: /** michael@0: * NPBrowserStream represents a NPStream sent from the browser to the plugin. michael@0: */ michael@0: michael@0: intr protocol PBrowserStream michael@0: { michael@0: manager PPluginInstance; michael@0: michael@0: child: michael@0: async Write(int32_t offset, Buffer data, michael@0: uint32_t newlength); michael@0: async NPP_StreamAsFile(nsCString fname); michael@0: michael@0: /** michael@0: * NPP_DestroyStream may race with other messages: the child acknowledges michael@0: * the message with StreamDestroyed before this actor is deleted. michael@0: */ michael@0: async NPP_DestroyStream(NPReason reason); michael@0: async __delete__(); michael@0: michael@0: parent: michael@0: intr NPN_RequestRead(IPCByteRanges ranges) michael@0: returns (NPError result); michael@0: async NPN_DestroyStream(NPReason reason); michael@0: async StreamDestroyed(); michael@0: michael@0: /* michael@0: TODO: turn on state machine. michael@0: michael@0: // need configurable start state: if the constructor michael@0: // returns an error in result, start state should michael@0: // be DELETING. michael@0: start state ALIVE: michael@0: send Write goto ALIVE; michael@0: call NPP_StreamAsFile goto ALIVE; michael@0: send NPP_DestroyStream goto ALIVE; michael@0: answer NPN_RequestRead goto ALIVE; michael@0: recv NPN_DestroyStream goto DYING; michael@0: michael@0: state DYING: michael@0: answer NPN_RequestRead goto DYING; michael@0: recv NPN_DestroyStream goto DYING; michael@0: recv StreamDestroyed goto DELETING; michael@0: michael@0: state DELETING: michael@0: send __delete__; michael@0: */ michael@0: }; michael@0: michael@0: } // namespace plugins michael@0: } // namespace mozilla