Bug 1386439 - Record image-drawing in RasterImage::GetImageContainer and RasterImage::GetFrameAtSize for browser_image_startup.js. r=tnikkel

MozReview-Commit-ID: 1JDWyx8toTB

--HG--
extra : rebase_source : 32659556571acb887f85b922731489f91fcd9075
This commit is contained in:
Johann Hofmann 2017-08-02 00:08:02 +02:00
parent 5b6073d494
commit 4ac05f9ead
3 changed files with 35 additions and 48 deletions

View File

@ -96,54 +96,17 @@ const whitelist = [
intermittentNotLoaded: ["win", "macosx"],
},
{
file: "chrome://browser/skin/places/unfiledBookmarks.png",
hidpi: "<not loaded>",
platforms: ["win", "macosx"],
intermittentNotLoaded: ["win", "macosx"],
},
{
file: "chrome://browser/skin/urlbar-history-dropmarker.png",
hidpi: "<not loaded>",
platforms: ["win", "macosx"],
intermittentShown: ["win", "macosx"],
},
{
file: "chrome://global/skin/icons/chevron.png",
hidpi: "chrome://global/skin/icons/chevron@2x.png",
platforms: ["macosx"],
},
{
file: "chrome://pocket/content/panels/img/pocketmenuitem16.png",
hidpi: "chrome://pocket/content/panels/img/pocketmenuitem16@2x.png",
platforms: ["macosx"],
},
{
file: "chrome://browser/skin/places/bookmarksToolbar.png",
hidpi: "chrome://browser/skin/places/bookmarksToolbar@2x.png",
platforms: ["macosx"],
},
{
file: "chrome://global/skin/tree/folder.png",
hidpi: "chrome://global/skin/tree/folder@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", "linux"],
},
{
file: "chrome://global/skin/icons/resizer.png",
platforms: ["win"],

View File

@ -542,6 +542,11 @@ RasterImage::GetFrameAtSize(const IntSize& aSize,
uint32_t aWhichFrame,
uint32_t aFlags)
{
#ifdef DEBUG
NotifyDrawingObservers();
#endif
RefPtr<SourceSurface> surf =
GetFrameInternal(aSize, aWhichFrame, aFlags).second().forget();
// If we are here, it suggests the image is embedded in a canvas or some
@ -664,6 +669,10 @@ RasterImage::GetImageContainer(LayerManager* aManager, uint32_t aFlags)
return nullptr;
}
#ifdef DEBUG
NotifyDrawingObservers();
#endif
// |image| holds a reference to a SourceSurface which in turn holds a lock on
// the current frame's data buffer, ensuring that it doesn't get freed as
// long as the layer system keeps this ImageContainer alive.
@ -1397,17 +1406,7 @@ RasterImage::DrawInternal(DrawableSurface&& aSurface,
bool frameIsFinished = aSurface->IsFinished();
#ifdef DEBUG
// Record the image drawing for startup performance testing.
if (NS_IsMainThread()) {
nsCOMPtr<nsIObserverService> obs = services::GetObserverService();
NS_WARNING_ASSERTION(obs, "Can't get an observer service handle");
if (obs) {
nsCOMPtr<nsIURI> imageURI = mURI->ToIURI();
nsAutoCString spec;
imageURI->GetSpec(spec);
obs->NotifyObservers(nullptr, "image-drawing", NS_ConvertUTF8toUTF16(spec).get());
}
}
NotifyDrawingObservers();
#endif
// By now we may have a frame with the requested size. If not, we need to
@ -1656,6 +1655,26 @@ RasterImage::GetFramesNotified(uint32_t* aFramesNotified)
}
#endif
#ifdef DEBUG
void
RasterImage::NotifyDrawingObservers()
{
if (!mURI || !NS_IsMainThread()) {
return;
}
// Record the image drawing for startup performance testing.
nsCOMPtr<nsIObserverService> obs = services::GetObserverService();
NS_WARNING_ASSERTION(obs, "Can't get an observer service handle");
if (obs) {
nsCOMPtr<nsIURI> imageURI = mURI->ToIURI();
nsAutoCString spec;
imageURI->GetSpec(spec);
obs->NotifyObservers(nullptr, "image-drawing", NS_ConvertUTF8toUTF16(spec).get());
}
}
#endif
void
RasterImage::NotifyProgress(Progress aProgress,
const IntRect& aInvalidRect /* = IntRect() */,

View File

@ -316,6 +316,11 @@ private:
void UpdateImageContainer();
#ifdef DEBUG
// Records the image drawing for startup performance testing.
void NotifyDrawingObservers();
#endif
//////////////////////////////////////////////////////////////////////////////
// Decoding.
//////////////////////////////////////////////////////////////////////////////