Bug 1368776 - Part 0. Move RasterImage's NotifyDrawingObservers to ImageResource. r=tnikkel

This commit is contained in:
Andrew Osmond 2017-11-17 06:45:23 -05:00
parent e3b5379696
commit 37395798ee
4 changed files with 31 additions and 31 deletions

View File

@ -169,5 +169,31 @@ ImageResource::SendOnUnlockedDraw(uint32_t aFlags)
}
}
#ifdef DEBUG
void
ImageResource::NotifyDrawingObservers()
{
if (!mURI || !NS_IsMainThread()) {
return;
}
bool match = false;
if ((NS_FAILED(mURI->SchemeIs("resource", &match)) || !match) &&
(NS_FAILED(mURI->SchemeIs("chrome", &match)) || !match)) {
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
} // namespace image
} // namespace mozilla

View File

@ -318,6 +318,11 @@ protected:
void SendOnUnlockedDraw(uint32_t aFlags);
#ifdef DEBUG
// Records the image drawing for startup performance testing.
void NotifyDrawingObservers();
#endif
// Member data shared by all implementations of this abstract class
RefPtr<ProgressTracker> mProgressTracker;
RefPtr<ImageURL> mURI;

View File

@ -1691,32 +1691,6 @@ RasterImage::GetFramesNotified(uint32_t* aFramesNotified)
}
#endif
#ifdef DEBUG
void
RasterImage::NotifyDrawingObservers()
{
if (!mURI || !NS_IsMainThread()) {
return;
}
bool match = false;
if ((NS_FAILED(mURI->SchemeIs("resource", &match)) || !match) &&
(NS_FAILED(mURI->SchemeIs("chrome", &match)) || !match)) {
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

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