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

Side by Side Diff: content/browser/renderer_host/websocket_host.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "content/browser/renderer_host/websocket_host.h" 5 #include "content/browser/renderer_host/websocket_host.h"
6 6
7 #include <inttypes.h> 7 #include <inttypes.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after
506 << " routing_id=" << routing_id_ << " quota=" << quota; 506 << " routing_id=" << routing_id_ << " quota=" << quota;
507 507
508 if (!channel_) { 508 if (!channel_) {
509 // WebSocketChannel is not yet created due to the delay introduced by 509 // WebSocketChannel is not yet created due to the delay introduced by
510 // per-renderer WebSocket throttling. 510 // per-renderer WebSocket throttling.
511 // SendFlowControl() is called after WebSocketChannel is created. 511 // SendFlowControl() is called after WebSocketChannel is created.
512 pending_flow_control_quota_ += quota; 512 pending_flow_control_quota_ += quota;
513 return; 513 return;
514 } 514 }
515 515
516 channel_->SendFlowControl(quota); 516 ignore_result(channel_->SendFlowControl(quota));
517 } 517 }
518 518
519 void WebSocketHost::OnDropChannel(bool was_clean, 519 void WebSocketHost::OnDropChannel(bool was_clean,
520 uint16_t code, 520 uint16_t code,
521 const std::string& reason) { 521 const std::string& reason) {
522 DVLOG(3) << "WebSocketHost::OnDropChannel" 522 DVLOG(3) << "WebSocketHost::OnDropChannel"
523 << " routing_id=" << routing_id_ << " was_clean=" << was_clean 523 << " routing_id=" << routing_id_ << " was_clean=" << was_clean
524 << " code=" << code << " reason=\"" << reason << "\""; 524 << " code=" << code << " reason=\"" << reason << "\"";
525 525
526 if (!channel_) { 526 if (!channel_) {
527 // WebSocketChannel is not yet created due to the delay introduced by 527 // WebSocketChannel is not yet created due to the delay introduced by
528 // per-renderer WebSocket throttling. 528 // per-renderer WebSocket throttling.
529 WebSocketDispatcherHost::WebSocketHostState result = 529 WebSocketDispatcherHost::WebSocketHostState result =
530 dispatcher_->DoDropChannel(routing_id_, false, 530 dispatcher_->DoDropChannel(routing_id_, false,
531 net::kWebSocketErrorAbnormalClosure, ""); 531 net::kWebSocketErrorAbnormalClosure, "");
532 DCHECK_EQ(WebSocketDispatcherHost::WEBSOCKET_HOST_DELETED, result); 532 DCHECK_EQ(WebSocketDispatcherHost::WEBSOCKET_HOST_DELETED, result);
533 return; 533 return;
534 } 534 }
535 535
536 blob_sender_.reset(); 536 blob_sender_.reset();
537 // TODO(yhirano): Handle |was_clean| appropriately. 537 // TODO(yhirano): Handle |was_clean| appropriately.
538 channel_->StartClosingHandshake(code, reason); 538 ignore_result(channel_->StartClosingHandshake(code, reason));
539 } 539 }
540 540
541 void WebSocketHost::BlobSendComplete(int result) { 541 void WebSocketHost::BlobSendComplete(int result) {
542 DVLOG(3) << "WebSocketHost::BlobSendComplete" 542 DVLOG(3) << "WebSocketHost::BlobSendComplete"
543 << " routing_id=" << routing_id_ 543 << " routing_id=" << routing_id_
544 << " result=" << net::ErrorToString(result); 544 << " result=" << net::ErrorToString(result);
545 545
546 // All paths through this method must reset blob_sender_, so take ownership 546 // All paths through this method must reset blob_sender_, so take ownership
547 // at the beginning. 547 // at the beginning.
548 scoped_ptr<WebSocketBlobSender> blob_sender(std::move(blob_sender_)); 548 scoped_ptr<WebSocketBlobSender> blob_sender(std::move(blob_sender_));
(...skipping 20 matching lines...) Expand all
569 default: 569 default:
570 ignore_result(dispatcher_->NotifyFailure( 570 ignore_result(dispatcher_->NotifyFailure(
571 routing_id_, 571 routing_id_,
572 "Failed to load Blob: error code = " + net::ErrorToString(result))); 572 "Failed to load Blob: error code = " + net::ErrorToString(result)));
573 // |this| is destroyed here. 573 // |this| is destroyed here.
574 return; 574 return;
575 } 575 }
576 } 576 }
577 577
578 } // namespace content 578 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | mojo/services/network/web_socket_impl.cc » ('j') | net/websockets/websocket_channel.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698