| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 WEBKIT_GLUE_MEDIA_BUFFERED_DATA_SOURCE_H_ | 5 #ifndef WEBKIT_GLUE_MEDIA_BUFFERED_DATA_SOURCE_H_ |
| 6 #define WEBKIT_GLUE_MEDIA_BUFFERED_DATA_SOURCE_H_ | 6 #define WEBKIT_GLUE_MEDIA_BUFFERED_DATA_SOURCE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 | 36 |
| 37 // media::DataSource implementation. | 37 // media::DataSource implementation. |
| 38 // Called from demuxer thread. | 38 // Called from demuxer thread. |
| 39 virtual void Read(int64 position, size_t size, | 39 virtual void Read(int64 position, size_t size, |
| 40 uint8* data, | 40 uint8* data, |
| 41 media::DataSource::ReadCallback* read_callback); | 41 media::DataSource::ReadCallback* read_callback); |
| 42 virtual bool GetSize(int64* size_out); | 42 virtual bool GetSize(int64* size_out); |
| 43 virtual bool IsStreaming(); | 43 virtual bool IsStreaming(); |
| 44 virtual void SetPreload(media::Preload preload); | 44 virtual void SetPreload(media::Preload preload); |
| 45 | 45 |
| 46 const media::MediaFormat& media_format() { | |
| 47 return media_format_; | |
| 48 } | |
| 49 | |
| 50 // webkit_glue::WebDataSource implementation. | 46 // webkit_glue::WebDataSource implementation. |
| 51 virtual void Initialize(const std::string& url, | 47 virtual void Initialize(const std::string& url, |
| 52 media::PipelineStatusCallback* callback); | 48 media::PipelineStatusCallback* callback); |
| 53 virtual void CancelInitialize(); | 49 virtual void CancelInitialize(); |
| 54 virtual bool HasSingleOrigin(); | 50 virtual bool HasSingleOrigin(); |
| 55 virtual void Abort(); | 51 virtual void Abort(); |
| 56 | 52 |
| 57 protected: | 53 protected: |
| 58 // A factory method to create a BufferedResourceLoader based on the read | 54 // A factory method to create a BufferedResourceLoader based on the read |
| 59 // parameters. We can override this file to object a mock | 55 // parameters. We can override this file to object a mock |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 // Callback method for making a read request to BufferedResourceLoader. | 114 // Callback method for making a read request to BufferedResourceLoader. |
| 119 // If data arrives or the request has failed, this method is called with | 115 // If data arrives or the request has failed, this method is called with |
| 120 // the error code or the number of bytes read. | 116 // the error code or the number of bytes read. |
| 121 void ReadCallback(int error); | 117 void ReadCallback(int error); |
| 122 | 118 |
| 123 // Callback method when a network event is received. | 119 // Callback method when a network event is received. |
| 124 void NetworkEventCallback(); | 120 void NetworkEventCallback(); |
| 125 | 121 |
| 126 void UpdateHostState(); | 122 void UpdateHostState(); |
| 127 | 123 |
| 128 media::MediaFormat media_format_; | |
| 129 | |
| 130 // URL of the resource requested. | 124 // URL of the resource requested. |
| 131 GURL url_; | 125 GURL url_; |
| 132 | 126 |
| 133 // Members for total bytes of the requested object. It is written once on | 127 // Members for total bytes of the requested object. It is written once on |
| 134 // render thread but may be read from any thread. However reading of this | 128 // render thread but may be read from any thread. However reading of this |
| 135 // member is guaranteed to happen after it is first written, so we don't | 129 // member is guaranteed to happen after it is first written, so we don't |
| 136 // need to protect it. | 130 // need to protect it. |
| 137 int64 total_bytes_; | 131 int64 total_bytes_; |
| 138 int64 buffered_bytes_; | 132 int64 buffered_bytes_; |
| 139 | 133 |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 | 201 |
| 208 // Number of cache miss retries left. | 202 // Number of cache miss retries left. |
| 209 int cache_miss_retries_left_; | 203 int cache_miss_retries_left_; |
| 210 | 204 |
| 211 DISALLOW_COPY_AND_ASSIGN(BufferedDataSource); | 205 DISALLOW_COPY_AND_ASSIGN(BufferedDataSource); |
| 212 }; | 206 }; |
| 213 | 207 |
| 214 } // namespace webkit_glue | 208 } // namespace webkit_glue |
| 215 | 209 |
| 216 #endif // WEBKIT_GLUE_MEDIA_BUFFERED_DATA_SOURCE_H_ | 210 #endif // WEBKIT_GLUE_MEDIA_BUFFERED_DATA_SOURCE_H_ |
| OLD | NEW |