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

Side by Side Diff: content/renderer/pepper/pepper_platform_audio_output_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: fix mac 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_output_impl.h" 5 #include "content/renderer/pepper/pepper_platform_audio_output_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/message_loop_proxy.h" 10 #include "base/message_loop_proxy.h"
(...skipping 12 matching lines...) Expand all
23 int sample_rate, 23 int sample_rate,
24 int frames_per_buffer, 24 int frames_per_buffer,
25 int source_render_view_id, 25 int source_render_view_id,
26 webkit::ppapi::PluginDelegate::PlatformAudioOutputClient* client) { 26 webkit::ppapi::PluginDelegate::PlatformAudioOutputClient* client) {
27 scoped_refptr<PepperPlatformAudioOutputImpl> audio_output( 27 scoped_refptr<PepperPlatformAudioOutputImpl> audio_output(
28 new PepperPlatformAudioOutputImpl()); 28 new PepperPlatformAudioOutputImpl());
29 if (audio_output->Initialize(sample_rate, frames_per_buffer, 29 if (audio_output->Initialize(sample_rate, frames_per_buffer,
30 source_render_view_id, client)) { 30 source_render_view_id, client)) {
31 // Balanced by Release invoked in 31 // Balanced by Release invoked in
32 // PepperPlatformAudioOutputImpl::ShutDownOnIOThread(). 32 // PepperPlatformAudioOutputImpl::ShutDownOnIOThread().
33 return audio_output.release(); 33 audio_output->AddRef();
34 return audio_output.get();
34 } 35 }
35 return NULL; 36 return NULL;
36 } 37 }
37 38
38 bool PepperPlatformAudioOutputImpl::StartPlayback() { 39 bool PepperPlatformAudioOutputImpl::StartPlayback() {
39 if (ipc_) { 40 if (ipc_) {
40 ChildProcess::current()->io_message_loop()->PostTask( 41 ChildProcess::current()->io_message_loop()->PostTask(
41 FROM_HERE, 42 FROM_HERE,
42 base::Bind(&PepperPlatformAudioOutputImpl::StartPlaybackOnIOThread, 43 base::Bind(&PepperPlatformAudioOutputImpl::StartPlaybackOnIOThread,
43 this)); 44 this));
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 178
178 ipc_->CloseStream(stream_id_); 179 ipc_->CloseStream(stream_id_);
179 ipc_->RemoveDelegate(stream_id_); 180 ipc_->RemoveDelegate(stream_id_);
180 stream_id_ = 0; 181 stream_id_ = 0;
181 182
182 Release(); // Release for the delegate, balances out the reference taken in 183 Release(); // Release for the delegate, balances out the reference taken in
183 // PepperPluginDelegateImpl::CreateAudio. 184 // PepperPluginDelegateImpl::CreateAudio.
184 } 185 }
185 186
186 } // namespace content 187 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698