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