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

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

Issue 262093006: Oilpan: Make the Node hierarchy RefCountedGarbageCollected instead of TreeShared. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 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
OLDNEW
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 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 #endif 267 #endif
268 268
269 if (hasRareData()) 269 if (hasRareData())
270 clearRareData(); 270 clearRareData();
271 271
272 RELEASE_ASSERT(!renderer()); 272 RELEASE_ASSERT(!renderer());
273 273
274 #if !ENABLE(OILPAN) 274 #if !ENABLE(OILPAN)
275 if (!isContainerNode()) 275 if (!isContainerNode())
276 willBeDeletedFromDocument(); 276 willBeDeletedFromDocument();
277 #endif
278 277
279 if (m_previous) 278 if (m_previous)
280 m_previous->setNextSibling(0); 279 m_previous->setNextSibling(0);
281 if (m_next) 280 if (m_next)
282 m_next->setPreviousSibling(0); 281 m_next->setPreviousSibling(0);
283 282
284 #if !ENABLE(OILPAN)
285 if (m_treeScope) 283 if (m_treeScope)
286 m_treeScope->guardDeref(); 284 m_treeScope->guardDeref();
287 #endif 285 #endif
288 286
289 InspectorCounters::decrementCounter(InspectorCounters::NodeCounter); 287 InspectorCounters::decrementCounter(InspectorCounters::NodeCounter);
290 288
291 if (getFlag(HasWeakReferencesFlag)) 289 if (getFlag(HasWeakReferencesFlag))
292 WeakNodeMap::notifyNodeDestroyed(this); 290 WeakNodeMap::notifyNodeDestroyed(this);
293 } 291 }
294 292
(...skipping 2073 matching lines...) Expand 10 before | Expand all | Expand 10 after
2368 return isContentEditable(UserSelectAllIsAlwaysNonEditable) || hasEventListen ers(EventTypeNames::mouseup) || hasEventListeners(EventTypeNames::mousedown) || hasEventListeners(EventTypeNames::click) || hasEventListeners(EventTypeNames::DO MActivate); 2366 return isContentEditable(UserSelectAllIsAlwaysNonEditable) || hasEventListen ers(EventTypeNames::mouseup) || hasEventListeners(EventTypeNames::mousedown) || hasEventListeners(EventTypeNames::click) || hasEventListeners(EventTypeNames::DO MActivate);
2369 } 2367 }
2370 2368
2371 bool Node::willRespondToTouchEvents() 2369 bool Node::willRespondToTouchEvents()
2372 { 2370 {
2373 if (isDisabledFormControl(this)) 2371 if (isDisabledFormControl(this))
2374 return false; 2372 return false;
2375 return hasEventListeners(EventTypeNames::touchstart) || hasEventListeners(Ev entTypeNames::touchmove) || hasEventListeners(EventTypeNames::touchcancel) || ha sEventListeners(EventTypeNames::touchend); 2373 return hasEventListeners(EventTypeNames::touchstart) || hasEventListeners(Ev entTypeNames::touchmove) || hasEventListeners(EventTypeNames::touchcancel) || ha sEventListeners(EventTypeNames::touchend);
2376 } 2374 }
2377 2375
2376 #if !ENABLE(OILPAN)
2378 // This is here for inlining 2377 // This is here for inlining
2379 #if ENABLE(OILPAN)
2380 inline void TreeScope::removedLastRefToScope()
2381 {
2382 dispose();
2383 }
2384 #else
2385 inline void TreeScope::removedLastRefToScope() 2378 inline void TreeScope::removedLastRefToScope()
2386 { 2379 {
2387 ASSERT_WITH_SECURITY_IMPLICATION(!deletionHasBegun()); 2380 ASSERT_WITH_SECURITY_IMPLICATION(!deletionHasBegun());
2388 if (m_guardRefCount) { 2381 if (m_guardRefCount) {
2389 // If removing a child removes the last self-only ref, we don't 2382 // If removing a child removes the last self-only ref, we don't
2390 // want the scope to be destructed until after 2383 // want the scope to be destructed until after
2391 // removeDetachedChildren returns, so we guard ourselves with an 2384 // removeDetachedChildren returns, so we guard ourselves with an
2392 // extra self-only ref. 2385 // extra self-only ref.
2393 guardRef(); 2386 guardRef();
2394 dispose(); 2387 dispose();
2395 #if !ASSERT_DISABLED 2388 #if !ASSERT_DISABLED
2396 // We need to do this right now since guardDeref() can delete this. 2389 // We need to do this right now since guardDeref() can delete this.
2397 rootNode().m_inRemovedLastRefFunction = false; 2390 rootNode().m_inRemovedLastRefFunction = false;
2398 #endif 2391 #endif
2399 guardDeref(); 2392 guardDeref();
2400 } else { 2393 } else {
2401 #if !ASSERT_DISABLED 2394 #if !ASSERT_DISABLED
2402 rootNode().m_inRemovedLastRefFunction = false; 2395 rootNode().m_inRemovedLastRefFunction = false;
2403 #endif 2396 #endif
2404 #if SECURITY_ASSERT_ENABLED 2397 #if SECURITY_ASSERT_ENABLED
2405 beginDeletion(); 2398 beginDeletion();
2406 #endif 2399 #endif
2407 delete this; 2400 delete this;
2408 } 2401 }
2409 } 2402 }
2410 #endif 2403 #endif
2411 2404
2405 #if !ENABLE(OILPAN)
2412 // It's important not to inline removedLastRef, because we don't want to inline the code to 2406 // It's important not to inline removedLastRef, because we don't want to inline the code to
2413 // delete a Node at each deref call site. 2407 // delete a Node at each deref call site.
2414 void Node::removedLastRef() 2408 void Node::removedLastRef()
2415 { 2409 {
2416 // An explicit check for Document here is better than a virtual function sin ce it is 2410 // An explicit check for Document here is better than a virtual function sin ce it is
2417 // faster for non-Document nodes, and because the call to removedLastRef tha t is inlined 2411 // faster for non-Document nodes, and because the call to removedLastRef tha t is inlined
2418 // at all deref call sites is smaller if it's a non-virtual function. 2412 // at all deref call sites is smaller if it's a non-virtual function.
2419 if (isTreeScope()) { 2413 if (isTreeScope()) {
2420 treeScope().removedLastRefToScope(); 2414 treeScope().removedLastRefToScope();
2421 return; 2415 return;
2422 } 2416 }
2423 2417
2424 #if !ENABLE(OILPAN)
2425 #if SECURITY_ASSERT_ENABLED 2418 #if SECURITY_ASSERT_ENABLED
2426 m_deletionHasBegun = true; 2419 m_deletionHasBegun = true;
2427 #endif 2420 #endif
2428 delete this; 2421 delete this;
2422 }
2429 #endif 2423 #endif
2430 }
2431 2424
2432 unsigned Node::connectedSubframeCount() const 2425 unsigned Node::connectedSubframeCount() const
2433 { 2426 {
2434 return hasRareData() ? rareData()->connectedSubframeCount() : 0; 2427 return hasRareData() ? rareData()->connectedSubframeCount() : 0;
2435 } 2428 }
2436 2429
2437 void Node::incrementConnectedSubframeCount(unsigned amount) 2430 void Node::incrementConnectedSubframeCount(unsigned amount)
2438 { 2431 {
2439 ASSERT(isContainerNode()); 2432 ASSERT(isContainerNode());
2440 ensureRareData().incrementConnectedSubframeCount(amount); 2433 ensureRareData().incrementConnectedSubframeCount(amount);
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
2564 ASSERT(isHTMLElement() || isSVGElement()); 2557 ASSERT(isHTMLElement() || isSVGElement());
2565 setFlag(CustomElementFlag); 2558 setFlag(CustomElementFlag);
2566 setFlag(newState == Upgraded, CustomElementUpgradedFlag); 2559 setFlag(newState == Upgraded, CustomElementUpgradedFlag);
2567 2560
2568 if (oldState == NotCustomElement || newState == Upgraded) 2561 if (oldState == NotCustomElement || newState == Upgraded)
2569 setNeedsStyleRecalc(SubtreeStyleChange); // :unresolved has changed 2562 setNeedsStyleRecalc(SubtreeStyleChange); // :unresolved has changed
2570 } 2563 }
2571 2564
2572 void Node::trace(Visitor* visitor) 2565 void Node::trace(Visitor* visitor)
2573 { 2566 {
2567 visitor->trace(m_parentOrShadowHostNode);
2568 visitor->trace(m_previous);
2569 visitor->trace(m_next);
2574 visitor->trace(m_treeScope); 2570 visitor->trace(m_treeScope);
2575 } 2571 }
2576 2572
2577 } // namespace WebCore 2573 } // namespace WebCore
2578 2574
2579 #ifndef NDEBUG 2575 #ifndef NDEBUG
2580 2576
2581 void showNode(const WebCore::Node* node) 2577 void showNode(const WebCore::Node* node)
2582 { 2578 {
2583 if (node) 2579 if (node)
2584 node->showNode(""); 2580 node->showNode("");
2585 } 2581 }
2586 2582
2587 void showTree(const WebCore::Node* node) 2583 void showTree(const WebCore::Node* node)
2588 { 2584 {
2589 if (node) 2585 if (node)
2590 node->showTreeForThis(); 2586 node->showTreeForThis();
2591 } 2587 }
2592 2588
2593 void showNodePath(const WebCore::Node* node) 2589 void showNodePath(const WebCore::Node* node)
2594 { 2590 {
2595 if (node) 2591 if (node)
2596 node->showNodePathForThis(); 2592 node->showNodePathForThis();
2597 } 2593 }
2598 2594
2599 #endif 2595 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698