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 fe01fb4d3cfa88be1f84f7b73cfc9b1f077fff97..d03e9d03858f9f0680bc873e9229cfca888dc36d 100644 |
--- a/webkit/glue/media/buffered_resource_loader.h |
+++ b/webkit/glue/media/buffered_resource_loader.h |
@@ -1,4 +1,4 @@ |
-// Copyright (c) 2010 The Chromium Authors. All rights reserved. |
+// Copyright (c) 2011 The Chromium Authors. All rights reserved. |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
@@ -28,6 +28,7 @@ const char kHttpScheme[] = "http"; |
const char kHttpsScheme[] = "https"; |
const char kDataScheme[] = "data"; |
+class BufferedDataSource; |
acolwell GONE FROM CHROMIUM
2011/03/25 23:08:14
No longer necessary.
vrk (LEFT CHROMIUM)
2011/03/29 00:53:00
Done.
|
// This class works inside demuxer thread and render thread. It contains a |
// WebURLLoader and does the actual resource loading. This object does |
// buffering internally, it defers the resource loading if buffer is full |
@@ -36,6 +37,12 @@ class BufferedResourceLoader : |
public base::RefCountedThreadSafe<BufferedResourceLoader>, |
public WebKit::WebURLLoaderClient { |
public: |
+ enum DeferStrategy { |
acolwell GONE FROM CHROMIUM
2011/03/25 23:08:14
Brief comments about each of these.
vrk (LEFT CHROMIUM)
2011/03/29 00:53:00
Done.
I also changed the naming style to match th
acolwell GONE FROM CHROMIUM
2011/03/29 05:52:03
I think the kXXX style is good here. I think Pipel
|
+ NeverDefer, |
+ ReadThenDefer, |
+ ThresholdDefer |
+ }; |
+ |
typedef Callback0::Type NetworkEventCallback; |
// |url| - URL for the resource to be loaded. |
@@ -85,9 +92,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. |
@@ -141,19 +145,30 @@ class BufferedResourceLoader : |
bool HasSingleOrigin() const; |
+ void SetDeferStrategy(DeferStrategy strategy); |
+ |
+ // Updates deferring behavior based on current buffering scheme. |
+ void UpdateDeferBehavior(); |
acolwell GONE FROM CHROMIUM
2011/03/25 23:08:14
I believe this can become private once the one cal
vrk (LEFT CHROMIUM)
2011/03/29 00:53:00
Done.
|
+ |
protected: |
friend class base::RefCountedThreadSafe<BufferedResourceLoader>; |
- |
virtual ~BufferedResourceLoader(); |
private: |
+ |
acolwell GONE FROM CHROMIUM
2011/03/25 23:08:14
Remove blank line
vrk (LEFT CHROMIUM)
2011/03/29 00:53:00
Done.
|
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(); |
- // Disable defer loading if we are under-buffered. |
- void DisableDeferIfNeeded(); |
+ // Returns true if we should enable resource loading, based |
+ // on current buffering scheme. |
+ bool ShouldDisableDefer(); |
// Returns true if the current read request can be fulfilled by what is in |
// the buffer. |
@@ -196,8 +211,7 @@ class BufferedResourceLoader : |
// True if resource loading was deferred. |
bool deferred_; |
- // True if resource loader is allowed to defer, false otherwise. |
- bool defer_allowed_; |
+ DeferStrategy defer_strategy_; |
// True if resource loading has completed. |
bool completed_; |