From e87565613f60ed803c2c8ad499237f0daecd5ec1 Mon Sep 17 00:00:00 2001 From: "Carsten \"Tomcat\" Book" Date: Thu, 22 Jun 2017 15:35:50 +0200 Subject: [PATCH] Backed out changeset 7e137dfb0bff (bug 1363059) for failures like browser_startup_images.js | Loaded image chrome://browser/skin/sidebars.svg was shown --HG-- extra : rebase_source : 2b1f422a7a98686886215069a62897e87369a55b --- .../base/content/test/performance/browser.ini | 2 - .../test/performance/browser_startup.js | 2 +- .../performance/browser_startup_images.js | 195 ------------------ browser/components/tests/startupRecorder.js | 19 +- image/ImageFactory.cpp | 12 -- image/RasterImage.cpp | 13 -- image/VectorImage.cpp | 13 -- 7 files changed, 3 insertions(+), 253 deletions(-) delete mode 100644 browser/base/content/test/performance/browser_startup_images.js diff --git a/browser/base/content/test/performance/browser.ini b/browser/base/content/test/performance/browser.ini index bda9c0786a65..e4b0a3a51813 100644 --- a/browser/base/content/test/performance/browser.ini +++ b/browser/base/content/test/performance/browser.ini @@ -3,8 +3,6 @@ support-files = head.js [browser_appmenu_reflows.js] [browser_startup.js] -[browser_startup_images.js] -skip-if = !debug [browser_tabclose_grow_reflows.js] [browser_tabclose_reflows.js] [browser_tabopen_reflows.js] diff --git a/browser/base/content/test/performance/browser_startup.js b/browser/base/content/test/performance/browser_startup.js index d675a1781b31..969062108555 100644 --- a/browser/base/content/test/performance/browser_startup.js +++ b/browser/base/content/test/performance/browser_startup.js @@ -105,7 +105,7 @@ function test() { return; } - let data = Cc["@mozilla.org/test/startuprecorder;1"].getService().wrappedJSObject.data.code; + let data = Cc["@mozilla.org/test/startuprecorder;1"].getService().wrappedJSObject.data; // Keep only the file name for components, as the path is an absolute file // URL rather than a resource:// URL like for modules. for (let phase in data) { diff --git a/browser/base/content/test/performance/browser_startup_images.js b/browser/base/content/test/performance/browser_startup_images.js deleted file mode 100644 index 24a40229466b..000000000000 --- a/browser/base/content/test/performance/browser_startup_images.js +++ /dev/null @@ -1,195 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ */ - -"use strict"; - -/* A whitelist of images that are loaded at startup but not shown. - * List items support the following attributes: - * - file: The location of the loaded image file. - * - hidpi: An alternative hidpi file location for retina screens, if one exists. - * May be the magic string in strange cases where - * only the low-resolution image is loaded but not shown. - * - platforms: An array of the platforms where the issue is occurring. - * Possible values are linux, win, macosx. - * - intermittentNotLoaded: an array of platforms where this image is - * intermittently not loaded, e.g. because it is - * loaded during the time we stop recording. - * - intermittentShown: An array of platforms where this image is - * intermittently shown, contrary to what our - * whitelist says. - * - * Please don't add items to this list. Please remove items from this list. - */ -const whitelist = [ - { - file: "chrome://browser/skin/fxa/sync-illustration.svg", - platforms: ["linux", "win", "macosx"], - }, - { - file: "chrome://browser/skin/tabbrowser/tab-overflow-indicator.png", - platforms: ["linux", "win", "macosx"], - }, - { - file: "chrome://browser/skin/stop.svg", - platforms: ["linux", "win", "macosx"], - }, - { - file: "chrome://pocket-shared/skin/pocket.svg", - platforms: ["linux", "win", "macosx"], - intermittentNotLoaded: ["macosx"], - }, - { - file: "chrome://browser/skin/places/toolbarDropMarker.png", - platforms: ["linux", "win", "macosx"], - }, - { - file: "chrome://browser/skin/tracking-protection-16.svg#enabled", - platforms: ["linux", "win", "macosx"], - }, - { - file: "chrome://browser/skin/toolbarbutton-dropdown-arrow.png", - platforms: ["linux", "win", "macosx"], - }, - { - file: "chrome://global/skin/icons/autoscroll.png", - platforms: ["linux", "win", "macosx"], - }, - - { - file: "chrome://browser/skin/tabbrowser/tab-background-end.png", - hidpi: "chrome://browser/skin/tabbrowser/tab-background-end@2x.png", - platforms: ["linux", "win", "macosx"], - }, - { - file: "chrome://browser/skin/tabbrowser/tab-background-middle.png", - hidpi: "chrome://browser/skin/tabbrowser/tab-background-middle@2x.png", - platforms: ["linux", "win", "macosx"], - }, - { - file: "chrome://browser/skin/tabbrowser/tab-background-start.png", - hidpi: "chrome://browser/skin/tabbrowser/tab-background-start@2x.png", - platforms: ["linux", "win", "macosx"], - }, - { - file: "chrome://browser/skin/tabbrowser/tabDragIndicator.png", - hidpi: "chrome://browser/skin/tabbrowser/tabDragIndicator@2x.png", - platforms: ["linux", "win", "macosx"], - }, - - { - file: "resource://gre-resources/loading-image.png", - platforms: ["win", "macosx"], - intermittentNotLoaded: ["win", "macosx"], - }, - { - file: "resource://gre-resources/broken-image.png", - platforms: ["win", "macosx"], - intermittentNotLoaded: ["win", "macosx"], - }, - - { - file: "chrome://browser/skin/places/unfiledBookmarks.png", - hidpi: "", - platforms: ["win", "macosx"], - }, - { - file: "chrome://browser/skin/urlbar-history-dropmarker.png", - hidpi: "", - platforms: ["win", "macosx"], - intermittentShown: ["win"], - }, - - { - file: "chrome://global/skin/icons/chevron.png", - hidpi: "chrome://global/skin/icons/chevron@2x.png", - platforms: ["macosx"], - }, - - { - file: "chrome://browser/skin/tabbrowser/alltabs-box-bkgnd-icon.png", - hidpi: "chrome://browser/skin/tabbrowser/alltabs-box-bkgnd-icon@2x.png", - platforms: ["macosx"], - }, - - { - file: "chrome://global/skin/toolbar/chevron.gif", - platforms: ["win", "linux"], - }, - { - file: "chrome://browser/skin/reload-stop-go.png", - platforms: ["win", "linux"], - intermittentShown: ["win"], - }, - - { - file: "chrome://browser/skin/tabbrowser/alltabs.png", - platforms: ["linux"], - }, - - { - file: "chrome://browser/skin/tabbrowser/tab-arrow-left.svg", - platforms: ["win"], - }, - - { - file: "chrome://global/skin/icons/resizer.png", - platforms: ["win"], - }, - - { - file: "chrome://global/skin/icons/resizer.png", - platforms: ["win"], - }, - - { - file: "chrome://browser/skin/tabbrowser/tab-arrow-left.png", - hidpi: "chrome://browser/skin/tabbrowser/tab-arrow-left@2x.png", - platforms: ["linux", "macosx"], - }, - { - file: "chrome://browser/skin/tabbrowser/tab-arrow-right.png", - hidpi: "chrome://browser/skin/tabbrowser/tab-arrow-right@2x.png", - platforms: ["macosx"], - }, -]; - -function test() { - let data = Cc["@mozilla.org/test/startuprecorder;1"].getService().wrappedJSObject.data.images; - let platformWhitelist = whitelist.filter(el => el.platforms.includes(AppConstants.platform)); - - let loadedImages = data["image-loading"]; - let shownImages = data["image-drawing"]; - - for (let loaded of loadedImages.values()) { - let whitelistItem = platformWhitelist.find(el => { - if (window.devicePixelRatio >= 2 && el.hidpi && el.hidpi == loaded) { - return true; - } - return el.file == loaded; - }); - if (whitelistItem) { - if (!whitelistItem.intermittentShown || - !whitelistItem.intermittentShown.includes(AppConstants.platform)) { - todo(shownImages.has(loaded), `Loaded image ${loaded} is not shown but whitelisted.`); - } - continue; - } - ok(shownImages.has(loaded), `Loaded image ${loaded} was shown.`); - } - - // Check for unneeded whitelist entries. - for (let item of platformWhitelist) { - if (!item.intermittentNotLoaded || - !item.intermittentNotLoaded.includes(AppConstants.platform)) { - if (window.devicePixelRatio >= 2 && item.hidpi) { - if (item.hidpi != "") { - ok(loadedImages.has(item.hidpi), `Whitelisted image ${item.hidpi} was loaded.`); - ok(!shownImages.has(item.hidpi), `Whitelisted image ${item.hidpi} was not shown.`); - } - } else { - ok(loadedImages.has(item.file), `Whitelisted image ${item.file} was loaded.`); - ok(!shownImages.has(item.file), `Whitelisted image ${item.file} was not shown.`); - } - } - } -} diff --git a/browser/components/tests/startupRecorder.js b/browser/components/tests/startupRecorder.js index 5ae0f7a4e904..8a0bcd37c747 100644 --- a/browser/components/tests/startupRecorder.js +++ b/browser/components/tests/startupRecorder.js @@ -26,13 +26,7 @@ if (AppConstants.platform == "linux") function startupRecorder() { this.wrappedJSObject = this; this.loader = Cc["@mozilla.org/moz/jsloader;1"].getService(Ci.xpcIJSModuleLoader); - this.data = { - images: { - "image-drawing": new Set(), - "image-loading": new Set(), - }, - code: {} - }; + this.data = {}; } startupRecorder.prototype = { classID: Components.ID("{11c095b2-e42e-4bdf-9dd0-aed87595f6a4}"), @@ -40,7 +34,7 @@ startupRecorder.prototype = { QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver]), record(name) { - this.data.code[name] = { + this.data[name] = { components: this.loader.loadedComponents(), modules: this.loader.loadedModules(), services: Object.keys(Cc).filter(c => { @@ -63,8 +57,6 @@ startupRecorder.prototype = { let topics = [ "profile-do-change", // This catches stuff loaded during app-startup "toplevel-window-ready", // Catches stuff from final-ui-startup - "image-loading", - "image-drawing", firstPaintNotification, "sessionstore-windows-restored", ]; @@ -73,16 +65,9 @@ startupRecorder.prototype = { return; } - if (topic == "image-drawing" || topic == "image-loading") { - this.data.images[topic].add(data); - return; - } - Services.obs.removeObserver(this, topic); if (topic == "sessionstore-windows-restored") { - Services.obs.removeObserver(this, "image-drawing"); - Services.obs.removeObserver(this, "image-loading"); // We use idleDispatch here to record the set of loaded scripts after we // are fully done with startup and ready to react to user events. Services.tm.mainThread.idleDispatch( diff --git a/image/ImageFactory.cpp b/image/ImageFactory.cpp index 11e2703a4a24..0f783154891c 100644 --- a/image/ImageFactory.cpp +++ b/image/ImageFactory.cpp @@ -92,18 +92,6 @@ ImageFactory::CreateImage(nsIRequest* aRequest, // Compute the image's initialization flags. uint32_t imageFlags = ComputeImageFlags(aURI, aMimeType, aIsMultiPart); -#ifdef DEBUG - // Record the image load for startup performance testing. - if (NS_IsMainThread()) { - nsCOMPtr obs = services::GetObserverService(); - if (NS_WARN_IF(obs)) { - nsAutoCString spec; - aURI->GetSpec(spec); - obs->NotifyObservers(nullptr, "image-loading", NS_ConvertUTF8toUTF16(spec).get()); - } - } -#endif - // Select the type of image to create based on MIME type. if (aMimeType.EqualsLiteral(IMAGE_SVG_XML)) { return CreateVectorImage(aRequest, aProgressTracker, aMimeType, diff --git a/image/RasterImage.cpp b/image/RasterImage.cpp index 0e832dd96bca..8585272ab49c 100644 --- a/image/RasterImage.cpp +++ b/image/RasterImage.cpp @@ -1399,19 +1399,6 @@ RasterImage::DrawInternal(DrawableSurface&& aSurface, ImageRegion region(aRegion); bool frameIsFinished = aSurface->IsFinished(); -#ifdef DEBUG - // Record the image drawing for startup performance testing. - if (NS_IsMainThread()) { - nsCOMPtr obs = services::GetObserverService(); - if (NS_WARN_IF(obs)) { - nsCOMPtr imageURI = mURI->ToIURI(); - nsAutoCString spec; - imageURI->GetSpec(spec); - obs->NotifyObservers(nullptr, "image-drawing", NS_ConvertUTF8toUTF16(spec).get()); - } - } -#endif - // By now we may have a frame with the requested size. If not, we need to // adjust the drawing parameters accordingly. IntSize finalSize = aSurface->GetImageSize(); diff --git a/image/VectorImage.cpp b/image/VectorImage.cpp index 4fefa722cbc9..bfb408554255 100644 --- a/image/VectorImage.cpp +++ b/image/VectorImage.cpp @@ -1025,19 +1025,6 @@ VectorImage::Show(gfxDrawable* aDrawable, const SVGDrawingParameters& aParams) aParams.samplingFilter, aParams.flags, aParams.opacity); -#ifdef DEBUG - // Record the image drawing for startup performance testing. - if (NS_IsMainThread()) { - nsCOMPtr obs = services::GetObserverService(); - if (NS_WARN_IF(obs)) { - nsCOMPtr imageURI = mURI->ToIURI(); - nsAutoCString spec; - imageURI->GetSpec(spec); - obs->NotifyObservers(nullptr, "image-drawing", NS_ConvertUTF8toUTF16(spec).get()); - } - } -#endif - MOZ_ASSERT(mRenderingObserver, "Should have a rendering observer by now"); mRenderingObserver->ResumeHonoringInvalidations(); }