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

Unified Diff: webkit/media/active_loader.h

Issue 8667002: Split a portion of BufferedResourceLoader into a separate class ActiveLoader. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src
Patch Set: fixes Created 9 years 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 | « tools/valgrind/memcheck/suppressions.txt ('k') | webkit/media/active_loader.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..18c220c8d3dbc0593a3e99c987753b7bc615160e
--- /dev/null
+++ b/webkit/media/active_loader.h
@@ -0,0 +1,53 @@
+// 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 deletion of loaders.
+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 takes ownership of |loader|.
+ ActiveLoader(const scoped_refptr<BufferedResourceLoader>& parent,
+ WebKit::WebURLLoader* loader);
+ ~ActiveLoader();
+
+ // Starts or stops deferring the resource load.
+ void SetDeferred(bool deferred);
+ bool deferred() { return deferred_; }
+
+ // Cancels the URL loader associated with this object.
+ void Cancel();
+
+ 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_
« no previous file with comments | « tools/valgrind/memcheck/suppressions.txt ('k') | webkit/media/active_loader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698