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

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

Issue 1399603003: Tie multibuffers to URLs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@media_cache
Patch Set: compile fixes Created 5 years, 2 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
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 "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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 weak_ptr_ = weak_factory_.GetWeakPtr(); 108 weak_ptr_ = weak_factory_.GetWeakPtr();
109 DCHECK(host_); 109 DCHECK(host_);
110 DCHECK(!downloading_cb_.is_null()); 110 DCHECK(!downloading_cb_.is_null());
111 DCHECK(render_task_runner_->BelongsToCurrentThread()); 111 DCHECK(render_task_runner_->BelongsToCurrentThread());
112 } 112 }
113 113
114 BufferedDataSource::~BufferedDataSource() { 114 BufferedDataSource::~BufferedDataSource() {
115 DCHECK(render_task_runner_->BelongsToCurrentThread()); 115 DCHECK(render_task_runner_->BelongsToCurrentThread());
116 } 116 }
117 117
118 bool BufferedDataSource::media_has_played() const {
119 return media_has_played_;
120 }
121
122 bool BufferedDataSource::assume_fully_buffered() {
123 return !url_.SchemeIsHTTPOrHTTPS();
124 }
125
118 // A factory method to create BufferedResourceLoader using the read parameters. 126 // A factory method to create BufferedResourceLoader using the read parameters.
119 // This method can be overridden to inject mock BufferedResourceLoader object 127 // This method can be overridden to inject mock BufferedResourceLoader object
120 // for testing purpose. 128 // for testing purpose.
121 BufferedResourceLoader* BufferedDataSource::CreateResourceLoader( 129 BufferedResourceLoader* BufferedDataSource::CreateResourceLoader(
122 int64 first_byte_position, int64 last_byte_position) { 130 int64 first_byte_position, int64 last_byte_position) {
123 DCHECK(render_task_runner_->BelongsToCurrentThread()); 131 DCHECK(render_task_runner_->BelongsToCurrentThread());
124 132
125 BufferedResourceLoader::DeferStrategy strategy = preload_ == METADATA ? 133 BufferedResourceLoader::DeferStrategy strategy = preload_ == METADATA ?
126 BufferedResourceLoader::kReadThenDefer : 134 BufferedResourceLoader::kReadThenDefer :
127 BufferedResourceLoader::kCapacityDefer; 135 BufferedResourceLoader::kCapacityDefer;
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after
565 } 573 }
566 574
567 // If media is currently playing or the page indicated preload=auto or the 575 // If media is currently playing or the page indicated preload=auto or the
568 // the server does not support the byte range request or we do not want to go 576 // the server does not support the byte range request or we do not want to go
569 // too far ahead of the read head, use threshold strategy to enable/disable 577 // too far ahead of the read head, use threshold strategy to enable/disable
570 // deferring when the buffer is full/depleted. 578 // deferring when the buffer is full/depleted.
571 loader_->UpdateDeferStrategy(BufferedResourceLoader::kCapacityDefer); 579 loader_->UpdateDeferStrategy(BufferedResourceLoader::kCapacityDefer);
572 } 580 }
573 581
574 } // namespace media 582 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698