зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1704103 - add 'Image Paint' and 'Image Load' profiler markers, r=gerald,tnikkel.
Differential Revision: https://phabricator.services.mozilla.com/D111420
This commit is contained in:
Родитель
28193cd188
Коммит
821491b1c4
|
@ -219,6 +219,7 @@ ImgDrawResult ImageResource::GetImageContainerImpl(
|
|||
}
|
||||
}
|
||||
|
||||
AutoProfilerImagePaintMarker PROFILER_RAII(this);
|
||||
#ifdef DEBUG
|
||||
NotifyDrawingObservers();
|
||||
#endif
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
#include "mozilla/Maybe.h"
|
||||
#include "mozilla/MemoryReporting.h"
|
||||
#include "mozilla/ProfilerMarkers.h"
|
||||
#include "mozilla/SizeOfState.h"
|
||||
#include "mozilla/ThreadSafeWeakPtr.h"
|
||||
#include "mozilla/TimeStamp.h"
|
||||
|
@ -431,6 +432,33 @@ class ImageResource : public Image {
|
|||
|
||||
void ReleaseImageContainer();
|
||||
|
||||
class MOZ_RAII AutoProfilerImagePaintMarker {
|
||||
public:
|
||||
explicit AutoProfilerImagePaintMarker(ImageResource* self)
|
||||
: mStartTime(TimeStamp::NowUnfuzzed()) {
|
||||
nsAutoCString spec;
|
||||
if (self->mURI && profiler_can_accept_markers()) {
|
||||
static const size_t sMaxTruncatedLength = 1024;
|
||||
self->mURI->GetSpec(mSpec);
|
||||
if (mSpec.Length() >= sMaxTruncatedLength) {
|
||||
mSpec.Truncate(sMaxTruncatedLength);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
~AutoProfilerImagePaintMarker() {
|
||||
if (!mSpec.IsEmpty()) {
|
||||
PROFILER_MARKER_TEXT("Image Paint", GRAPHICS,
|
||||
MarkerTiming::IntervalUntilNowFrom(mStartTime),
|
||||
mSpec);
|
||||
}
|
||||
}
|
||||
|
||||
protected:
|
||||
TimeStamp mStartTime;
|
||||
nsAutoCString mSpec;
|
||||
};
|
||||
|
||||
private:
|
||||
void SetCurrentImage(layers::ImageContainer* aContainer,
|
||||
gfx::SourceSurface* aSurface,
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
|
||||
#include "mozilla/SchedulerGroup.h"
|
||||
#include "mozilla/StaticPrefs_image.h"
|
||||
#include "mozilla/ProfilerMarkers.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace image {
|
||||
|
@ -113,6 +114,17 @@ already_AddRefed<Image> ImageFactory::CreateImage(
|
|||
}
|
||||
#endif
|
||||
|
||||
if (profiler_can_accept_markers()) {
|
||||
static const size_t sMaxTruncatedLength = 1024;
|
||||
nsAutoCString spec;
|
||||
aURI->GetSpec(spec);
|
||||
if (spec.Length() >= sMaxTruncatedLength) {
|
||||
spec.Truncate(sMaxTruncatedLength);
|
||||
}
|
||||
PROFILER_MARKER_TEXT("Image Load", GRAPHICS,
|
||||
MarkerInnerWindowId(aInnerWindowId), spec);
|
||||
}
|
||||
|
||||
// Select the type of image to create based on MIME type.
|
||||
if (aMimeType.EqualsLiteral(IMAGE_SVG_XML)) {
|
||||
return CreateVectorImage(aRequest, aProgressTracker, aMimeType, aURI,
|
||||
|
|
|
@ -545,6 +545,7 @@ RasterImage::GetFrame(uint32_t aWhichFrame, uint32_t aFlags) {
|
|||
NS_IMETHODIMP_(already_AddRefed<SourceSurface>)
|
||||
RasterImage::GetFrameAtSize(const IntSize& aSize, uint32_t aWhichFrame,
|
||||
uint32_t aFlags) {
|
||||
AutoProfilerImagePaintMarker PROFILER_RAII(this);
|
||||
#ifdef DEBUG
|
||||
NotifyDrawingObservers();
|
||||
#endif
|
||||
|
@ -1385,6 +1386,7 @@ ImgDrawResult RasterImage::DrawInternal(DrawableSurface&& aSurface,
|
|||
ImageRegion region(aRegion);
|
||||
bool frameIsFinished = aSurface->IsFinished();
|
||||
|
||||
AutoProfilerImagePaintMarker PROFILER_RAII(this);
|
||||
#ifdef DEBUG
|
||||
NotifyDrawingObservers();
|
||||
#endif
|
||||
|
|
|
@ -723,6 +723,7 @@ VectorImage::GetFrame(uint32_t aWhichFrame, uint32_t aFlags) {
|
|||
NS_IMETHODIMP_(already_AddRefed<SourceSurface>)
|
||||
VectorImage::GetFrameAtSize(const IntSize& aSize, uint32_t aWhichFrame,
|
||||
uint32_t aFlags) {
|
||||
AutoProfilerImagePaintMarker PROFILER_RAII(this);
|
||||
#ifdef DEBUG
|
||||
NotifyDrawingObservers();
|
||||
#endif
|
||||
|
@ -1183,6 +1184,7 @@ void VectorImage::Show(gfxDrawable* aDrawable,
|
|||
SurfaceFormat::OS_RGBA, aParams.samplingFilter,
|
||||
aParams.flags, aParams.opacity, false);
|
||||
|
||||
AutoProfilerImagePaintMarker PROFILER_RAII(this);
|
||||
#ifdef DEBUG
|
||||
NotifyDrawingObservers();
|
||||
#endif
|
||||
|
|
Загрузка…
Ссылка в новой задаче