Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(201)

Side by Side Diff: content/renderer/pepper/pepper_platform_audio_input_impl.cc

Issue 11458003: Remove scoped_refptr::release which is confusing and causes leaks. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: duh Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 12 matching lines...) Expand all
23 const std::string& device_id, 23 const std::string& device_id,
24 int sample_rate, 24 int sample_rate,
25 int frames_per_buffer, 25 int frames_per_buffer,
26 webkit::ppapi::PluginDelegate::PlatformAudioInputClient* client) { 26 webkit::ppapi::PluginDelegate::PlatformAudioInputClient* client) {
27 scoped_refptr<PepperPlatformAudioInputImpl> audio_input( 27 scoped_refptr<PepperPlatformAudioInputImpl> audio_input(
28 new PepperPlatformAudioInputImpl()); 28 new PepperPlatformAudioInputImpl());
29 if (audio_input->Initialize(plugin_delegate, device_id, sample_rate, 29 if (audio_input->Initialize(plugin_delegate, device_id, sample_rate,
30 frames_per_buffer, client)) { 30 frames_per_buffer, client)) {
31 // Balanced by Release invoked in 31 // Balanced by Release invoked in
32 // PepperPlatformAudioInputImpl::ShutDownOnIOThread(). 32 // PepperPlatformAudioInputImpl::ShutDownOnIOThread().
33 return audio_input.release(); 33 audio_input->AddRef();
34 return audio_input.get();
34 } 35 }
35 return NULL; 36 return NULL;
36 } 37 }
37 38
38 void PepperPlatformAudioInputImpl::StartCapture() { 39 void PepperPlatformAudioInputImpl::StartCapture() {
39 DCHECK(main_message_loop_proxy_->BelongsToCurrentThread()); 40 DCHECK(main_message_loop_proxy_->BelongsToCurrentThread());
40 41
41 ChildProcess::current()->io_message_loop()->PostTask( 42 ChildProcess::current()->io_message_loop()->PostTask(
42 FROM_HERE, 43 FROM_HERE,
43 base::Bind(&PepperPlatformAudioInputImpl::StartCaptureOnIOThread, this)); 44 base::Bind(&PepperPlatformAudioInputImpl::StartCaptureOnIOThread, this));
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 } 279 }
279 280
280 void PepperPlatformAudioInputImpl::NotifyStreamCreationFailed() { 281 void PepperPlatformAudioInputImpl::NotifyStreamCreationFailed() {
281 DCHECK(main_message_loop_proxy_->BelongsToCurrentThread()); 282 DCHECK(main_message_loop_proxy_->BelongsToCurrentThread());
282 283
283 if (client_) 284 if (client_)
284 client_->StreamCreationFailed(); 285 client_->StreamCreationFailed();
285 } 286 }
286 287
287 } // namespace content 288 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698