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 { |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 callback ReadCallback = void (ReadInfo readInfo); | 67 callback ReadCallback = void (ReadInfo readInfo); |
68 | 68 |
69 dictionary WriteInfo { | 69 dictionary WriteInfo { |
70 // The number of bytes sent, or a negative error code. | 70 // The number of bytes sent, or a negative error code. |
71 long bytesWritten; | 71 long bytesWritten; |
72 }; | 72 }; |
73 | 73 |
74 callback WriteCallback = void (WriteInfo writeInfo); | 74 callback WriteCallback = void (WriteInfo writeInfo); |
75 | 75 |
76 dictionary RecvFromInfo { | 76 dictionary RecvFromInfo { |
| 77 // The resultCode returned from the underlying read() call. |
| 78 long resultCode; |
| 79 |
77 // The data received. Warning: will probably become a blob or other | 80 // The data received. Warning: will probably become a blob or other |
78 // appropriate binary-friendly type. | 81 // appropriate binary-friendly type. |
79 // TODO(miket): [instanceOf=ArrayBuffer]object data; | 82 // TODO(miket): [instanceOf=ArrayBuffer]object data; |
80 long[] data; | 83 long[] data; |
81 DOMString address; | 84 DOMString address; |
82 long port; | 85 long port; |
83 }; | 86 }; |
84 | 87 |
85 callback RecvFromCallback = void (RecvFromInfo recvFromInfo); | 88 callback RecvFromCallback = void (RecvFromInfo recvFromInfo); |
86 | 89 |
87 callback SendToCallback = void (long bytesWritten); | 90 callback SendToCallback = void (WriteInfo writeInfo); |
88 | 91 |
89 interface Functions { | 92 interface Functions { |
90 // Creates a socket of the specified type that will connect to the specified | 93 // Creates a socket of the specified type that will connect to the specified |
91 // remote machine. | 94 // remote machine. |
92 // |type| : The type of socket to create. Must be <code>tcp</code> or | 95 // |type| : The type of socket to create. Must be <code>tcp</code> or |
93 // <code>udp</code>. | 96 // <code>udp</code>. |
94 // |options| : The socket options. | 97 // |options| : The socket options. |
95 // |callback| : Called when the socket has been created. | 98 // |callback| : Called when the socket has been created. |
96 static void create(DOMString type, | 99 static void create(DOMString type, |
97 optional CreateOptions options, | 100 optional CreateOptions options, |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 SendToCallback callback); | 174 SendToCallback callback); |
172 }; | 175 }; |
173 | 176 |
174 interface Events { | 177 interface Events { |
175 // Used to pass events back to the socket creator. | 178 // Used to pass events back to the socket creator. |
176 // |event| : The event indicating socket status. | 179 // |event| : The event indicating socket status. |
177 static void onEvent(SocketEvent event); | 180 static void onEvent(SocketEvent event); |
178 }; | 181 }; |
179 | 182 |
180 }; | 183 }; |
OLD | NEW |