зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1482109 - Hook the memory pressure observer up with WebRender. r=sotaro
--HG-- extra : rebase_source : e23d9db4ffff5d1994f476e660f7f6cbe52e6ad6
This commit is contained in:
Родитель
125d387bbf
Коммит
0805d95b99
|
@ -1912,6 +1912,17 @@ CompositorBridgeParent::DeallocPWebRenderBridgeParent(PWebRenderBridgeParent* aA
|
|||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
CompositorBridgeParent::NotifyMemoryPressure()
|
||||
{
|
||||
if (mWrBridge) {
|
||||
RefPtr<wr::WebRenderAPI> api = mWrBridge->GetWebRenderAPI();
|
||||
if (api) {
|
||||
api->NotifyMemoryPressure();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RefPtr<WebRenderBridgeParent>
|
||||
CompositorBridgeParent::GetWebRenderBridgeParent() const
|
||||
{
|
||||
|
|
|
@ -175,6 +175,8 @@ public:
|
|||
MOZ_CRASH();
|
||||
}
|
||||
|
||||
virtual void NotifyMemoryPressure() {}
|
||||
|
||||
protected:
|
||||
~CompositorBridgeParentBase() override;
|
||||
|
||||
|
@ -236,6 +238,8 @@ public:
|
|||
|
||||
mozilla::ipc::IPCResult RecvAllPluginsCaptured() override;
|
||||
|
||||
virtual void NotifyMemoryPressure() override;
|
||||
|
||||
void ActorDestroy(ActorDestroyReason why) override;
|
||||
|
||||
void ShadowLayersUpdated(LayerTransactionParent* aLayerTree,
|
||||
|
|
|
@ -288,5 +288,16 @@ CompositorManagerParent::RecvRemoveSharedSurface(const wr::ExternalImageId& aId)
|
|||
return IPC_OK();
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult
|
||||
CompositorManagerParent::RecvNotifyMemoryPressure()
|
||||
{
|
||||
nsTArray<PCompositorBridgeParent*> compositorBridges;
|
||||
ManagedPCompositorBridgeParent(compositorBridges);
|
||||
for (auto bridge : compositorBridges) {
|
||||
static_cast<CompositorBridgeParentBase*>(bridge)->NotifyMemoryPressure();
|
||||
}
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
} // namespace layers
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -44,6 +44,8 @@ public:
|
|||
const SurfaceDescriptorShared& aDesc) override;
|
||||
mozilla::ipc::IPCResult RecvRemoveSharedSurface(const wr::ExternalImageId& aId) override;
|
||||
|
||||
virtual mozilla::ipc::IPCResult RecvNotifyMemoryPressure() override;
|
||||
|
||||
void BindComplete();
|
||||
void ActorDestroy(ActorDestroyReason aReason) override;
|
||||
|
||||
|
|
|
@ -75,6 +75,8 @@ parent:
|
|||
|
||||
async AddSharedSurface(ExternalImageId aId, SurfaceDescriptorShared aDesc);
|
||||
async RemoveSharedSurface(ExternalImageId aId);
|
||||
|
||||
async NotifyMemoryPressure();
|
||||
};
|
||||
|
||||
} // layers
|
||||
|
|
|
@ -471,6 +471,12 @@ gfxPlatform::OnMemoryPressure(layers::MemoryPressureReason aWhy)
|
|||
gfxGradientCache::PurgeAllCaches();
|
||||
PurgeSkiaFontCache();
|
||||
PurgeSkiaGPUCache();
|
||||
if (XRE_IsParentProcess()) {
|
||||
layers::CompositorManagerChild* manager = CompositorManagerChild::GetInstance();
|
||||
if (manager) {
|
||||
manager->SendNotifyMemoryPressure();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
gfxPlatform::gfxPlatform()
|
||||
|
|
|
@ -502,6 +502,12 @@ WebRenderAPI::Resume()
|
|||
return result;
|
||||
}
|
||||
|
||||
void
|
||||
WebRenderAPI::NotifyMemoryPressure()
|
||||
{
|
||||
wr_api_notify_memory_pressure(mDocHandle);
|
||||
}
|
||||
|
||||
void
|
||||
WebRenderAPI::WakeSceneBuilder()
|
||||
{
|
||||
|
|
|
@ -206,6 +206,8 @@ public:
|
|||
void WakeSceneBuilder();
|
||||
void FlushSceneBuilder();
|
||||
|
||||
void NotifyMemoryPressure();
|
||||
|
||||
wr::WrIdNamespace GetNamespace();
|
||||
uint32_t GetMaxTextureSize() const { return mMaxTextureSize; }
|
||||
bool GetUseANGLE() const { return mUseANGLE; }
|
||||
|
|
|
@ -1029,6 +1029,11 @@ pub unsafe extern "C" fn wr_api_shut_down(dh: &mut DocumentHandle) {
|
|||
dh.api.shut_down();
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn wr_api_notify_memory_pressure(dh: &mut DocumentHandle) {
|
||||
dh.api.notify_memory_pressure();
|
||||
}
|
||||
|
||||
/// cbindgen:postfix=WR_DESTRUCTOR_SAFE_FUNC
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn wr_api_clear_all_caches(dh: &mut DocumentHandle) {
|
||||
|
|
|
@ -1097,6 +1097,10 @@ bool wr_api_hit_test(DocumentHandle *aDh,
|
|||
uint16_t *aOutHitInfo)
|
||||
WR_FUNC;
|
||||
|
||||
WR_INLINE
|
||||
void wr_api_notify_memory_pressure(DocumentHandle *aDh)
|
||||
WR_FUNC;
|
||||
|
||||
WR_INLINE
|
||||
void wr_api_send_external_event(DocumentHandle *aDh,
|
||||
uintptr_t aEvt)
|
||||
|
|
Загрузка…
Ссылка в новой задаче