OLD | NEW |
1 // Copyright (c) 2017 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2017 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 "content/renderer/pepper/pepper_platform_audio_output_dev.h" | 5 #include "content/renderer/pepper/pepper_platform_audio_output_dev.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/location.h" | 8 #include "base/location.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 FROM_HERE, | 171 FROM_HERE, |
172 base::Bind(&PepperPlatformAudioOutputDev::NotifyStreamCreationFailed, | 172 base::Bind(&PepperPlatformAudioOutputDev::NotifyStreamCreationFailed, |
173 this)); | 173 this)); |
174 } | 174 } |
175 } | 175 } |
176 | 176 |
177 void PepperPlatformAudioOutputDev::OnStreamCreated( | 177 void PepperPlatformAudioOutputDev::OnStreamCreated( |
178 base::SharedMemoryHandle handle, | 178 base::SharedMemoryHandle handle, |
179 base::SyncSocket::Handle socket_handle, | 179 base::SyncSocket::Handle socket_handle, |
180 int length) { | 180 int length) { |
| 181 DCHECK(handle.IsValid()); |
181 #if defined(OS_WIN) | 182 #if defined(OS_WIN) |
182 DCHECK(handle.IsValid()); | |
183 DCHECK(socket_handle); | 183 DCHECK(socket_handle); |
184 #else | 184 #else |
185 DCHECK(base::SharedMemory::IsHandleValid(handle)); | |
186 DCHECK_NE(-1, socket_handle); | 185 DCHECK_NE(-1, socket_handle); |
187 #endif | 186 #endif |
188 DCHECK(length); | 187 DCHECK(length); |
189 | 188 |
190 if (base::ThreadTaskRunnerHandle::Get().get() == main_task_runner_.get()) { | 189 if (base::ThreadTaskRunnerHandle::Get().get() == main_task_runner_.get()) { |
191 // Must dereference the client only on the main thread. Shutdown may have | 190 // Must dereference the client only on the main thread. Shutdown may have |
192 // occurred while the request was in-flight, so we need to NULL check. | 191 // occurred while the request was in-flight, so we need to NULL check. |
193 if (client_) | 192 if (client_) |
194 client_->StreamCreated(handle, length, socket_handle); | 193 client_->StreamCreated(handle, length, socket_handle); |
195 } else { | 194 } else { |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 } | 397 } |
399 | 398 |
400 void PepperPlatformAudioOutputDev::NotifyStreamCreationFailed() { | 399 void PepperPlatformAudioOutputDev::NotifyStreamCreationFailed() { |
401 DCHECK(main_task_runner_->BelongsToCurrentThread()); | 400 DCHECK(main_task_runner_->BelongsToCurrentThread()); |
402 | 401 |
403 if (client_) | 402 if (client_) |
404 client_->StreamCreationFailed(); | 403 client_->StreamCreationFailed(); |
405 } | 404 } |
406 | 405 |
407 } // namespace content | 406 } // namespace content |
OLD | NEW |