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

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

Issue 512413002: Move Preload enum to BufferedDataSource. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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
« no previous file with comments | « content/content_renderer.gypi ('k') | content/renderer/media/buffered_data_source_unittest.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 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"
16 #include "media/base/data_source.h" 15 #include "media/base/data_source.h"
17 #include "media/base/ranges.h" 16 #include "media/base/ranges.h"
18 #include "url/gurl.h" 17 #include "url/gurl.h"
19 18
20 namespace base { 19 namespace base {
21 class SingleThreadTaskRunner; 20 class SingleThreadTaskRunner;
22 } 21 }
23 22
24 namespace media { 23 namespace media {
25 class MediaLog; 24 class MediaLog;
(...skipping 15 matching lines...) Expand all
41 virtual ~BufferedDataSourceHost() {}; 40 virtual ~BufferedDataSourceHost() {};
42 }; 41 };
43 42
44 // A data source capable of loading URLs and buffering the data using an 43 // A data source capable of loading URLs and buffering the data using an
45 // in-memory sliding window. 44 // in-memory sliding window.
46 // 45 //
47 // BufferedDataSource must be created and initialized on the render thread 46 // BufferedDataSource must be created and initialized on the render thread
48 // before being passed to other threads. It may be deleted on any thread. 47 // before being passed to other threads. It may be deleted on any thread.
49 class CONTENT_EXPORT BufferedDataSource : public media::DataSource { 48 class CONTENT_EXPORT BufferedDataSource : public media::DataSource {
50 public: 49 public:
50 // Used to specify video preload states. They are "hints" to the browser about
51 // how aggressively the browser should load and buffer data.
52 // Please see the HTML5 spec for the descriptions of these values:
53 // http://www.w3.org/TR/html5/video.html#attr-media-preload
54 //
55 // Enum values must match the values in blink::WebMediaPlayer::Preload and
56 // there will be assertions at compile time if they do not match.
57 enum Preload {
58 NONE,
59 METADATA,
60 AUTO,
61 };
51 typedef base::Callback<void(bool)> DownloadingCB; 62 typedef base::Callback<void(bool)> DownloadingCB;
52 63
53 // |url| and |cors_mode| are passed to the object. Buffered byte range changes 64 // |url| and |cors_mode| are passed to the object. Buffered byte range changes
54 // will be reported to |host|. |downloading_cb| will be called whenever the 65 // will be reported to |host|. |downloading_cb| will be called whenever the
55 // downloading/paused state of the source changes. 66 // downloading/paused state of the source changes.
56 BufferedDataSource( 67 BufferedDataSource(
57 const GURL& url, 68 const GURL& url,
58 BufferedResourceLoader::CORSMode cors_mode, 69 BufferedResourceLoader::CORSMode cors_mode,
59 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, 70 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner,
60 blink::WebFrame* frame, 71 blink::WebFrame* frame,
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 234
224 // NOTE: Weak pointers must be invalidated before all other member variables. 235 // NOTE: Weak pointers must be invalidated before all other member variables.
225 base::WeakPtrFactory<BufferedDataSource> weak_factory_; 236 base::WeakPtrFactory<BufferedDataSource> weak_factory_;
226 237
227 DISALLOW_COPY_AND_ASSIGN(BufferedDataSource); 238 DISALLOW_COPY_AND_ASSIGN(BufferedDataSource);
228 }; 239 };
229 240
230 } // namespace content 241 } // namespace content
231 242
232 #endif // CONTENT_RENDERER_MEDIA_BUFFERED_DATA_SOURCE_H_ 243 #endif // CONTENT_RENDERER_MEDIA_BUFFERED_DATA_SOURCE_H_
OLDNEW
« no previous file with comments | « content/content_renderer.gypi ('k') | content/renderer/media/buffered_data_source_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698