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/multibuffer_data_source.h" | 5 #include "media/blink/multibuffer_data_source.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 | 241 |
242 void MultibufferDataSource::SetBufferingStrategy( | 242 void MultibufferDataSource::SetBufferingStrategy( |
243 BufferingStrategy buffering_strategy) { | 243 BufferingStrategy buffering_strategy) { |
244 DCHECK(render_task_runner_->BelongsToCurrentThread()); | 244 DCHECK(render_task_runner_->BelongsToCurrentThread()); |
245 buffering_strategy_ = buffering_strategy; | 245 buffering_strategy_ = buffering_strategy; |
246 UpdateBufferSizes(); | 246 UpdateBufferSizes(); |
247 } | 247 } |
248 | 248 |
249 bool MultibufferDataSource::HasSingleOrigin() { | 249 bool MultibufferDataSource::HasSingleOrigin() { |
250 DCHECK(render_task_runner_->BelongsToCurrentThread()); | 250 DCHECK(render_task_runner_->BelongsToCurrentThread()); |
251 DCHECK(init_cb_.is_null() && reader_.get()) | 251 // Before initialization completes there is no risk of leaking data. Callers |
252 << "Initialize() must complete before calling HasSingleOrigin()"; | 252 // are required to order checks such that this isn't a race. |
253 return single_origin_; | 253 return single_origin_; |
254 } | 254 } |
255 | 255 |
256 bool MultibufferDataSource::DidPassCORSAccessCheck() const { | 256 bool MultibufferDataSource::DidPassCORSAccessCheck() const { |
257 if (cors_mode_ == UrlData::CORS_UNSPECIFIED) | 257 if (cors_mode_ == UrlData::CORS_UNSPECIFIED) |
258 return false; | 258 return false; |
259 // If init_cb is set, we initialization is not finished yet. | 259 // If init_cb is set, we initialization is not finished yet. |
260 if (!init_cb_.is_null()) | 260 if (!init_cb_.is_null()) |
261 return false; | 261 return false; |
262 if (failed_) | 262 if (failed_) |
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
597 reader_->SetPinRange(back_buffer, kMaxBufferPreload + kPreloadHighExtra); | 597 reader_->SetPinRange(back_buffer, kMaxBufferPreload + kPreloadHighExtra); |
598 | 598 |
599 if (preload_ == METADATA) { | 599 if (preload_ == METADATA) { |
600 reader_->SetPreload(0, 0); | 600 reader_->SetPreload(0, 0); |
601 } else { | 601 } else { |
602 reader_->SetPreload(preload_high, preload); | 602 reader_->SetPreload(preload_high, preload); |
603 } | 603 } |
604 } | 604 } |
605 | 605 |
606 } // namespace media | 606 } // namespace media |
OLD | NEW |