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

Side by Side Diff: Source/core/dom/EventHandlerRegistry.cpp

Issue 255983003: Oilpan: Move all supplements of Page, Document, and WorkerClients to the managed heap. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: using namespace WebCore Created 6 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/dom/EventHandlerRegistry.h ('k') | Source/core/dom/FullscreenElementStack.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/dom/EventHandlerRegistry.h" 6 #include "core/dom/EventHandlerRegistry.h"
7 7
8 #include "core/dom/Document.h" 8 #include "core/dom/Document.h"
9 #include "core/events/ThreadLocalEventNames.h" 9 #include "core/events/ThreadLocalEventNames.h"
10 #include "core/events/WheelEvent.h" 10 #include "core/events/WheelEvent.h"
(...skipping 26 matching lines...) Expand all
37 const char* EventHandlerRegistry::supplementName() 37 const char* EventHandlerRegistry::supplementName()
38 { 38 {
39 return "EventHandlerRegistry"; 39 return "EventHandlerRegistry";
40 } 40 }
41 41
42 EventHandlerRegistry* EventHandlerRegistry::from(Document& document) 42 EventHandlerRegistry* EventHandlerRegistry::from(Document& document)
43 { 43 {
44 EventHandlerRegistry* registry = static_cast<EventHandlerRegistry*>(Document Supplement::from(document, supplementName())); 44 EventHandlerRegistry* registry = static_cast<EventHandlerRegistry*>(Document Supplement::from(document, supplementName()));
45 if (!registry) { 45 if (!registry) {
46 registry = new EventHandlerRegistry(document); 46 registry = new EventHandlerRegistry(document);
47 DocumentSupplement::provideTo(document, supplementName(), adoptPtr(regis try)); 47 DocumentSupplement::provideTo(document, supplementName(), adoptPtrWillBe Noop(registry));
48 } 48 }
49 return registry; 49 return registry;
50 } 50 }
51 51
52 bool EventHandlerRegistry::eventTypeToClass(const AtomicString& eventType, Event HandlerClass* result) 52 bool EventHandlerRegistry::eventTypeToClass(const AtomicString& eventType, Event HandlerClass* result)
53 { 53 {
54 if (eventType == EventTypeNames::scroll) { 54 if (eventType == EventTypeNames::scroll) {
55 *result = ScrollEvent; 55 *result = ScrollEvent;
56 } else { 56 } else {
57 return false; 57 return false;
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 case ScrollEvent: 192 case ScrollEvent:
193 if (scrollingCoordinator) 193 if (scrollingCoordinator)
194 scrollingCoordinator->updateHaveScrollEventHandlers(); 194 scrollingCoordinator->updateHaveScrollEventHandlers();
195 break; 195 break;
196 default: 196 default:
197 ASSERT_NOT_REACHED(); 197 ASSERT_NOT_REACHED();
198 break; 198 break;
199 } 199 }
200 } 200 }
201 201
202 void EventHandlerRegistry::trace(Visitor* visitor)
203 {
204 visitor->registerWeakMembers<EventHandlerRegistry, &EventHandlerRegistry::cl earWeakMembers>(this);
205 }
206
202 void EventHandlerRegistry::clearWeakMembers(Visitor* visitor) 207 void EventHandlerRegistry::clearWeakMembers(Visitor* visitor)
203 { 208 {
209 // FIXME: Oilpan: This is pretty funky. The current code disables all modifi cations of the
210 // EventHandlerRegistry when the document becomes inactive. To keep that beh avior we only
211 // perform weak processing of the registry when the document is active.
212 if (!m_document.isActive())
213 return;
204 Vector<EventTarget*> deadNodeTargets; 214 Vector<EventTarget*> deadNodeTargets;
205 for (size_t i = 0; i < EventHandlerClassCount; ++i) { 215 for (size_t i = 0; i < EventHandlerClassCount; ++i) {
206 EventHandlerClass handlerClass = static_cast<EventHandlerClass>(i); 216 EventHandlerClass handlerClass = static_cast<EventHandlerClass>(i);
207 const EventTargetSet* targets = eventHandlerTargets(handlerClass); 217 const EventTargetSet* targets = eventHandlerTargets(handlerClass);
208 if (!targets) 218 if (!targets)
209 continue; 219 continue;
210 for (EventTargetSet::const_iterator it = targets->begin(); it != targets ->end(); ++it) { 220 for (EventTargetSet::const_iterator it = targets->begin(); it != targets ->end(); ++it) {
211 Node* node = it->key->toNode(); 221 Node* node = it->key->toNode();
212 if (node && !visitor->isAlive(node)) 222 if (node && !visitor->isAlive(node))
213 deadNodeTargets.append(node); 223 deadNodeTargets.append(node);
214 } 224 }
215 } 225 }
216 for (size_t i = 0; i < deadNodeTargets.size(); ++i) 226 for (size_t i = 0; i < deadNodeTargets.size(); ++i)
217 didRemoveAllEventHandlers(*deadNodeTargets[i]); 227 didRemoveAllEventHandlers(*deadNodeTargets[i]);
218 } 228 }
219 229
220 } // namespace WebCore 230 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/dom/EventHandlerRegistry.h ('k') | Source/core/dom/FullscreenElementStack.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698