Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(390)

Side by Side Diff: mojo/services/network/web_socket_impl.cc

Issue 1820233002: [WebSocket] Incoming close frame should not overtake data frames (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "mojo/services/network/web_socket_impl.h" 5 #include "mojo/services/network/web_socket_impl.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 uint32_t num_bytes) { 213 uint32_t num_bytes) {
214 DCHECK(channel_); 214 DCHECK(channel_);
215 read_queue_->Read(num_bytes, 215 read_queue_->Read(num_bytes,
216 base::Bind(&WebSocketImpl::DidReadFromSendStream, 216 base::Bind(&WebSocketImpl::DidReadFromSendStream,
217 base::Unretained(this), 217 base::Unretained(this),
218 fin, type, num_bytes)); 218 fin, type, num_bytes));
219 } 219 }
220 220
221 void WebSocketImpl::FlowControl(int64_t quota) { 221 void WebSocketImpl::FlowControl(int64_t quota) {
222 DCHECK(channel_); 222 DCHECK(channel_);
223 channel_->SendFlowControl(quota); 223 ignore_result(channel_->SendFlowControl(quota));
224 } 224 }
225 225
226 void WebSocketImpl::Close(uint16_t code, const String& reason) { 226 void WebSocketImpl::Close(uint16_t code, const String& reason) {
227 DCHECK(channel_); 227 DCHECK(channel_);
228 channel_->StartClosingHandshake(code, reason); 228 ignore_result(channel_->StartClosingHandshake(code, reason));
229 } 229 }
230 230
231 void WebSocketImpl::DidReadFromSendStream(bool fin, 231 void WebSocketImpl::DidReadFromSendStream(bool fin,
232 WebSocket::MessageType type, 232 WebSocket::MessageType type,
233 uint32_t num_bytes, 233 uint32_t num_bytes,
234 const char* data) { 234 const char* data) {
235 std::vector<char> buffer(num_bytes); 235 std::vector<char> buffer(num_bytes);
236 memcpy(&buffer[0], data, num_bytes); 236 memcpy(&buffer[0], data, num_bytes);
237 DCHECK(channel_); 237 DCHECK(channel_);
238 channel_->SendFrame( 238 channel_->SendFrame(
239 fin, ConvertTo<net::WebSocketFrameHeader::OpCode>(type), buffer); 239 fin, ConvertTo<net::WebSocketFrameHeader::OpCode>(type), buffer);
240 } 240 }
241 241
242 } // namespace mojo 242 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698