Bug 1690216 - Clarify that StartRemoteDrawingInRegion does not actually modify the region. r=mattwoodrow

It caused us substantial confusion investigating this bug under the belief that
StartRemoteDrawingInRegion may have been modifying the dirty region. None of our
existing widget code anymore uses the API in this way, so it makes sense to just
force this dirty region to be const so that we no longer support the assumption
and alleviate confusion in the future about how our widget code actually behaves.

Depends on D106246

Differential Revision: https://phabricator.services.mozilla.com/D106247
This commit is contained in:
Lee Salzman 2021-02-24 18:34:52 +00:00
Родитель 8632afe08c
Коммит 6d0dfe44e3
15 изменённых файлов: 25 добавлений и 17 удалений

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

@ -720,7 +720,7 @@ impl SwCompositeThread {
}
}
fn start_compositing(&self) {
fn prepare_for_composites(&self) {
// Initialize the job count to 1 to prevent spurious signaling of job completion
// in the middle of queuing compositing jobs until we're actually waiting for
// composition.
@ -1693,7 +1693,8 @@ impl Compositor for SwCompositor {
self.locked_framebuffer = self.gl.lock_framebuffer(0);
composite_thread.start_compositing();
composite_thread.prepare_for_composites();
// Issue any initial composite jobs for the SwComposite thread.
let mut lock = composite_thread.lock();
for &(ref id, ref transform, ref clip_rect, filter) in &self.frame_surfaces {
@ -1761,7 +1762,7 @@ impl Compositor for SwCompositor {
// phase. These late surfaces don't have any overlap/dependency tracking,
// so we just queue them directly and wait synchronously for the composite
// thread to process them in order.
composite_thread.start_compositing();
composite_thread.prepare_for_composites();
{
let mut lock = composite_thread.lock();
for &(ref id, ref transform, ref clip_rect, filter) in &self.late_surfaces {

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

@ -137,7 +137,8 @@ class CompositorWidget {
*/
virtual already_AddRefed<gfx::DrawTarget> StartRemoteDrawing();
virtual already_AddRefed<gfx::DrawTarget> StartRemoteDrawingInRegion(
LayoutDeviceIntRegion& aInvalidRegion, layers::BufferMode* aBufferMode) {
const LayoutDeviceIntRegion& aInvalidRegion,
layers::BufferMode* aBufferMode) {
return StartRemoteDrawing();
}

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

@ -67,7 +67,8 @@ InProcessCompositorWidget::StartRemoteDrawing() {
already_AddRefed<gfx::DrawTarget>
InProcessCompositorWidget::StartRemoteDrawingInRegion(
LayoutDeviceIntRegion& aInvalidRegion, layers::BufferMode* aBufferMode) {
const LayoutDeviceIntRegion& aInvalidRegion,
layers::BufferMode* aBufferMode) {
return mWidget->StartRemoteDrawingInRegion(aInvalidRegion, aBufferMode);
}

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

@ -22,7 +22,7 @@ class InProcessCompositorWidget : public CompositorWidget {
virtual RefPtr<layers::NativeLayerRoot> GetNativeLayerRoot() override;
virtual already_AddRefed<gfx::DrawTarget> StartRemoteDrawing() override;
virtual already_AddRefed<gfx::DrawTarget> StartRemoteDrawingInRegion(
LayoutDeviceIntRegion& aInvalidRegion,
const LayoutDeviceIntRegion& aInvalidRegion,
layers::BufferMode* aBufferMode) override;
virtual void EndRemoteDrawing() override;
virtual void EndRemoteDrawingInRegion(

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

@ -24,7 +24,8 @@ AndroidCompositorWidget::~AndroidCompositorWidget() {
already_AddRefed<gfx::DrawTarget>
AndroidCompositorWidget::StartRemoteDrawingInRegion(
LayoutDeviceIntRegion& aInvalidRegion, layers::BufferMode* aBufferMode) {
const LayoutDeviceIntRegion& aInvalidRegion,
layers::BufferMode* aBufferMode) {
if (!mNativeWindow) {
EGLNativeWindowType window = GetEGLNativeWindow();
JNIEnv* const env = jni::GetEnvForThread();

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

@ -27,7 +27,7 @@ class AndroidCompositorWidget final : public InProcessCompositorWidget {
nsBaseWidget* aWidget);
already_AddRefed<gfx::DrawTarget> StartRemoteDrawingInRegion(
LayoutDeviceIntRegion& aInvalidRegion,
const LayoutDeviceIntRegion& aInvalidRegion,
layers::BufferMode* aBufferMode) override;
void EndRemoteDrawingInRegion(
gfx::DrawTarget* aDrawTarget,

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

@ -76,7 +76,8 @@ void GtkCompositorWidget::EndRemoteDrawing() {}
already_AddRefed<gfx::DrawTarget>
GtkCompositorWidget::StartRemoteDrawingInRegion(
LayoutDeviceIntRegion& aInvalidRegion, layers::BufferMode* aBufferMode) {
const LayoutDeviceIntRegion& aInvalidRegion,
layers::BufferMode* aBufferMode) {
return mProvider.StartRemoteDrawingInRegion(aInvalidRegion, aBufferMode);
}

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

@ -45,7 +45,7 @@ class GtkCompositorWidget : public CompositorWidget,
void EndRemoteDrawing() override;
already_AddRefed<gfx::DrawTarget> StartRemoteDrawingInRegion(
LayoutDeviceIntRegion& aInvalidRegion,
const LayoutDeviceIntRegion& aInvalidRegion,
layers::BufferMode* aBufferMode) override;
void EndRemoteDrawingInRegion(
gfx::DrawTarget* aDrawTarget,

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

@ -99,7 +99,8 @@ UniquePtr<WindowSurface> WindowSurfaceProvider::CreateWindowSurface() {
already_AddRefed<gfx::DrawTarget>
WindowSurfaceProvider::StartRemoteDrawingInRegion(
LayoutDeviceIntRegion& aInvalidRegion, layers::BufferMode* aBufferMode) {
const LayoutDeviceIntRegion& aInvalidRegion,
layers::BufferMode* aBufferMode) {
if (aInvalidRegion.IsEmpty()) return nullptr;
if (!mWindowSurface) {

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

@ -55,7 +55,8 @@ class WindowSurfaceProvider final {
void CleanupResources();
already_AddRefed<gfx::DrawTarget> StartRemoteDrawingInRegion(
LayoutDeviceIntRegion& aInvalidRegion, layers::BufferMode* aBufferMode);
const LayoutDeviceIntRegion& aInvalidRegion,
layers::BufferMode* aBufferMode);
void EndRemoteDrawingInRegion(gfx::DrawTarget* aDrawTarget,
const LayoutDeviceIntRegion& aInvalidRegion);

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

@ -7480,7 +7480,7 @@ bool nsWindow::GetEditCommands(NativeKeyBindingsType aType,
}
already_AddRefed<DrawTarget> nsWindow::StartRemoteDrawingInRegion(
LayoutDeviceIntRegion& aInvalidRegion, BufferMode* aBufferMode) {
const LayoutDeviceIntRegion& aInvalidRegion, BufferMode* aBufferMode) {
return mSurfaceProvider.StartRemoteDrawingInRegion(aInvalidRegion,
aBufferMode);
}

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

@ -229,7 +229,7 @@ class nsWindow final : public nsBaseWidget {
void UpdateTopLevelOpaqueRegion();
virtual already_AddRefed<mozilla::gfx::DrawTarget> StartRemoteDrawingInRegion(
LayoutDeviceIntRegion& aInvalidRegion,
const LayoutDeviceIntRegion& aInvalidRegion,
mozilla::layers::BufferMode* aBufferMode) override;
virtual void EndRemoteDrawingInRegion(
mozilla::gfx::DrawTarget* aDrawTarget,

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

@ -442,7 +442,7 @@ class nsBaseWidget : public nsIWidget, public nsSupportsWeakReference {
}
virtual already_AddRefed<DrawTarget> StartRemoteDrawing();
virtual already_AddRefed<DrawTarget> StartRemoteDrawingInRegion(
LayoutDeviceIntRegion& aInvalidRegion, BufferMode* aBufferMode) {
const LayoutDeviceIntRegion& aInvalidRegion, BufferMode* aBufferMode) {
return StartRemoteDrawing();
}
virtual void EndRemoteDrawing() {}

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

@ -76,7 +76,8 @@ LayoutDeviceIntSize CompositorWidgetParent::GetClientSize() {
already_AddRefed<gfx::DrawTarget>
CompositorWidgetParent::StartRemoteDrawingInRegion(
LayoutDeviceIntRegion& aInvalidRegion, layers::BufferMode* aBufferMode) {
const LayoutDeviceIntRegion& aInvalidRegion,
layers::BufferMode* aBufferMode) {
MOZ_ASSERT(mRemoteBackbufferClient);
MOZ_ASSERT(aBufferMode);

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

@ -29,7 +29,7 @@ class CompositorWidgetParent final : public PCompositorWidgetParent,
bool PreRender(WidgetRenderingContext*) override;
void PostRender(WidgetRenderingContext*) override;
already_AddRefed<gfx::DrawTarget> StartRemoteDrawingInRegion(
LayoutDeviceIntRegion& aInvalidRegion,
const LayoutDeviceIntRegion& aInvalidRegion,
layers::BufferMode* aBufferMode) override;
void EndRemoteDrawingInRegion(
gfx::DrawTarget* aDrawTarget,