| 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 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 LOG(ERROR) << "Invalid handle"; | 280 LOG(ERROR) << "Invalid handle"; |
| 281 return; | 281 return; |
| 282 } | 282 } |
| 283 mojo::ScopedMessagePipeHandle server_pipe = mojo::edk::CreateMessagePipe( | 283 mojo::ScopedMessagePipeHandle server_pipe = mojo::edk::CreateMessagePipe( |
| 284 mojo::edk::ScopedPlatformHandle(mojo::edk::PlatformHandle(fd.release()))); | 284 mojo::edk::ScopedPlatformHandle(mojo::edk::PlatformHandle(fd.release()))); |
| 285 if (!server_pipe.is_valid()) { | 285 if (!server_pipe.is_valid()) { |
| 286 LOG(ERROR) << "Invalid pipe"; | 286 LOG(ERROR) << "Invalid pipe"; |
| 287 return; | 287 return; |
| 288 } | 288 } |
| 289 SetState(State::READY); | 289 SetState(State::READY); |
| 290 ArcBridgeInstancePtr instance; | 290 mojom::ArcBridgeInstancePtr instance; |
| 291 instance.Bind( | 291 instance.Bind(mojo::InterfacePtrInfo<mojom::ArcBridgeInstance>( |
| 292 mojo::InterfacePtrInfo<ArcBridgeInstance>(std::move(server_pipe), 0u)); | 292 std::move(server_pipe), 0u)); |
| 293 delegate_->OnConnectionEstablished(std::move(instance)); | 293 delegate_->OnConnectionEstablished(std::move(instance)); |
| 294 } | 294 } |
| 295 | 295 |
| 296 void ArcBridgeBootstrapImpl::Stop() { | 296 void ArcBridgeBootstrapImpl::Stop() { |
| 297 DCHECK(thread_checker_.CalledOnValidThread()); | 297 DCHECK(thread_checker_.CalledOnValidThread()); |
| 298 if (state_ == State::STOPPED || state_ == State::STOPPING) { | 298 if (state_ == State::STOPPED || state_ == State::STOPPING) { |
| 299 VLOG(1) << "Stop() called when ARC is not running"; | 299 VLOG(1) << "Stop() called when ARC is not running"; |
| 300 return; | 300 return; |
| 301 } | 301 } |
| 302 if (state_ == State::SOCKET_CREATING) { | 302 if (state_ == State::SOCKET_CREATING) { |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 335 ArcBridgeBootstrap::ArcBridgeBootstrap() {} | 335 ArcBridgeBootstrap::ArcBridgeBootstrap() {} |
| 336 | 336 |
| 337 ArcBridgeBootstrap::~ArcBridgeBootstrap() {} | 337 ArcBridgeBootstrap::~ArcBridgeBootstrap() {} |
| 338 | 338 |
| 339 // static | 339 // static |
| 340 scoped_ptr<ArcBridgeBootstrap> ArcBridgeBootstrap::Create() { | 340 scoped_ptr<ArcBridgeBootstrap> ArcBridgeBootstrap::Create() { |
| 341 return make_scoped_ptr(new ArcBridgeBootstrapImpl()); | 341 return make_scoped_ptr(new ArcBridgeBootstrapImpl()); |
| 342 } | 342 } |
| 343 | 343 |
| 344 } // namespace arc | 344 } // namespace arc |
| OLD | NEW |