| 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 21 matching lines...) Expand all Loading... |
| 32 namespace blink { | 32 namespace blink { |
| 33 | 33 |
| 34 template <typename Context, typename Observer> | 34 template <typename Context, typename Observer> |
| 35 class LifecycleNotifier; | 35 class LifecycleNotifier; |
| 36 | 36 |
| 37 template <typename Context, typename Observer> | 37 template <typename Context, typename Observer> |
| 38 class LifecycleObserver : public GarbageCollectedMixin { | 38 class LifecycleObserver : public GarbageCollectedMixin { |
| 39 public: | 39 public: |
| 40 DEFINE_INLINE_VIRTUAL_TRACE() { visitor->trace(m_lifecycleContext); } | 40 DEFINE_INLINE_VIRTUAL_TRACE() { visitor->trace(m_lifecycleContext); } |
| 41 | 41 |
| 42 virtual void contextDestroyed() {} | 42 virtual void contextDestroyed(Context*) {} |
| 43 | 43 |
| 44 Context* lifecycleContext() const { return m_lifecycleContext; } | 44 Context* lifecycleContext() const { return m_lifecycleContext; } |
| 45 | 45 |
| 46 void clearContext() { setContext(nullptr); } | 46 void clearContext() { setContext(nullptr); } |
| 47 | 47 |
| 48 protected: | 48 protected: |
| 49 explicit LifecycleObserver(Context* context) : m_lifecycleContext(nullptr) { | 49 explicit LifecycleObserver(Context* context) : m_lifecycleContext(nullptr) { |
| 50 setContext(context); | 50 setContext(context); |
| 51 } | 51 } |
| 52 | 52 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 69 | 69 |
| 70 if (m_lifecycleContext) { | 70 if (m_lifecycleContext) { |
| 71 static_cast<Notifier*>(m_lifecycleContext) | 71 static_cast<Notifier*>(m_lifecycleContext) |
| 72 ->addObserver(static_cast<Observer*>(this)); | 72 ->addObserver(static_cast<Observer*>(this)); |
| 73 } | 73 } |
| 74 } | 74 } |
| 75 | 75 |
| 76 } // namespace blink | 76 } // namespace blink |
| 77 | 77 |
| 78 #endif // LifecycleObserver_h | 78 #endif // LifecycleObserver_h |
| OLD | NEW |