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

Side by Side Diff: sky/engine/core/frame/EventHandlerRegistry.cpp

Issue 686783002: Remove almost all of Oilpan (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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 | « sky/engine/core/frame/EventHandlerRegistry.h ('k') | sky/engine/core/frame/FrameView.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 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "config.h" 5 #include "config.h"
6 #include "core/frame/EventHandlerRegistry.h" 6 #include "core/frame/EventHandlerRegistry.h"
7 7
8 #include "core/events/ThreadLocalEventNames.h" 8 #include "core/events/ThreadLocalEventNames.h"
9 #include "core/frame/LocalDOMWindow.h" 9 #include "core/frame/LocalDOMWindow.h"
10 #include "core/frame/LocalFrame.h" 10 #include "core/frame/LocalFrame.h"
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 } 188 }
189 } 189 }
190 190
191 void EventHandlerRegistry::notifyDidAddOrRemoveEventHandlerTarget(EventHandlerCl ass handlerClass) 191 void EventHandlerRegistry::notifyDidAddOrRemoveEventHandlerTarget(EventHandlerCl ass handlerClass)
192 { 192 {
193 ScrollingCoordinator* scrollingCoordinator = m_frameHost.page().scrollingCoo rdinator(); 193 ScrollingCoordinator* scrollingCoordinator = m_frameHost.page().scrollingCoo rdinator();
194 if (scrollingCoordinator && handlerClass == TouchEvent) 194 if (scrollingCoordinator && handlerClass == TouchEvent)
195 scrollingCoordinator->touchEventTargetRectsDidChange(); 195 scrollingCoordinator->touchEventTargetRectsDidChange();
196 } 196 }
197 197
198 void EventHandlerRegistry::trace(Visitor* visitor)
199 {
200 visitor->registerWeakMembers<EventHandlerRegistry, &EventHandlerRegistry::cl earWeakMembers>(this);
201 }
202
203 void EventHandlerRegistry::clearWeakMembers(Visitor* visitor)
204 {
205 Vector<EventTarget*> deadTargets;
206 for (size_t i = 0; i < EventHandlerClassCount; ++i) {
207 EventHandlerClass handlerClass = static_cast<EventHandlerClass>(i);
208 const EventTargetSet* targets = &m_targets[handlerClass];
209 for (EventTargetSet::const_iterator it = targets->begin(); it != targets ->end(); ++it) {
210 Node* node = it->key->toNode();
211 LocalDOMWindow* window = it->key->toDOMWindow();
212 if (node && !visitor->isAlive(node)) {
213 deadTargets.append(node);
214 } else if (window && !visitor->isAlive(window)) {
215 deadTargets.append(window);
216 }
217 }
218 }
219 for (size_t i = 0; i < deadTargets.size(); ++i)
220 didRemoveAllEventHandlers(*deadTargets[i]);
221 }
222
223 void EventHandlerRegistry::documentDetached(Document& document) 198 void EventHandlerRegistry::documentDetached(Document& document)
224 { 199 {
225 // Remove all event targets under the detached document. 200 // Remove all event targets under the detached document.
226 for (size_t handlerClassIndex = 0; handlerClassIndex < EventHandlerClassCoun t; ++handlerClassIndex) { 201 for (size_t handlerClassIndex = 0; handlerClassIndex < EventHandlerClassCoun t; ++handlerClassIndex) {
227 EventHandlerClass handlerClass = static_cast<EventHandlerClass>(handlerC lassIndex); 202 EventHandlerClass handlerClass = static_cast<EventHandlerClass>(handlerC lassIndex);
228 Vector<EventTarget*> targetsToRemove; 203 Vector<EventTarget*> targetsToRemove;
229 const EventTargetSet* targets = &m_targets[handlerClass]; 204 const EventTargetSet* targets = &m_targets[handlerClass];
230 for (EventTargetSet::const_iterator iter = targets->begin(); iter != tar gets->end(); ++iter) { 205 for (EventTargetSet::const_iterator iter = targets->begin(); iter != tar gets->end(); ++iter) {
231 if (Node* node = iter->key->toNode()) { 206 if (Node* node = iter->key->toNode()) {
232 if (node->document() == &document) { 207 if (node->document() == &document) {
(...skipping 29 matching lines...) Expand all
262 ASSERT(window->frame()); 237 ASSERT(window->frame());
263 ASSERT(window->frame()->host()); 238 ASSERT(window->frame()->host());
264 ASSERT(window->frame()->host() == &m_frameHost); 239 ASSERT(window->frame()->host() == &m_frameHost);
265 } 240 }
266 } 241 }
267 } 242 }
268 #endif // ENABLE(ASSERT) 243 #endif // ENABLE(ASSERT)
269 } 244 }
270 245
271 } // namespace blink 246 } // namespace blink
OLDNEW
« no previous file with comments | « sky/engine/core/frame/EventHandlerRegistry.h ('k') | sky/engine/core/frame/FrameView.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698