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

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

Issue 2271313002: Bugfix for cross-origin check (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: test added Created 4 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
« no previous file with comments | « media/blink/multibuffer_data_source.h ('k') | media/blink/multibuffer_data_source_unittest.cc » ('j') | 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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, 106 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner,
107 linked_ptr<UrlIndex> url_index, 107 linked_ptr<UrlIndex> url_index,
108 WebFrame* frame, 108 WebFrame* frame,
109 MediaLog* media_log, 109 MediaLog* media_log,
110 BufferedDataSourceHost* host, 110 BufferedDataSourceHost* host,
111 const DownloadingCB& downloading_cb) 111 const DownloadingCB& downloading_cb)
112 : cors_mode_(cors_mode), 112 : cors_mode_(cors_mode),
113 total_bytes_(kPositionNotSpecified), 113 total_bytes_(kPositionNotSpecified),
114 streaming_(false), 114 streaming_(false),
115 loading_(false), 115 loading_(false),
116 failed_(false),
116 render_task_runner_(task_runner), 117 render_task_runner_(task_runner),
117 url_index_(url_index), 118 url_index_(url_index),
118 frame_(frame), 119 frame_(frame),
119 stop_signal_received_(false), 120 stop_signal_received_(false),
120 media_has_played_(false), 121 media_has_played_(false),
121 buffering_strategy_(BUFFERING_STRATEGY_NORMAL), 122 buffering_strategy_(BUFFERING_STRATEGY_NORMAL),
122 single_origin_(true), 123 single_origin_(true),
123 cancel_on_defer_(false), 124 cancel_on_defer_(false),
124 preload_(AUTO), 125 preload_(AUTO),
125 bitrate_(0), 126 bitrate_(0),
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 } else { 179 } else {
179 reader_->Wait(1, 180 reader_->Wait(1,
180 base::Bind(&MultibufferDataSource::StartCallback, weak_ptr_)); 181 base::Bind(&MultibufferDataSource::StartCallback, weak_ptr_));
181 } 182 }
182 } 183 }
183 184
184 void MultibufferDataSource::OnRedirect( 185 void MultibufferDataSource::OnRedirect(
185 const scoped_refptr<UrlData>& destination) { 186 const scoped_refptr<UrlData>& destination) {
186 if (!destination) { 187 if (!destination) {
187 // A failure occured. 188 // A failure occured.
189 failed_ = true;
188 if (!init_cb_.is_null()) { 190 if (!init_cb_.is_null()) {
189 render_task_runner_->PostTask( 191 render_task_runner_->PostTask(
190 FROM_HERE, 192 FROM_HERE,
191 base::Bind(&MultibufferDataSource::StartCallback, weak_ptr_)); 193 base::Bind(&MultibufferDataSource::StartCallback, weak_ptr_));
192 } else { 194 } else {
193 base::AutoLock auto_lock(lock_); 195 base::AutoLock auto_lock(lock_);
194 StopInternal_Locked(); 196 StopInternal_Locked();
195 } 197 }
196 StopLoader(); 198 StopLoader();
197 return; 199 return;
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 << "Initialize() must complete before calling HasSingleOrigin()"; 251 << "Initialize() must complete before calling HasSingleOrigin()";
250 return single_origin_; 252 return single_origin_;
251 } 253 }
252 254
253 bool MultibufferDataSource::DidPassCORSAccessCheck() const { 255 bool MultibufferDataSource::DidPassCORSAccessCheck() const {
254 if (cors_mode_ == UrlData::CORS_UNSPECIFIED) 256 if (cors_mode_ == UrlData::CORS_UNSPECIFIED)
255 return false; 257 return false;
256 // If init_cb is set, we initialization is not finished yet. 258 // If init_cb is set, we initialization is not finished yet.
257 if (!init_cb_.is_null()) 259 if (!init_cb_.is_null())
258 return false; 260 return false;
259 // Loader will be false if there was a failure. 261 if (failed_)
260 if (!reader_)
261 return false; 262 return false;
262 return true; 263 return true;
263 } 264 }
264 265
265 void MultibufferDataSource::Abort() { 266 void MultibufferDataSource::Abort() {
266 DCHECK(render_task_runner_->BelongsToCurrentThread()); 267 DCHECK(render_task_runner_->BelongsToCurrentThread());
267 { 268 {
268 base::AutoLock auto_lock(lock_); 269 base::AutoLock auto_lock(lock_);
269 StopInternal_Locked(); 270 StopInternal_Locked();
270 } 271 }
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
595 reader_->SetPinRange(back_buffer, kMaxBufferPreload + kPreloadHighExtra); 596 reader_->SetPinRange(back_buffer, kMaxBufferPreload + kPreloadHighExtra);
596 597
597 if (preload_ == METADATA) { 598 if (preload_ == METADATA) {
598 reader_->SetPreload(0, 0); 599 reader_->SetPreload(0, 0);
599 } else { 600 } else {
600 reader_->SetPreload(preload_high, preload); 601 reader_->SetPreload(preload_high, preload);
601 } 602 }
602 } 603 }
603 604
604 } // namespace media 605 } // namespace media
OLDNEW
« no previous file with comments | « media/blink/multibuffer_data_source.h ('k') | media/blink/multibuffer_data_source_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698