Title: [174642] trunk/Tools
- Revision
- 174642
- Author
- [email protected]
- Date
- 2014-10-12 14:48:16 -0700 (Sun, 12 Oct 2014)
Log Message
Page not fully rendered in iOS DRT snapshots
https://bugs.webkit.org/show_bug.cgi?id=137638
Reviewed by Tim Horton.
In iOS DumpRenderTree, we need to wait for a cycle of the WebThread runloop
to ensure that the page has laid out and is rendered by the time we take
the snapshot.
* DumpRenderTree/mac/DumpRenderTree.mm:
(-[DumpRenderTree _webThreadEventLoopHasRun]): Moved.
(-[DumpRenderTree _webThreadInvoked]): Moved.
(-[DumpRenderTree _waitForWebThreadThenDump]):
(dump): Use a performSelectorOnMainThread:withObject:waitUntilDone:NO to wait
for a cycle of the WebThrewd runloop. We can't just call _waitForWebThread because
that blocks on a delegate callback, and we can't dispatch_async because _waitForWebThread
relies on dispatch_async too, and the inner block won't complete until the outer block
has completed.
(dumpTestResults): Move the guts of dump() here.
(runTest): Whitespace.
Modified Paths
Diff
Modified: trunk/Tools/ChangeLog (174641 => 174642)
--- trunk/Tools/ChangeLog 2014-10-12 18:48:12 UTC (rev 174641)
+++ trunk/Tools/ChangeLog 2014-10-12 21:48:16 UTC (rev 174642)
@@ -1,3 +1,26 @@
+2014-10-12 Simon Fraser <[email protected]>
+
+ Page not fully rendered in iOS DRT snapshots
+ https://bugs.webkit.org/show_bug.cgi?id=137638
+
+ Reviewed by Tim Horton.
+
+ In iOS DumpRenderTree, we need to wait for a cycle of the WebThread runloop
+ to ensure that the page has laid out and is rendered by the time we take
+ the snapshot.
+
+ * DumpRenderTree/mac/DumpRenderTree.mm:
+ (-[DumpRenderTree _webThreadEventLoopHasRun]): Moved.
+ (-[DumpRenderTree _webThreadInvoked]): Moved.
+ (-[DumpRenderTree _waitForWebThreadThenDump]):
+ (dump): Use a performSelectorOnMainThread:withObject:waitUntilDone:NO to wait
+ for a cycle of the WebThrewd runloop. We can't just call _waitForWebThread because
+ that blocks on a delegate callback, and we can't dispatch_async because _waitForWebThread
+ relies on dispatch_async too, and the inner block won't complete until the outer block
+ has completed.
+ (dumpTestResults): Move the guts of dump() here.
+ (runTest): Whitespace.
+
2014-10-12 Alexey Proskuryakov <[email protected]>
Adding svn:ignore so that .pyc files don't show up as new.
Modified: trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm (174641 => 174642)
--- trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm 2014-10-12 18:48:12 UTC (rev 174641)
+++ trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm 2014-10-12 21:48:16 UTC (rev 174642)
@@ -155,6 +155,7 @@
#endif
static void runTest(const string& testPathOrURL);
+static void dumpTestResults();
// Deciding when it's OK to dump out the state is a bit tricky. All these must be true:
// - There is no load in progress
@@ -1216,20 +1217,6 @@
});
}
-- (void)_webThreadEventLoopHasRun
-{
- ASSERT(!WebThreadIsCurrent());
- _hasFlushedWebThreadRunQueue = YES;
-}
-
-- (void)_webThreadInvoked
-{
- ASSERT(WebThreadIsCurrent());
- dispatch_async(dispatch_get_main_queue(), ^{
- [self _webThreadEventLoopHasRun];
- });
-}
-
- (void)applicationDidEnterBackground:(UIApplication *)application
{
/* Apps will get suspended or killed some time after entering the background state but we want to be able to run multiple copies of DumpRenderTree. Periodically check to see if our remaining background time dips below a threshold and create a new background task.
@@ -1253,6 +1240,20 @@
});
}
+- (void)_webThreadEventLoopHasRun
+{
+ ASSERT(!WebThreadIsCurrent());
+ _hasFlushedWebThreadRunQueue = YES;
+}
+
+- (void)_webThreadInvoked
+{
+ ASSERT(WebThreadIsCurrent());
+ dispatch_async(dispatch_get_main_queue(), ^{
+ [self _webThreadEventLoopHasRun];
+ });
+}
+
// The test can end in response to a delegate callback while there are still methods queued on the Web Thread.
// If we do not ensure the Web Thread has been run, the callback can be done on a WebView that no longer exists.
// To avoid this, _waitForWebThread dispatches a call to the WebThread event loop, actively processing the delegate
@@ -1271,6 +1272,12 @@
}
}
+- (void)_waitForWebThreadThenDump
+{
+ [self _waitForWebThread];
+ dumpTestResults();
+}
+
@end
#endif
@@ -1561,6 +1568,19 @@
[(DumpRenderTree *)UIApp _deferDumpToMainThread];
return;
}
+
+ // Allow the web thread to run before dumping. We can't call -_waitForWebThread directly since we may
+ // be inside a delegate callback.
+ [UIApp performSelectorOnMainThread:@selector(_waitForWebThreadThenDump) withObject:nil waitUntilDone:NO];
+ return;
+#endif
+
+ dumpTestResults();
+}
+
+void dumpTestResults()
+{
+#if PLATFORM(IOS)
WebThreadLock();
#endif
@@ -1831,6 +1851,7 @@
if ([WebHistory optionalSharedHistory])
[WebHistory setOptionalSharedHistory:nil];
+
lastMousePosition = NSZeroPoint;
lastClickPosition = NSZeroPoint;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes