Merge mozilla-central to inbound. a=merge CLOSED TREE

This commit is contained in:
Gurzau Raul 2018-07-04 13:02:19 +03:00
Родитель 169c0ced40 03062dd04b
Коммит 7842ca58ca
110 изменённых файлов: 3271 добавлений и 216 удалений

Просмотреть файл

@ -263,6 +263,7 @@ dom/url/**
dom/vr/**
dom/webauthn/**
dom/webbrowserpersist/**
dom/webgpu/**
dom/webidl/**
dom/websocket/**
dom/workers/**

Просмотреть файл

@ -5,7 +5,6 @@
# 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/.
#ifdef XP_MACOSX
<?xml-stylesheet href="chrome://browser/skin/webRTC-indicator.css" type="text/css"?>
<!DOCTYPE window [
@ -31,5 +30,3 @@
</popupset>
</window>
#endif

Просмотреть файл

@ -100,8 +100,10 @@ browser.jar:
content/browser/webext-panels.js (content/webext-panels.js)
* content/browser/webext-panels.xul (content/webext-panels.xul)
content/browser/nsContextMenu.js (content/nsContextMenu.js)
#ifdef XP_MACOSX
# XXX: We should exclude this one as well (bug 71895)
* content/browser/hiddenWindow.xul (content/hiddenWindow.xul)
#endif
#ifndef XP_MACOSX
* content/browser/webrtcIndicator.xul (content/webrtcIndicator.xul)
content/browser/webrtcIndicator.js (content/webrtcIndicator.js)

Просмотреть файл

@ -0,0 +1,73 @@
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# 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/.
option('--enable-nodejs',
help='Require Node.js to build')
# "nodejs" is first in the tuple on the assumption that it's only likely to
# exist on systems (probably linux distros) where there is a program in the path
# called "node" that does something else.
nodejs = check_prog('NODEJS', ('nodejs', 'node',),
allow_missing=True)
@depends_if(nodejs)
@checking('for node.js version')
@imports('os')
@imports('re')
@imports('subprocess')
def nodejs_version(node):
env = dict(os.environ)
env[b'NODE_DISABLE_COLORS'] = b'1'
try:
out = subprocess.check_output([node, '--version'], env=env,
stderr=subprocess.STDOUT)
except subprocess.CalledProcessError as e:
return None
match = re.search(r'v(.+)$', out)
if not match:
return None
return Version(match.group(1))
@depends('--enable-nodejs', nodejs, nodejs_version)
def nodejs_suitability(require, node, version):
MIN_NODE_VERSION = Version('8.11')
if not node:
msg = ('could not find Node.js executable; ensure `node` or `nodejs` '
'is in PATH or set NODEJS in environment to point to an '
'executable')
if require:
raise FatalCheckError(msg)
else:
log.warning(msg)
log.warning('(This will become a fatal error in the near future.)')
return
if not version:
msg = 'could not resolve Node.js version'
if require:
raise FatalCheckError(msg)
else:
log.warning(msg)
log.warning('(This will become a fatal error in the near future.)')
return
if version < MIN_NODE_VERSION:
msg = 'NODEJS must point to node %s or newer; %s found' (
MIN_NODE_VERSION, node_version)
if require:
raise FatalCheckError(msg)
else:
log.warning(msg)

Просмотреть файл

@ -128,8 +128,10 @@ OriginAttributes::CreateSuffix(nsACString& aStr) const
}
if (!mFirstPartyDomain.IsEmpty()) {
MOZ_RELEASE_ASSERT(mFirstPartyDomain.FindCharInSet(dom::quota::QuotaManager::kReplaceChars) == kNotFound);
params.Set(NS_LITERAL_STRING("firstPartyDomain"), mFirstPartyDomain);
nsAutoString sanitizedFirstPartyDomain(mFirstPartyDomain);
sanitizedFirstPartyDomain.ReplaceChar(dom::quota::QuotaManager::kReplaceChars, '+');
params.Set(NS_LITERAL_STRING("firstPartyDomain"), sanitizedFirstPartyDomain);
}
aStr.Truncate();

Просмотреть файл

@ -75,6 +75,8 @@ class ToolboxTabs extends Component {
}
componentWillUnmount() {
window.removeEventListener("resize", this.resizeHandler);
window.cancelIdleCallback(this._resizeTimerId);
this._tabsOrderManager.destroy();
}

Просмотреть файл

@ -517,7 +517,8 @@ class AnimationInspector {
await this.inspector.highlighters.hideBoxModelHighlighter();
if (nodeFront) {
await this.inspector.highlighters.showBoxModelHighlighter(nodeFront);
await this.inspector.highlighters.showBoxModelHighlighter(
nodeFront, { hideInfoBar: true, hideGuides: true });
}
this.inspector.store.dispatch(updateHighlightedNode(nodeFront));

Просмотреть файл

@ -88,7 +88,8 @@ class AnimationTarget extends Component {
await this.ensureNodeFront();
if (this.state.nodeFront) {
this.props.onShowBoxModelHighlighterForNode(this.state.nodeFront);
this.props.onShowBoxModelHighlighterForNode(
this.state.nodeFront, { hideInfoBar: true, hideGuides: true });
}
}

Просмотреть файл

@ -33,7 +33,7 @@ class ColorPath extends ComputedStylePath {
}
propToState({ keyframes }) {
const maxObject = { distance: 0 };
const maxObject = { distance: -Number.MAX_VALUE };
for (let i = 0; i < keyframes.length - 1; i++) {
const value1 = getRGBA(keyframes[i].value);

Просмотреть файл

@ -200,6 +200,30 @@
},
]
);
createAnimation(
"same-color",
[
{
backgroundColor: "lime",
},
{
backgroundColor: "lime",
},
]
);
createAnimation(
"currentcolor",
[
{
backgroundColor: "currentColor",
},
{
backgroundColor: "lime",
},
]
);
</script>
</body>
</html>

Просмотреть файл

@ -132,7 +132,43 @@ const KEYFRAMES_TEST_DATA = [
],
},
],
}
},
{
targetClass: "same-color",
properties: [
{
name: "background-color",
expectedValues: [
{
title: "rgb(0, 255, 0)",
marginInlineStart: "0%",
},
{
title: "rgb(0, 255, 0)",
marginInlineStart: "100%",
},
],
},
],
},
{
targetClass: "currentcolor",
properties: [
{
name: "background-color",
expectedValues: [
{
title: "currentcolor",
marginInlineStart: "0%",
},
{
title: "rgb(0, 255, 0)",
marginInlineStart: "100%",
},
],
},
],
},
];
/**
@ -179,4 +215,3 @@ async function testKeyframesGraphKeyframesMarker() {
}
}
}

Просмотреть файл

@ -1321,6 +1321,43 @@ Element::GetAttribute(const nsAString& aName, DOMString& aReturn)
}
}
bool
Element::ToggleAttribute(const nsAString& aName,
const Optional<bool>& aForce,
nsIPrincipal* aTriggeringPrincipal,
ErrorResult& aError)
{
aError = nsContentUtils::CheckQName(aName, false);
if (aError.Failed()) {
return false;
}
nsAutoString nameToUse;
const nsAttrName* name = InternalGetAttrNameFromQName(aName, &nameToUse);
if (!name) {
if (aForce.WasPassed() && !aForce.Value()) {
return false;
}
RefPtr<nsAtom> nameAtom = NS_AtomizeMainThread(nameToUse);
if (!nameAtom) {
aError.Throw(NS_ERROR_OUT_OF_MEMORY);
return false;
}
aError = SetAttr(kNameSpaceID_None, nameAtom, EmptyString(), aTriggeringPrincipal, true);
return true;
}
if (aForce.WasPassed() && aForce.Value()) {
return true;
}
// Hold a strong reference here so that the atom or nodeinfo doesn't go
// away during UnsetAttr. If it did UnsetAttr would be left with a
// dangling pointer as argument without knowing it.
nsAttrName tmp(*name);
aError = UnsetAttr(name->NamespaceID(), name->LocalName(), true);
return false;
}
void
Element::SetAttribute(const nsAString& aName,
const nsAString& aValue,

Просмотреть файл

@ -1101,6 +1101,8 @@ public:
void GetAttributeNS(const nsAString& aNamespaceURI,
const nsAString& aLocalName,
nsAString& aReturn);
bool ToggleAttribute(const nsAString& aName, const Optional<bool>& aForce,
nsIPrincipal* aTriggeringPrincipal, ErrorResult& aError);
void SetAttribute(const nsAString& aName, const nsAString& aValue,
nsIPrincipal* aTriggeringPrincipal, ErrorResult& aError);
void SetAttributeNS(const nsAString& aNamespaceURI,

Просмотреть файл

@ -886,6 +886,7 @@ public:
nsGlobalWindowInner::nsGlobalWindowInner(nsGlobalWindowOuter *aOuterWindow)
: nsPIDOMWindowInner(aOuterWindow->AsOuter()),
mozilla::webgpu::InstanceProvider(this),
mIdleFuzzFactor(0),
mIdleCallbackIndex(-1),
mCurrentlyIdle(false),
@ -1479,6 +1480,8 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INTERNAL(nsGlobalWindowInner)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mDocumentFlushedResolvers[i]->mCallback);
}
static_cast<mozilla::webgpu::InstanceProvider*>(tmp)->CcTraverse(cb);
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsGlobalWindowInner)
@ -1582,6 +1585,8 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsGlobalWindowInner)
}
tmp->mDocumentFlushedResolvers.Clear();
static_cast<mozilla::webgpu::InstanceProvider*>(tmp)->CcUnlink();
NS_IMPL_CYCLE_COLLECTION_UNLINK_PRESERVED_WRAPPER
NS_IMPL_CYCLE_COLLECTION_UNLINK_END

Просмотреть файл

@ -45,6 +45,7 @@
#include "mozilla/GuardObjects.h"
#include "mozilla/LinkedList.h"
#include "mozilla/TimeStamp.h"
#include "mozilla/webgpu/InstanceProvider.h"
#include "nsWrapperCacheInlines.h"
#include "nsIIdleObserver.h"
#include "nsIDocument.h"
@ -217,6 +218,7 @@ class nsGlobalWindowInner final
, public nsIInterfaceRequestor
, public PRCListStr
, public nsAPostRefreshObserver
, public mozilla::webgpu::InstanceProvider
{
public:
typedef mozilla::TimeStamp TimeStamp;

Просмотреть файл

@ -1297,6 +1297,139 @@ DOMInterfaces = {
'headerFile': 'WebGLVertexArray.h'
},
# WebGPU
'WebGPU': {
'nativeType': 'mozilla::webgpu::Instance',
},
'WebGPUAdapter': {
'nativeType': 'mozilla::webgpu::Adapter',
},
'WebGPUAttachmentState': {
'nativeType': 'mozilla::webgpu::AttachmentState',
},
'WebGPUBindGroup': {
'nativeType': 'mozilla::webgpu::BindGroup',
},
'WebGPUBindGroupLayout': {
'nativeType': 'mozilla::webgpu::BindGroupLayout',
},
'WebGPUBlendState': {
'nativeType': 'mozilla::webgpu::BlendState',
},
'WebGPUBuffer': {
'nativeType': 'mozilla::webgpu::Buffer',
},
'WebGPUCommandBuffer': {
'nativeType': 'mozilla::webgpu::CommandBuffer',
},
'WebGPUCommandEncoder': {
'nativeType': 'mozilla::webgpu::CommandEncoder',
},
'WebGPUComputePipeline': {
'nativeType': 'mozilla::webgpu::ComputePipeline',
},
'WebGPUDepthStencilState': {
'nativeType': 'mozilla::webgpu::DepthStencilState',
},
'WebGPUDevice': {
'nativeType': 'mozilla::webgpu::Device',
},
'WebGPUFence': {
'nativeType': 'mozilla::webgpu::Fence',
},
'WebGPUInputState': {
'nativeType': 'mozilla::webgpu::InputState',
},
'WebGPULogEntry': {
'nativeType': 'mozilla::webgpu::LogEntry',
},
'WebGPUPipelineLayout': {
'nativeType': 'mozilla::webgpu::PipelineLayout',
},
'WebGPUQueue': {
'nativeType': 'mozilla::webgpu::Queue',
},
'WebGPURenderPipeline': {
'nativeType': 'mozilla::webgpu::RenderPipeline',
},
'WebGPUSampler': {
'nativeType': 'mozilla::webgpu::Sampler',
},
'WebGPUShaderModule': {
'nativeType': 'mozilla::webgpu::ShaderModule',
},
'WebGPUSwapChain': {
'nativeType': 'mozilla::webgpu::SwapChain',
},
'WebGPUTexture': {
'nativeType': 'mozilla::webgpu::Texture',
},
'WebGPUTextureView': {
'nativeType': 'mozilla::webgpu::TextureView',
},
'WebGPUBindingType': {
'concrete': False,
},
'WebGPUBlendFactor': {
'concrete': False,
},
'WebGPUBlendOperation': {
'concrete': False,
},
'WebGPUBufferUsage': {
'concrete': False,
},
'WebGPUColorWriteBits': {
'concrete': False,
},
'WebGPUCompareFunction': {
'concrete': False,
},
'WebGPUFilterMode': {
'concrete': False,
},
'WebGPUIndexFormat': {
'concrete': False,
},
'WebGPUInputStepMode': {
'concrete': False,
},
'WebGPULoadOp': {
'concrete': False,
},
'WebGPUPrimitiveTopology': {
'concrete': False,
},
'WebGPUShaderStage': {
'concrete': False,
},
'WebGPUShaderStageBit': {
'concrete': False,
},
'WebGPUStencilOperation': {
'concrete': False,
},
'WebGPUStoreOp': {
'concrete': False,
},
'WebGPUTextureDimension': {
'concrete': False,
},
'WebGPUTextureFormat': {
'concrete': False,
},
'WebGPUTextureUsage': {
'concrete': False,
},
'WebGPUVertexFormat': {
'concrete': False,
},
# WebRTC
'WebrtcGlobalInformation': {
'nativeType': 'mozilla::dom::WebrtcGlobalInformation',
'headerFile': 'WebrtcGlobalInformation.h',

Просмотреть файл

@ -7,6 +7,9 @@
with Files("**"):
BUG_COMPONENT = ("Core", "DOM")
if CONFIG['CC_TYPE'] == 'msvc':
CXXFLAGS += ['-bigobj']
TEST_DIRS += ['test']
XPIDL_SOURCES += [

Просмотреть файл

@ -39,6 +39,7 @@ DIRS += [
'browser-element',
'cache',
'canvas',
'webgpu',
'chrome-webidl',
'clients',
'commandhandler',

37
dom/webgpu/Adapter.cpp Normal file
Просмотреть файл

@ -0,0 +1,37 @@
/* -*- 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 "Adapter.h"
#include "Instance.h"
#include "mozilla/dom/WebGPUBinding.h"
namespace mozilla {
namespace webgpu {
Adapter::~Adapter() = default;
void
Adapter::Extensions(dom::WebGPUExtensions& out) const
{
MOZ_CRASH("todo");
}
void
Adapter::Features(dom::WebGPUFeatures& out) const
{
MOZ_CRASH("todo");
}
already_AddRefed<Device>
Adapter::CreateDevice(const dom::WebGPUDeviceDescriptor& desc) const
{
MOZ_CRASH("todo");
}
WEBGPU_IMPL_GOOP_0(Adapter)
} // namespace webgpu
} // namespace mozilla

49
dom/webgpu/Adapter.h Normal file
Просмотреть файл

@ -0,0 +1,49 @@
/* -*- 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 WEBGPU_Adapter_H_
#define WEBGPU_Adapter_H_
#include "mozilla/AlreadyAddRefed.h"
#include "nsString.h"
#include "ObjectModel.h"
namespace mozilla {
namespace dom {
struct WebGPUDeviceDescriptor;
struct WebGPUExtensions;
struct WebGPUFeatures;
} // namespace dom
namespace webgpu {
class Device;
class Instance;
class Adapter final
: public ChildOf<Instance>
{
public:
WEBGPU_DECL_GOOP(Adapter)
const nsString mName;
private:
Adapter() = delete;
virtual ~Adapter();
public:
void GetName(nsString& out) const {
out = mName;
}
void Extensions(dom::WebGPUExtensions& out) const;
void Features(dom::WebGPUFeatures& out) const;
already_AddRefed<Device> CreateDevice(const dom::WebGPUDeviceDescriptor& desc) const;
};
} // namespace webgpu
} // namespace mozilla
#endif // WEBGPU_Adapter_H_

Просмотреть файл

@ -0,0 +1,19 @@
/* -*- 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 "AttachmentState.h"
#include "Device.h"
#include "mozilla/dom/WebGPUBinding.h"
namespace mozilla {
namespace webgpu {
AttachmentState::~AttachmentState() = default;
WEBGPU_IMPL_GOOP_0(AttachmentState)
} // namespace webgpu
} // namespace mozilla

Просмотреть файл

@ -0,0 +1,31 @@
/* -*- 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 WEBGPU_AttachmentState_H_
#define WEBGPU_AttachmentState_H_
#include "nsWrapperCache.h"
#include "ObjectModel.h"
namespace mozilla {
namespace webgpu {
class Device;
class AttachmentState final
: public ChildOf<Device>
{
public:
WEBGPU_DECL_GOOP(AttachmentState)
private:
AttachmentState() = delete;
virtual ~AttachmentState();
};
} // namespace webgpu
} // namespace mozilla
#endif // WEBGPU_AttachmentState_H_

19
dom/webgpu/BindGroup.cpp Normal file
Просмотреть файл

@ -0,0 +1,19 @@
/* -*- 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 "BindGroup.h"
#include "Device.h"
#include "mozilla/dom/WebGPUBinding.h"
namespace mozilla {
namespace webgpu {
BindGroup::~BindGroup() = default;
WEBGPU_IMPL_GOOP_0(BindGroup)
} // namespace webgpu
} // namespace mozilla

31
dom/webgpu/BindGroup.h Normal file
Просмотреть файл

@ -0,0 +1,31 @@
/* -*- 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 WEBGPU_BindGroup_H_
#define WEBGPU_BindGroup_H_
#include "nsWrapperCache.h"
#include "ObjectModel.h"
namespace mozilla {
namespace webgpu {
class Device;
class BindGroup final
: public ChildOf<Device>
{
public:
WEBGPU_DECL_GOOP(BindGroup)
private:
BindGroup() = delete;
virtual ~BindGroup();
};
} // namespace webgpu
} // namespace mozilla
#endif // WEBGPU_BindGroup_H_

Просмотреть файл

@ -0,0 +1,19 @@
/* -*- 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 "BindGroupLayout.h"
#include "Device.h"
#include "mozilla/dom/WebGPUBinding.h"
namespace mozilla {
namespace webgpu {
BindGroupLayout::~BindGroupLayout() = default;
WEBGPU_IMPL_GOOP_0(BindGroupLayout)
} // namespace webgpu
} // namespace mozilla

Просмотреть файл

@ -0,0 +1,31 @@
/* -*- 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 WEBGPU_BindGroupLayout_H_
#define WEBGPU_BindGroupLayout_H_
#include "nsWrapperCache.h"
#include "ObjectModel.h"
namespace mozilla {
namespace webgpu {
class Device;
class BindGroupLayout final
: public ChildOf<Device>
{
public:
WEBGPU_DECL_GOOP(BindGroupLayout)
private:
BindGroupLayout() = delete;
virtual ~BindGroupLayout();
};
} // namespace webgpu
} // namespace mozilla
#endif // WEBGPU_BindGroupLayout_H_

19
dom/webgpu/BlendState.cpp Normal file
Просмотреть файл

@ -0,0 +1,19 @@
/* -*- 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 "BlendState.h"
#include "Device.h"
#include "mozilla/dom/WebGPUBinding.h"
namespace mozilla {
namespace webgpu {
BlendState::~BlendState() = default;
WEBGPU_IMPL_GOOP_0(BlendState)
} // namespace webgpu
} // namespace mozilla

31
dom/webgpu/BlendState.h Normal file
Просмотреть файл

@ -0,0 +1,31 @@
/* -*- 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 WEBGPU_BlendState_H_
#define WEBGPU_BlendState_H_
#include "nsWrapperCache.h"
#include "ObjectModel.h"
namespace mozilla {
namespace webgpu {
class Device;
class BlendState final
: public ChildOf<Device>
{
public:
WEBGPU_DECL_GOOP(BlendState)
private:
BlendState() = delete;
virtual ~BlendState();
};
} // namespace webgpu
} // namespace mozilla
#endif // WEBGPU_BlendState_H_

62
dom/webgpu/Buffer.cpp Normal file
Просмотреть файл

@ -0,0 +1,62 @@
/* -*- 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 "Buffer.h"
#include "Device.h"
#include "mozilla/dom/WebGPUBinding.h"
namespace mozilla {
namespace webgpu {
Buffer::Buffer(Device* const parent)
: ChildOf(parent)
{
mozilla::HoldJSObjects(this); // Mimed from PushSubscriptionOptions
}
Buffer::~Buffer()
{
mMapping = nullptr;
mozilla::DropJSObjects(this);
}
void
Buffer::GetMapping(JSContext*, JS::MutableHandle<JSObject*> out) const
{
out.set(mMapping);
}
void
Buffer::Unmap() const
{
MOZ_CRASH("todo");
}
JSObject*
webgpu::Buffer::WrapObject(JSContext* cx, JS::Handle<JSObject*> givenProto)
{
return dom::WebGPUBuffer_Binding::Wrap(cx, this, givenProto);
}
NS_IMPL_CYCLE_COLLECTION_CLASS(Buffer)
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(Buffer)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mParent)
NS_IMPL_CYCLE_COLLECTION_UNLINK_PRESERVED_WRAPPER
tmp->mMapping = nullptr;
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(Buffer)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mParent)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(Buffer)
NS_IMPL_CYCLE_COLLECTION_TRACE_PRESERVED_WRAPPER
NS_IMPL_CYCLE_COLLECTION_TRACE_JS_MEMBER_CALLBACK(mMapping)
NS_IMPL_CYCLE_COLLECTION_TRACE_END
NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(Buffer, AddRef)
NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(Buffer, Release)
} // namespace webgpu
} // namespace mozilla

38
dom/webgpu/Buffer.h Normal file
Просмотреть файл

@ -0,0 +1,38 @@
/* -*- 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 WEBGPU_BUFFER_H_
#define WEBGPU_BUFFER_H_
#include "mozilla/dom/Nullable.h"
#include "mozilla/dom/TypedArray.h"
#include "ObjectModel.h"
namespace mozilla {
namespace webgpu {
class Device;
class Buffer final
: public ChildOf<Device>
{
public:
JS::Heap<JSObject*> mMapping;
WEBGPU_DECL_GOOP(Buffer)
private:
explicit Buffer(Device* parent);
virtual ~Buffer();
public:
void GetMapping(JSContext* cx, JS::MutableHandle<JSObject*> out) const;
void Unmap() const;
};
} // namespace webgpu
} // namespace mozilla
#endif // WEBGPU_BUFFER_H_

Просмотреть файл

@ -0,0 +1,19 @@
/* -*- 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 "CommandBuffer.h"
#include "Device.h"
#include "mozilla/dom/WebGPUBinding.h"
namespace mozilla {
namespace webgpu {
CommandBuffer::~CommandBuffer() = default;
WEBGPU_IMPL_GOOP_0(CommandBuffer)
} // namespace webgpu
} // namespace mozilla

Просмотреть файл

@ -0,0 +1,31 @@
/* -*- 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 WEBGPU_CommandBuffer_H_
#define WEBGPU_CommandBuffer_H_
#include "nsWrapperCache.h"
#include "ObjectModel.h"
namespace mozilla {
namespace webgpu {
class Device;
class CommandBuffer final
: public ChildOf<Device>
{
public:
WEBGPU_DECL_GOOP(CommandBuffer)
private:
CommandBuffer() = delete;
virtual ~CommandBuffer();
};
} // namespace webgpu
} // namespace mozilla
#endif // WEBGPU_CommandBuffer_H_

Просмотреть файл

@ -0,0 +1,147 @@
/* -*- 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 "CommandEncoder.h"
#include "Device.h"
#include "mozilla/dom/WebGPUBinding.h"
namespace mozilla {
namespace webgpu {
CommandEncoder::~CommandEncoder() = default;
already_AddRefed<CommandBuffer>
CommandEncoder::FinishEncoding() const
{
MOZ_CRASH("todo");
}
void
CommandEncoder::CopyBufferToBuffer(const Buffer& src, const uint32_t srcOffset,
const Buffer& dst, const uint32_t dstOffset,
const uint32_t size) const
{
MOZ_CRASH("todo");
}
void
CommandEncoder::CopyBufferToTexture() const
{
MOZ_CRASH("todo");
}
void
CommandEncoder::CopyTextureToBuffer() const
{
MOZ_CRASH("todo");
}
void
CommandEncoder::CopyTextureToTexture() const
{
MOZ_CRASH("todo");
}
void
CommandEncoder::Blit() const
{
MOZ_CRASH("todo");
}
void
CommandEncoder::TransitionBuffer(const Buffer& b, const uint32_t flags) const
{
MOZ_CRASH("todo");
}
void
CommandEncoder::SetPushConstants(const uint32_t stageFlags, const uint32_t offset,
const uint32_t count, const dom::ArrayBuffer& data) const
{
MOZ_CRASH("todo");
}
void
CommandEncoder::SetBindGroup(const uint32_t index, const BindGroup& bindGroup) const
{
MOZ_CRASH("todo");
}
void
CommandEncoder::SetPipeline(const dom::WebGPUComputePipelineOrWebGPURenderPipeline& pipeline) const
{
MOZ_CRASH("todo");
}
void
CommandEncoder::BeginComputePass() const
{
MOZ_CRASH("todo");
}
void
CommandEncoder::EndComputePass() const
{
MOZ_CRASH("todo");
}
void
CommandEncoder::Dispatch(const uint32_t x, const uint32_t y, const uint32_t z) const
{
MOZ_CRASH("todo");
}
void
CommandEncoder::BeginRenderPass(const dom::WebGPURenderPassDescriptor& desc) const
{
MOZ_CRASH("todo");
}
void
CommandEncoder::EndRenderPass() const
{
MOZ_CRASH("todo");
}
void
CommandEncoder::SetBlendColor(const float r, const float g, const float b,
const float a) const
{
MOZ_CRASH("todo");
}
void
CommandEncoder::SetIndexBuffer(const Buffer& buffer, const uint32_t offset) const
{
MOZ_CRASH("todo");
}
void
CommandEncoder::SetVertexBuffers(const uint32_t startSlot,
const dom::Sequence<OwningNonNull<Buffer>>& buffers,
const dom::Sequence<uint32_t>& offsets) const
{
MOZ_CRASH("todo");
}
void
CommandEncoder::Draw(const uint32_t vertexCount, const uint32_t instanceCount,
const uint32_t firstVertex, const uint32_t firstInstance) const
{
MOZ_CRASH("todo");
}
void
CommandEncoder::DrawIndexed(const uint32_t indexCount, const uint32_t instanceCount,
const uint32_t firstIndex, const uint32_t firstInstance,
const uint32_t firstVertex) const
{
MOZ_CRASH("todo");
}
WEBGPU_IMPL_GOOP_0(CommandEncoder)
} // namespace webgpu
} // namespace mozilla

Просмотреть файл

@ -0,0 +1,83 @@
/* -*- 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 WEBGPU_CommandEncoder_H_
#define WEBGPU_CommandEncoder_H_
#include "mozilla/dom/TypedArray.h"
#include "nsWrapperCache.h"
#include "ObjectModel.h"
namespace mozilla {
namespace dom {
template<typename T> class Sequence;
class WebGPUComputePipelineOrWebGPURenderPipeline;
struct WebGPURenderPassDescriptor;
} // namespace dom
namespace webgpu {
class BindGroup;
class Buffer;
class CommandBuffer;
class Device;
class CommandEncoder final
: public ChildOf<Device>
{
public:
WEBGPU_DECL_GOOP(CommandEncoder)
private:
CommandEncoder() = delete;
virtual ~CommandEncoder();
public:
already_AddRefed<CommandBuffer> FinishEncoding() const;
// Commands allowed outside of "passes"
void CopyBufferToBuffer(const Buffer& src, uint32_t srcOffset, const Buffer& dst,
uint32_t dstOffset, uint32_t size) const;
// TODO figure out all the arguments required for these
void CopyBufferToTexture() const;
void CopyTextureToBuffer() const;
void CopyTextureToTexture() const;
void Blit() const;
void TransitionBuffer(const Buffer& b, uint32_t flags) const;
// Allowed in both compute and render passes
void SetPushConstants(uint32_t stageFlags,
uint32_t offset,
uint32_t count,
const dom::ArrayBuffer& data) const;
void SetBindGroup(uint32_t index, const BindGroup& bindGroup) const;
void SetPipeline(const dom::WebGPUComputePipelineOrWebGPURenderPipeline& pipeline) const;
// Compute pass commands
void BeginComputePass() const;
void EndComputePass() const;
void Dispatch(uint32_t x, uint32_t y, uint32_t z) const;
// Render pass commands
void BeginRenderPass(const dom::WebGPURenderPassDescriptor& desc) const;
void EndRenderPass() const;
void SetBlendColor(float r, float g, float b, float a) const;
void SetIndexBuffer(const Buffer& buffer, uint32_t offset) const;
void SetVertexBuffers(uint32_t startSlot,
const dom::Sequence<OwningNonNull<Buffer>>& buffers,
const dom::Sequence<uint32_t>& offsets) const;
void Draw(uint32_t vertexCount, uint32_t instanceCount, uint32_t firstVertex,
uint32_t firstInstance) const;
void DrawIndexed(uint32_t indexCount, uint32_t instanceCount, uint32_t firstIndex,
uint32_t firstInstance, uint32_t firstVertex) const;
};
} // namespace webgpu
} // namespace mozilla
#endif // WEBGPU_CommandEncoder_H_

Просмотреть файл

@ -0,0 +1,19 @@
/* -*- 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 "ComputePipeline.h"
#include "Device.h"
#include "mozilla/dom/WebGPUBinding.h"
namespace mozilla {
namespace webgpu {
ComputePipeline::~ComputePipeline() = default;
WEBGPU_IMPL_GOOP_0(ComputePipeline)
} // namespace webgpu
} // namespace mozilla

Просмотреть файл

@ -0,0 +1,31 @@
/* -*- 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 WEBGPU_ComputePipeline_H_
#define WEBGPU_ComputePipeline_H_
#include "nsWrapperCache.h"
#include "ObjectModel.h"
namespace mozilla {
namespace webgpu {
class Device;
class ComputePipeline final
: public ChildOf<Device>
{
public:
WEBGPU_DECL_GOOP(ComputePipeline)
private:
ComputePipeline() = delete;
virtual ~ComputePipeline();
};
} // namespace webgpu
} // namespace mozilla
#endif // WEBGPU_ComputePipeline_H_

Просмотреть файл

@ -0,0 +1,19 @@
/* -*- 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 "DepthStencilState.h"
#include "Device.h"
#include "mozilla/dom/WebGPUBinding.h"
namespace mozilla {
namespace webgpu {
DepthStencilState::~DepthStencilState() = default;
WEBGPU_IMPL_GOOP_0(DepthStencilState)
} // namespace webgpu
} // namespace mozilla

Просмотреть файл

@ -0,0 +1,31 @@
/* -*- 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 WEBGPU_DepthStencilState_H_
#define WEBGPU_DepthStencilState_H_
#include "nsWrapperCache.h"
#include "ObjectModel.h"
namespace mozilla {
namespace webgpu {
class Device;
class DepthStencilState final
: public ChildOf<Device>
{
public:
WEBGPU_DECL_GOOP(DepthStencilState)
private:
DepthStencilState() = delete;
virtual ~DepthStencilState();
};
} // namespace webgpu
} // namespace mozilla
#endif // WEBGPU_DepthStencilState_H_

153
dom/webgpu/Device.cpp Normal file
Просмотреть файл

@ -0,0 +1,153 @@
/* -*- 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 "Device.h"
#include "Adapter.h"
#include "mozilla/dom/WebGPUBinding.h"
namespace mozilla {
namespace webgpu {
Device::~Device() = default;
already_AddRefed<webgpu::Adapter>
Device::Adapter() const
{
MOZ_CRASH("todo");
}
void
Device::Extensions(dom::WebGPUExtensions& out) const
{
MOZ_CRASH("todo");
}
void
Device::Features(dom::WebGPUFeatures& out) const
{
MOZ_CRASH("todo");
}
void
Device::Limits(dom::WebGPULimits& out) const
{
MOZ_CRASH("todo");
}
already_AddRefed<Buffer>
Device::CreateBuffer(const dom::WebGPUBufferDescriptor& desc) const
{
MOZ_CRASH("todo");
}
already_AddRefed<Texture>
Device::CreateTexture(const dom::WebGPUTextureDescriptor& desc) const
{
MOZ_CRASH("todo");
}
already_AddRefed<Sampler>
Device::CreateSampler(const dom::WebGPUSamplerDescriptor& desc) const
{
MOZ_CRASH("todo");
}
already_AddRefed<BindGroupLayout>
Device::CreateBindGroupLayout(const dom::WebGPUBindGroupLayoutDescriptor& desc) const
{
MOZ_CRASH("todo");
}
already_AddRefed<PipelineLayout>
Device::CreatePipelineLayout(const dom::WebGPUPipelineLayoutDescriptor& desc) const
{
MOZ_CRASH("todo");
}
already_AddRefed<BindGroup>
Device::CreateBindGroup(const dom::WebGPUBindGroupDescriptor& desc) const
{
MOZ_CRASH("todo");
}
already_AddRefed<BlendState>
Device::CreateBlendState(const dom::WebGPUBlendStateDescriptor& desc) const
{
MOZ_CRASH("todo");
}
already_AddRefed<DepthStencilState>
Device::CreateDepthStencilState(const dom::WebGPUDepthStencilStateDescriptor& desc) const
{
MOZ_CRASH("todo");
}
already_AddRefed<InputState>
Device::CreateInputState(const dom::WebGPUInputStateDescriptor& desc) const
{
MOZ_CRASH("todo");
}
already_AddRefed<ShaderModule>
Device::CreateShaderModule(const dom::WebGPUShaderModuleDescriptor& desc) const
{
MOZ_CRASH("todo");
}
already_AddRefed<AttachmentState>
Device::CreateAttachmentState(const dom::WebGPUAttachmentStateDescriptor& desc) const
{
MOZ_CRASH("todo");
}
already_AddRefed<ComputePipeline>
Device::CreateComputePipeline(const dom::WebGPUComputePipelineDescriptor& desc) const
{
MOZ_CRASH("todo");
}
already_AddRefed<RenderPipeline>
Device::CreateRenderPipeline(const dom::WebGPURenderPipelineDescriptor& desc) const
{
MOZ_CRASH("todo");
}
already_AddRefed<CommandEncoder>
Device::CreateCommandEncoder(const dom::WebGPUCommandEncoderDescriptor& desc) const
{
MOZ_CRASH("todo");
}
already_AddRefed<Queue>
Device::GetQueue() const
{
MOZ_CRASH("todo");
}
RefPtr<dom::WebGPULogCallback>
Device::OnLog() const
{
MOZ_CRASH("todo");
}
void
Device::SetOnLog(const dom::WebGPULogCallback& callback) const
{
MOZ_CRASH("todo");
}
already_AddRefed<dom::Promise>
Device::GetObjectStatus(const dom::WebGPUBufferOrWebGPUTexture& obj) const
{
MOZ_CRASH("todo");
}
WEBGPU_IMPL_GOOP_0(Device)
} // namespace webgpu
} // namespace mozilla

103
dom/webgpu/Device.h Normal file
Просмотреть файл

@ -0,0 +1,103 @@
/* -*- 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 WEBGPU_DEVICE_H_
#define WEBGPU_DEVICE_H_
#include "mozilla/RefPtr.h"
#include "ObjectModel.h"
namespace mozilla {
namespace dom {
struct WebGPUExtensions;
struct WebGPUFeatures;
struct WebGPULimits;
struct WebGPUBufferDescriptor;
struct WebGPUTextureDescriptor;
struct WebGPUSamplerDescriptor;
struct WebGPUBindGroupLayoutDescriptor;
struct WebGPUPipelineLayoutDescriptor;
struct WebGPUBindGroupDescriptor;
struct WebGPUBlendStateDescriptor;
struct WebGPUDepthStencilStateDescriptor;
struct WebGPUInputStateDescriptor;
struct WebGPUShaderModuleDescriptor;
struct WebGPUAttachmentStateDescriptor;
struct WebGPUComputePipelineDescriptor;
struct WebGPURenderPipelineDescriptor;
struct WebGPUCommandEncoderDescriptor;
class Promise;
class WebGPUBufferOrWebGPUTexture;
class WebGPULogCallback;
} // namespace dom
namespace webgpu {
class Adapter;
class AttachmentState;
class BindGroup;
class BindGroupLayout;
class BlendState;
class Buffer;
class CommandEncoder;
class ComputePipeline;
class DepthStencilState;
class Fence;
class InputState;
class PipelineLayout;
class Queue;
class RenderPipeline;
class Sampler;
class ShaderModule;
class Texture;
class Device final
: public ChildOf<Adapter>
{
public:
WEBGPU_DECL_GOOP(Device)
private:
Device() = delete;
virtual ~Device();
public:
already_AddRefed<webgpu::Adapter> Adapter() const;
void Extensions(dom::WebGPUExtensions& out) const;
void Features(dom::WebGPUFeatures& out) const;
void Limits(dom::WebGPULimits& out) const;
already_AddRefed<Buffer> CreateBuffer(const dom::WebGPUBufferDescriptor& desc) const;
already_AddRefed<Texture> CreateTexture(const dom::WebGPUTextureDescriptor& desc) const;
already_AddRefed<Sampler> CreateSampler(const dom::WebGPUSamplerDescriptor& desc) const;
already_AddRefed<BindGroupLayout> CreateBindGroupLayout(const dom::WebGPUBindGroupLayoutDescriptor& desc) const;
already_AddRefed<PipelineLayout> CreatePipelineLayout(const dom::WebGPUPipelineLayoutDescriptor& desc) const;
already_AddRefed<BindGroup> CreateBindGroup(const dom::WebGPUBindGroupDescriptor& desc) const;
already_AddRefed<BlendState> CreateBlendState(const dom::WebGPUBlendStateDescriptor& desc) const;
already_AddRefed<DepthStencilState> CreateDepthStencilState(const dom::WebGPUDepthStencilStateDescriptor& desc) const;
already_AddRefed<InputState> CreateInputState(const dom::WebGPUInputStateDescriptor& desc) const;
already_AddRefed<ShaderModule> CreateShaderModule(const dom::WebGPUShaderModuleDescriptor& desc) const;
already_AddRefed<AttachmentState> CreateAttachmentState(const dom::WebGPUAttachmentStateDescriptor& desc) const;
already_AddRefed<ComputePipeline> CreateComputePipeline(const dom::WebGPUComputePipelineDescriptor& desc) const;
already_AddRefed<RenderPipeline> CreateRenderPipeline(const dom::WebGPURenderPipelineDescriptor& desc) const;
already_AddRefed<CommandEncoder> CreateCommandEncoder(const dom::WebGPUCommandEncoderDescriptor& desc) const;
already_AddRefed<Queue> GetQueue() const;
RefPtr<dom::WebGPULogCallback> OnLog() const;
void SetOnLog(const dom::WebGPULogCallback& callback) const;
already_AddRefed<dom::Promise> GetObjectStatus(const dom::WebGPUBufferOrWebGPUTexture& obj) const;
};
} // namespace webgpu
} // namespace mozilla
#endif // WEBGPU_DEVICE_H_

31
dom/webgpu/Fence.cpp Normal file
Просмотреть файл

@ -0,0 +1,31 @@
/* -*- 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 "Fence.h"
#include "Device.h"
#include "mozilla/dom/WebGPUBinding.h"
namespace mozilla {
namespace webgpu {
Fence::~Fence() = default;
bool
Fence::Wait(const double milliseconds) const
{
MOZ_CRASH("todo");
}
already_AddRefed<dom::Promise>
Fence::Promise() const
{
MOZ_CRASH("todo");
}
WEBGPU_IMPL_GOOP_0(Fence)
} // namespace webgpu
} // namespace mozilla

38
dom/webgpu/Fence.h Normal file
Просмотреть файл

@ -0,0 +1,38 @@
/* -*- 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 WEBGPU_Fence_H_
#define WEBGPU_Fence_H_
#include "nsWrapperCache.h"
#include "ObjectModel.h"
namespace mozilla {
namespace dom {
class Promise;
} // namespace dom
namespace webgpu {
class Device;
class Fence final
: public ChildOf<Device>
{
public:
WEBGPU_DECL_GOOP(Fence)
private:
Fence() = delete;
virtual ~Fence();
public:
bool Wait(double milliseconds) const;
already_AddRefed<dom::Promise> Promise() const;
};
} // namespace webgpu
} // namespace mozilla
#endif // WEBGPU_Fence_H_

19
dom/webgpu/InputState.cpp Normal file
Просмотреть файл

@ -0,0 +1,19 @@
/* -*- 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 "InputState.h"
#include "Device.h"
#include "mozilla/dom/WebGPUBinding.h"
namespace mozilla {
namespace webgpu {
InputState::~InputState() = default;
WEBGPU_IMPL_GOOP_0(InputState)
} // namespace webgpu
} // namespace mozilla

31
dom/webgpu/InputState.h Normal file
Просмотреть файл

@ -0,0 +1,31 @@
/* -*- 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 WEBGPU_InputState_H_
#define WEBGPU_InputState_H_
#include "nsWrapperCache.h"
#include "ObjectModel.h"
namespace mozilla {
namespace webgpu {
class Device;
class InputState final
: public ChildOf<Device>
{
public:
WEBGPU_DECL_GOOP(InputState)
private:
InputState() = delete;
virtual ~InputState();
};
} // namespace webgpu
} // namespace mozilla
#endif // WEBGPU_InputState_H_

63
dom/webgpu/Instance.cpp Normal file
Просмотреть файл

@ -0,0 +1,63 @@
/* -*- 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 "Instance.h"
#include "Adapter.h"
#include "InstanceProvider.h"
#include "mozilla/dom/WebGPUBinding.h"
#include "nsIGlobalObject.h"
namespace mozilla {
namespace webgpu {
/*static*/ RefPtr<Instance>
Instance::Create(nsIGlobalObject* parent)
{
return new Instance(parent);
}
Instance::Instance(nsIGlobalObject* parent)
: mParent(parent)
{
}
Instance::~Instance() = default;
already_AddRefed<Adapter>
Instance::GetAdapter(const dom::WebGPUAdapterDescriptor& desc) const
{
MOZ_CRASH("todo");
}
template<typename T>
void
ImplCycleCollectionTraverse(nsCycleCollectionTraversalCallback& callback,
const nsCOMPtr<T>& field,
const char* name, uint32_t flags)
{
CycleCollectionNoteChild(callback, field.get(), name, flags);
}
template<typename T>
void
ImplCycleCollectionUnlink(const nsCOMPtr<T>& field)
{
const auto mut = const_cast<nsCOMPtr<T>*>(&field);
*mut = nullptr;
}
JSObject*
Instance::WrapObject(JSContext* cx, JS::Handle<JSObject*> givenProto)
{
return dom::WebGPU_Binding::Wrap(cx, this, givenProto);
}
NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(Instance, AddRef)
NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(Instance, Release)
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(Instance, mParent)
} // namespace webgpu
} // namespace mozilla

46
dom/webgpu/Instance.h Normal file
Просмотреть файл

@ -0,0 +1,46 @@
/* -*- 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 WEBGPU_INSTANCE_H_
#define WEBGPU_INSTANCE_H_
#include "mozilla/AlreadyAddRefed.h"
#include "mozilla/RefPtr.h"
#include "nsCOMPtr.h"
#include "ObjectModel.h"
namespace mozilla {
namespace dom {
struct WebGPUAdapterDescriptor;
} // namespace dom
namespace webgpu {
class Adapter;
class InstanceProvider;
class Instance final
: public nsWrapperCache
{
public:
WEBGPU_DECL_GOOP(Instance)
const nsCOMPtr<nsIGlobalObject> mParent;
static RefPtr<Instance> Create(nsIGlobalObject* parent);
private:
explicit Instance(nsIGlobalObject* parent);
virtual ~Instance();
public:
nsIGlobalObject* GetParentObject() const { return mParent.get(); }
already_AddRefed<Adapter> GetAdapter(const dom::WebGPUAdapterDescriptor& desc) const;
};
} // namespace webgpu
} // namespace mozilla
#endif // WEBGPU_INSTANCE_H_

Просмотреть файл

@ -0,0 +1,47 @@
/* -*- 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 "InstanceProvider.h"
#include "Instance.h"
#include "mozilla/dom/WebGPUBinding.h"
namespace mozilla {
namespace webgpu {
InstanceProvider::InstanceProvider(nsIGlobalObject* const global)
: mGlobal(global)
{ }
InstanceProvider::~InstanceProvider() = default;
already_AddRefed<Instance>
InstanceProvider::Webgpu() const
{
if (!mInstance) {
const auto inst = Instance::Create(mGlobal);
mInstance = Some(inst);
}
auto ret = mInstance.value();
return ret.forget();
}
void
InstanceProvider::CcTraverse(nsCycleCollectionTraversalCallback& callback) const
{
if (mInstance) {
CycleCollectionNoteChild(callback, mInstance.ref().get(),
"webgpu::InstanceProvider::mInstance", 0);
}
}
void
InstanceProvider::CcUnlink()
{
mInstance = Some(nullptr);
}
} // namespace webgpu
} // namespace mozilla

Просмотреть файл

@ -0,0 +1,60 @@
/* -*- 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 WEBGPU_INSTANCE_PROVIDER_H_
#define WEBGPU_INSTANCE_PROVIDER_H_
#include "mozilla/AlreadyAddRefed.h"
#include "mozilla/Maybe.h"
#include "mozilla/RefPtr.h"
class nsCycleCollectionTraversalCallback;
class nsIGlobalObject;
namespace mozilla {
namespace webgpu {
class Instance;
class InstanceProvider
{
private:
nsIGlobalObject* const mGlobal;
mutable Maybe<RefPtr<Instance>> mInstance;
protected:
explicit InstanceProvider(nsIGlobalObject* global);
virtual ~InstanceProvider();
public:
already_AddRefed<Instance> Webgpu() const;
nsIGlobalObject* GetParentObject() const { return mGlobal; }
void CcTraverse(nsCycleCollectionTraversalCallback&) const;
void CcUnlink();
};
template<typename T>
void
ImplCycleCollectionTraverse(nsCycleCollectionTraversalCallback& callback,
const Maybe<T>& field,
const char* name, uint32_t flags)
{
if (field) {
CycleCollectionNoteChild(callback, field.value(), name, flags);
}
}
template<typename T>
void
ImplCycleCollectionUnlink(Maybe<T>& field)
{
field = Nothing();
}
} // namespace webgpu
} // namespace mozilla
#endif // WEBGPU_INSTANCE_PROVIDER_H_

37
dom/webgpu/LogEntry.cpp Normal file
Просмотреть файл

@ -0,0 +1,37 @@
/* -*- 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 "LogEntry.h"
#include "Device.h"
#include "mozilla/dom/WebGPUBinding.h"
namespace mozilla {
namespace webgpu {
LogEntry::~LogEntry() = default;
dom::WebGPULogEntryType
LogEntry::Type() const
{
MOZ_CRASH("todo");
}
void
LogEntry::GetObj(JSContext* cx, JS::MutableHandleValue out) const
{
MOZ_CRASH("todo");
}
void
LogEntry::GetReason(nsString& out) const
{
MOZ_CRASH("todo");
}
WEBGPU_IMPL_GOOP_0(LogEntry)
} // namespace webgpu
} // namespace mozilla

39
dom/webgpu/LogEntry.h Normal file
Просмотреть файл

@ -0,0 +1,39 @@
/* -*- 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 WEBGPU_LogEntry_H_
#define WEBGPU_LogEntry_H_
#include "nsWrapperCache.h"
#include "ObjectModel.h"
namespace mozilla {
namespace dom {
enum class WebGPULogEntryType : uint8_t;
} // namespace dom
namespace webgpu {
class Device;
class LogEntry final
: public ChildOf<Device>
{
public:
WEBGPU_DECL_GOOP(LogEntry)
private:
LogEntry() = delete;
virtual ~LogEntry();
public:
dom::WebGPULogEntryType Type() const;
void GetObj(JSContext* cx, JS::MutableHandleValue out) const;
void GetReason(nsString& out) const;
};
} // namespace webgpu
} // namespace mozilla
#endif // WEBGPU_LogEntry_H_

Просмотреть файл

@ -0,0 +1,35 @@
/* -*- 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 "ObjectModel.h"
#include "Adapter.h"
#include "Device.h"
#include "Instance.h"
namespace mozilla {
namespace webgpu {
template<typename T>
ChildOf<T>::ChildOf(T* const parent)
: mParent(parent)
{ }
template<typename T>
ChildOf<T>::~ChildOf() = default;
template<typename T>
nsIGlobalObject*
ChildOf<T>::GetParentObject() const
{
return mParent->GetParentObject();
}
template class ChildOf<Adapter>;
template class ChildOf<Device>;
template class ChildOf<Instance>;
} // namespace webgpu
} // namespace mozilla

73
dom/webgpu/ObjectModel.h Normal file
Просмотреть файл

@ -0,0 +1,73 @@
/* -*- 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 WEBGPU_OBJECT_MODEL_H_
#define WEBGPU_OBJECT_MODEL_H_
#include "nsWrapperCache.h"
class nsIGlobalObject;
namespace mozilla {
namespace webgpu {
template<typename T>
class ChildOf
: public nsWrapperCache
{
public:
const RefPtr<T> mParent;
explicit ChildOf(T* parent = nullptr); // TODO: This can't be nullptr eventually.
protected:
virtual ~ChildOf();
public:
nsIGlobalObject* GetParentObject() const;
};
} // namespace webgpu
} // namespace mozilla
#define WEBGPU_DECL_GOOP(T) \
NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(T) \
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(T) \
virtual JSObject* WrapObject(JSContext* cx, JS::Handle<JSObject*> givenProto) override;
#define WEBGPU_IMPL_GOOP_INTERNAL(T) \
JSObject* \
T::WrapObject(JSContext* cx, JS::Handle<JSObject*> givenProto) \
{ \
return dom::WebGPU ## T ## _Binding::Wrap(cx, this, givenProto); \
} \
NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(T, AddRef) \
NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(T, Release)
#define WEBGPU_IMPL_GOOP(T,...) \
WEBGPU_IMPL_GOOP_INTERNAL(T) \
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(T, mParent, __VA_ARGS__)
#define WEBGPU_IMPL_GOOP_0(T) \
WEBGPU_IMPL_GOOP_INTERNAL(T) \
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(T, mParent)
template<typename T>
void
ImplCycleCollectionTraverse(nsCycleCollectionTraversalCallback& callback,
const RefPtr<T>& field,
const char* name, uint32_t flags)
{
CycleCollectionNoteChild(callback, field.get(), name, flags);
}
template<typename T>
void
ImplCycleCollectionUnlink(const RefPtr<T>& field)
{
const auto mutPtr = const_cast< RefPtr<T>* >(&field);
ImplCycleCollectionUnlink(*mutPtr);
}
#endif // WEBGPU_OBJECT_MODEL_H_

Просмотреть файл

@ -0,0 +1,19 @@
/* -*- 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 "PipelineLayout.h"
#include "Device.h"
#include "mozilla/dom/WebGPUBinding.h"
namespace mozilla {
namespace webgpu {
PipelineLayout::~PipelineLayout() = default;
WEBGPU_IMPL_GOOP_0(PipelineLayout)
} // namespace webgpu
} // namespace mozilla

Просмотреть файл

@ -0,0 +1,31 @@
/* -*- 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 WEBGPU_PipelineLayout_H_
#define WEBGPU_PipelineLayout_H_
#include "nsWrapperCache.h"
#include "ObjectModel.h"
namespace mozilla {
namespace webgpu {
class Device;
class PipelineLayout final
: public ChildOf<Device>
{
public:
WEBGPU_DECL_GOOP(PipelineLayout)
private:
PipelineLayout() = delete;
virtual ~PipelineLayout();
};
} // namespace webgpu
} // namespace mozilla
#endif // WEBGPU_PipelineLayout_H_

31
dom/webgpu/Queue.cpp Normal file
Просмотреть файл

@ -0,0 +1,31 @@
/* -*- 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 "Queue.h"
#include "Device.h"
#include "mozilla/dom/WebGPUBinding.h"
namespace mozilla {
namespace webgpu {
Queue::~Queue() = default;
void
Queue::Submit(const dom::Sequence<OwningNonNull<CommandBuffer>>& buffers) const
{
MOZ_CRASH("todo");
}
already_AddRefed<Fence>
Queue::InsertFence() const
{
MOZ_CRASH("todo");
}
WEBGPU_IMPL_GOOP_0(Queue)
} // namespace webgpu
} // namespace mozilla

41
dom/webgpu/Queue.h Normal file
Просмотреть файл

@ -0,0 +1,41 @@
/* -*- 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 WEBGPU_Queue_H_
#define WEBGPU_Queue_H_
#include "nsWrapperCache.h"
#include "ObjectModel.h"
namespace mozilla {
namespace dom {
template<typename T> class Sequence;
} // namespace dom
namespace webgpu {
class CommandBuffer;
class Device;
class Fence;
class Queue final
: public ChildOf<Device>
{
public:
WEBGPU_DECL_GOOP(Queue)
private:
Queue() = delete;
virtual ~Queue();
public:
void Submit(const dom::Sequence<OwningNonNull<CommandBuffer>>& buffers) const;
already_AddRefed<Fence> InsertFence() const;
};
} // namespace webgpu
} // namespace mozilla
#endif // WEBGPU_Queue_H_

Просмотреть файл

@ -0,0 +1,19 @@
/* -*- 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 "RenderPipeline.h"
#include "Device.h"
#include "mozilla/dom/WebGPUBinding.h"
namespace mozilla {
namespace webgpu {
RenderPipeline::~RenderPipeline() = default;
WEBGPU_IMPL_GOOP_0(RenderPipeline)
} // namespace webgpu
} // namespace mozilla

Просмотреть файл

@ -0,0 +1,31 @@
/* -*- 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 WEBGPU_RenderPipeline_H_
#define WEBGPU_RenderPipeline_H_
#include "nsWrapperCache.h"
#include "ObjectModel.h"
namespace mozilla {
namespace webgpu {
class Device;
class RenderPipeline final
: public ChildOf<Device>
{
public:
WEBGPU_DECL_GOOP(RenderPipeline)
private:
RenderPipeline() = delete;
virtual ~RenderPipeline();
};
} // namespace webgpu
} // namespace mozilla
#endif // WEBGPU_RenderPipeline_H_

19
dom/webgpu/Sampler.cpp Normal file
Просмотреть файл

@ -0,0 +1,19 @@
/* -*- 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 "Sampler.h"
#include "Device.h"
#include "mozilla/dom/WebGPUBinding.h"
namespace mozilla {
namespace webgpu {
Sampler::~Sampler() = default;
WEBGPU_IMPL_GOOP_0(Sampler)
} // namespace webgpu
} // namespace mozilla

31
dom/webgpu/Sampler.h Normal file
Просмотреть файл

@ -0,0 +1,31 @@
/* -*- 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 WEBGPU_SAMPLER_H_
#define WEBGPU_SAMPLER_H_
#include "nsWrapperCache.h"
#include "ObjectModel.h"
namespace mozilla {
namespace webgpu {
class Device;
class Sampler final
: public ChildOf<Device>
{
public:
WEBGPU_DECL_GOOP(Sampler)
private:
Sampler() = delete;
virtual ~Sampler();
};
} // namespace webgpu
} // namespace mozilla
#endif // WEBGPU_SAMPLER_H_

Просмотреть файл

@ -0,0 +1,19 @@
/* -*- 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 "ShaderModule.h"
#include "Device.h"
#include "mozilla/dom/WebGPUBinding.h"
namespace mozilla {
namespace webgpu {
ShaderModule::~ShaderModule() = default;
WEBGPU_IMPL_GOOP_0(ShaderModule)
} // namespace webgpu
} // namespace mozilla

31
dom/webgpu/ShaderModule.h Normal file
Просмотреть файл

@ -0,0 +1,31 @@
/* -*- 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 WEBGPU_ShaderModule_H_
#define WEBGPU_ShaderModule_H_
#include "nsWrapperCache.h"
#include "ObjectModel.h"
namespace mozilla {
namespace webgpu {
class Device;
class ShaderModule final
: public ChildOf<Device>
{
public:
WEBGPU_DECL_GOOP(ShaderModule)
private:
ShaderModule() = delete;
virtual ~ShaderModule();
};
} // namespace webgpu
} // namespace mozilla
#endif // WEBGPU_ShaderModule_H_

37
dom/webgpu/SwapChain.cpp Normal file
Просмотреть файл

@ -0,0 +1,37 @@
/* -*- 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 "SwapChain.h"
#include "Device.h"
#include "mozilla/dom/WebGPUBinding.h"
namespace mozilla {
namespace webgpu {
SwapChain::~SwapChain() = default;
void
SwapChain::Configure(const dom::WebGPUSwapChainDescriptor& desc) const
{
MOZ_CRASH("todo");
}
already_AddRefed<Texture>
SwapChain::GetNextTexture() const
{
MOZ_CRASH("todo");
}
void
SwapChain::Present() const
{
MOZ_CRASH("todo");
}
WEBGPU_IMPL_GOOP_0(SwapChain)
} // namespace webgpu
} // namespace mozilla

41
dom/webgpu/SwapChain.h Normal file
Просмотреть файл

@ -0,0 +1,41 @@
/* -*- 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 WEBGPU_SwapChain_H_
#define WEBGPU_SwapChain_H_
#include "nsWrapperCache.h"
#include "ObjectModel.h"
namespace mozilla {
namespace dom {
struct WebGPUSwapChainDescriptor;
} // namespace dom
namespace webgpu {
class Device;
class Texture;
class SwapChain final
: public ChildOf<Device>
{
public:
WEBGPU_DECL_GOOP(SwapChain)
private:
SwapChain() = delete;
virtual ~SwapChain();
public:
void Configure(const dom::WebGPUSwapChainDescriptor& desc) const;
already_AddRefed<Texture> GetNextTexture() const;
void Present() const;
};
} // namespace webgpu
} // namespace mozilla
#endif // WEBGPU_SwapChain_H_

26
dom/webgpu/Texture.cpp Normal file
Просмотреть файл

@ -0,0 +1,26 @@
/* -*- 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 "Texture.h"
#include "Device.h"
#include "mozilla/dom/WebGPUBinding.h"
#include "TextureView.h"
namespace mozilla {
namespace webgpu {
Texture::~Texture() = default;
already_AddRefed<TextureView>
Texture::CreateTextureView(const dom::WebGPUTextureViewDescriptor& desc) const
{
MOZ_CRASH("todo");
}
WEBGPU_IMPL_GOOP_0(Texture)
} // namespace webgpu
} // namespace mozilla

39
dom/webgpu/Texture.h Normal file
Просмотреть файл

@ -0,0 +1,39 @@
/* -*- 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 WEBGPU_Texture_H_
#define WEBGPU_Texture_H_
#include "nsWrapperCache.h"
#include "ObjectModel.h"
namespace mozilla {
namespace dom {
struct WebGPUTextureViewDescriptor;
} // namespace dom
namespace webgpu {
class Device;
class TextureView;
class Texture final
: public ChildOf<Device>
{
public:
WEBGPU_DECL_GOOP(Texture)
private:
Texture() = delete;
virtual ~Texture();
public:
already_AddRefed<TextureView> CreateTextureView(const dom::WebGPUTextureViewDescriptor&) const;
};
} // namespace webgpu
} // namespace mozilla
#endif // WEBGPU_Texture_H_

Просмотреть файл

@ -0,0 +1,19 @@
/* -*- 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 "TextureView.h"
#include "Device.h"
#include "mozilla/dom/WebGPUBinding.h"
namespace mozilla {
namespace webgpu {
TextureView::~TextureView() = default;
WEBGPU_IMPL_GOOP_0(TextureView)
} // namespace webgpu
} // namespace mozilla

31
dom/webgpu/TextureView.h Normal file
Просмотреть файл

@ -0,0 +1,31 @@
/* -*- 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 WEBGPU_TEXTURE_VIEW_H_
#define WEBGPU_TEXTURE_VIEW_H_
#include "nsWrapperCache.h"
#include "ObjectModel.h"
namespace mozilla {
namespace webgpu {
class Device;
class TextureView final
: public ChildOf<Device>
{
public:
WEBGPU_DECL_GOOP(TextureView)
private:
TextureView() = delete;
virtual ~TextureView();
};
} // namespace webgpu
} // namespace mozilla
#endif // WEBGPU_TEXTURE_VIEW_H_

Просмотреть файл

@ -0,0 +1,5 @@
[DEFAULT]
subsuite = webgl1-core
[test_disabled.html]

Просмотреть файл

@ -0,0 +1,6 @@
[DEFAULT]
subsuite = webgl1-core
prefs = dom.webgpu.enable=true
[test_enabled.html]

Просмотреть файл

@ -0,0 +1,18 @@
<!DOCTYPE HTML>
<html>
<head>
<meta charset='utf-8'>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
</head>
<body>
<script>
ok(!SpecialPowers.getBoolPref('dom.webgpu.enable'), 'Pref should be disabled.');
ok(window.WebGPU === undefined, 'window.WebGPU === undefined');
ok(window.webgpu === undefined, 'window.webgpu === undefined');
</script>
</body>
</html>

Просмотреть файл

@ -0,0 +1,18 @@
<!DOCTYPE HTML>
<html>
<head>
<meta charset='utf-8'>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
</head>
<body>
<script>
ok(SpecialPowers.getBoolPref('dom.webgpu.enable'), 'Pref should be enabled.');
ok(window.WebGPU !== undefined, 'window.WebGPU !== undefined');
ok(window.webgpu !== undefined, 'window.webgpu !== undefined');
</script>
</body>
</html>

49
dom/webgpu/moz.build Normal file
Просмотреть файл

@ -0,0 +1,49 @@
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# 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/.
with Files('**'):
BUG_COMPONENT = ('Core', 'Canvas: WebGL')
MOCHITEST_MANIFESTS += [
'mochitest/mochitest-no-pref.ini',
'mochitest/mochitest.ini',
]
h_and_cpp = [
'Adapter',
'AttachmentState',
'BindGroup',
'BindGroupLayout',
'BlendState',
'Buffer',
'CommandBuffer',
'CommandEncoder',
'ComputePipeline',
'DepthStencilState',
'Device',
'Fence',
'InputState',
'Instance',
'InstanceProvider',
'LogEntry',
'ObjectModel',
'PipelineLayout',
'Queue',
'RenderPipeline',
'Sampler',
'ShaderModule',
'SwapChain',
'Texture',
'TextureView',
]
EXPORTS.mozilla.webgpu += [x + '.h' for x in h_and_cpp]
UNIFIED_SOURCES += [x + '.cpp' for x in h_and_cpp]
EXPORTS.mozilla.webgpu += [
# 'ObjectModel.h',
]
FINAL_LIBRARY = 'xul'

Просмотреть файл

@ -41,6 +41,8 @@ interface Element : Node {
[Pure]
DOMString? getAttributeNS(DOMString? namespace, DOMString localName);
[CEReactions, NeedsSubjectPrincipal=NonSystem, Throws]
boolean toggleAttribute(DOMString name, optional boolean force);
[CEReactions, NeedsSubjectPrincipal=NonSystem, Throws]
void setAttribute(DOMString name, DOMString value);
[CEReactions, NeedsSubjectPrincipal=NonSystem, Throws]
void setAttributeNS(DOMString? namespace, DOMString name, DOMString value);

Просмотреть файл

@ -23,15 +23,9 @@ interface ScrollBoxObject : BoxObject {
[Throws]
void scrollBy(long dx, long dy);
[Throws]
void scrollByLine(long dlines);
[Throws]
void scrollByIndex(long dindexes);
[Throws]
void scrollToLine(long line);
[Throws]
void scrollToElement(Element child);
[Throws]
void scrollToIndex(long index);
/**
* Get the current scroll position in css pixels.
@ -46,25 +40,6 @@ interface ScrollBoxObject : BoxObject {
[Pure, Throws]
readonly attribute long scrolledHeight;
/**
* DEPRECATED: Please use positionX and positionY
*
* Get the current scroll position in css pixels.
* @see scrollTo for the definition of x and y.
*/
[Throws]
void getPosition(object x, object y);
/**
* DEPRECATED: Please use scrolledWidth and scrolledHeight
*/
[Throws]
void getScrolledSize(object width, object height);
[Throws]
void ensureElementIsVisible(Element child);
[Throws]
void ensureIndexIsVisible(long index);
[Throws]
void ensureLineIsVisible(long line);
};

639
dom/webidl/WebGPU.webidl Normal file
Просмотреть файл

@ -0,0 +1,639 @@
/* -*- Mode: IDL; 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/.
*
* The origin of this IDL file is
* https://github.com/gpuweb/gpuweb/blob/master/design/sketch.webidl
*/
typedef unsigned long u32;
typedef unsigned long long u64;
// ****************************************************************************
// ERROR HANDLING
// ****************************************************************************
enum WebGPULogEntryType {
"device-lost",
"validation-error",
"recoverable-out-of-memory",
};
[Pref="dom.webgpu.enable"]
interface WebGPULogEntry {
readonly attribute WebGPULogEntryType type;
readonly attribute any obj;
readonly attribute DOMString? reason;
};
enum WebGPUObjectStatus {
"valid",
"out-of-memory",
"invalid",
};
typedef (WebGPUBuffer or WebGPUTexture) WebGPUStatusable;
callback WebGPULogCallback = void (WebGPULogEntry error);
// ****************************************************************************
// SHADER RESOURCES (buffer, textures, texture views, samples)
// ****************************************************************************
// Buffer
typedef u32 WebGPUBufferUsageFlags;
[Pref="dom.webgpu.enable"]
interface WebGPUBufferUsage {
const u32 NONE = 0;
const u32 MAP_READ = 1;
const u32 MAP_WRITE = 2;
const u32 TRANSFER_SRC = 4;
const u32 TRANSFER_DST = 8;
const u32 INDEX = 16;
const u32 VERTEX = 32;
const u32 UNIFORM = 64;
const u32 STORAGE = 128;
};
dictionary WebGPUBufferDescriptor {
u32 size;
WebGPUBufferUsageFlags usage;
};
[Pref="dom.webgpu.enable"]
interface WebGPUBuffer {
readonly attribute ArrayBuffer? mapping;
void unmap();
};
// Texture view
dictionary WebGPUTextureViewDescriptor {
// TODO Investigate what goes in there.
};
[Pref="dom.webgpu.enable"]
interface WebGPUTextureView {
};
// Texture
typedef u32 WebGPUTextureDimensionEnum;
[Pref="dom.webgpu.enable"]
interface WebGPUTextureDimension {
const u32 e1D = 0;
const u32 e2D = 1;
const u32 e3D = 2;
// TODO other dimensions (cube, arrays)
};
typedef u32 WebGPUTextureFormatEnum;
[Pref="dom.webgpu.enable"]
interface WebGPUTextureFormat {
const u32 R8_G8_B8_A8_UNORM = 0;
const u32 R8_G8_B8_A8_UINT = 1;
const u32 B8_G8_R8_A8_UNORM = 2;
const u32 D32_FLOAT_S8_UINT = 3;
// TODO other formats
};
typedef u32 WebGPUTextureUsageFlags;
[Pref="dom.webgpu.enable"]
interface WebGPUTextureUsage {
const u32 NONE = 0;
const u32 TRANSFER_SRC = 1;
const u32 TRANSFER_DST = 2;
const u32 SAMPLED = 4;
const u32 STORAGE = 8;
const u32 OUTPUT_ATTACHMENT = 16;
const u32 PRESENT = 32;
};
dictionary WebGPUTextureDescriptor {
u32 width;
u32 height;
u32 depth;
u32 arraySize;
WebGPUTextureDimensionEnum dimension;
WebGPUTextureFormatEnum format;
WebGPUTextureUsageFlags usage;
};
[Pref="dom.webgpu.enable"]
interface WebGPUTexture {
WebGPUTextureView createTextureView(optional WebGPUTextureViewDescriptor desc);
};
// Sampler
typedef u32 WebGPUFilterModeEnum;
[Pref="dom.webgpu.enable"]
interface WebGPUFilterMode {
const u32 NEAREST = 0;
const u32 LINEAR = 1;
};
dictionary WebGPUSamplerDescriptor {
WebGPUFilterModeEnum magFilter;
WebGPUFilterModeEnum minFilter;
WebGPUFilterModeEnum mipmapFilter;
};
[Pref="dom.webgpu.enable"]
interface WebGPUSampler {
};
// ****************************************************************************
// BINDING MODEL (bindgroup layout, bindgroup)
// ****************************************************************************
// BindGroupLayout
typedef u32 WebGPUShaderStageFlags;
[Pref="dom.webgpu.enable"]
interface WebGPUShaderStageBit {
const u32 NONE = 0;
const u32 VERTEX = 1;
const u32 FRAGMENT = 2;
const u32 COMPUTE = 4;
};
typedef u32 WebGPUBindingTypeEnum;
[Pref="dom.webgpu.enable"]
interface WebGPUBindingType {
const u32 UNIFORM_BUFFER = 0;
const u32 SAMPLER = 1;
const u32 SAMPLED_TEXTURE = 2;
const u32 STORAGE_BUFFER = 3;
// TODO other binding types (storage images, ...)
};
dictionary WebGPUBindGroupBinding {
WebGPUShaderStageFlags visibility;
WebGPUBindingTypeEnum type;
u32 start;
u32 count;
};
dictionary WebGPUBindGroupLayoutDescriptor {
sequence<WebGPUBindGroupBinding> bindingTypes;
};
[Pref="dom.webgpu.enable"]
interface WebGPUBindGroupLayout {
};
// PipelineLayout
dictionary WebGPUPipelineLayoutDescriptor {
sequence<WebGPUBindGroupLayout> bindGroupLayouts;
};
[Pref="dom.webgpu.enable"]
interface WebGPUPipelineLayout {
};
// BindGroup
/* Moved to WebGPUExtras.webidl for now.
dictionary WebGPUBufferBinding {
WebGPUBuffer buffer;
u32 offset;
u32 size;
};
*/
typedef (WebGPUSampler or WebGPUTextureView or WebGPUBufferBinding) WebGPUBindingResource;
dictionary WebGPUBinding {
sequence<WebGPUBindingResource> resources;
u32 start;
u32 count;
};
dictionary WebGPUBindGroupDescriptor {
WebGPUBindGroupLayout layout;
sequence<WebGPUBinding> bindings;
};
[Pref="dom.webgpu.enable"]
interface WebGPUBindGroup {
};
// ****************************************************************************
// PIPELINE CREATION (blend state, DS state, ..., pipelines)
// ****************************************************************************
// BlendState
typedef u32 WebGPUBlendFactorEnum;
[Pref="dom.webgpu.enable"]
interface WebGPUBlendFactor {
const u32 ZERO = 0;
const u32 ONE = 1;
const u32 SRC_COLOR = 2;
const u32 ONE_MINUS_SRC_COLOR = 3;
const u32 SRC_ALPHA = 4;
const u32 ONE_MINUS_SRC_ALPHA = 5;
const u32 DST_COLOR = 6;
const u32 ONE_MINUS_DST_COLOR = 7;
const u32 DST_ALPHA = 8;
const u32 ONE_MINUS_DST_ALPHA = 9;
const u32 SRC_ALPHA_SATURATED = 10;
const u32 BLEND_COLOR = 11;
const u32 ONE_MINUS_BLEND_COLOR = 12;
};
typedef u32 WebGPUBlendOperationEnum;
[Pref="dom.webgpu.enable"]
interface WebGPUBlendOperation {
const u32 ADD = 0;
const u32 SUBTRACT = 1;
const u32 REVERSE_SUBTRACT = 2;
const u32 MIN = 3;
const u32 MAX = 4;
};
typedef u32 WebGPUColorWriteFlags;
[Pref="dom.webgpu.enable"]
interface WebGPUColorWriteBits {
const u32 NONE = 0;
const u32 RED = 1;
const u32 GREEN = 2;
const u32 BLUE = 4;
const u32 ALPHA = 8;
const u32 ALL = 15;
};
dictionary WebGPUBlendDescriptor {
WebGPUBlendFactorEnum srcFactor;
WebGPUBlendFactorEnum dstFactor;
WebGPUBlendOperationEnum operation;
};
dictionary WebGPUBlendStateDescriptor {
boolean blendEnabled;
WebGPUBlendDescriptor alpha;
WebGPUBlendDescriptor color;
WebGPUColorWriteFlags writeMask;
};
[Pref="dom.webgpu.enable"]
interface WebGPUBlendState {
};
// DepthStencilState
typedef u32 WebGPUCompareFunctionEnum;
[Pref="dom.webgpu.enable"]
interface WebGPUCompareFunction {
const u32 NEVER = 0;
const u32 LESS = 1;
const u32 LESS_EQUAL = 2;
const u32 GREATER = 3;
const u32 GREATER_EQUAL = 4;
const u32 EQUAL = 5;
const u32 NOT_EQUAL = 6;
const u32 ALWAYS = 7;
};
typedef u32 WebGPUStencilOperationEnum;
[Pref="dom.webgpu.enable"]
interface WebGPUStencilOperation {
const u32 KEEP = 0;
const u32 ZERO = 1;
const u32 REPLACE = 2;
const u32 INVERT = 3;
const u32 INCREMENT_CLAMP = 4;
const u32 DECREMENT_CLAMP = 5;
const u32 INCREMENT_WRAP = 6;
const u32 DECREMENT_WRAP = 7;
};
dictionary WebGPUStencilStateFaceDescriptor {
WebGPUCompareFunctionEnum compare;
WebGPUStencilOperationEnum stencilFailOp;
WebGPUStencilOperationEnum depthFailOp;
WebGPUStencilOperationEnum passOp;
};
dictionary WebGPUDepthStencilStateDescriptor {
boolean depthWriteEnabled;
WebGPUCompareFunctionEnum depthCompare;
WebGPUStencilStateFaceDescriptor front;
WebGPUStencilStateFaceDescriptor back;
u32 stencilReadMask;
u32 stencilWriteMask;
};
[Pref="dom.webgpu.enable"]
interface WebGPUDepthStencilState {
};
// InputState
typedef u32 WebGPUIndexFormatEnum;
[Pref="dom.webgpu.enable"]
interface WebGPUIndexFormat {
const u32 UINT16 = 0;
const u32 UINT32 = 1;
};
typedef u32 WebGPUVertexFormatEnum;
[Pref="dom.webgpu.enable"]
interface WebGPUVertexFormat {
const u32 FLOAT_R32_G32_B32_A32 = 0;
const u32 FLOAT_R32_G32_B32 = 1;
const u32 FLOAT_R32_G32 = 2;
const u32 FLOAT_R32 = 3;
// TODO other vertex formats
};
typedef u32 WebGPUInputStepModeEnum;
[Pref="dom.webgpu.enable"]
interface WebGPUInputStepMode {
const u32 VERTEX = 0;
const u32 INSTANCE = 1;
};
dictionary WebGPUVertexAttributeDescriptor {
u32 shaderLocation;
u32 inputSlot;
u32 offset;
WebGPUVertexFormatEnum format;
};
dictionary WebGPUVertexInputDescriptor {
u32 inputSlot;
u32 stride;
WebGPUInputStepModeEnum stepMode;
};
dictionary WebGPUInputStateDescriptor {
WebGPUIndexFormatEnum indexFormat;
sequence<WebGPUVertexAttributeDescriptor> attributes;
sequence<WebGPUVertexInputDescriptor> inputs;
};
[Pref="dom.webgpu.enable"]
interface WebGPUInputState {
};
// ShaderModule
dictionary WebGPUShaderModuleDescriptor {
required ArrayBuffer code;
};
[Pref="dom.webgpu.enable"]
interface WebGPUShaderModule {
};
// AttachmentState
dictionary WebGPUAttachmentStateDescriptor {
sequence<WebGPUTextureFormatEnum> formats;
// TODO other stuff like sample count etc.
};
[Pref="dom.webgpu.enable"]
interface WebGPUAttachmentState {
};
// Common stuff for ComputePipeline and RenderPipeline
typedef u32 WebGPUShaderStageEnum;
[Pref="dom.webgpu.enable"]
interface WebGPUShaderStage {
const u32 VERTEX = 0;
const u32 FRAGMENT = 1;
const u32 COMPUTE = 2;
};
dictionary WebGPUPipelineStageDescriptor {
required WebGPUShaderModule shaderModule;
required WebGPUShaderStageEnum stage;
required DOMString entryPoint;
// TODO other stuff like specialization constants?
};
dictionary WebGPUPipelineDescriptorBase {
required WebGPUPipelineLayout layout;
sequence<WebGPUPipelineStageDescriptor> stages;
};
// ComputePipeline
dictionary WebGPUComputePipelineDescriptor : WebGPUPipelineDescriptorBase {
};
[Pref="dom.webgpu.enable"]
interface WebGPUComputePipeline {
};
// WebGPURenderPipeline
typedef u32 WebGPUPrimitiveTopologyEnum;
[Pref="dom.webgpu.enable"]
interface WebGPUPrimitiveTopology {
const u32 POINT_LIST = 0;
const u32 LINE_LIST = 1;
const u32 LINE_STRIP = 2;
const u32 TRIANGLE_LIST = 3;
const u32 TRIANGLE_STRIP = 4;
};
dictionary WebGPURenderPipelineDescriptor : WebGPUPipelineDescriptorBase {
WebGPUPrimitiveTopologyEnum primitiveTopology;
sequence<WebGPUBlendState> blendState;
WebGPUDepthStencilState depthStencilState;
WebGPUInputState inputState;
WebGPUAttachmentState attachmentState;
// TODO other properties
};
[Pref="dom.webgpu.enable"]
interface WebGPURenderPipeline {
};
// ****************************************************************************
// COMMAND RECORDING (Command buffer and all relevant structures)
// ****************************************************************************
typedef u32 WebGPULoadOpEnum;
[Pref="dom.webgpu.enable"]
interface WebGPULoadOp {
const u32 CLEAR = 0;
const u32 LOAD = 1;
};
typedef u32 WebGPUStoreOpEnum;
[Pref="dom.webgpu.enable"]
interface WebGPUStoreOp {
const u32 STORE = 0;
};
dictionary WebGPURenderPassAttachmentDescriptor {
WebGPUTextureView attachment;
WebGPULoadOpEnum loadOp;
WebGPUStoreOpEnum storeOp;
};
dictionary WebGPURenderPassDescriptor {
sequence<WebGPURenderPassAttachmentDescriptor> colorAttachments;
WebGPURenderPassAttachmentDescriptor depthStencilAttachment;
};
[Pref="dom.webgpu.enable"]
interface WebGPUCommandBuffer {
};
dictionary WebGPUCommandEncoderDescriptor {
};
[Pref="dom.webgpu.enable"]
interface WebGPUCommandEncoder {
WebGPUCommandBuffer finishEncoding();
// Commands allowed outside of "passes"
void copyBufferToBuffer(WebGPUBuffer src,
u32 srcOffset,
WebGPUBuffer dst,
u32 dstOffset,
u32 size);
// TODO figure out all the arguments required for these
void copyBufferToTexture();
void copyTextureToBuffer();
void copyTextureToTexture();
void blit();
void transitionBuffer(WebGPUBuffer b, WebGPUBufferUsageFlags f);
// Allowed in both compute and render passes
void setPushConstants(WebGPUShaderStageFlags stage,
u32 offset,
u32 count,
ArrayBuffer data);
void setBindGroup(u32 index, WebGPUBindGroup bindGroup);
void setPipeline((WebGPUComputePipeline or WebGPURenderPipeline) pipeline);
// Compute pass commands
void beginComputePass();
void endComputePass();
void dispatch(u32 x, u32 y, u32 z);
// Render pass commands
void beginRenderPass(optional WebGPURenderPassDescriptor descriptor);
void endRenderPass();
void setBlendColor(float r, float g, float b, float a);
void setIndexBuffer(WebGPUBuffer buffer, u32 offset);
void setVertexBuffers(u32 startSlot, sequence<WebGPUBuffer> buffers, sequence<u32> offsets);
void draw(u32 vertexCount, u32 instanceCount, u32 firstVertex, u32 firstInstance);
void drawIndexed(u32 indexCount, u32 instanceCount, u32 firstIndex, u32 firstInstance, u32 firstVertex);
// TODO add missing commands
};
// ****************************************************************************
// OTHER (Fence, Queue SwapChain, Device)
// ****************************************************************************
// Fence
[Pref="dom.webgpu.enable"]
interface WebGPUFence {
boolean wait(double milliseconds);
readonly attribute Promise<void> promise;
};
// Queue
[Pref="dom.webgpu.enable"]
interface WebGPUQueue {
void submit(sequence<WebGPUCommandBuffer> buffers);
WebGPUFence insertFence();
};
// SwapChain / RenderingContext
dictionary WebGPUSwapChainDescriptor {
WebGPUTextureUsageFlags usage;
WebGPUTextureFormatEnum format;
u32 width;
u32 height;
};
[Pref="dom.webgpu.enable"]
interface WebGPUSwapChain {
void configure(optional WebGPUSwapChainDescriptor descriptor);
WebGPUTexture getNextTexture();
void present();
};
//[Pref="dom.webgpu.enable"]
//interface WebGPURenderingContext : WebGPUSwapChain {
//};
// WebGPU "namespace" used for device creation
dictionary WebGPUExtensions {
boolean anisotropicFiltering;
boolean logicOp; // Previously a "Feature".
};
dictionary WebGPULimits {
u32 maxBindGroups;
};
// Device
[Pref="dom.webgpu.enable"]
interface WebGPUDevice {
readonly attribute WebGPUAdapter adapter;
WebGPUExtensions extensions();
WebGPULimits limits();
WebGPUBuffer createBuffer(optional WebGPUBufferDescriptor descriptor);
WebGPUTexture createTexture(optional WebGPUTextureDescriptor descriptor);
WebGPUSampler createSampler(optional WebGPUSamplerDescriptor descriptor);
WebGPUBindGroupLayout createBindGroupLayout(optional WebGPUBindGroupLayoutDescriptor descriptor);
WebGPUPipelineLayout createPipelineLayout(optional WebGPUPipelineLayoutDescriptor descriptor);
WebGPUBindGroup createBindGroup(optional WebGPUBindGroupDescriptor descriptor);
WebGPUBlendState createBlendState(optional WebGPUBlendStateDescriptor descriptor);
WebGPUDepthStencilState createDepthStencilState(optional WebGPUDepthStencilStateDescriptor descriptor);
WebGPUInputState createInputState(optional WebGPUInputStateDescriptor descriptor);
WebGPUShaderModule createShaderModule(WebGPUShaderModuleDescriptor descriptor);
WebGPUAttachmentState createAttachmentState(optional WebGPUAttachmentStateDescriptor descriptor);
WebGPUComputePipeline createComputePipeline(WebGPUComputePipelineDescriptor descriptor);
WebGPURenderPipeline createRenderPipeline(WebGPURenderPipelineDescriptor descriptor);
WebGPUCommandEncoder createCommandEncoder(optional WebGPUCommandEncoderDescriptor descriptor);
WebGPUQueue getQueue();
attribute WebGPULogCallback onLog;
Promise<WebGPUObjectStatus> getObjectStatus(WebGPUStatusable obj);
};
dictionary WebGPUDeviceDescriptor {
WebGPUExtensions extensions;
//WebGPULimits limits; Don't expose higher limits for now.
// TODO are other things configurable like queues?
};
[Pref="dom.webgpu.enable"]
interface WebGPUAdapter {
readonly attribute DOMString name;
WebGPUExtensions extensions();
//WebGPULimits limits(); Don't expose higher limits for now.
WebGPUDevice createDevice(optional WebGPUDeviceDescriptor descriptor);
};
enum WebGPUPowerPreference { "default", "low-power", "high-performance" };
dictionary WebGPUAdapterDescriptor {
WebGPUPowerPreference powerPreference;
};
[Pref="dom.webgpu.enable"]
interface WebGPU {
WebGPUAdapter getAdapter(optional WebGPUAdapterDescriptor desc);
};
// Add a "webgpu" member to Window that contains the global instance of a "WebGPU"
[NoInterfaceObject]
interface WebGPUProvider {
[SameObject, Replaceable, Pref="dom.webgpu.enable"] readonly attribute WebGPU webgpu;
};
//Window includes WebGPUProvider;

Просмотреть файл

@ -0,0 +1,14 @@
/* -*- Mode: IDL; 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/.
*
* Some parts of WebGPU.webidl need to be pulled into a different file due to a codegen
* bug/missing support.
*/
dictionary WebGPUBufferBinding {
WebGPUBuffer buffer;
u32 offset;
u32 size;
};

Просмотреть файл

@ -563,3 +563,5 @@ partial interface Window {
[Throws, Func="IsChromeOrXBL"]
readonly attribute IntlUtils intlUtils;
};
Window implements WebGPUProvider;

Просмотреть файл

@ -328,6 +328,9 @@ with Files("WebAuthentication.webidl"):
with Files("WebGL*"):
BUG_COMPONENT = ("Core", "Canvas: WebGL")
with Files("WebGPU*"):
BUG_COMPONENT = ("Core", "Canvas: WebGL")
with Files("WebKitCSSMatrix.webidl"):
BUG_COMPONENT = ("Core", "DOM: CSS Object Model")
@ -922,6 +925,8 @@ WEBIDL_FILES = [
'WebComponents.webidl',
'WebGL2RenderingContext.webidl',
'WebGLRenderingContext.webidl',
'WebGPU.webidl',
'WebGPUExtras.webidl',
'WebKitCSSMatrix.webidl',
'WebSocket.webidl',
'WheelEvent.webidl',

Просмотреть файл

@ -4353,9 +4353,12 @@ GetIteratorIRGenerator::tryAttachStub()
RootedObject obj(cx_, &val_.toObject());
ObjOperandId objId = writer.guardIsObject(valId);
if (tryAttachNativeIterator(objId, obj))
return true;
if (tryAttachNativeIterator(objId, obj)) {
trackAttached("GetIterator");
return true;
}
trackAttached(IRGenerator::NotAttached);
return false;
}
@ -4391,6 +4394,16 @@ GetIteratorIRGenerator::tryAttachNativeIterator(ObjOperandId objId, HandleObject
return true;
}
void
GetIteratorIRGenerator::trackAttached(const char* name)
{
#ifdef JS_CACHEIR_SPEW
if (const CacheIRSpewer::Guard& sp = CacheIRSpewer::Guard(*this, name)) {
sp.valueProperty("val", val_);
}
#endif
}
CallIRGenerator::CallIRGenerator(JSContext* cx, HandleScript script, jsbytecode* pc, JSOp op,
ICState::Mode mode, uint32_t argc,
HandleValue callee, HandleValue thisval, HandleValueArray args)

Просмотреть файл

@ -1668,6 +1668,8 @@ class MOZ_RAII GetIteratorIRGenerator : public IRGenerator
HandleValue value);
bool tryAttachStub();
void trackAttached(const char *name);
};
class MOZ_RAII CallIRGenerator : public IRGenerator

Просмотреть файл

@ -579,7 +579,8 @@ public:
const DisplayItemClip& aClip,
LayerState aLayerState,
nsDisplayList *aList,
DisplayItemEntryType aType);
DisplayItemEntryType aType,
nsTArray<size_t>& aOpacityIndices);
AnimatedGeometryRoot* GetAnimatedGeometryRoot() { return mAnimatedGeometryRoot; }
/**
@ -768,11 +769,6 @@ public:
* These items get added by Accumulate().
*/
nsTArray<AssignedDisplayItem> mAssignedDisplayItems;
/**
* Tracks the active opacity markers by holding the indices to PUSH_OPACITY
* items in |mAssignedDisplayItems|.
*/
nsTArray<size_t> mOpacityIndices;
};
struct NewLayerEntry {
@ -3351,8 +3347,6 @@ void ContainerState::FinishPaintedLayerData(PaintedLayerData& aData, FindOpaqueB
{
PaintedLayerData* data = &aData;
MOZ_ASSERT(data->mOpacityIndices.IsEmpty());
if (!data->mLayer) {
// No layer was recycled, so we create a new one.
RefPtr<PaintedLayer> paintedLayer = CreatePaintedLayer(data);
@ -3639,18 +3633,19 @@ PaintedLayerData::Accumulate(ContainerState* aState,
const DisplayItemClip& aClip,
LayerState aLayerState,
nsDisplayList* aList,
DisplayItemEntryType aType)
DisplayItemEntryType aType,
nsTArray<size_t>& aOpacityIndices)
{
FLB_LOG_PAINTED_LAYER_DECISION(this, "Accumulating dp=%s(%p), f=%p against pld=%p\n", aItem->Name(), aItem, aItem->Frame(), this);
const bool hasOpacity = mOpacityIndices.Length() > 0;
const bool hasOpacity = aOpacityIndices.Length() > 0;
const DisplayItemClip* oldClip = mItemClip;
mItemClip = &aClip;
if (aType == DisplayItemEntryType::POP_OPACITY) {
MOZ_ASSERT(!mOpacityIndices.IsEmpty());
mOpacityIndices.RemoveLastElement();
MOZ_ASSERT(!aOpacityIndices.IsEmpty());
aOpacityIndices.RemoveLastElement();
AssignedDisplayItem item(aItem, aLayerState,
nullptr, aContentRect, aType, hasOpacity);
@ -3673,7 +3668,7 @@ PaintedLayerData::Accumulate(ContainerState* aState,
if (!componentAlphaBounds.IsEmpty()) {
// This display item needs background copy when pushing opacity group.
for (size_t i : mOpacityIndices) {
for (size_t i : aOpacityIndices) {
AssignedDisplayItem& item = mAssignedDisplayItems[i];
MOZ_ASSERT(item.mType == DisplayItemEntryType::PUSH_OPACITY ||
item.mType == DisplayItemEntryType::PUSH_OPACITY_WITH_BG);
@ -3696,7 +3691,7 @@ PaintedLayerData::Accumulate(ContainerState* aState,
mAssignedDisplayItems.AppendElement(std::move(item));
if (aType == DisplayItemEntryType::PUSH_OPACITY) {
mOpacityIndices.AppendElement(mAssignedDisplayItems.Length() - 1);
aOpacityIndices.AppendElement(mAssignedDisplayItems.Length() - 1);
}
if (aItem->MustPaintOnContentSide()) {
@ -4288,6 +4283,7 @@ ContainerState::ProcessDisplayItems(nsDisplayList* aList)
// Tracks the PaintedLayerData that the item will be accumulated in, if it is
// non-null. Currently only used with PUSH_OPACITY and POP_OPACITY markers.
PaintedLayerData* selectedPLD = nullptr;
AutoTArray<size_t, 2> opacityIndices;
FLBDisplayItemIterator iter(mBuilder, aList, this);
while (iter.HasNext()) {
@ -4841,7 +4837,7 @@ ContainerState::ProcessDisplayItems(nsDisplayList* aList)
paintedLayerData->AccumulateHitTestInfo(this, hitTestInfo);
} else {
paintedLayerData->Accumulate(this, item, itemVisibleRect, itemContent, itemClip,
layerState, aList, marker);
layerState, aList, marker, opacityIndices);
if (!paintedLayerData->mLayer) {
// Try to recycle the old layer of this display item.
@ -4868,7 +4864,7 @@ ContainerState::ProcessDisplayItems(nsDisplayList* aList)
if (marker == DisplayItemEntryType::POP_OPACITY ) {
MOZ_ASSERT(selectedPLD);
if (selectedPLD->mOpacityIndices.IsEmpty()) {
if (opacityIndices.IsEmpty()) {
selectedPLD = nullptr;
}
}

Просмотреть файл

@ -933,7 +933,7 @@ def run_test_harness(parser, options):
# We have to validate options.app here for the case when the mach
# command is able to find it after argument parsing. This can happen
# when running from a tests.zip.
# when running from a tests archive.
if not options.app:
parser.error("could not find the application path, --appname must be specified")

Просмотреть файл

@ -59,18 +59,6 @@ void ScrollBoxObject::ScrollBy(int32_t dx, int32_t dy, ErrorResult& aRv)
ScrollTo(pt.x + dx, pt.y + dy, aRv);
}
void ScrollBoxObject::ScrollByLine(int32_t dlines, ErrorResult& aRv)
{
nsIScrollableFrame* sf = GetScrollFrame();
if (!sf) {
aRv.Throw(NS_ERROR_FAILURE);
return;
}
sf->ScrollBy(nsIntPoint(0, dlines), nsIScrollableFrame::LINES,
nsIScrollableFrame::SMOOTH);
}
// XUL <scrollbox> elements have a single box child element.
// Get a pointer to that box.
// Note that now that the <scrollbox> is just a regular box
@ -212,20 +200,6 @@ void ScrollBoxObject::ScrollByIndex(int32_t dindexes, ErrorResult& aRv)
}
}
void ScrollBoxObject::ScrollToLine(int32_t line, ErrorResult& aRv)
{
nsIScrollableFrame* sf = GetScrollFrame();
if (!sf) {
aRv.Throw(NS_ERROR_FAILURE);
return;
}
nscoord y = sf->GetLineScrollAmount().height * line;
nsRect range(0, y - nsPresContext::CSSPixelsToAppUnits(1),
0, nsPresContext::CSSPixelsToAppUnits(1));
sf->ScrollTo(nsPoint(0, y), nsIScrollableFrame::INSTANT, &range);
}
void ScrollBoxObject::ScrollToElement(Element& child, ErrorResult& aRv)
{
nsCOMPtr<nsIPresShell> shell = GetPresShell(false);
@ -245,11 +219,6 @@ void ScrollBoxObject::ScrollToElement(Element& child, ErrorResult& aRv)
nsIPresShell::SCROLL_OVERFLOW_HIDDEN);
}
void ScrollBoxObject::ScrollToIndex(int32_t index, ErrorResult& aRv)
{
aRv.Throw(NS_ERROR_NOT_IMPLEMENTED);
}
int32_t ScrollBoxObject::GetPositionX(ErrorResult& aRv)
{
CSSIntPoint pt;
@ -304,46 +273,6 @@ void ScrollBoxObject::GetScrolledSize(nsRect& aRect, ErrorResult& aRv)
aRect.height = nsPresContext::AppUnitsToIntCSSPixels(aRect.height);
}
void ScrollBoxObject::GetPosition(JSContext* cx,
JS::Handle<JSObject*> x,
JS::Handle<JSObject*> y,
ErrorResult& aRv)
{
CSSIntPoint pt;
GetPosition(pt, aRv);
JS::Rooted<JS::Value> v(cx);
if (!ToJSValue(cx, pt.x, &v) ||
!JS_SetProperty(cx, x, "value", v)) {
aRv.Throw(NS_ERROR_XPC_CANT_SET_OUT_VAL);
return;
}
if (!ToJSValue(cx, pt.y, &v) ||
!JS_SetProperty(cx, y, "value", v)) {
aRv.Throw(NS_ERROR_XPC_CANT_SET_OUT_VAL);
return;
}
}
void ScrollBoxObject::GetScrolledSize(JSContext* cx,
JS::Handle<JSObject*> width,
JS::Handle<JSObject*> height,
ErrorResult& aRv)
{
nsRect rect;
GetScrolledSize(rect, aRv);
JS::Rooted<JS::Value> v(cx);
if (!ToJSValue(cx, rect.width, &v) ||
!JS_SetProperty(cx, width, "value", v)) {
aRv.Throw(NS_ERROR_XPC_CANT_SET_OUT_VAL);
return;
}
if (!ToJSValue(cx, rect.height, &v) ||
!JS_SetProperty(cx, height, "value", v)) {
aRv.Throw(NS_ERROR_XPC_CANT_SET_OUT_VAL);
return;
}
}
void ScrollBoxObject::EnsureElementIsVisible(Element& child, ErrorResult& aRv)
{
nsCOMPtr<nsIPresShell> shell = GetPresShell(false);
@ -358,27 +287,14 @@ void ScrollBoxObject::EnsureElementIsVisible(Element& child, ErrorResult& aRv)
nsIPresShell::SCROLL_FIRST_ANCESTOR_ONLY |
nsIPresShell::SCROLL_OVERFLOW_HIDDEN);
}
void ScrollBoxObject::EnsureIndexIsVisible(int32_t index, ErrorResult& aRv)
{
aRv.Throw(NS_ERROR_NOT_IMPLEMENTED);
}
void ScrollBoxObject::EnsureLineIsVisible(int32_t line, ErrorResult& aRv)
{
aRv.Throw(NS_ERROR_NOT_IMPLEMENTED);
}
} // namespace dom
} // namespace mozilla
// Creation Routine ///////////////////////////////////////////////////////////////////////
using namespace mozilla::dom;
nsresult
NS_NewScrollBoxObject(nsIBoxObject** aResult)
{
NS_ADDREF(*aResult = new ScrollBoxObject());
return NS_OK;
NS_ADDREF(*aResult = new ScrollBoxObject());
return NS_OK;
}

Просмотреть файл

@ -27,29 +27,14 @@ public:
void ScrollTo(int32_t x, int32_t y, ErrorResult& aRv);
void ScrollBy(int32_t dx, int32_t dy, ErrorResult& aRv);
void ScrollByLine(int32_t dlines, ErrorResult& aRv);
void ScrollByIndex(int32_t dindexes, ErrorResult& aRv);
void ScrollToLine(int32_t line, ErrorResult& aRv);
void ScrollToElement(Element& child, ErrorResult& aRv);
void ScrollToIndex(int32_t index, ErrorResult& aRv);
int32_t GetPositionX(ErrorResult& aRv);
int32_t GetPositionY(ErrorResult& aRv);
int32_t GetScrolledWidth(ErrorResult& aRv);
int32_t GetScrolledHeight(ErrorResult& aRv);
void EnsureElementIsVisible(Element& child, ErrorResult& aRv);
void EnsureIndexIsVisible(int32_t index, ErrorResult& aRv);
void EnsureLineIsVisible(int32_t line, ErrorResult& aRv);
// Deprecated APIs from old IDL
void GetPosition(JSContext* cx,
JS::Handle<JSObject*> x,
JS::Handle<JSObject*> y,
ErrorResult& aRv);
void GetScrolledSize(JSContext* cx,
JS::Handle<JSObject*> width,
JS::Handle<JSObject*> height,
ErrorResult& aRv);
protected:
void GetScrolledSize(nsRect& aRect, ErrorResult& aRv);

Просмотреть файл

@ -3737,7 +3737,6 @@ TEST_P(NewSdpTest, CheckMalformedImageattr)
}
TEST_P(NewSdpTest, ParseInvalidSimulcastNoSuchSendRid) {
SKIP_TEST_WITH_RUST_PARSER; // See Bug 1432931
ParseSdp("v=0" CRLF
"o=- 4294967296 2 IN IP4 127.0.0.1" CRLF
"s=SIP Call" CRLF

Просмотреть файл

@ -699,6 +699,12 @@ fn sanity_check_sdp_session(session: &SdpSession) -> Result<(), SdpParserError>
_ => None,
}
}).collect();
let send_rids:Vec<&str> = rids.iter().filter_map(|rid| {
match rid.direction {
SdpSingleDirection::Send => Some(rid.id.as_str()),
_ => None,
}
}).collect();
for rid_format in rids.iter().flat_map(|rid| &rid.formats) {
@ -718,7 +724,6 @@ fn sanity_check_sdp_session(session: &SdpSession) -> Result<(), SdpParserError>
if let Some(&SdpAttribute::Simulcast(ref simulcast)) =
msection.get_attribute(SdpAttributeType::Simulcast) {
// This is already a closure as the next Bug 1432931 will require the same procedure
let check_defined_rids = |simulcast_version_list: &Vec<SdpAttributeSimulcastVersion>,
rid_ids: &[&str]| -> Result<(),SdpParserError> {
for simulcast_rid in simulcast_version_list.iter().flat_map(|x| &x.ids) {
@ -730,7 +735,8 @@ fn sanity_check_sdp_session(session: &SdpSession) -> Result<(), SdpParserError>
Ok(())
};
check_defined_rids(&simulcast.receive, &recv_rids)?
check_defined_rids(&simulcast.receive, &recv_rids)?;
check_defined_rids(&simulcast.send, &send_rids)?;
}
}

Просмотреть файл

@ -15,8 +15,6 @@
"uniqlo.com": "\\)\\s#) Mobile Safari ",
// bug 1338260, directv.com
"directv.com": "Mozilla/5.0 (Linux; Android 6.0.1; SM-G920F Build/MMB29K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.91 Mobile Safari/537.36",
// bug 1310951, m.canadiantire.ca
"m.canadiantire.ca": "Mozilla/5.0 (Linux; Android 6.0.1; SM-G920F Build/MMB29K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.91 Mobile Safari/537.36",
// bug 1385206, rakuten.co.jp
"rakuten.co.jp": "Firefox.+$#"
}

Просмотреть файл

@ -4716,6 +4716,8 @@ pref("webgl.dxgl.enabled", true);
pref("webgl.dxgl.needs-finish", false);
#endif
pref("dom.webgpu.enable", false);
pref("gfx.offscreencanvas.enabled", false);
// sendbuffer of 0 means use OS default, sendbuffer unset means use

Просмотреть файл

@ -573,7 +573,7 @@ def find_files(archive):
if archive == 'common':
# Construct entries ensuring all our generated harness files are
# packaged in the common tests zip.
# packaged in the common tests archive.
packaged_paths = set()
for entry in OBJDIR_TEST_FILES.values():
pat = mozpath.join(entry['base'], entry['pattern'])

Просмотреть файл

@ -65,7 +65,12 @@ lazy_static! {
.map(|s| s.parse::<usize>().expect("invalid STYLO_THREADS value"));
let mut num_threads = match stylo_threads {
Ok(num) => num,
_ => cmp::max(num_cpus::get() * 3 / 4, 1),
// The default heuristic is num_virtual_cores * .75. This gives us
// three threads on a hyper-threaded dual core, and six threads on
// a hyper-threaded quad core. The performance benefit of additional
// threads seems to level off at around six, so we cap it there on
// many-core machines (see bug 1431285 comment 14).
_ => cmp::min(cmp::max(num_cpus::get() * 3 / 4, 1), 6),
};
// If num_threads is one, there's no point in creating a thread pool, so

Просмотреть файл

@ -67,15 +67,17 @@ mochitest-harness:
use-artifacts:
build:
- target.tar.bz2
- target.common.tests.zip
- target.mochitest.tests.zip
- target.common.tests.tar.gz
- target.mochitest.tests.tar.gz
command: >
source /builds/worker/scripts/xvfb.sh &&
start_xvfb '1600x1200x24' 0 &&
cd $USE_ARTIFACT_PATH/build &&
tar -xf target.tar.bz2 &&
unzip -q -d tests target.common.tests.zip &&
unzip -q -d tests target.mochitest.tests.zip &&
mkdir -p tests &&
(cd tests &&
tar xf ../target.common.tests.tar.gz &&
tar xf ../target.mochitest.tests.tar.gz) &&
export GECKO_BINARY_PATH=$USE_ARTIFACT_PATH/build/firefox/firefox &&
export TEST_HARNESS_ROOT=$USE_ARTIFACT_PATH/build/tests &&
cd /builds/worker/checkouts/gecko &&
@ -184,15 +186,17 @@ reftest-harness:
use-artifacts:
build:
- target.tar.bz2
- target.common.tests.zip
- target.reftest.tests.zip
- target.common.tests.tar.gz
- target.reftest.tests.tar.gz
command: >
source /builds/worker/scripts/xvfb.sh &&
start_xvfb '1600x1200x24' 0 &&
cd $USE_ARTIFACT_PATH/build &&
tar -xf target.tar.bz2 &&
unzip -q -d tests target.common.tests.zip &&
unzip -q -d tests target.reftest.tests.zip &&
mkdir -p tests &&
(cd tests &&
tar xf ../target.common.tests.tar.gz &&
tar xf ../target.reftest.tests.tar.gz) &&
export GECKO_BINARY_PATH=$USE_ARTIFACT_PATH/build/firefox/firefox &&
export TEST_HARNESS_ROOT=$USE_ARTIFACT_PATH/build/tests &&
cd /builds/worker/checkouts/gecko &&

Просмотреть файл

@ -498,15 +498,15 @@ if [ "${USE_MC}" == "true" ]; then
fi
BROWSER_ARCHIVE="${PRODUCT}-${VERSION}.en-US.${PLATFORM}.${PLATFORM_EXT}"
TESTS_ARCHIVE="${PRODUCT}-${VERSION}.en-US.${PLATFORM}.common.tests.zip"
TESTS_ARCHIVE="${PRODUCT}-${VERSION}.en-US.${PLATFORM}.common.tests.tar.gz"
if [ "${USE_MC}" == "true" ]; then
BROWSER_ARCHIVE="${PRODUCT}-${MCVERSION}.en-US.${PLATFORM}.${PLATFORM_EXT}"
TESTS_ARCHIVE="${PRODUCT}-${MCVERSION}.en-US.${PLATFORM}.common.tests.zip"
TESTS_ARCHIVE="${PRODUCT}-${MCVERSION}.en-US.${PLATFORM}.common.tests.tar.gz"
fi
# Simple name builds on >=53.0.0
if [ "${MAJOR_VERSION}" -ge 53 ] ; then
BROWSER_ARCHIVE="target.${PLATFORM_EXT}"
TESTS_ARCHIVE="target.common.tests.zip"
TESTS_ARCHIVE="target.common.tests.tar.gz"
fi
# End 'remove once 52esr is off support'

Просмотреть файл

@ -0,0 +1,28 @@
# -*- coding: utf-8 -*-
# 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/.
from __future__ import absolute_import, print_function, unicode_literals
from taskgraph.util.taskcluster import cancel_task
from .registry import register_callback_action
@register_callback_action(
title='Cancel Task',
name='cancel',
symbol='cx',
kind='hook',
generic=True,
description=(
'Cancel the given task'
),
order=100,
context=[{}]
)
def cancel_action(parameters, graph_config, input, task_group_id, task_id, task):
# Note that this is limited by the scopes afforded to generic actions to
# only cancel tasks with the level-specific schedulerId.
cancel_task(task_id, use_proxy=True)

Просмотреть файл

@ -25,19 +25,19 @@ from voluptuous import Any, Required, Optional
# See example in bug 1348286
_DESKTOP_UPSTREAM_ARTIFACTS_UNSIGNED_EN_US = [
'buildhub.json',
"target.common.tests.zip",
"target.cppunittest.tests.zip",
"target.common.tests.tar.gz",
"target.cppunittest.tests.tar.gz",
"target.crashreporter-symbols.zip",
"target.json",
"target.mochitest.tests.zip",
"target.mochitest.tests.tar.gz",
"target.mozinfo.json",
"target.reftest.tests.zip",
"target.talos.tests.zip",
"target.awsy.tests.zip",
"target.reftest.tests.tar.gz",
"target.talos.tests.tar.gz",
"target.awsy.tests.tar.gz",
"target.test_packages.json",
"target.txt",
"target.web-platform.tests.tar.gz",
"target.xpcshell.tests.zip",
"target.xpcshell.tests.tar.gz",
"target_info.txt",
"target.jsshell.zip",
"mozharness.zip",
@ -71,19 +71,19 @@ _DESKTOP_UPSTREAM_ARTIFACTS_SIGNED_L10N = [
# See example in bug 1348286
_MOBILE_UPSTREAM_ARTIFACTS_UNSIGNED_EN_US = [
"en-US/buildhub.json",
"en-US/target.common.tests.zip",
"en-US/target.cppunittest.tests.zip",
"en-US/target.common.tests.tar.gz",
"en-US/target.cppunittest.tests.tar.gz",
"en-US/target.crashreporter-symbols.zip",
"en-US/target.json",
"en-US/target.mochitest.tests.zip",
"en-US/target.mochitest.tests.tar.gz",
"en-US/target.mozinfo.json",
"en-US/target.reftest.tests.zip",
"en-US/target.talos.tests.zip",
"en-US/target.awsy.tests.zip",
"en-US/target.reftest.tests.tar.gz",
"en-US/target.talos.tests.tar.gz",
"en-US/target.awsy.tests.tar.gz",
"en-US/target.test_packages.json",
"en-US/target.txt",
"en-US/target.web-platform.tests.tar.gz",
"en-US/target.xpcshell.tests.zip",
"en-US/target.xpcshell.tests.tar.gz",
"en-US/target_info.txt",
"en-US/mozharness.zip",
"en-US/robocop.apk",

Просмотреть файл

@ -41,19 +41,19 @@ _WINDOWS_BUILD_PLATFORMS = [
# See example in bug 1348286
_DESKTOP_UPSTREAM_ARTIFACTS_UNSIGNED_EN_US = [
"buildhub.json",
"target.common.tests.zip",
"target.cppunittest.tests.zip",
"target.common.tests.tar.gz",
"target.cppunittest.tests.tar.gz",
"target.crashreporter-symbols.zip",
"target.json",
"target.mochitest.tests.zip",
"target.mochitest.tests.tar.gz",
"target.mozinfo.json",
"target.reftest.tests.zip",
"target.talos.tests.zip",
"target.awsy.tests.zip",
"target.reftest.tests.tar.gz",
"target.talos.tests.tar.gz",
"target.awsy.tests.tar.gz",
"target.test_packages.json",
"target.txt",
"target.web-platform.tests.tar.gz",
"target.xpcshell.tests.zip",
"target.xpcshell.tests.tar.gz",
"target_info.txt",
"target.jsshell.zip",
"mozharness.zip",

Просмотреть файл

@ -186,7 +186,7 @@ possibly to run the Marionette tests _without_ a local build and
with a downloaded test archive from <Taskcluster.html>.
If you want to run tests from a downloaded test archive, you will
need to download the `target.common.tests.zip` artifact attached to
need to download the `target.common.tests.tar.gz` artifact attached to
Treeherder [build jobs] `B` for your system. Extract the archive
and set up the Python Marionette client and harness by executing
the following command in a virtual environment:

Просмотреть файл

@ -753,7 +753,7 @@ class MochitestArguments(ArgumentContainer):
options.testingModulesDir = p
break
# Paths to specialpowers and mochijar from the tests zip.
# Paths to specialpowers and mochijar from the tests archive.
options.stagedAddons = [
os.path.join(here, 'extensions', 'specialpowers'),
os.path.join(here, 'mochijar'),

Просмотреть файл

@ -1,7 +1,7 @@
# 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/.
"""Pytest fixtures to help set up Firefox and a tests.zip
"""Pytest fixtures to help set up Firefox and a tests archive
in test harness selftests.
"""

Просмотреть файл

@ -89,7 +89,7 @@ class MakeUploadOutputParser(OutputParser):
# key: property name, value: condition
('symbolsUrl', "m.endswith('crashreporter-symbols.zip') or "
"m.endswith('crashreporter-symbols-full.zip')"),
('testsUrl', "m.endswith(('tests.tar.bz2', 'tests.zip'))"),
('testsUrl', "m.endswith(('tests.tar.bz2', 'tests.zip', 'tests.tar.gz'))"),
('robocopApkUrl', "m.endswith('apk') and 'robocop' in m"),
('jsshellUrl', "'jsshell-' in m and m.endswith('.zip')"),
('partialMarUrl', "m.endswith('.mar') and '.partial.' in m"),

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше