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

Side by Side Diff: Source/core/inspector/DOMPatchSupport.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/Node.cpp ('k') | no next file » | 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) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 if (newMap[i].first || merges.contains(newList[i].get())) 383 if (newMap[i].first || merges.contains(newList[i].get()))
384 continue; 384 continue;
385 if (!insertBeforeAndMarkAsUsed(parentNode, newList[i].get(), parentNode- >traverseToChildAt(i), exceptionState)) 385 if (!insertBeforeAndMarkAsUsed(parentNode, newList[i].get(), parentNode- >traverseToChildAt(i), exceptionState))
386 return false; 386 return false;
387 } 387 }
388 388
389 // 4. Then put all nodes that retained into their slots (sort by new index). 389 // 4. Then put all nodes that retained into their slots (sort by new index).
390 for (size_t i = 0; i < oldMap.size(); ++i) { 390 for (size_t i = 0; i < oldMap.size(); ++i) {
391 if (!oldMap[i].first) 391 if (!oldMap[i].first)
392 continue; 392 continue;
393 RefPtr<Node> node = oldMap[i].first->m_node; 393 RefPtrWillBeRawPtr<Node> node = oldMap[i].first->m_node;
394 Node* anchorNode = parentNode->traverseToChildAt(oldMap[i].second); 394 Node* anchorNode = parentNode->traverseToChildAt(oldMap[i].second);
395 if (node == anchorNode) 395 if (node == anchorNode)
396 continue; 396 continue;
397 if (isHTMLBodyElement(*node) || isHTMLHeadElement(*node)) 397 if (isHTMLBodyElement(*node) || isHTMLHeadElement(*node))
398 continue; // Never move head or body, move the rest of the nodes aro und them. 398 continue; // Never move head or body, move the rest of the nodes aro und them.
399 399
400 if (!m_domEditor->insertBefore(parentNode, node.release(), anchorNode, e xceptionState)) 400 if (!m_domEditor->insertBefore(parentNode, node.release(), anchorNode, e xceptionState))
401 return false; 401 return false;
402 } 402 }
403 return true; 403 return true;
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
454 454
455 bool DOMPatchSupport::insertBeforeAndMarkAsUsed(ContainerNode* parentNode, Diges t* digest, Node* anchor, ExceptionState& exceptionState) 455 bool DOMPatchSupport::insertBeforeAndMarkAsUsed(ContainerNode* parentNode, Diges t* digest, Node* anchor, ExceptionState& exceptionState)
456 { 456 {
457 bool result = m_domEditor->insertBefore(parentNode, digest->m_node, anchor, exceptionState); 457 bool result = m_domEditor->insertBefore(parentNode, digest->m_node, anchor, exceptionState);
458 markNodeAsUsed(digest); 458 markNodeAsUsed(digest);
459 return result; 459 return result;
460 } 460 }
461 461
462 bool DOMPatchSupport::removeChildAndMoveToNew(Digest* oldDigest, ExceptionState& exceptionState) 462 bool DOMPatchSupport::removeChildAndMoveToNew(Digest* oldDigest, ExceptionState& exceptionState)
463 { 463 {
464 RefPtr<Node> oldNode = oldDigest->m_node; 464 RefPtrWillBeRawPtr<Node> oldNode = oldDigest->m_node;
465 if (!m_domEditor->removeChild(oldNode->parentNode(), oldNode.get(), exceptio nState)) 465 if (!m_domEditor->removeChild(oldNode->parentNode(), oldNode.get(), exceptio nState))
466 return false; 466 return false;
467 467
468 // Diff works within levels. In order not to lose the node identity when use r 468 // Diff works within levels. In order not to lose the node identity when use r
469 // prepends his HTML with "<div>" (i.e. all nodes are shifted to the next ne sted level), 469 // prepends his HTML with "<div>" (i.e. all nodes are shifted to the next ne sted level),
470 // prior to dropping the original node on the floor, check whether new DOM h as a digest 470 // prior to dropping the original node on the floor, check whether new DOM h as a digest
471 // with matching sha1. If it does, replace it with the original DOM chunk. C hances are 471 // with matching sha1. If it does, replace it with the original DOM chunk. C hances are
472 // high that it will get merged back into the original DOM during the furthe r patching. 472 // high that it will get merged back into the original DOM during the furthe r patching.
473 UnusedNodesMap::iterator it = m_unusedNodesMap.find(oldDigest->m_sha1); 473 UnusedNodesMap::iterator it = m_unusedNodesMap.find(oldDigest->m_sha1);
474 if (it != m_unusedNodesMap.end()) { 474 if (it != m_unusedNodesMap.end()) {
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
511 void DOMPatchSupport::dumpMap(const ResultMap& map, const String& name) 511 void DOMPatchSupport::dumpMap(const ResultMap& map, const String& name)
512 { 512 {
513 fprintf(stderr, "\n\n"); 513 fprintf(stderr, "\n\n");
514 for (size_t i = 0; i < map.size(); ++i) 514 for (size_t i = 0; i < map.size(); ++i)
515 fprintf(stderr, "%s[%lu]: %s (%p) - [%lu]\n", name.utf8().data(), i, map [i].first ? nodeName(map[i].first->m_node).utf8().data() : "", map[i].first, map [i].second); 515 fprintf(stderr, "%s[%lu]: %s (%p) - [%lu]\n", name.utf8().data(), i, map [i].first ? nodeName(map[i].first->m_node).utf8().data() : "", map[i].first, map [i].second);
516 } 516 }
517 #endif 517 #endif
518 518
519 } // namespace WebCore 519 } // namespace WebCore
520 520
OLDNEW
« no previous file with comments | « Source/core/dom/Node.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698