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

Side by Side Diff: Source/core/html/HTMLFormElement.cpp

Issue 280123002: Oilpan: move LiveNodeList collections to the heap. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Have NodeRareData clear out NodeListsNodeData instead. 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
« no previous file with comments | « Source/core/html/HTMLFormElement.h ('k') | Source/core/html/HTMLInputElement.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 Apple Inc. All rights reserv ed. 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv ed.
6 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) 6 * (C) 2006 Alexey Proskuryakov (ap@nypop.com)
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after
534 } 534 }
535 535
536 void HTMLFormElement::didAssociateByParser() 536 void HTMLFormElement::didAssociateByParser()
537 { 537 {
538 if (!m_didFinishParsingChildren) 538 if (!m_didFinishParsingChildren)
539 return; 539 return;
540 m_hasElementsAssociatedByParser = true; 540 m_hasElementsAssociatedByParser = true;
541 UseCounter::count(document(), UseCounter::FormAssociationByParser); 541 UseCounter::count(document(), UseCounter::FormAssociationByParser);
542 } 542 }
543 543
544 PassRefPtr<HTMLCollection> HTMLFormElement::elements() 544 PassRefPtrWillBeRawPtr<HTMLCollection> HTMLFormElement::elements()
545 { 545 {
546 return ensureCachedHTMLCollection(FormControls); 546 return ensureCachedHTMLCollection(FormControls);
547 } 547 }
548 548
549 void HTMLFormElement::collectAssociatedElements(Node& root, FormAssociatedElemen t::List& elements) const 549 void HTMLFormElement::collectAssociatedElements(Node& root, FormAssociatedElemen t::List& elements) const
550 { 550 {
551 elements.clear(); 551 elements.clear();
552 for (HTMLElement* element = Traversal<HTMLElement>::firstWithin(root); eleme nt; element = Traversal<HTMLElement>::next(*element)) { 552 for (HTMLElement* element = Traversal<HTMLElement>::firstWithin(root); eleme nt; element = Traversal<HTMLElement>::next(*element)) {
553 FormAssociatedElement* associatedElement = 0; 553 FormAssociatedElement* associatedElement = 0;
554 if (element->isFormControlElement()) 554 if (element->isFormControlElement())
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
711 return; 711 return;
712 PastNamesMap::iterator end = m_pastNamesMap->end(); 712 PastNamesMap::iterator end = m_pastNamesMap->end();
713 for (PastNamesMap::iterator it = m_pastNamesMap->begin(); it != end; ++it) { 713 for (PastNamesMap::iterator it = m_pastNamesMap->begin(); it != end; ++it) {
714 if (it->value.get() == &element) { 714 if (it->value.get() == &element) {
715 it->value = nullptr; 715 it->value = nullptr;
716 // Keep looping. Single element can have multiple names. 716 // Keep looping. Single element can have multiple names.
717 } 717 }
718 } 718 }
719 } 719 }
720 720
721 void HTMLFormElement::getNamedElements(const AtomicString& name, Vector<RefPtr<E lement> >& namedItems) 721 void HTMLFormElement::getNamedElements(const AtomicString& name, WillBeHeapVecto r<RefPtrWillBeMember<Element> >& namedItems)
722 { 722 {
723 // http://www.whatwg.org/specs/web-apps/current-work/multipage/forms.html#do m-form-nameditem 723 // http://www.whatwg.org/specs/web-apps/current-work/multipage/forms.html#do m-form-nameditem
724 elements()->namedItems(name, namedItems); 724 elements()->namedItems(name, namedItems);
725 725
726 Element* elementFromPast = elementFromPastNamesMap(name); 726 Element* elementFromPast = elementFromPastNamesMap(name);
727 if (namedItems.size() && namedItems.first() != elementFromPast) { 727 if (namedItems.size() && namedItems.first() != elementFromPast) {
728 addToPastNamesMap(namedItems.first().get(), name); 728 addToPastNamesMap(namedItems.first().get(), name);
729 } else if (elementFromPast && namedItems.isEmpty()) { 729 } else if (elementFromPast && namedItems.isEmpty()) {
730 namedItems.append(elementFromPast); 730 namedItems.append(elementFromPast);
731 UseCounter::count(document(), UseCounter::FormNameAccessForPastNamesMap) ; 731 UseCounter::count(document(), UseCounter::FormNameAccessForPastNamesMap) ;
(...skipping 11 matching lines...) Expand all
743 document().formController().restoreControlStateIn(*this); 743 document().formController().restoreControlStateIn(*this);
744 m_didFinishParsingChildren = true; 744 m_didFinishParsingChildren = true;
745 } 745 }
746 746
747 void HTMLFormElement::copyNonAttributePropertiesFromElement(const Element& sourc e) 747 void HTMLFormElement::copyNonAttributePropertiesFromElement(const Element& sourc e)
748 { 748 {
749 m_wasDemoted = static_cast<const HTMLFormElement&>(source).m_wasDemoted; 749 m_wasDemoted = static_cast<const HTMLFormElement&>(source).m_wasDemoted;
750 HTMLElement::copyNonAttributePropertiesFromElement(source); 750 HTMLElement::copyNonAttributePropertiesFromElement(source);
751 } 751 }
752 752
753 void HTMLFormElement::anonymousNamedGetter(const AtomicString& name, bool& retur nValue0Enabled, RefPtr<RadioNodeList>& returnValue0, bool& returnValue1Enabled, RefPtr<Element>& returnValue1) 753 void HTMLFormElement::anonymousNamedGetter(const AtomicString& name, bool& retur nValue0Enabled, RefPtrWillBeRawPtr<RadioNodeList>& returnValue0, bool& returnVal ue1Enabled, RefPtr<Element>& returnValue1)
754 { 754 {
755 // Call getNamedElements twice, first time check if it has a value 755 // Call getNamedElements twice, first time check if it has a value
756 // and let HTMLFormElement update its cache. 756 // and let HTMLFormElement update its cache.
757 // See issue: 867404 757 // See issue: 867404
758 { 758 {
759 Vector<RefPtr<Element> > elements; 759 WillBeHeapVector<RefPtrWillBeMember<Element> > elements;
760 getNamedElements(name, elements); 760 getNamedElements(name, elements);
761 if (elements.isEmpty()) 761 if (elements.isEmpty())
762 return; 762 return;
763 } 763 }
764 764
765 // Second call may return different results from the first call, 765 // Second call may return different results from the first call,
766 // but if the first the size cannot be zero. 766 // but if the first the size cannot be zero.
767 Vector<RefPtr<Element> > elements; 767 WillBeHeapVector<RefPtrWillBeMember<Element> > elements;
768 getNamedElements(name, elements); 768 getNamedElements(name, elements);
769 ASSERT(!elements.isEmpty()); 769 ASSERT(!elements.isEmpty());
770 770
771 if (elements.size() == 1) { 771 if (elements.size() == 1) {
772 returnValue1Enabled = true; 772 returnValue1Enabled = true;
773 returnValue1 = elements.at(0); 773 // FIXME: Oilpan: remove the call to |get| when Element becomes [Garbage Collected].
774 returnValue1 = elements.at(0).get();
774 return; 775 return;
775 } 776 }
776 777
777 bool onlyMatchImg = !elements.isEmpty() && isHTMLImageElement(*elements.firs t()); 778 bool onlyMatchImg = !elements.isEmpty() && isHTMLImageElement(*elements.firs t());
778 returnValue0Enabled = true; 779 returnValue0Enabled = true;
779 returnValue0 = radioNodeList(name, onlyMatchImg); 780 returnValue0 = radioNodeList(name, onlyMatchImg);
780 } 781 }
781 782
782 void HTMLFormElement::setDemoted(bool demoted) 783 void HTMLFormElement::setDemoted(bool demoted)
783 { 784 {
784 if (demoted) 785 if (demoted)
785 UseCounter::count(document(), UseCounter::DemotedFormElement); 786 UseCounter::count(document(), UseCounter::DemotedFormElement);
786 m_wasDemoted = demoted; 787 m_wasDemoted = demoted;
787 } 788 }
788 789
789 } // namespace 790 } // namespace
OLDNEW
« no previous file with comments | « Source/core/html/HTMLFormElement.h ('k') | Source/core/html/HTMLInputElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698