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

Side by Side 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: ntis 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef WEBKIT_MEDIA_ACTIVE_LOADER_H_
6 #define WEBKIT_MEDIA_ACTIVE_LOADER_H_
7
8 #include "base/basictypes.h"
9 #include "base/memory/ref_counted.h"
10 #include "base/memory/scoped_ptr.h"
11
12 namespace WebKit {
13 class WebURLLoader;
14 }
15
16 namespace webkit_media {
17
18 class BufferedResourceLoader;
19
20 // Wraps an active WebURLLoader with some additional state and maintains a
21 // reference to its parent.
22 //
23 // Handles deferring and cancellation of loaders upon deletion.
24 class ActiveLoader {
25 public:
26 // Creates an ActiveLoader with a reference to its parent. The initial state
27 // assumes that the loader has started loading and has not been deferred.
28 //
29 // ActiveLoader takes ownership of |loader|.
30 ActiveLoader(const scoped_refptr<BufferedResourceLoader>& parent,
31 WebKit::WebURLLoader* loader);
32 ~ActiveLoader();
33
34 // Starts or stops deferring the resource load.
35 void SetDeferred(bool deferred);
36
37 bool deferred() { return deferred_; }
38
39 private:
40 friend class BufferedDataSourceTest;
41
42 scoped_refptr<BufferedResourceLoader> parent_;
43 scoped_ptr<WebKit::WebURLLoader> loader_;
44 bool deferred_;
45
46 DISALLOW_IMPLICIT_CONSTRUCTORS(ActiveLoader);
47 };
48
49 } // namespace webkit_media
50
51 #endif // WEBKIT_MEDIA_ACTIVE_LOADER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698