OLD | NEW |
---|---|
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" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
45 // in-memory sliding window. | 45 // in-memory sliding window. |
46 // | 46 // |
47 // BufferedDataSource must be created and initialized on the render thread | 47 // BufferedDataSource must be created and initialized on the render thread |
48 // 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. |
49 class CONTENT_EXPORT BufferedDataSource : public media::DataSource { | 49 class CONTENT_EXPORT BufferedDataSource : public media::DataSource { |
50 public: | 50 public: |
51 typedef base::Callback<void(bool)> DownloadingCB; | 51 typedef base::Callback<void(bool)> DownloadingCB; |
52 | 52 |
53 // Buffered byte range changes will be reported to |host|. |downloading_cb| | 53 // Buffered byte range changes will be reported to |host|. |downloading_cb| |
54 // 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. |
55 BufferedDataSource(const scoped_refptr<base::MessageLoopProxy>& render_loop, | 55 BufferedDataSource(const GURL& url, |
56 BufferedResourceLoader::CORSMode cors_mode, | |
57 const scoped_refptr<base::MessageLoopProxy>& render_loop, | |
56 blink::WebFrame* frame, | 58 blink::WebFrame* frame, |
57 media::MediaLog* media_log, | 59 media::MediaLog* media_log, |
58 BufferedDataSourceHost* host, | 60 BufferedDataSourceHost* host, |
59 const DownloadingCB& downloading_cb); | 61 const DownloadingCB& downloading_cb); |
60 virtual ~BufferedDataSource(); | 62 virtual ~BufferedDataSource(); |
61 | 63 |
62 // Initialize this object using |url| and |cors_mode|, executing |init_cb| | 64 // Initialize this object using |url| and |cors_mode|, executing |init_cb| |
scherkus (not reviewing)
2014/05/30 20:45:14
please update the comments here and on the constru
amogh.bihani
2014/06/02 06:11:01
Done.
| |
63 // with the result of initialization when it has completed. | 65 // with the result of initialization when it has completed. |
64 // | 66 // |
65 // Method called on the render thread. | 67 // Method called on the render thread. |
66 typedef base::Callback<void(bool)> InitializeCB; | 68 typedef base::Callback<void(bool)> InitializeCB; |
67 void Initialize( | 69 void Initialize(const InitializeCB& init_cb); |
68 const GURL& url, | |
69 BufferedResourceLoader::CORSMode cors_mode, | |
70 const InitializeCB& init_cb); | |
71 | 70 |
72 // Adjusts the buffering algorithm based on the given preload value. | 71 // Adjusts the buffering algorithm based on the given preload value. |
73 void SetPreload(Preload preload); | 72 void SetPreload(Preload preload); |
74 | 73 |
75 // Returns true if the media resource has a single origin, false otherwise. | 74 // Returns true if the media resource has a single origin, false otherwise. |
76 // Only valid to call after Initialize() has completed. | 75 // Only valid to call after Initialize() has completed. |
77 // | 76 // |
78 // Method called on the render thread. | 77 // Method called on the render thread. |
79 bool HasSingleOrigin(); | 78 bool HasSingleOrigin(); |
80 | 79 |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
224 | 223 |
225 // NOTE: Weak pointers must be invalidated before all other member variables. | 224 // NOTE: Weak pointers must be invalidated before all other member variables. |
226 base::WeakPtrFactory<BufferedDataSource> weak_factory_; | 225 base::WeakPtrFactory<BufferedDataSource> weak_factory_; |
227 | 226 |
228 DISALLOW_COPY_AND_ASSIGN(BufferedDataSource); | 227 DISALLOW_COPY_AND_ASSIGN(BufferedDataSource); |
229 }; | 228 }; |
230 | 229 |
231 } // namespace content | 230 } // namespace content |
232 | 231 |
233 #endif // CONTENT_RENDERER_MEDIA_BUFFERED_DATA_SOURCE_H_ | 232 #endif // CONTENT_RENDERER_MEDIA_BUFFERED_DATA_SOURCE_H_ |
OLD | NEW |