Bug 1284350. Backed out changeset bb3bf463c0ec (Bug 1261554 (Part 3) - Visualize Visibility::IN_DISPLAYPORT regions in the APZ minimap visibility debugger. r=botond)

This commit is contained in:
Timothy Nikkel 2016-09-12 00:19:08 -05:00
Родитель 391116c2ba
Коммит c630475661
11 изменённых файлов: 74 добавлений и 186 удалений

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

@ -215,22 +215,6 @@ ContainerPrepare(ContainerT* aContainer,
}
}
template <typename RectPainter> void
DrawRegion(CSSIntRegion* aRegion,
gfx::Color aColor,
const RectPainter& aRectPainter)
{
MOZ_ASSERT(aRegion);
// Iterate through and draw the rects in the region using the provided lambda.
for (CSSIntRegion::RectIterator iterator = aRegion->RectIter();
!iterator.Done();
iterator.Next())
{
aRectPainter(iterator.Get(), aColor);
}
}
template<class ContainerT> void
RenderMinimap(ContainerT* aContainer, LayerManagerComposite* aManager,
const RenderTargetIntRect& aClipRect, Layer* aLayer)
@ -258,8 +242,7 @@ RenderMinimap(ContainerT* aContainer, LayerManagerComposite* aManager,
gfx::Color criticalDisplayPortColor(1.f, 1.f, 0);
gfx::Color displayPortColor(0, 1.f, 0);
gfx::Color viewPortColor(0, 0, 1.f, 0.3f);
gfx::Color approxVisibilityColor(1.f, 0, 0);
gfx::Color inDisplayPortVisibilityColor(1.f, 1.f, 0);
gfx::Color visibilityColor(1.f, 0, 0);
// Rects
const FrameMetrics& fm = aLayer->GetFrameMetrics(0);
@ -316,21 +299,23 @@ RenderMinimap(ContainerT* aContainer, LayerManagerComposite* aManager,
ScrollableLayerGuid guid = controller->GetGuid();
auto rectPainter = [&](const CSSIntRect& aRect, const gfx::Color& aColor) {
LayerRect scaledRect = aRect * fm.LayersPixelsPerCSSPixel();
// Get the approximately visible region.
static CSSIntRegion emptyRegion;
CSSIntRegion* visibleRegion = aManager->GetApproximatelyVisibleRegion(guid);
if (!visibleRegion) {
visibleRegion = &emptyRegion;
}
// Iterate through and draw the rects in the region.
for (CSSIntRegion::RectIterator iterator = visibleRegion->RectIter();
!iterator.Done();
iterator.Next())
{
CSSIntRect rect = iterator.Get();
LayerRect scaledRect = rect * fm.LayersPixelsPerCSSPixel();
Rect r = transform.TransformBounds(scaledRect.ToUnknownRect());
compositor->FillRect(r, aColor, clipRect, aContainer->GetEffectiveTransform());
};
// Draw the approximately visible region.
CSSIntRegion* approxVisibleRegion =
aManager->GetVisibleRegion(VisibilityCounter::MAY_BECOME_VISIBLE, guid);
DrawRegion(approxVisibleRegion, approxVisibilityColor, rectPainter);
// Draw the in-displayport visible region.
CSSIntRegion* inDisplayPortVisibleRegion =
aManager->GetVisibleRegion(VisibilityCounter::IN_DISPLAYPORT, guid);
DrawRegion(inDisplayPortVisibleRegion, inDisplayPortVisibilityColor, rectPainter);
compositor->FillRect(r, visibilityColor, clipRect, aContainer->GetEffectiveTransform());
}
}
// Render the displayport.

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

@ -33,7 +33,6 @@
#include "nsRegion.h" // for nsIntRegion
#include "nscore.h" // for nsAString, etc
#include "LayerTreeInvalidation.h"
#include "Visibility.h"
class gfxContext;
@ -212,17 +211,10 @@ public:
mInvalidRegion.Or(mInvalidRegion, aRegion);
}
void ClearVisibleRegions(uint64_t aLayersId,
const Maybe<uint32_t>& aPresShellId)
void ClearApproximatelyVisibleRegions(uint64_t aLayersId,
const Maybe<uint32_t>& aPresShellId)
{
for (auto iter = mApproximatelyVisibleRegions.Iter(); !iter.Done(); iter.Next()) {
if (iter.Key().mLayersId == aLayersId &&
(!aPresShellId || iter.Key().mPresShellId == *aPresShellId)) {
iter.Remove();
}
}
for (auto iter = mInDisplayPortVisibleRegions.Iter(); !iter.Done(); iter.Next()) {
for (auto iter = mVisibleRegions.Iter(); !iter.Done(); iter.Next()) {
if (iter.Key().mLayersId == aLayersId &&
(!aPresShellId || iter.Key().mPresShellId == *aPresShellId)) {
iter.Remove();
@ -230,35 +222,18 @@ public:
}
}
void UpdateVisibleRegion(VisibilityCounter aCounter,
const ScrollableLayerGuid& aGuid,
const CSSIntRegion& aRegion)
void UpdateApproximatelyVisibleRegion(const ScrollableLayerGuid& aGuid,
const CSSIntRegion& aRegion)
{
VisibleRegions& regions = aCounter == VisibilityCounter::MAY_BECOME_VISIBLE
? mApproximatelyVisibleRegions
: mInDisplayPortVisibleRegions;
CSSIntRegion* regionForScrollFrame = regions.LookupOrAdd(aGuid);
CSSIntRegion* regionForScrollFrame = mVisibleRegions.LookupOrAdd(aGuid);
MOZ_ASSERT(regionForScrollFrame);
*regionForScrollFrame = aRegion;
}
CSSIntRegion* GetVisibleRegion(VisibilityCounter aCounter,
const ScrollableLayerGuid& aGuid)
CSSIntRegion* GetApproximatelyVisibleRegion(const ScrollableLayerGuid& aGuid)
{
static CSSIntRegion emptyRegion;
VisibleRegions& regions = aCounter == VisibilityCounter::MAY_BECOME_VISIBLE
? mApproximatelyVisibleRegions
: mInDisplayPortVisibleRegions;
CSSIntRegion* region = regions.Get(aGuid);
if (!region) {
region = &emptyRegion;
}
return region;
return mVisibleRegions.Get(aGuid);
}
Compositor* GetCompositor() const
@ -399,8 +374,7 @@ private:
typedef nsClassHashtable<nsGenericHashKey<ScrollableLayerGuid>,
CSSIntRegion> VisibleRegions;
VisibleRegions mApproximatelyVisibleRegions;
VisibleRegions mInDisplayPortVisibleRegions;
VisibleRegions mVisibleRegions;
UniquePtr<FPSState> mFPS;

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

@ -802,26 +802,26 @@ CompositorBridgeChild::SendRequestNotifyAfterRemotePaint()
}
bool
CompositorBridgeChild::SendClearVisibleRegions(uint64_t aLayersId,
uint32_t aPresShellId)
CompositorBridgeChild::SendClearApproximatelyVisibleRegions(uint64_t aLayersId,
uint32_t aPresShellId)
{
MOZ_ASSERT(mCanSend);
if (!mCanSend) {
return true;
}
return PCompositorBridgeChild::SendClearVisibleRegions(aLayersId, aPresShellId);
return PCompositorBridgeChild::SendClearApproximatelyVisibleRegions(aLayersId,
aPresShellId);
}
bool
CompositorBridgeChild::SendUpdateVisibleRegion(VisibilityCounter aCounter,
const ScrollableLayerGuid& aGuid,
const CSSIntRegion& aRegion)
CompositorBridgeChild::SendNotifyApproximatelyVisibleRegion(const ScrollableLayerGuid& aGuid,
const CSSIntRegion& aRegion)
{
MOZ_ASSERT(mCanSend);
if (!mCanSend) {
return true;
}
return PCompositorBridgeChild::SendUpdateVisibleRegion(aCounter, aGuid, aRegion);
return PCompositorBridgeChild::SendNotifyApproximatelyVisibleRegion(aGuid, aRegion);
}
PTextureChild*

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

@ -160,10 +160,9 @@ public:
bool SendStopFrameTimeRecording(const uint32_t& startIndex, nsTArray<float>* intervals);
bool SendNotifyRegionInvalidated(const nsIntRegion& region);
bool SendRequestNotifyAfterRemotePaint();
bool SendClearVisibleRegions(uint64_t aLayersId, uint32_t aPresShellId);
bool SendUpdateVisibleRegion(VisibilityCounter aCounter,
const ScrollableLayerGuid& aGuid,
const mozilla::CSSIntRegion& aRegion);
bool SendClearApproximatelyVisibleRegions(uint64_t aLayersId, uint32_t aPresShellId);
bool SendNotifyApproximatelyVisibleRegion(const ScrollableLayerGuid& aGuid,
const mozilla::CSSIntRegion& aRegion);
bool IsSameProcess() const override;
virtual bool IPCOpen() const override { return mCanSend; }

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

@ -946,19 +946,19 @@ CompositorBridgeParent::RecvStopFrameTimeRecording(const uint32_t& aStartIndex,
}
bool
CompositorBridgeParent::RecvClearVisibleRegions(const uint64_t& aLayersId,
const uint32_t& aPresShellId)
CompositorBridgeParent::RecvClearApproximatelyVisibleRegions(const uint64_t& aLayersId,
const uint32_t& aPresShellId)
{
ClearVisibleRegions(aLayersId, Some(aPresShellId));
ClearApproximatelyVisibleRegions(aLayersId, Some(aPresShellId));
return true;
}
void
CompositorBridgeParent::ClearVisibleRegions(const uint64_t& aLayersId,
const Maybe<uint32_t>& aPresShellId)
CompositorBridgeParent::ClearApproximatelyVisibleRegions(const uint64_t& aLayersId,
const Maybe<uint32_t>& aPresShellId)
{
if (mLayerManager) {
mLayerManager->ClearVisibleRegions(aLayersId, aPresShellId);
mLayerManager->ClearApproximatelyVisibleRegions(aLayersId, aPresShellId);
// We need to recomposite to update the minimap.
ScheduleComposition();
@ -966,25 +966,16 @@ CompositorBridgeParent::ClearVisibleRegions(const uint64_t& aLayersId,
}
bool
CompositorBridgeParent::RecvUpdateVisibleRegion(const VisibilityCounter& aCounter,
const ScrollableLayerGuid& aGuid,
const CSSIntRegion& aRegion)
{
UpdateVisibleRegion(aCounter, aGuid, aRegion);
return true;
}
void
CompositorBridgeParent::UpdateVisibleRegion(const VisibilityCounter& aCounter,
const ScrollableLayerGuid& aGuid,
const CSSIntRegion& aRegion)
CompositorBridgeParent::RecvNotifyApproximatelyVisibleRegion(const ScrollableLayerGuid& aGuid,
const CSSIntRegion& aRegion)
{
if (mLayerManager) {
mLayerManager->UpdateVisibleRegion(aCounter, aGuid, aRegion);
mLayerManager->UpdateApproximatelyVisibleRegion(aGuid, aRegion);
// We need to recomposite to update the minimap.
ScheduleComposition();
}
return true;
}
void
@ -1929,7 +1920,7 @@ EraseLayerState(uint64_t aId)
if (iter != sIndirectLayerTrees.end()) {
CompositorBridgeParent* parent = iter->second.mParent;
if (parent) {
parent->ClearVisibleRegions(aId, Nothing());
parent->ClearApproximatelyVisibleRegions(aId, Nothing());
}
sIndirectLayerTrees.erase(iter);
@ -2152,38 +2143,31 @@ public:
virtual bool RecvStartFrameTimeRecording(const int32_t& aBufferSize, uint32_t* aOutStartIndex) override { return true; }
virtual bool RecvStopFrameTimeRecording(const uint32_t& aStartIndex, InfallibleTArray<float>* intervals) override { return true; }
virtual bool RecvClearVisibleRegions(const uint64_t& aLayersId,
const uint32_t& aPresShellId) override
virtual bool RecvClearApproximatelyVisibleRegions(const uint64_t& aLayersId,
const uint32_t& aPresShellId) override
{
CompositorBridgeParent* parent;
{ // scope lock
MonitorAutoLock lock(*sIndirectLayerTreesLock);
parent = sIndirectLayerTrees[aLayersId].mParent;
}
if (!parent) {
return false;
if (parent) {
parent->ClearApproximatelyVisibleRegions(aLayersId, Some(aPresShellId));
}
parent->ClearVisibleRegions(aLayersId, Some(aPresShellId));
return true;
}
virtual bool RecvUpdateVisibleRegion(const VisibilityCounter& aCounter,
const ScrollableLayerGuid& aGuid,
const CSSIntRegion& aRegion) override
virtual bool RecvNotifyApproximatelyVisibleRegion(const ScrollableLayerGuid& aGuid,
const CSSIntRegion& aRegion) override
{
CompositorBridgeParent* parent;
{ // scope lock
MonitorAutoLock lock(*sIndirectLayerTreesLock);
parent = sIndirectLayerTrees[aGuid.mLayersId].mParent;
}
if (!parent) {
return false;
if (parent) {
return parent->RecvNotifyApproximatelyVisibleRegion(aGuid, aRegion);
}
parent->UpdateVisibleRegion(aCounter, aGuid, aRegion);
return true;
}

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

@ -304,16 +304,12 @@ public:
// @see CrossProcessCompositorBridgeParent::RecvRequestNotifyAfterRemotePaint
virtual bool RecvRequestNotifyAfterRemotePaint() override { return true; };
virtual bool RecvClearVisibleRegions(const uint64_t& aLayersId,
const uint32_t& aPresShellId) override;
void ClearVisibleRegions(const uint64_t& aLayersId,
const Maybe<uint32_t>& aPresShellId);
virtual bool RecvUpdateVisibleRegion(const VisibilityCounter& aCounter,
const ScrollableLayerGuid& aGuid,
const CSSIntRegion& aRegion) override;
void UpdateVisibleRegion(const VisibilityCounter& aCounter,
const ScrollableLayerGuid& aGuid,
const CSSIntRegion& aRegion);
virtual bool RecvClearApproximatelyVisibleRegions(const uint64_t& aLayersId,
const uint32_t& aPresShellId) override;
void ClearApproximatelyVisibleRegions(const uint64_t& aLayersId,
const Maybe<uint32_t>& aPresShellId);
virtual bool RecvNotifyApproximatelyVisibleRegion(const ScrollableLayerGuid& aGuid,
const CSSIntRegion& aRegion) override;
virtual bool RecvAllPluginsCaptured() override;

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

@ -32,7 +32,6 @@ using mozilla::ipc::SharedMemoryBasic::Handle from "mozilla/ipc/SharedMemoryBasi
using mozilla::CSSIntRegion from "Units.h";
using mozilla::LayoutDeviceIntPoint from "Units.h";
using mozilla::LayoutDeviceIntRegion from "Units.h";
using mozilla::VisibilityCounter from "VisibilityIPC.h";
using class mozilla::TimeStamp from "mozilla/TimeStamp.h";
using class mozilla::layers::FrameUniformityData from "mozilla/layers/FrameUniformityData.h";
using mozilla::layers::TextureFlags from "mozilla/layers/CompositorTypes.h";
@ -196,18 +195,15 @@ parent:
*/
async RequestNotifyAfterRemotePaint();
// The child sends a request to clear the visible regions (approximate,
// in-displayport, etc.) associated with the provided layers ID and pres shell
// ID (i.e., the regions for all view IDs associated with those IDs).
async ClearVisibleRegions(uint64_t layersId, uint32_t presShellId);
// The child clears the 'approximately visible' regions associated with the
// provided layers ID and pres shell ID (i.e., the regions for all view IDs
// associated with those IDs).
async ClearApproximatelyVisibleRegions(uint64_t layersId, uint32_t presShellId);
// The child sends a region containing rects associated with the provided
// scrollable layer GUID that the child considers visible in the sense
// specified by |counter|.
// scrollable layer GUID that the child considers 'approximately visible'.
// We visualize this information in the APZ minimap.
async UpdateVisibleRegion(VisibilityCounter counter,
ScrollableLayerGuid guid,
CSSIntRegion region);
async NotifyApproximatelyVisibleRegion(ScrollableLayerGuid guid, CSSIntRegion region);
/**
* Sent when the child has finished CaptureAllPlugins.

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

@ -4644,8 +4644,12 @@ PresShell::NotifyCompositorOfVisibleRegionsChange()
return;
}
// XXX(seth): Right now we're just treating MAY_BECOME_VISIBLE and
// IN_DISPLAYPORT regions the same when visualizing them. In part 2 we'll
// update the visualization to display them differently.
// Clear the old visible regions associated with this document.
compositorChild->SendClearVisibleRegions(layersId, presShellId);
compositorChild->SendClearApproximatelyVisibleRegions(layersId, presShellId);
// Send the new visible regions to the compositor.
for (auto iter = mVisibleRegions->mApproximate.ConstIter();
@ -4657,8 +4661,7 @@ PresShell::NotifyCompositorOfVisibleRegionsChange()
const ScrollableLayerGuid guid(layersId, presShellId, viewId);
compositorChild->SendUpdateVisibleRegion(VisibilityCounter::MAY_BECOME_VISIBLE,
guid, *region);
compositorChild->SendNotifyApproximatelyVisibleRegion(guid, *region);
}
for (auto iter = mVisibleRegions->mInDisplayPort.ConstIter();
@ -4670,8 +4673,7 @@ PresShell::NotifyCompositorOfVisibleRegionsChange()
const ScrollableLayerGuid guid(layersId, presShellId, viewId);
compositorChild->SendUpdateVisibleRegion(VisibilityCounter::IN_DISPLAYPORT,
guid, *region);
compositorChild->SendNotifyApproximatelyVisibleRegion(guid, *region);
}
}

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

@ -8,8 +8,6 @@
* possible visibility states of a frame. @OnNonvisible is an enumeration that
* allows callers to request a specific action when a frame transitions from
* visible to nonvisible.
*
* IPC serializers are available in VisibilityIPC.h.
*/
#ifndef mozilla_layout_generic_Visibility_h

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

@ -1,45 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/**
* Declares IPC serializers for the visibility-related types in Visibility.h.
* These are separated out to reduce the number of moz.build files that need to
* include chromium IPC headers, since Visibility.h is included from nsIFrame.h
* which is widely included.
*/
#ifndef mozilla_layout_generic_VisibilityIPC_h
#define mozilla_layout_generic_VisibilityIPC_h
#include "ipc/IPCMessageUtils.h"
#include "Visibility.h"
namespace IPC {
template<>
struct ParamTraits<mozilla::VisibilityCounter>
{
typedef mozilla::VisibilityCounter paramType;
static void Write(Message* aMsg, const paramType& aParam)
{
WriteParam(aMsg, uint8_t(aParam));
}
static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
{
uint8_t valueAsByte;
if (ReadParam(aMsg, aIter, &valueAsByte)) {
*aResult = paramType(valueAsByte);
return true;
}
return false;
}
};
} // namespace IPC
#endif // mozilla_layout_generic_VisibilityIPC_h

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

@ -96,7 +96,6 @@ EXPORTS += [
'ScrollbarActivity.h',
'ScrollSnap.h',
'Visibility.h',
'VisibilityIPC.h',
]
EXPORTS.mozilla += [