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 MEDIA_BASE_CALLBACK_HOLDER_H_ | 5 #ifndef MEDIA_BASE_CALLBACK_HOLDER_H_ |
6 #define MEDIA_BASE_CALLBACK_HOLDER_H_ | 6 #define MEDIA_BASE_CALLBACK_HOLDER_H_ |
7 | 7 |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
11 #include "media/base/bind_to_loop.h" | 11 #include "media/base/bind_to_current_loop.h" |
12 | 12 |
13 namespace media { | 13 namespace media { |
14 | 14 |
15 // A helper class that can hold a callback from being fired. | 15 // A helper class that can hold a callback from being fired. |
16 template <typename CB> class CallbackHolder { | 16 template <typename CB> class CallbackHolder { |
17 public: | 17 public: |
18 CallbackHolder() : hold_(false) {} | 18 CallbackHolder() : hold_(false) {} |
19 | 19 |
20 ~CallbackHolder() { | 20 ~CallbackHolder() { |
21 // Make sure all callbacks are satisfied! | 21 // Make sure all callbacks are satisfied! |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 | 79 |
80 private: | 80 private: |
81 bool hold_; | 81 bool hold_; |
82 CB original_cb_; | 82 CB original_cb_; |
83 base::Closure held_cb_; | 83 base::Closure held_cb_; |
84 }; | 84 }; |
85 | 85 |
86 } // namespace media | 86 } // namespace media |
87 | 87 |
88 #endif // MEDIA_BASE_CALLBACK_HOLDER_H_ | 88 #endif // MEDIA_BASE_CALLBACK_HOLDER_H_ |
OLD | NEW |