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
Родитель e3b5379696
Коммит 37395798ee
4 изменённых файлов: 31 добавлений и 31 удалений

Просмотреть файл

@ -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

Просмотреть файл

@ -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;

Просмотреть файл

@ -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() */,

Просмотреть файл

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