| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 // without, we have these three signatures. Use of | 78 // without, we have these three signatures. Use of |
| 79 // Optional=DefaultIsUndefined in the IDL file doesn't help for now since | 79 // Optional=DefaultIsUndefined in the IDL file doesn't help for now since |
| 80 // it's bound to a value of 0 which is indistinguishable from the case 0 | 80 // it's bound to a value of 0 which is indistinguishable from the case 0 |
| 81 // is passed as code parameter. | 81 // is passed as code parameter. |
| 82 void close(unsigned short code, const String& reason, ExceptionState&); | 82 void close(unsigned short code, const String& reason, ExceptionState&); |
| 83 void close(ExceptionState&); | 83 void close(ExceptionState&); |
| 84 void close(unsigned short code, ExceptionState&); | 84 void close(unsigned short code, ExceptionState&); |
| 85 | 85 |
| 86 const KURL& url() const; | 86 const KURL& url() const; |
| 87 State readyState() const; | 87 State readyState() const; |
| 88 unsigned long bufferedAmount() const; | 88 unsigned bufferedAmount() const; |
| 89 | 89 |
| 90 String protocol() const; | 90 String protocol() const; |
| 91 String extensions() const; | 91 String extensions() const; |
| 92 | 92 |
| 93 String binaryType() const; | 93 String binaryType() const; |
| 94 void setBinaryType(const String&); | 94 void setBinaryType(const String&); |
| 95 | 95 |
| 96 DEFINE_ATTRIBUTE_EVENT_LISTENER(open); | 96 DEFINE_ATTRIBUTE_EVENT_LISTENER(open); |
| 97 DEFINE_ATTRIBUTE_EVENT_LISTENER(message); | 97 DEFINE_ATTRIBUTE_EVENT_LISTENER(message); |
| 98 DEFINE_ATTRIBUTE_EVENT_LISTENER(error); | 98 DEFINE_ATTRIBUTE_EVENT_LISTENER(error); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 110 virtual void stop() OVERRIDE; | 110 virtual void stop() OVERRIDE; |
| 111 | 111 |
| 112 using RefCounted<WebSocket>::ref; | 112 using RefCounted<WebSocket>::ref; |
| 113 using RefCounted<WebSocket>::deref; | 113 using RefCounted<WebSocket>::deref; |
| 114 | 114 |
| 115 // WebSocketChannelClient functions. | 115 // WebSocketChannelClient functions. |
| 116 virtual void didConnect() OVERRIDE; | 116 virtual void didConnect() OVERRIDE; |
| 117 virtual void didReceiveMessage(const String& message) OVERRIDE; | 117 virtual void didReceiveMessage(const String& message) OVERRIDE; |
| 118 virtual void didReceiveBinaryData(PassOwnPtr<Vector<char> >) OVERRIDE; | 118 virtual void didReceiveBinaryData(PassOwnPtr<Vector<char> >) OVERRIDE; |
| 119 virtual void didReceiveMessageError() OVERRIDE; | 119 virtual void didReceiveMessageError() OVERRIDE; |
| 120 // FIXME: bufferedAmount should be an "unsigned int". |
| 120 virtual void didUpdateBufferedAmount(unsigned long bufferedAmount) OVERRIDE; | 121 virtual void didUpdateBufferedAmount(unsigned long bufferedAmount) OVERRIDE; |
| 121 virtual void didStartClosingHandshake() OVERRIDE; | 122 virtual void didStartClosingHandshake() OVERRIDE; |
| 122 virtual void didClose(unsigned long unhandledBufferedAmount, ClosingHandshak
eCompletionStatus, unsigned short code, const String& reason) OVERRIDE; | 123 virtual void didClose(unsigned long unhandledBufferedAmount, ClosingHandshak
eCompletionStatus, unsigned short code, const String& reason) OVERRIDE; |
| 123 | 124 |
| 124 private: | 125 private: |
| 125 explicit WebSocket(ScriptExecutionContext*); | 126 explicit WebSocket(ScriptExecutionContext*); |
| 126 | 127 |
| 127 // Handle the JavaScript close method call. close() methods on this class | 128 // Handle the JavaScript close method call. close() methods on this class |
| 128 // are just for determining if the optional code argument is supplied or | 129 // are just for determining if the optional code argument is supplied or |
| 129 // not. | 130 // not. |
| (...skipping 17 matching lines...) Expand all Loading... |
| 147 enum BinaryType { | 148 enum BinaryType { |
| 148 BinaryTypeBlob, | 149 BinaryTypeBlob, |
| 149 BinaryTypeArrayBuffer | 150 BinaryTypeArrayBuffer |
| 150 }; | 151 }; |
| 151 | 152 |
| 152 RefPtr<WebSocketChannel> m_channel; | 153 RefPtr<WebSocketChannel> m_channel; |
| 153 | 154 |
| 154 State m_state; | 155 State m_state; |
| 155 KURL m_url; | 156 KURL m_url; |
| 156 EventTargetData m_eventTargetData; | 157 EventTargetData m_eventTargetData; |
| 157 unsigned long m_bufferedAmount; | 158 unsigned m_bufferedAmount; |
| 159 // FIXME: Can this just be "unsigned" too? |
| 158 unsigned long m_bufferedAmountAfterClose; | 160 unsigned long m_bufferedAmountAfterClose; |
| 159 BinaryType m_binaryType; | 161 BinaryType m_binaryType; |
| 160 String m_subprotocol; | 162 String m_subprotocol; |
| 161 String m_extensions; | 163 String m_extensions; |
| 162 }; | 164 }; |
| 163 | 165 |
| 164 } // namespace WebCore | 166 } // namespace WebCore |
| 165 | 167 |
| 166 #endif // WebSocket_h | 168 #endif // WebSocket_h |
| OLD | NEW |