Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added basic implementation of EmbedliteCompositorParent for process b…
…ackend
- Loading branch information
Showing
9 changed files
with
338 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
210 changes: 210 additions & 0 deletions
210
embedding/embedlite/embedprocess/EmbedLiteCompositorProcessParent.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,210 @@ | ||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ | ||
/* 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 "EmbedLog.h" | ||
|
||
#include "EmbedLiteCompositorProcessParent.h" | ||
#include "mozilla/layers/CompositorParent.h" // for CompositorParent | ||
#include "mozilla/layers/LayerTransactionParent.h" // for LayerTransactionParent | ||
|
||
namespace mozilla { | ||
namespace embedlite { | ||
|
||
static StaticRefPtr<CompositorThreadHolder> sCompositorThreadHolder; | ||
|
||
static void | ||
OpenCompositor(EmbedLiteCompositorProcessParent* aCompositor, | ||
Transport* aTransport, ProcessHandle aHandle, | ||
MessageLoop* aIOLoop) | ||
{ | ||
LOGT(); | ||
DebugOnly<bool> ok = aCompositor->Open(aTransport, aHandle, aIOLoop); | ||
MOZ_ASSERT(ok); | ||
} | ||
|
||
/*static*/ PCompositorParent* | ||
EmbedLiteCompositorProcessParent::Create(Transport* aTransport, ProcessId aOtherProcess) | ||
{ | ||
LOGT(); | ||
nsRefPtr<EmbedLiteCompositorProcessParent> cpcp = | ||
new EmbedLiteCompositorProcessParent(aTransport, aOtherProcess); | ||
ProcessHandle handle; | ||
if (!base::OpenProcessHandle(aOtherProcess, &handle)) { | ||
// XXX need to kill |aOtherProcess|, it's boned | ||
return nullptr; | ||
} | ||
|
||
cpcp->mSelfRef = cpcp; | ||
CompositorParent::CompositorLoop()->PostTask( | ||
FROM_HERE, | ||
NewRunnableFunction(OpenCompositor, cpcp.get(), | ||
aTransport, handle, XRE_GetIOMessageLoop())); | ||
// The return value is just compared to null for success checking, | ||
// we're not sharing a ref. | ||
return cpcp.get(); | ||
} | ||
|
||
EmbedLiteCompositorProcessParent::EmbedLiteCompositorProcessParent(Transport* aTransport, ProcessId aOtherProcess) | ||
: mTransport(aTransport) | ||
, mChildProcessId(aOtherProcess) | ||
, mCompositorThreadHolder(sCompositorThreadHolder) | ||
, mNotifyAfterRemotePaint(false) | ||
{ | ||
LOGT(); | ||
MOZ_ASSERT(NS_IsMainThread()); | ||
} | ||
|
||
bool | ||
EmbedLiteCompositorProcessParent::RecvGetTileSize(int32_t* aWidth, int32_t* aHeight) | ||
{ | ||
LOGT(); | ||
*aWidth = 256; | ||
*aHeight = 256; | ||
return true; | ||
} | ||
|
||
bool | ||
EmbedLiteCompositorProcessParent::RecvRequestNotifyAfterRemotePaint() | ||
{ | ||
LOGT(); | ||
mNotifyAfterRemotePaint = true; | ||
return true; | ||
} | ||
|
||
void | ||
EmbedLiteCompositorProcessParent::ActorDestroy(ActorDestroyReason aWhy) | ||
{ | ||
LOGT(); | ||
MessageLoop::current()->PostTask( | ||
FROM_HERE, | ||
NewRunnableMethod(this, &EmbedLiteCompositorProcessParent::DeferredDestroy)); | ||
} | ||
|
||
PLayerTransactionParent* | ||
EmbedLiteCompositorProcessParent::AllocPLayerTransactionParent(const nsTArray<LayersBackend>&, | ||
const uint64_t& aId, | ||
TextureFactoryIdentifier* aTextureFactoryIdentifier, | ||
bool *aSuccess) | ||
{ | ||
LOGT("Implement me"); | ||
MOZ_ASSERT(aId != 0); | ||
|
||
return nullptr; | ||
} | ||
|
||
bool | ||
EmbedLiteCompositorProcessParent::DeallocPLayerTransactionParent(PLayerTransactionParent* aLayers) | ||
{ | ||
LOGT("Implement me"); | ||
|
||
return true; | ||
} | ||
|
||
bool | ||
EmbedLiteCompositorProcessParent::RecvNotifyChildCreated(const uint64_t& child) | ||
{ | ||
LOGT("Implement me"); | ||
|
||
return false; | ||
} | ||
|
||
void | ||
EmbedLiteCompositorProcessParent::ShadowLayersUpdated( | ||
LayerTransactionParent* aLayerTree, | ||
const uint64_t& aTransactionId, | ||
const TargetConfig& aTargetConfig, | ||
bool aIsFirstPaint, | ||
bool aScheduleComposite, | ||
uint32_t aPaintSequenceNumber, | ||
bool aIsRepeatTransaction) | ||
{ | ||
LOGT("Implement me"); | ||
uint64_t id = aLayerTree->GetId(); | ||
|
||
MOZ_ASSERT(id != 0); | ||
} | ||
|
||
void | ||
EmbedLiteCompositorProcessParent::DidComposite(uint64_t aId) | ||
{ | ||
LOGT("Implement me"); | ||
} | ||
|
||
void | ||
EmbedLiteCompositorProcessParent::ForceComposite(LayerTransactionParent* aLayerTree) | ||
{ | ||
LOGT("Implement me"); | ||
uint64_t id = aLayerTree->GetId(); | ||
MOZ_ASSERT(id != 0); | ||
} | ||
|
||
bool | ||
EmbedLiteCompositorProcessParent::SetTestSampleTime( | ||
LayerTransactionParent* aLayerTree, const TimeStamp& aTime) | ||
{ | ||
LOGT("Implement me"); | ||
uint64_t id = aLayerTree->GetId(); | ||
MOZ_ASSERT(id != 0); | ||
|
||
return false; | ||
} | ||
|
||
void | ||
EmbedLiteCompositorProcessParent::LeaveTestMode(LayerTransactionParent* aLayerTree) | ||
{ | ||
LOGT("Implement me"); | ||
|
||
uint64_t id = aLayerTree->GetId(); | ||
MOZ_ASSERT(id != 0); | ||
} | ||
|
||
void | ||
EmbedLiteCompositorProcessParent::GetAPZTestData(const LayerTransactionParent* aLayerTree, | ||
APZTestData* aOutData) | ||
{ | ||
LOGT("Implement me"); | ||
uint64_t id = aLayerTree->GetId(); | ||
MOZ_ASSERT(id != 0); | ||
} | ||
|
||
|
||
AsyncCompositionManager* | ||
EmbedLiteCompositorProcessParent::GetCompositionManager(LayerTransactionParent* aLayerTree) | ||
{ | ||
LOGT("Implement me"); | ||
uint64_t id = aLayerTree->GetId(); | ||
MOZ_ASSERT(id != 0); | ||
|
||
return nullptr; | ||
} | ||
|
||
void | ||
EmbedLiteCompositorProcessParent::DeferredDestroy() | ||
{ | ||
LOGT("Implement me"); | ||
} | ||
|
||
EmbedLiteCompositorProcessParent::~EmbedLiteCompositorProcessParent() | ||
{ | ||
LOGT(); | ||
MOZ_ASSERT(NS_IsMainThread()); | ||
MOZ_ASSERT(XRE_GetIOMessageLoop()); | ||
XRE_GetIOMessageLoop()->PostTask(FROM_HERE, | ||
new DeleteTask<Transport>(mTransport)); | ||
} | ||
|
||
IToplevelProtocol* | ||
EmbedLiteCompositorProcessParent::CloneToplevel(const InfallibleTArray<mozilla::ipc::ProtocolFdMapping>& aFds, | ||
base::ProcessHandle aPeerProcess, | ||
mozilla::ipc::ProtocolCloneContext* aCtx) | ||
{ | ||
LOGT("Implement me"); | ||
|
||
return nullptr; | ||
} | ||
|
||
} // namespace embedlite | ||
} // namespace mozilla | ||
|
114 changes: 114 additions & 0 deletions
114
embedding/embedlite/embedprocess/EmbedLiteCompositorProcessParent.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ | ||
/* 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_EmbedLiteCompositorProcessParent_h | ||
#define mozilla_layers_EmbedLiteCompositorProcessParent_h | ||
|
||
#define COMPOSITOR_PERFORMANCE_WARNING | ||
|
||
#include "mozilla/layers/CompositorParent.h" | ||
#include "mozilla/layers/CompositorChild.h" | ||
#include "Layers.h" | ||
#include "EmbedLiteViewThreadParent.h" | ||
|
||
namespace mozilla { | ||
namespace embedlite { | ||
|
||
class EmbedLiteCompositorProcessParent MOZ_FINAL : public mozilla::layers::PCompositorParent, | ||
public mozilla::layers::ShadowLayersManager | ||
{ | ||
friend class CompositorParent; | ||
|
||
NS_INLINE_DECL_THREADSAFE_REFCOUNTING_WITH_MAIN_THREAD_DESTRUCTION(EmbedLiteCompositorProcessParent) | ||
public: | ||
EmbedLiteCompositorProcessParent(Transport* aTransport, ProcessId aOtherProcess); | ||
|
||
// IToplevelProtocol::CloneToplevel() | ||
virtual IToplevelProtocol* | ||
CloneToplevel(const InfallibleTArray<mozilla::ipc::ProtocolFdMapping>& aFds, | ||
base::ProcessHandle aPeerProcess, | ||
mozilla::ipc::ProtocolCloneContext* aCtx) MOZ_OVERRIDE; | ||
|
||
virtual void ActorDestroy(ActorDestroyReason aWhy) MOZ_OVERRIDE; | ||
|
||
// FIXME/bug 774388: work out what shutdown protocol we need. | ||
virtual bool RecvRequestOverfill() MOZ_OVERRIDE { return true; } | ||
virtual bool RecvWillStop() MOZ_OVERRIDE { return true; } | ||
virtual bool RecvStop() MOZ_OVERRIDE { return true; } | ||
virtual bool RecvPause() MOZ_OVERRIDE { return true; } | ||
virtual bool RecvResume() MOZ_OVERRIDE { return true; } | ||
virtual bool RecvNotifyChildCreated(const uint64_t& child) MOZ_OVERRIDE; | ||
virtual bool RecvAdoptChild(const uint64_t& child) MOZ_OVERRIDE { return false; } | ||
virtual bool RecvMakeSnapshot(const SurfaceDescriptor& aInSnapshot, | ||
const nsIntRect& aRect) | ||
{ return true; } | ||
virtual bool RecvFlushRendering() MOZ_OVERRIDE { return true; } | ||
virtual bool RecvNotifyRegionInvalidated(const nsIntRegion& aRegion) { return true; } | ||
virtual bool RecvStartFrameTimeRecording(const int32_t& aBufferSize, uint32_t* aOutStartIndex) MOZ_OVERRIDE { return true; } | ||
virtual bool RecvStopFrameTimeRecording(const uint32_t& aStartIndex, InfallibleTArray<float>* intervals) MOZ_OVERRIDE { return true; } | ||
virtual bool RecvGetTileSize(int32_t* aWidth, int32_t* aHeight) MOZ_OVERRIDE; | ||
|
||
/** | ||
* Tells this CompositorParent to send a message when the compositor has received the transaction. | ||
*/ | ||
virtual bool RecvRequestNotifyAfterRemotePaint() MOZ_OVERRIDE; | ||
|
||
virtual PLayerTransactionParent* | ||
AllocPLayerTransactionParent(const nsTArray<LayersBackend>& aBackendHints, | ||
const uint64_t& aId, | ||
TextureFactoryIdentifier* aTextureFactoryIdentifier, | ||
bool *aSuccess) MOZ_OVERRIDE; | ||
|
||
virtual bool DeallocPLayerTransactionParent(PLayerTransactionParent* aLayers) MOZ_OVERRIDE; | ||
|
||
virtual void ShadowLayersUpdated(LayerTransactionParent* aLayerTree, | ||
const uint64_t& aTransactionId, | ||
const TargetConfig& aTargetConfig, | ||
bool aIsFirstPaint, | ||
bool aScheduleComposite, | ||
uint32_t aPaintSequenceNumber, | ||
bool aIsRepeatTransaction) MOZ_OVERRIDE; | ||
virtual void ForceComposite(LayerTransactionParent* aLayerTree) MOZ_OVERRIDE; | ||
virtual bool SetTestSampleTime(LayerTransactionParent* aLayerTree, | ||
const TimeStamp& aTime) MOZ_OVERRIDE; | ||
virtual void LeaveTestMode(LayerTransactionParent* aLayerTree) MOZ_OVERRIDE; | ||
virtual void GetAPZTestData(const LayerTransactionParent* aLayerTree, | ||
APZTestData* aOutData) MOZ_OVERRIDE; | ||
|
||
virtual AsyncCompositionManager* GetCompositionManager(LayerTransactionParent* aParent) MOZ_OVERRIDE; | ||
|
||
void DidComposite(uint64_t aId); | ||
|
||
/** | ||
* A new child process has been configured to push transactions | ||
* directly to us. Transport is to its thread context. | ||
*/ | ||
static PCompositorParent* | ||
Create(Transport* aTransport, ProcessId aOtherProcess); | ||
|
||
private: | ||
// Private destructor, to discourage deletion outside of Release(): | ||
virtual ~EmbedLiteCompositorProcessParent(); | ||
|
||
void DeferredDestroy(); | ||
|
||
// There can be many CPCPs, and IPDL-generated code doesn't hold a | ||
// reference to top-level actors. So we hold a reference to | ||
// ourself. This is released (deferred) in ActorDestroy(). | ||
nsRefPtr<EmbedLiteCompositorProcessParent> mSelfRef; | ||
Transport* mTransport; | ||
// Child side's process Id. | ||
base::ProcessId mChildProcessId; | ||
|
||
nsRefPtr<CompositorThreadHolder> mCompositorThreadHolder; | ||
// If true, we should send a RemotePaintIsReady message when the layer transaction | ||
// is received | ||
bool mNotifyAfterRemotePaint; | ||
}; | ||
|
||
} // embedlite | ||
} // mozilla | ||
|
||
#endif // mozilla_layers_EmbedLiteCompositorProcessParent_h |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.