Bug 1363059 - Add a test for images loaded at startup vs. images shown at startup. r=florian,jwatt
This patch enables startupRecorder.js to collect data on loaded and shown raster and SVG images on startup via events from native code. It also adds a test that uses this data to find images that are unnecessarily loaded. I've not fixed any of the affected images yet, there's a fairly comprehensive whitelist that I want to gradually decrease by opening bugs in the respective components. MozReview-Commit-ID: 9KqQvKLtZhu
This commit is contained in:
@@ -1025,6 +1025,19 @@ 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<nsIObserverService> obs = services::GetObserverService();
|
||||
if (NS_WARN_IF(obs)) {
|
||||
nsCOMPtr<nsIURI> 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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user