| 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 WEBKIT_RENDERER_MEDIA_BUFFERED_DATA_SOURCE_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_BUFFERED_DATA_SOURCE_H_ |
| 6 #define WEBKIT_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" |
| 14 #include "content/renderer/media/buffered_resource_loader.h" |
| 15 #include "content/renderer/media/preload.h" |
| 13 #include "googleurl/src/gurl.h" | 16 #include "googleurl/src/gurl.h" |
| 14 #include "media/base/data_source.h" | 17 #include "media/base/data_source.h" |
| 15 #include "media/base/ranges.h" | 18 #include "media/base/ranges.h" |
| 16 #include "webkit/renderer/media/buffered_resource_loader.h" | |
| 17 #include "webkit/renderer/media/preload.h" | |
| 18 | 19 |
| 19 namespace base { | 20 namespace base { |
| 20 class MessageLoopProxy; | 21 class MessageLoopProxy; |
| 21 } | 22 } |
| 22 | 23 |
| 23 namespace media { | 24 namespace media { |
| 24 class MediaLog; | 25 class MediaLog; |
| 25 } | 26 } |
| 26 | 27 |
| 27 namespace webkit_media { | 28 namespace content { |
| 28 | 29 |
| 29 // A data source capable of loading URLs and buffering the data using an | 30 // A data source capable of loading URLs and buffering the data using an |
| 30 // in-memory sliding window. | 31 // in-memory sliding window. |
| 31 // | 32 // |
| 32 // BufferedDataSource must be created and initialized on the render thread | 33 // BufferedDataSource must be created and initialized on the render thread |
| 33 // before being passed to other threads. It may be deleted on any thread. | 34 // before being passed to other threads. It may be deleted on any thread. |
| 34 class BufferedDataSource : public media::DataSource { | 35 class CONTENT_EXPORT BufferedDataSource : public media::DataSource { |
| 35 public: | 36 public: |
| 36 typedef base::Callback<void(bool)> DownloadingCB; | 37 typedef base::Callback<void(bool)> DownloadingCB; |
| 37 | 38 |
| 38 // |downloading_cb| will be called whenever the downloading/paused state of | 39 // |downloading_cb| will be called whenever the downloading/paused state of |
| 39 // the source changes. | 40 // the source changes. |
| 40 BufferedDataSource(const scoped_refptr<base::MessageLoopProxy>& render_loop, | 41 BufferedDataSource(const scoped_refptr<base::MessageLoopProxy>& render_loop, |
| 41 WebKit::WebFrame* frame, | 42 WebKit::WebFrame* frame, |
| 42 media::MediaLog* media_log, | 43 media::MediaLog* media_log, |
| 43 const DownloadingCB& downloading_cb); | 44 const DownloadingCB& downloading_cb); |
| 44 virtual ~BufferedDataSource(); | 45 virtual ~BufferedDataSource(); |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 // Buffered byte ranges awaiting set_host() being called to report to host(). | 209 // Buffered byte ranges awaiting set_host() being called to report to host(). |
| 209 media::Ranges<int64> queued_buffered_byte_ranges_; | 210 media::Ranges<int64> queued_buffered_byte_ranges_; |
| 210 | 211 |
| 211 scoped_refptr<media::MediaLog> media_log_; | 212 scoped_refptr<media::MediaLog> media_log_; |
| 212 | 213 |
| 213 DownloadingCB downloading_cb_; | 214 DownloadingCB downloading_cb_; |
| 214 | 215 |
| 215 DISALLOW_COPY_AND_ASSIGN(BufferedDataSource); | 216 DISALLOW_COPY_AND_ASSIGN(BufferedDataSource); |
| 216 }; | 217 }; |
| 217 | 218 |
| 218 } // namespace webkit_media | 219 } // namespace content |
| 219 | 220 |
| 220 #endif // WEBKIT_RENDERER_MEDIA_BUFFERED_DATA_SOURCE_H_ | 221 #endif // CONTENT_RENDERER_MEDIA_BUFFERED_DATA_SOURCE_H_ |
| OLD | NEW |