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

Side by Side Diff: content/renderer/media/buffered_data_source.h

Issue 224093011: Move DataSourceHost to BufferedDataSourceHost. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 8 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 CONTENT_RENDERER_MEDIA_BUFFERED_DATA_SOURCE_H_ 5 #ifndef CONTENT_RENDERER_MEDIA_BUFFERED_DATA_SOURCE_H_
6 #define CONTENT_RENDERER_MEDIA_BUFFERED_DATA_SOURCE_H_ 6 #define CONTENT_RENDERER_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"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "base/synchronization/lock.h" 12 #include "base/synchronization/lock.h"
13 #include "content/common/content_export.h" 13 #include "content/common/content_export.h"
14 #include "content/renderer/media/buffered_resource_loader.h" 14 #include "content/renderer/media/buffered_resource_loader.h"
15 #include "content/renderer/media/preload.h" 15 #include "content/renderer/media/preload.h"
16 #include "media/base/data_source.h" 16 #include "media/base/data_source.h"
17 #include "media/base/ranges.h" 17 #include "media/base/ranges.h"
18 #include "url/gurl.h" 18 #include "url/gurl.h"
19 19
20 namespace base { 20 namespace base {
21 class MessageLoopProxy; 21 class MessageLoopProxy;
22 } 22 }
23 23
24 namespace media { 24 namespace media {
25 class MediaLog; 25 class MediaLog;
26 } 26 }
27 27
28 namespace content { 28 namespace content {
29 29
30 class CONTENT_EXPORT BufferedDataSourceHost {
31 public:
32 // Set the total size of the media file.
scherkus (not reviewing) 2014/04/03 21:59:37 we should tweak this similar to below ("Notify the
sandersd (OOO until July 31) 2014/04/04 23:48:41 Done.
33 virtual void SetTotalBytes(int64 total_bytes) = 0;
34
35 // Notify the host that byte range [start,end] has been buffered.
36 // TODO(fischman): remove this method when demuxing is push-based instead of
37 // pull-based. http://crbug.com/131444
38 virtual void AddBufferedByteRange(int64 start, int64 end) = 0;
39
40 protected:
41 virtual ~BufferedDataSourceHost();
scherkus (not reviewing) 2014/04/03 21:59:37 it's ok to inline this: http://dev.chromium.org/de
sandersd (OOO until July 31) 2014/04/04 23:48:41 Done.
42 };
43
30 // A data source capable of loading URLs and buffering the data using an 44 // A data source capable of loading URLs and buffering the data using an
31 // in-memory sliding window. 45 // in-memory sliding window.
32 // 46 //
33 // BufferedDataSource must be created and initialized on the render thread 47 // BufferedDataSource must be created and initialized on the render thread
34 // before being passed to other threads. It may be deleted on any thread. 48 // before being passed to other threads. It may be deleted on any thread.
35 class CONTENT_EXPORT BufferedDataSource : public media::DataSource { 49 class CONTENT_EXPORT BufferedDataSource : public media::DataSource {
36 public: 50 public:
37 typedef base::Callback<void(bool)> DownloadingCB; 51 typedef base::Callback<void(bool)> DownloadingCB;
38 52
39 // Buffered byte range changes will be reported to |host|. |downloading_cb| 53 // Buffered byte range changes will be reported to |host|. |downloading_cb|
40 // will be called whenever the downloading/paused state of the source changes. 54 // will be called whenever the downloading/paused state of the source changes.
41 // TODO(sandersd): Move media::DataSourceHost to
42 // content::BufferedDataSourceHost.
43 BufferedDataSource(const scoped_refptr<base::MessageLoopProxy>& render_loop, 55 BufferedDataSource(const scoped_refptr<base::MessageLoopProxy>& render_loop,
44 blink::WebFrame* frame, 56 blink::WebFrame* frame,
45 media::MediaLog* media_log, 57 media::MediaLog* media_log,
46 media::DataSourceHost* host, 58 BufferedDataSourceHost* host,
47 const DownloadingCB& downloading_cb); 59 const DownloadingCB& downloading_cb);
48 virtual ~BufferedDataSource(); 60 virtual ~BufferedDataSource();
49 61
50 // Initialize this object using |url| and |cors_mode|, executing |init_cb| 62 // Initialize this object using |url| and |cors_mode|, executing |init_cb|
51 // with the result of initialization when it has completed. 63 // with the result of initialization when it has completed.
52 // 64 //
53 // Method called on the render thread. 65 // Method called on the render thread.
54 typedef base::Callback<void(bool)> InitializeCB; 66 typedef base::Callback<void(bool)> InitializeCB;
55 void Initialize( 67 void Initialize(
56 const GURL& url, 68 const GURL& url,
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 211
200 // Bitrate of the content, 0 if unknown. 212 // Bitrate of the content, 0 if unknown.
201 int bitrate_; 213 int bitrate_;
202 214
203 // Current playback rate. 215 // Current playback rate.
204 float playback_rate_; 216 float playback_rate_;
205 217
206 scoped_refptr<media::MediaLog> media_log_; 218 scoped_refptr<media::MediaLog> media_log_;
207 219
208 // Host object to report buffered byte range changes to. 220 // Host object to report buffered byte range changes to.
209 media::DataSourceHost* host_; 221 BufferedDataSourceHost* host_;
210 222
211 DownloadingCB downloading_cb_; 223 DownloadingCB downloading_cb_;
212 224
213 // NOTE: Weak pointers must be invalidated before all other member variables. 225 // NOTE: Weak pointers must be invalidated before all other member variables.
214 base::WeakPtrFactory<BufferedDataSource> weak_factory_; 226 base::WeakPtrFactory<BufferedDataSource> weak_factory_;
215 227
216 DISALLOW_COPY_AND_ASSIGN(BufferedDataSource); 228 DISALLOW_COPY_AND_ASSIGN(BufferedDataSource);
217 }; 229 };
218 230
219 } // namespace content 231 } // namespace content
220 232
221 #endif // CONTENT_RENDERER_MEDIA_BUFFERED_DATA_SOURCE_H_ 233 #endif // CONTENT_RENDERER_MEDIA_BUFFERED_DATA_SOURCE_H_
OLDNEW
« no previous file with comments | « no previous file | content/renderer/media/buffered_data_source.cc » ('j') | content/renderer/media/buffered_data_source.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698