|
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/. */ |
|
5 |
|
6 include protocol PPluginInstance; |
|
7 |
|
8 |
|
9 using mozilla::plugins::Buffer from "mozilla/plugins/PluginMessageUtils.h"; |
|
10 using mozilla::plugins::IPCByteRanges from "mozilla/plugins/PluginMessageUtils.h"; |
|
11 |
|
12 using NPError from "npapi.h"; |
|
13 using NPReason from "npapi.h"; |
|
14 |
|
15 namespace mozilla { |
|
16 namespace plugins { |
|
17 |
|
18 /** |
|
19 * NPBrowserStream represents a NPStream sent from the browser to the plugin. |
|
20 */ |
|
21 |
|
22 intr protocol PBrowserStream |
|
23 { |
|
24 manager PPluginInstance; |
|
25 |
|
26 child: |
|
27 async Write(int32_t offset, Buffer data, |
|
28 uint32_t newlength); |
|
29 async NPP_StreamAsFile(nsCString fname); |
|
30 |
|
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__(); |
|
37 |
|
38 parent: |
|
39 intr NPN_RequestRead(IPCByteRanges ranges) |
|
40 returns (NPError result); |
|
41 async NPN_DestroyStream(NPReason reason); |
|
42 async StreamDestroyed(); |
|
43 |
|
44 /* |
|
45 TODO: turn on state machine. |
|
46 |
|
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; |
|
56 |
|
57 state DYING: |
|
58 answer NPN_RequestRead goto DYING; |
|
59 recv NPN_DestroyStream goto DYING; |
|
60 recv StreamDestroyed goto DELETING; |
|
61 |
|
62 state DELETING: |
|
63 send __delete__; |
|
64 */ |
|
65 }; |
|
66 |
|
67 } // namespace plugins |
|
68 } // namespace mozilla |