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

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
« no previous file with comments | « webkit/media/android/webmediaplayer_android.cc ('k') | webkit/media/buffered_data_source.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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| and |cors_mode|, and call |status_cb|
39 // initialization has completed. 39 // when initialization has completed.
40 // 40 //
41 // Method called on the render thread. 41 // Method called on the render thread.
42 void Initialize(const GURL& url, 42 void Initialize(
43 const media::PipelineStatusCB& status_cb); 43 const GURL& url,
44 BufferedResourceLoader::CORSMode cors_mode,
45 const media::PipelineStatusCB& status_cb);
44 46
45 // Adjusts the buffering algorithm based on the given preload value. 47 // Adjusts the buffering algorithm based on the given preload value.
46 void SetPreload(Preload preload); 48 void SetPreload(Preload preload);
47 49
48 // Returns true if the media resource has a single origin, false otherwise. 50 // Returns true if the media resource has a single origin, false otherwise.
49 // Only valid to call after Initialize() has completed. 51 // Only valid to call after Initialize() has completed.
50 // 52 //
51 // Method called on the render thread. 53 // Method called on the render thread.
52 bool HasSingleOrigin(); 54 bool HasSingleOrigin();
53 55
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 // Callback method for making a read request to BufferedResourceLoader. 134 // Callback method for making a read request to BufferedResourceLoader.
133 void ReadCallback(BufferedResourceLoader::Status status, int bytes_read); 135 void ReadCallback(BufferedResourceLoader::Status status, int bytes_read);
134 136
135 // Callback method when a network event is received. 137 // Callback method when a network event is received.
136 void NetworkEventCallback(); 138 void NetworkEventCallback();
137 139
138 void UpdateHostState_Locked(); 140 void UpdateHostState_Locked();
139 141
140 // URL of the resource requested. 142 // URL of the resource requested.
141 GURL url_; 143 GURL url_;
144 // crossorigin attribute on the corresponding HTML media element, if any.
145 BufferedResourceLoader::CORSMode cors_mode_;
142 146
143 // Members for total bytes of the requested object. It is written once on 147 // 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 148 // 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 149 // member is guaranteed to happen after it is first written, so we don't
146 // need to protect it. 150 // need to protect it.
147 int64 total_bytes_; 151 int64 total_bytes_;
148 int64 buffered_bytes_; 152 int64 buffered_bytes_;
149 153
150 // 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.
151 // i.e. range request is not supported. 155 // i.e. range request is not supported.
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 float playback_rate_; 220 float playback_rate_;
217 221
218 scoped_refptr<media::MediaLog> media_log_; 222 scoped_refptr<media::MediaLog> media_log_;
219 223
220 DISALLOW_COPY_AND_ASSIGN(BufferedDataSource); 224 DISALLOW_COPY_AND_ASSIGN(BufferedDataSource);
221 }; 225 };
222 226
223 } // namespace webkit_media 227 } // namespace webkit_media
224 228
225 #endif // WEBKIT_MEDIA_BUFFERED_DATA_SOURCE_H_ 229 #endif // WEBKIT_MEDIA_BUFFERED_DATA_SOURCE_H_
OLDNEW
« no previous file with comments | « webkit/media/android/webmediaplayer_android.cc ('k') | webkit/media/buffered_data_source.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698