| 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 "content/renderer/media/buffered_data_source.h" | 5 #include "content/renderer/media/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/message_loop/message_loop_proxy.h" | 9 #include "base/message_loop/message_loop_proxy.h" |
| 10 #include "content/public/common/url_constants.h" | 10 #include "content/public/common/url_constants.h" |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 BufferedResourceLoader::CORSMode cors_mode, | 133 BufferedResourceLoader::CORSMode cors_mode, |
| 134 const InitializeCB& init_cb) { | 134 const InitializeCB& init_cb) { |
| 135 DCHECK(render_loop_->BelongsToCurrentThread()); | 135 DCHECK(render_loop_->BelongsToCurrentThread()); |
| 136 DCHECK(!init_cb.is_null()); | 136 DCHECK(!init_cb.is_null()); |
| 137 DCHECK(!loader_.get()); | 137 DCHECK(!loader_.get()); |
| 138 url_ = url; | 138 url_ = url; |
| 139 cors_mode_ = cors_mode; | 139 cors_mode_ = cors_mode; |
| 140 | 140 |
| 141 init_cb_ = init_cb; | 141 init_cb_ = init_cb; |
| 142 | 142 |
| 143 if (url_.SchemeIs(kHttpScheme) || url_.SchemeIs(kHttpsScheme)) { | 143 if (url_.SchemeIs(url::kHttpScheme) || url_.SchemeIs(url::kHttpsScheme)) { |
| 144 // Do an unbounded range request starting at the beginning. If the server | 144 // Do an unbounded range request starting at the beginning. If the server |
| 145 // responds with 200 instead of 206 we'll fall back into a streaming mode. | 145 // responds with 200 instead of 206 we'll fall back into a streaming mode. |
| 146 loader_.reset(CreateResourceLoader(0, kPositionNotSpecified)); | 146 loader_.reset(CreateResourceLoader(0, kPositionNotSpecified)); |
| 147 } else { | 147 } else { |
| 148 // For all other protocols, assume they support range request. We fetch | 148 // For all other protocols, assume they support range request. We fetch |
| 149 // the full range of the resource to obtain the instance size because | 149 // the full range of the resource to obtain the instance size because |
| 150 // we won't be served HTTP headers. | 150 // we won't be served HTTP headers. |
| 151 loader_.reset(CreateResourceLoader(kPositionNotSpecified, | 151 loader_.reset(CreateResourceLoader(kPositionNotSpecified, |
| 152 kPositionNotSpecified)); | 152 kPositionNotSpecified)); |
| 153 assume_fully_buffered_ = true; | 153 assume_fully_buffered_ = true; |
| (...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 531 return; | 531 return; |
| 532 } | 532 } |
| 533 | 533 |
| 534 // If media is currently playing or the page indicated preload=auto, | 534 // If media is currently playing or the page indicated preload=auto, |
| 535 // use threshold strategy to enable/disable deferring when the buffer | 535 // use threshold strategy to enable/disable deferring when the buffer |
| 536 // is full/depleted. | 536 // is full/depleted. |
| 537 loader_->UpdateDeferStrategy(BufferedResourceLoader::kCapacityDefer); | 537 loader_->UpdateDeferStrategy(BufferedResourceLoader::kCapacityDefer); |
| 538 } | 538 } |
| 539 | 539 |
| 540 } // namespace content | 540 } // namespace content |
| OLD | NEW |