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

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

Issue 1924383002: BufferedDataSource now caches redirects for subsequent requests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 | media/blink/buffered_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/buffered_data_source.h" 5 #include "media/blink/buffered_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 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 380
381 bool init_cb_is_null = false; 381 bool init_cb_is_null = false;
382 { 382 {
383 base::AutoLock auto_lock(lock_); 383 base::AutoLock auto_lock(lock_);
384 init_cb_is_null = init_cb_.is_null(); 384 init_cb_is_null = init_cb_.is_null();
385 } 385 }
386 if (init_cb_is_null) { 386 if (init_cb_is_null) {
387 loader_->Stop(); 387 loader_->Stop();
388 return; 388 return;
389 } 389 }
390
390 response_original_url_ = loader_->response_original_url(); 391 response_original_url_ = loader_->response_original_url();
392 // The response original url is the URL of this resource after following
393 // redirects. Update |url_| to this so that we only follow redirects once for
394 // simplicity and efficiency.
395 // If it's empty, it was a response from a Service Worker, so keep the
hubbe 2016/04/28 19:34:17 Why do we care if it's a service worker?
watk 2016/04/28 20:05:16 I guess my phrasing is slightly misleading. It's n
396 // original URL.
397 if (!response_original_url_.is_empty())
398 url_ = response_original_url_;
391 399
392 // All responses must be successful. Resources that are assumed to be fully 400 // All responses must be successful. Resources that are assumed to be fully
393 // buffered must have a known content length. 401 // buffered must have a known content length.
394 bool success = status == BufferedResourceLoader::kOk && 402 bool success = status == BufferedResourceLoader::kOk &&
395 (!assume_fully_buffered() || 403 (!assume_fully_buffered() ||
396 loader_->instance_size() != kPositionNotSpecified); 404 loader_->instance_size() != kPositionNotSpecified);
397 405
398 if (success) { 406 if (success) {
399 total_bytes_ = loader_->instance_size(); 407 total_bytes_ = loader_->instance_size();
400 streaming_ = 408 streaming_ =
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
608 } 616 }
609 617
610 // If media is currently playing or the page indicated preload=auto or the 618 // If media is currently playing or the page indicated preload=auto or the
611 // the server does not support the byte range request or we do not want to go 619 // the server does not support the byte range request or we do not want to go
612 // too far ahead of the read head, use threshold strategy to enable/disable 620 // too far ahead of the read head, use threshold strategy to enable/disable
613 // deferring when the buffer is full/depleted. 621 // deferring when the buffer is full/depleted.
614 loader_->UpdateDeferStrategy(BufferedResourceLoader::kCapacityDefer); 622 loader_->UpdateDeferStrategy(BufferedResourceLoader::kCapacityDefer);
615 } 623 }
616 624
617 } // namespace media 625 } // namespace media
OLDNEW
« no previous file with comments | « no previous file | media/blink/buffered_data_source_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698