| 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 <utility> | 10 #include <utility> |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 connect_state_(proto::CONN_STATE_START_CONNECT), | 129 connect_state_(proto::CONN_STATE_START_CONNECT), |
| 130 error_state_(CHANNEL_ERROR_NONE), | 130 error_state_(CHANNEL_ERROR_NONE), |
| 131 ready_state_(READY_STATE_NONE), | 131 ready_state_(READY_STATE_NONE), |
| 132 auth_delegate_(nullptr) { | 132 auth_delegate_(nullptr) { |
| 133 DCHECK(net_log_); | 133 DCHECK(net_log_); |
| 134 net_log_source_.type = net::NetLogSourceType::SOCKET; | 134 net_log_source_.type = net::NetLogSourceType::SOCKET; |
| 135 net_log_source_.id = net_log_->NextID(); | 135 net_log_source_.id = net_log_->NextID(); |
| 136 } | 136 } |
| 137 | 137 |
| 138 CastSocketImpl::~CastSocketImpl() { | 138 CastSocketImpl::~CastSocketImpl() { |
| 139 // Ensure that resources are freed but do not run pending callbacks to avoid | 139 // Ensure that resources are freed but do not run pending callbacks that |
| 140 // any re-entrancy. | 140 // would result in re-entrancy. |
| 141 CloseInternal(); | 141 CloseInternal(); |
| 142 |
| 143 if (!connect_callback_.is_null()) |
| 144 base::ResetAndReturn(&connect_callback_).Run(CHANNEL_ERROR_UNKNOWN); |
| 142 } | 145 } |
| 143 | 146 |
| 144 ReadyState CastSocketImpl::ready_state() const { | 147 ReadyState CastSocketImpl::ready_state() const { |
| 145 return ready_state_; | 148 return ready_state_; |
| 146 } | 149 } |
| 147 | 150 |
| 148 ChannelError CastSocketImpl::error_state() const { | 151 ChannelError CastSocketImpl::error_state() const { |
| 149 return error_state_; | 152 return error_state_; |
| 150 } | 153 } |
| 151 | 154 |
| (...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 596 void CastSocketImpl::SetErrorState(ChannelError error_state) { | 599 void CastSocketImpl::SetErrorState(ChannelError error_state) { |
| 597 VLOG_WITH_CONNECTION(1) << "SetErrorState " << error_state; | 600 VLOG_WITH_CONNECTION(1) << "SetErrorState " << error_state; |
| 598 DCHECK_EQ(CHANNEL_ERROR_NONE, error_state_); | 601 DCHECK_EQ(CHANNEL_ERROR_NONE, error_state_); |
| 599 error_state_ = error_state; | 602 error_state_ = error_state; |
| 600 delegate_->OnError(error_state_); | 603 delegate_->OnError(error_state_); |
| 601 } | 604 } |
| 602 } // namespace cast_channel | 605 } // namespace cast_channel |
| 603 } // namespace api | 606 } // namespace api |
| 604 } // namespace extensions | 607 } // namespace extensions |
| 605 #undef VLOG_WITH_CONNECTION | 608 #undef VLOG_WITH_CONNECTION |
| OLD | NEW |