| 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_input_impl.h" | 5 #include "content/renderer/pepper/pepper_platform_audio_input_impl.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/message_loop/message_loop_proxy.h" | 9 #include "base/message_loop/message_loop_proxy.h" |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 DCHECK(handle); | 75 DCHECK(handle); |
| 76 DCHECK(socket_handle); | 76 DCHECK(socket_handle); |
| 77 #else | 77 #else |
| 78 DCHECK_NE(-1, handle.fd); | 78 DCHECK_NE(-1, handle.fd); |
| 79 DCHECK_NE(-1, socket_handle); | 79 DCHECK_NE(-1, socket_handle); |
| 80 #endif | 80 #endif |
| 81 DCHECK(length); | 81 DCHECK(length); |
| 82 // TODO(yzshen): Make use of circular buffer scheme. crbug.com/181449. | 82 // TODO(yzshen): Make use of circular buffer scheme. crbug.com/181449. |
| 83 DCHECK_EQ(1, total_segments); | 83 DCHECK_EQ(1, total_segments); |
| 84 | 84 |
| 85 if (base::MessageLoopProxy::current() != main_message_loop_proxy_.get()) { | 85 if (base::MessageLoopProxy::current().get() != |
| 86 main_message_loop_proxy_.get()) { |
| 86 // If shutdown has occurred, |client_| will be NULL and the handles will be | 87 // If shutdown has occurred, |client_| will be NULL and the handles will be |
| 87 // cleaned up on the main thread. | 88 // cleaned up on the main thread. |
| 88 main_message_loop_proxy_->PostTask( | 89 main_message_loop_proxy_->PostTask( |
| 89 FROM_HERE, | 90 FROM_HERE, |
| 90 base::Bind(&PepperPlatformAudioInputImpl::OnStreamCreated, this, | 91 base::Bind(&PepperPlatformAudioInputImpl::OnStreamCreated, this, |
| 91 handle, socket_handle, length, total_segments)); | 92 handle, socket_handle, length, total_segments)); |
| 92 } else { | 93 } else { |
| 93 // Must dereference the client only on the main thread. Shutdown may have | 94 // Must dereference the client only on the main thread. Shutdown may have |
| 94 // occurred while the request was in-flight, so we need to NULL check. | 95 // occurred while the request was in-flight, so we need to NULL check. |
| 95 if (client_) { | 96 if (client_) { |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 } | 239 } |
| 239 | 240 |
| 240 void PepperPlatformAudioInputImpl::NotifyStreamCreationFailed() { | 241 void PepperPlatformAudioInputImpl::NotifyStreamCreationFailed() { |
| 241 DCHECK(main_message_loop_proxy_->BelongsToCurrentThread()); | 242 DCHECK(main_message_loop_proxy_->BelongsToCurrentThread()); |
| 242 | 243 |
| 243 if (client_) | 244 if (client_) |
| 244 client_->StreamCreationFailed(); | 245 client_->StreamCreationFailed(); |
| 245 } | 246 } |
| 246 | 247 |
| 247 } // namespace content | 248 } // namespace content |
| OLD | NEW |