Fix Win8 metro startup crash from window switcher button
[chromium-blink-merge.git] / webkit / media / active_loader.h
blob171730707b16db51fef2abf84468bd62f5654002
1 // Copyright (c) 2012 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 WEBKIT_MEDIA_ACTIVE_LOADER_H_
6 #define WEBKIT_MEDIA_ACTIVE_LOADER_H_
8 #include "base/basictypes.h"
9 #include "base/memory/scoped_ptr.h"
11 namespace WebKit {
12 class WebURLLoader;
15 namespace webkit_media {
17 // Wraps an active WebURLLoader with some additional state.
19 // Handles deferring and deletion of loaders.
20 class ActiveLoader {
21 public:
22 // Creates an ActiveLoader with the given loader. It is assumed that the
23 // initial state of |loader| is loading and not deferred.
24 explicit ActiveLoader(scoped_ptr<WebKit::WebURLLoader> loader);
25 ~ActiveLoader();
27 // Starts or stops deferring the resource load.
28 void SetDeferred(bool deferred);
29 bool deferred() { return deferred_; }
31 private:
32 friend class BufferedDataSourceTest;
34 scoped_ptr<WebKit::WebURLLoader> loader_;
35 bool deferred_;
37 DISALLOW_IMPLICIT_CONSTRUCTORS(ActiveLoader);
40 } // namespace webkit_media
42 #endif // WEBKIT_MEDIA_ACTIVE_LOADER_H_