OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 SelfKeepAlive_h | 5 #ifndef SelfKeepAlive_h |
6 #define SelfKeepAlive_h | 6 #define SelfKeepAlive_h |
7 | 7 |
8 #include "platform/heap/Persistent.h" | 8 #include "platform/heap/Persistent.h" |
9 #include "wtf/Allocator.h" | 9 #include "wtf/Allocator.h" |
10 #include "wtf/Assertions.h" | 10 #include "wtf/Assertions.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 // // Clear self-reference that ensured we were kept alive while opened. | 30 // // Clear self-reference that ensured we were kept alive while opened. |
31 // m_keepAlive.clear(); | 31 // m_keepAlive.clear(); |
32 // .... | 32 // .... |
33 // } | 33 // } |
34 // | 34 // |
35 // private: | 35 // private: |
36 // ... | 36 // ... |
37 // SelfKeepAlive m_keepAlive; | 37 // SelfKeepAlive m_keepAlive; |
38 // }; | 38 // }; |
39 // | 39 // |
40 // The responsibility to call clear() in a timely fashion resides with the imple
mentation | 40 // The responsibility to call clear() in a timely fashion resides with the |
41 // of the object. | 41 // implementation of the object. |
42 // | 42 // |
43 // | 43 // |
44 template <typename Self> | 44 template <typename Self> |
45 class SelfKeepAlive final { | 45 class SelfKeepAlive final { |
46 DISALLOW_NEW(); | 46 DISALLOW_NEW(); |
47 | 47 |
48 public: | 48 public: |
49 SelfKeepAlive() {} | 49 SelfKeepAlive() {} |
50 | 50 |
51 explicit SelfKeepAlive(Self* self) { assign(self); } | 51 explicit SelfKeepAlive(Self* self) { assign(self); } |
(...skipping 13 matching lines...) Expand all Loading... |
65 m_keepAlive = self; | 65 m_keepAlive = self; |
66 } | 66 } |
67 | 67 |
68 GC_PLUGIN_IGNORE("420515") | 68 GC_PLUGIN_IGNORE("420515") |
69 Persistent<Self> m_keepAlive; | 69 Persistent<Self> m_keepAlive; |
70 }; | 70 }; |
71 | 71 |
72 } // namespace blink | 72 } // namespace blink |
73 | 73 |
74 #endif // SelfKeepAlive_h | 74 #endif // SelfKeepAlive_h |
OLD | NEW |