Chromium Code Reviews| 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 "media/blink/buffered_data_source.h" | 5 #include "media/blink/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/location.h" | 9 #include "base/location.h" |
| 10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 95 render_task_runner_(task_runner), | 95 render_task_runner_(task_runner), |
| 96 stop_signal_received_(false), | 96 stop_signal_received_(false), |
| 97 media_has_played_(false), | 97 media_has_played_(false), |
| 98 preload_(AUTO), | 98 preload_(AUTO), |
| 99 bitrate_(0), | 99 bitrate_(0), |
| 100 playback_rate_(0.0), | 100 playback_rate_(0.0), |
| 101 media_log_(media_log), | 101 media_log_(media_log), |
| 102 host_(host), | 102 host_(host), |
| 103 downloading_cb_(downloading_cb), | 103 downloading_cb_(downloading_cb), |
| 104 weak_factory_(this) { | 104 weak_factory_(this) { |
| 105 DCHECK(host_); | 105 DCHECK(host_); |
|
DaleCurtis
2014/11/19 21:14:10
DCHECK constructed on render_task_runner_ too?
no sievers
2014/11/19 21:16:21
It's not required in terms of the WeakPtr factory,
Wez
2014/11/19 21:38:55
If you want to allow this object to be created on
no sievers
2014/11/19 21:42:48
Done.
| |
| 106 DCHECK(!downloading_cb_.is_null()); | 106 DCHECK(!downloading_cb_.is_null()); |
| 107 } | 107 } |
| 108 | 108 |
| 109 BufferedDataSource::~BufferedDataSource() {} | 109 BufferedDataSource::~BufferedDataSource() { |
| 110 DCHECK(render_task_runner_->BelongsToCurrentThread()); | |
| 111 } | |
| 110 | 112 |
| 111 // A factory method to create BufferedResourceLoader using the read parameters. | 113 // A factory method to create BufferedResourceLoader using the read parameters. |
| 112 // This method can be overridden to inject mock BufferedResourceLoader object | 114 // This method can be overridden to inject mock BufferedResourceLoader object |
| 113 // for testing purpose. | 115 // for testing purpose. |
| 114 BufferedResourceLoader* BufferedDataSource::CreateResourceLoader( | 116 BufferedResourceLoader* BufferedDataSource::CreateResourceLoader( |
| 115 int64 first_byte_position, int64 last_byte_position) { | 117 int64 first_byte_position, int64 last_byte_position) { |
| 116 DCHECK(render_task_runner_->BelongsToCurrentThread()); | 118 DCHECK(render_task_runner_->BelongsToCurrentThread()); |
| 117 | 119 |
| 118 BufferedResourceLoader::DeferStrategy strategy = preload_ == METADATA ? | 120 BufferedResourceLoader::DeferStrategy strategy = preload_ == METADATA ? |
| 119 BufferedResourceLoader::kReadThenDefer : | 121 BufferedResourceLoader::kReadThenDefer : |
| (...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 527 } | 529 } |
| 528 | 530 |
| 529 // If media is currently playing or the page indicated preload=auto or the | 531 // If media is currently playing or the page indicated preload=auto or the |
| 530 // the server does not support the byte range request or we do not want to go | 532 // the server does not support the byte range request or we do not want to go |
| 531 // too far ahead of the read head, use threshold strategy to enable/disable | 533 // too far ahead of the read head, use threshold strategy to enable/disable |
| 532 // deferring when the buffer is full/depleted. | 534 // deferring when the buffer is full/depleted. |
| 533 loader_->UpdateDeferStrategy(BufferedResourceLoader::kCapacityDefer); | 535 loader_->UpdateDeferStrategy(BufferedResourceLoader::kCapacityDefer); |
| 534 } | 536 } |
| 535 | 537 |
| 536 } // namespace media | 538 } // namespace media |
| OLD | NEW |