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

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

Issue 10543007: Add CORS-awareness to HTML5 media elements. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 6 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 17 matching lines...) Expand all
28 // in-memory sliding window. 28 // in-memory sliding window.
29 // 29 //
30 // BufferedDataSource must be created and initialized on the render thread 30 // BufferedDataSource must be created and initialized on the render thread
31 // before being passed to other threads. It may be deleted on any thread. 31 // before being passed to other threads. It may be deleted on any thread.
32 class BufferedDataSource : public media::DataSource { 32 class BufferedDataSource : public media::DataSource {
33 public: 33 public:
34 BufferedDataSource(MessageLoop* render_loop, 34 BufferedDataSource(MessageLoop* render_loop,
35 WebKit::WebFrame* frame, 35 WebKit::WebFrame* frame,
36 media::MediaLog* media_log); 36 media::MediaLog* media_log);
37 37
38 // Initialize this object using |url|. This object calls |status_cb| when 38 // Initialize this object using |url|, |has_cross_origin_attr|, and
39 // initialization has completed. 39 // |cross_origin_attr|, and call |status_cb| when initialization has
40 // completed.
40 // 41 //
41 // Method called on the render thread. 42 // Method called on the render thread.
42 void Initialize(const GURL& url, 43 void Initialize(
43 const media::PipelineStatusCB& status_cb); 44 const GURL& url,
45 BufferedResourceLoader::CrossOriginAttribute cross_origin_attribute,
46 const media::PipelineStatusCB& status_cb);
44 47
45 // Adjusts the buffering algorithm based on the given preload value. 48 // Adjusts the buffering algorithm based on the given preload value.
46 void SetPreload(Preload preload); 49 void SetPreload(Preload preload);
47 50
48 // Returns true if the media resource has a single origin, false otherwise. 51 // Returns true if the media resource has a single origin, false otherwise.
49 // Only valid to call after Initialize() has completed. 52 // Only valid to call after Initialize() has completed.
50 // 53 //
51 // Method called on the render thread. 54 // Method called on the render thread.
52 bool HasSingleOrigin(); 55 bool HasSingleOrigin();
53 56
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 // Callback method for making a read request to BufferedResourceLoader. 135 // Callback method for making a read request to BufferedResourceLoader.
133 void ReadCallback(BufferedResourceLoader::Status status, int bytes_read); 136 void ReadCallback(BufferedResourceLoader::Status status, int bytes_read);
134 137
135 // Callback method when a network event is received. 138 // Callback method when a network event is received.
136 void NetworkEventCallback(); 139 void NetworkEventCallback();
137 140
138 void UpdateHostState_Locked(); 141 void UpdateHostState_Locked();
139 142
140 // URL of the resource requested. 143 // URL of the resource requested.
141 GURL url_; 144 GURL url_;
145 // crossorigin attribute on the corresponding HTML media element, if any.
146 BufferedResourceLoader::CrossOriginAttribute cross_origin_attribute_;
142 147
143 // Members for total bytes of the requested object. It is written once on 148 // Members for total bytes of the requested object. It is written once on
144 // render thread but may be read from any thread. However reading of this 149 // render thread but may be read from any thread. However reading of this
145 // member is guaranteed to happen after it is first written, so we don't 150 // member is guaranteed to happen after it is first written, so we don't
146 // need to protect it. 151 // need to protect it.
147 int64 total_bytes_; 152 int64 total_bytes_;
148 int64 buffered_bytes_; 153 int64 buffered_bytes_;
149 154
150 // This value will be true if this data source can only support streaming. 155 // This value will be true if this data source can only support streaming.
151 // i.e. range request is not supported. 156 // i.e. range request is not supported.
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 float playback_rate_; 221 float playback_rate_;
217 222
218 scoped_refptr<media::MediaLog> media_log_; 223 scoped_refptr<media::MediaLog> media_log_;
219 224
220 DISALLOW_COPY_AND_ASSIGN(BufferedDataSource); 225 DISALLOW_COPY_AND_ASSIGN(BufferedDataSource);
221 }; 226 };
222 227
223 } // namespace webkit_media 228 } // namespace webkit_media
224 229
225 #endif // WEBKIT_MEDIA_BUFFERED_DATA_SOURCE_H_ 230 #endif // WEBKIT_MEDIA_BUFFERED_DATA_SOURCE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698