Chromium Code Reviews| Index: components/proximity_auth/remote_device_life_cycle_impl.cc |
| diff --git a/components/proximity_auth/remote_device_life_cycle_impl.cc b/components/proximity_auth/remote_device_life_cycle_impl.cc |
| index a9d2538b0eda6321cd2ac804bbf49dd8733adcff..f7c532be147791803074db618631afc8f4427967 100644 |
| --- a/components/proximity_auth/remote_device_life_cycle_impl.cc |
| +++ b/components/proximity_auth/remote_device_life_cycle_impl.cc |
| @@ -43,6 +43,7 @@ RemoteDeviceLifeCycleImpl::RemoteDeviceLifeCycleImpl( |
| : remote_device_(remote_device), |
| proximity_auth_client_(proximity_auth_client), |
| state_(RemoteDeviceLifeCycle::State::STOPPED), |
| + observers_(base::ObserverList<Observer>::NOTIFY_EXISTING_ONLY), |
| bluetooth_throttler_(new BluetoothThrottlerImpl( |
| make_scoped_ptr(new base::DefaultTickClock()))), |
| weak_ptr_factory_(this) {} |
| @@ -114,6 +115,7 @@ void RemoteDeviceLifeCycleImpl::FindConnection() { |
| void RemoteDeviceLifeCycleImpl::OnConnectionFound( |
| scoped_ptr<Connection> connection) { |
| DCHECK(state_ == RemoteDeviceLifeCycle::State::FINDING_CONNECTION); |
| + connection_finder_.reset(); |
| connection_ = connection.Pass(); |
| authenticator_ = CreateAuthenticator(); |
| authenticator_->Authenticate( |
| @@ -126,6 +128,7 @@ void RemoteDeviceLifeCycleImpl::OnAuthenticationResult( |
| Authenticator::Result result, |
| scoped_ptr<SecureContext> secure_context) { |
| DCHECK(state_ == RemoteDeviceLifeCycle::State::AUTHENTICATING); |
| + authenticator_.reset(); |
| if (result != Authenticator::Result::SUCCESS) { |
| PA_LOG(WARNING) << "Waiting " << kAuthenticationRecoveryTimeSeconds |
| << " seconds to retry after authentication failure."; |
| @@ -139,9 +142,8 @@ void RemoteDeviceLifeCycleImpl::OnAuthenticationResult( |
| } |
| // Create the MessengerImpl asynchronously. |messenger_| registers itself as |
| - // an |
| - // observer of |connection_|, so creating it synchronously would |
| - // trigger |OnSendComplete()| as an observer call for |messenger_|. |
| + // an observer of |connection_|, so creating it synchronously would trigger |
| + // |OnSendComplete()| as an observer call for |messenger_|. |
|
sacomoto
2015/09/29 20:58:33
nit: s/OnSendComplete/OnSendCompleted/.
Tim Song
2015/09/30 00:05:04
Done.
|
| secure_context_ = secure_context.Pass(); |
| base::ThreadTaskRunnerHandle::Get()->PostTask( |
| FROM_HERE, base::Bind(&RemoteDeviceLifeCycleImpl::CreateMessenger, |
| @@ -160,6 +162,7 @@ void RemoteDeviceLifeCycleImpl::CreateMessenger() { |
| void RemoteDeviceLifeCycleImpl::OnDisconnected() { |
| DCHECK(state_ == RemoteDeviceLifeCycle::State::SECURE_CHANNEL_ESTABLISHED); |
| + messenger_.reset(); |
| FindConnection(); |
| } |