| 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 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 511 << " routing_id=" << routing_id_ << " quota=" << quota; | 511 << " routing_id=" << routing_id_ << " quota=" << quota; |
| 512 | 512 |
| 513 if (!channel_) { | 513 if (!channel_) { |
| 514 // WebSocketChannel is not yet created due to the delay introduced by | 514 // WebSocketChannel is not yet created due to the delay introduced by |
| 515 // per-renderer WebSocket throttling. | 515 // per-renderer WebSocket throttling. |
| 516 // SendFlowControl() is called after WebSocketChannel is created. | 516 // SendFlowControl() is called after WebSocketChannel is created. |
| 517 pending_flow_control_quota_ += quota; | 517 pending_flow_control_quota_ += quota; |
| 518 return; | 518 return; |
| 519 } | 519 } |
| 520 | 520 |
| 521 channel_->SendFlowControl(quota); | 521 ignore_result(channel_->SendFlowControl(quota)); |
| 522 } | 522 } |
| 523 | 523 |
| 524 void WebSocketHost::OnDropChannel(bool was_clean, | 524 void WebSocketHost::OnDropChannel(bool was_clean, |
| 525 uint16_t code, | 525 uint16_t code, |
| 526 const std::string& reason) { | 526 const std::string& reason) { |
| 527 DVLOG(3) << "WebSocketHost::OnDropChannel" | 527 DVLOG(3) << "WebSocketHost::OnDropChannel" |
| 528 << " routing_id=" << routing_id_ << " was_clean=" << was_clean | 528 << " routing_id=" << routing_id_ << " was_clean=" << was_clean |
| 529 << " code=" << code << " reason=\"" << reason << "\""; | 529 << " code=" << code << " reason=\"" << reason << "\""; |
| 530 | 530 |
| 531 if (!channel_) { | 531 if (!channel_) { |
| 532 // WebSocketChannel is not yet created due to the delay introduced by | 532 // WebSocketChannel is not yet created due to the delay introduced by |
| 533 // per-renderer WebSocket throttling. | 533 // per-renderer WebSocket throttling. |
| 534 WebSocketDispatcherHost::WebSocketHostState result = | 534 WebSocketDispatcherHost::WebSocketHostState result = |
| 535 dispatcher_->DoDropChannel(routing_id_, false, | 535 dispatcher_->DoDropChannel(routing_id_, false, |
| 536 net::kWebSocketErrorAbnormalClosure, ""); | 536 net::kWebSocketErrorAbnormalClosure, ""); |
| 537 DCHECK_EQ(WebSocketDispatcherHost::WEBSOCKET_HOST_DELETED, result); | 537 DCHECK_EQ(WebSocketDispatcherHost::WEBSOCKET_HOST_DELETED, result); |
| 538 return; | 538 return; |
| 539 } | 539 } |
| 540 | 540 |
| 541 blob_sender_.reset(); | 541 blob_sender_.reset(); |
| 542 // TODO(yhirano): Handle |was_clean| appropriately. | 542 // TODO(yhirano): Handle |was_clean| appropriately. |
| 543 channel_->StartClosingHandshake(code, reason); | 543 ignore_result(channel_->StartClosingHandshake(code, reason)); |
| 544 } | 544 } |
| 545 | 545 |
| 546 void WebSocketHost::BlobSendComplete(int result) { | 546 void WebSocketHost::BlobSendComplete(int result) { |
| 547 DVLOG(3) << "WebSocketHost::BlobSendComplete" | 547 DVLOG(3) << "WebSocketHost::BlobSendComplete" |
| 548 << " routing_id=" << routing_id_ | 548 << " routing_id=" << routing_id_ |
| 549 << " result=" << net::ErrorToString(result); | 549 << " result=" << net::ErrorToString(result); |
| 550 | 550 |
| 551 // All paths through this method must reset blob_sender_, so take ownership | 551 // All paths through this method must reset blob_sender_, so take ownership |
| 552 // at the beginning. | 552 // at the beginning. |
| 553 std::unique_ptr<WebSocketBlobSender> blob_sender(std::move(blob_sender_)); | 553 std::unique_ptr<WebSocketBlobSender> blob_sender(std::move(blob_sender_)); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 574 default: | 574 default: |
| 575 ignore_result(dispatcher_->NotifyFailure( | 575 ignore_result(dispatcher_->NotifyFailure( |
| 576 routing_id_, | 576 routing_id_, |
| 577 "Failed to load Blob: error code = " + net::ErrorToString(result))); | 577 "Failed to load Blob: error code = " + net::ErrorToString(result))); |
| 578 // |this| is destroyed here. | 578 // |this| is destroyed here. |
| 579 return; | 579 return; |
| 580 } | 580 } |
| 581 } | 581 } |
| 582 | 582 |
| 583 } // namespace content | 583 } // namespace content |
| OLD | NEW |