mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-18 06:45:33 +00:00
Move CompositorBridgeParent::CompositorLoop to CompositorThreadHolder. (bug 1273017 part 2, r=mattwoodrow)
This commit is contained in:
parent
a6d9f5b888
commit
03a3af51b6
@ -86,6 +86,7 @@
|
||||
#include "mozilla/jsipc/CrossProcessObjectWrappers.h"
|
||||
#include "mozilla/layers/PAPZParent.h"
|
||||
#include "mozilla/layers/CompositorBridgeParent.h"
|
||||
#include "mozilla/layers/CompositorThread.h"
|
||||
#include "mozilla/layers/ImageBridgeParent.h"
|
||||
#include "mozilla/layers/SharedBufferManagerParent.h"
|
||||
#include "mozilla/layout/RenderFrameParent.h"
|
||||
@ -2558,7 +2559,7 @@ ContentParent::InitInternal(ProcessPriority aInitialPriority,
|
||||
// PBrowsers are created, because they rely on the Compositor
|
||||
// already being around. (Creation is async, so can't happen
|
||||
// on demand.)
|
||||
bool useOffMainThreadCompositing = !!CompositorBridgeParent::CompositorLoop();
|
||||
bool useOffMainThreadCompositing = !!CompositorThreadHolder::Loop();
|
||||
if (useOffMainThreadCompositing) {
|
||||
DebugOnly<bool> opened = PCompositorBridge::Open(this);
|
||||
MOZ_ASSERT(opened);
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include "base/message_loop.h" // for MessageLoop
|
||||
#include "mozilla/layers/CompositorBridgeParent.h" // for CompositorBridgeParent
|
||||
#include "mozilla/layers/Effects.h" // for Effect, EffectChain, etc
|
||||
#include "mozilla/layers/CompositorThread.h"
|
||||
#include "mozilla/mozalloc.h" // for operator delete, etc
|
||||
#include "gfx2DGlue.h"
|
||||
#include "nsAppRunner.h"
|
||||
@ -25,8 +26,8 @@ namespace layers {
|
||||
/* static */ void
|
||||
Compositor::AssertOnCompositorThread()
|
||||
{
|
||||
MOZ_ASSERT(!CompositorBridgeParent::CompositorLoop() ||
|
||||
CompositorBridgeParent::CompositorLoop() == MessageLoop::current(),
|
||||
MOZ_ASSERT(!CompositorThreadHolder::Loop() ||
|
||||
CompositorThreadHolder::Loop() == MessageLoop::current(),
|
||||
"Can only call this from the compositor thread!");
|
||||
}
|
||||
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
#include "mozilla/layers/CompositorBridgeChild.h"
|
||||
#include "mozilla/layers/CompositorBridgeParent.h"
|
||||
#include "mozilla/layers/CompositorThread.h"
|
||||
#include <stddef.h> // for size_t
|
||||
#include "ClientLayerManager.h" // for ClientLayerManager
|
||||
#include "base/message_loop.h" // for MessageLoop
|
||||
@ -180,7 +181,7 @@ CompositorBridgeChild::OpenSameProcess(CompositorBridgeParent* aParent)
|
||||
|
||||
mCompositorBridgeParent = aParent;
|
||||
mCanSend = Open(mCompositorBridgeParent->GetIPCChannel(),
|
||||
CompositorBridgeParent::CompositorLoop(),
|
||||
CompositorThreadHolder::Loop(),
|
||||
ipc::ChildSide);
|
||||
return mCanSend;
|
||||
}
|
||||
|
@ -552,18 +552,13 @@ CompositorVsyncScheduler::DispatchVREvents(TimeStamp aVsyncTimestamp)
|
||||
vm->NotifyVsync(aVsyncTimestamp);
|
||||
}
|
||||
|
||||
MessageLoop* CompositorBridgeParent::CompositorLoop()
|
||||
{
|
||||
return CompositorThread() ? CompositorThread()->message_loop() : nullptr;
|
||||
}
|
||||
|
||||
void
|
||||
CompositorVsyncScheduler::ScheduleTask(already_AddRefed<CancelableRunnable> aTask,
|
||||
int aTime)
|
||||
{
|
||||
MOZ_ASSERT(CompositorBridgeParent::CompositorLoop());
|
||||
MOZ_ASSERT(CompositorThreadHolder::Loop());
|
||||
MOZ_ASSERT(aTime >= 0);
|
||||
CompositorBridgeParent::CompositorLoop()->PostDelayedTask(Move(aTask), aTime);
|
||||
CompositorThreadHolder::Loop()->PostDelayedTask(Move(aTask), aTime);
|
||||
}
|
||||
|
||||
void
|
||||
@ -582,6 +577,12 @@ CompositorVsyncScheduler::ComposeToTarget(gfx::DrawTarget* aTarget, const IntRec
|
||||
mCompositorBridgeParent->CompositeToTarget(aTarget, aRect);
|
||||
}
|
||||
|
||||
static inline MessageLoop*
|
||||
CompositorLoop()
|
||||
{
|
||||
return CompositorThreadHolder::Loop();
|
||||
}
|
||||
|
||||
CompositorBridgeParent::CompositorBridgeParent(widget::CompositorWidgetProxy* aWidget,
|
||||
CSSToLayoutDeviceScale aScale,
|
||||
bool aUseAPZ,
|
||||
|
@ -372,14 +372,6 @@ public:
|
||||
*/
|
||||
static CompositorBridgeParent* GetCompositor(uint64_t id);
|
||||
|
||||
/**
|
||||
* Returns the compositor thread's message loop.
|
||||
*
|
||||
* This message loop is used by CompositorBridgeParent, ImageBridgeParent,
|
||||
* and VRManagerParent
|
||||
*/
|
||||
static MessageLoop* CompositorLoop();
|
||||
|
||||
/**
|
||||
* Allocate an ID that can be used to refer to a layer tree and
|
||||
* associated resources that live only on the compositor thread.
|
||||
|
@ -37,6 +37,12 @@ CompositorThread()
|
||||
: nullptr;
|
||||
}
|
||||
|
||||
/* static */ MessageLoop*
|
||||
CompositorThreadHolder::Loop()
|
||||
{
|
||||
return CompositorThread() ? CompositorThread()->message_loop() : nullptr;
|
||||
}
|
||||
|
||||
CompositorThreadHolder*
|
||||
CompositorThreadHolder::GetSingleton()
|
||||
{
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include "base/basictypes.h" // for DISALLOW_EVIL_CONSTRUCTORS
|
||||
#include "base/platform_thread.h" // for PlatformThreadId
|
||||
#include "base/thread.h" // for Thread
|
||||
#include "base/message_loop.h"
|
||||
#include "nsISupportsImpl.h"
|
||||
#include "ThreadSafeRefcountingWithMainThreadDestruction.h"
|
||||
|
||||
@ -43,6 +44,8 @@ public:
|
||||
*/
|
||||
static void Shutdown();
|
||||
|
||||
static MessageLoop* Loop();
|
||||
|
||||
private:
|
||||
~CompositorThreadHolder();
|
||||
|
||||
|
@ -24,7 +24,7 @@
|
||||
#include "mozilla/media/MediaSystemResourceManager.h" // for MediaSystemResourceManager
|
||||
#include "mozilla/media/MediaSystemResourceManagerChild.h" // for MediaSystemResourceManagerChild
|
||||
#include "mozilla/layers/CompositableClient.h" // for CompositableChild, etc
|
||||
#include "mozilla/layers/CompositorBridgeParent.h" // for CompositorBridgeParent
|
||||
#include "mozilla/layers/CompositorThread.h"
|
||||
#include "mozilla/layers/ISurfaceAllocator.h" // for ISurfaceAllocator
|
||||
#include "mozilla/layers/ImageClient.h" // for ImageClient
|
||||
#include "mozilla/layers/LayersMessages.h" // for CompositableOperation
|
||||
@ -844,7 +844,7 @@ bool ImageBridgeChild::StartUpOnThread(Thread* aThread)
|
||||
}
|
||||
sImageBridgeChildSingleton = new ImageBridgeChild();
|
||||
sImageBridgeParentSingleton = new ImageBridgeParent(
|
||||
CompositorBridgeParent::CompositorLoop(), nullptr, base::GetCurrentProcId());
|
||||
CompositorThreadHolder::Loop(), nullptr, base::GetCurrentProcId());
|
||||
sImageBridgeChildSingleton->ConnectAsync(sImageBridgeParentSingleton);
|
||||
sImageBridgeChildSingleton->GetMessageLoop()->PostTask(
|
||||
NewRunnableFunction(CallSendImageBridgeThreadId,
|
||||
|
@ -201,7 +201,7 @@ ConnectImageBridgeInParentProcess(ImageBridgeParent* aBridge,
|
||||
/*static*/ PImageBridgeParent*
|
||||
ImageBridgeParent::Create(Transport* aTransport, ProcessId aChildProcessId, GeckoChildProcessHost* aProcessHost)
|
||||
{
|
||||
MessageLoop* loop = CompositorBridgeParent::CompositorLoop();
|
||||
MessageLoop* loop = CompositorThreadHolder::Loop();
|
||||
RefPtr<ImageBridgeParent> bridge = new ImageBridgeParent(loop, aTransport, aChildProcessId);
|
||||
|
||||
if (aProcessHost) {
|
||||
|
@ -10,7 +10,7 @@
|
||||
#include "VRDeviceProxy.h"
|
||||
#include "VRDeviceProxyOrientationFallBack.h"
|
||||
#include "mozilla/StaticPtr.h"
|
||||
#include "mozilla/layers/CompositorBridgeParent.h" // for CompositorBridgeParent
|
||||
#include "mozilla/layers/CompositorThread.h" // for CompositorThread
|
||||
#include "mozilla/dom/Navigator.h"
|
||||
|
||||
namespace mozilla {
|
||||
@ -77,7 +77,7 @@ VRManagerChild::StartUpSameProcess()
|
||||
sVRManagerChildSingleton = new VRManagerChild();
|
||||
sVRManagerParentSingleton = VRManagerParent::CreateSameProcess();
|
||||
sVRManagerChildSingleton->Open(sVRManagerParentSingleton->GetIPCChannel(),
|
||||
mozilla::layers::CompositorBridgeParent::CompositorLoop(),
|
||||
mozilla::layers::CompositorThreadHolder::Loop(),
|
||||
mozilla::ipc::ChildSide);
|
||||
}
|
||||
}
|
||||
|
@ -69,7 +69,7 @@ VRManagerParent::ConnectVRManagerInParentProcess(VRManagerParent* aVRManager,
|
||||
/*static*/ VRManagerParent*
|
||||
VRManagerParent::CreateCrossProcess(Transport* aTransport, ProcessId aChildProcessId)
|
||||
{
|
||||
MessageLoop* loop = mozilla::layers::CompositorBridgeParent::CompositorLoop();
|
||||
MessageLoop* loop = mozilla::layers::CompositorThreadHolder::Loop();
|
||||
RefPtr<VRManagerParent> vmp = new VRManagerParent(loop, aTransport, aChildProcessId);
|
||||
vmp->mSelfRef = vmp;
|
||||
loop->PostTask(NewRunnableFunction(ConnectVRManagerInParentProcess,
|
||||
@ -86,7 +86,7 @@ VRManagerParent::RegisterVRManagerInCompositorThread(VRManagerParent* aVRManager
|
||||
/*static*/ VRManagerParent*
|
||||
VRManagerParent::CreateSameProcess()
|
||||
{
|
||||
MessageLoop* loop = mozilla::layers::CompositorBridgeParent::CompositorLoop();
|
||||
MessageLoop* loop = mozilla::layers::CompositorThreadHolder::Loop();
|
||||
RefPtr<VRManagerParent> vmp = new VRManagerParent(loop, nullptr, base::GetCurrentProcId());
|
||||
vmp->mCompositorThreadHolder = layers::CompositorThreadHolder::GetSingleton();
|
||||
vmp->mSelfRef = vmp;
|
||||
|
@ -8,7 +8,7 @@
|
||||
#ifndef MOZILLA_GFX_VR_VRMANAGERPARENT_H
|
||||
#define MOZILLA_GFX_VR_VRMANAGERPARENT_H
|
||||
|
||||
#include "mozilla/layers/CompositorBridgeParent.h" // for CompositorThreadHolder
|
||||
#include "mozilla/layers/CompositorThread.h" // for CompositorThreadHolder
|
||||
#include "mozilla/gfx/PVRManagerParent.h" // for PVRManagerParent
|
||||
#include "mozilla/ipc/ProtocolUtils.h" // for IToplevelProtocol
|
||||
#include "mozilla/TimeStamp.h" // for TimeStamp
|
||||
|
Loading…
x
Reference in New Issue
Block a user