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

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

Issue 319453002: [oilpan]: get rid of some trivial RefPtr's to node. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 6 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/ContainerNode.cpp ('k') | Source/core/inspector/DOMPatchSupport.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 490 matching lines...) Expand 10 before | Expand all | Expand 10 after
501 { 501 {
502 if (ContainerNode* parent = parentNode()) 502 if (ContainerNode* parent = parentNode())
503 parent->removeChild(this, exceptionState); 503 parent->removeChild(this, exceptionState);
504 } 504 }
505 505
506 void Node::normalize() 506 void Node::normalize()
507 { 507 {
508 // Go through the subtree beneath us, normalizing all nodes. This means that 508 // Go through the subtree beneath us, normalizing all nodes. This means that
509 // any two adjacent text nodes are merged and any empty text nodes are remov ed. 509 // any two adjacent text nodes are merged and any empty text nodes are remov ed.
510 510
511 RefPtr<Node> node = this; 511 RefPtrWillBeRawPtr<Node> node = this;
512 while (Node* firstChild = node->firstChild()) 512 while (Node* firstChild = node->firstChild())
513 node = firstChild; 513 node = firstChild;
514 while (node) { 514 while (node) {
515 if (node->isElementNode()) 515 if (node->isElementNode())
516 toElement(node)->normalizeAttributes(); 516 toElement(node)->normalizeAttributes();
517 517
518 if (node == this) 518 if (node == this)
519 break; 519 break;
520 520
521 if (node->nodeType() == TEXT_NODE) 521 if (node->nodeType() == TEXT_NODE)
(...skipping 990 matching lines...) Expand 10 before | Expand all | Expand 10 after
1512 case TEXT_NODE: 1512 case TEXT_NODE:
1513 case CDATA_SECTION_NODE: 1513 case CDATA_SECTION_NODE:
1514 case COMMENT_NODE: 1514 case COMMENT_NODE:
1515 case PROCESSING_INSTRUCTION_NODE: 1515 case PROCESSING_INSTRUCTION_NODE:
1516 setNodeValue(text); 1516 setNodeValue(text);
1517 return; 1517 return;
1518 case ELEMENT_NODE: 1518 case ELEMENT_NODE:
1519 case ATTRIBUTE_NODE: 1519 case ATTRIBUTE_NODE:
1520 case DOCUMENT_FRAGMENT_NODE: { 1520 case DOCUMENT_FRAGMENT_NODE: {
1521 // FIXME: Merge this logic into replaceChildrenWithText. 1521 // FIXME: Merge this logic into replaceChildrenWithText.
1522 RefPtr<ContainerNode> container = toContainerNode(this); 1522 RefPtrWillBeRawPtr<ContainerNode> container = toContainerNode(this);
1523 // No need to do anything if the text is identical. 1523 // No need to do anything if the text is identical.
1524 if (container->hasOneTextChild() && toText(container->firstChild())- >data() == text) 1524 if (container->hasOneTextChild() && toText(container->firstChild())- >data() == text)
1525 return; 1525 return;
1526 ChildListMutationScope mutation(*this); 1526 ChildListMutationScope mutation(*this);
1527 container->removeChildren(); 1527 container->removeChildren();
1528 // Note: This API will not insert empty text nodes: 1528 // Note: This API will not insert empty text nodes:
1529 // http://dom.spec.whatwg.org/#dom-node-textcontent 1529 // http://dom.spec.whatwg.org/#dom-node-textcontent
1530 if (!text.isEmpty()) 1530 if (!text.isEmpty())
1531 container->appendChild(document().createTextNode(text), ASSERT_N O_EXCEPTION); 1531 container->appendChild(document().createTextNode(text), ASSERT_N O_EXCEPTION);
1532 return; 1532 return;
(...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after
2158 return; 2158 return;
2159 2159
2160 size_t index = registry->find(registration); 2160 size_t index = registry->find(registration);
2161 ASSERT(index != kNotFound); 2161 ASSERT(index != kNotFound);
2162 if (index == kNotFound) 2162 if (index == kNotFound)
2163 return; 2163 return;
2164 2164
2165 // Deleting the registration may cause this node to be derefed, so we must m ake sure the Vector operation completes 2165 // Deleting the registration may cause this node to be derefed, so we must m ake sure the Vector operation completes
2166 // before that, in case |this| is destroyed (see MutationObserverRegistratio n::m_registrationNodeKeepAlive). 2166 // before that, in case |this| is destroyed (see MutationObserverRegistratio n::m_registrationNodeKeepAlive).
2167 // FIXME: Simplify the registration/transient registration logic to make thi s understandable by humans. 2167 // FIXME: Simplify the registration/transient registration logic to make thi s understandable by humans.
2168 RefPtr<Node> protect(this); 2168 RefPtrWillBeRawPtr<Node> protect(this);
2169 #if ENABLE(OILPAN) 2169 #if ENABLE(OILPAN)
2170 // The explicit dispose() is needed to have the registration 2170 // The explicit dispose() is needed to have the registration
2171 // object unregister itself promptly. 2171 // object unregister itself promptly.
2172 registration->dispose(); 2172 registration->dispose();
2173 #endif 2173 #endif
2174 registry->remove(index); 2174 registry->remove(index);
2175 } 2175 }
2176 2176
2177 void Node::registerTransientMutationObserver(MutationObserverRegistration* regis tration) 2177 void Node::registerTransientMutationObserver(MutationObserverRegistration* regis tration)
2178 { 2178 {
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after
2596 node->showTreeForThis(); 2596 node->showTreeForThis();
2597 } 2597 }
2598 2598
2599 void showNodePath(const WebCore::Node* node) 2599 void showNodePath(const WebCore::Node* node)
2600 { 2600 {
2601 if (node) 2601 if (node)
2602 node->showNodePathForThis(); 2602 node->showNodePathForThis();
2603 } 2603 }
2604 2604
2605 #endif 2605 #endif
OLDNEW
« no previous file with comments | « Source/core/dom/ContainerNode.cpp ('k') | Source/core/inspector/DOMPatchSupport.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698