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

Side by Side Diff: webkit/media/buffered_data_source.h

Issue 10735016: Collapse HTTP and non-HTTP codepaths into single methods. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix stuff Created 8 years, 5 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 | Annotate | Revision Log
OLDNEW
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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 void ReadInternal(); 116 void ReadInternal();
117 117
118 // Calls |read_cb_| and reset all read parameters. Non-negative |bytes_read| 118 // Calls |read_cb_| and reset all read parameters. Non-negative |bytes_read|
119 // values represent successful reads, otherwise |bytes_read| should be 119 // values represent successful reads, otherwise |bytes_read| should be
120 // kReadError. 120 // kReadError.
121 void DoneRead_Locked(int bytes_read); 121 void DoneRead_Locked(int bytes_read);
122 122
123 // Calls |initialize_cb_| and reset it. 123 // Calls |initialize_cb_| and reset it.
124 void DoneInitialization_Locked(media::PipelineStatus status); 124 void DoneInitialization_Locked(media::PipelineStatus status);
125 125
126 // Callback method for |loader_| if URL for the resource requested is using 126 // BufferedResourceLoader::Start() callback for initial load.
127 // HTTP protocol. This method is called when response for initial request is 127 void StartCallback(BufferedResourceLoader::Status status);
128 // received.
129 void HttpInitialStartCallback(BufferedResourceLoader::Status status);
130 128
131 // Callback method for |loader_| if URL for the resource requested is using 129 // BufferedResourceLoader::Start() callback for subsequent loads (i.e.,
132 // a non-HTTP protocol, e.g. local files. This method is called when response 130 // when accessing ranges that are outside initial buffered region).
133 // for initial request is received.
134 void NonHttpInitialStartCallback(BufferedResourceLoader::Status status);
135
136 // Callback method to be passed to BufferedResourceLoader during range
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
139 // BufferedResourceLoader lives, i.e. render thread.
140 void PartialReadStartCallback(BufferedResourceLoader::Status status); 131 void PartialReadStartCallback(BufferedResourceLoader::Status status);
141 132
142 // Read callback for BufferedResourceLoader. 133 // BufferedResourceLoader callbacks.
143 void ReadCallback(BufferedResourceLoader::Status status, int bytes_read); 134 void ReadCallback(BufferedResourceLoader::Status status, int bytes_read);
144 135 void LoadingStateChangedCallback(BufferedResourceLoader::LoadingState state);
145 // Loading and progress callbacks for HTTP resources. 136 void ProgressCallback(int64 position);
146 void HttpLoadingStateChangedCallback(
147 BufferedResourceLoader::LoadingState state);
148 void HttpProgressCallback(int64 position);
149 137
150 void UpdateHostState_Locked(); 138 void UpdateHostState_Locked();
151 139
152 // URL of the resource requested. 140 // URL of the resource requested.
153 GURL url_; 141 GURL url_;
154 // crossorigin attribute on the corresponding HTML media element, if any. 142 // crossorigin attribute on the corresponding HTML media element, if any.
155 BufferedResourceLoader::CORSMode cors_mode_; 143 BufferedResourceLoader::CORSMode cors_mode_;
156 144
157 // Members for total bytes of the requested object. It is written once on 145 // The total size of the resource. Set during StartCallback() if the size is
158 // render thread but may be read from any thread. However reading of this 146 // known, otherwise it will remain kPositionNotSpecified until the size is
159 // member is guaranteed to happen after it is first written, so we don't 147 // determined by reaching EOF.
160 // need to protect it.
161 int64 total_bytes_; 148 int64 total_bytes_;
162 int64 buffered_bytes_; 149
150 // Some resources are assumed to be fully buffered (i.e., file://) so we don't
151 // need to report the what |loader_| has buffered.
Ami GONE FROM CHROMIUM 2012/07/11 00:56:41 drop "the"
scherkus (not reviewing) 2012/07/11 18:39:02 Done.
152 bool assume_fully_buffered_;
163 153
164 // This value will be true if this data source can only support streaming. 154 // This value will be true if this data source can only support streaming.
165 // i.e. range request is not supported. 155 // i.e. range request is not supported.
166 bool streaming_; 156 bool streaming_;
167 157
168 // A webframe for loading. 158 // A webframe for loading.
169 WebKit::WebFrame* frame_; 159 WebKit::WebFrame* frame_;
170 160
171 // A resource loader for the media resource. 161 // A resource loader for the media resource.
172 scoped_ptr<BufferedResourceLoader> loader_; 162 scoped_ptr<BufferedResourceLoader> loader_;
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 scoped_refptr<media::MediaLog> media_log_; 219 scoped_refptr<media::MediaLog> media_log_;
230 220
231 DownloadingCB downloading_cb_; 221 DownloadingCB downloading_cb_;
232 222
233 DISALLOW_COPY_AND_ASSIGN(BufferedDataSource); 223 DISALLOW_COPY_AND_ASSIGN(BufferedDataSource);
234 }; 224 };
235 225
236 } // namespace webkit_media 226 } // namespace webkit_media
237 227
238 #endif // WEBKIT_MEDIA_BUFFERED_DATA_SOURCE_H_ 228 #endif // WEBKIT_MEDIA_BUFFERED_DATA_SOURCE_H_
OLDNEW
« no previous file with comments | « no previous file | webkit/media/buffered_data_source.cc » ('j') | webkit/media/buffered_data_source.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698