| OLD | NEW |
| 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 "extensions/browser/api/cast_channel/cast_socket.h" | 5 #include "extensions/browser/api/cast_channel/cast_socket.h" |
| 6 | 6 |
| 7 #include <stdlib.h> | 7 #include <stdlib.h> |
| 8 #include <string.h> | 8 #include <string.h> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 697 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 708 if (io_buffer->BytesRemaining() == 0) // Message fully sent | 708 if (io_buffer->BytesRemaining() == 0) // Message fully sent |
| 709 SetWriteState(WRITE_STATE_DO_CALLBACK); | 709 SetWriteState(WRITE_STATE_DO_CALLBACK); |
| 710 else | 710 else |
| 711 SetWriteState(WRITE_STATE_WRITE); | 711 SetWriteState(WRITE_STATE_WRITE); |
| 712 | 712 |
| 713 return net::OK; | 713 return net::OK; |
| 714 } | 714 } |
| 715 | 715 |
| 716 int CastSocket::DoWriteCallback() { | 716 int CastSocket::DoWriteCallback() { |
| 717 DCHECK(!write_queue_.empty()); | 717 DCHECK(!write_queue_.empty()); |
| 718 write_state_ = WRITE_STATE_WRITE; | 718 |
| 719 logger_->LogSocketWriteState(channel_id_, WriteStateToProto(write_state_)); | 719 SetWriteState(WRITE_STATE_WRITE); |
| 720 |
| 720 WriteRequest& request = write_queue_.front(); | 721 WriteRequest& request = write_queue_.front(); |
| 721 int bytes_consumed = request.io_buffer->BytesConsumed(); | 722 int bytes_consumed = request.io_buffer->BytesConsumed(); |
| 722 logger_->LogSocketEventForMessage( | 723 logger_->LogSocketEventForMessage( |
| 723 channel_id_, | 724 channel_id_, |
| 724 proto::MESSAGE_WRITTEN, | 725 proto::MESSAGE_WRITTEN, |
| 725 request.message_namespace, | 726 request.message_namespace, |
| 726 base::StringPrintf("Bytes: %d", bytes_consumed)); | 727 base::StringPrintf("Bytes: %d", bytes_consumed)); |
| 727 request.callback.Run(bytes_consumed); | 728 request.callback.Run(bytes_consumed); |
| 728 write_queue_.pop(); | 729 write_queue_.pop(); |
| 729 return net::OK; | 730 return net::OK; |
| (...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1092 return true; | 1093 return true; |
| 1093 } | 1094 } |
| 1094 | 1095 |
| 1095 CastSocket::WriteRequest::~WriteRequest() { } | 1096 CastSocket::WriteRequest::~WriteRequest() { } |
| 1096 | 1097 |
| 1097 } // namespace cast_channel | 1098 } // namespace cast_channel |
| 1098 } // namespace core_api | 1099 } // namespace core_api |
| 1099 } // namespace extensions | 1100 } // namespace extensions |
| 1100 | 1101 |
| 1101 #undef VLOG_WITH_CONNECTION | 1102 #undef VLOG_WITH_CONNECTION |
| OLD | NEW |