OLD | NEW |
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 #include "core/dom/custom/CustomElementReactionStack.h" | 5 #include "core/dom/custom/CustomElementReactionStack.h" |
6 | 6 |
7 #include "bindings/core/v8/Microtask.h" | 7 #include "bindings/core/v8/Microtask.h" |
8 #include "core/dom/Element.h" | 8 #include "core/dom/Element.h" |
9 #include "core/dom/custom/CEReactionsScope.h" | 9 #include "core/dom/custom/CEReactionsScope.h" |
10 #include "core/dom/custom/CustomElementReactionQueue.h" | 10 #include "core/dom/custom/CustomElementReactionQueue.h" |
11 #include "core/frame/FrameHost.h" | 11 #include "core/frame/FrameHost.h" |
12 | 12 |
13 namespace blink { | 13 namespace blink { |
14 | 14 |
| 15 namespace { |
| 16 |
| 17 CustomElementReactionStack& customElementReactionStack() |
| 18 { |
| 19 DEFINE_STATIC_LOCAL(CustomElementReactionStack, customElementReactionStack,
(new CustomElementReactionStack)); |
| 20 return customElementReactionStack; |
| 21 } |
| 22 |
| 23 } // namespace |
| 24 |
15 // TODO(dominicc): Consider using linked heap structures, avoiding | 25 // TODO(dominicc): Consider using linked heap structures, avoiding |
16 // finalizers, to make short-lived entries fast. | 26 // finalizers, to make short-lived entries fast. |
17 | 27 |
18 CustomElementReactionStack::CustomElementReactionStack() | 28 CustomElementReactionStack::CustomElementReactionStack() |
19 { | 29 { |
20 } | 30 } |
21 | 31 |
22 DEFINE_TRACE(CustomElementReactionStack) | 32 DEFINE_TRACE(CustomElementReactionStack) |
23 { | 33 { |
24 visitor->trace(m_map); | 34 visitor->trace(m_map); |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 enqueue(m_backupQueue, element, reaction); | 106 enqueue(m_backupQueue, element, reaction); |
97 } | 107 } |
98 | 108 |
99 void CustomElementReactionStack::invokeBackupQueue() | 109 void CustomElementReactionStack::invokeBackupQueue() |
100 { | 110 { |
101 DCHECK(isMainThread()); | 111 DCHECK(isMainThread()); |
102 invokeReactions(*m_backupQueue); | 112 invokeReactions(*m_backupQueue); |
103 m_backupQueue->clear(); | 113 m_backupQueue->clear(); |
104 } | 114 } |
105 | 115 |
| 116 CustomElementReactionStack& CustomElementReactionStack::current() |
| 117 { |
| 118 return customElementReactionStack(); |
| 119 } |
| 120 |
106 } // namespace blink | 121 } // namespace blink |
OLD | NEW |