| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/arc/arc_bridge_bootstrap.h" | 5 #include "components/arc/arc_bridge_bootstrap.h" |
| 6 | 6 |
| 7 #include <fcntl.h> | 7 #include <fcntl.h> |
| 8 #include <grp.h> | 8 #include <grp.h> |
| 9 #include <unistd.h> | 9 #include <unistd.h> |
| 10 | 10 |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 base::WeakPtrFactory<ArcBridgeBootstrapImpl> weak_factory_; | 121 base::WeakPtrFactory<ArcBridgeBootstrapImpl> weak_factory_; |
| 122 | 122 |
| 123 private: | 123 private: |
| 124 DISALLOW_COPY_AND_ASSIGN(ArcBridgeBootstrapImpl); | 124 DISALLOW_COPY_AND_ASSIGN(ArcBridgeBootstrapImpl); |
| 125 }; | 125 }; |
| 126 | 126 |
| 127 ArcBridgeBootstrapImpl::ArcBridgeBootstrapImpl() : weak_factory_(this) {} | 127 ArcBridgeBootstrapImpl::ArcBridgeBootstrapImpl() : weak_factory_(this) {} |
| 128 | 128 |
| 129 ArcBridgeBootstrapImpl::~ArcBridgeBootstrapImpl() { | 129 ArcBridgeBootstrapImpl::~ArcBridgeBootstrapImpl() { |
| 130 DCHECK(thread_checker_.CalledOnValidThread()); | 130 DCHECK(thread_checker_.CalledOnValidThread()); |
| 131 DCHECK(state_ == State::STOPPED); | 131 DCHECK(state_ == State::STOPPED || state_ == State::STOPPING); |
| 132 } | 132 } |
| 133 | 133 |
| 134 void ArcBridgeBootstrapImpl::Start() { | 134 void ArcBridgeBootstrapImpl::Start() { |
| 135 DCHECK(thread_checker_.CalledOnValidThread()); | 135 DCHECK(thread_checker_.CalledOnValidThread()); |
| 136 DCHECK(delegate_); | 136 DCHECK(delegate_); |
| 137 if (state_ != State::STOPPED) { | 137 if (state_ != State::STOPPED) { |
| 138 VLOG(1) << "Start() called when instance is not stopped"; | 138 VLOG(1) << "Start() called when instance is not stopped"; |
| 139 return; | 139 return; |
| 140 } | 140 } |
| 141 SetState(State::SOCKET_CREATING); | 141 SetState(State::SOCKET_CREATING); |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 322 DCHECK(delegate_); | 322 DCHECK(delegate_); |
| 323 SetState(State::STOPPED); | 323 SetState(State::STOPPED); |
| 324 delegate_->OnStopped(); | 324 delegate_->OnStopped(); |
| 325 } | 325 } |
| 326 | 326 |
| 327 void ArcBridgeBootstrapImpl::SetState(State state) { | 327 void ArcBridgeBootstrapImpl::SetState(State state) { |
| 328 DCHECK(thread_checker_.CalledOnValidThread()); | 328 DCHECK(thread_checker_.CalledOnValidThread()); |
| 329 // DCHECK on enum classes not supported. | 329 // DCHECK on enum classes not supported. |
| 330 DCHECK(state_ != state); | 330 DCHECK(state_ != state); |
| 331 state_ = state; | 331 state_ = state; |
| 332 VLOG(2) << "State: " << static_cast<uint32_t>(state_); |
| 332 } | 333 } |
| 333 | 334 |
| 334 } // namespace | 335 } // namespace |
| 335 | 336 |
| 336 ArcBridgeBootstrap::ArcBridgeBootstrap() {} | |
| 337 | |
| 338 ArcBridgeBootstrap::~ArcBridgeBootstrap() {} | |
| 339 | |
| 340 // static | 337 // static |
| 341 std::unique_ptr<ArcBridgeBootstrap> ArcBridgeBootstrap::Create() { | 338 std::unique_ptr<ArcBridgeBootstrap> ArcBridgeBootstrap::Create() { |
| 342 return base::WrapUnique(new ArcBridgeBootstrapImpl()); | 339 return base::WrapUnique(new ArcBridgeBootstrapImpl()); |
| 343 } | 340 } |
| 344 | 341 |
| 345 } // namespace arc | 342 } // namespace arc |
| OLD | NEW |