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 "content/renderer/pepper/pepper_platform_audio_output.h" | 5 #include "content/renderer/pepper/pepper_platform_audio_output.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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 media::AudioOutputIPCDelegate::State state) {} | 73 media::AudioOutputIPCDelegate::State state) {} |
74 | 74 |
75 void PepperPlatformAudioOutput::OnStreamCreated( | 75 void PepperPlatformAudioOutput::OnStreamCreated( |
76 base::SharedMemoryHandle handle, | 76 base::SharedMemoryHandle handle, |
77 base::SyncSocket::Handle socket_handle, | 77 base::SyncSocket::Handle socket_handle, |
78 int length) { | 78 int length) { |
79 #if defined(OS_WIN) | 79 #if defined(OS_WIN) |
80 DCHECK(handle); | 80 DCHECK(handle); |
81 DCHECK(socket_handle); | 81 DCHECK(socket_handle); |
82 #else | 82 #else |
83 DCHECK_NE(-1, handle.fd); | 83 DCHECK(base::SharedMemory::IsHandleValid(handle)); |
84 DCHECK_NE(-1, socket_handle); | 84 DCHECK_NE(-1, socket_handle); |
85 #endif | 85 #endif |
86 DCHECK(length); | 86 DCHECK(length); |
87 | 87 |
88 if (base::ThreadTaskRunnerHandle::Get().get() == main_task_runner_.get()) { | 88 if (base::ThreadTaskRunnerHandle::Get().get() == main_task_runner_.get()) { |
89 // Must dereference the client only on the main thread. Shutdown may have | 89 // Must dereference the client only on the main thread. Shutdown may have |
90 // occurred while the request was in-flight, so we need to NULL check. | 90 // occurred while the request was in-flight, so we need to NULL check. |
91 if (client_) | 91 if (client_) |
92 client_->StreamCreated(handle, length, socket_handle); | 92 client_->StreamCreated(handle, length, socket_handle); |
93 } else { | 93 } else { |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 return; | 164 return; |
165 | 165 |
166 ipc_->CloseStream(); | 166 ipc_->CloseStream(); |
167 ipc_.reset(); | 167 ipc_.reset(); |
168 | 168 |
169 Release(); // Release for the delegate, balances out the reference taken in | 169 Release(); // Release for the delegate, balances out the reference taken in |
170 // PepperPlatformAudioOutput::Create. | 170 // PepperPlatformAudioOutput::Create. |
171 } | 171 } |
172 | 172 |
173 } // namespace content | 173 } // namespace content |
OLD | NEW |