OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * (C) 2001 Dirk Mueller (mueller@kde.org) | 4 * (C) 2001 Dirk Mueller (mueller@kde.org) |
5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved. | 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved. |
6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) | 6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) |
7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) | 7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) |
8 * | 8 * |
9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
10 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
272 RELEASE_ASSERT(!renderer()); | 272 RELEASE_ASSERT(!renderer()); |
273 | 273 |
274 if (!isContainerNode()) | 274 if (!isContainerNode()) |
275 willBeDeletedFromDocument(); | 275 willBeDeletedFromDocument(); |
276 | 276 |
277 if (m_previous) | 277 if (m_previous) |
278 m_previous->setNextSibling(0); | 278 m_previous->setNextSibling(0); |
279 if (m_next) | 279 if (m_next) |
280 m_next->setPreviousSibling(0); | 280 m_next->setPreviousSibling(0); |
281 | 281 |
282 #if !ENABLE(OILPAN) | |
282 if (m_treeScope) | 283 if (m_treeScope) |
283 m_treeScope->guardDeref(); | 284 m_treeScope->guardDeref(); |
285 #endif | |
284 | 286 |
285 InspectorCounters::decrementCounter(InspectorCounters::NodeCounter); | 287 InspectorCounters::decrementCounter(InspectorCounters::NodeCounter); |
286 | 288 |
287 if (getFlag(HasWeakReferences)) | 289 if (getFlag(HasWeakReferences)) |
288 WeakNodeMap::notifyNodeDestroyed(this); | 290 WeakNodeMap::notifyNodeDestroyed(this); |
289 } | 291 } |
290 | 292 |
291 void Node::willBeDeletedFromDocument() | 293 void Node::willBeDeletedFromDocument() |
292 { | 294 { |
295 #if !ENABLE(OILPAN) | |
293 if (!isTreeScopeInitialized()) | 296 if (!isTreeScopeInitialized()) |
294 return; | 297 return; |
295 | 298 |
296 Document& document = this->document(); | 299 Document& document = this->document(); |
297 | 300 |
298 if (hasEventTargetData()) { | 301 if (hasEventTargetData()) { |
299 clearEventTargetData(); | 302 clearEventTargetData(); |
300 document.didClearTouchEventHandlers(this); | 303 document.didClearTouchEventHandlers(this); |
301 EventHandlerRegistry::from(document)->didRemoveAllEventHandlers(*this); | 304 EventHandlerRegistry::from(document)->didRemoveAllEventHandlers(*this); |
haraken
2014/04/25 05:21:42
Who calls this in the oilpan build? Do we need to
Mads Ager (chromium)
2014/04/25 10:58:25
Urgh, good catch Haraken! I went through this and
| |
302 } | 305 } |
303 | 306 |
304 if (AXObjectCache* cache = document.existingAXObjectCache()) | 307 if (AXObjectCache* cache = document.existingAXObjectCache()) |
305 cache->remove(this); | 308 cache->remove(this); |
306 | 309 |
307 document.markers().removeMarkers(this); | 310 document.markers().removeMarkers(this); |
311 #endif | |
308 } | 312 } |
309 | 313 |
310 NodeRareData* Node::rareData() const | 314 NodeRareData* Node::rareData() const |
311 { | 315 { |
312 ASSERT_WITH_SECURITY_IMPLICATION(hasRareData()); | 316 ASSERT_WITH_SECURITY_IMPLICATION(hasRareData()); |
313 return static_cast<NodeRareData*>(m_data.m_rareData); | 317 return static_cast<NodeRareData*>(m_data.m_rareData); |
314 } | 318 } |
315 | 319 |
316 NodeRareData& Node::ensureRareData() | 320 NodeRareData& Node::ensureRareData() |
317 { | 321 { |
(...skipping 1704 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2022 | 2026 |
2023 void Node::removeAllEventListenersRecursively() | 2027 void Node::removeAllEventListenersRecursively() |
2024 { | 2028 { |
2025 for (Node* node = this; node; node = NodeTraversal::next(*node)) { | 2029 for (Node* node = this; node; node = NodeTraversal::next(*node)) { |
2026 node->removeAllEventListeners(); | 2030 node->removeAllEventListeners(); |
2027 for (ShadowRoot* root = node->youngestShadowRoot(); root; root = root->o lderShadowRoot()) | 2031 for (ShadowRoot* root = node->youngestShadowRoot(); root; root = root->o lderShadowRoot()) |
2028 root->removeAllEventListenersRecursively(); | 2032 root->removeAllEventListenersRecursively(); |
2029 } | 2033 } |
2030 } | 2034 } |
2031 | 2035 |
2032 typedef HashMap<Node*, OwnPtr<EventTargetData> > EventTargetDataMap; | 2036 typedef WillBeHeapHashMap<RawPtrWillBeWeakMember<Node>, OwnPtr<EventTargetData> > EventTargetDataMap; |
2033 | 2037 |
2034 static EventTargetDataMap& eventTargetDataMap() | 2038 static EventTargetDataMap& eventTargetDataMap() |
2035 { | 2039 { |
2040 #if ENABLE(OILPAN) | |
2041 DEFINE_STATIC_LOCAL(Persistent<EventTargetDataMap>, map, (new EventTargetDat aMap())); | |
2042 return *map; | |
2043 #else | |
2036 DEFINE_STATIC_LOCAL(EventTargetDataMap, map, ()); | 2044 DEFINE_STATIC_LOCAL(EventTargetDataMap, map, ()); |
2037 return map; | 2045 return map; |
2046 #endif | |
2038 } | 2047 } |
2039 | 2048 |
2040 EventTargetData* Node::eventTargetData() | 2049 EventTargetData* Node::eventTargetData() |
2041 { | 2050 { |
2042 return hasEventTargetData() ? eventTargetDataMap().get(this) : 0; | 2051 return hasEventTargetData() ? eventTargetDataMap().get(this) : 0; |
2043 } | 2052 } |
2044 | 2053 |
2045 EventTargetData& Node::ensureEventTargetData() | 2054 EventTargetData& Node::ensureEventTargetData() |
2046 { | 2055 { |
2047 if (hasEventTargetData()) | 2056 if (hasEventTargetData()) |
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2347 } | 2356 } |
2348 | 2357 |
2349 bool Node::willRespondToTouchEvents() | 2358 bool Node::willRespondToTouchEvents() |
2350 { | 2359 { |
2351 if (isDisabledFormControl(this)) | 2360 if (isDisabledFormControl(this)) |
2352 return false; | 2361 return false; |
2353 return hasEventListeners(EventTypeNames::touchstart) || hasEventListeners(Ev entTypeNames::touchmove) || hasEventListeners(EventTypeNames::touchcancel) || ha sEventListeners(EventTypeNames::touchend); | 2362 return hasEventListeners(EventTypeNames::touchstart) || hasEventListeners(Ev entTypeNames::touchmove) || hasEventListeners(EventTypeNames::touchcancel) || ha sEventListeners(EventTypeNames::touchend); |
2354 } | 2363 } |
2355 | 2364 |
2356 // This is here for inlining | 2365 // This is here for inlining |
2366 #if ENABLE(OILPAN) | |
2367 inline void TreeScope::removedLastRefToScope() | |
2368 { | |
2369 dispose(); | |
2370 } | |
2371 #else | |
2357 inline void TreeScope::removedLastRefToScope() | 2372 inline void TreeScope::removedLastRefToScope() |
2358 { | 2373 { |
2359 ASSERT_WITH_SECURITY_IMPLICATION(!deletionHasBegun()); | 2374 ASSERT_WITH_SECURITY_IMPLICATION(!deletionHasBegun()); |
2360 if (m_guardRefCount) { | 2375 if (m_guardRefCount) { |
2361 // If removing a child removes the last self-only ref, we don't | 2376 // If removing a child removes the last self-only ref, we don't |
2362 // want the scope to be destructed until after | 2377 // want the scope to be destructed until after |
2363 // removeDetachedChildren returns, so we guard ourselves with an | 2378 // removeDetachedChildren returns, so we guard ourselves with an |
2364 // extra self-only ref. | 2379 // extra self-only ref. |
2365 guardRef(); | 2380 guardRef(); |
2366 dispose(); | 2381 dispose(); |
2367 #if !ASSERT_DISABLED | 2382 #if !ASSERT_DISABLED |
2368 // We need to do this right now since guardDeref() can delete this. | 2383 // We need to do this right now since guardDeref() can delete this. |
2369 rootNode().m_inRemovedLastRefFunction = false; | 2384 rootNode().m_inRemovedLastRefFunction = false; |
2370 #endif | 2385 #endif |
2371 guardDeref(); | 2386 guardDeref(); |
2372 } else { | 2387 } else { |
2373 #if !ASSERT_DISABLED | 2388 #if !ASSERT_DISABLED |
2374 rootNode().m_inRemovedLastRefFunction = false; | 2389 rootNode().m_inRemovedLastRefFunction = false; |
2375 #endif | 2390 #endif |
2376 #if !ENABLE(OILPAN) | |
2377 #if SECURITY_ASSERT_ENABLED | 2391 #if SECURITY_ASSERT_ENABLED |
2378 beginDeletion(); | 2392 beginDeletion(); |
2379 #endif | 2393 #endif |
2380 delete this; | 2394 delete this; |
2381 #endif | |
2382 } | 2395 } |
2383 } | 2396 } |
2397 #endif | |
2384 | 2398 |
2385 // It's important not to inline removedLastRef, because we don't want to inline the code to | 2399 // It's important not to inline removedLastRef, because we don't want to inline the code to |
2386 // delete a Node at each deref call site. | 2400 // delete a Node at each deref call site. |
2387 void Node::removedLastRef() | 2401 void Node::removedLastRef() |
2388 { | 2402 { |
2389 // An explicit check for Document here is better than a virtual function sin ce it is | 2403 // An explicit check for Document here is better than a virtual function sin ce it is |
2390 // faster for non-Document nodes, and because the call to removedLastRef tha t is inlined | 2404 // faster for non-Document nodes, and because the call to removedLastRef tha t is inlined |
2391 // at all deref call sites is smaller if it's a non-virtual function. | 2405 // at all deref call sites is smaller if it's a non-virtual function. |
2392 if (isTreeScope()) { | 2406 if (isTreeScope()) { |
2393 treeScope().removedLastRefToScope(); | 2407 treeScope().removedLastRefToScope(); |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2535 } | 2549 } |
2536 | 2550 |
2537 ASSERT(isHTMLElement() || isSVGElement()); | 2551 ASSERT(isHTMLElement() || isSVGElement()); |
2538 setFlag(CustomElement); | 2552 setFlag(CustomElement); |
2539 setFlag(newState == Upgraded, CustomElementUpgraded); | 2553 setFlag(newState == Upgraded, CustomElementUpgraded); |
2540 | 2554 |
2541 if (oldState == NotCustomElement || newState == Upgraded) | 2555 if (oldState == NotCustomElement || newState == Upgraded) |
2542 setNeedsStyleRecalc(SubtreeStyleChange); // :unresolved has changed | 2556 setNeedsStyleRecalc(SubtreeStyleChange); // :unresolved has changed |
2543 } | 2557 } |
2544 | 2558 |
2559 void Node::trace(Visitor* visitor) | |
2560 { | |
2561 visitor->trace(m_treeScope); | |
2562 } | |
2563 | |
2545 } // namespace WebCore | 2564 } // namespace WebCore |
2546 | 2565 |
2547 #ifndef NDEBUG | 2566 #ifndef NDEBUG |
2548 | 2567 |
2549 void showNode(const WebCore::Node* node) | 2568 void showNode(const WebCore::Node* node) |
2550 { | 2569 { |
2551 if (node) | 2570 if (node) |
2552 node->showNode(""); | 2571 node->showNode(""); |
2553 } | 2572 } |
2554 | 2573 |
2555 void showTree(const WebCore::Node* node) | 2574 void showTree(const WebCore::Node* node) |
2556 { | 2575 { |
2557 if (node) | 2576 if (node) |
2558 node->showTreeForThis(); | 2577 node->showTreeForThis(); |
2559 } | 2578 } |
2560 | 2579 |
2561 void showNodePath(const WebCore::Node* node) | 2580 void showNodePath(const WebCore::Node* node) |
2562 { | 2581 { |
2563 if (node) | 2582 if (node) |
2564 node->showNodePathForThis(); | 2583 node->showNodePathForThis(); |
2565 } | 2584 } |
2566 | 2585 |
2567 #endif | 2586 #endif |
OLD | NEW |