| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |