OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // File-level comment to appease parser. Eventually this will not be necessary. | 5 // File-level comment to appease parser. Eventually this will not be necessary. |
6 | 6 |
7 [nodoc] namespace experimental.socket { | 7 [nodoc] namespace experimental.socket { |
8 | 8 |
9 // A socket event. | 9 // A socket event. |
10 dictionary SocketEvent { | 10 dictionary SocketEvent { |
11 // A connectComplete event reports the result of a connect that blocked. A | 11 // A connectComplete event reports the result of a connect that blocked. A |
12 // writeComplete event reports the result of a write that blocked. A | 12 // writeComplete event reports the result of a write that blocked. A |
13 // dataRead event reports bytes that have arrived following a read call | 13 // dataRead event reports bytes that have arrived following a read call |
14 // that blocked. | 14 // that blocked. |
15 DOMString type; | 15 DOMString type; |
16 | 16 |
17 // The result code, if the event type is writeComplete. The result code | 17 // The result code, if the event type is dataRead or writeComplete. The |
18 // description matches that of <code>writeInfo.bytesWritten</code>. | 18 // result code description matches the resultCode field in the immediate |
| 19 // callback for the call that led to this event. |
19 long? resultCode; | 20 long? resultCode; |
20 | 21 |
21 // The data read, if the event type is dataRead. | 22 // The data read, if the event type is dataRead. |
22 // TODO(miket): [instanceOf=ArrayBuffer]object? data; | 23 // TODO(miket): [instanceOf=ArrayBuffer]object? data; |
23 long[]? data; | 24 long[]? data; |
24 | 25 |
25 // Whether this is the final event that this socket will send. | 26 // Whether this is the final event that this socket will send. |
26 [nodoc] boolean isFinalEvent; | 27 [nodoc] boolean isFinalEvent; |
27 | 28 |
28 // An ID unique to the calling function's context so that events can get | 29 // An ID unique to the calling function's context so that events can get |
(...skipping 16 matching lines...) Expand all Loading... |
45 dictionary CreateInfo { | 46 dictionary CreateInfo { |
46 // The id of the newly created socket. | 47 // The id of the newly created socket. |
47 long socketId; | 48 long socketId; |
48 }; | 49 }; |
49 | 50 |
50 callback CreateCallback = void (CreateInfo createInfo); | 51 callback CreateCallback = void (CreateInfo createInfo); |
51 | 52 |
52 callback ConnectCallback = void (long result); | 53 callback ConnectCallback = void (long result); |
53 | 54 |
54 dictionary ReadInfo { | 55 dictionary ReadInfo { |
| 56 // The resultCode returned from the underlying read() call. |
| 57 long resultCode; |
| 58 |
55 // The data received. Warning: will probably become a blob or other | 59 // The data received. Warning: will probably become a blob or other |
56 // appropriate binary-friendly type. | 60 // appropriate binary-friendly type. |
57 // TODO(miket): [instanceOf=ArrayBuffer]object data; | 61 // TODO(miket): [instanceOf=ArrayBuffer]object data; |
58 long[] data; | 62 long[] data; |
59 }; | 63 }; |
60 | 64 |
61 callback ReadCallback = void (ReadInfo readInfo); | 65 callback ReadCallback = void (ReadInfo readInfo); |
62 | 66 |
63 dictionary WriteInfo { | 67 dictionary WriteInfo { |
64 // The number of bytes sent, or a negative error code. | 68 // The number of bytes sent, or a negative error code. |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 WriteCallback callback); | 123 WriteCallback callback); |
120 }; | 124 }; |
121 | 125 |
122 interface Events { | 126 interface Events { |
123 // Used to pass events back to the socket creator. | 127 // Used to pass events back to the socket creator. |
124 // |event| : The event indicating socket status. | 128 // |event| : The event indicating socket status. |
125 static void onEvent(SocketEvent event); | 129 static void onEvent(SocketEvent event); |
126 }; | 130 }; |
127 | 131 |
128 }; | 132 }; |
OLD | NEW |