| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_MEDIA_BUFFERED_DATA_SOURCE_H_ | 5 #ifndef WEBKIT_MEDIA_BUFFERED_DATA_SOURCE_H_ |
| 6 #define WEBKIT_MEDIA_BUFFERED_DATA_SOURCE_H_ | 6 #define WEBKIT_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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 // a non-HTTP protocol, e.g. local files. This method is called when response | 132 // a non-HTTP protocol, e.g. local files. This method is called when response |
| 133 // for initial request is received. | 133 // for initial request is received. |
| 134 void NonHttpInitialStartCallback(BufferedResourceLoader::Status status); | 134 void NonHttpInitialStartCallback(BufferedResourceLoader::Status status); |
| 135 | 135 |
| 136 // Callback method to be passed to BufferedResourceLoader during range | 136 // Callback method to be passed to BufferedResourceLoader during range |
| 137 // request. Once a resource request has started, this method will be called | 137 // request. Once a resource request has started, this method will be called |
| 138 // with the error code. This method will be executed on the thread | 138 // with the error code. This method will be executed on the thread |
| 139 // BufferedResourceLoader lives, i.e. render thread. | 139 // BufferedResourceLoader lives, i.e. render thread. |
| 140 void PartialReadStartCallback(BufferedResourceLoader::Status status); | 140 void PartialReadStartCallback(BufferedResourceLoader::Status status); |
| 141 | 141 |
| 142 // Callback method for making a read request to BufferedResourceLoader. | 142 // Read callback for BufferedResourceLoader. |
| 143 void ReadCallback(BufferedResourceLoader::Status status, int bytes_read); | 143 void ReadCallback(BufferedResourceLoader::Status status, int bytes_read); |
| 144 | 144 |
| 145 // Callback method when a network event is received. | 145 // Loading and progress callbacks for HTTP resources. |
| 146 void NetworkEventCallback(); | 146 void HttpLoadingStateChangedCallback( |
| 147 BufferedResourceLoader::LoadingState state); |
| 148 void HttpProgressCallback(int64 position); |
| 147 | 149 |
| 148 void UpdateHostState_Locked(); | 150 void UpdateHostState_Locked(); |
| 149 | 151 |
| 150 // URL of the resource requested. | 152 // URL of the resource requested. |
| 151 GURL url_; | 153 GURL url_; |
| 152 // crossorigin attribute on the corresponding HTML media element, if any. | 154 // crossorigin attribute on the corresponding HTML media element, if any. |
| 153 BufferedResourceLoader::CORSMode cors_mode_; | 155 BufferedResourceLoader::CORSMode cors_mode_; |
| 154 | 156 |
| 155 // Members for total bytes of the requested object. It is written once on | 157 // Members for total bytes of the requested object. It is written once on |
| 156 // render thread but may be read from any thread. However reading of this | 158 // render thread but may be read from any thread. However reading of this |
| 157 // member is guaranteed to happen after it is first written, so we don't | 159 // member is guaranteed to happen after it is first written, so we don't |
| 158 // need to protect it. | 160 // need to protect it. |
| 159 int64 total_bytes_; | 161 int64 total_bytes_; |
| 160 int64 buffered_bytes_; | 162 int64 buffered_bytes_; |
| 161 | 163 |
| 162 // This value will be true if this data source can only support streaming. | 164 // This value will be true if this data source can only support streaming. |
| 163 // i.e. range request is not supported. | 165 // i.e. range request is not supported. |
| 164 bool streaming_; | 166 bool streaming_; |
| 165 | 167 |
| 166 // A webframe for loading. | 168 // A webframe for loading. |
| 167 WebKit::WebFrame* frame_; | 169 WebKit::WebFrame* frame_; |
| 168 | 170 |
| 169 // A resource loader for the media resource. | 171 // A resource loader for the media resource. |
| 170 scoped_ptr<BufferedResourceLoader> loader_; | 172 scoped_ptr<BufferedResourceLoader> loader_; |
| 171 | 173 |
| 172 // True if |loader| is downloading data. | |
| 173 bool is_downloading_data_; | |
| 174 | |
| 175 // Callback method from the pipeline for initialization. | 174 // Callback method from the pipeline for initialization. |
| 176 media::PipelineStatusCB initialize_cb_; | 175 media::PipelineStatusCB initialize_cb_; |
| 177 | 176 |
| 178 // Read parameters received from the Read() method call. | 177 // Read parameters received from the Read() method call. |
| 179 media::DataSource::ReadCB read_cb_; | 178 media::DataSource::ReadCB read_cb_; |
| 180 int read_size_; | 179 int read_size_; |
| 181 uint8* read_buffer_; | 180 uint8* read_buffer_; |
| 182 // Retained between reads to make sense of buffering information. | 181 // Retained between reads to make sense of buffering information. |
| 183 int64 last_read_start_; | 182 int64 last_read_start_; |
| 184 | 183 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 scoped_refptr<media::MediaLog> media_log_; | 229 scoped_refptr<media::MediaLog> media_log_; |
| 231 | 230 |
| 232 DownloadingCB downloading_cb_; | 231 DownloadingCB downloading_cb_; |
| 233 | 232 |
| 234 DISALLOW_COPY_AND_ASSIGN(BufferedDataSource); | 233 DISALLOW_COPY_AND_ASSIGN(BufferedDataSource); |
| 235 }; | 234 }; |
| 236 | 235 |
| 237 } // namespace webkit_media | 236 } // namespace webkit_media |
| 238 | 237 |
| 239 #endif // WEBKIT_MEDIA_BUFFERED_DATA_SOURCE_H_ | 238 #endif // WEBKIT_MEDIA_BUFFERED_DATA_SOURCE_H_ |
| OLD | NEW |