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

Side by Side Diff: media/blink/multibuffer_data_source.cc

Issue 2341483003: MultibufferDataSource: Handle HasSingleOrigin() before init completes. (Closed)
Patch Set: Created 4 years, 3 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "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
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 if (!init_cb_.is_null())
254 return true;
hubbe 2016/09/13 22:43:23 single_origin_ defaults to true, so this if statem
sandersd (OOO until July 31) 2016/09/13 22:50:37 But now it looks like it took me seconds to make t
253 return single_origin_; 255 return single_origin_;
254 } 256 }
255 257
256 bool MultibufferDataSource::DidPassCORSAccessCheck() const { 258 bool MultibufferDataSource::DidPassCORSAccessCheck() const {
257 if (cors_mode_ == UrlData::CORS_UNSPECIFIED) 259 if (cors_mode_ == UrlData::CORS_UNSPECIFIED)
258 return false; 260 return false;
259 // If init_cb is set, we initialization is not finished yet. 261 // If init_cb is set, we initialization is not finished yet.
260 if (!init_cb_.is_null()) 262 if (!init_cb_.is_null())
261 return false; 263 return false;
262 if (failed_) 264 if (failed_)
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
597 reader_->SetPinRange(back_buffer, kMaxBufferPreload + kPreloadHighExtra); 599 reader_->SetPinRange(back_buffer, kMaxBufferPreload + kPreloadHighExtra);
598 600
599 if (preload_ == METADATA) { 601 if (preload_ == METADATA) {
600 reader_->SetPreload(0, 0); 602 reader_->SetPreload(0, 0);
601 } else { 603 } else {
602 reader_->SetPreload(preload_high, preload); 604 reader_->SetPreload(preload_high, preload);
603 } 605 }
604 } 606 }
605 607
606 } // namespace media 608 } // namespace media
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698