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

Unified Diff: PerformanceTests/resources/runner.js

Issue 675983004: Allow performance tests to test full rendering performance (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: layoutOrFullyRender -> forceLayoutOrFullFrame Created 6 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « PerformanceTests/ShadowDOM/shadow-style-share-with-distribution.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: PerformanceTests/resources/runner.js
diff --git a/PerformanceTests/resources/runner.js b/PerformanceTests/resources/runner.js
index ffa6fa7669f77110a50df0b171a4b7e206bc4093..4c1ae2463e51ab72ebce8dea5c8777fb5c0cb04f 100644
--- a/PerformanceTests/resources/runner.js
+++ b/PerformanceTests/resources/runner.js
@@ -137,6 +137,27 @@ if (window.testRunner) {
finish();
}
+ // Force a layout (including style recalc) if window.fullFrameMeasurement is false,
+ // or a full frame update (including style recalc, layout, compositing update and paint invalidation,
+ // not including painting).
+ PerfTestRunner.forceLayoutOrFullFrame = function(doc) {
+ doc = doc || document;
+ // Forcing full frame is only feasible when window.internals is available.
+ if (window.fullFrameMeasurement) {
+ if (window.internals)
+ internals.forceCompositingUpdate(doc);
+ else
+ PerfTestRunner.logFatalError('window.internals API is required for full frame measurement.');
+ return;
+ }
+
+ // Otherwise just force style recalc and layout without compositing update and paint invalidation.
+ if (doc.body)
+ doc.body.offsetHeight;
+ else if (doc.documentElement)
+ doc.documentElement.offsetHeight;
+ };
+
function start(test, runner) {
if (!test) {
PerfTestRunner.logFatalError("Got a bad test object.");
@@ -311,12 +332,7 @@ if (window.testRunner) {
for (var chunkIndex = 0; chunkIndex < chunks.length; chunkIndex++) {
iframe.contentDocument.write(chunks[chunkIndex]);
- // Note that we won't cause a style resolve until we've encountered the <body> element.
- // Thus the number of chunks counted above is not exactly equal to the number of style resolves.
- if (iframe.contentDocument.body)
- iframe.contentDocument.body.clientHeight; // Force a full layout/style-resolve.
- else if (iframe.documentElement.localName == 'html')
- iframe.contentDocument.documentElement.offsetWidth; // Force the painting.
+ PerfTestRunner.forceLayoutOrFullFrame(iframe.contentDocument);
}
iframe.contentDocument.close();
« no previous file with comments | « PerformanceTests/ShadowDOM/shadow-style-share-with-distribution.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698