зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1551735 - Ref count and document CompositionRecorder r=kats
The CompositionRecorder was being stored as a UniquePtr on the CompositorBridgeParent, but was then passed to and stored on the LayerManger as a raw pointer. This has been updated to use a RefPtr. Differential Revision: https://phabricator.services.mozilla.com/D32230 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
0698f8bffe
Коммит
76600ea0a2
|
@ -20,6 +20,9 @@ class DataSourceSurface;
|
||||||
|
|
||||||
namespace layers {
|
namespace layers {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A captured frame from a |LayerManager|.
|
||||||
|
*/
|
||||||
class RecordedFrame {
|
class RecordedFrame {
|
||||||
public:
|
public:
|
||||||
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(RecordedFrame)
|
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(RecordedFrame)
|
||||||
|
@ -38,17 +41,33 @@ class RecordedFrame {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* A recorder for composited frames.
|
||||||
*
|
*
|
||||||
|
* This object collects frames sent to it by a |LayerManager| and writes them
|
||||||
|
* out as a series of images until recording has finished.
|
||||||
|
*
|
||||||
|
* If GPU-accelerated rendering is used, the frames will not be mapped into
|
||||||
|
* memory until |WriteCollectedFrames| is called.
|
||||||
*/
|
*/
|
||||||
class CompositionRecorder final {
|
class CompositionRecorder final {
|
||||||
|
NS_INLINE_DECL_REFCOUNTING(CompositionRecorder)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit CompositionRecorder(TimeStamp aRecordingStart);
|
explicit CompositionRecorder(TimeStamp aRecordingStart);
|
||||||
~CompositionRecorder();
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Record a composited frame.
|
||||||
|
*/
|
||||||
void RecordFrame(RecordedFrame* aFrame);
|
void RecordFrame(RecordedFrame* aFrame);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Write out the collected frames as a series of timestamped images.
|
||||||
|
*/
|
||||||
void WriteCollectedFrames();
|
void WriteCollectedFrames();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
~CompositionRecorder();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
nsTArray<RefPtr<RecordedFrame>> mCollectedFrames;
|
nsTArray<RefPtr<RecordedFrame>> mCollectedFrames;
|
||||||
TimeStamp mRecordingStart;
|
TimeStamp mRecordingStart;
|
||||||
|
@ -57,4 +76,4 @@ class CompositionRecorder final {
|
||||||
} // namespace layers
|
} // namespace layers
|
||||||
} // namespace mozilla
|
} // namespace mozilla
|
||||||
|
|
||||||
#endif // mozilla_layers_ProfilerScreenshots_h
|
#endif // mozilla_layers_CompositionRecorder_h
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
#include "mozilla/gfx/Point.h" // for IntSize
|
#include "mozilla/gfx/Point.h" // for IntSize
|
||||||
#include "mozilla/gfx/Rect.h" // for Rect
|
#include "mozilla/gfx/Rect.h" // for Rect
|
||||||
#include "mozilla/gfx/Types.h" // for SurfaceFormat
|
#include "mozilla/gfx/Types.h" // for SurfaceFormat
|
||||||
|
#include "mozilla/layers/CompositionRecorder.h"
|
||||||
#include "mozilla/layers/CompositorTypes.h"
|
#include "mozilla/layers/CompositorTypes.h"
|
||||||
#include "mozilla/layers/Effects.h" // for EffectChain
|
#include "mozilla/layers/Effects.h" // for EffectChain
|
||||||
#include "mozilla/layers/LayersMessages.h"
|
#include "mozilla/layers/LayersMessages.h"
|
||||||
|
@ -53,7 +54,6 @@ namespace layers {
|
||||||
class CanvasLayerComposite;
|
class CanvasLayerComposite;
|
||||||
class ColorLayerComposite;
|
class ColorLayerComposite;
|
||||||
class Compositor;
|
class Compositor;
|
||||||
class CompositionRecorder;
|
|
||||||
class ContainerLayerComposite;
|
class ContainerLayerComposite;
|
||||||
class Diagnostics;
|
class Diagnostics;
|
||||||
struct EffectChain;
|
struct EffectChain;
|
||||||
|
@ -199,7 +199,7 @@ class HostLayerManager : public LayerManager {
|
||||||
mCompositorBridgeID = aID;
|
mCompositorBridgeID = aID;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetCompositionRecorder(CompositionRecorder* aRecorder) {
|
void SetCompositionRecorder(already_AddRefed<CompositionRecorder> aRecorder) {
|
||||||
mCompositionRecorder = aRecorder;
|
mCompositionRecorder = aRecorder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -216,7 +216,7 @@ class HostLayerManager : public LayerManager {
|
||||||
bool mWindowOverlayChanged;
|
bool mWindowOverlayChanged;
|
||||||
TimeDuration mLastPaintTime;
|
TimeDuration mLastPaintTime;
|
||||||
TimeStamp mRenderStartTime;
|
TimeStamp mRenderStartTime;
|
||||||
CompositionRecorder* mCompositionRecorder = nullptr;
|
RefPtr<CompositionRecorder> mCompositionRecorder = nullptr;
|
||||||
|
|
||||||
// Render time for the current composition.
|
// Render time for the current composition.
|
||||||
TimeStamp mCompositionTime;
|
TimeStamp mCompositionTime;
|
||||||
|
|
|
@ -2609,10 +2609,10 @@ int32_t RecordContentFrameTime(
|
||||||
|
|
||||||
mozilla::ipc::IPCResult CompositorBridgeParent::RecvBeginRecording(
|
mozilla::ipc::IPCResult CompositorBridgeParent::RecvBeginRecording(
|
||||||
const TimeStamp& aRecordingStart) {
|
const TimeStamp& aRecordingStart) {
|
||||||
mCompositionRecorder.reset(new CompositionRecorder(aRecordingStart));
|
mCompositionRecorder = new CompositionRecorder(aRecordingStart);
|
||||||
|
|
||||||
if (mLayerManager) {
|
if (mLayerManager) {
|
||||||
mLayerManager->SetCompositionRecorder(mCompositionRecorder.get());
|
mLayerManager->SetCompositionRecorder(do_AddRef(mCompositionRecorder));
|
||||||
}
|
}
|
||||||
|
|
||||||
return IPC_OK();
|
return IPC_OK();
|
||||||
|
@ -2623,7 +2623,7 @@ mozilla::ipc::IPCResult CompositorBridgeParent::RecvEndRecording() {
|
||||||
mLayerManager->SetCompositionRecorder(nullptr);
|
mLayerManager->SetCompositionRecorder(nullptr);
|
||||||
}
|
}
|
||||||
mCompositionRecorder->WriteCollectedFrames();
|
mCompositionRecorder->WriteCollectedFrames();
|
||||||
mCompositionRecorder.reset(nullptr);
|
mCompositionRecorder = nullptr;
|
||||||
return IPC_OK();
|
return IPC_OK();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
#include "mozilla/gfx/Point.h" // for IntSize
|
#include "mozilla/gfx/Point.h" // for IntSize
|
||||||
#include "mozilla/ipc/ProtocolUtils.h"
|
#include "mozilla/ipc/ProtocolUtils.h"
|
||||||
#include "mozilla/ipc/SharedMemory.h"
|
#include "mozilla/ipc/SharedMemory.h"
|
||||||
|
#include "mozilla/layers/CompositionRecorder.h"
|
||||||
#include "mozilla/layers/CompositorController.h"
|
#include "mozilla/layers/CompositorController.h"
|
||||||
#include "mozilla/layers/CompositorOptions.h"
|
#include "mozilla/layers/CompositorOptions.h"
|
||||||
#include "mozilla/layers/CompositorVsyncSchedulerOwner.h"
|
#include "mozilla/layers/CompositorVsyncSchedulerOwner.h"
|
||||||
|
@ -72,7 +73,6 @@ class APZSampler;
|
||||||
class APZUpdater;
|
class APZUpdater;
|
||||||
class AsyncCompositionManager;
|
class AsyncCompositionManager;
|
||||||
class AsyncImagePipelineManager;
|
class AsyncImagePipelineManager;
|
||||||
class CompositionRecorder;
|
|
||||||
class Compositor;
|
class Compositor;
|
||||||
class CompositorAnimationStorage;
|
class CompositorAnimationStorage;
|
||||||
class CompositorBridgeParent;
|
class CompositorBridgeParent;
|
||||||
|
@ -767,7 +767,7 @@ class CompositorBridgeParent final : public CompositorBridgeParentBase,
|
||||||
// mSelfRef is cleared in DeferredDestroy which is scheduled by ActorDestroy.
|
// mSelfRef is cleared in DeferredDestroy which is scheduled by ActorDestroy.
|
||||||
RefPtr<CompositorBridgeParent> mSelfRef;
|
RefPtr<CompositorBridgeParent> mSelfRef;
|
||||||
RefPtr<CompositorAnimationStorage> mAnimationStorage;
|
RefPtr<CompositorAnimationStorage> mAnimationStorage;
|
||||||
UniquePtr<CompositionRecorder> mCompositionRecorder;
|
RefPtr<CompositionRecorder> mCompositionRecorder;
|
||||||
|
|
||||||
TimeDuration mPaintTime;
|
TimeDuration mPaintTime;
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче