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

Unified Diff: webkit/glue/media/buffered_data_source.h

Issue 6625059: Implementing preload=metadata for video (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Cleanup defer strategy, fix logic bug Created 9 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: webkit/glue/media/buffered_data_source.h
diff --git a/webkit/glue/media/buffered_data_source.h b/webkit/glue/media/buffered_data_source.h
index 5ab30358d0000481d4c09ae550904ec6478bb6ef..ea8c3302f39e5142c4845322454839ed8f0598d9 100644
--- a/webkit/glue/media/buffered_data_source.h
+++ b/webkit/glue/media/buffered_data_source.h
@@ -11,6 +11,7 @@
#include "base/scoped_ptr.h"
#include "base/synchronization/lock.h"
#include "media/base/filter_factories.h"
+#include "media/base/filters.h"
#include "webkit/glue/media/buffered_resource_loader.h"
namespace webkit_glue {
@@ -32,6 +33,11 @@ class BufferedDataSource : public WebDataSource {
virtual void set_host(media::FilterHost* host);
virtual void Stop(media::FilterCallback* callback);
virtual void SetPlaybackRate(float playback_rate);
+ virtual void SetPreload(media::Preload preload);
+
+ // Decides which DeferStrategy to used based on the current state of the
+ // BufferedDataSource.
+ DeferStrategy* ChooseDeferStrategy();
// media::DataSource implementation.
// Called from demuxer thread.
@@ -89,6 +95,7 @@ class BufferedDataSource : public WebDataSource {
// to determine whether we are going from pause to play and play to pause,
// and signals the buffered resource loader accordingly.
void SetPlaybackRateTask(float playback_rate);
+ void SetPreloadTask(media::Preload preload);
// The method that performs actual read. This method can only be executed on
// the render thread.
@@ -196,6 +203,14 @@ class BufferedDataSource : public WebDataSource {
// are in a playing state.
bool media_is_paused_;
+ // This variable is true when the user has requested the video to play at
+ // least once.
+ bool media_has_played_;
+
+ // This variable holds the value of the preload attribute for the video
+ // element.
+ media::Preload preload_;
+
// This timer is to run the WatchDogTask repeatedly. We use a timer instead
// of doing PostDelayedTask() reduce the extra reference held by the message
// loop. The RepeatingTimer does PostDelayedTask() internally, by using it

Powered by Google App Engine
This is Rietveld 408576698