| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "ppapi/shared_impl/ppb_tcp_socket_shared.h" | 5 #include "ppapi/shared_impl/ppb_tcp_socket_shared.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 | 8 |
| 9 namespace ppapi { | 9 namespace ppapi { |
| 10 | 10 |
| 11 TCPSocketState::TCPSocketState(StateType state) | 11 TCPSocketState::TCPSocketState(StateType state) |
| 12 : state_(state), | 12 : state_(state), pending_transition_(NONE) { |
| 13 pending_transition_(NONE) { | |
| 14 DCHECK(state_ == INITIAL || state_ == CONNECTED); | 13 DCHECK(state_ == INITIAL || state_ == CONNECTED); |
| 15 } | 14 } |
| 16 | 15 |
| 17 TCPSocketState::~TCPSocketState() { | 16 TCPSocketState::~TCPSocketState() {} |
| 18 } | |
| 19 | 17 |
| 20 void TCPSocketState::SetPendingTransition(TransitionType pending_transition) { | 18 void TCPSocketState::SetPendingTransition(TransitionType pending_transition) { |
| 21 DCHECK(IsValidTransition(pending_transition)); | 19 DCHECK(IsValidTransition(pending_transition)); |
| 22 pending_transition_ = pending_transition; | 20 pending_transition_ = pending_transition; |
| 23 } | 21 } |
| 24 | 22 |
| 25 void TCPSocketState::CompletePendingTransition(bool success) { | 23 void TCPSocketState::CompletePendingTransition(bool success) { |
| 26 switch (pending_transition_) { | 24 switch (pending_transition_) { |
| 27 case NONE: | 25 case NONE: |
| 28 NOTREACHED(); | 26 NOTREACHED(); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 | 79 |
| 82 bool TCPSocketState::IsConnected() const { | 80 bool TCPSocketState::IsConnected() const { |
| 83 return state_ == CONNECTED || state_ == SSL_CONNECTED; | 81 return state_ == CONNECTED || state_ == SSL_CONNECTED; |
| 84 } | 82 } |
| 85 | 83 |
| 86 bool TCPSocketState::IsBound() const { | 84 bool TCPSocketState::IsBound() const { |
| 87 return state_ != INITIAL && state_ != CLOSED; | 85 return state_ != INITIAL && state_ != CLOSED; |
| 88 } | 86 } |
| 89 | 87 |
| 90 } // namespace ppapi | 88 } // namespace ppapi |
| OLD | NEW |