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

Side by Side Diff: Source/web/WebDocument.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/testing/Internals.cpp ('k') | Source/web/WebElementCollection.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) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 return WebString(constUnwrap<Document>()->title()); 152 return WebString(constUnwrap<Document>()->title());
153 } 153 }
154 154
155 WebElementCollection WebDocument::all() 155 WebElementCollection WebDocument::all()
156 { 156 {
157 return WebElementCollection(unwrap<Document>()->all()); 157 return WebElementCollection(unwrap<Document>()->all());
158 } 158 }
159 159
160 void WebDocument::images(WebVector<WebElement>& results) 160 void WebDocument::images(WebVector<WebElement>& results)
161 { 161 {
162 RefPtr<HTMLCollection> images = unwrap<Document>()->images(); 162 RefPtrWillBeRawPtr<HTMLCollection> images = unwrap<Document>()->images();
163 size_t sourceLength = images->length(); 163 size_t sourceLength = images->length();
164 Vector<WebElement> temp; 164 Vector<WebElement> temp;
165 temp.reserveCapacity(sourceLength); 165 temp.reserveCapacity(sourceLength);
166 for (size_t i = 0; i < sourceLength; ++i) { 166 for (size_t i = 0; i < sourceLength; ++i) {
167 Element* element = images->item(i); 167 Element* element = images->item(i);
168 if (element && element->isHTMLElement()) 168 if (element && element->isHTMLElement())
169 temp.append(WebElement(element)); 169 temp.append(WebElement(element));
170 } 170 }
171 results.assign(temp); 171 results.assign(temp);
172 } 172 }
173 173
174 void WebDocument::forms(WebVector<WebFormElement>& results) const 174 void WebDocument::forms(WebVector<WebFormElement>& results) const
175 { 175 {
176 RefPtr<HTMLCollection> forms = const_cast<Document*>(constUnwrap<Document>() )->forms(); 176 RefPtrWillBeRawPtr<HTMLCollection> forms = const_cast<Document*>(constUnwrap <Document>())->forms();
177 size_t sourceLength = forms->length(); 177 size_t sourceLength = forms->length();
178 Vector<WebFormElement> temp; 178 Vector<WebFormElement> temp;
179 temp.reserveCapacity(sourceLength); 179 temp.reserveCapacity(sourceLength);
180 for (size_t i = 0; i < sourceLength; ++i) { 180 for (size_t i = 0; i < sourceLength; ++i) {
181 Element* element = forms->item(i); 181 Element* element = forms->item(i);
182 // Strange but true, sometimes node can be 0. 182 // Strange but true, sometimes node can be 0.
183 if (element && element->isHTMLElement()) 183 if (element && element->isHTMLElement())
184 temp.append(WebFormElement(toHTMLFormElement(element))); 184 temp.append(WebFormElement(toHTMLFormElement(element)));
185 } 185 }
186 results.assign(temp); 186 results.assign(temp);
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 m_private = elem; 311 m_private = elem;
312 return *this; 312 return *this;
313 } 313 }
314 314
315 WebDocument::operator PassRefPtrWillBeRawPtr<Document>() const 315 WebDocument::operator PassRefPtrWillBeRawPtr<Document>() const
316 { 316 {
317 return toDocument(m_private.get()); 317 return toDocument(m_private.get());
318 } 318 }
319 319
320 } // namespace blink 320 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/testing/Internals.cpp ('k') | Source/web/WebElementCollection.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698