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