| 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 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 LOG(ERROR) << "Invalid handle"; | 288 LOG(ERROR) << "Invalid handle"; |
| 289 return; | 289 return; |
| 290 } | 290 } |
| 291 mojo::ScopedMessagePipeHandle server_pipe = mojo::edk::CreateMessagePipe( | 291 mojo::ScopedMessagePipeHandle server_pipe = mojo::edk::CreateMessagePipe( |
| 292 mojo::edk::ScopedPlatformHandle(mojo::edk::PlatformHandle(fd.release()))); | 292 mojo::edk::ScopedPlatformHandle(mojo::edk::PlatformHandle(fd.release()))); |
| 293 if (!server_pipe.is_valid()) { | 293 if (!server_pipe.is_valid()) { |
| 294 LOG(ERROR) << "Invalid pipe"; | 294 LOG(ERROR) << "Invalid pipe"; |
| 295 return; | 295 return; |
| 296 } | 296 } |
| 297 SetState(State::READY); | 297 SetState(State::READY); |
| 298 ArcBridgeInstancePtr instance; | 298 mojom::ArcBridgeInstancePtr instance; |
| 299 instance.Bind( | 299 instance.Bind(mojo::InterfacePtrInfo<mojom::ArcBridgeInstance>( |
| 300 mojo::InterfacePtrInfo<ArcBridgeInstance>(std::move(server_pipe), 0u)); | 300 std::move(server_pipe), 0u)); |
| 301 delegate_->OnConnectionEstablished(std::move(instance)); | 301 delegate_->OnConnectionEstablished(std::move(instance)); |
| 302 } | 302 } |
| 303 | 303 |
| 304 void ArcBridgeBootstrapImpl::Stop() { | 304 void ArcBridgeBootstrapImpl::Stop() { |
| 305 DCHECK(thread_checker_.CalledOnValidThread()); | 305 DCHECK(thread_checker_.CalledOnValidThread()); |
| 306 if (state_ == State::STOPPED || state_ == State::STOPPING) { | 306 if (state_ == State::STOPPED || state_ == State::STOPPING) { |
| 307 VLOG(1) << "Stop() called when ARC is not running"; | 307 VLOG(1) << "Stop() called when ARC is not running"; |
| 308 return; | 308 return; |
| 309 } | 309 } |
| 310 if (state_ == State::SOCKET_CREATING) { | 310 if (state_ == State::SOCKET_CREATING) { |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 343 ArcBridgeBootstrap::ArcBridgeBootstrap() {} | 343 ArcBridgeBootstrap::ArcBridgeBootstrap() {} |
| 344 | 344 |
| 345 ArcBridgeBootstrap::~ArcBridgeBootstrap() {} | 345 ArcBridgeBootstrap::~ArcBridgeBootstrap() {} |
| 346 | 346 |
| 347 // static | 347 // static |
| 348 scoped_ptr<ArcBridgeBootstrap> ArcBridgeBootstrap::Create() { | 348 scoped_ptr<ArcBridgeBootstrap> ArcBridgeBootstrap::Create() { |
| 349 return make_scoped_ptr(new ArcBridgeBootstrapImpl()); | 349 return make_scoped_ptr(new ArcBridgeBootstrapImpl()); |
| 350 } | 350 } |
| 351 | 351 |
| 352 } // namespace arc | 352 } // namespace arc |
| OLD | NEW |