| 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 VLOG(1) << "State: " << static_cast<uint32_t>(state_); |
| 132 DCHECK(state_ == State::STOPPED || state_ == State::STOPPING); |
| 132 } | 133 } |
| 133 | 134 |
| 134 void ArcBridgeBootstrapImpl::Start() { | 135 void ArcBridgeBootstrapImpl::Start() { |
| 135 DCHECK(thread_checker_.CalledOnValidThread()); | 136 DCHECK(thread_checker_.CalledOnValidThread()); |
| 136 DCHECK(delegate_); | 137 DCHECK(delegate_); |
| 137 if (state_ != State::STOPPED) { | 138 if (state_ != State::STOPPED) { |
| 138 VLOG(1) << "Start() called when instance is not stopped"; | 139 VLOG(1) << "Start() called when instance is not stopped"; |
| 139 return; | 140 return; |
| 140 } | 141 } |
| 141 SetState(State::SOCKET_CREATING); | 142 SetState(State::SOCKET_CREATING); |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 322 DCHECK(delegate_); | 323 DCHECK(delegate_); |
| 323 SetState(State::STOPPED); | 324 SetState(State::STOPPED); |
| 324 delegate_->OnStopped(); | 325 delegate_->OnStopped(); |
| 325 } | 326 } |
| 326 | 327 |
| 327 void ArcBridgeBootstrapImpl::SetState(State state) { | 328 void ArcBridgeBootstrapImpl::SetState(State state) { |
| 328 DCHECK(thread_checker_.CalledOnValidThread()); | 329 DCHECK(thread_checker_.CalledOnValidThread()); |
| 329 // DCHECK on enum classes not supported. | 330 // DCHECK on enum classes not supported. |
| 330 DCHECK(state_ != state); | 331 DCHECK(state_ != state); |
| 331 state_ = state; | 332 state_ = state; |
| 333 VLOG(2) << "State: " << static_cast<uint32_t>(state_); |
| 332 } | 334 } |
| 333 | 335 |
| 334 } // namespace | 336 } // namespace |
| 335 | 337 |
| 336 ArcBridgeBootstrap::ArcBridgeBootstrap() {} | |
| 337 | |
| 338 ArcBridgeBootstrap::~ArcBridgeBootstrap() {} | |
| 339 | |
| 340 // static | 338 // static |
| 341 std::unique_ptr<ArcBridgeBootstrap> ArcBridgeBootstrap::Create() { | 339 std::unique_ptr<ArcBridgeBootstrap> ArcBridgeBootstrap::Create() { |
| 342 return base::WrapUnique(new ArcBridgeBootstrapImpl()); | 340 return base::WrapUnique(new ArcBridgeBootstrapImpl()); |
| 343 } | 341 } |
| 344 | 342 |
| 345 } // namespace arc | 343 } // namespace arc |
| OLD | NEW |