Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 8 -*- */ |
michael@0 | 2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | include protocol PPluginInstance; |
michael@0 | 7 | |
michael@0 | 8 | |
michael@0 | 9 | using mozilla::plugins::Buffer from "mozilla/plugins/PluginMessageUtils.h"; |
michael@0 | 10 | using mozilla::plugins::IPCByteRanges from "mozilla/plugins/PluginMessageUtils.h"; |
michael@0 | 11 | |
michael@0 | 12 | using NPError from "npapi.h"; |
michael@0 | 13 | using NPReason from "npapi.h"; |
michael@0 | 14 | |
michael@0 | 15 | namespace mozilla { |
michael@0 | 16 | namespace plugins { |
michael@0 | 17 | |
michael@0 | 18 | /** |
michael@0 | 19 | * NPBrowserStream represents a NPStream sent from the browser to the plugin. |
michael@0 | 20 | */ |
michael@0 | 21 | |
michael@0 | 22 | intr protocol PBrowserStream |
michael@0 | 23 | { |
michael@0 | 24 | manager PPluginInstance; |
michael@0 | 25 | |
michael@0 | 26 | child: |
michael@0 | 27 | async Write(int32_t offset, Buffer data, |
michael@0 | 28 | uint32_t newlength); |
michael@0 | 29 | async NPP_StreamAsFile(nsCString fname); |
michael@0 | 30 | |
michael@0 | 31 | /** |
michael@0 | 32 | * NPP_DestroyStream may race with other messages: the child acknowledges |
michael@0 | 33 | * the message with StreamDestroyed before this actor is deleted. |
michael@0 | 34 | */ |
michael@0 | 35 | async NPP_DestroyStream(NPReason reason); |
michael@0 | 36 | async __delete__(); |
michael@0 | 37 | |
michael@0 | 38 | parent: |
michael@0 | 39 | intr NPN_RequestRead(IPCByteRanges ranges) |
michael@0 | 40 | returns (NPError result); |
michael@0 | 41 | async NPN_DestroyStream(NPReason reason); |
michael@0 | 42 | async StreamDestroyed(); |
michael@0 | 43 | |
michael@0 | 44 | /* |
michael@0 | 45 | TODO: turn on state machine. |
michael@0 | 46 | |
michael@0 | 47 | // need configurable start state: if the constructor |
michael@0 | 48 | // returns an error in result, start state should |
michael@0 | 49 | // be DELETING. |
michael@0 | 50 | start state ALIVE: |
michael@0 | 51 | send Write goto ALIVE; |
michael@0 | 52 | call NPP_StreamAsFile goto ALIVE; |
michael@0 | 53 | send NPP_DestroyStream goto ALIVE; |
michael@0 | 54 | answer NPN_RequestRead goto ALIVE; |
michael@0 | 55 | recv NPN_DestroyStream goto DYING; |
michael@0 | 56 | |
michael@0 | 57 | state DYING: |
michael@0 | 58 | answer NPN_RequestRead goto DYING; |
michael@0 | 59 | recv NPN_DestroyStream goto DYING; |
michael@0 | 60 | recv StreamDestroyed goto DELETING; |
michael@0 | 61 | |
michael@0 | 62 | state DELETING: |
michael@0 | 63 | send __delete__; |
michael@0 | 64 | */ |
michael@0 | 65 | }; |
michael@0 | 66 | |
michael@0 | 67 | } // namespace plugins |
michael@0 | 68 | } // namespace mozilla |