Bug 1758156 - Check the pref when creating PWebGPU parent actors. r=aosmond a=pascalc

Differential Revision: https://phabricator.services.mozilla.com/D140539
This commit is contained in:
Nicolas Silva 2022-03-10 10:41:29 +00:00
parent eb868507e2
commit bd8cf93679

View File

@ -15,6 +15,7 @@
# include "mozilla/gfx/DeviceManagerDx.h" // for DeviceManagerDx
# include "mozilla/layers/ImageDataSerializer.h"
#endif
#include "mozilla/StaticPrefs_dom.h"
#include "mozilla/dom/WebGLParent.h"
#include "mozilla/ipc/Transport.h" // for Transport
#include "mozilla/layers/AnimationHelper.h" // for CompositorAnimationStorage
@ -270,6 +271,10 @@ bool ContentCompositorBridgeParent::DeallocPWebRenderBridgeParent(
}
webgpu::PWebGPUParent* ContentCompositorBridgeParent::AllocPWebGPUParent() {
if (!StaticPrefs::dom_webgpu_enabled()) {
return nullptr;
}
webgpu::WebGPUParent* parent = new webgpu::WebGPUParent();
parent->AddRef(); // IPDL reference
return parent;