Index: webkit/media/active_loader.h |
diff --git a/webkit/media/active_loader.h b/webkit/media/active_loader.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..e03aa93b27a5d77d45e836b0a2ea94b2c47906cb |
--- /dev/null |
+++ b/webkit/media/active_loader.h |
@@ -0,0 +1,49 @@ |
+// 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. |
+ |
+#ifndef WEBKIT_MEDIA_ACTIVE_LOADER_H_ |
+#define WEBKIT_MEDIA_ACTIVE_LOADER_H_ |
+ |
+#include "base/basictypes.h" |
+#include "base/memory/ref_counted.h" |
+#include "base/memory/scoped_ptr.h" |
+ |
+namespace WebKit { |
+class WebURLLoader; |
+} |
+ |
+namespace webkit_media { |
+ |
+class BufferedResourceLoader; |
+ |
+// Wraps an active WebURLLoader with some additional state and maintains a |
+// reference to its parent. |
+// |
+// Handles deferring and cancellation of loaders upon deletion. |
+class ActiveLoader { |
+ public: |
+ // Creates an ActiveLoader with a reference to its parent. The initial state |
+ // assumes that the loader has started loading and has not been deferred. |
+ ActiveLoader(const scoped_refptr<BufferedResourceLoader>& parent, |
+ WebKit::WebURLLoader* loader); |
Ami GONE FROM CHROMIUM
2011/11/29 18:55:49
Doco taking ownership.
scherkus (not reviewing)
2011/11/29 21:43:51
Done.
|
+ ~ActiveLoader(); |
+ |
+ // Starts or stops deferring the resource load. |
+ void SetDeferred(bool deferred); |
+ |
+ bool deferred() { return deferred_; } |
+ |
+ private: |
+ friend class BufferedDataSourceTest; |
+ |
+ scoped_refptr<BufferedResourceLoader> parent_; |
+ scoped_ptr<WebKit::WebURLLoader> loader_; |
+ bool deferred_; |
+ |
+ DISALLOW_IMPLICIT_CONSTRUCTORS(ActiveLoader); |
+}; |
+ |
+} // namespace webkit_media |
+ |
+#endif // WEBKIT_MEDIA_ACTIVE_LOADER_H_ |