| 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 , m_observerType(type) | 49 , m_observerType(type) |
| 50 { | 50 { |
| 51 observeContext(context); | 51 observeContext(context); |
| 52 } | 52 } |
| 53 | 53 |
| 54 virtual ~LifecycleObserver() | 54 virtual ~LifecycleObserver() |
| 55 { | 55 { |
| 56 observeContext(0); | 56 observeContext(0); |
| 57 } | 57 } |
| 58 | 58 |
| 59 virtual void contextWillBeDestroyed() { } |
| 59 virtual void contextDestroyed() { m_lifecycleContext = 0; } | 60 virtual void contextDestroyed() { m_lifecycleContext = 0; } |
| 60 | 61 |
| 61 | |
| 62 Context* lifecycleContext() const { return m_lifecycleContext; } | 62 Context* lifecycleContext() const { return m_lifecycleContext; } |
| 63 Type observerType() const { return m_observerType; } | 63 Type observerType() const { return m_observerType; } |
| 64 | 64 |
| 65 protected: | 65 protected: |
| 66 void observeContext(Context*); | 66 void observeContext(Context*); |
| 67 | 67 |
| 68 Context* m_lifecycleContext; | 68 Context* m_lifecycleContext; |
| 69 Type m_observerType; | 69 Type m_observerType; |
| 70 }; | 70 }; |
| 71 | 71 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 84 | 84 |
| 85 m_lifecycleContext = context; | 85 m_lifecycleContext = context; |
| 86 | 86 |
| 87 if (m_lifecycleContext) | 87 if (m_lifecycleContext) |
| 88 observerContext(m_lifecycleContext, this); | 88 observerContext(m_lifecycleContext, this); |
| 89 } | 89 } |
| 90 | 90 |
| 91 } // namespace WebCore | 91 } // namespace WebCore |
| 92 | 92 |
| 93 #endif // LifecycleObserver_h | 93 #endif // LifecycleObserver_h |
| OLD | NEW |