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

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: s/forceFullLayout/forceLayout/g Created 6 years, 2 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 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..c09754a546a5197137653f9485b4bde936818435 100644
--- a/PerformanceTests/resources/runner.js
+++ b/PerformanceTests/resources/runner.js
@@ -137,6 +137,24 @@ if (window.testRunner) {
finish();
}
+ PerfTestRunner.forceLayout = function(doc) {
+ doc = doc || document;
+ // Forcing full layout is only fully feasible when window.internals is available.
leviw_travelin_and_unemployed 2014/10/30 20:33:53 I don't think this naming is right. Simply calling
Xianzhu 2014/10/30 21:29:12 I'm not sure what the correct name is. I thought s
+ if (window.fullLayoutMeasurement) {
+ if (window.internals)
+ internals.forceCompositingUpdate(doc);
+ else
+ PerfTestRunner.logFatalError('window.internals API is required for full layout 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 +329,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.forceLayout(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