Bug 1330696 - Add profiler labels for canvas captureStream. r?jesup
MozReview-Commit-ID: IDY1Elfd2Kn
--- a/dom/html/HTMLCanvasElement.cpp
+++ b/dom/html/HTMLCanvasElement.cpp
@@ -103,16 +103,18 @@ public:
return copy.forget();
}
void WillRefresh(TimeStamp aTime) override
{
MOZ_ASSERT(NS_IsMainThread());
+ PROFILER_LABEL("HTMLCanvasElement", "FrameCapture", js::ProfileEntry::Category::OTHER);
+
if (!mOwningElement) {
return;
}
if (mOwningElement->IsWriteOnly()) {
return;
}
@@ -121,28 +123,39 @@ public:
}
mOwningElement->ProcessDestroyedFrameListeners();
if (!mOwningElement->IsFrameCaptureRequested()) {
return;
}
- RefPtr<SourceSurface> snapshot = mOwningElement->GetSurfaceSnapshot(nullptr);
- if (!snapshot) {
- return;
+ RefPtr<SourceSurface> snapshot;
+ {
+ PROFILER_LABEL("HTMLCanvasElement", "GetSnapshot", js::ProfileEntry::Category::OTHER);
+ snapshot = mOwningElement->GetSurfaceSnapshot(nullptr);
+ if (!snapshot) {
+ return;
+ }
}
- RefPtr<DataSourceSurface> copy = CopySurface(snapshot);
- if (!copy) {
- return;
+ RefPtr<DataSourceSurface> copy;
+ {
+ PROFILER_LABEL("HTMLCanvasElement", "CopySnapshot", js::ProfileEntry::Category::OTHER);
+ copy = CopySurface(snapshot);
+ if (!copy) {
+ return;
+ }
}
- mOwningElement->SetFrameCapture(copy.forget());
- mOwningElement->MarkContextCleanForFrameCapture();
+ {
+ PROFILER_LABEL("HTMLCanvasElement", "SetFrame", js::ProfileEntry::Category::OTHER);
+ mOwningElement->SetFrameCapture(copy.forget());
+ mOwningElement->MarkContextCleanForFrameCapture();
+ }
}
void DetachFromRefreshDriver()
{
MOZ_ASSERT(mOwningElement);
MOZ_ASSERT(mRefreshDriver);
Unregister();