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 "components/cast_channel/cast_socket.h" | 5 #include "components/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 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 CastTransport* CastSocketImpl::transport() const { | 289 CastTransport* CastSocketImpl::transport() const { |
290 return transport_.get(); | 290 return transport_.get(); |
291 } | 291 } |
292 | 292 |
293 void CastSocketImpl::AddObserver(Observer* observer) { | 293 void CastSocketImpl::AddObserver(Observer* observer) { |
294 DCHECK(observer); | 294 DCHECK(observer); |
295 if (!observers_.HasObserver(observer)) | 295 if (!observers_.HasObserver(observer)) |
296 observers_.AddObserver(observer); | 296 observers_.AddObserver(observer); |
297 } | 297 } |
298 | 298 |
| 299 void CastSocketImpl::RemoveObserver(Observer* observer) { |
| 300 DCHECK(observer); |
| 301 observers_.RemoveObserver(observer); |
| 302 } |
| 303 |
299 void CastSocketImpl::OnConnectTimeout() { | 304 void CastSocketImpl::OnConnectTimeout() { |
300 DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); | 305 DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); |
301 // Stop all pending connection setup tasks and report back to the client. | 306 // Stop all pending connection setup tasks and report back to the client. |
302 is_canceled_ = true; | 307 is_canceled_ = true; |
303 VLOG_WITH_CONNECTION(1) << "Timeout while establishing a connection."; | 308 VLOG_WITH_CONNECTION(1) << "Timeout while establishing a connection."; |
304 SetErrorState(ChannelError::CONNECT_TIMEOUT); | 309 SetErrorState(ChannelError::CONNECT_TIMEOUT); |
305 DoConnectCallback(); | 310 DoConnectCallback(); |
306 } | 311 } |
307 | 312 |
308 void CastSocketImpl::ResetConnectLoopCallback() { | 313 void CastSocketImpl::ResetConnectLoopCallback() { |
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
645 void CastSocketImpl::CastSocketMessageDelegate::OnMessage( | 650 void CastSocketImpl::CastSocketMessageDelegate::OnMessage( |
646 const CastMessage& message) { | 651 const CastMessage& message) { |
647 for (auto& observer : socket_->observers_) | 652 for (auto& observer : socket_->observers_) |
648 observer.OnMessage(*socket_, message); | 653 observer.OnMessage(*socket_, message); |
649 } | 654 } |
650 | 655 |
651 void CastSocketImpl::CastSocketMessageDelegate::Start() {} | 656 void CastSocketImpl::CastSocketMessageDelegate::Start() {} |
652 | 657 |
653 } // namespace cast_channel | 658 } // namespace cast_channel |
654 #undef VLOG_WITH_CONNECTION | 659 #undef VLOG_WITH_CONNECTION |
OLD | NEW |