OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
65 return adoptRef(new NewWebSocketChannelImpl(context, client, sourceURL, lineNumber)); | 65 return adoptRef(new NewWebSocketChannelImpl(context, client, sourceURL, lineNumber)); |
66 } | 66 } |
67 virtual ~NewWebSocketChannelImpl(); | 67 virtual ~NewWebSocketChannelImpl(); |
68 | 68 |
69 // WebSocketChannel functions. | 69 // WebSocketChannel functions. |
70 virtual void connect(const KURL&, const String& protocol) OVERRIDE; | 70 virtual void connect(const KURL&, const String& protocol) OVERRIDE; |
71 virtual String subprotocol() OVERRIDE; | 71 virtual String subprotocol() OVERRIDE; |
72 virtual String extensions() OVERRIDE; | 72 virtual String extensions() OVERRIDE; |
73 virtual WebSocketChannel::SendResult send(const String& message) OVERRIDE; | 73 virtual WebSocketChannel::SendResult send(const String& message) OVERRIDE; |
74 virtual WebSocketChannel::SendResult send(const ArrayBuffer&, unsigned byteO ffset, unsigned byteLength) OVERRIDE; | 74 virtual WebSocketChannel::SendResult send(const ArrayBuffer&, unsigned byteO ffset, unsigned byteLength) OVERRIDE; |
75 virtual WebSocketChannel::SendResult send(const Blob&) OVERRIDE; | 75 virtual WebSocketChannel::SendResult send(PassRefPtr<BlobDataHandle>) OVERRI DE; |
76 virtual unsigned long bufferedAmount() const OVERRIDE; | 76 virtual unsigned long bufferedAmount() const OVERRIDE; |
77 // Start closing handshake. Use the CloseEventCodeNotSpecified for the code | 77 // Start closing handshake. Use the CloseEventCodeNotSpecified for the code |
78 // argument to omit payload. | 78 // argument to omit payload. |
79 virtual void close(int code, const String& reason) OVERRIDE; | 79 virtual void close(int code, const String& reason) OVERRIDE; |
80 virtual void fail(const String& reason, MessageLevel, const String&, unsigne d lineNumber) OVERRIDE; | 80 virtual void fail(const String& reason, MessageLevel, const String&, unsigne d lineNumber) OVERRIDE; |
81 using WebSocketChannel::fail; | 81 using WebSocketChannel::fail; |
82 virtual void disconnect() OVERRIDE; | 82 virtual void disconnect() OVERRIDE; |
83 | 83 |
84 using RefCounted<NewWebSocketChannelImpl>::ref; | 84 using RefCounted<NewWebSocketChannelImpl>::ref; |
85 using RefCounted<NewWebSocketChannelImpl>::deref; | 85 using RefCounted<NewWebSocketChannelImpl>::deref; |
86 | 86 |
87 virtual void suspend() OVERRIDE; | 87 virtual void suspend() OVERRIDE; |
88 virtual void resume() OVERRIDE; | 88 virtual void resume() OVERRIDE; |
89 | 89 |
90 void handleDidConnect(); | 90 void handleDidConnect(); |
91 void handleTextMessage(Vector<char>*); | 91 void handleTextMessage(Vector<char>*); |
92 void handleBinaryMessage(Vector<char>*); | 92 void handleBinaryMessage(Vector<char>*); |
93 void handleDidReceiveMessageError(); | 93 void handleDidReceiveMessageError(); |
94 void handleDidClose(unsigned short code, const String& reason); | 94 void handleDidClose(unsigned short code, const String& reason); |
95 | 95 |
96 private: | 96 private: |
97 enum MessageType { | 97 enum MessageType { |
98 MessageTypeText, | 98 MessageTypeText, |
99 MessageTypeBlob, | 99 MessageTypeBlob, |
100 MessageTypeArrayBuffer, | 100 MessageTypeArrayBuffer, |
101 }; | 101 }; |
102 | 102 |
103 struct Message { | 103 struct Message { |
104 explicit Message(const String&); | 104 explicit Message(const String&); |
105 explicit Message(const Blob&); | 105 explicit Message(PassRefPtr<BlobDataHandle>); |
106 explicit Message(PassRefPtr<ArrayBuffer>); | 106 explicit Message(PassRefPtr<ArrayBuffer>); |
107 MessageType type; | 107 MessageType type; |
108 CString text; | 108 CString text; |
109 RefPtr<Blob> blob; | 109 RefPtr<BlobDataHandle> blobData; |
kinuko
2013/09/30 11:31:53
nit: We also have a class named BlobData, and call
michaeln
2013/09/30 20:50:24
renamed to blobDataHandle
| |
110 RefPtr<ArrayBuffer> arrayBuffer; | 110 RefPtr<ArrayBuffer> arrayBuffer; |
111 }; | 111 }; |
112 | 112 |
113 struct ReceivedMessage { | 113 struct ReceivedMessage { |
114 bool isMessageText; | 114 bool isMessageText; |
115 Vector<char> data; | 115 Vector<char> data; |
116 }; | 116 }; |
117 | 117 |
118 class BlobLoader; | 118 class BlobLoader; |
119 class Resumer; | 119 class Resumer; |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
163 size_t m_sentSizeOfTopMessage; | 163 size_t m_sentSizeOfTopMessage; |
164 String m_subprotocol; | 164 String m_subprotocol; |
165 String m_extensions; | 165 String m_extensions; |
166 | 166 |
167 static const int64_t receivedDataSizeForFlowControlHighWaterMark = 1 << 15; | 167 static const int64_t receivedDataSizeForFlowControlHighWaterMark = 1 << 15; |
168 }; | 168 }; |
169 | 169 |
170 } // namespace WebCore | 170 } // namespace WebCore |
171 | 171 |
172 #endif // NewWebSocketChannelImpl_h | 172 #endif // NewWebSocketChannelImpl_h |
OLD | NEW |