Chromium Code Reviews| 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 EAGERLY_SWEEP(); | |
|
haraken
2015/05/21 23:24:49
Add a TODO to remove this.
| |
| 47 DEFINE_INLINE_VIRTUAL_TRACE() | 48 DEFINE_INLINE_VIRTUAL_TRACE() |
| 48 { | 49 { |
| 49 visitor->trace(m_lifecycleContext); | 50 visitor->trace(m_lifecycleContext); |
| 50 } | 51 } |
| 52 | |
| 51 virtual void contextDestroyed() { } | 53 virtual void contextDestroyed() { } |
| 52 | 54 |
| 53 void dispose() | 55 void dispose() |
| 54 { | 56 { |
| 55 setContext(nullptr); | 57 setContext(nullptr); |
| 56 } | 58 } |
| 57 | 59 |
| 58 Context* lifecycleContext() const { return m_lifecycleContext; } | 60 Context* lifecycleContext() const { return m_lifecycleContext; } |
| 59 void clearLifecycleContext() { m_lifecycleContext = nullptr; } | 61 void clearLifecycleContext() { m_lifecycleContext = nullptr; } |
| 60 | 62 |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 79 | 81 |
| 80 m_lifecycleContext = context; | 82 m_lifecycleContext = context; |
| 81 | 83 |
| 82 if (m_lifecycleContext) | 84 if (m_lifecycleContext) |
| 83 static_cast<Notifier*>(m_lifecycleContext.get())->addObserver(static_cas t<Observer*>(this)); | 85 static_cast<Notifier*>(m_lifecycleContext.get())->addObserver(static_cas t<Observer*>(this)); |
| 84 } | 86 } |
| 85 | 87 |
| 86 } // namespace blink | 88 } // namespace blink |
| 87 | 89 |
| 88 #endif // LifecycleObserver_h | 90 #endif // LifecycleObserver_h |
| OLD | NEW |