| 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_service_impl.h" | 5 #include "components/arc/arc_bridge_service_impl.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
| 10 #include "base/prefs/pref_registry_simple.h" | 10 #include "base/prefs/pref_registry_simple.h" |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 | 98 |
| 99 bool ArcBridgeServiceImpl::RegisterInputDevice(const std::string& name, | 99 bool ArcBridgeServiceImpl::RegisterInputDevice(const std::string& name, |
| 100 const std::string& device_type, | 100 const std::string& device_type, |
| 101 base::ScopedFD fd) { | 101 base::ScopedFD fd) { |
| 102 DCHECK(origin_task_runner()->RunsTasksOnCurrentThread()); | 102 DCHECK(origin_task_runner()->RunsTasksOnCurrentThread()); |
| 103 if (state() != State::READY) { | 103 if (state() != State::READY) { |
| 104 LOG(ERROR) << "Called RegisterInputDevice when the service is not ready"; | 104 LOG(ERROR) << "Called RegisterInputDevice when the service is not ready"; |
| 105 return false; | 105 return false; |
| 106 } | 106 } |
| 107 return ipc_channel_->Send(new ArcInstanceMsg_RegisterInputDevice( | 107 return ipc_channel_->Send(new ArcInstanceMsg_RegisterInputDevice( |
| 108 name, device_type, base::FileDescriptor(fd.Pass()))); | 108 name, device_type, base::FileDescriptor(fd.release(), true))); |
| 109 } | 109 } |
| 110 | 110 |
| 111 void ArcBridgeServiceImpl::SocketConnect(const base::FilePath& socket_path) { | 111 void ArcBridgeServiceImpl::SocketConnect(const base::FilePath& socket_path) { |
| 112 DCHECK(origin_task_runner()->RunsTasksOnCurrentThread()); | 112 DCHECK(origin_task_runner()->RunsTasksOnCurrentThread()); |
| 113 if (state() != State::STOPPED) { | 113 if (state() != State::STOPPED) { |
| 114 VLOG(1) << "SocketConnect() called when instance is not stopped"; | 114 VLOG(1) << "SocketConnect() called when instance is not stopped"; |
| 115 return; | 115 return; |
| 116 } | 116 } |
| 117 SetState(State::CONNECTING); | 117 SetState(State::CONNECTING); |
| 118 base::PostTaskAndReplyWithResult( | 118 base::PostTaskAndReplyWithResult( |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 void ArcBridgeServiceImpl::OnInstanceStopped(bool success) { | 245 void ArcBridgeServiceImpl::OnInstanceStopped(bool success) { |
| 246 DCHECK(origin_task_runner()->RunsTasksOnCurrentThread()); | 246 DCHECK(origin_task_runner()->RunsTasksOnCurrentThread()); |
| 247 // STOPPING is the only valid state for this function. | 247 // STOPPING is the only valid state for this function. |
| 248 // DCHECK on enum classes not supported. | 248 // DCHECK on enum classes not supported. |
| 249 DCHECK(state() == State::STOPPING); | 249 DCHECK(state() == State::STOPPING); |
| 250 ipc_channel_.reset(); | 250 ipc_channel_.reset(); |
| 251 SetState(State::STOPPED); | 251 SetState(State::STOPPED); |
| 252 } | 252 } |
| 253 | 253 |
| 254 } // namespace arc | 254 } // namespace arc |
| OLD | NEW |