OLD | NEW |
---|---|
(Empty) | |
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. | |
4 | |
5 #ifndef CC_RESOURCES_SCOPED_RELEASE_CALLBACK_H_ | |
6 #define CC_RESOURCES_SCOPED_RELEASE_CALLBACK_H_ | |
7 | |
8 #include "base/move.h" | |
9 #include "cc/base/cc_export.h" | |
10 #include "cc/resources/release_callback.h" | |
11 | |
12 namespace cc { | |
13 | |
14 // A ReleaseCallback that can only have one owner. It must have RunAndReset() | |
awong
2013/09/13 07:07:19
??? As is, can't people just copy ReleaseCallback
danakj
2013/09/13 17:32:59
Yes, we have been careful to ensure they are alway
| |
15 // called before it is destroyed. | |
16 class CC_EXPORT ScopedReleaseCallback { | |
17 MOVE_ONLY_TYPE_FOR_CPP_03(ScopedReleaseCallback, RValue) | |
18 public: | |
19 ScopedReleaseCallback(); | |
20 explicit ScopedReleaseCallback(const ReleaseCallback& callback); | |
21 // This constructor is for Pass(). | |
22 ScopedReleaseCallback(RValue other); // NOLINT(runtime/explicit) | |
23 ~ScopedReleaseCallback(); | |
24 | |
25 void RunAndReset(unsigned sync_point, bool is_lost); | |
26 | |
27 // Move-only emulation, only usable with Pass(). | |
28 ScopedReleaseCallback& operator=(ScopedReleaseCallback rhs); | |
29 | |
30 ReleaseCallback Leak(); | |
31 | |
32 bool Equals(const ScopedReleaseCallback& other) const { | |
33 return callback_.Equals(other.callback_); | |
34 } | |
35 | |
36 bool IsEmpty() const { return callback_.is_null(); } | |
piman
2013/09/13 06:08:30
nit: is_null() ? I'm not sure 'empty' qualifies a
| |
37 | |
38 private: | |
39 ReleaseCallback callback_; | |
40 }; | |
41 | |
42 } // namespace cc | |
43 | |
44 #endif // CC_RESOURCES_SCOPED_RELEASE_CALLBACK_H_ | |
OLD | NEW |