mirror of
https://github.com/roytam1/palemoon27.git
synced 2026-05-26 14:18:48 +00:00
1c5959ee6e
- Bug 1125750 - Check the overflow region direction to avoid unnecesary reflow for scrollable frame. (6b5067631) - Bug 1125750 - Add auto test to detect error when using mOuter to check overflow area of a scrollable frame. (4e9c43e31) - override -> MOZ_OVERRIDE (ed1ecc151) - Bug 990907 - Don't add text-overflow markers while being actively scrolled by APZ. (523bc5a3e) - Bug 945584: Part 6 - Implementation of scroll snapping (v10 Patch) (bf64eb0f3) - Bug 945584: Part 7 - Implement Scroll Snapping for Autoscroll, - Triggering scroll snapping at the end of an autoscroll. - This enables text selection to be unencumbered by scroll snapping, while restoring the scroll position to a valid snapping position when the drag operation is completed. (db9ce9811) - Bug 945584: Part 8 - Implement Scroll Snapping for Middle Mouse Button Scrolls (v2 Patch) (06d1b733d) - some MacOS 10.5 Leopard support (6a37f6745) - Bug 945584: Part 9 - Tests for scroll snapping (v4 Patch) (f67175387) - Bug 1102427 - Ensure scroll parents of an active scrollframe are layerized. (910d43ec5) - Bug 1142731 followup. Check isInterpreted() before we call environment(), because of the asmjs lambdas. (29b2acdc7) - Bug 1161627 - part 1 - add move constructor and assignment operator for already_AddRefed&& to RefPtr; This change is prep work for future mass rewriting. (98416d45c) - Bug 1161627 - part 2 - machine-convert TemporaryRef<T> to already_AddRefed<T>; (336e96af7) - Bug 1161627 - part 3 - remove TemporaryRef<T> from RefPtr.h (6c3acdaed) - Bug 940273 - Part 3 - Service Worker Cache webidl. (4b6803d0a) - Bug 940273 - Part 4 - Initial implementation of Service Worker Cache. (74498c108) - Bug 1133861 - Bustage fix. (4a81437c2)
277 lines
7.3 KiB
C++
277 lines
7.3 KiB
C++
/* -*- Mode: C++; tab-width: 20; 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/. */
|
|
|
|
#include "mozilla/layers/CompositableClient.h"
|
|
#include <stdint.h> // for uint64_t, uint32_t
|
|
#include "gfxPlatform.h" // for gfxPlatform
|
|
#include "mozilla/layers/CompositableForwarder.h"
|
|
#include "mozilla/layers/TextureClient.h" // for TextureClient, etc
|
|
#include "mozilla/layers/TextureClientOGL.h"
|
|
#include "mozilla/mozalloc.h" // for operator delete, etc
|
|
#include "mozilla/layers/PCompositableChild.h"
|
|
#ifdef XP_WIN
|
|
#include "gfxWindowsPlatform.h" // for gfxWindowsPlatform
|
|
#include "mozilla/layers/TextureD3D11.h"
|
|
#include "mozilla/layers/TextureD3D9.h"
|
|
#endif
|
|
#include "gfxUtils.h"
|
|
|
|
namespace mozilla {
|
|
namespace layers {
|
|
|
|
using namespace mozilla::gfx;
|
|
|
|
/**
|
|
* IPDL actor used by CompositableClient to match with its corresponding
|
|
* CompositableHost on the compositor side.
|
|
*
|
|
* CompositableChild is owned by a CompositableClient.
|
|
*/
|
|
class CompositableChild : public PCompositableChild
|
|
, public AsyncTransactionTrackersHolder
|
|
{
|
|
public:
|
|
CompositableChild()
|
|
: mCompositableClient(nullptr), mAsyncID(0)
|
|
{
|
|
MOZ_COUNT_CTOR(CompositableChild);
|
|
}
|
|
|
|
virtual ~CompositableChild()
|
|
{
|
|
MOZ_COUNT_DTOR(CompositableChild);
|
|
}
|
|
|
|
virtual void ActorDestroy(ActorDestroyReason) override {
|
|
DestroyAsyncTransactionTrackersHolder();
|
|
if (mCompositableClient) {
|
|
mCompositableClient->mCompositableChild = nullptr;
|
|
}
|
|
}
|
|
|
|
CompositableClient* mCompositableClient;
|
|
|
|
uint64_t mAsyncID;
|
|
};
|
|
|
|
void
|
|
RemoveTextureFromCompositableTracker::ReleaseTextureClient()
|
|
{
|
|
if (mTextureClient &&
|
|
mTextureClient->GetAllocator() &&
|
|
!mTextureClient->GetAllocator()->IsImageBridgeChild())
|
|
{
|
|
TextureClientReleaseTask* task = new TextureClientReleaseTask(mTextureClient);
|
|
RefPtr<ISurfaceAllocator> allocator = mTextureClient->GetAllocator();
|
|
mTextureClient = nullptr;
|
|
allocator->GetMessageLoop()->PostTask(FROM_HERE, task);
|
|
} else {
|
|
mTextureClient = nullptr;
|
|
}
|
|
}
|
|
|
|
/* static */ void
|
|
CompositableClient::TransactionCompleteted(PCompositableChild* aActor, uint64_t aTransactionId)
|
|
{
|
|
CompositableChild* child = static_cast<CompositableChild*>(aActor);
|
|
child->TransactionCompleteted(aTransactionId);
|
|
}
|
|
|
|
/* static */ void
|
|
CompositableClient::HoldUntilComplete(PCompositableChild* aActor, AsyncTransactionTracker* aTracker)
|
|
{
|
|
CompositableChild* child = static_cast<CompositableChild*>(aActor);
|
|
child->HoldUntilComplete(aTracker);
|
|
}
|
|
|
|
/* static */ uint64_t
|
|
CompositableClient::GetTrackersHolderId(PCompositableChild* aActor)
|
|
{
|
|
CompositableChild* child = static_cast<CompositableChild*>(aActor);
|
|
return child->GetId();
|
|
}
|
|
|
|
/* static */ PCompositableChild*
|
|
CompositableClient::CreateIPDLActor()
|
|
{
|
|
return new CompositableChild();
|
|
}
|
|
|
|
/* static */ bool
|
|
CompositableClient::DestroyIPDLActor(PCompositableChild* actor)
|
|
{
|
|
delete actor;
|
|
return true;
|
|
}
|
|
|
|
void
|
|
CompositableClient::InitIPDLActor(PCompositableChild* aActor, uint64_t aAsyncID)
|
|
{
|
|
MOZ_ASSERT(aActor);
|
|
CompositableChild* child = static_cast<CompositableChild*>(aActor);
|
|
mCompositableChild = child;
|
|
child->mCompositableClient = this;
|
|
child->mAsyncID = aAsyncID;
|
|
}
|
|
|
|
/* static */ CompositableClient*
|
|
CompositableClient::FromIPDLActor(PCompositableChild* aActor)
|
|
{
|
|
MOZ_ASSERT(aActor);
|
|
return static_cast<CompositableChild*>(aActor)->mCompositableClient;
|
|
}
|
|
|
|
CompositableClient::CompositableClient(CompositableForwarder* aForwarder,
|
|
TextureFlags aTextureFlags)
|
|
: mCompositableChild(nullptr)
|
|
, mForwarder(aForwarder)
|
|
, mTextureFlags(aTextureFlags)
|
|
{
|
|
MOZ_COUNT_CTOR(CompositableClient);
|
|
}
|
|
|
|
CompositableClient::~CompositableClient()
|
|
{
|
|
MOZ_COUNT_DTOR(CompositableClient);
|
|
Destroy();
|
|
}
|
|
|
|
LayersBackend
|
|
CompositableClient::GetCompositorBackendType() const
|
|
{
|
|
return mForwarder->GetCompositorBackendType();
|
|
}
|
|
|
|
void
|
|
CompositableClient::SetIPDLActor(CompositableChild* aChild)
|
|
{
|
|
mCompositableChild = aChild;
|
|
}
|
|
|
|
PCompositableChild*
|
|
CompositableClient::GetIPDLActor() const
|
|
{
|
|
return mCompositableChild;
|
|
}
|
|
|
|
bool
|
|
CompositableClient::Connect()
|
|
{
|
|
if (!GetForwarder() || GetIPDLActor()) {
|
|
return false;
|
|
}
|
|
GetForwarder()->Connect(this);
|
|
return true;
|
|
}
|
|
|
|
void
|
|
CompositableClient::Destroy()
|
|
{
|
|
if (!mCompositableChild) {
|
|
return;
|
|
}
|
|
// Send pending AsyncMessages before deleting CompositableChild.
|
|
// They might have dependency to the mCompositableChild.
|
|
mForwarder->SendPendingAsyncMessges();
|
|
// Delete CompositableChild.
|
|
mCompositableChild->mCompositableClient = nullptr;
|
|
PCompositableChild::Send__delete__(mCompositableChild);
|
|
mCompositableChild = nullptr;
|
|
}
|
|
|
|
uint64_t
|
|
CompositableClient::GetAsyncID() const
|
|
{
|
|
if (mCompositableChild) {
|
|
return mCompositableChild->mAsyncID;
|
|
}
|
|
return 0; // zero is always an invalid async ID
|
|
}
|
|
|
|
already_AddRefed<BufferTextureClient>
|
|
CompositableClient::CreateBufferTextureClient(gfx::SurfaceFormat aFormat,
|
|
gfx::IntSize aSize,
|
|
gfx::BackendType aMoz2DBackend,
|
|
TextureFlags aTextureFlags)
|
|
{
|
|
return TextureClient::CreateForRawBufferAccess(GetForwarder(),
|
|
aFormat, aSize, aMoz2DBackend,
|
|
aTextureFlags | mTextureFlags);
|
|
}
|
|
|
|
already_AddRefed<TextureClient>
|
|
CompositableClient::CreateTextureClientForDrawing(gfx::SurfaceFormat aFormat,
|
|
gfx::IntSize aSize,
|
|
gfx::BackendType aMoz2DBackend,
|
|
TextureFlags aTextureFlags,
|
|
TextureAllocationFlags aAllocFlags)
|
|
{
|
|
return TextureClient::CreateForDrawing(GetForwarder(),
|
|
aFormat, aSize, aMoz2DBackend,
|
|
aTextureFlags | mTextureFlags,
|
|
aAllocFlags);
|
|
}
|
|
|
|
bool
|
|
CompositableClient::AddTextureClient(TextureClient* aClient)
|
|
{
|
|
if(!aClient || !aClient->IsAllocated()) {
|
|
return false;
|
|
}
|
|
aClient->SetAddedToCompositableClient();
|
|
return aClient->InitIPDLActor(mForwarder);
|
|
}
|
|
|
|
void
|
|
CompositableClient::OnTransaction()
|
|
{
|
|
}
|
|
|
|
void
|
|
CompositableClient::ClearCachedResources()
|
|
{
|
|
if (mTextureClientRecycler) {
|
|
mTextureClientRecycler = nullptr;
|
|
}
|
|
}
|
|
|
|
void
|
|
CompositableClient::RemoveTexture(TextureClient* aTexture)
|
|
{
|
|
mForwarder->RemoveTextureFromCompositable(this, aTexture);
|
|
}
|
|
|
|
TextureClientRecycleAllocator*
|
|
CompositableClient::GetTextureClientRecycler()
|
|
{
|
|
if (mTextureClientRecycler) {
|
|
return mTextureClientRecycler;
|
|
}
|
|
|
|
if (!mForwarder) {
|
|
return nullptr;
|
|
}
|
|
|
|
mTextureClientRecycler =
|
|
new layers::TextureClientRecycleAllocator(mForwarder);
|
|
return mTextureClientRecycler;
|
|
}
|
|
|
|
void
|
|
CompositableClient::DumpTextureClient(std::stringstream& aStream, TextureClient* aTexture)
|
|
{
|
|
if (!aTexture) {
|
|
return;
|
|
}
|
|
RefPtr<gfx::DataSourceSurface> dSurf = aTexture->GetAsSurface();
|
|
if (!dSurf) {
|
|
return;
|
|
}
|
|
aStream << gfxUtils::GetAsLZ4Base64Str(dSurf).get();
|
|
}
|
|
|
|
} // namespace layers
|
|
} // namespace mozilla
|