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

Side by Side Diff: Source/web/tests/TouchActionTest.cpp

Issue 280123002: Oilpan: move LiveNodeList collections to the heap. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Pre-emptively GC a long runnning test 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 } 140 }
141 141
142 void TouchActionTest::runShadowDOMTest(std::string file) 142 void TouchActionTest::runShadowDOMTest(std::string file)
143 { 143 {
144 TouchActionTrackingWebViewClient client; 144 TouchActionTrackingWebViewClient client;
145 145
146 WebView* webView = setupTest(file, client); 146 WebView* webView = setupTest(file, client);
147 147
148 WebCore::TrackExceptionState es; 148 WebCore::TrackExceptionState es;
149 RefPtrWillBeRawPtr<WebCore::Document> document = static_cast<PassRefPtrWillB eRawPtr<WebCore::Document> >(webView->mainFrame()->document()); 149 RefPtrWillBeRawPtr<WebCore::Document> document = static_cast<PassRefPtrWillB eRawPtr<WebCore::Document> >(webView->mainFrame()->document());
150 RefPtr<WebCore::NodeList> hostNodes = document->querySelectorAll("[shadow-ho st]", es); 150 RefPtrWillBeRawPtr<WebCore::NodeList> hostNodes = document->querySelectorAll ("[shadow-host]", es);
151 ASSERT_FALSE(es.hadException()); 151 ASSERT_FALSE(es.hadException());
152 ASSERT_GE(hostNodes->length(), 1u); 152 ASSERT_GE(hostNodes->length(), 1u);
153 153
154 for (unsigned index = 0; index < hostNodes->length(); index++) { 154 for (unsigned index = 0; index < hostNodes->length(); index++) {
155 WebCore::ShadowRoot* shadowRoot = WebCore::toElement(hostNodes->item(ind ex))->shadowRoot(); 155 WebCore::ShadowRoot* shadowRoot = WebCore::toElement(hostNodes->item(ind ex))->shadowRoot();
156 runTestOnTree(shadowRoot, webView, client); 156 runTestOnTree(shadowRoot, webView, client);
157 } 157 }
158 158
159 // Projections show up in the main document. 159 // Projections show up in the main document.
160 runTestOnTree(document.get(), webView, client); 160 runTestOnTree(document.get(), webView, client);
(...skipping 15 matching lines...) Expand all
176 RefPtrWillBeRawPtr<WebCore::Document> document = static_cast<PassRefPtrWillB eRawPtr<WebCore::Document> >(webView->mainFrame()->document()); 176 RefPtrWillBeRawPtr<WebCore::Document> document = static_cast<PassRefPtrWillB eRawPtr<WebCore::Document> >(webView->mainFrame()->document());
177 document->frame()->view()->setScrollOffset(WebCore::IntPoint(0, kScrollOffse t)); 177 document->frame()->view()->setScrollOffset(WebCore::IntPoint(0, kScrollOffse t));
178 178
179 return webView; 179 return webView;
180 } 180 }
181 181
182 void TouchActionTest::runTestOnTree(WebCore::ContainerNode* root, WebView* webVi ew, TouchActionTrackingWebViewClient& client) 182 void TouchActionTest::runTestOnTree(WebCore::ContainerNode* root, WebView* webVi ew, TouchActionTrackingWebViewClient& client)
183 { 183 {
184 // Find all elements to test the touch-action of in the document. 184 // Find all elements to test the touch-action of in the document.
185 WebCore::TrackExceptionState es; 185 WebCore::TrackExceptionState es;
186 RefPtr<WebCore::NodeList> nodes = root->querySelectorAll("[expected-action]" , es); 186 RefPtrWillBeRawPtr<WebCore::NodeList> nodes = root->querySelectorAll("[expec ted-action]", es);
187 ASSERT_FALSE(es.hadException()); 187 ASSERT_FALSE(es.hadException());
188 188
189 for (unsigned index = 0; index < nodes->length(); index++) { 189 for (unsigned index = 0; index < nodes->length(); index++) {
190 // FIXME: Oilpan: long-running test that allocates; if the PendingGCRunn er task
191 // is run, it GCs assuming no pointers on the stack. But there is.
192 WebCore::Heap::collectGarbage(WebCore::ThreadState::HeapPointersOnStack) ;
haraken 2014/05/12 12:04:13 Would you elaborate on this? - Why can PendingGCR
sof 2014/05/12 12:24:36 The parser thread creates a pending GC runner. I d
haraken 2014/05/12 12:36:55 hmm, your current solution looks a bit fragile. Ev
sof 2014/05/12 12:52:46 Indeed so; I'm not proposing this as the final sol
sof 2014/05/15 09:23:24 Tried to make the FIXME comment clearer; i.e., tes
Mads Ager (chromium) 2014/05/15 10:54:24 The PendingGCRunner should only run when we are ba
sof 2014/05/15 11:39:41 A nested message loop, it seems. The PendingGCRunn
193
190 WebCore::Element* element = toElement(nodes->item(index)); 194 WebCore::Element* element = toElement(nodes->item(index));
191 element->scrollIntoViewIfNeeded(); 195 element->scrollIntoViewIfNeeded();
192 ASSERT_TRUE(nodes->item(index)->isElementNode()); 196 ASSERT_TRUE(nodes->item(index)->isElementNode());
193 197
194 std::string failureContext("Test case: "); 198 std::string failureContext("Test case: ");
195 if (element->hasID()) { 199 if (element->hasID()) {
196 failureContext.append(element->getIdAttribute().ascii().data()); 200 failureContext.append(element->getIdAttribute().ascii().data());
197 } else if (element->firstChild()) { 201 } else if (element->firstChild()) {
198 failureContext.append("\""); 202 failureContext.append("\"");
199 failureContext.append(element->firstChild()->textContent(false).stri pWhiteSpace().ascii().data()); 203 failureContext.append(element->firstChild()->textContent(false).stri pWhiteSpace().ascii().data());
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 { 330 {
327 runShadowDOMTest("touch-action-shadow-dom.html"); 331 runShadowDOMTest("touch-action-shadow-dom.html");
328 } 332 }
329 333
330 TEST_F(TouchActionTest, Pan) 334 TEST_F(TouchActionTest, Pan)
331 { 335 {
332 runTouchActionTest("touch-action-pan.html"); 336 runTouchActionTest("touch-action-pan.html");
333 } 337 }
334 338
335 } 339 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698