Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(107)

Side by Side Diff: Source/platform/LifecycleNotifier.h

Issue 1024543004: Disallow adding ContextLifecycleObservers during iteration. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: tidier LifecycleObserver ctor Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/platform/LifecycleContextTest.cpp ('k') | Source/platform/LifecycleObserver.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved.
3 * Copyright (C) 2013 Google Inc. All Rights Reserved. 3 * Copyright (C) 2013 Google Inc. All Rights Reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 protected: 60 protected:
61 LifecycleNotifier() 61 LifecycleNotifier()
62 : m_iterating(IteratingNone) 62 : m_iterating(IteratingNone)
63 , m_didCallContextDestroyed(false) 63 , m_didCallContextDestroyed(false)
64 { 64 {
65 } 65 }
66 66
67 enum IterationType { 67 enum IterationType {
68 IteratingNone, 68 IteratingNone,
69 IteratingOverAll, 69 IteratingOverAll,
70 IteratingOverActiveDOMObjects,
71 }; 70 };
72 71
73 IterationType m_iterating; 72 IterationType m_iterating;
74 73
75 protected: 74 protected:
76 using ObserverSet = WillBeHeapHashSet<RawPtrWillBeWeakMember<Observer>>; 75 using ObserverSet = WillBeHeapHashSet<RawPtrWillBeWeakMember<Observer>>;
77 76
78 // FIXME: Oilpan: make LifecycleNotifier<> a GC mixin, somehow. ExecutionCon text 77 // FIXME: Oilpan: make LifecycleNotifier<> a GC mixin, somehow. ExecutionCon text
79 // is the problematic case, as it would then be a class with two GC mixin 78 // is the problematic case, as it would then be a class with two GC mixin
80 // bases, but cannot itself derive from a GC base class also. 79 // bases, but cannot itself derive from a GC base class also.
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 136
138 template<typename T, typename Observer> 137 template<typename T, typename Observer>
139 inline void LifecycleNotifier<T, Observer>::removeObserver(Observer* observer) 138 inline void LifecycleNotifier<T, Observer>::removeObserver(Observer* observer)
140 { 139 {
141 m_observers.remove(observer); 140 m_observers.remove(observer);
142 } 141 }
143 142
144 } // namespace blink 143 } // namespace blink
145 144
146 #endif // LifecycleNotifier_h 145 #endif // LifecycleNotifier_h
OLDNEW
« no previous file with comments | « Source/platform/LifecycleContextTest.cpp ('k') | Source/platform/LifecycleObserver.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698