OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 26 matching lines...) Expand all Loading... |
37 public: | 37 public: |
38 using Context = T; | 38 using Context = T; |
39 | 39 |
40 #if !ENABLE(OILPAN) | 40 #if !ENABLE(OILPAN) |
41 virtual ~LifecycleObserver() | 41 virtual ~LifecycleObserver() |
42 { | 42 { |
43 dispose(); | 43 dispose(); |
44 } | 44 } |
45 #endif | 45 #endif |
46 | 46 |
| 47 // TODO(Oilpan): remove eager sweeping once LifecycleObserver is |
| 48 // always on the heap. |
| 49 EAGERLY_SWEEP(); |
47 DEFINE_INLINE_VIRTUAL_TRACE() | 50 DEFINE_INLINE_VIRTUAL_TRACE() |
48 { | 51 { |
49 visitor->trace(m_lifecycleContext); | 52 visitor->trace(m_lifecycleContext); |
50 } | 53 } |
| 54 |
51 virtual void contextDestroyed() { } | 55 virtual void contextDestroyed() { } |
52 | 56 |
53 void dispose() | 57 void dispose() |
54 { | 58 { |
55 setContext(nullptr); | 59 setContext(nullptr); |
56 } | 60 } |
57 | 61 |
58 Context* lifecycleContext() const { return m_lifecycleContext; } | 62 Context* lifecycleContext() const { return m_lifecycleContext; } |
59 void clearLifecycleContext() { m_lifecycleContext = nullptr; } | 63 void clearLifecycleContext() { m_lifecycleContext = nullptr; } |
60 | 64 |
(...skipping 18 matching lines...) Expand all Loading... |
79 | 83 |
80 m_lifecycleContext = context; | 84 m_lifecycleContext = context; |
81 | 85 |
82 if (m_lifecycleContext) | 86 if (m_lifecycleContext) |
83 static_cast<Notifier*>(m_lifecycleContext.get())->addObserver(static_cas
t<Observer*>(this)); | 87 static_cast<Notifier*>(m_lifecycleContext.get())->addObserver(static_cas
t<Observer*>(this)); |
84 } | 88 } |
85 | 89 |
86 } // namespace blink | 90 } // namespace blink |
87 | 91 |
88 #endif // LifecycleObserver_h | 92 #endif // LifecycleObserver_h |
OLD | NEW |