mirror of
https://github.com/roytam1/palemoon27.git
synced 2026-05-26 14:18:48 +00:00
081721a2da
- reapply Bug 1574573 - Disambiguate a use of Handle in XPCShellEnvironment.cpp r=Ehsan (a674c4b006) - Bug 1255707 - Part 2. Remove ScreenSizeChanged. r=snorp (3a93e4e768) - Bug 1250418 - Remove the assertion check of mCanSend in CompositorCh ld::ActorDestroy, r=nical (14bb402a1d) - Bug 1250718 - Improve layer logging for preserve-3d layers. r=thinker (f373a50040) - Bug 1232042 - Addendum: Add comment for mLayerManager check. r=jrmuizel (2b69aa784a) - Bug 1239861. Skip composite if vsync time is before force composite time. r=kats (5ee4038157) - Bug 1241678 - Fix low-volume null-deref crash. r=BenWa (b28d944615) - Rename PCompositor to PCompositorBridge. (bug 1258479 part 2, r=mattwoodrow) (dd535a9bdd) - Bug 1220184 - Eliminate Gingerbread compatibility. r=froydnj, r=nalexander (dce9e4f9e8) - Bug 1250917 - Remove NS_SUCCESS_I_DID_SOMETHING; r=bholley (9dd6fe351b) - Bug 1155241: Check mInstanceOwner for nullptr in nsObjectLoadingContent::PluginDestroyed; r=smaug (ad60991e3e) - Bug 1229220 - Update the scrollbar visibility prefs when initializing a TabChild; r=smaug (28997e0a6d) - Bug 1252262 - Don't combine the client offset into the outer rect for the child process. r=jimm (f415c0418e) - Bug 1249943 - Make test_basic_pan work on Fennec and Linux as well. r=botond (657c940be1) - bit of bug 1245765 part 5 (82463f7eaa) - Bug 1207512 - Remove the JS_IsRunning call in nsObjectLoadingContent::ScriptRequestPluginInstance; r=bholley (76047284a6) - Bug 1239463 - Do not assert when notifying an inactive document about changed content from the plugin crash notification. r=bz (03bf38a683) - Bug 1192450 - Remove PlayPreview registration from Shumway. r=jet (9b6e131876) - Bug 1200602 - Use the alternate content for <applet>. r=kmachulis (843fccf0aa)
215 lines
8.1 KiB
C++
215 lines
8.1 KiB
C++
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
/* vim: set sw=2 ts=8 et tw=80 : */
|
|
/* 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/. */
|
|
|
|
#ifndef mozilla_layers_CompositorBridgeChild_h
|
|
#define mozilla_layers_CompositorBridgeChild_h
|
|
|
|
#include "base/basictypes.h" // for DISALLOW_EVIL_CONSTRUCTORS
|
|
#include "mozilla/Assertions.h" // for MOZ_ASSERT_HELPER2
|
|
#include "mozilla/Attributes.h" // for override
|
|
#include "mozilla/ipc/ProtocolUtils.h"
|
|
#include "mozilla/layers/PCompositorBridgeChild.h"
|
|
#include "nsAutoPtr.h" // for nsRefPtr
|
|
#include "nsClassHashtable.h" // for nsClassHashtable
|
|
#include "nsCOMPtr.h" // for nsCOMPtr
|
|
#include "nsHashKeys.h" // for nsUint64HashKey
|
|
#include "nsISupportsImpl.h" // for NS_INLINE_DECL_REFCOUNTING
|
|
#include "ThreadSafeRefcountingWithMainThreadDestruction.h"
|
|
#include "nsWeakReference.h"
|
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
class TabChild;
|
|
} // namespace dom
|
|
|
|
namespace layers {
|
|
|
|
using mozilla::dom::TabChild;
|
|
|
|
class ClientLayerManager;
|
|
class CompositorBridgeParent;
|
|
struct FrameMetrics;
|
|
|
|
class CompositorBridgeChild final : public PCompositorBridgeChild
|
|
{
|
|
NS_INLINE_DECL_THREADSAFE_REFCOUNTING_WITH_MAIN_THREAD_DESTRUCTION(CompositorBridgeChild)
|
|
|
|
public:
|
|
explicit CompositorBridgeChild(ClientLayerManager *aLayerManager);
|
|
|
|
void Destroy();
|
|
|
|
/**
|
|
* Lookup the FrameMetrics shared by the compositor process with the
|
|
* associated FrameMetrics::ViewID. The returned FrameMetrics is used
|
|
* in progressive paint calculations.
|
|
*/
|
|
bool LookupCompositorFrameMetrics(const FrameMetrics::ViewID aId, FrameMetrics&);
|
|
|
|
/**
|
|
* We're asked to create a new Compositor in response to an Opens()
|
|
* or Bridge() request from our parent process. The Transport is to
|
|
* the compositor's context.
|
|
*/
|
|
static PCompositorBridgeChild*
|
|
Create(Transport* aTransport, ProcessId aOtherProcess);
|
|
|
|
/**
|
|
* Initialize the CompositorBridgeChild and open the connection in the non-multi-process
|
|
* case.
|
|
*/
|
|
bool OpenSameProcess(CompositorBridgeParent* aParent);
|
|
|
|
static CompositorBridgeChild* Get();
|
|
|
|
static bool ChildProcessHasCompositor() { return sCompositor != nullptr; }
|
|
|
|
void AddOverfillObserver(ClientLayerManager* aLayerManager);
|
|
|
|
virtual bool
|
|
RecvClearCachedResources(const uint64_t& id) override;
|
|
|
|
virtual bool
|
|
RecvDidComposite(const uint64_t& aId, const uint64_t& aTransactionId,
|
|
const TimeStamp& aCompositeStart,
|
|
const TimeStamp& aCompositeEnd) override;
|
|
|
|
virtual bool
|
|
RecvInvalidateLayers(const uint64_t& aLayersId) override;
|
|
|
|
virtual bool
|
|
RecvCompositorUpdated(const uint64_t& aLayersId,
|
|
const TextureFactoryIdentifier& aNewIdentifier) override;
|
|
|
|
virtual bool
|
|
RecvOverfill(const uint32_t &aOverfill) override;
|
|
|
|
virtual bool
|
|
RecvUpdatePluginConfigurations(const LayoutDeviceIntPoint& aContentOffset,
|
|
const LayoutDeviceIntRegion& aVisibleRegion,
|
|
nsTArray<PluginWindowData>&& aPlugins) override;
|
|
|
|
virtual bool
|
|
RecvHideAllPlugins(const uintptr_t& aParentWidget) override;
|
|
|
|
/**
|
|
* Request that the parent tell us when graphics are ready on GPU.
|
|
* When we get that message, we bounce it to the TabParent via
|
|
* the TabChild
|
|
* @param tabChild The object to bounce the note to. Non-NULL.
|
|
*/
|
|
void RequestNotifyAfterRemotePaint(TabChild* aTabChild);
|
|
|
|
void CancelNotifyAfterRemotePaint(TabChild* aTabChild);
|
|
|
|
// Beware that these methods don't override their super-class equivalent (which
|
|
// are not virtual), they just overload them.
|
|
// All of these Send* methods just add a sanity check (that it is not too late
|
|
// send a message) and forward the call to the super-class's equivalent method.
|
|
// This means that it is correct to call directly the super-class methods, but
|
|
// you won't get the extra safety provided here.
|
|
bool SendWillStop();
|
|
bool SendPause();
|
|
bool SendResume();
|
|
bool SendNotifyHidden(const uint64_t& id);
|
|
bool SendNotifyVisible(const uint64_t& id);
|
|
bool SendNotifyChildCreated(const uint64_t& id);
|
|
bool SendAdoptChild(const uint64_t& id);
|
|
bool SendMakeSnapshot(const SurfaceDescriptor& inSnapshot, const gfx::IntRect& dirtyRect);
|
|
bool SendFlushRendering();
|
|
bool SendGetTileSize(int32_t* tileWidth, int32_t* tileHeight);
|
|
bool SendStartFrameTimeRecording(const int32_t& bufferSize, uint32_t* startIndex);
|
|
bool SendStopFrameTimeRecording(const uint32_t& startIndex, nsTArray<float>* intervals);
|
|
bool SendNotifyRegionInvalidated(const nsIntRegion& region);
|
|
bool SendRequestNotifyAfterRemotePaint();
|
|
bool SendClearApproximatelyVisibleRegions(uint64_t aLayersId, uint32_t aPresShellId);
|
|
bool SendNotifyApproximatelyVisibleRegion(const ScrollableLayerGuid& aGuid,
|
|
const mozilla::CSSIntRegion& aRegion);
|
|
|
|
private:
|
|
// Private destructor, to discourage deletion outside of Release():
|
|
virtual ~CompositorBridgeChild();
|
|
|
|
virtual PLayerTransactionChild*
|
|
AllocPLayerTransactionChild(const nsTArray<LayersBackend>& aBackendHints,
|
|
const uint64_t& aId,
|
|
TextureFactoryIdentifier* aTextureFactoryIdentifier,
|
|
bool* aSuccess) override;
|
|
|
|
virtual bool DeallocPLayerTransactionChild(PLayerTransactionChild *aChild) override;
|
|
|
|
virtual void ActorDestroy(ActorDestroyReason aWhy) override;
|
|
|
|
virtual bool RecvSharedCompositorFrameMetrics(const mozilla::ipc::SharedMemoryBasic::Handle& metrics,
|
|
const CrossProcessMutexHandle& handle,
|
|
const uint64_t& aLayersId,
|
|
const uint32_t& aAPZCId) override;
|
|
|
|
virtual bool RecvReleaseSharedCompositorFrameMetrics(const ViewID& aId,
|
|
const uint32_t& aAPZCId) override;
|
|
|
|
virtual bool
|
|
RecvRemotePaintIsReady() override;
|
|
|
|
// Class used to store the shared FrameMetrics, mutex, and APZCId in a hash table
|
|
class SharedFrameMetricsData {
|
|
public:
|
|
SharedFrameMetricsData(
|
|
const mozilla::ipc::SharedMemoryBasic::Handle& metrics,
|
|
const CrossProcessMutexHandle& handle,
|
|
const uint64_t& aLayersId,
|
|
const uint32_t& aAPZCId);
|
|
|
|
~SharedFrameMetricsData();
|
|
|
|
void CopyFrameMetrics(FrameMetrics* aFrame);
|
|
FrameMetrics::ViewID GetViewID();
|
|
uint64_t GetLayersId() const;
|
|
uint32_t GetAPZCId();
|
|
|
|
private:
|
|
// Pointer to the class that allows access to the shared memory that contains
|
|
// the shared FrameMetrics
|
|
RefPtr<mozilla::ipc::SharedMemoryBasic> mBuffer;
|
|
CrossProcessMutex* mMutex;
|
|
uint64_t mLayersId;
|
|
// Unique ID of the APZC that is sharing the FrameMetrics
|
|
uint32_t mAPZCId;
|
|
};
|
|
|
|
RefPtr<ClientLayerManager> mLayerManager;
|
|
// When not multi-process, hold a reference to the CompositorBridgeParent to keep it
|
|
// alive. This reference should be null in multi-process.
|
|
RefPtr<CompositorBridgeParent> mCompositorBridgeParent;
|
|
|
|
// The ViewID of the FrameMetrics is used as the key for this hash table.
|
|
// While this should be safe to use since the ViewID is unique
|
|
nsClassHashtable<nsUint64HashKey, SharedFrameMetricsData> mFrameMetricsTable;
|
|
|
|
// When we're in a child process, this is the process-global
|
|
// compositor that we use to forward transactions directly to the
|
|
// compositor context in another process.
|
|
static CompositorBridgeChild* sCompositor;
|
|
|
|
// Weakly hold the TabChild that made a request to be alerted when
|
|
// the transaction has been received.
|
|
nsWeakPtr mWeakTabChild; // type is TabChild
|
|
|
|
DISALLOW_EVIL_CONSTRUCTORS(CompositorBridgeChild);
|
|
|
|
// When we receive overfill numbers, notify these client layer managers
|
|
AutoTArray<ClientLayerManager*,0> mOverfillObservers;
|
|
|
|
// True until the beginning of the two-step shutdown sequence of this actor.
|
|
bool mCanSend;
|
|
};
|
|
|
|
} // namespace layers
|
|
} // namespace mozilla
|
|
|
|
#endif // mozilla_layers_CompositorBrigedChild_h
|