Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / media / blink / active_loader.h
blobd8c60df8e8b3ba2f92f2215945588d1c837cea00
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
3 // found in the LICENSE file.
5 #ifndef MEDIA_BLINK_ACTIVE_LOADER_H_
6 #define MEDIA_BLINK_ACTIVE_LOADER_H_
8 #include "base/basictypes.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "media/base/media_export.h"
12 namespace blink {
13 class WebURLLoader;
16 namespace media {
18 // Wraps an active WebURLLoader with some additional state.
20 // Handles deferring and deletion of loaders.
21 class MEDIA_EXPORT ActiveLoader {
22 public:
23 // Creates an ActiveLoader with the given loader. It is assumed that the
24 // initial state of |loader| is loading and not deferred.
25 explicit ActiveLoader(scoped_ptr<blink::WebURLLoader> loader);
26 ~ActiveLoader();
28 // Starts or stops deferring the resource load.
29 void SetDeferred(bool deferred);
30 bool deferred() { return deferred_; }
32 private:
33 friend class BufferedDataSourceTest;
35 scoped_ptr<blink::WebURLLoader> loader_;
36 bool deferred_;
38 DISALLOW_IMPLICIT_CONSTRUCTORS(ActiveLoader);
41 } // namespace media
43 #endif // MEDIA_BLINK_ACTIVE_LOADER_H_