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

Side by Side Diff: webkit/glue/media/simple_data_source.h

Issue 7452016: Remove MediaFormat once and for all. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src
Patch Set: Created 9 years, 5 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/glue/media/buffered_data_source.cc ('k') | webkit/glue/media/simple_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) 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 29 matching lines...) Expand all
40 WebDataSourceBuildObserverHack* build_observer); 40 WebDataSourceBuildObserverHack* build_observer);
41 41
42 SimpleDataSource(MessageLoop* render_loop, WebKit::WebFrame* frame); 42 SimpleDataSource(MessageLoop* render_loop, WebKit::WebFrame* frame);
43 virtual ~SimpleDataSource(); 43 virtual ~SimpleDataSource();
44 44
45 // media::Filter implementation. 45 // media::Filter implementation.
46 virtual void set_host(media::FilterHost* host); 46 virtual void set_host(media::FilterHost* host);
47 virtual void Stop(media::FilterCallback* callback); 47 virtual void Stop(media::FilterCallback* callback);
48 48
49 // media::DataSource implementation. 49 // media::DataSource implementation.
50 virtual const media::MediaFormat& media_format();
51 virtual void Read(int64 position, size_t size, 50 virtual void Read(int64 position, size_t size,
52 uint8* data, ReadCallback* read_callback); 51 uint8* data, ReadCallback* read_callback);
53 virtual bool GetSize(int64* size_out); 52 virtual bool GetSize(int64* size_out);
54 virtual bool IsStreaming(); 53 virtual bool IsStreaming();
55 virtual void SetPreload(media::Preload preload); 54 virtual void SetPreload(media::Preload preload);
56 55
57 // Used to inject a mock used for unittests. 56 // Used to inject a mock used for unittests.
58 virtual void SetURLLoaderForTest(WebKit::WebURLLoader* mock_loader); 57 virtual void SetURLLoaderForTest(WebKit::WebURLLoader* mock_loader);
59 58
60 // WebKit::WebURLLoaderClient implementations. 59 // WebKit::WebURLLoaderClient implementations.
(...skipping 27 matching lines...) Expand all
88 const WebKit::WebURLError&); 87 const WebKit::WebURLError&);
89 88
90 // webkit_glue::WebDataSource implementation. 89 // webkit_glue::WebDataSource implementation.
91 virtual void Initialize(const std::string& url, 90 virtual void Initialize(const std::string& url,
92 media::PipelineStatusCallback* callback); 91 media::PipelineStatusCallback* callback);
93 virtual void CancelInitialize(); 92 virtual void CancelInitialize();
94 virtual bool HasSingleOrigin(); 93 virtual bool HasSingleOrigin();
95 virtual void Abort(); 94 virtual void Abort();
96 95
97 private: 96 private:
98 // Updates |url_| and |media_format_| with the given URL.
99 void SetURL(const GURL& url);
100
101 // Creates and starts the resource loading on the render thread. 97 // Creates and starts the resource loading on the render thread.
102 void StartTask(); 98 void StartTask();
103 99
104 // Cancels and deletes the resource loading on the render thread. 100 // Cancels and deletes the resource loading on the render thread.
105 void CancelTask(); 101 void CancelTask();
106 102
107 // Perform initialization completion tasks under a lock. 103 // Perform initialization completion tasks under a lock.
108 void DoneInitialization_Locked(bool success); 104 void DoneInitialization_Locked(bool success);
109 105
110 // Update host() stats like total bytes & buffered bytes. 106 // Update host() stats like total bytes & buffered bytes.
111 void UpdateHostState(); 107 void UpdateHostState();
112 108
113 // Primarily used for asserting the bridge is loading on the render thread. 109 // Primarily used for asserting the bridge is loading on the render thread.
114 MessageLoop* render_loop_; 110 MessageLoop* render_loop_;
115 111
116 // A webframe for loading. 112 // A webframe for loading.
117 WebKit::WebFrame* frame_; 113 WebKit::WebFrame* frame_;
118 114
119 // Does the work of loading and sends data back to this client. 115 // Does the work of loading and sends data back to this client.
120 scoped_ptr<WebKit::WebURLLoader> url_loader_; 116 scoped_ptr<WebKit::WebURLLoader> url_loader_;
121 117
122 media::MediaFormat media_format_;
123 GURL url_; 118 GURL url_;
124 std::string data_; 119 std::string data_;
125 int64 size_; 120 int64 size_;
126 bool single_origin_; 121 bool single_origin_;
127 122
128 // Simple state tracking variable. 123 // Simple state tracking variable.
129 enum State { 124 enum State {
130 UNINITIALIZED, 125 UNINITIALIZED,
131 INITIALIZING, 126 INITIALIZING,
132 INITIALIZED, 127 INITIALIZED,
133 STOPPED, 128 STOPPED,
134 }; 129 };
135 State state_; 130 State state_;
136 131
137 // Used for accessing |state_|. 132 // Used for accessing |state_|.
138 base::Lock lock_; 133 base::Lock lock_;
139 134
140 // Filter callbacks. 135 // Filter callbacks.
141 scoped_ptr<media::PipelineStatusCallback> initialize_callback_; 136 scoped_ptr<media::PipelineStatusCallback> initialize_callback_;
142 137
143 // Used to ensure mocks for unittests are used instead of reset in Start(). 138 // Used to ensure mocks for unittests are used instead of reset in Start().
144 bool keep_test_loader_; 139 bool keep_test_loader_;
145 140
146 DISALLOW_COPY_AND_ASSIGN(SimpleDataSource); 141 DISALLOW_COPY_AND_ASSIGN(SimpleDataSource);
147 }; 142 };
148 143
149 } // namespace webkit_glue 144 } // namespace webkit_glue
150 145
151 #endif // WEBKIT_GLUE_MEDIA_SIMPLE_DATA_SOURCE_H_ 146 #endif // WEBKIT_GLUE_MEDIA_SIMPLE_DATA_SOURCE_H_
OLDNEW
« no previous file with comments | « webkit/glue/media/buffered_data_source.cc ('k') | webkit/glue/media/simple_data_source.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698