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

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

Issue 6625059: Implementing preload=metadata for video (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix indent 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
« no previous file with comments | « webkit/glue/media/buffered_data_source.cc ('k') | webkit/glue/media/buffered_resource_loader.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/glue/media/buffered_resource_loader.h
diff --git a/webkit/glue/media/buffered_resource_loader.h b/webkit/glue/media/buffered_resource_loader.h
index 3e04b43d166104f0e22187951516244a24edf539..22b8bd1b95706ea6cfa8abf8c2bee1396498f89a 100644
--- a/webkit/glue/media/buffered_resource_loader.h
+++ b/webkit/glue/media/buffered_resource_loader.h
@@ -36,6 +36,15 @@ class BufferedResourceLoader :
public base::RefCountedThreadSafe<BufferedResourceLoader>,
public WebKit::WebURLLoaderClient {
public:
+ // kNeverDefer - Aggresively buffer; never defer loading while paused.
+ // kReadThenDefer - Request only enough data to fulfill read requests.
+ // kThresholdDefer - Try to keep amount of buffered data at a threshold.
+ enum DeferStrategy {
+ kNeverDefer,
+ kReadThenDefer,
+ kThresholdDefer,
+ };
+
typedef Callback0::Type NetworkEventCallback;
// |url| - URL for the resource to be loaded.
@@ -85,9 +94,6 @@ class BufferedResourceLoader :
// |kPositionNotSpecified| if such value is not available.
virtual int64 GetBufferedPosition();
- // Sets whether deferring data is allowed or disallowed.
- virtual void SetAllowDefer(bool is_allowed);
-
// Gets the content length in bytes of the instance after this loader has been
// started. If this value is |kPositionNotSpecified|, then content length is
// unknown.
@@ -149,19 +155,30 @@ class BufferedResourceLoader :
bool HasSingleOrigin() const;
+ // Sets the defer strategy to the given value.
+ void UpdateDeferStrategy(DeferStrategy strategy);
+
protected:
friend class base::RefCountedThreadSafe<BufferedResourceLoader>;
-
virtual ~BufferedResourceLoader();
private:
friend class BufferedResourceLoaderTest;
- // Defer the resource loading if the buffer is full.
- void EnableDeferIfNeeded();
+ // Toggles whether the resource loading is deferred or not.
+ // Returns true if a network event was fired.
+ bool ToggleDeferring();
+
+ // Returns true if we should defer resource loading, based
+ // on current buffering scheme.
+ bool ShouldEnableDefer();
+
+ // Returns true if we should enable resource loading, based
+ // on current buffering scheme.
+ bool ShouldDisableDefer();
- // Disable defer loading if we are under-buffered.
- void DisableDeferIfNeeded();
+ // Updates deferring behavior based on current buffering scheme.
+ void UpdateDeferBehavior();
// Returns true if the current read request can be fulfilled by what is in
// the buffer.
@@ -204,8 +221,8 @@ class BufferedResourceLoader :
// True if resource loading was deferred.
bool deferred_;
- // True if resource loader is allowed to defer, false otherwise.
- bool defer_allowed_;
+ // Current buffering algorithm in place for resource loading.
+ DeferStrategy defer_strategy_;
// True if resource loading has completed.
bool completed_;
« no previous file with comments | « webkit/glue/media/buffered_data_source.cc ('k') | webkit/glue/media/buffered_resource_loader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698