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_proxy.h" | 9 #include "base/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_) { | 85 if (base::MessageLoopProxy::current() != main_message_loop_proxy_.get()) { |
86 // If shutdown has occurred, |client_| will be NULL and the handles will be | 86 // If shutdown has occurred, |client_| will be NULL and the handles will be |
87 // cleaned up on the main thread. | 87 // cleaned up on the main thread. |
88 main_message_loop_proxy_->PostTask( | 88 main_message_loop_proxy_->PostTask( |
89 FROM_HERE, | 89 FROM_HERE, |
90 base::Bind(&PepperPlatformAudioInputImpl::OnStreamCreated, this, | 90 base::Bind(&PepperPlatformAudioInputImpl::OnStreamCreated, this, |
91 handle, socket_handle, length, total_segments)); | 91 handle, socket_handle, length, total_segments)); |
92 } else { | 92 } else { |
93 // Must dereference the client only on the main thread. Shutdown may have | 93 // 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. | 94 // occurred while the request was in-flight, so we need to NULL check. |
95 if (client_) { | 95 if (client_) { |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 } | 238 } |
239 | 239 |
240 void PepperPlatformAudioInputImpl::NotifyStreamCreationFailed() { | 240 void PepperPlatformAudioInputImpl::NotifyStreamCreationFailed() { |
241 DCHECK(main_message_loop_proxy_->BelongsToCurrentThread()); | 241 DCHECK(main_message_loop_proxy_->BelongsToCurrentThread()); |
242 | 242 |
243 if (client_) | 243 if (client_) |
244 client_->StreamCreationFailed(); | 244 client_->StreamCreationFailed(); |
245 } | 245 } |
246 | 246 |
247 } // namespace content | 247 } // namespace content |
OLD | NEW |