| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |