OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2011, 2012 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 return true; | 78 return true; |
79 } | 79 } |
80 | 80 |
81 void WebSocketImpl::connect(const WebURL& url, const WebString& protocol) | 81 void WebSocketImpl::connect(const WebURL& url, const WebString& protocol) |
82 { | 82 { |
83 m_private->connect(url, protocol); | 83 m_private->connect(url, protocol); |
84 } | 84 } |
85 | 85 |
86 WebString WebSocketImpl::subprotocol() | 86 WebString WebSocketImpl::subprotocol() |
87 { | 87 { |
88 return m_private->subprotocol(); | 88 return m_subprotocol; |
89 } | 89 } |
90 | 90 |
91 WebString WebSocketImpl::extensions() | 91 WebString WebSocketImpl::extensions() |
92 { | 92 { |
93 return m_private->extensions(); | 93 return m_extensions; |
94 } | 94 } |
95 | 95 |
96 bool WebSocketImpl::sendText(const WebString& message) | 96 bool WebSocketImpl::sendText(const WebString& message) |
97 { | 97 { |
98 return m_private->send(message) == WebSocketChannel::SendSuccess; | 98 return m_private->send(message) == WebSocketChannel::SendSuccess; |
99 } | 99 } |
100 | 100 |
101 bool WebSocketImpl::sendArrayBuffer(const WebArrayBuffer& webArrayBuffer) | 101 bool WebSocketImpl::sendArrayBuffer(const WebArrayBuffer& webArrayBuffer) |
102 { | 102 { |
103 return m_private->send(*PassRefPtr<ArrayBuffer>(webArrayBuffer), 0, webArray Buffer.byteLength()) == WebSocketChannel::SendSuccess; | 103 return m_private->send(*PassRefPtr<ArrayBuffer>(webArrayBuffer), 0, webArray Buffer.byteLength()) == WebSocketChannel::SendSuccess; |
(...skipping 13 matching lines...) Expand all Loading... | |
117 { | 117 { |
118 m_private->fail(reason, ErrorMessageLevel, String(), 0); | 118 m_private->fail(reason, ErrorMessageLevel, String(), 0); |
119 } | 119 } |
120 | 120 |
121 void WebSocketImpl::disconnect() | 121 void WebSocketImpl::disconnect() |
122 { | 122 { |
123 m_private->disconnect(); | 123 m_private->disconnect(); |
124 m_client = 0; | 124 m_client = 0; |
125 } | 125 } |
126 | 126 |
127 void WebSocketImpl::didConnect() | 127 void WebSocketImpl::didConnect(const String& subprotocol, const String& extensio ns) |
128 { | 128 { |
129 m_client->didConnect(); | 129 m_client->didConnect(); |
130 m_subprotocol = subprotocol; | |
131 m_extensions = extensions; | |
tyoshino (SeeGerritForStatus)
2014/06/13 09:00:12
let's set variables first, and then didConnect()
yhirano
2014/06/13 09:04:03
Done.
| |
130 } | 132 } |
131 | 133 |
132 void WebSocketImpl::didReceiveMessage(const String& message) | 134 void WebSocketImpl::didReceiveMessage(const String& message) |
133 { | 135 { |
134 m_client->didReceiveMessage(WebString(message)); | 136 m_client->didReceiveMessage(WebString(message)); |
135 } | 137 } |
136 | 138 |
137 void WebSocketImpl::didReceiveBinaryData(PassOwnPtr<Vector<char> > binaryData) | 139 void WebSocketImpl::didReceiveBinaryData(PassOwnPtr<Vector<char> > binaryData) |
138 { | 140 { |
139 switch (m_binaryType) { | 141 switch (m_binaryType) { |
(...skipping 20 matching lines...) Expand all Loading... | |
160 { | 162 { |
161 m_client->didStartClosingHandshake(); | 163 m_client->didStartClosingHandshake(); |
162 } | 164 } |
163 | 165 |
164 void WebSocketImpl::didClose(unsigned long bufferedAmount, ClosingHandshakeCompl etionStatus status, unsigned short code, const String& reason) | 166 void WebSocketImpl::didClose(unsigned long bufferedAmount, ClosingHandshakeCompl etionStatus status, unsigned short code, const String& reason) |
165 { | 167 { |
166 m_client->didClose(bufferedAmount, static_cast<WebSocketClient::ClosingHands hakeCompletionStatus>(status), code, WebString(reason)); | 168 m_client->didClose(bufferedAmount, static_cast<WebSocketClient::ClosingHands hakeCompletionStatus>(status), code, WebString(reason)); |
167 } | 169 } |
168 | 170 |
169 } // namespace blink | 171 } // namespace blink |
OLD | NEW |