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

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

Issue 17741010: Make ChildThread::current() and ChildProcess::current() only work on the main thread of the child... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: sync and also fix gpu single process case Created 7 years, 5 months 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/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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 128
129 ChildProcess::current()->io_message_loop()->PostTask( 129 ChildProcess::current()->io_message_loop()->PostTask(
130 FROM_HERE, 130 FROM_HERE,
131 base::Bind(&PepperPlatformAudioOutputImpl::InitializeOnIOThread, 131 base::Bind(&PepperPlatformAudioOutputImpl::InitializeOnIOThread,
132 this, params)); 132 this, params));
133 return true; 133 return true;
134 } 134 }
135 135
136 void PepperPlatformAudioOutputImpl::InitializeOnIOThread( 136 void PepperPlatformAudioOutputImpl::InitializeOnIOThread(
137 const media::AudioParameters& params) { 137 const media::AudioParameters& params) {
138 DCHECK(ChildProcess::current()->io_message_loop_proxy()->
139 BelongsToCurrentThread());
140 const int kSessionId = 0; 138 const int kSessionId = 0;
141 if (ipc_) 139 if (ipc_)
142 ipc_->CreateStream(this, params, kSessionId); 140 ipc_->CreateStream(this, params, kSessionId);
143 } 141 }
144 142
145 void PepperPlatformAudioOutputImpl::StartPlaybackOnIOThread() { 143 void PepperPlatformAudioOutputImpl::StartPlaybackOnIOThread() {
146 DCHECK(ChildProcess::current()->io_message_loop_proxy()->
147 BelongsToCurrentThread());
148 if (ipc_) 144 if (ipc_)
149 ipc_->PlayStream(); 145 ipc_->PlayStream();
150 } 146 }
151 147
152 void PepperPlatformAudioOutputImpl::StopPlaybackOnIOThread() { 148 void PepperPlatformAudioOutputImpl::StopPlaybackOnIOThread() {
153 DCHECK(ChildProcess::current()->io_message_loop_proxy()->
154 BelongsToCurrentThread());
155 if (ipc_) 149 if (ipc_)
156 ipc_->PauseStream(); 150 ipc_->PauseStream();
157 } 151 }
158 152
159 void PepperPlatformAudioOutputImpl::ShutDownOnIOThread() { 153 void PepperPlatformAudioOutputImpl::ShutDownOnIOThread() {
160 DCHECK(ChildProcess::current()->io_message_loop_proxy()->
161 BelongsToCurrentThread());
162
163 // Make sure we don't call shutdown more than once. 154 // Make sure we don't call shutdown more than once.
164 if (!ipc_) 155 if (!ipc_)
165 return; 156 return;
166 157
167 ipc_->CloseStream(); 158 ipc_->CloseStream();
168 ipc_.reset(); 159 ipc_.reset();
169 160
170 Release(); // Release for the delegate, balances out the reference taken in 161 Release(); // Release for the delegate, balances out the reference taken in
171 // PepperPluginDelegateImpl::CreateAudio. 162 // PepperPluginDelegateImpl::CreateAudio.
172 } 163 }
173 164
174 } // namespace content 165 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698