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

Side by Side Diff: third_party/WebKit/Source/core/dom/custom/CEReactionsScope.h

Issue 2097463002: Add backup element queue to CustomElementReactionStack (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix tests Created 4 years, 5 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CEReactionsScope_h 5 #ifndef CEReactionsScope_h
6 #define CEReactionsScope_h 6 #define CEReactionsScope_h
7 7
8 #include "core/CoreExport.h" 8 #include "core/CoreExport.h"
9 #include "platform/heap/Handle.h" 9 #include "platform/heap/Handle.h"
10 #include "wtf/Allocator.h" 10 #include "wtf/Allocator.h"
11 #include "wtf/Noncopyable.h" 11 #include "wtf/Noncopyable.h"
12 #include "wtf/StdLibExtras.h" 12 #include "wtf/StdLibExtras.h"
13 13
14 namespace blink { 14 namespace blink {
15 15
16 class CustomElementReaction; 16 class CustomElementReaction;
17 class CustomElementReactionStack;
17 class Element; 18 class Element;
18 class FrameHost; 19 class FrameHost;
19 20
20 // https://html.spec.whatwg.org/multipage/scripting.html#cereactions 21 // https://html.spec.whatwg.org/multipage/scripting.html#cereactions
21 class CORE_EXPORT CEReactionsScope final { 22 class CORE_EXPORT CEReactionsScope final {
22 STACK_ALLOCATED(); 23 STACK_ALLOCATED();
23 WTF_MAKE_NONCOPYABLE(CEReactionsScope); 24 WTF_MAKE_NONCOPYABLE(CEReactionsScope);
24 public: 25 public:
25 static CEReactionsScope* current()
26 {
27 return s_topOfStack;
28 }
29
30 CEReactionsScope() 26 CEReactionsScope()
31 : m_prev(s_topOfStack) 27 : m_prev(s_topOfStack)
32 { 28 {
33 s_topOfStack = this; 29 s_topOfStack = this;
34 } 30 }
35 31
36 ~CEReactionsScope() 32 ~CEReactionsScope()
37 { 33 {
38 if (m_frameHost.get()) 34 if (m_frameHost.get())
39 invokeReactions(); 35 invokeReactions();
40 s_topOfStack = s_topOfStack->m_prev; 36 s_topOfStack = s_topOfStack->m_prev;
41 } 37 }
42 38
43 void enqueue(Element*, CustomElementReaction*); 39 static CustomElementReactionStack* currentCustomElementReactionStack(
dominicc (has gone to gerrit) 2016/06/28 03:37:13 I think it would be better if we were not exposing
kojii 2016/06/28 04:19:04 Sounds good, done.
40 Element*);
44 41
45 private: 42 private:
46 static CEReactionsScope* s_topOfStack; 43 static CEReactionsScope* s_topOfStack;
47 44
48 void invokeReactions(); 45 void invokeReactions();
49 46
50 CEReactionsScope* m_prev; 47 CEReactionsScope* m_prev;
51 Member<FrameHost> m_frameHost; 48 Member<FrameHost> m_frameHost;
52 }; 49 };
53 50
54 } // namespace blink 51 } // namespace blink
55 52
56 #endif // CEReactionsScope_h 53 #endif // CEReactionsScope_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698