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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 void setContext(Context*); | 68 void setContext(Context*); |
69 | 69 |
70 private: | 70 private: |
71 RawPtrWillBeWeakMember<Context> m_lifecycleContext; | 71 RawPtrWillBeWeakMember<Context> m_lifecycleContext; |
72 }; | 72 }; |
73 | 73 |
74 template<typename T, typename Observer, typename Notifier> | 74 template<typename T, typename Observer, typename Notifier> |
75 inline void LifecycleObserver<T, Observer, Notifier>::setContext(typename Lifecy
cleObserver<T, Observer, Notifier>::Context* context) | 75 inline void LifecycleObserver<T, Observer, Notifier>::setContext(typename Lifecy
cleObserver<T, Observer, Notifier>::Context* context) |
76 { | 76 { |
77 if (m_lifecycleContext) | 77 if (m_lifecycleContext) |
78 static_cast<Notifier*>(m_lifecycleContext.get())->removeObserver(static_
cast<Observer*>(this)); | 78 static_cast<Notifier*>(m_lifecycleContext.get())->removeObserver(static_
cast<Observer*>(this), IsGarbageCollectedType<T>::value); |
79 | 79 |
80 m_lifecycleContext = context; | 80 m_lifecycleContext = context; |
81 | 81 |
82 if (m_lifecycleContext) | 82 if (m_lifecycleContext) |
83 static_cast<Notifier*>(m_lifecycleContext.get())->addObserver(static_cas
t<Observer*>(this)); | 83 static_cast<Notifier*>(m_lifecycleContext.get())->addObserver(static_cas
t<Observer*>(this), IsGarbageCollectedType<T>::value); |
84 } | 84 } |
85 | 85 |
86 } // namespace blink | 86 } // namespace blink |
87 | 87 |
88 #endif // LifecycleObserver_h | 88 #endif // LifecycleObserver_h |
OLD | NEW |