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_transport.h" | 5 #include "extensions/browser/api/cast_channel/cast_transport.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
320 | 320 |
321 int CastTransportImpl::DoWriteCallback() { | 321 int CastTransportImpl::DoWriteCallback() { |
322 VLOG_WITH_CONNECTION(2) << "DoWriteCallback"; | 322 VLOG_WITH_CONNECTION(2) << "DoWriteCallback"; |
323 DCHECK(!write_queue_.empty()); | 323 DCHECK(!write_queue_.empty()); |
324 | 324 |
325 WriteRequest& request = write_queue_.front(); | 325 WriteRequest& request = write_queue_.front(); |
326 int bytes_consumed = request.io_buffer->BytesConsumed(); | 326 int bytes_consumed = request.io_buffer->BytesConsumed(); |
327 logger_->LogSocketEventForMessage( | 327 logger_->LogSocketEventForMessage( |
328 channel_id_, proto::MESSAGE_WRITTEN, request.message_namespace, | 328 channel_id_, proto::MESSAGE_WRITTEN, request.message_namespace, |
329 base::StringPrintf("Bytes: %d", bytes_consumed)); | 329 base::StringPrintf("Bytes: %d", bytes_consumed)); |
330 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, | |
331 base::Bind(&base::DoNothing)); | |
332 base::ThreadTaskRunnerHandle::Get()->PostTask( | 330 base::ThreadTaskRunnerHandle::Get()->PostTask( |
333 FROM_HERE, base::Bind(request.callback, net::OK)); | 331 FROM_HERE, base::Bind(request.callback, net::OK)); |
334 | 332 |
335 write_queue_.pop(); | 333 write_queue_.pop(); |
336 if (write_queue_.empty()) { | 334 if (write_queue_.empty()) { |
337 SetWriteState(WRITE_STATE_IDLE); | 335 SetWriteState(WRITE_STATE_IDLE); |
338 } else { | 336 } else { |
339 SetWriteState(WRITE_STATE_WRITE); | 337 SetWriteState(WRITE_STATE_WRITE); |
340 } | 338 } |
341 | 339 |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
470 VLOG_WITH_CONNECTION(2) << "DoReadHandleError"; | 468 VLOG_WITH_CONNECTION(2) << "DoReadHandleError"; |
471 DCHECK_NE(CHANNEL_ERROR_NONE, error_state_); | 469 DCHECK_NE(CHANNEL_ERROR_NONE, error_state_); |
472 DCHECK_LE(result, 0); | 470 DCHECK_LE(result, 0); |
473 SetReadState(READ_STATE_ERROR); | 471 SetReadState(READ_STATE_ERROR); |
474 return net::ERR_FAILED; | 472 return net::ERR_FAILED; |
475 } | 473 } |
476 | 474 |
477 } // namespace cast_channel | 475 } // namespace cast_channel |
478 } // namespace api | 476 } // namespace api |
479 } // namespace extensions | 477 } // namespace extensions |
OLD | NEW |