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 #ifndef CONTENT_RENDERER_MEDIA_BUFFERED_RESOURCE_LOADER_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_BUFFERED_RESOURCE_LOADER_H_ |
6 #define CONTENT_RENDERER_MEDIA_BUFFERED_RESOURCE_LOADER_H_ | 6 #define CONTENT_RENDERER_MEDIA_BUFFERED_RESOURCE_LOADER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 // Returns true if the current read request will be fulfilled in the future. | 230 // Returns true if the current read request will be fulfilled in the future. |
231 bool WillFulfillRead() const; | 231 bool WillFulfillRead() const; |
232 | 232 |
233 // Method that does the actual read and calls the |read_cb_|, assuming the | 233 // Method that does the actual read and calls the |read_cb_|, assuming the |
234 // request range is in |buffer_|. | 234 // request range is in |buffer_|. |
235 void ReadInternal(); | 235 void ReadInternal(); |
236 | 236 |
237 // If we have made a range request, verify the response from the server. | 237 // If we have made a range request, verify the response from the server. |
238 bool VerifyPartialResponse(const blink::WebURLResponse& response); | 238 bool VerifyPartialResponse(const blink::WebURLResponse& response); |
239 | 239 |
240 // Returns the value for a range request header using parameters | |
241 // |first_byte_position| and |last_byte_position|. Negative numbers other | |
242 // than |kPositionNotSpecified| are not allowed for |first_byte_position| and | |
243 // |last_byte_position|. |first_byte_position| should always be less than or | |
244 // equal to |last_byte_position| if they are both not |kPositionNotSpecified|. | |
245 // Empty string is returned on invalid parameters. | |
246 std::string GenerateHeaders(int64 first_byte_position, | |
247 int64 last_byte_position); | |
248 | |
249 // Done with read. Invokes the read callback and reset parameters for the | 240 // Done with read. Invokes the read callback and reset parameters for the |
250 // read request. | 241 // read request. |
251 void DoneRead(Status status, int bytes_read); | 242 void DoneRead(Status status, int bytes_read); |
252 | 243 |
253 // Done with start. Invokes the start callback and reset it. | 244 // Done with start. Invokes the start callback and reset it. |
254 void DoneStart(Status status); | 245 void DoneStart(Status status); |
255 | 246 |
256 bool HasPendingRead() { return !read_cb_.is_null(); } | 247 bool HasPendingRead() { return !read_cb_.is_null(); } |
257 | 248 |
258 // Helper function that returns true if a range request was specified. | 249 // Helper function that returns true if a range request was specified. |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 float playback_rate_; | 316 float playback_rate_; |
326 | 317 |
327 scoped_refptr<media::MediaLog> media_log_; | 318 scoped_refptr<media::MediaLog> media_log_; |
328 | 319 |
329 DISALLOW_COPY_AND_ASSIGN(BufferedResourceLoader); | 320 DISALLOW_COPY_AND_ASSIGN(BufferedResourceLoader); |
330 }; | 321 }; |
331 | 322 |
332 } // namespace content | 323 } // namespace content |
333 | 324 |
334 #endif // CONTENT_RENDERER_MEDIA_BUFFERED_RESOURCE_LOADER_H_ | 325 #endif // CONTENT_RENDERER_MEDIA_BUFFERED_RESOURCE_LOADER_H_ |
OLD | NEW |