OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "device/gamepad/gamepad_service.h" | 5 #include "device/gamepad/gamepad_service.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 void GamepadService::OnGamepadDisconnected(int index, const Gamepad& pad) { | 133 void GamepadService::OnGamepadDisconnected(int index, const Gamepad& pad) { |
134 DCHECK(main_thread_task_runner_->BelongsToCurrentThread()); | 134 DCHECK(main_thread_task_runner_->BelongsToCurrentThread()); |
135 | 135 |
136 for (ConsumerSet::iterator it = consumers_.begin(); it != consumers_.end(); | 136 for (ConsumerSet::iterator it = consumers_.begin(); it != consumers_.end(); |
137 ++it) { | 137 ++it) { |
138 if (it->did_observe_user_gesture && it->is_active) | 138 if (it->did_observe_user_gesture && it->is_active) |
139 it->consumer->OnGamepadDisconnected(index, pad); | 139 it->consumer->OnGamepadDisconnected(index, pad); |
140 } | 140 } |
141 } | 141 } |
142 | 142 |
143 base::SharedMemoryHandle GamepadService::GetSharedMemoryHandleForProcess( | 143 base::SharedMemoryHandle GamepadService::DuplicateSharedMemoryHandle() { |
144 base::ProcessHandle handle) { | |
145 DCHECK(main_thread_task_runner_->BelongsToCurrentThread()); | 144 DCHECK(main_thread_task_runner_->BelongsToCurrentThread()); |
146 return provider_->GetSharedMemoryHandleForProcess(handle); | 145 return provider_->DuplicateSharedMemoryHandle(); |
147 } | 146 } |
148 | 147 |
149 mojo::ScopedSharedBufferHandle GamepadService::GetSharedBufferHandle() { | 148 mojo::ScopedSharedBufferHandle GamepadService::GetSharedBufferHandle() { |
150 DCHECK(main_thread_task_runner_->BelongsToCurrentThread()); | 149 DCHECK(main_thread_task_runner_->BelongsToCurrentThread()); |
151 return provider_->GetSharedBufferHandle(); | 150 return provider_->GetSharedBufferHandle(); |
152 } | 151 } |
153 | 152 |
154 void GamepadService::OnUserGesture() { | 153 void GamepadService::OnUserGesture() { |
155 DCHECK(main_thread_task_runner_->BelongsToCurrentThread()); | 154 DCHECK(main_thread_task_runner_->BelongsToCurrentThread()); |
156 | 155 |
(...skipping 16 matching lines...) Expand all Loading... |
173 } | 172 } |
174 } | 173 } |
175 } | 174 } |
176 } | 175 } |
177 | 176 |
178 void GamepadService::SetSanitizationEnabled(bool sanitize) { | 177 void GamepadService::SetSanitizationEnabled(bool sanitize) { |
179 provider_->SetSanitizationEnabled(sanitize); | 178 provider_->SetSanitizationEnabled(sanitize); |
180 } | 179 } |
181 | 180 |
182 } // namespace device | 181 } // namespace device |
OLD | NEW |