| 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 414 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 425 } | 425 } | 
| 426 | 426 | 
| 427 bool BufferedDataSource::CheckPartialResponseURL( | 427 bool BufferedDataSource::CheckPartialResponseURL( | 
| 428     const GURL& partial_response_original_url) const { | 428     const GURL& partial_response_original_url) const { | 
| 429   // We check the redirected URL of partial responses in case malicious | 429   // We check the redirected URL of partial responses in case malicious | 
| 430   // attackers scan the bytes of other origin resources by mixing their | 430   // attackers scan the bytes of other origin resources by mixing their | 
| 431   // generated bytes and the target response. See http://crbug.com/489060#c32 | 431   // generated bytes and the target response. See http://crbug.com/489060#c32 | 
| 432   // for details. | 432   // for details. | 
| 433   // If the origin of the new response is different from the first response we | 433   // If the origin of the new response is different from the first response we | 
| 434   // deny the redirected response unless the crossorigin attribute has been set. | 434   // deny the redirected response unless the crossorigin attribute has been set. | 
| 435   return (response_original_url_.GetOrigin() == | 435   if ((response_original_url_.GetOrigin() == | 
| 436           partial_response_original_url.GetOrigin()) || | 436        partial_response_original_url.GetOrigin()) || | 
| 437          DidPassCORSAccessCheck(); | 437       DidPassCORSAccessCheck()) { | 
|  | 438     return true; | 
|  | 439   } | 
|  | 440 | 
|  | 441   MEDIA_LOG(ERROR, media_log_) << "BufferedDataSource: origin has changed"; | 
|  | 442   return false; | 
| 438 } | 443 } | 
| 439 | 444 | 
| 440 void BufferedDataSource::ReadCallback( | 445 void BufferedDataSource::ReadCallback( | 
| 441     BufferedResourceLoader::Status status, | 446     BufferedResourceLoader::Status status, | 
| 442     int bytes_read) { | 447     int bytes_read) { | 
| 443   DCHECK(render_task_runner_->BelongsToCurrentThread()); | 448   DCHECK(render_task_runner_->BelongsToCurrentThread()); | 
| 444 | 449 | 
| 445   // TODO(scherkus): we shouldn't have to lock to signal host(), see | 450   // TODO(scherkus): we shouldn't have to lock to signal host(), see | 
| 446   // http://crbug.com/113712 for details. | 451   // http://crbug.com/113712 for details. | 
| 447   base::AutoLock auto_lock(lock_); | 452   base::AutoLock auto_lock(lock_); | 
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 566   } | 571   } | 
| 567 | 572 | 
| 568   // If media is currently playing or the page indicated preload=auto or the | 573   // If media is currently playing or the page indicated preload=auto or the | 
| 569   // the server does not support the byte range request or we do not want to go | 574   // the server does not support the byte range request or we do not want to go | 
| 570   // too far ahead of the read head, use threshold strategy to enable/disable | 575   // too far ahead of the read head, use threshold strategy to enable/disable | 
| 571   // deferring when the buffer is full/depleted. | 576   // deferring when the buffer is full/depleted. | 
| 572   loader_->UpdateDeferStrategy(BufferedResourceLoader::kCapacityDefer); | 577   loader_->UpdateDeferStrategy(BufferedResourceLoader::kCapacityDefer); | 
| 573 } | 578 } | 
| 574 | 579 | 
| 575 }  // namespace media | 580 }  // namespace media | 
| OLD | NEW | 
|---|