OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // An extremely simple implementation of DataSource that downloads the entire | 5 // An extremely simple implementation of DataSource that downloads the entire |
6 // media resource into memory before signaling that initialization has finished. | 6 // media resource into memory before signaling that initialization has finished. |
7 // Primarily used to test <audio> and <video> with buffering/caching removed | 7 // Primarily used to test <audio> and <video> with buffering/caching removed |
8 // from the equation. | 8 // from the equation. |
9 | 9 |
10 #ifndef WEBKIT_GLUE_MEDIA_SIMPLE_DATA_SOURCE_H_ | 10 #ifndef WEBKIT_GLUE_MEDIA_SIMPLE_DATA_SOURCE_H_ |
(...skipping 30 matching lines...) Expand all Loading... |
41 static media::DataSourceFactory* CreateFactory( | 41 static media::DataSourceFactory* CreateFactory( |
42 MessageLoop* render_loop, | 42 MessageLoop* render_loop, |
43 WebKit::WebFrame* frame, | 43 WebKit::WebFrame* frame, |
44 media::MediaLog* media_log, | 44 media::MediaLog* media_log, |
45 const WebDataSourceBuildObserverHack& build_observer); | 45 const WebDataSourceBuildObserverHack& build_observer); |
46 | 46 |
47 SimpleDataSource(MessageLoop* render_loop, WebKit::WebFrame* frame); | 47 SimpleDataSource(MessageLoop* render_loop, WebKit::WebFrame* frame); |
48 virtual ~SimpleDataSource(); | 48 virtual ~SimpleDataSource(); |
49 | 49 |
50 // media::Filter implementation. | 50 // media::Filter implementation. |
51 virtual void set_host(media::FilterHost* host); | 51 virtual void set_host(media::FilterHost* host) OVERRIDE; |
52 virtual void Stop(const base::Closure& callback); | 52 virtual void Stop(const base::Closure& callback) OVERRIDE; |
53 | 53 |
54 // media::DataSource implementation. | 54 // media::DataSource implementation. |
55 virtual void Read(int64 position, size_t size, | 55 virtual void Read(int64 position, |
56 uint8* data, const DataSource::ReadCallback& read_callback); | 56 size_t size, |
57 virtual bool GetSize(int64* size_out); | 57 uint8* data, |
58 virtual bool IsStreaming(); | 58 const DataSource::ReadCallback& read_callback) OVERRIDE; |
59 virtual void SetPreload(media::Preload preload); | 59 virtual bool GetSize(int64* size_out) OVERRIDE; |
60 virtual void SetBitrate(int bitrate); | 60 virtual bool IsStreaming() OVERRIDE; |
| 61 virtual void SetPreload(media::Preload preload) OVERRIDE; |
| 62 virtual void SetBitrate(int bitrate) OVERRIDE; |
61 | 63 |
62 // Used to inject a mock used for unittests. | 64 // Used to inject a mock used for unittests. |
63 virtual void SetURLLoaderForTest(WebKit::WebURLLoader* mock_loader); | 65 virtual void SetURLLoaderForTest(WebKit::WebURLLoader* mock_loader); |
64 | 66 |
65 // WebKit::WebURLLoaderClient implementations. | 67 // WebKit::WebURLLoaderClient implementations. |
66 virtual void willSendRequest( | 68 virtual void willSendRequest( |
67 WebKit::WebURLLoader* loader, | 69 WebKit::WebURLLoader* loader, |
68 WebKit::WebURLRequest& newRequest, | 70 WebKit::WebURLRequest& newRequest, |
69 const WebKit::WebURLResponse& redirectResponse); | 71 const WebKit::WebURLResponse& redirectResponse); |
70 virtual void didSendData( | 72 virtual void didSendData( |
(...skipping 16 matching lines...) Expand all Loading... |
87 const char* data, int dataLength); | 89 const char* data, int dataLength); |
88 virtual void didFinishLoading( | 90 virtual void didFinishLoading( |
89 WebKit::WebURLLoader* loader, | 91 WebKit::WebURLLoader* loader, |
90 double finishTime); | 92 double finishTime); |
91 virtual void didFail( | 93 virtual void didFail( |
92 WebKit::WebURLLoader* loader, | 94 WebKit::WebURLLoader* loader, |
93 const WebKit::WebURLError&); | 95 const WebKit::WebURLError&); |
94 | 96 |
95 // webkit_glue::WebDataSource implementation. | 97 // webkit_glue::WebDataSource implementation. |
96 virtual void Initialize(const std::string& url, | 98 virtual void Initialize(const std::string& url, |
97 const media::PipelineStatusCB& callback); | 99 const media::PipelineStatusCB& callback) OVERRIDE; |
98 virtual void CancelInitialize(); | 100 virtual void CancelInitialize() OVERRIDE; |
99 virtual bool HasSingleOrigin(); | 101 virtual bool HasSingleOrigin() OVERRIDE; |
100 virtual void Abort(); | 102 virtual void Abort() OVERRIDE; |
101 | 103 |
102 private: | 104 private: |
103 // Creates and starts the resource loading on the render thread. | 105 // Creates and starts the resource loading on the render thread. |
104 void StartTask(); | 106 void StartTask(); |
105 | 107 |
106 // Cancels and deletes the resource loading on the render thread. | 108 // Cancels and deletes the resource loading on the render thread. |
107 void CancelTask(); | 109 void CancelTask(); |
108 | 110 |
109 // Perform initialization completion tasks under a lock. | 111 // Perform initialization completion tasks under a lock. |
110 void DoneInitialization_Locked(bool success); | 112 void DoneInitialization_Locked(bool success); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 | 145 |
144 // Used to ensure mocks for unittests are used instead of reset in Start(). | 146 // Used to ensure mocks for unittests are used instead of reset in Start(). |
145 bool keep_test_loader_; | 147 bool keep_test_loader_; |
146 | 148 |
147 DISALLOW_COPY_AND_ASSIGN(SimpleDataSource); | 149 DISALLOW_COPY_AND_ASSIGN(SimpleDataSource); |
148 }; | 150 }; |
149 | 151 |
150 } // namespace webkit_glue | 152 } // namespace webkit_glue |
151 | 153 |
152 #endif // WEBKIT_GLUE_MEDIA_SIMPLE_DATA_SOURCE_H_ | 154 #endif // WEBKIT_GLUE_MEDIA_SIMPLE_DATA_SOURCE_H_ |
OLD | NEW |