OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CONTENT_RENDERER_MEDIA_ACTIVE_LOADER_H_ | 5 #ifndef MEDIA_BLINK_ACTIVE_LOADER_H_ |
6 #define CONTENT_RENDERER_MEDIA_ACTIVE_LOADER_H_ | 6 #define MEDIA_BLINK_ACTIVE_LOADER_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 | 10 |
11 namespace blink { | 11 namespace blink { |
12 class WebURLLoader; | 12 class WebURLLoader; |
13 } | 13 } |
14 | 14 |
15 namespace content { | 15 namespace media { |
16 | 16 |
17 // Wraps an active WebURLLoader with some additional state. | 17 // Wraps an active WebURLLoader with some additional state. |
18 // | 18 // |
19 // Handles deferring and deletion of loaders. | 19 // Handles deferring and deletion of loaders. |
20 class ActiveLoader { | 20 class ActiveLoader { |
21 public: | 21 public: |
22 // Creates an ActiveLoader with the given loader. It is assumed that the | 22 // Creates an ActiveLoader with the given loader. It is assumed that the |
23 // initial state of |loader| is loading and not deferred. | 23 // initial state of |loader| is loading and not deferred. |
24 explicit ActiveLoader(scoped_ptr<blink::WebURLLoader> loader); | 24 explicit ActiveLoader(scoped_ptr<blink::WebURLLoader> loader); |
25 ~ActiveLoader(); | 25 ~ActiveLoader(); |
26 | 26 |
27 // Starts or stops deferring the resource load. | 27 // Starts or stops deferring the resource load. |
28 void SetDeferred(bool deferred); | 28 void SetDeferred(bool deferred); |
29 bool deferred() { return deferred_; } | 29 bool deferred() { return deferred_; } |
30 | 30 |
31 private: | 31 private: |
32 friend class BufferedDataSourceTest; | 32 friend class BufferedDataSourceTest; |
33 | 33 |
34 scoped_ptr<blink::WebURLLoader> loader_; | 34 scoped_ptr<blink::WebURLLoader> loader_; |
35 bool deferred_; | 35 bool deferred_; |
36 | 36 |
37 DISALLOW_IMPLICIT_CONSTRUCTORS(ActiveLoader); | 37 DISALLOW_IMPLICIT_CONSTRUCTORS(ActiveLoader); |
38 }; | 38 }; |
39 | 39 |
40 } // namespace content | 40 } // namespace media |
41 | 41 |
42 #endif // CONTENT_RENDERER_MEDIA_ACTIVE_LOADER_H_ | 42 #endif // MEDIA_BLINK_ACTIVE_LOADER_H_ |
OLD | NEW |