OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 }; | 81 }; |
82 | 82 |
83 virtual bool connect(const KURL&, const String& protocol) = 0; | 83 virtual bool connect(const KURL&, const String& protocol) = 0; |
84 virtual SendResult send(const String& message) = 0; | 84 virtual SendResult send(const String& message) = 0; |
85 virtual SendResult send(const ArrayBuffer&, unsigned byteOffset, unsigned by
teLength) = 0; | 85 virtual SendResult send(const ArrayBuffer&, unsigned byteOffset, unsigned by
teLength) = 0; |
86 virtual SendResult send(PassRefPtr<BlobDataHandle>) = 0; | 86 virtual SendResult send(PassRefPtr<BlobDataHandle>) = 0; |
87 | 87 |
88 // For WorkerThreadableWebSocketChannel. | 88 // For WorkerThreadableWebSocketChannel. |
89 virtual SendResult send(PassOwnPtr<Vector<char> >) = 0; | 89 virtual SendResult send(PassOwnPtr<Vector<char> >) = 0; |
90 | 90 |
| 91 virtual unsigned long bufferedAmount() const = 0; |
91 virtual void close(int code, const String& reason) = 0; | 92 virtual void close(int code, const String& reason) = 0; |
92 | 93 |
93 // Log the reason text and close the connection. Will call didClose(). | 94 // Log the reason text and close the connection. Will call didClose(). |
94 // The MessageLevel parameter will be used for the level of the message | 95 // The MessageLevel parameter will be used for the level of the message |
95 // shown at the devtool console. | 96 // shown at the devtool console. |
96 // sourceURL and lineNumber parameters may be shown with the reason text | 97 // sourceURL and lineNumber parameters may be shown with the reason text |
97 // at the devtool console. | 98 // at the devtool console. |
98 // Even if sourceURL and lineNumber are specified, they may be ignored | 99 // Even if sourceURL and lineNumber are specified, they may be ignored |
99 // and the "current" url and the line number in the sense of | 100 // and the "current" url and the line number in the sense of |
100 // JavaScript execution may be shown if this method is called in | 101 // JavaScript execution may be shown if this method is called in |
101 // a JS execution context. | 102 // a JS execution context. |
102 // You can specify String() and 0 for sourceURL and lineNumber | 103 // You can specify String() and 0 for sourceURL and lineNumber |
103 // respectively, if you can't / needn't provide the information. | 104 // respectively, if you can't / needn't provide the information. |
104 virtual void fail(const String& reason, MessageLevel, const String& sourceUR
L, unsigned lineNumber) = 0; | 105 virtual void fail(const String& reason, MessageLevel, const String& sourceUR
L, unsigned lineNumber) = 0; |
105 | 106 |
106 virtual void disconnect() = 0; // Will suppress didClose(). | 107 virtual void disconnect() = 0; // Will suppress didClose(). |
107 | 108 |
108 virtual void suspend() = 0; | 109 virtual void suspend() = 0; |
109 virtual void resume() = 0; | 110 virtual void resume() = 0; |
110 | 111 |
111 virtual ~WebSocketChannel() { } | 112 virtual ~WebSocketChannel() { } |
112 | 113 |
113 virtual void trace(Visitor*) { } | 114 virtual void trace(Visitor*) { } |
114 }; | 115 }; |
115 | 116 |
116 } // namespace WebCore | 117 } // namespace WebCore |
117 | 118 |
118 #endif // WebSocketChannel_h | 119 #endif // WebSocketChannel_h |
OLD | NEW |