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

Side by Side Diff: content/renderer/media/buffered_data_source.cc

Issue 435023002: Revert "Revert 285479 "Make DataSource::Stop() synchronous."" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/media/buffered_data_source.h" 5 #include "content/renderer/media/buffered_data_source.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback_helpers.h" 8 #include "base/callback_helpers.h"
9 #include "base/message_loop/message_loop_proxy.h" 9 #include "base/message_loop/message_loop_proxy.h"
10 #include "content/public/common/url_constants.h" 10 #include "content/public/common/url_constants.h"
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 UpdateDeferStrategy(false); 200 UpdateDeferStrategy(false);
201 } 201 }
202 202
203 void BufferedDataSource::MediaIsPaused() { 203 void BufferedDataSource::MediaIsPaused() {
204 DCHECK(render_loop_->BelongsToCurrentThread()); 204 DCHECK(render_loop_->BelongsToCurrentThread());
205 UpdateDeferStrategy(true); 205 UpdateDeferStrategy(true);
206 } 206 }
207 207
208 ///////////////////////////////////////////////////////////////////////////// 208 /////////////////////////////////////////////////////////////////////////////
209 // media::DataSource implementation. 209 // media::DataSource implementation.
210 void BufferedDataSource::Stop(const base::Closure& closure) { 210 void BufferedDataSource::Stop() {
211 { 211 {
212 base::AutoLock auto_lock(lock_); 212 base::AutoLock auto_lock(lock_);
213 StopInternal_Locked(); 213 StopInternal_Locked();
214 } 214 }
215 closure.Run();
216 215
217 render_loop_->PostTask( 216 render_loop_->PostTask(
218 FROM_HERE, 217 FROM_HERE,
219 base::Bind(&BufferedDataSource::StopLoader, weak_factory_.GetWeakPtr())); 218 base::Bind(&BufferedDataSource::StopLoader, weak_factory_.GetWeakPtr()));
220 } 219 }
221 220
222 void BufferedDataSource::SetBitrate(int bitrate) { 221 void BufferedDataSource::SetBitrate(int bitrate) {
223 render_loop_->PostTask(FROM_HERE, 222 render_loop_->PostTask(FROM_HERE,
224 base::Bind(&BufferedDataSource::SetBitrateTask, 223 base::Bind(&BufferedDataSource::SetBitrateTask,
225 weak_factory_.GetWeakPtr(), 224 weak_factory_.GetWeakPtr(),
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
528 } 527 }
529 528
530 // If media is currently playing or the page indicated preload=auto or the 529 // If media is currently playing or the page indicated preload=auto or the
531 // the server does not support the byte range request or we do not want to go 530 // the server does not support the byte range request or we do not want to go
532 // too far ahead of the read head, use threshold strategy to enable/disable 531 // too far ahead of the read head, use threshold strategy to enable/disable
533 // deferring when the buffer is full/depleted. 532 // deferring when the buffer is full/depleted.
534 loader_->UpdateDeferStrategy(BufferedResourceLoader::kCapacityDefer); 533 loader_->UpdateDeferStrategy(BufferedResourceLoader::kCapacityDefer);
535 } 534 }
536 535
537 } // namespace content 536 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/media/buffered_data_source.h ('k') | content/renderer/media/buffered_data_source_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698