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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 // without, we have these three signatures. Use of | 82 // without, we have these three signatures. Use of |
83 // Optional=DefaultIsUndefined in the IDL file doesn't help for now since | 83 // Optional=DefaultIsUndefined in the IDL file doesn't help for now since |
84 // it's bound to a value of 0 which is indistinguishable from the case 0 | 84 // it's bound to a value of 0 which is indistinguishable from the case 0 |
85 // is passed as code parameter. | 85 // is passed as code parameter. |
86 void close(unsigned short code, const String& reason, ExceptionState&); | 86 void close(unsigned short code, const String& reason, ExceptionState&); |
87 void close(ExceptionState&); | 87 void close(ExceptionState&); |
88 void close(unsigned short code, ExceptionState&); | 88 void close(unsigned short code, ExceptionState&); |
89 | 89 |
90 const KURL& url() const; | 90 const KURL& url() const; |
91 State readyState() const; | 91 State readyState() const; |
92 unsigned long bufferedAmount() const; | 92 unsigned bufferedAmount() const; |
93 | 93 |
94 String protocol() const; | 94 String protocol() const; |
95 String extensions() const; | 95 String extensions() const; |
96 | 96 |
97 String binaryType() const; | 97 String binaryType() const; |
98 void setBinaryType(const String&); | 98 void setBinaryType(const String&); |
99 | 99 |
100 DEFINE_ATTRIBUTE_EVENT_LISTENER(open); | 100 DEFINE_ATTRIBUTE_EVENT_LISTENER(open); |
101 DEFINE_ATTRIBUTE_EVENT_LISTENER(message); | 101 DEFINE_ATTRIBUTE_EVENT_LISTENER(message); |
102 DEFINE_ATTRIBUTE_EVENT_LISTENER(error); | 102 DEFINE_ATTRIBUTE_EVENT_LISTENER(error); |
(...skipping 10 matching lines...) Expand all Loading... |
113 virtual bool hasPendingActivity() const override; | 113 virtual bool hasPendingActivity() const override; |
114 virtual void suspend() override; | 114 virtual void suspend() override; |
115 virtual void resume() override; | 115 virtual void resume() override; |
116 virtual void stop() override; | 116 virtual void stop() override; |
117 | 117 |
118 // WebSocketChannelClient functions. | 118 // WebSocketChannelClient functions. |
119 virtual void didConnect(const String& subprotocol, const String& extensions)
override; | 119 virtual void didConnect(const String& subprotocol, const String& extensions)
override; |
120 virtual void didReceiveTextMessage(const String& message) override; | 120 virtual void didReceiveTextMessage(const String& message) override; |
121 virtual void didReceiveBinaryMessage(PassOwnPtr<Vector<char> >) override; | 121 virtual void didReceiveBinaryMessage(PassOwnPtr<Vector<char> >) override; |
122 virtual void didError() override; | 122 virtual void didError() override; |
123 virtual void didConsumeBufferedAmount(unsigned long) override; | 123 virtual void didConsumeBufferedAmount(unsigned) override; |
124 virtual void didStartClosingHandshake() override; | 124 virtual void didStartClosingHandshake() override; |
125 virtual void didClose(ClosingHandshakeCompletionStatus, unsigned short code,
const String& reason) override; | 125 virtual void didClose(ClosingHandshakeCompletionStatus, unsigned short code,
const String& reason) override; |
126 | 126 |
127 virtual void trace(Visitor*) override; | 127 virtual void trace(Visitor*) override; |
128 | 128 |
129 static bool isValidSubprotocolString(const String&); | 129 static bool isValidSubprotocolString(const String&); |
130 | 130 |
131 protected: | 131 protected: |
132 explicit DOMWebSocket(ExecutionContext*); | 132 explicit DOMWebSocket(ExecutionContext*); |
133 | 133 |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 | 208 |
209 enum BinaryType { | 209 enum BinaryType { |
210 BinaryTypeBlob, | 210 BinaryTypeBlob, |
211 BinaryTypeArrayBuffer | 211 BinaryTypeArrayBuffer |
212 }; | 212 }; |
213 | 213 |
214 Member<WebSocketChannel> m_channel; | 214 Member<WebSocketChannel> m_channel; |
215 | 215 |
216 State m_state; | 216 State m_state; |
217 KURL m_url; | 217 KURL m_url; |
218 unsigned long m_bufferedAmount; | 218 unsigned m_bufferedAmount; |
219 // The consumed buffered amount that will be reflected to m_bufferedAmount | 219 // The consumed buffered amount that will be reflected to m_bufferedAmount |
220 // later. It will be cleared once reflected. | 220 // later. It will be cleared once reflected. |
221 unsigned long m_consumedBufferedAmount; | 221 unsigned m_consumedBufferedAmount; |
222 unsigned long m_bufferedAmountAfterClose; | 222 unsigned m_bufferedAmountAfterClose; |
223 BinaryType m_binaryType; | 223 BinaryType m_binaryType; |
224 // The subprotocol the server selected. | 224 // The subprotocol the server selected. |
225 String m_subprotocol; | 225 String m_subprotocol; |
226 String m_extensions; | 226 String m_extensions; |
227 | 227 |
228 Member<EventQueue> m_eventQueue; | 228 Member<EventQueue> m_eventQueue; |
229 Timer<DOMWebSocket> m_bufferedAmountConsumeTimer; | 229 Timer<DOMWebSocket> m_bufferedAmountConsumeTimer; |
230 }; | 230 }; |
231 | 231 |
232 } // namespace blink | 232 } // namespace blink |
233 | 233 |
234 #endif // DOMWebSocket_h | 234 #endif // DOMWebSocket_h |
OLD | NEW |