Compare commits

...
50 Commits
Author SHA1 Message Date
Moonchild 610e44320c Issue #2342: Remove MOZ_MUST_USE macro 2023-11-05 12:38:11 +01:00
Moonchild 10476e27da Issue #2342: Use [[nodiscard]] in /mfbt 2023-11-05 12:37:04 +01:00
Moonchild a4777b1c21 Issue #2342: Use [[nodiscard]] in /xpcom and xpidl parser 2023-11-05 10:41:52 +01:00
Moonchild 9f6e448f78 Issue #2342: Use [[nodiscard]] in /uriloader /widget
Also a few misc low-volume places.
2023-11-05 00:59:31 +01:00
Moonchild 19a21bac1b Issue #2342: Use [[nodiscard]] in /netwerk 2023-11-04 23:42:53 +01:00
Moonchild c7867ce130 Issue #2342: Use [[nodiscard]] in /memory and remove Sun Studio hack 2023-11-04 22:57:30 +01:00
Moonchild 34c068e611 Issue #2342: Use [[nodiscard]] in /media 2023-11-04 22:28:58 +01:00
Moonchild a48e621048 Issue #2342: Use [[nodiscard]] in /js 2023-11-04 20:06:50 +01:00
Moonchild de5d3b1034 Issue #2342: Use [[nodiscard]] in IPDL generation and fix warnings
DOM plugin code had two warning in IPC caught by [[nodiscard]], these
were fixed in one go.
2023-11-04 01:24:20 +01:00
Moonchild f8737bbf4f Issue #2342: Use [[nodiscard]] in /ipc 2023-11-04 01:22:37 +01:00
Moonchild d9c70eaba2 Issue #2342: Use [[nodiscard]] in /hal /image and /intl 2023-11-04 01:21:57 +01:00
Moonchild 9308c63ce6 Issue #2281 - Remove the use of non-standard namespace std::tr1 in
Google's WebRTC gtest code
2023-11-04 00:13:32 +01:00
Moonchild 6314e01691 Issue #2342: Use [[nodiscard]] in /accessible and /caps 2023-11-03 12:17:29 +01:00
Moonchild b7b2f1de84 Issue #2342: Use [[nodiscard]] in /gfx and /layout 2023-11-03 00:34:37 +01:00
Moonchild b838d6634c Issue #2342: Use [[nodiscard]] in /dom 2023-11-03 00:17:31 +01:00
Moonchild dc4ea7f680 Merge branch 'master' into c++17-work 2023-11-02 12:20:37 +01:00
Moonchild 2132ea4a22 Merge pull request 'Improve boxshadow rendering' (#2367) from boxshadow-work into master
Reviewed-on: https://repo.palemoon.org/MoonchildProductions/UXP/pulls/2367
2023-11-02 00:27:19 +00:00
Moonchild 33bff10b1c [devtools] Make ECMA v6 the default for devtools pretty-printing. 2023-11-01 14:27:24 +01:00
Moonchild 9493e8c3de Issue #2364 - Limit the growth of scaling for animated nsDisplayTransform
in the fallback case.

This ensures we don't scale the underlying size of the layer beyond what
is close to the current display size. When box shadows get much larger
than this, they start taking so much time to render that successive
frames grow in scale too fast for any inter-frame reuse to be possible.

With this, we avoid that and no longer get crushed by re-rendering
gigantic box shadows every single frame.

See BZ 1383825
2023-11-01 10:32:04 +01:00
Moonchild 7631297112 [gfx] Add Min() and Max() convenience functions for 2d point types.
This will return (min(x1,x2), min(y1,y2)) and equivalent max from 2
passed-in (x1,y1) (x2,y2) points
2023-11-01 10:31:19 +01:00
Moonchild 5e381b021c [gfx] Fix a bug in SizeTyped templating
A second template parameter 'F' was previously added to SizeTyped, but
was not correspondingly added to the argument passed for the 'Sub'
parameter of BaseSize.
2023-11-01 10:31:18 +01:00
Moonchild 5c9a1efa7c Issue #2364 - Only use HWA AlphaBoxBlur when targets are large enough.
There's considerable cost associated with creating HWA draw targets
which would negate and regress the performance won by it if used for
too small targets (like small spans of text).
This only uses HWA if >= 8K SurfaceAllocationSize to balance HWA draw
target cost with box blur cost.
2023-11-01 10:31:18 +01:00
Moonchild 93ddeb613e Issue #2364 - Optimize the software-based box blur implementation. 2023-11-01 10:31:17 +01:00
Moonchild 2fae5d3e6b Issue #2364 - use DrawTarget::DrawSurfaceWithShadow to render box
shadows on platforms that accelerate it.
2023-11-01 10:31:16 +01:00
Moonchild 5fd365cb76 Issue #2364 - Re-factor AlphaBoxBlur
Only blur one quadrant of a box-shadow and mirror it to the other quadrants.
This applies only if the corners are symmetrical (square corners or equal
corner radii) otherwise we'll fall back to the old method.
2023-11-01 10:31:16 +01:00
Moonchild d7f8e56f04 Merge pull request 'Update ffvpx to version 6.0' (#2363) from trav90/UXP-contrib:ffvpx60-rebased into master
Reviewed-on: https://repo.palemoon.org/MoonchildProductions/UXP/pulls/2363
2023-11-01 09:27:31 +00:00
trav90 6ee56b0a60 Issue #2317 - Part 9 - "send" before "receive"-ing when decoding audio using FFmpeg
This is what the documentation says we should be doing. We miss decoding a packet otherwise.
2023-10-27 10:16:08 -05:00
trav90 165ef56547 Issue #2317 - Part 8 - Update compiler flags used for ffvpx 2023-10-27 10:15:42 -05:00
trav90 9d333be11b Issue #2317 - Part 7 - Don't use -ffreestanding flag when building with clang
This was added by Mozilla as a workaround for an automated build system (one that they no longer use) for building on Linux with clang (which is not our target compiler for that platform). No need for us to keep this workaround.
2023-10-27 10:15:10 -05:00
trav90 aff6fbf36c Issue #2317 - Part 6 - Remove old workaround for clang-cl
This was added back in 2016 to work around issues with clang-cl. Shouldn't be needed anymore.
2023-10-27 10:14:45 -05:00
trav90 ef8447ad4b Issue #2317 - Part 5 - Build ffvpx against the FFmpeg 6.0 headers 2023-10-27 10:14:24 -05:00
trav90 21face45d3 Issue #2317 - Part 4 - Regenerate config* files for ffvpx 2023-10-27 10:14:02 -05:00
trav90 ff4d550c80 Issue #2317 - Part 3 - Update symbols list for FFmpeg 6.0 2023-10-27 10:13:46 -05:00
trav90 45b9cfbe93 Issue #2317 - Part 2b - Clip constants used with shift instructions within inline assembly
Cherry-pick of upstream commit: https://git.ffmpeg.org/gitweb/ffmpeg.git/commit/effadce6c756247ea8bae32dc13bb3e6f464f0eb
2023-10-27 10:13:23 -05:00
trav90 4321dbddcc Issue #2317 - Part 2a - Update changes.patch for ffvpx 2023-10-27 10:13:06 -05:00
trav90 3a67a9510b Issue #2317 - Part 2 - Import FFmpeg 6.0 source files for ffvpx 2023-10-27 10:12:44 -05:00
trav90 ea464a764f Issue #2317 - Part 1 - Update and cleanup ffvpx documentation in preparation for lib update. 2023-10-27 10:11:11 -05:00
Moonchild 72a2a5f2bd [DOM] For now, use C++11 static_asserts only.
Single-param static_assert is C++17 or later.
Follow-up to 3d92b82125
2023-10-27 14:18:57 +02:00
Moonchild 0b70c77657 Merge branch 'master' of https://repo.palemoon.org/MoonchildProductions/UXP 2023-10-26 22:46:45 +02:00
Moonchild ca04aefa67 Issue #35 - Follow-up: undo locale changes so they aren't pre-processed.
Pre-processing loses our localization notes and licensing headers for
l10n which is not a good thing. It's not a big deal having a few unused
strings in these files in the resulting locales.
2023-10-26 22:45:36 +02:00
Moonchild 89dec27643 Merge pull request 'Restore ARM32 buildability.' (#2360) from dbsoft/UXP:arm-2354 into master
Reviewed-on: https://repo.palemoon.org/MoonchildProductions/UXP/pulls/2360
2023-10-26 12:10:38 +00:00
Brian Smith 5fa394b169 Issue #2354 - Restore ARM32 buildability on Linux.
Fix ION breakages due to BigInt changes.
Fix breakages from libjpeg, libyuv and libvpx upgrades.
Restore ARM(32/64) NEON FPU support in libyuv.
2023-10-25 19:01:38 +00:00
Moonchild 0e427867e3 Issue #2281 - Force clobber
Without a clobber, mozconfigure doesn't properly pick up the /std:c++17
or -std=gnu++17 compiler switches needed to put them into C++17 mode.
2023-10-18 14:40:16 +02:00
Moonchild 8137a4e122 Issue #2281 - Add some deduction guides for class template arguments.
This is necessary if we want to start using Span() constructors
instead of the MakeSpan() kludge.
2023-10-18 14:35:59 +02:00
Moonchild 46138995f6 Issue #2281 - Default to C++17 when building.
Configure the toolchain to default to C++17 language standard with
optional gnu extensions (if on GCC)
2023-10-15 15:12:23 +02:00
Moonchild aeb9de40a5 Issue #2281 - Avoid class-static constexpr in TypedArrayObject 2023-10-15 01:54:25 +02:00
Moonchild 3d693801f9 Issue #2281 - Build LZ4 as C instead of including it as C++. 2023-10-15 00:19:13 +02:00
Moonchild 14fa712b8c Issue #2281 - The 'register' storage class is no longer a thing in c++17 2023-10-13 23:12:37 +02:00
Moonchild 7d93034fd0 Issue #2281 - Mark mozalloc new() as noexcept to aligh with what the VC
runtime expects.

Currently spams warnings but may actually error out if not fixed, or
result in undefined behaviour if mismatching signatures are treated as
redeclarations with different exception specifications.
2023-10-13 23:12:00 +02:00
Moonchild 1769e74839 Issue #2281 - Replace std::iterator inheritance with iterator traits
definitions (as required by C++17).
2023-10-13 23:07:22 +02:00
669 changed files with 27221 additions and 24488 deletions

No files matched your search

+1 -1
View File
@@ -22,4 +22,4 @@
# changes to stick? As of bug 928195, this shouldn't be necessary! Please
# don't change CLOBBER for WebIDL changes any more.
Removal of SIMD.js and associated scalar types requires CLOBBER. (Issue #2307)
Switching to C++17 requires CLOBBER to pick up compiler conf. (Issue #2281)
+1 -1
View File
@@ -176,7 +176,7 @@ private:
uint32_t AddSubtree(ProxyAccessible* aParent,
const nsTArray<AccessibleData>& aNewTree, uint32_t aIdx,
uint32_t aIdxInParent);
MOZ_MUST_USE bool CheckDocTree() const;
[[nodiscard]] bool CheckDocTree() const;
xpcAccessibleGeneric* GetXPCAccessible(ProxyAccessible* aProxy);
nsTArray<DocAccessibleParent*> mChildDocs;
+2 -2
View File
@@ -173,7 +173,7 @@ public: // construction, destruction
/**
* Find an accessible by the given child ID in cached documents.
*/
MOZ_MUST_USE already_AddRefed<IAccessible>
[[nodiscard]] already_AddRefed<IAccessible>
GetIAccessibleFor(const VARIANT& aVarChild, bool* aIsDefunct);
virtual void GetNativeInterface(void **aOutAccessible) override;
@@ -198,7 +198,7 @@ protected:
/**
* Find a remote accessible by the given child ID.
*/
MOZ_MUST_USE already_AddRefed<IAccessible>
[[nodiscard]] already_AddRefed<IAccessible>
GetRemoteIAccessibleFor(const VARIANT& aVarChild);
/**
+9 -10
View File
@@ -340,17 +340,16 @@ def check_compiler(compiler, language, target):
if info.type in ('clang-cl', 'clang', 'gcc'):
append_flag('-std=gnu99')
# Note: this is a strict version check because we used to always add
# -std=gnu++14.
cxx14_version = 201402
cxx17_version = 201703
if info.language == 'C++':
if info.type in ('clang', 'gcc') and info.language_version != cxx14_version:
append_flag('-std=gnu++14')
# MSVC 2015 headers include C++14 features, but don't guard them
# with appropriate checks.
if info.type == 'clang-cl' and info.language_version != cxx14_version:
append_flag('-std=c++14')
# MSVC from 2015 on defaults to C++14.
if info.language_version != cxx17_version:
# Compiler doesn't default to C++17, so add the appropriate flag.
if info.type in ('clang', 'gcc'):
# We're on Clang or GCC, enable C++17 and add GNU extensions.
append_flag('-std=gnu++17')
else:
# We're on MSVC; enable C++17 language mode.
append_flag('-std:c++17')
# We force clang-cl to emulate Visual C++ 2015 Update 3 with fallback to
# cl.exe.
+1 -1
View File
@@ -52,7 +52,7 @@ check_and_add_gcc_warning('-Wclass-varargs')
check_and_add_gcc_warning('-Wloop-analysis')
# catches C++ version forward-compat issues
check_and_add_gcc_warning('-Wc++1z-compat', cxx_compiler)
# check_and_add_gcc_warning('-Wc++2a-compat', cxx_compiler)
# catches unintentional switch case fallthroughs
check_and_add_gcc_warning('-Wimplicit-fallthrough', cxx_compiler)
+3 -3
View File
@@ -51,12 +51,12 @@ public:
// Don't use this method for anything else than debugging!
void CreateAnonymizedSuffix(nsACString& aStr) const;
MOZ_MUST_USE bool PopulateFromSuffix(const nsACString& aStr);
[[nodiscard]] bool PopulateFromSuffix(const nsACString& aStr);
// Populates the attributes from a string like
// |uri!key1=value1&key2=value2| and returns the uri without the suffix.
MOZ_MUST_USE bool PopulateFromOrigin(const nsACString& aOrigin,
nsACString& aOriginNoSuffix);
[[nodiscard]] bool PopulateFromOrigin(const nsACString& aOrigin,
nsACString& aOriginNoSuffix);
// Helper function to match mIsPrivateBrowsing to existing private browsing
// flags. Once all other flags are removed, this can be removed too.
@@ -1068,7 +1068,7 @@ var Debugger =
// be either 3, or 5, or 6. This influences support for strict
// mode, the set of reserved words, support for getters and
// setters and other features.
ecmaVersion: 5,
ecmaVersion: 6,
// Turn on `strictSemicolons` to prevent the parser from doing
// automatic semicolon insertion.
strictSemicolons: false,
+1 -1
View File
@@ -1299,7 +1299,7 @@ var defaultOptions = {
// be either 3, or 5, or 6. This influences support for strict
// mode, the set of reserved words, support for getters and
// setters and other features.
ecmaVersion: 5,
ecmaVersion: 6,
// Source type ("script" or "module") for different semantics
sourceType: "script",
// `onInsertedSemicolon` can be a callback that will be called
+1 -1
View File
@@ -118,7 +118,7 @@ Crypto::GetRandomValues(JSContext* aCx, const ArrayBufferView& aArray,
void Crypto::RandomUUID(nsAString& aRetVal)
{
// NSID_LENGTH == 39 == 36 UUID chars + 2 curly braces + 1 NUL byte
static_assert(NSID_LENGTH == 39);
static_assert(NSID_LENGTH == 39, "Crypto:RandomUUID: NSID_LENGTH must be 39");
nsCOMPtr<nsIUUIDGenerator> uuidgen =
do_GetService("@mozilla.org/uuid-generator;1");
+1 -2
View File
@@ -147,8 +147,7 @@ public:
virtual bool TextIsOnlyWhitespace() override;
virtual bool HasTextForTranslation() override;
virtual void AppendTextTo(nsAString& aResult) override;
MOZ_MUST_USE
virtual bool AppendTextTo(nsAString& aResult, const mozilla::fallible_t&) override;
[[nodiscard]] virtual bool AppendTextTo(nsAString& aResult, const mozilla::fallible_t&) override;
virtual nsIContent *GetBindingParent() const override;
virtual nsXBLBinding *GetXBLBinding() const override;
virtual void SetXBLBinding(nsXBLBinding* aBinding,
+1 -1
View File
@@ -84,7 +84,7 @@ private:
nsIContent **outImageOrLinkNode,
bool* outDragSelectedText);
static already_AddRefed<nsIContent> FindParentLinkNode(nsIContent* inNode);
static MOZ_MUST_USE nsresult
static [[nodiscard]] nsresult
GetAnchorURL(nsIContent* inNode, nsAString& outURL);
static void GetNodeString(nsIContent* inNode, nsAString & outNodeString);
static void CreateLinkText(const nsAString& inURL, const nsAString & inText,
+20 -19
View File
@@ -1508,9 +1508,10 @@ public:
* @param aResult the result. Out param.
* @return false on out of memory errors, true otherwise.
*/
MOZ_MUST_USE
static bool GetNodeTextContent(nsINode* aNode, bool aDeep,
nsAString& aResult, const mozilla::fallible_t&);
[[nodiscard]] static bool GetNodeTextContent(nsINode* aNode,
bool aDeep,
nsAString& aResult,
const mozilla::fallible_t&);
static void GetNodeTextContent(nsINode* aNode, bool aDeep,
nsAString& aResult);
@@ -1869,28 +1870,29 @@ public:
*/
static bool CanAccessNativeAnon();
MOZ_MUST_USE
static nsresult WrapNative(JSContext *cx, nsISupports *native,
const nsIID* aIID, JS::MutableHandle<JS::Value> vp,
bool aAllowWrapping = true)
[[nodiscard]] static nsresult WrapNative(JSContext* cx,
nsISupports* native,
const nsIID* aIID,
JS::MutableHandle<JS::Value> vp,
bool aAllowWrapping = true)
{
return WrapNative(cx, native, nullptr, aIID, vp, aAllowWrapping);
}
// Same as the WrapNative above, but use this one if aIID is nsISupports' IID.
MOZ_MUST_USE
static nsresult WrapNative(JSContext *cx, nsISupports *native,
JS::MutableHandle<JS::Value> vp,
bool aAllowWrapping = true)
[[nodiscard]] static nsresult WrapNative(JSContext* cx,
nsISupports* native,
JS::MutableHandle<JS::Value> vp,
bool aAllowWrapping = true)
{
return WrapNative(cx, native, nullptr, nullptr, vp, aAllowWrapping);
}
MOZ_MUST_USE
static nsresult WrapNative(JSContext *cx, nsISupports *native,
nsWrapperCache *cache,
JS::MutableHandle<JS::Value> vp,
bool aAllowWrapping = true)
[[nodiscard]] static nsresult WrapNative(JSContext* cx,
nsISupports* native,
nsWrapperCache* cache,
JS::MutableHandle<JS::Value> vp,
bool aAllowWrapping = true)
{
return WrapNative(cx, native, cache, nullptr, vp, aAllowWrapping);
}
@@ -1914,9 +1916,8 @@ public:
* @param aString the string to convert the newlines inside [in/out]
*/
static void PlatformToDOMLineBreaks(nsString &aString);
MOZ_MUST_USE
static bool PlatformToDOMLineBreaks(nsString &aString,
const mozilla::fallible_t&);
[[nodiscard]] static bool PlatformToDOMLineBreaks(nsString &aString,
const mozilla::fallible_t&);
/**
* Populates aResultString with the contents of the string-buffer aBuf, up
+2 -3
View File
@@ -144,9 +144,8 @@ public:
virtual bool TextIsOnlyWhitespace() override;
virtual bool HasTextForTranslation() override;
virtual void AppendTextTo(nsAString& aResult) override;
MOZ_MUST_USE
virtual bool AppendTextTo(nsAString& aResult,
const mozilla::fallible_t&) override;
[[nodiscard]] virtual bool AppendTextTo(nsAString& aResult,
const mozilla::fallible_t&) override;
virtual void SaveSubtreeState() override;
#ifdef DEBUG
+9 -11
View File
@@ -37,18 +37,16 @@ class nsHTMLContentSerializer final : public nsXHTMLContentSerializer {
nsAString& aStr) override;
protected:
MOZ_MUST_USE
virtual bool SerializeHTMLAttributes(nsIContent* aContent,
nsIContent *aOriginalElement,
nsAString& aTagPrefix,
const nsAString& aTagNamespaceURI,
nsIAtom* aTagName,
int32_t aNamespace,
nsAString& aStr);
[[nodiscard]] virtual bool SerializeHTMLAttributes(nsIContent* aContent,
nsIContent* aOriginalElement,
nsAString& aTagPrefix,
const nsAString& aTagNamespaceURI,
nsIAtom* aTagName,
int32_t aNamespace,
nsAString& aStr);
MOZ_MUST_USE
virtual bool AppendAndTranslateEntities(const nsAString& aStr,
nsAString& aOutputStr) override;
[[nodiscard]] virtual bool AppendAndTranslateEntities(const nsAString& aStr,
nsAString& aOutputStr) override;
};
+1 -2
View File
@@ -576,8 +576,7 @@ public:
* Append the text content to aResult.
* NOTE: This asserts and returns for elements
*/
MOZ_MUST_USE
virtual bool AppendTextTo(nsAString& aResult, const mozilla::fallible_t&) = 0;
[[nodiscard]] virtual bool AppendTextTo(nsAString& aResult, const mozilla::fallible_t&) = 0;
/**
* Check if this content is focusable and in the current tab order.
+2 -2
View File
@@ -2513,8 +2513,8 @@ public:
mozilla::ErrorResult& rv);
virtual mozilla::dom::DOMImplementation*
GetImplementation(mozilla::ErrorResult& rv) = 0;
MOZ_MUST_USE nsresult GetURL(nsString& retval) const;
MOZ_MUST_USE nsresult GetDocumentURI(nsString& retval) const;
[[nodiscard]] nsresult GetURL(nsString& retval) const;
[[nodiscard]] nsresult GetDocumentURI(nsString& retval) const;
// Return the URI for the document.
// The returned value may differ if the document is loaded via XHR, and
// when accessed from chrome privileged script and
+1 -1
View File
@@ -1873,7 +1873,7 @@ public:
aNodeName.SetStringBuffer(nsStringBuffer::FromString(nodeName),
nodeName.Length());
}
MOZ_MUST_USE nsresult GetBaseURI(nsAString& aBaseURI) const;
[[nodiscard]] nsresult GetBaseURI(nsAString& aBaseURI) const;
// Return the base URI for the document.
// The returned value may differ if the document is loaded via XHR, and
// when accessed from chrome privileged script and
+4 -4
View File
@@ -143,7 +143,7 @@ public:
// After getting a notification that an off-thread compilation terminated,
// this function will take the result of the parser and move it to the main
// thread.
MOZ_MUST_USE nsresult JoinCompile(void** aOffThreadToken);
[[nodiscard]] nsresult JoinCompile(void** aOffThreadToken);
// Compile a script contained in a SourceText.
nsresult Compile(JS::CompileOptions& aCompileOptions,
@@ -167,7 +167,7 @@ public:
JSScript* GetScript();
// Execute the compiled script and ignore the return value.
MOZ_MUST_USE nsresult ExecScript();
[[nodiscard]] nsresult ExecScript();
// Execute the compiled script a get the return value.
//
@@ -180,10 +180,10 @@ public:
// compartment given as argument to the ExecutionContext constructor. If the
// caller is in a different compartment, then the out-param value should be
// wrapped by calling |JS_WrapValue|.
MOZ_MUST_USE nsresult
[[nodiscard]] nsresult
ExtractReturnValue(JS::MutableHandle<JS::Value> aRetValue);
MOZ_MUST_USE nsresult ExecScript(JS::MutableHandle<JS::Value> aRetValue);
[[nodiscard]] nsresult ExecScript(JS::MutableHandle<JS::Value> aRetValue);
};
static nsresult CompileModule(JSContext* aCx,
+1 -1
View File
@@ -382,7 +382,7 @@ class nsObjectLoadingContent : public nsImageLoadingContent
void GetNestedParams(nsTArray<mozilla::dom::MozPluginParameter>& aParameters,
bool aIgnoreCodebase);
MOZ_MUST_USE nsresult BuildParametersArray();
[[nodiscard]] nsresult BuildParametersArray();
/**
* Loads fallback content with the specified FallbackType
+2 -2
View File
@@ -136,7 +136,7 @@ public:
* Append the contents of this string fragment to aString
* @return false if an out of memory condition is detected, true otherwise
*/
MOZ_MUST_USE
[[nodiscard]]
bool AppendTo(nsAString& aString,
const mozilla::fallible_t& aFallible) const {
if (mState.mIs2b) {
@@ -170,7 +170,7 @@ public:
* @param aLength the length of the substring
* @return false if an out of memory condition is detected, true otherwise
*/
MOZ_MUST_USE
[[nodiscard]]
bool AppendTo(nsAString& aString, int32_t aOffset, int32_t aLength,
const mozilla::fallible_t& aFallible) const
{
+4 -4
View File
@@ -46,7 +46,7 @@ class nsXHTMLContentSerializer : public nsXMLContentSerializer {
nsAString& aStr,
nsresult& aResult) override;
MOZ_MUST_USE
[[nodiscard]]
virtual bool AfterElementStart(nsIContent* aContent,
nsIContent* aOriginalElement,
nsAString& aStr) override;
@@ -70,7 +70,7 @@ class nsXHTMLContentSerializer : public nsXMLContentSerializer {
virtual void MaybeEnterInPreContent(nsIContent* aNode) override;
virtual void MaybeLeaveFromPreContent(nsIContent* aNode) override;
MOZ_MUST_USE
[[nodiscard]]
virtual bool SerializeAttributes(nsIContent* aContent,
nsIContent *aOriginalElement,
nsAString& aTagPrefix,
@@ -82,13 +82,13 @@ class nsXHTMLContentSerializer : public nsXMLContentSerializer {
bool IsFirstChildOfOL(nsIContent* aElement);
MOZ_MUST_USE
[[nodiscard]]
bool SerializeLIValueAttribute(nsIContent* aElement,
nsAString& aStr);
bool IsShorthandAttr(const nsIAtom* aAttrName,
const nsIAtom* aElementName);
MOZ_MUST_USE
[[nodiscard]]
virtual bool AppendAndTranslateEntities(const nsAString& aStr,
nsAString& aOutputStr) override;
+19 -24
View File
@@ -72,23 +72,21 @@ class nsXMLContentSerializer : public nsIContentSerializer {
/**
* Appends a char16_t character and increments the column position
*/
MOZ_MUST_USE
bool AppendToString(const char16_t aChar,
nsAString& aOutputStr);
[[nodiscard]] bool AppendToString(const char16_t aChar,
nsAString& aOutputStr);
/**
* Appends a nsAString string and increments the column position
*/
MOZ_MUST_USE
bool AppendToString(const nsAString& aStr,
nsAString& aOutputStr);
[[nodiscard]] bool AppendToString(const nsAString& aStr,
nsAString& aOutputStr);
/**
* Appends a string by replacing all line-endings
* by mLineBreak, except in the case of raw output.
* It increments the column position.
*/
MOZ_MUST_USE
[[nodiscard]]
bool AppendToStringConvertLF(const nsAString& aStr,
nsAString& aOutputStr);
@@ -96,7 +94,7 @@ class nsXMLContentSerializer : public nsIContentSerializer {
* Appends a string by wrapping it when necessary.
* It updates the column position.
*/
MOZ_MUST_USE
[[nodiscard]]
bool AppendToStringWrapped(const nsASingleFragmentString& aStr,
nsAString& aOutputStr);
@@ -104,12 +102,12 @@ class nsXMLContentSerializer : public nsIContentSerializer {
* Appends a string by formating and wrapping it when necessary
* It updates the column position.
*/
MOZ_MUST_USE
[[nodiscard]]
bool AppendToStringFormatedWrapped(const nsASingleFragmentString& aStr,
nsAString& aOutputStr);
// used by AppendToStringWrapped
MOZ_MUST_USE
[[nodiscard]]
bool AppendWrapped_WhitespaceSequence(
nsASingleFragmentString::const_char_iterator &aPos,
const nsASingleFragmentString::const_char_iterator aEnd,
@@ -117,7 +115,7 @@ class nsXMLContentSerializer : public nsIContentSerializer {
nsAString &aOutputStr);
// used by AppendToStringFormatedWrapped
MOZ_MUST_USE
[[nodiscard]]
bool AppendFormatedWrapped_WhitespaceSequence(
nsASingleFragmentString::const_char_iterator &aPos,
const nsASingleFragmentString::const_char_iterator aEnd,
@@ -126,7 +124,7 @@ class nsXMLContentSerializer : public nsIContentSerializer {
nsAString &aOutputStr);
// used by AppendToStringWrapped and AppendToStringFormatedWrapped
MOZ_MUST_USE
[[nodiscard]]
bool AppendWrapped_NonWhitespaceSequence(
nsASingleFragmentString::const_char_iterator &aPos,
const nsASingleFragmentString::const_char_iterator aEnd,
@@ -139,7 +137,7 @@ class nsXMLContentSerializer : public nsIContentSerializer {
* add mLineBreak to the string
* It updates the column position and other flags.
*/
MOZ_MUST_USE
[[nodiscard]]
bool AppendNewLineToString(nsAString& aOutputStr);
@@ -147,7 +145,7 @@ class nsXMLContentSerializer : public nsIContentSerializer {
* Appends a string by translating entities
* It doesn't increment the column position
*/
MOZ_MUST_USE
[[nodiscard]]
virtual bool AppendAndTranslateEntities(const nsAString& aStr,
nsAString& aOutputStr);
@@ -197,7 +195,7 @@ class nsXMLContentSerializer : public nsIContentSerializer {
nsIContent *aOriginalElement,
const nsAString& aTagNamespaceURI);
MOZ_MUST_USE
[[nodiscard]]
virtual bool SerializeAttributes(nsIContent* aContent,
nsIContent *aOriginalElement,
nsAString& aTagPrefix,
@@ -207,7 +205,7 @@ class nsXMLContentSerializer : public nsIContentSerializer {
uint32_t aSkipAttr,
bool aAddNSAttr);
MOZ_MUST_USE
[[nodiscard]]
bool SerializeAttr(const nsAString& aPrefix,
const nsAString& aName,
const nsAString& aValue,
@@ -239,7 +237,7 @@ class nsXMLContentSerializer : public nsIContentSerializer {
* aElement and aOriginalElement are the same as the corresponding arguments
* to AppendElementStart.
*/
MOZ_MUST_USE
[[nodiscard]]
bool AppendEndOfElementStart(mozilla::dom::Element* aEleemnt,
mozilla::dom::Element* aOriginalElement,
nsAString& aStr);
@@ -249,7 +247,7 @@ class nsXMLContentSerializer : public nsIContentSerializer {
* after the serialization ot the start tag.
* (called at the end of AppendElementStart)
*/
MOZ_MUST_USE
[[nodiscard]]
virtual bool AfterElementStart(nsIContent* aContent,
nsIContent* aOriginalElement,
nsAString& aStr) { return true; };
@@ -299,17 +297,14 @@ class nsXMLContentSerializer : public nsIContentSerializer {
* add intendation. Call only in the case of formating and if the current
* position is at 0. It updates the column position.
*/
MOZ_MUST_USE
bool AppendIndentation(nsAString& aStr);
[[nodiscard]] bool AppendIndentation(nsAString& aStr);
MOZ_MUST_USE
bool IncrIndentation(nsIAtom* aName);
[[nodiscard]] bool IncrIndentation(nsIAtom* aName);
void DecrIndentation(nsIAtom* aName);
// Functions to check for newlines that needs to be added between nodes in
// the root of a document. See mAddNewlineForRootNode
MOZ_MUST_USE
bool MaybeAddNewlineForRootNode(nsAString& aStr);
[[nodiscard]] bool MaybeAddNewlineForRootNode(nsAString& aStr);
void MaybeFlagNewlineForRootNode(nsINode* aNode);
// Functions to check if we enter in or leave from a preformated content
+23 -23
View File
@@ -24,7 +24,7 @@ class Promise;
// JSContext.
// Accept strings.
MOZ_MUST_USE bool
[[nodiscard]] bool
ToJSValue(JSContext* aCx,
const nsAString& aArgument,
JS::MutableHandle<JS::Value> aValue);
@@ -35,7 +35,7 @@ ToJSValue(JSContext* aCx,
// desirable. So make this a template that only gets used if the argument type
// is actually boolean
template<typename T>
MOZ_MUST_USE
[[nodiscard]]
typename EnableIf<IsSame<T, bool>::value, bool>::Type
ToJSValue(JSContext* aCx,
T aArgument,
@@ -123,7 +123,7 @@ ToJSValue(JSContext* aCx,
}
// Accept CallbackObjects
MOZ_MUST_USE inline bool
[[nodiscard]] inline bool
ToJSValue(JSContext* aCx,
CallbackObject& aArgument,
JS::MutableHandle<JS::Value> aValue)
@@ -139,7 +139,7 @@ ToJSValue(JSContext* aCx,
// Accept objects that inherit from nsWrapperCache (e.g. most
// DOM objects).
template <class T>
MOZ_MUST_USE
[[nodiscard]]
typename EnableIf<IsBaseOf<nsWrapperCache, T>::value, bool>::Type
ToJSValue(JSContext* aCx,
T& aArgument,
@@ -155,7 +155,7 @@ ToJSValue(JSContext* aCx,
// Accept typed arrays built from appropriate nsTArray values
template<typename T>
MOZ_MUST_USE
[[nodiscard]]
typename EnableIf<IsBaseOf<AllTypedArraysBase, T>::value, bool>::Type
ToJSValue(JSContext* aCx,
const TypedArrayCreator<T>& aArgument,
@@ -175,7 +175,7 @@ ToJSValue(JSContext* aCx,
// Accept objects that inherit from nsISupports but not nsWrapperCache (e.g.
// DOM File).
template <class T>
MOZ_MUST_USE
[[nodiscard]]
typename EnableIf<!IsBaseOf<nsWrapperCache, T>::value &&
!IsBaseOf<CallbackObject, T>::value &&
IsBaseOf<nsISupports, T>::value, bool>::Type
@@ -193,7 +193,7 @@ ToJSValue(JSContext* aCx,
// Accept nsRefPtr/nsCOMPtr
template <typename T>
MOZ_MUST_USE bool
[[nodiscard]] bool
ToJSValue(JSContext* aCx,
const nsCOMPtr<T>& aArgument,
JS::MutableHandle<JS::Value> aValue)
@@ -202,7 +202,7 @@ ToJSValue(JSContext* aCx,
}
template <typename T>
MOZ_MUST_USE bool
[[nodiscard]] bool
ToJSValue(JSContext* aCx,
const RefPtr<T>& aArgument,
JS::MutableHandle<JS::Value> aValue)
@@ -211,7 +211,7 @@ ToJSValue(JSContext* aCx,
}
template <typename T>
MOZ_MUST_USE bool
[[nodiscard]] bool
ToJSValue(JSContext* aCx,
const NonNull<T>& aArgument,
JS::MutableHandle<JS::Value> aValue)
@@ -221,7 +221,7 @@ ToJSValue(JSContext* aCx,
// Accept WebIDL dictionaries
template <class T>
MOZ_MUST_USE
[[nodiscard]]
typename EnableIf<IsBaseOf<DictionaryBase, T>::value, bool>::Type
ToJSValue(JSContext* aCx,
const T& aArgument,
@@ -231,7 +231,7 @@ ToJSValue(JSContext* aCx,
}
// Accept existing JS values (which may not be same-compartment with us
MOZ_MUST_USE inline bool
[[nodiscard]] inline bool
ToJSValue(JSContext* aCx, JS::Handle<JS::Value> aArgument,
JS::MutableHandle<JS::Value> aValue)
{
@@ -240,7 +240,7 @@ ToJSValue(JSContext* aCx, JS::Handle<JS::Value> aArgument,
}
// Accept existing JS values on the Heap (which may not be same-compartment with us
MOZ_MUST_USE inline bool
[[nodiscard]] inline bool
ToJSValue(JSContext* aCx, const JS::Heap<JS::Value>& aArgument,
JS::MutableHandle<JS::Value> aValue)
{
@@ -249,7 +249,7 @@ ToJSValue(JSContext* aCx, const JS::Heap<JS::Value>& aArgument,
}
// Accept existing rooted JS values (which may not be same-compartment with us
MOZ_MUST_USE inline bool
[[nodiscard]] inline bool
ToJSValue(JSContext* aCx, const JS::Rooted<JS::Value>& aArgument,
JS::MutableHandle<JS::Value> aValue)
{
@@ -259,7 +259,7 @@ ToJSValue(JSContext* aCx, const JS::Rooted<JS::Value>& aArgument,
// Accept existing rooted JS objects (which may not be same-compartment with
// us).
MOZ_MUST_USE inline bool
[[nodiscard]] inline bool
ToJSValue(JSContext* aCx, const JS::Rooted<JSObject*>& aArgument,
JS::MutableHandle<JS::Value> aValue)
{
@@ -269,7 +269,7 @@ ToJSValue(JSContext* aCx, const JS::Rooted<JSObject*>& aArgument,
// Accept nsresult, for use in rejections, and create an XPCOM
// exception object representing that nsresult.
MOZ_MUST_USE bool
[[nodiscard]] bool
ToJSValue(JSContext* aCx,
nsresult aArgument,
JS::MutableHandle<JS::Value> aValue);
@@ -277,14 +277,14 @@ ToJSValue(JSContext* aCx,
// Accept ErrorResult, for use in rejections, and create an exception
// representing the failure. Note, the ErrorResult must indicate a failure
// with aArgument.Failure() returning true.
MOZ_MUST_USE bool
[[nodiscard]] bool
ToJSValue(JSContext* aCx,
ErrorResult& aArgument,
JS::MutableHandle<JS::Value> aValue);
// Accept owning WebIDL unions.
template <typename T>
MOZ_MUST_USE
[[nodiscard]]
typename EnableIf<IsBaseOf<AllOwningUnionBase, T>::value, bool>::Type
ToJSValue(JSContext* aCx,
const T& aArgument,
@@ -296,7 +296,7 @@ ToJSValue(JSContext* aCx,
// Accept pointers to other things we accept
template <typename T>
MOZ_MUST_USE
[[nodiscard]]
typename EnableIf<IsPointer<T>::value, bool>::Type
ToJSValue(JSContext* aCx,
T aArgument,
@@ -306,14 +306,14 @@ ToJSValue(JSContext* aCx,
}
// Accept Promise objects, which need special handling.
MOZ_MUST_USE bool
[[nodiscard]] bool
ToJSValue(JSContext* aCx,
Promise& aArgument,
JS::MutableHandle<JS::Value> aValue);
// Accept arrays of other things we accept
template <typename T>
MOZ_MUST_USE bool
[[nodiscard]] bool
ToJSValue(JSContext* aCx,
T* aArguments,
size_t aLength,
@@ -340,7 +340,7 @@ ToJSValue(JSContext* aCx,
}
template <typename T>
MOZ_MUST_USE bool
[[nodiscard]] bool
ToJSValue(JSContext* aCx,
const nsTArray<T>& aArgument,
JS::MutableHandle<JS::Value> aValue)
@@ -350,7 +350,7 @@ ToJSValue(JSContext* aCx,
}
template <typename T>
MOZ_MUST_USE bool
[[nodiscard]] bool
ToJSValue(JSContext* aCx,
const FallibleTArray<T>& aArgument,
JS::MutableHandle<JS::Value> aValue)
@@ -360,7 +360,7 @@ ToJSValue(JSContext* aCx,
}
template <typename T, int N>
MOZ_MUST_USE bool
[[nodiscard]] bool
ToJSValue(JSContext* aCx,
const T(&aArgument)[N],
JS::MutableHandle<JS::Value> aValue)
+1 -1
View File
@@ -154,7 +154,7 @@ public:
// Whether the value change should be notified to the frame/contet nor not.
eSetValue_Notify = 1 << 2
};
MOZ_MUST_USE bool SetValue(const nsAString& aValue, uint32_t aFlags);
[[nodiscard]] bool SetValue(const nsAString& aValue, uint32_t aFlags);
void GetValue(nsAString& aValue, bool aIgnoreWrap) const;
bool HasNonEmptyValue();
// The following methods are for textarea element to use whether default
+2 -2
View File
@@ -63,11 +63,11 @@ public:
virtual bool IsForApp() const = 0;
virtual bool IsForBrowser() const = 0;
MOZ_MUST_USE virtual PBlobParent*
[[nodiscard]] virtual PBlobParent*
SendPBlobConstructor(PBlobParent* aActor,
const BlobConstructorParams& aParams) = 0;
MOZ_MUST_USE virtual PBrowserParent*
[[nodiscard]] virtual PBrowserParent*
SendPBrowserConstructor(PBrowserParent* actor,
const TabId& aTabId,
const IPCTabContext& context,
@@ -22,7 +22,6 @@ suffixes_label=Suffixes
learn_more_label=Learn More
# GMP Plugins
#ifdef MOZ_GMP
gmp_license_info=License information
gmp_privacy_info=Privacy Information
@@ -31,4 +30,3 @@ openH264_description2=This plugin is automatically installed by Mozilla to compl
widevine_name=Widevine Content Decryption Module provided by Google Inc.
widevine_description2=Play back protected web video.
#endif
+1 -1
View File
@@ -15,7 +15,7 @@
locale/@AB_CD@/global/global.dtd (%chrome/global.dtd)
locale/@AB_CD@/global/appstrings.properties (%chrome/appstrings.properties)
locale/@AB_CD@/global/global-strres.properties (%chrome/global-strres.properties)
* locale/@AB_CD@/global/plugins.properties (%chrome/plugins.properties)
locale/@AB_CD@/global/plugins.properties (%chrome/plugins.properties)
locale/@AB_CD@/global/nsWebBrowserPersist.properties (%chrome/nsWebBrowserPersist.properties)
locale/@AB_CD@/global/xslt/xslt.properties (%chrome/xslt/xslt.properties)
locale/@AB_CD@/global/dom/dom.properties (%chrome/dom/dom.properties)
@@ -149,21 +149,7 @@ FFmpegAudioDecoder<LIBAV_VER>::DoDecode(MediaRawData* aSample)
}
#else
#define AVRESULT_OK 0
int ret = mLib->avcodec_receive_frame(mCodecContext, mFrame);
switch (ret) {
case AVRESULT_OK:
decoded = true;
break;
case AVERROR(EAGAIN):
break;
case AVERROR_EOF: {
FFMPEG_LOG("End of stream.");
return MediaResult(NS_ERROR_DOM_MEDIA_END_OF_STREAM,
RESULT_DETAIL("End of stream"));
}
}
ret = mLib->avcodec_send_packet(mCodecContext, &packet);
int ret = mLib->avcodec_send_packet(mCodecContext, &packet);
switch (ret) {
case AVRESULT_OK:
bytesConsumed = packet.size;
@@ -179,6 +165,20 @@ FFmpegAudioDecoder<LIBAV_VER>::DoDecode(MediaRawData* aSample)
return MediaResult(NS_ERROR_DOM_MEDIA_DECODE_ERR,
RESULT_DETAIL("FFmpeg audio error"));
}
ret = mLib->avcodec_receive_frame(mCodecContext, mFrame);
switch (ret) {
case AVRESULT_OK:
decoded = true;
break;
case AVERROR(EAGAIN):
break;
case AVERROR_EOF: {
FFMPEG_LOG("End of stream.");
return MediaResult(NS_ERROR_DOM_MEDIA_END_OF_STREAM,
RESULT_DETAIL("End of stream"));
}
}
#endif
if (decoded) {
+1 -1
View File
@@ -19,7 +19,7 @@ SOURCES += [
]
LOCAL_INCLUDES += [
'..',
'../ffmpeg58/include',
'../ffmpeg60/include',
]
if CONFIG['GNU_CXX']:
+2 -2
View File
@@ -36,7 +36,7 @@ public:
base_type::SetLength(newLen + sExtra);
}
MOZ_MUST_USE
[[nodiscard]]
bool SetLength(size_type newLen, const mozilla::fallible_t&)
{
return base_type::SetLength(newLen + sExtra, mozilla::fallible);
@@ -89,7 +89,7 @@ public:
base_type::SetLength(newLen + sExtra);
}
MOZ_MUST_USE
[[nodiscard]]
bool SetLength(size_type newLen, const mozilla::fallible_t&)
{
return base_type::SetLength(newLen + sExtra, mozilla::fallible);
+4 -1
View File
@@ -2210,7 +2210,10 @@ PluginModuleParent::NPP_NewInternal(NPMIMEType pluginType, NPP instance,
if (supportsAsyncRender) {
// Prefs indicates we want async plugin rendering, make sure
// the flash module has support.
CallModuleSupportsAsyncRender(&supportsAsyncRender);
if (!CallModuleSupportsAsyncRender(&supportsAsyncRender)) {
// The actual support call failed. Should not happen; abort.
return NS_ERROR_FAILURE;
}
}
#ifdef _WIN64
// For 64-bit builds force windowless if the flash library doesn't support
+3 -1
View File
@@ -34,7 +34,9 @@ public:
for (auto iter = mAudioNotificationSet->ConstIter(); !iter.Done(); iter.Next()) {
PluginModuleParent* pluginModule = iter.Get()->GetKey();
pluginModule->SendNPP_SetValue_NPNVaudioDeviceChangeDetails(mChangeDetails);
if (!pluginModule->SendNPP_SetValue_NPNVaudioDeviceChangeDetails(mChangeDetails)) {
// Sending of notification failed. Ignore for now.
}
}
return NS_OK;
}
+2 -2
View File
@@ -287,14 +287,14 @@ public:
insertBack(aElem);
}
MOZ_MUST_USE
[[nodiscard]]
already_AddRefed<ScriptLoadRequest> Steal(ScriptLoadRequest* aElem)
{
aElem->removeFrom(*this);
return dont_AddRef(aElem);
}
MOZ_MUST_USE
[[nodiscard]]
already_AddRefed<ScriptLoadRequest> StealFirst()
{
MOZ_ASSERT(!isEmpty());
+10 -10
View File
@@ -224,11 +224,11 @@ public:
// If aGlobalObject represents a web-visible global, errors reported by this
// AutoJSAPI as it comes off the stack will fire the relevant error events and
// show up in the corresponding web console.
MOZ_MUST_USE bool Init(nsIGlobalObject* aGlobalObject);
[[nodiscard]] bool Init(nsIGlobalObject* aGlobalObject);
// This is a helper that grabs the native global associated with aObject and
// invokes the above Init() with that.
MOZ_MUST_USE bool Init(JSObject* aObject);
[[nodiscard]] bool Init(JSObject* aObject);
// Unsurprisingly, this uses aCx and enters the compartment of aGlobalObject.
// If aGlobalObject or its associated JS global are null then it returns
@@ -238,15 +238,15 @@ public:
// If aGlobalObject represents a web-visible global, errors reported by this
// AutoJSAPI as it comes off the stack will fire the relevant error events and
// show up in the corresponding web console.
MOZ_MUST_USE bool Init(nsIGlobalObject* aGlobalObject, JSContext* aCx);
[[nodiscard]] bool Init(nsIGlobalObject* aGlobalObject, JSContext* aCx);
// Convenience functions to take an nsPIDOMWindow* or nsGlobalWindow*,
// when it is more easily available than an nsIGlobalObject.
MOZ_MUST_USE bool Init(nsPIDOMWindowInner* aWindow);
MOZ_MUST_USE bool Init(nsPIDOMWindowInner* aWindow, JSContext* aCx);
[[nodiscard]] bool Init(nsPIDOMWindowInner* aWindow);
[[nodiscard]] bool Init(nsPIDOMWindowInner* aWindow, JSContext* aCx);
MOZ_MUST_USE bool Init(nsGlobalWindow* aWindow);
MOZ_MUST_USE bool Init(nsGlobalWindow* aWindow, JSContext* aCx);
[[nodiscard]] bool Init(nsGlobalWindow* aWindow);
[[nodiscard]] bool Init(nsGlobalWindow* aWindow, JSContext* aCx);
JSContext* cx() const {
MOZ_ASSERT(mCx, "Must call Init before using an AutoJSAPI");
@@ -272,12 +272,12 @@ public:
//
// Note that this fails if and only if we OOM while wrapping the exception
// into the current compartment.
MOZ_MUST_USE bool StealException(JS::MutableHandle<JS::Value> aVal);
[[nodiscard]] bool StealException(JS::MutableHandle<JS::Value> aVal);
// As for StealException(), but put the saved frames for any stack trace
// associated with the point the exception was thrown into aStack.
// aVal will be in the current compartment, but aStack might not be.
MOZ_MUST_USE bool StealExceptionAndStack(JS::MutableHandle<JS::Value> aVal,
[[nodiscard]] bool StealExceptionAndStack(JS::MutableHandle<JS::Value> aVal,
JS::MutableHandle<JSObject*> aStack);
// Peek the current exception from the JS engine, without stealing it.
@@ -286,7 +286,7 @@ public:
//
// Note that this fails if and only if we OOM while wrapping the exception
// into the current compartment.
MOZ_MUST_USE bool PeekException(JS::MutableHandle<JS::Value> aVal);
[[nodiscard]] bool PeekException(JS::MutableHandle<JS::Value> aVal);
void ClearException() {
MOZ_ASSERT(IsStackTop());
+4 -4
View File
@@ -44,7 +44,7 @@ public:
// This method should be called only when the string is really needed because
// it can cause the duplication of the strings in case the loading of the XHR
// is not completed yet.
MOZ_MUST_USE bool GetAsString(nsAString& aString) const;
[[nodiscard]] bool GetAsString(nsAString& aString) const;
size_t SizeOfThis(MallocSizeOf aMallocSizeOf) const;
@@ -121,7 +121,7 @@ public:
return !mLength;
}
MOZ_MUST_USE bool GetAsString(DOMString& aString) const;
[[nodiscard]] bool GetAsString(DOMString& aString) const;
private:
XMLHttpRequestStringSnapshot(const XMLHttpRequestStringSnapshot&) = delete;
@@ -193,7 +193,7 @@ public:
mData.Append(aString);
}
MOZ_MUST_USE bool
[[nodiscard]] bool
GetAsString(nsAString& aString)
{
MutexAutoLock lock(mMutex);
@@ -206,7 +206,7 @@ public:
return mData.SizeOfExcludingThisIfUnshared(aMallocSizeOf);
}
MOZ_MUST_USE bool
[[nodiscard]] bool
GetAsString(DOMString& aString, uint32_t aLength)
{
MutexAutoLock lock(mMutex);
+1 -1
View File
@@ -60,7 +60,7 @@ public:
{
}
~txLoadedDocumentsHash();
MOZ_MUST_USE nsresult init(const txXPathNode& aSource);
[[nodiscard]] nsresult init(const txXPathNode& aSource);
private:
friend class txExecutionState;
+6 -6
View File
@@ -111,7 +111,7 @@ struct BaseRect {
// Intersection with an empty Rect may not produce an empty Rect if overflow
// occurs. e.g. {INT_MIN, 0, 0, 20} Intersect { 5000, 0, 500, 20 } gives:
// the non-emtpy {5000, 0, 500, 20 } instead of {5000, 0, 0, 0}
MOZ_MUST_USE Sub Intersect(const Sub& aRect) const
[[nodiscard]] Sub Intersect(const Sub& aRect) const
{
Sub result;
result.x = std::max<T>(x, aRect.x);
@@ -127,7 +127,7 @@ struct BaseRect {
// better. This comes at a tiny cost in performance.
// e.g. {INT_MIN, 0, 0, 20} Intersect { 5000, 0, 500, 20 } gives:
// {5000, 0, 0, 0}
MOZ_MUST_USE Sub SafeIntersect(const Sub& aRect) const
[[nodiscard]] Sub SafeIntersect(const Sub& aRect) const
{
Sub result;
result.x = std::max<T>(x, aRect.x);
@@ -161,7 +161,7 @@ struct BaseRect {
// If both rectangles are empty, returns this.
// WARNING! This is not safe against overflow, prefer using SafeUnion instead
// when dealing with int-based rects.
MOZ_MUST_USE Sub Union(const Sub& aRect) const
[[nodiscard]] Sub Union(const Sub& aRect) const
{
if (IsEmpty()) {
return aRect;
@@ -176,7 +176,7 @@ struct BaseRect {
// Thus, empty input rectangles are allowed to affect the result.
// WARNING! This is not safe against overflow, prefer using SafeUnionEdges
// instead when dealing with int-based rects.
MOZ_MUST_USE Sub UnionEdges(const Sub& aRect) const
[[nodiscard]] Sub UnionEdges(const Sub& aRect) const
{
Sub result;
result.x = std::min(x, aRect.x);
@@ -588,7 +588,7 @@ struct BaseRect {
* Clamp aPoint to this rectangle. It is allowed to end up on any
* edge of the rectangle.
*/
MOZ_MUST_USE Point ClampPoint(const Point& aPoint) const
[[nodiscard]] Point ClampPoint(const Point& aPoint) const
{
return Point(std::max(x, std::min(XMost(), aPoint.x)),
std::max(y, std::min(YMost(), aPoint.y)));
@@ -599,7 +599,7 @@ struct BaseRect {
* aRect then the dimensions that don't fit will be shrunk so that they
* do fit. The resulting rect is returned.
*/
MOZ_MUST_USE Sub MoveInsideAndClamp(const Sub& aRect) const
[[nodiscard]] Sub MoveInsideAndClamp(const Sub& aRect) const
{
Sub rect(std::max(aRect.x, x),
std::max(aRect.y, y),
+11
View File
@@ -6,6 +6,7 @@
#ifndef MOZILLA_GFX_BASESIZE_H_
#define MOZILLA_GFX_BASESIZE_H_
#include <algorithm>
#include "mozilla/Attributes.h"
namespace mozilla {
@@ -92,6 +93,16 @@ struct BaseSize {
Sub operator/(const Sub& aSize) const {
return Sub(width / aSize.width, height / aSize.height);
}
friend Sub Min(const Sub& aA, const Sub& aB) {
return Sub(std::min(aA.width, aB.width),
std::min(aA.height, aB.height));
}
friend Sub Max(const Sub& aA, const Sub& aB) {
return Sub(std::max(aA.width, aB.width),
std::max(aA.height, aB.height));
}
};
} // namespace gfx
+282 -183
View File
@@ -25,159 +25,268 @@ namespace mozilla {
namespace gfx {
/**
* Box blur involves looking at one pixel, and setting its value to the average
* of its neighbouring pixels.
* @param aInput The input buffer.
* @param aOutput The output buffer.
* @param aLeftLobe The number of pixels to blend on the left.
* @param aRightLobe The number of pixels to blend on the right.
* @param aWidth The number of columns in the buffers.
* @param aRows The number of rows in the buffers.
* @param aSkipRect An area to skip blurring in.
* XXX shouldn't we pass stride in separately here?
* Helper function to process each row of the box blur.
* It takes care of transposing the data on input or output depending
* on whether we intend a horizontal or vertical blur, and whether we're
* reading from the initial source or writing to the final destination.
* It allows starting or ending anywhere within the row to accomodate
* a skip rect.
*/
static void
BoxBlurHorizontal(unsigned char* aInput,
unsigned char* aOutput,
int32_t aLeftLobe,
int32_t aRightLobe,
int32_t aWidth,
int32_t aRows,
const IntRect& aSkipRect)
template<bool aTransposeInput, bool aTransposeOutput>
static inline void
BoxBlurRow(const uint8_t* aInput,
uint8_t* aOutput,
int32_t aLeftLobe,
int32_t aRightLobe,
int32_t aWidth,
int32_t aStride,
int32_t aStart,
int32_t aEnd)
{
MOZ_ASSERT(aWidth > 0);
// If the input or output is transposed, then we will move down a row
// for each step, instead of moving over a column. Since these values
// only depend on a template parameter, they will more easily get
// copy-propagated in the non-transposed case, which is why they
// are not passed as parameters.
const int32_t inputStep = aTransposeInput ? aStride : 1;
const int32_t outputStep = aTransposeOutput ? aStride : 1;
int32_t boxSize = aLeftLobe + aRightLobe + 1;
bool skipRectCoversWholeRow = 0 >= aSkipRect.x &&
aWidth <= aSkipRect.XMost();
if (boxSize == 1) {
memcpy(aOutput, aInput, aWidth*aRows);
return;
// We need to sample aLeftLobe pixels to the left and aRightLobe pixels
// to the right of the current position, then average them. So this is
// the size of the total width of this filter.
const int32_t boxSize = aLeftLobe + aRightLobe + 1;
// Instead of dividing the pixel sum by boxSize to average, we can just
// compute a scale that will normalize the result so that it can be quickly
// shifted into the desired range.
const uint32_t reciprocal = (1 << 24) / boxSize;
// The shift would normally truncate the result, whereas we would rather
// prefer to round the result to the closest increment. By adding 0.5 units
// to the initial sum, we bias the sum so that it will be rounded by the
// truncation instead.
uint32_t alphaSum = (boxSize + 1) / 2;
// We process the row with a moving filter, keeping a sum (alphaSum) of
// boxSize pixels. As we move over a pixel, we need to add on a pixel
// from the right extreme of the window that moved into range, and subtract
// off a pixel from the left extreme of window that moved out of range.
// But first, we need to initialization alphaSum to the contents of
// the window before we can get going. If the window moves out of bounds
// of the row, we clamp each sample to be the closest pixel from within
// row bounds, so the 0th and aWidth-1th pixel.
int32_t initLeft = aStart - aLeftLobe;
if (initLeft < 0) {
// If the left lobe samples before the row, add in clamped samples.
alphaSum += -initLeft * aInput[0];
initLeft = 0;
}
int32_t initRight = aStart + boxSize - aLeftLobe;
if (initRight > aWidth) {
// If the right lobe samples after the row, add in clamped samples.
alphaSum += (initRight - aWidth) * aInput[(aWidth - 1) * inputStep];
initRight = aWidth;
}
// Finally, add in all the valid, non-clamped samples to fill up the
// rest of the window.
const uint8_t* src = &aInput[initLeft * inputStep];
const uint8_t* iterEnd = &aInput[initRight * inputStep];
#define INIT_ITER \
alphaSum += *src; \
src += inputStep;
// We unroll the per-pixel loop here substantially. The amount of work
// done per sample is so small that the cost of a loop condition check
// and a branch can substantially add to or even dominate the performance
// of the loop.
while (src + 16 * inputStep <= iterEnd) {
INIT_ITER; INIT_ITER; INIT_ITER; INIT_ITER;
INIT_ITER; INIT_ITER; INIT_ITER; INIT_ITER;
INIT_ITER; INIT_ITER; INIT_ITER; INIT_ITER;
INIT_ITER; INIT_ITER; INIT_ITER; INIT_ITER;
}
while (src < iterEnd) {
INIT_ITER;
}
// Now we start moving the window over the row. We will be accessing
// pixels form aStart - aLeftLobe up to aEnd + aRightLobe, which may be
// out of bounds of the row. To avoid having to check within the inner
// loops if we are in bound, we instead compute the points at which
// we will move out of bounds of the row on the left side (splitLeft)
// and right side (splitRight).
int32_t splitLeft = min(max(aLeftLobe, aStart), aEnd);
int32_t splitRight = min(max(aWidth - (boxSize - aLeftLobe), aStart), aEnd);
// If the filter window is actually large than the size of the row,
// there will be a middle area of overlap where the leftmost and rightmost
// pixel of the filter will both be outside the row. In this case, we need
// to invert the splits so that splitLeft <= splitRight.
if (boxSize > aWidth) {
swap(splitLeft, splitRight);
}
// Process all pixels up to splitLeft that would sample before the start of the row.
// Note that because inputStep and outputStep may not be a const 1 value, it is more
// performant to increment pointers here for the source and destination rather than
// use a loop counter, since doing so would entail an expensive multiplication that
// significantly slows down the loop.
uint8_t* dst = &aOutput[aStart * outputStep];
iterEnd = &aOutput[splitLeft * outputStep];
src = &aInput[(aStart + boxSize - aLeftLobe) * inputStep];
uint8_t firstVal = aInput[0];
#define LEFT_ITER \
*dst = (alphaSum * reciprocal) >> 24; \
alphaSum += *src - firstVal; \
dst += outputStep; \
src += inputStep;
while (dst + 16 * outputStep <= iterEnd) {
LEFT_ITER; LEFT_ITER; LEFT_ITER; LEFT_ITER;
LEFT_ITER; LEFT_ITER; LEFT_ITER; LEFT_ITER;
LEFT_ITER; LEFT_ITER; LEFT_ITER; LEFT_ITER;
LEFT_ITER; LEFT_ITER; LEFT_ITER; LEFT_ITER;
}
while (dst < iterEnd) {
LEFT_ITER;
}
// Process all pixels between splitLeft and splitRight.
iterEnd = &aOutput[splitRight * outputStep];
if (boxSize <= aWidth) {
// The filter window is smaller than the row size, so the leftmost and rightmost
// samples are both within row bounds.
src = &aInput[(splitLeft - aLeftLobe) * inputStep];
int32_t boxStep = boxSize * inputStep;
#define CENTER_ITER \
*dst = (alphaSum * reciprocal) >> 24; \
alphaSum += src[boxStep] - *src; \
dst += outputStep; \
src += inputStep;
while (dst + 16 * outputStep <= iterEnd) {
CENTER_ITER; CENTER_ITER; CENTER_ITER; CENTER_ITER;
CENTER_ITER; CENTER_ITER; CENTER_ITER; CENTER_ITER;
CENTER_ITER; CENTER_ITER; CENTER_ITER; CENTER_ITER;
CENTER_ITER; CENTER_ITER; CENTER_ITER; CENTER_ITER;
}
uint32_t reciprocal = uint32_t((uint64_t(1) << 32) / boxSize);
for (int32_t y = 0; y < aRows; y++) {
// Check whether the skip rect intersects this row. If the skip
// rect covers the whole surface in this row, we can avoid
// this row entirely (and any others along the skip rect).
bool inSkipRectY = y >= aSkipRect.y &&
y < aSkipRect.YMost();
if (inSkipRectY && skipRectCoversWholeRow) {
y = aSkipRect.YMost() - 1;
continue;
}
uint32_t alphaSum = 0;
for (int32_t i = 0; i < boxSize; i++) {
int32_t pos = i - aLeftLobe;
// See assertion above; if aWidth is zero, then we would have no
// valid position to clamp to.
pos = max(pos, 0);
pos = min(pos, aWidth - 1);
alphaSum += aInput[aWidth * y + pos];
}
for (int32_t x = 0; x < aWidth; x++) {
// Check whether we are within the skip rect. If so, go
// to the next point outside the skip rect.
if (inSkipRectY && x >= aSkipRect.x &&
x < aSkipRect.XMost()) {
x = aSkipRect.XMost();
if (x >= aWidth)
break;
// Recalculate the neighbouring alpha values for
// our new point on the surface.
alphaSum = 0;
for (int32_t i = 0; i < boxSize; i++) {
int32_t pos = x + i - aLeftLobe;
// See assertion above; if aWidth is zero, then we would have no
// valid position to clamp to.
pos = max(pos, 0);
pos = min(pos, aWidth - 1);
alphaSum += aInput[aWidth * y + pos];
}
}
int32_t tmp = x - aLeftLobe;
int32_t last = max(tmp, 0);
int32_t next = min(tmp + boxSize, aWidth - 1);
aOutput[aWidth * y + x] = (uint64_t(alphaSum) * reciprocal) >> 32;
alphaSum += aInput[aWidth * y + next] -
aInput[aWidth * y + last];
}
while (dst < iterEnd) {
CENTER_ITER;
}
} else {
// The filter window is larger than the row size, and we're in the area of split
// overlap. So the leftmost and rightmost samples are both out of bounds and need
// to be clamped. We can just precompute the difference here consequently.
int32_t firstLastDiff = aInput[(aWidth -1) * inputStep] - aInput[0];
while (dst < iterEnd) {
*dst = (alphaSum * reciprocal) >> 24;
alphaSum += firstLastDiff;
dst += outputStep;
}
}
// Process all remaining pixels after splitRight that would sample after the row end.
iterEnd = &aOutput[aEnd * outputStep];
src = &aInput[(splitRight - aLeftLobe) * inputStep];
uint8_t lastVal = aInput[(aWidth - 1) * inputStep];
#define RIGHT_ITER \
*dst = (alphaSum * reciprocal) >> 24; \
alphaSum += lastVal - *src; \
dst += outputStep; \
src += inputStep;
while (dst + 16 * outputStep <= iterEnd) {
RIGHT_ITER; RIGHT_ITER; RIGHT_ITER; RIGHT_ITER;
RIGHT_ITER; RIGHT_ITER; RIGHT_ITER; RIGHT_ITER;
RIGHT_ITER; RIGHT_ITER; RIGHT_ITER; RIGHT_ITER;
RIGHT_ITER; RIGHT_ITER; RIGHT_ITER; RIGHT_ITER;
}
while (dst < iterEnd) {
RIGHT_ITER;
}
}
/**
* Identical to BoxBlurHorizontal, except it blurs top and bottom instead of
* left and right.
* XXX shouldn't we pass stride in separately here?
* Box blur involves looking at one pixel, and setting its value to the average
* of its neighbouring pixels. This is meant to provide a 3-pass approximation of a
* Gaussian blur.
* @param aTranspose Whether to transpose the buffer when reading and writing to it.
* @param aData The buffer to be blurred.
* @param aLobes The number of pixels to blend on the left and right for each of 3 passes.
* @param aWidth The number of columns in the buffers.
* @param aRows The number of rows in the buffers.
* @param aStride The stride of the buffer.
*/
template<bool aTranspose>
static void
BoxBlurVertical(unsigned char* aInput,
unsigned char* aOutput,
int32_t aTopLobe,
int32_t aBottomLobe,
int32_t aWidth,
int32_t aRows,
const IntRect& aSkipRect)
BoxBlur(uint8_t* aData,
const int32_t aLobes[3][2],
int32_t aWidth,
int32_t aRows,
int32_t aStride,
IntRect aSkipRect)
{
MOZ_ASSERT(aRows > 0);
if (aTranspose) {
swap(aWidth, aRows);
swap(aSkipRect.x, aSkipRect.y);
swap(aSkipRect.width, aSkipRect.height);
}
int32_t boxSize = aTopLobe + aBottomLobe + 1;
bool skipRectCoversWholeColumn = 0 >= aSkipRect.y &&
aRows <= aSkipRect.YMost();
if (boxSize == 1) {
memcpy(aOutput, aInput, aWidth*aRows);
return;
MOZ_ASSERT(aWidth > 0);
// All three passes of the box blur that approximate the Gaussian are done
// on each row in turn, so we only need two temporary row buffers to process
// each row, instead of a full-sized buffer. Data moves from the source to the
// first temporary, from the first temporary to the second, then from the second
// back to the destination. This way is more cache-friendly than processing whe
// whole buffer in each pass and thus yields a nice speedup.
uint8_t* tmpRow = new (std::nothrow) uint8_t[2 * aWidth];
if (!tmpRow) {
return;
}
uint8_t* tmpRow2 = tmpRow + aWidth;
const int32_t stride = aTranspose ? 1 : aStride;
bool skipRectCoversWholeRow = 0 >= aSkipRect.x &&
aWidth <= aSkipRect.XMost();
for (int32_t y = 0; y < aRows; y++) {
// Check whether the skip rect intersects this row. If the skip
// rect covers the whole surface in this row, we can avoid
// this row entirely (and any others along the skip rect).
bool inSkipRectY = y >= aSkipRect.y &&
y < aSkipRect.YMost();
if (inSkipRectY && skipRectCoversWholeRow) {
aData += stride * (aSkipRect.YMost() - y);
y = aSkipRect.YMost() - 1;
continue;
}
uint32_t reciprocal = uint32_t((uint64_t(1) << 32) / boxSize);
for (int32_t x = 0; x < aWidth; x++) {
bool inSkipRectX = x >= aSkipRect.x &&
x < aSkipRect.XMost();
if (inSkipRectX && skipRectCoversWholeColumn) {
x = aSkipRect.XMost() - 1;
continue;
}
// Read in data from the source transposed if necessary.
BoxBlurRow<aTranspose, false>(aData, tmpRow, aLobes[0][0], aLobes[0][1], aWidth, aStride, 0, aWidth);
uint32_t alphaSum = 0;
for (int32_t i = 0; i < boxSize; i++) {
int32_t pos = i - aTopLobe;
// See assertion above; if aRows is zero, then we would have no
// valid position to clamp to.
pos = max(pos, 0);
pos = min(pos, aRows - 1);
alphaSum += aInput[aWidth * pos + x];
}
for (int32_t y = 0; y < aRows; y++) {
if (inSkipRectX && y >= aSkipRect.y &&
y < aSkipRect.YMost()) {
y = aSkipRect.YMost();
if (y >= aRows)
break;
// For the middle pass, the data is already pre-transposed and does not need to be post-transposed yet.
BoxBlurRow<false, false>(tmpRow, tmpRow2, aLobes[1][0], aLobes[1][1], aWidth, aStride, 0, aWidth);
alphaSum = 0;
for (int32_t i = 0; i < boxSize; i++) {
int32_t pos = y + i - aTopLobe;
// See assertion above; if aRows is zero, then we would have no
// valid position to clamp to.
pos = max(pos, 0);
pos = min(pos, aRows - 1);
alphaSum += aInput[aWidth * pos + x];
}
}
int32_t tmp = y - aTopLobe;
int32_t last = max(tmp, 0);
int32_t next = min(tmp + boxSize, aRows - 1);
aOutput[aWidth * y + x] = (uint64_t(alphaSum) * reciprocal) >> 32;
alphaSum += aInput[aWidth * next + x] -
aInput[aWidth * last + x];
}
// Write back data to the destination transposed if necessary too.
// Make sure not to overwrite the skip rect by only outputting to the
// destination before and after the skip rect, if requested.
int32_t skipStart = inSkipRectY ? min(max(aSkipRect.x, 0), aWidth) : aWidth;
int32_t skipEnd = max(skipStart, aSkipRect.XMost());
if (skipStart > 0) {
BoxBlurRow<false, aTranspose>(tmpRow2, aData, aLobes[2][0], aLobes[2][1], aWidth, aStride, 0, skipStart);
}
if (skipEnd < aWidth) {
BoxBlurRow<false, aTranspose>(tmpRow2, aData, aLobes[2][0], aLobes[2][1], aWidth, aStride, skipEnd, aWidth);
}
aData += stride;
}
delete[] tmpRow;
}
static void ComputeLobes(int32_t aRadius, int32_t aLobes[3][2])
@@ -226,8 +335,8 @@ static void ComputeLobes(int32_t aRadius, int32_t aLobes[3][2])
}
static void
SpreadHorizontal(unsigned char* aInput,
unsigned char* aOutput,
SpreadHorizontal(uint8_t* aInput,
uint8_t* aOutput,
int32_t aRadius,
int32_t aWidth,
int32_t aRows,
@@ -274,8 +383,8 @@ SpreadHorizontal(unsigned char* aInput,
}
static void
SpreadVertical(unsigned char* aInput,
unsigned char* aOutput,
SpreadVertical(uint8_t* aInput,
uint8_t* aOutput,
int32_t aRadius,
int32_t aWidth,
int32_t aRows,
@@ -335,10 +444,26 @@ AlphaBoxBlur::AlphaBoxBlur(const Rect& aRect,
const IntSize& aBlurRadius,
const Rect* aDirtyRect,
const Rect* aSkipRect)
: mSpreadRadius(aSpreadRadius),
mBlurRadius(aBlurRadius),
mSurfaceAllocationSize(0)
: mSurfaceAllocationSize(0)
{
Init(aRect, aSpreadRadius, aBlurRadius, aDirtyRect, aSkipRect);
}
AlphaBoxBlur::AlphaBoxBlur()
: mSurfaceAllocationSize(0)
{
}
void
AlphaBoxBlur::Init(const Rect& aRect,
const IntSize& aSpreadRadius,
const IntSize& aBlurRadius,
const Rect* aDirtyRect,
const Rect* aSkipRect)
{
mSpreadRadius = aSpreadRadius;
mBlurRadius = aBlurRadius;
Rect rect(aRect);
rect.Inflate(Size(aBlurRadius + aSpreadRadius));
rect.RoundOut();
@@ -355,8 +480,7 @@ AlphaBoxBlur::AlphaBoxBlur(const Rect& aRect,
mHasDirtyRect = false;
}
mRect = IntRect(int32_t(rect.x), int32_t(rect.y),
int32_t(rect.width), int32_t(rect.height));
mRect = TruncatedToInt(rect);
if (mRect.IsEmpty()) {
return;
}
@@ -366,11 +490,8 @@ AlphaBoxBlur::AlphaBoxBlur(const Rect& aRect,
// blurring/spreading we need to do. We convert it to IntRect to avoid
// expensive int<->float conversions if we were to use Rect instead.
Rect skipRect = *aSkipRect;
skipRect.RoundIn();
skipRect.Deflate(Size(aBlurRadius + aSpreadRadius));
mSkipRect = IntRect(int32_t(skipRect.x), int32_t(skipRect.y),
int32_t(skipRect.width), int32_t(skipRect.height));
mSkipRect = RoundedIn(skipRect);
mSkipRect = mSkipRect.Intersect(mRect);
if (mSkipRect.IsEqualInterior(mRect))
return;
@@ -397,8 +518,7 @@ AlphaBoxBlur::AlphaBoxBlur(const Rect& aRect,
int32_t aStride,
float aSigmaX,
float aSigmaY)
: mRect(int32_t(aRect.x), int32_t(aRect.y),
int32_t(aRect.width), int32_t(aRect.height)),
: mRect(TruncatedToInt(aRect)),
mSpreadRadius(),
mBlurRadius(CalculateBlurRadius(Point(aSigmaX, aSigmaY))),
mStride(aStride),
@@ -469,7 +589,7 @@ AlphaBoxBlur::Blur(uint8_t* aData)
if (mSpreadRadius.width > 0 || mSpreadRadius.height > 0) {
// No need to use CheckedInt here - we have validated it in the constructor.
size_t szB = stride * size.height;
unsigned char* tmpData = new (std::nothrow) uint8_t[szB];
uint8_t* tmpData = new (std::nothrow) uint8_t[szB];
if (!tmpData) {
return;
@@ -477,8 +597,8 @@ AlphaBoxBlur::Blur(uint8_t* aData)
memset(tmpData, 0, szB);
SpreadHorizontal(aData, tmpData, mSpreadRadius.width, GetSize().width, GetSize().height, stride, mSkipRect);
SpreadVertical(tmpData, aData, mSpreadRadius.height, GetSize().width, GetSize().height, stride, mSkipRect);
SpreadHorizontal(aData, tmpData, mSpreadRadius.width, size.width, size.height, stride, mSkipRect);
SpreadVertical(tmpData, aData, mSpreadRadius.height, size.width, size.height, stride, mSkipRect);
delete [] tmpData;
}
@@ -497,39 +617,12 @@ AlphaBoxBlur::Blur(uint8_t* aData)
if ((integralImageSize.width * integralImageSize.height) > (1 << 24)) {
// Fallback to old blurring code when the surface is so large it may
// overflow our integral image!
// No need to use CheckedInt here - we have validated it in the constructor.
size_t szB = stride * size.height;
uint8_t* tmpData = new (std::nothrow) uint8_t[szB];
if (!tmpData) {
return;
}
memset(tmpData, 0, szB);
uint8_t* a = aData;
uint8_t* b = tmpData;
if (mBlurRadius.width > 0) {
BoxBlurHorizontal(a, b, horizontalLobes[0][0], horizontalLobes[0][1], stride, GetSize().height, mSkipRect);
BoxBlurHorizontal(b, a, horizontalLobes[1][0], horizontalLobes[1][1], stride, GetSize().height, mSkipRect);
BoxBlurHorizontal(a, b, horizontalLobes[2][0], horizontalLobes[2][1], stride, GetSize().height, mSkipRect);
} else {
a = tmpData;
b = aData;
BoxBlur<false>(aData, horizontalLobes, size.width, size.height, stride, mSkipRect);
}
// The result is in 'b' here.
if (mBlurRadius.height > 0) {
BoxBlurVertical(b, a, verticalLobes[0][0], verticalLobes[0][1], stride, GetSize().height, mSkipRect);
BoxBlurVertical(a, b, verticalLobes[1][0], verticalLobes[1][1], stride, GetSize().height, mSkipRect);
BoxBlurVertical(b, a, verticalLobes[2][0], verticalLobes[2][1], stride, GetSize().height, mSkipRect);
} else {
a = b;
BoxBlur<true>(aData, verticalLobes, size.width, size.height, stride, mSkipRect);
}
// The result is in 'a' here.
if (a == tmpData) {
memcpy(aData, tmpData, szB);
}
delete [] tmpData;
} else {
size_t integralImageStride = GetAlignedStride<16>(integralImageSize.width, 4);
if (integralImageStride == 0) {
@@ -765,5 +858,11 @@ AlphaBoxBlur::CalculateBlurRadius(const Point& aStd)
return size;
}
Float
AlphaBoxBlur::CalculateBlurSigma(int32_t aBlurRadius)
{
return aBlurRadius / GAUSSIAN_SCALE_FACTOR;
}
} // namespace gfx
} // namespace mozilla
+19
View File
@@ -68,6 +68,14 @@ public:
float aSigmaX,
float aSigmaY);
AlphaBoxBlur();
void Init(const Rect& aRect,
const IntSize& aSpreadRadius,
const IntSize& aBlurRadius,
const Rect* aDirtyRect,
const Rect* aSkipRect);
~AlphaBoxBlur();
/**
@@ -91,6 +99,16 @@ public:
*/
Rect* GetDirtyRect();
/**
* Return the spread radius, in pixels.
*/
IntSize GetSpreadRadius() const { return mSpreadRadius; }
/**
* Return the blur radius, in pixels.
*/
IntSize GetBlurRadius() const { return mBlurRadius; }
/**
* Return the minimum buffer size that should be given to Blur() method. If
* zero, the class is not properly setup for blurring. Note that this
@@ -114,6 +132,7 @@ public:
* constructor, above.
*/
static IntSize CalculateBlurRadius(const Point& aStandardDeviation);
static Float CalculateBlurSigma(int32_t aBlurRadius);
private:
+17 -16
View File
@@ -931,16 +931,18 @@ DrawTargetCairo::DrawSurfaceWithShadow(SourceSurface *aSurface,
if (cairo_surface_get_type(sourcesurf) == CAIRO_SURFACE_TYPE_TEE) {
blursurf = cairo_tee_surface_index(sourcesurf, 0);
surf = cairo_tee_surface_index(sourcesurf, 1);
} else {
blursurf = sourcesurf;
surf = sourcesurf;
}
if (aSigma != 0.0f) {
MOZ_ASSERT(cairo_surface_get_type(blursurf) == CAIRO_SURFACE_TYPE_IMAGE);
Rect extents(0, 0, width, height);
AlphaBoxBlur blur(extents,
cairo_image_surface_get_stride(blursurf),
aSigma, aSigma);
blur.Blur(cairo_image_surface_get_data(blursurf));
} else {
blursurf = sourcesurf;
surf = sourcesurf;
}
WillChange();
@@ -951,25 +953,24 @@ DrawTargetCairo::DrawSurfaceWithShadow(SourceSurface *aSurface,
cairo_identity_matrix(mContext);
cairo_translate(mContext, aDest.x, aDest.y);
if (IsOperatorBoundByMask(aOperator)){
cairo_set_source_rgba(mContext, aColor.r, aColor.g, aColor.b, aColor.a);
cairo_mask_surface(mContext, blursurf, aOffset.x, aOffset.y);
bool needsGroup = !IsOperatorBoundByMask(aOperator);
if (needsGroup) {
cairo_push_group(mContext);
}
cairo_set_source_rgba(mContext, aColor.r, aColor.g, aColor.b, aColor.a);
cairo_mask_surface(mContext, blursurf, aOffset.x, aOffset.y);
if (blursurf != surf ||
aSurface->GetFormat() != SurfaceFormat::A8) {
// Now that the shadow has been drawn, we can draw the surface on top.
cairo_set_source_surface(mContext, surf, 0, 0);
cairo_new_path(mContext);
cairo_rectangle(mContext, 0, 0, width, height);
cairo_fill(mContext);
} else {
cairo_push_group(mContext);
cairo_set_source_rgba(mContext, aColor.r, aColor.g, aColor.b, aColor.a);
cairo_mask_surface(mContext, blursurf, aOffset.x, aOffset.y);
}
// Now that the shadow has been drawn, we can draw the surface on top.
cairo_set_source_surface(mContext, surf, 0, 0);
cairo_new_path(mContext);
cairo_rectangle(mContext, 0, 0, width, height);
cairo_fill(mContext);
if (needsGroup) {
cairo_pop_group_to_source(mContext);
cairo_paint(mContext);
}
@@ -1924,7 +1925,7 @@ DrawTargetCairo::CreateShadowDrawTarget(const IntSize &aSize, SurfaceFormat aFor
// If we don't have a blur then we can use the RGBA mask and keep all the
// operations in graphics memory.
if (aSigma == 0.0F) {
if (aSigma == 0.0f || aFormat == SurfaceFormat::A8) {
RefPtr<DrawTargetCairo> target = new DrawTargetCairo();
if (target->InitAlreadyReferenced(similar, aSize)) {
return target.forget();
+14 -6
View File
@@ -244,21 +244,29 @@ DrawTargetD2D1::DrawSurfaceWithShadow(SourceSurface *aSurface,
// Step 1, create the shadow effect.
RefPtr<ID2D1Effect> shadowEffect;
HRESULT hr = mDC->CreateEffect(CLSID_D2D1Shadow, getter_AddRefs(shadowEffect));
HRESULT hr = mDC->CreateEffect(mFormat == SurfaceFormat::A8 ? CLSID_D2D1GaussianBlur : CLSID_D2D1Shadow,
getter_AddRefs(shadowEffect));
if (FAILED(hr) || !shadowEffect) {
gfxWarning() << "Failed to create shadow effect. Code: " << hexa(hr);
return;
}
shadowEffect->SetInput(0, image);
shadowEffect->SetValue(D2D1_SHADOW_PROP_BLUR_STANDARD_DEVIATION, aSigma);
D2D1_VECTOR_4F color = { aColor.r, aColor.g, aColor.b, aColor.a };
shadowEffect->SetValue(D2D1_SHADOW_PROP_COLOR, color);
if (mFormat == SurfaceFormat::A8) {
shadowEffect->SetValue(D2D1_GAUSSIANBLUR_PROP_STANDARD_DEVIATION, aSigma);
shadowEffect->SetValue(D2D1_GAUSSIANBLUR_PROP_BORDER_MODE, D2D1_BORDER_MODE_HARD);
} else {
shadowEffect->SetValue(D2D1_SHADOW_PROP_BLUR_STANDARD_DEVIATION, aSigma);
D2D1_VECTOR_4F color = { aColor.r, aColor.g, aColor.b, aColor.a };
shadowEffect->SetValue(D2D1_SHADOW_PROP_COLOR, color);
}
D2D1_POINT_2F shadowPoint = D2DPoint(aDest + aOffset);
mDC->DrawImage(shadowEffect, &shadowPoint, nullptr, D2D1_INTERPOLATION_MODE_LINEAR, D2DCompositionMode(aOperator));
D2D1_POINT_2F imgPoint = D2DPoint(aDest);
mDC->DrawImage(image, &imgPoint, nullptr, D2D1_INTERPOLATION_MODE_LINEAR, D2DCompositionMode(aOperator));
if (aSurface->GetFormat() != SurfaceFormat::A8) {
D2D1_POINT_2F imgPoint = D2DPoint(aDest);
mDC->DrawImage(image, &imgPoint, nullptr, D2D1_INTERPOLATION_MODE_LINEAR, D2DCompositionMode(aOperator));
}
}
void
+5 -3
View File
@@ -713,9 +713,11 @@ DrawTargetSkia::DrawSurfaceWithShadow(SourceSurface *aSurface,
mCanvas->drawImage(image, shadowDest.x, shadowDest.y, &shadowPaint);
}
// Composite the original image after the shadow
auto dest = IntPoint::Round(aDest);
mCanvas->drawImage(image, dest.x, dest.y, &paint);
if (aSurface->GetFormat() != SurfaceFormat::A8) {
// Composite the original image after the shadow
auto dest = IntPoint::Round(aDest);
mCanvas->drawImage(image, dest.x, dest.y, &paint);
}
mCanvas->restore();
}
+3 -3
View File
@@ -595,6 +595,8 @@ CreatePartialBitmapForSurface(DataSourceSurface *aSurface, const Matrix &aDestin
//
//
int Bpp = BytesPerPixel(aSurface->GetFormat());
if (uploadRect.Contains(rect)) {
// Extend mode is irrelevant, the displayed rect is completely contained
// by the source bitmap.
@@ -631,7 +633,7 @@ CreatePartialBitmapForSurface(DataSourceSurface *aSurface, const Matrix &aDestin
// A partial upload will suffice.
aRT->CreateBitmap(D2D1::SizeU(uint32_t(uploadRect.width), uint32_t(uploadRect.height)),
mapping.GetData() + int(uploadRect.x) * 4 + int(uploadRect.y) * mapping.GetStride(),
mapping.GetData() + int(uploadRect.x) * Bpp + int(uploadRect.y) * mapping.GetStride(),
mapping.GetStride(),
D2D1::BitmapProperties(D2DPixelFormat(aSurface->GetFormat())),
getter_AddRefs(bitmap));
@@ -641,8 +643,6 @@ CreatePartialBitmapForSurface(DataSourceSurface *aSurface, const Matrix &aDestin
return bitmap.forget();
} else {
int Bpp = BytesPerPixel(aSurface->GetFormat());
if (Bpp != 4) {
// This shouldn't actually happen in practice!
MOZ_ASSERT(false);
+9
View File
@@ -224,6 +224,15 @@ struct RectCornerRadii {
return true;
}
bool AreRadiiSame() const {
for (size_t i = 1; i < RectCorner::Count; i++) {
if (radii[i] != radii[0]) {
return false;
}
}
return true;
}
void Scale(Float aXScale, Float aYScale) {
for (int i = 0; i < RectCorner::Count; i++) {
radii[i].Scale(aXScale, aYScale);
+1 -1
View File
@@ -285,7 +285,7 @@ typedef IntSizeTyped<UnknownUnits> IntSize;
template<class units, class F = Float>
struct SizeTyped :
public BaseSize< F, SizeTyped<units> >,
public BaseSize< F, SizeTyped<units, F> >,
public units {
static_assert(IsPixel<units>::value,
"'units' must be a coordinate system tag");
+2 -2
View File
@@ -166,7 +166,7 @@ struct IntRectTyped :
// Same as Union(), but in the cases where aRect is non-empty, the union is
// done while guarding against overflow. If an overflow is detected, Nothing
// is returned.
MOZ_MUST_USE Maybe<Self> SafeUnion(const Self& aRect) const
[[nodiscard]] Maybe<Self> SafeUnion(const Self& aRect) const
{
if (this->IsEmpty()) {
return aRect.Overflows() ? Nothing() : Some(aRect);
@@ -179,7 +179,7 @@ struct IntRectTyped :
// Same as UnionEdges, but guards against overflow. If an overflow is detected,
// Nothing is returned.
MOZ_MUST_USE Maybe<Self> SafeUnionEdges(const Self& aRect) const
[[nodiscard]] Maybe<Self> SafeUnionEdges(const Self& aRect) const
{
if (this->Overflows() || aRect.Overflows()) {
return Nothing();
@@ -823,9 +823,9 @@ extern int pplex \
*/
YY_DECL
{
register yy_state_type yy_current_state;
register char *yy_cp, *yy_bp;
register int yy_act;
yy_state_type yy_current_state;
char *yy_cp, *yy_bp;
int yy_act;
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
yylval = yylval_param;
@@ -878,7 +878,7 @@ YY_DECL
yy_match:
do
{
register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ;
YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ;
if ( yy_accept[yy_current_state] )
{
yyg->yy_last_accepting_state = yy_current_state;
@@ -1336,9 +1336,9 @@ ECHO;
static int yy_get_next_buffer (yyscan_t yyscanner)
{
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
register char *source = yyg->yytext_ptr;
register int number_to_move, i;
char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
char *source = yyg->yytext_ptr;
int number_to_move, i;
int ret_val;
if ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] )
@@ -1470,15 +1470,15 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
static yy_state_type yy_get_previous_state (yyscan_t yyscanner)
{
register yy_state_type yy_current_state;
register char *yy_cp;
yy_state_type yy_current_state;
char *yy_cp;
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
yy_current_state = yyg->yy_start;
for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp )
{
register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
if ( yy_accept[yy_current_state] )
{
yyg->yy_last_accepting_state = yy_current_state;
@@ -1503,11 +1503,11 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
*/
static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state , yyscan_t yyscanner)
{
register int yy_is_jam;
int yy_is_jam;
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */
register char *yy_cp = yyg->yy_c_buf_p;
char *yy_cp = yyg->yy_c_buf_p;
register YY_CHAR yy_c = 1;
YY_CHAR yy_c = 1;
if ( yy_accept[yy_current_state] )
{
yyg->yy_last_accepting_state = yy_current_state;
@@ -1286,9 +1286,9 @@ extern int yylex \
*/
YY_DECL
{
register yy_state_type yy_current_state;
register char *yy_cp, *yy_bp;
register int yy_act;
yy_state_type yy_current_state;
char *yy_cp, *yy_bp;
int yy_act;
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
yylval = yylval_param;
@@ -1341,7 +1341,7 @@ YY_DECL
yy_match:
do
{
register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ;
YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ;
if ( yy_accept[yy_current_state] )
{
yyg->yy_last_accepting_state = yy_current_state;
@@ -2237,9 +2237,9 @@ ECHO;
static int yy_get_next_buffer (yyscan_t yyscanner)
{
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
register char *source = yyg->yytext_ptr;
register int number_to_move, i;
char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
char *source = yyg->yytext_ptr;
int number_to_move, i;
int ret_val;
if ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] )
@@ -2371,15 +2371,15 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
static yy_state_type yy_get_previous_state (yyscan_t yyscanner)
{
register yy_state_type yy_current_state;
register char *yy_cp;
yy_state_type yy_current_state;
char *yy_cp;
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
yy_current_state = yyg->yy_start;
for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp )
{
register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
if ( yy_accept[yy_current_state] )
{
yyg->yy_last_accepting_state = yy_current_state;
@@ -2404,11 +2404,11 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
*/
static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state , yyscan_t yyscanner)
{
register int yy_is_jam;
int yy_is_jam;
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */
register char *yy_cp = yyg->yy_c_buf_p;
char *yy_cp = yyg->yy_c_buf_p;
register YY_CHAR yy_c = 1;
YY_CHAR yy_c = 1;
if ( yy_accept[yy_current_state] )
{
yyg->yy_last_accepting_state = yy_current_state;
+3 -3
View File
@@ -35,12 +35,12 @@ struct nsPoint : public mozilla::gfx::BasePoint<nscoord, nsPoint> {
* @param aFromAPP the APP to scale from
* @param aToAPP the APP to scale to
*/
MOZ_MUST_USE inline nsPoint
[[nodiscard]] inline nsPoint
ScaleToOtherAppUnits(int32_t aFromAPP, int32_t aToAPP) const;
MOZ_MUST_USE inline nsPoint
[[nodiscard]] inline nsPoint
RemoveResolution(const float resolution) const;
MOZ_MUST_USE inline nsPoint
[[nodiscard]] inline nsPoint
ApplyResolution(const float resolution) const;
};
+13 -13
View File
@@ -56,7 +56,7 @@ struct nsRect :
// overflowing nscoord values in the 'width' and 'height' fields by
// clamping the width and height values to nscoord_MAX if necessary.
MOZ_MUST_USE nsRect SaturatingUnion(const nsRect& aRect) const
[[nodiscard]] nsRect SaturatingUnion(const nsRect& aRect) const
{
if (IsEmpty()) {
return aRect;
@@ -67,7 +67,7 @@ struct nsRect :
}
}
MOZ_MUST_USE nsRect SaturatingUnionEdges(const nsRect& aRect) const
[[nodiscard]] nsRect SaturatingUnionEdges(const nsRect& aRect) const
{
#ifdef NS_COORD_IS_FLOAT
return UnionEdges(aRect);
@@ -102,7 +102,7 @@ struct nsRect :
#ifndef NS_COORD_IS_FLOAT
// Make all nsRect Union methods be saturating.
MOZ_MUST_USE nsRect UnionEdges(const nsRect& aRect) const
[[nodiscard]] nsRect UnionEdges(const nsRect& aRect) const
{
return SaturatingUnionEdges(aRect);
}
@@ -110,7 +110,7 @@ struct nsRect :
{
*this = aRect1.UnionEdges(aRect2);
}
MOZ_MUST_USE nsRect Union(const nsRect& aRect) const
[[nodiscard]] nsRect Union(const nsRect& aRect) const
{
return SaturatingUnion(aRect);
}
@@ -141,32 +141,32 @@ struct nsRect :
* @param aToAPP the APP to scale to
* @note this can turn an empty rectangle into a non-empty rectangle
*/
MOZ_MUST_USE inline nsRect
[[nodiscard]] inline nsRect
ScaleToOtherAppUnitsRoundOut(int32_t aFromAPP, int32_t aToAPP) const;
MOZ_MUST_USE inline nsRect
[[nodiscard]] inline nsRect
ScaleToOtherAppUnitsRoundIn(int32_t aFromAPP, int32_t aToAPP) const;
MOZ_MUST_USE inline mozilla::gfx::IntRect
[[nodiscard]] inline mozilla::gfx::IntRect
ScaleToNearestPixels(float aXScale, float aYScale,
nscoord aAppUnitsPerPixel) const;
MOZ_MUST_USE inline mozilla::gfx::IntRect
[[nodiscard]] inline mozilla::gfx::IntRect
ToNearestPixels(nscoord aAppUnitsPerPixel) const;
// Note: this can turn an empty rectangle into a non-empty rectangle
MOZ_MUST_USE inline mozilla::gfx::IntRect
[[nodiscard]] inline mozilla::gfx::IntRect
ScaleToOutsidePixels(float aXScale, float aYScale,
nscoord aAppUnitsPerPixel) const;
// Note: this can turn an empty rectangle into a non-empty rectangle
MOZ_MUST_USE inline mozilla::gfx::IntRect
[[nodiscard]] inline mozilla::gfx::IntRect
ToOutsidePixels(nscoord aAppUnitsPerPixel) const;
MOZ_MUST_USE inline mozilla::gfx::IntRect
[[nodiscard]] inline mozilla::gfx::IntRect
ScaleToInsidePixels(float aXScale, float aYScale,
nscoord aAppUnitsPerPixel) const;
MOZ_MUST_USE inline mozilla::gfx::IntRect
[[nodiscard]] inline mozilla::gfx::IntRect
ToInsidePixels(nscoord aAppUnitsPerPixel) const;
// This is here only to keep IPDL-generated code happy. DO NOT USE.
@@ -175,7 +175,7 @@ struct nsRect :
return IsEqualEdges(aRect);
}
MOZ_MUST_USE inline nsRect RemoveResolution(const float aResolution) const;
[[nodiscard]] inline nsRect RemoveResolution(const float aResolution) const;
};
/*
+2 -2
View File
@@ -296,9 +296,9 @@ public:
* @param aToAPP the APP to scale to
* @note this can turn an empty region into a non-empty region
*/
MOZ_MUST_USE nsRegion
[[nodiscard]] nsRegion
ScaleToOtherAppUnitsRoundOut (int32_t aFromAPP, int32_t aToAPP) const;
MOZ_MUST_USE nsRegion
[[nodiscard]] nsRegion
ScaleToOtherAppUnitsRoundIn (int32_t aFromAPP, int32_t aToAPP) const;
nsRegion& ScaleRoundOut(float aXScale, float aYScale);
nsRegion& ScaleInverseRoundOut(float aXScale, float aYScale);
+1 -1
View File
@@ -30,7 +30,7 @@ struct nsSize : public mozilla::gfx::BaseSize<nscoord, nsSize> {
* @param aFromAPP the APP to scale from
* @param aToAPP the APP to scale to
*/
MOZ_MUST_USE inline nsSize
[[nodiscard]] inline nsSize
ScaleToOtherAppUnits(int32_t aFromAPP, int32_t aToAPP) const;
};
+579 -364
View File
File diff suppressed because it is too large. Load diff
+45 -35
View File
@@ -10,14 +10,13 @@
#include "nsSize.h"
#include "gfxPoint.h"
#include "mozilla/RefPtr.h"
#include "mozilla/UniquePtr.h"
#include "mozilla/gfx/Blur.h"
class gfxContext;
struct gfxRect;
namespace mozilla {
namespace gfx {
class AlphaBoxBlur;
struct Color;
struct RectCornerRadii;
class SourceSurface;
@@ -57,6 +56,9 @@ public:
/**
* Constructs a box blur and initializes the temporary surface.
*
* @param aDestinationCtx The destination to blur to.
*
* @param aRect The coordinates of the surface to create in device units.
*
* @param aBlurRadius The blur radius in pixels. This is the radius of
@@ -73,24 +75,28 @@ public:
* represents an area where blurring is unnecessary and shouldn't be done
* for speed reasons. It is safe to pass nullptr here.
*/
gfxContext* Init(const gfxRect& aRect,
const mozilla::gfx::IntSize& aSpreadRadius,
const mozilla::gfx::IntSize& aBlurRadius,
const gfxRect* aDirtyRect,
const gfxRect* aSkipRect);
already_AddRefed<gfxContext>
Init(gfxContext* aDestinationCtx,
const gfxRect& aRect,
const mozilla::gfx::IntSize& aSpreadRadius,
const mozilla::gfx::IntSize& aBlurRadius,
const gfxRect* aDirtyRect,
const gfxRect* aSkipRect);
already_AddRefed<DrawTarget>
InitDrawTarget(const mozilla::gfx::DrawTarget* aReferenceDT,
const mozilla::gfx::Rect& aRect,
const mozilla::gfx::IntSize& aSpreadRadius,
const mozilla::gfx::IntSize& aBlurRadius,
const mozilla::gfx::Rect* aDirtyRect = nullptr,
const mozilla::gfx::Rect* aSkipRect = nullptr);
/**
* Returns the context that should be drawn to supply the alpha mask to be
* blurred. If the returned surface is null, then there was an error in
* its creation.
* Performs the blur and optionally colors the result if aShadowColor is not null.
*/
gfxContext* GetContext()
{
return mContext;
}
already_AddRefed<mozilla::gfx::SourceSurface>
DoBlur(DrawTarget* aDT, mozilla::gfx::IntPoint* aTopLeft);
DoBlur(const mozilla::gfx::Color* aShadowColor = nullptr,
mozilla::gfx::IntPoint* aOutTopLeft = nullptr);
/**
* Does the actual blurring/spreading and mask applying. Users of this
@@ -129,7 +135,7 @@ public:
*/
static void BlurRectangle(gfxContext *aDestinationCtx,
const gfxRect& aRect,
RectCornerRadii* aCornerRadii,
const RectCornerRadii* aCornerRadii,
const gfxPoint& aBlurStdDev,
const Color& aShadowColor,
const gfxRect& aDirtyRect,
@@ -154,41 +160,45 @@ public:
* @param aSKipRect An area in device pixels we don't have to paint in.
*/
void BlurInsetBox(gfxContext* aDestinationCtx,
const mozilla::gfx::Rect aDestinationRect,
const mozilla::gfx::Rect aShadowClipRect,
const mozilla::gfx::IntSize aBlurRadius,
const mozilla::gfx::IntSize aSpreadRadius,
const mozilla::gfx::Rect& aDestinationRect,
const mozilla::gfx::Rect& aShadowClipRect,
const mozilla::gfx::IntSize& aBlurRadius,
const mozilla::gfx::Color& aShadowColor,
const bool aHasBorderRadius,
const RectCornerRadii& aInnerClipRadii,
const mozilla::gfx::Rect aSkipRect,
const mozilla::gfx::Point aShadowOffset);
const RectCornerRadii* aInnerClipRadii,
const mozilla::gfx::Rect& aSkipRect,
const mozilla::gfx::Point& aShadowOffset);
protected:
already_AddRefed<mozilla::gfx::SourceSurface>
GetInsetBlur(const mozilla::gfx::Rect aOuterRect,
const mozilla::gfx::Rect aWhitespaceRect,
const bool aIsDestRect,
GetInsetBlur(const mozilla::gfx::Rect& aOuterRect,
const mozilla::gfx::Rect& aWhitespaceRect,
bool aIsDestRect,
const mozilla::gfx::Color& aShadowColor,
const mozilla::gfx::IntSize& aBlurRadius,
const bool aHasBorderRadius,
const RectCornerRadii& aInnerClipRadii,
DrawTarget* aDestDrawTarget);
const RectCornerRadii* aInnerClipRadii,
DrawTarget* aDestDrawTarget,
bool aMirrorCorners);
/**
* The context of the temporary alpha surface.
* The DrawTarget of the temporary alpha surface.
*/
RefPtr<gfxContext> mContext;
RefPtr<DrawTarget> mDrawTarget;
/**
* The temporary alpha surface.
*/
mozilla::UniquePtr<unsigned char[]> mData;
uint8_t* mData;
/**
* The object that actually does the blurring for us.
*/
mozilla::UniquePtr<mozilla::gfx::AlphaBoxBlur> mBlur;
mozilla::gfx::AlphaBoxBlur mBlur;
/**
* Indicates using DrawTarget-accelerated blurs.
*/
bool mAccelerated;
};
#endif /* GFX_BLUR_H */
+10 -1
View File
@@ -1304,7 +1304,12 @@ gfxPlatform::CreateSimilarSoftwareDrawTarget(DrawTarget* aDT,
if (Factory::DoesBackendSupportDataDrawtarget(aDT->GetBackendType())) {
dt = aDT->CreateSimilarDrawTarget(aSize, aFormat);
} else {
dt = Factory::CreateDrawTarget(BackendType::SKIA, aSize, aFormat);
#ifdef USE_SKIA
BackendType backendType = BackendType::SKIA;
#else
BackendType backendType = BackendType::CAIRO;
#endif
dt = Factory::CreateDrawTarget(backendType, aSize, aFormat);
}
return dt.forget();
@@ -1317,7 +1322,11 @@ gfxPlatform::CreateDrawTargetForData(unsigned char* aData, const IntSize& aSize,
NS_ASSERTION(backendType != BackendType::NONE, "No backend.");
if (!Factory::DoesBackendSupportDataDrawtarget(backendType)) {
#ifdef USE_SKIA
backendType = BackendType::SKIA;
#else
backendType = BackendType::CAIRO;
#endif
}
RefPtr<DrawTarget> dt = Factory::CreateDrawTargetForData(backendType,
+8 -5
View File
@@ -692,7 +692,7 @@ gfxUtils::ClipToRegion(DrawTarget* aTarget, const nsIntRegion& aRegion)
}
/*static*/ gfxFloat
gfxUtils::ClampToScaleFactor(gfxFloat aVal)
gfxUtils::ClampToScaleFactor(gfxFloat aVal, bool aRoundDown)
{
// Arbitary scale factor limitation. We can increase this
// for better scaling performance at the cost of worse
@@ -713,14 +713,17 @@ gfxUtils::ClampToScaleFactor(gfxFloat aVal)
gfxFloat power = log(aVal)/log(kScaleResolution);
// If power is within 1e-5 of an integer, round to nearest to
// prevent floating point errors, otherwise round up to the
// next integer value.
if (fabs(power - NS_round(power)) < 1e-5) {
// If power is within 1e-5 of an integer, round to nearest to
// prevent floating point errors.
power = NS_round(power);
} else if (inverse) {
} else if (inverse != aRoundDown) {
// Use floor when we are either inverted or rounding down, but
// not both.
power = floor(power);
} else {
// Otherwise, ceil when we are not inverted and not rounding
// down, or we are inverted and rounding down.
power = ceil(power);
}
+3 -2
View File
@@ -128,9 +128,10 @@ public:
/**
* Return the smallest power of kScaleResolution (2) greater than or equal to
* aVal.
* aVal. If aRoundDown is specified, the power of 2 will be less than
* or equal to aVal.
*/
static gfxFloat ClampToScaleFactor(gfxFloat aVal);
static gfxFloat ClampToScaleFactor(gfxFloat aVal, bool aRoundDown = false);
/**
* Clears surface to aColor (which defaults to transparent black).
+3 -3
View File
@@ -333,7 +333,7 @@ void NotifyScreenConfigurationChange(const hal::ScreenConfiguration& aScreenConf
* Lock the screen orientation to the specific orientation.
* @return Whether the lock has been accepted.
*/
MOZ_MUST_USE bool LockScreenOrientation(const dom::ScreenOrientationInternal& aOrientation);
[[nodiscard]] bool LockScreenOrientation(const dom::ScreenOrientationInternal& aOrientation);
/**
* Unlock the screen orientation.
@@ -346,7 +346,7 @@ void UnlockScreenOrientation();
*
* Currently, there can only be 0 or 1 alarm observers.
*/
MOZ_MUST_USE bool RegisterTheOneAlarmObserver(hal::AlarmObserver* aObserver);
[[nodiscard]] bool RegisterTheOneAlarmObserver(hal::AlarmObserver* aObserver);
/**
* Unregister the alarm observer. Doing so will implicitly cancel any
@@ -373,7 +373,7 @@ void NotifyAlarmFired();
* This API is currently only allowed to be used from non-sandboxed
* contexts.
*/
MOZ_MUST_USE bool SetAlarm(int32_t aSeconds, int32_t aNanoseconds);
[[nodiscard]] bool SetAlarm(int32_t aSeconds, int32_t aNanoseconds);
/**
* Set the priority of the given process.
+1 -1
View File
@@ -56,7 +56,7 @@ void DisableScreenConfigurationNotifications();
/**
* Enable alarm notifications from the backend.
*/
MOZ_MUST_USE bool EnableAlarm();
[[nodiscard]] bool EnableAlarm();
/**
* Disable alarm notifications from the backend.
+15 -15
View File
@@ -287,22 +287,22 @@ public:
imgLoader();
nsresult Init();
MOZ_MUST_USE nsresult LoadImage(nsIURI* aURI,
nsIURI* aInitialDocumentURI,
nsIURI* aReferrerURI,
ReferrerPolicy aReferrerPolicy,
nsIPrincipal* aLoadingPrincipal,
nsILoadGroup* aLoadGroup,
imgINotificationObserver* aObserver,
nsINode* aContext,
nsIDocument* aLoadingDocument,
nsLoadFlags aLoadFlags,
nsISupports* aCacheKey,
nsContentPolicyType aContentPolicyType,
const nsAString& initiatorType,
imgRequestProxy** _retval);
[[nodiscard]] nsresult LoadImage(nsIURI* aURI,
nsIURI* aInitialDocumentURI,
nsIURI* aReferrerURI,
ReferrerPolicy aReferrerPolicy,
nsIPrincipal* aLoadingPrincipal,
nsILoadGroup* aLoadGroup,
imgINotificationObserver* aObserver,
nsINode* aContext,
nsIDocument* aLoadingDocument,
nsLoadFlags aLoadFlags,
nsISupports* aCacheKey,
nsContentPolicyType aContentPolicyType,
const nsAString& initiatorType,
imgRequestProxy** _retval);
MOZ_MUST_USE nsresult
[[nodiscard]] nsresult
LoadImageWithChannel(nsIChannel* channel,
imgINotificationObserver* aObserver,
nsISupports* aCX,
+10 -10
View File
@@ -65,16 +65,16 @@ public:
NS_DECL_NSIINTERFACEREQUESTOR
NS_DECL_NSIASYNCVERIFYREDIRECTCALLBACK
MOZ_MUST_USE nsresult Init(nsIURI* aURI,
nsIURI* aCurrentURI,
bool aHadInsecureRedirect,
nsIRequest* aRequest,
nsIChannel* aChannel,
imgCacheEntry* aCacheEntry,
nsISupports* aCX,
nsIPrincipal* aLoadingPrincipal,
int32_t aCORSMode,
ReferrerPolicy aReferrerPolicy);
[[nodiscard]] nsresult Init(nsIURI* aURI,
nsIURI* aCurrentURI,
bool aHadInsecureRedirect,
nsIRequest* aRequest,
nsIChannel* aChannel,
imgCacheEntry* aCacheEntry,
nsISupports* aCX,
nsIPrincipal* aLoadingPrincipal,
int32_t aCORSMode,
ReferrerPolicy aReferrerPolicy);
void ClearLoader();
+3 -3
View File
@@ -110,9 +110,9 @@ public:
* NS_ERROR_OUT_OF_MEMORY if OOM
* NS_OK is all we have is an approximation
*/
MOZ_MUST_USE NS_IMETHOD GetMaxLength(const char* aSrc,
int32_t aSrcLength,
int32_t* aDestLength) = 0;
[[nodiscard]] NS_IMETHOD GetMaxLength(const char* aSrc,
int32_t aSrcLength,
int32_t* aDestLength) = 0;
/**
* Resets the charset converter so it may be recycled for a completely
+3 -3
View File
@@ -135,9 +135,9 @@ public:
* NS_ERROR_OUT_OF_MEMORY if OOM
* NS_OK if all we have is an approximation
*/
MOZ_MUST_USE NS_IMETHOD GetMaxLength(const char16_t* aSrc,
int32_t aSrcLength,
int32_t* aDestLength) = 0;
[[nodiscard]] NS_IMETHOD GetMaxLength(const char16_t* aSrc,
int32_t aSrcLength,
int32_t* aDestLength) = 0;
/**
* Resets the charset converter so it may be recycled for a completely
+3 -3
View File
@@ -24,9 +24,9 @@ public:
char16_t* aDest,
int32_t* aDestLength) override;
MOZ_MUST_USE NS_IMETHOD GetMaxLength(const char* aSrc,
int32_t aSrcLength,
int32_t* aDestLength) override;
[[nodiscard]] NS_IMETHOD GetMaxLength(const char* aSrc,
int32_t aSrcLength,
int32_t* aDestLength) override;
NS_IMETHOD Reset() override;
+3 -3
View File
@@ -49,9 +49,9 @@ protected:
//--------------------------------------------------------------------
// Subclassing of nsDecoderSupport class [declaration]
MOZ_MUST_USE NS_IMETHOD GetMaxLength(const char* aSrc,
int32_t aSrcLength,
int32_t* aDestLength) override;
[[nodiscard]] NS_IMETHOD GetMaxLength(const char* aSrc,
int32_t aSrcLength,
int32_t* aDestLength) override;
//--------------------------------------------------------------------
// Subclassing of nsBasicDecoderSupport class [declaration]
+3 -3
View File
@@ -48,9 +48,9 @@ public:
NS_IMETHOD Finish(char* aDest, int32_t* aDestLength) override;
MOZ_MUST_USE NS_IMETHOD GetMaxLength(const char16_t* aSrc,
int32_t aSrcLength,
int32_t* aDestLength) override;
[[nodiscard]] NS_IMETHOD GetMaxLength(const char16_t* aSrc,
int32_t aSrcLength,
int32_t* aDestLength) override;
NS_IMETHOD Reset() override {mHighSurrogate = 0; return NS_OK;}
+3 -3
View File
@@ -24,9 +24,9 @@ public:
//--------------------------------------------------------------------
// Subclassing of nsDecoderSupport class [declaration]
MOZ_MUST_USE NS_IMETHOD GetMaxLength(const char* aSrc,
int32_t aSrcLength,
int32_t* aDestLength) override;
[[nodiscard]] NS_IMETHOD GetMaxLength(const char* aSrc,
int32_t aSrcLength,
int32_t* aDestLength) override;
NS_IMETHOD Reset() override;
protected:
+3 -3
View File
@@ -19,9 +19,9 @@ public:
NS_IMETHOD Convert(const char16_t* aSrc, int32_t* aSrcLength,
char* aDest, int32_t* aDestLength);
MOZ_MUST_USE NS_IMETHOD GetMaxLength(const char16_t* aSrc,
int32_t aSrcLength,
int32_t* aDestLength);
[[nodiscard]] NS_IMETHOD GetMaxLength(const char16_t* aSrc,
int32_t aSrcLength,
int32_t* aDestLength);
NS_IMETHOD Finish(char* aDest, int32_t* aDestLength);
NS_IMETHOD Reset();
NS_IMETHOD SetOutputErrorBehavior(int32_t aBehavior,
+3 -3
View File
@@ -29,9 +29,9 @@ public:
NS_IMETHOD Finish(char* aDest,
int32_t* aDestLength) override;
MOZ_MUST_USE NS_IMETHOD GetMaxLength(const char16_t* aSrc,
int32_t aSrcLength,
int32_t* aDestLength) override;
[[nodiscard]] NS_IMETHOD GetMaxLength(const char16_t* aSrc,
int32_t aSrcLength,
int32_t* aDestLength) override;
NS_IMETHOD Reset() override;
+23 -22
View File
@@ -1,5 +1,6 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
// Copyright (c) 2023, Moonchild Productions.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -92,32 +93,32 @@ class Pickle {
// the Pickle, initialize *iter to NULL. If successful, these methods return
// true. Otherwise, false is returned to indicate that the result could not
// be extracted.
MOZ_MUST_USE bool ReadBool(PickleIterator* iter, bool* result) const;
MOZ_MUST_USE bool ReadInt16(PickleIterator* iter, int16_t* result) const;
MOZ_MUST_USE bool ReadUInt16(PickleIterator* iter, uint16_t* result) const;
MOZ_MUST_USE bool ReadShort(PickleIterator* iter, short* result) const;
MOZ_MUST_USE bool ReadInt(PickleIterator* iter, int* result) const;
MOZ_MUST_USE bool ReadLong(PickleIterator* iter, long* result) const;
MOZ_MUST_USE bool ReadULong(PickleIterator* iter, unsigned long* result) const;
MOZ_MUST_USE bool ReadSize(PickleIterator* iter, size_t* result) const;
MOZ_MUST_USE bool ReadInt32(PickleIterator* iter, int32_t* result) const;
MOZ_MUST_USE bool ReadUInt32(PickleIterator* iter, uint32_t* result) const;
MOZ_MUST_USE bool ReadInt64(PickleIterator* iter, int64_t* result) const;
MOZ_MUST_USE bool ReadUInt64(PickleIterator* iter, uint64_t* result) const;
MOZ_MUST_USE bool ReadDouble(PickleIterator* iter, double* result) const;
MOZ_MUST_USE bool ReadIntPtr(PickleIterator* iter, intptr_t* result) const;
MOZ_MUST_USE bool ReadUnsignedChar(PickleIterator* iter, unsigned char* result) const;
MOZ_MUST_USE bool ReadString(PickleIterator* iter, std::string* result) const;
MOZ_MUST_USE bool ReadWString(PickleIterator* iter, std::wstring* result) const;
MOZ_MUST_USE bool ReadBytesInto(PickleIterator* iter, void* data, uint32_t length) const;
MOZ_MUST_USE bool ExtractBuffers(PickleIterator* iter, size_t length, BufferList* buffers,
uint32_t alignment = sizeof(memberAlignmentType)) const;
[[nodiscard]] bool ReadBool(PickleIterator* iter, bool* result) const;
[[nodiscard]] bool ReadInt16(PickleIterator* iter, int16_t* result) const;
[[nodiscard]] bool ReadUInt16(PickleIterator* iter, uint16_t* result) const;
[[nodiscard]] bool ReadShort(PickleIterator* iter, short* result) const;
[[nodiscard]] bool ReadInt(PickleIterator* iter, int* result) const;
[[nodiscard]] bool ReadLong(PickleIterator* iter, long* result) const;
[[nodiscard]] bool ReadULong(PickleIterator* iter, unsigned long* result) const;
[[nodiscard]] bool ReadSize(PickleIterator* iter, size_t* result) const;
[[nodiscard]] bool ReadInt32(PickleIterator* iter, int32_t* result) const;
[[nodiscard]] bool ReadUInt32(PickleIterator* iter, uint32_t* result) const;
[[nodiscard]] bool ReadInt64(PickleIterator* iter, int64_t* result) const;
[[nodiscard]] bool ReadUInt64(PickleIterator* iter, uint64_t* result) const;
[[nodiscard]] bool ReadDouble(PickleIterator* iter, double* result) const;
[[nodiscard]] bool ReadIntPtr(PickleIterator* iter, intptr_t* result) const;
[[nodiscard]] bool ReadUnsignedChar(PickleIterator* iter, unsigned char* result) const;
[[nodiscard]] bool ReadString(PickleIterator* iter, std::string* result) const;
[[nodiscard]] bool ReadWString(PickleIterator* iter, std::wstring* result) const;
[[nodiscard]] bool ReadBytesInto(PickleIterator* iter, void* data, uint32_t length) const;
[[nodiscard]] bool ExtractBuffers(PickleIterator* iter, size_t length, BufferList* buffers,
uint32_t alignment = sizeof(memberAlignmentType)) const;
// Safer version of ReadInt() checks for the result not being negative.
// Use it for reading the object sizes.
MOZ_MUST_USE bool ReadLength(PickleIterator* iter, int* result) const;
[[nodiscard]] bool ReadLength(PickleIterator* iter, int* result) const;
MOZ_MUST_USE bool ReadSentinel(PickleIterator* iter, uint32_t sentinel) const
[[nodiscard]] bool ReadSentinel(PickleIterator* iter, uint32_t sentinel) const
#ifdef MOZ_PICKLE_SENTINEL_CHECKING
;
#else
+1 -1
View File
@@ -185,7 +185,7 @@ class CxxCodeGen(CodePrinter, Visitor):
self.printdent()
if md.warn_unused:
self.write('MOZ_MUST_USE ')
self.write('[[nodiscard]] ')
if md.inline:
self.write('inline ')
if md.never_inline:
+1 -1
View File
@@ -37,7 +37,7 @@ public:
return mPtr.get();
}
MOZ_MUST_USE Interface* Release()
[[nodiscard]] Interface* Release()
{
return mPtr.release();
}
+16 -16
View File
@@ -88,7 +88,7 @@ class HashMap
// HashMap construction is fallible (due to OOM); thus the user must call
// init after constructing a HashMap and check the return value.
explicit HashMap(AllocPolicy a = AllocPolicy()) : impl(a) {}
MOZ_MUST_USE bool init(uint32_t len = 16) { return impl.init(len); }
[[nodiscard]] bool init(uint32_t len = 16) { return impl.init(len); }
bool initialized() const { return impl.initialized(); }
// Return whether the given lookup value is present in the map. E.g.:
@@ -151,19 +151,19 @@ class HashMap
}
template<typename KeyInput, typename ValueInput>
MOZ_MUST_USE bool add(AddPtr& p, KeyInput&& k, ValueInput&& v) {
[[nodiscard]] bool add(AddPtr& p, KeyInput&& k, ValueInput&& v) {
return impl.add(p,
mozilla::Forward<KeyInput>(k),
mozilla::Forward<ValueInput>(v));
}
template<typename KeyInput>
MOZ_MUST_USE bool add(AddPtr& p, KeyInput&& k) {
[[nodiscard]] bool add(AddPtr& p, KeyInput&& k) {
return impl.add(p, mozilla::Forward<KeyInput>(k), Value());
}
template<typename KeyInput, typename ValueInput>
MOZ_MUST_USE bool relookupOrAdd(AddPtr& p, KeyInput&& k, ValueInput&& v) {
[[nodiscard]] bool relookupOrAdd(AddPtr& p, KeyInput&& k, ValueInput&& v) {
return impl.relookupOrAdd(p, k,
mozilla::Forward<KeyInput>(k),
mozilla::Forward<ValueInput>(v));
@@ -232,7 +232,7 @@ class HashMap
// Overwrite existing value with v. Return false on oom.
template<typename KeyInput, typename ValueInput>
MOZ_MUST_USE bool put(KeyInput&& k, ValueInput&& v) {
[[nodiscard]] bool put(KeyInput&& k, ValueInput&& v) {
AddPtr p = lookupForAdd(k);
if (p) {
p->value() = mozilla::Forward<ValueInput>(v);
@@ -243,7 +243,7 @@ class HashMap
// Like put, but assert that the given key is not already present.
template<typename KeyInput, typename ValueInput>
MOZ_MUST_USE bool putNew(KeyInput&& k, ValueInput&& v) {
[[nodiscard]] bool putNew(KeyInput&& k, ValueInput&& v) {
return impl.putNew(k, mozilla::Forward<KeyInput>(k), mozilla::Forward<ValueInput>(v));
}
@@ -341,7 +341,7 @@ class HashSet
// HashSet construction is fallible (due to OOM); thus the user must call
// init after constructing a HashSet and check the return value.
explicit HashSet(AllocPolicy a = AllocPolicy()) : impl(a) {}
MOZ_MUST_USE bool init(uint32_t len = 16) { return impl.init(len); }
[[nodiscard]] bool init(uint32_t len = 16) { return impl.init(len); }
bool initialized() const { return impl.initialized(); }
// Return whether the given lookup value is present in the map. E.g.:
@@ -399,12 +399,12 @@ class HashSet
AddPtr lookupForAdd(const Lookup& l) const { return impl.lookupForAdd(l); }
template <typename U>
MOZ_MUST_USE bool add(AddPtr& p, U&& u) {
[[nodiscard]] bool add(AddPtr& p, U&& u) {
return impl.add(p, mozilla::Forward<U>(u));
}
template <typename U>
MOZ_MUST_USE bool relookupOrAdd(AddPtr& p, const Lookup& l, U&& u) {
[[nodiscard]] bool relookupOrAdd(AddPtr& p, const Lookup& l, U&& u) {
return impl.relookupOrAdd(p, l, mozilla::Forward<U>(u));
}
@@ -471,19 +471,19 @@ class HashSet
// Add |u| if it is not present already. Return false on oom.
template <typename U>
MOZ_MUST_USE bool put(U&& u) {
[[nodiscard]] bool put(U&& u) {
AddPtr p = lookupForAdd(u);
return p ? true : add(p, mozilla::Forward<U>(u));
}
// Like put, but assert that the given key is not already present.
template <typename U>
MOZ_MUST_USE bool putNew(U&& u) {
[[nodiscard]] bool putNew(U&& u) {
return impl.putNew(u, mozilla::Forward<U>(u));
}
template <typename U>
MOZ_MUST_USE bool putNew(const Lookup& l, U&& u) {
[[nodiscard]] bool putNew(const Lookup& l, U&& u) {
return impl.putNew(l, mozilla::Forward<U>(u));
}
@@ -1277,7 +1277,7 @@ class HashTable : private AllocPolicy
#endif
{}
MOZ_MUST_USE bool init(uint32_t length)
[[nodiscard]] bool init(uint32_t length)
{
MOZ_ASSERT(!initialized());
@@ -1775,7 +1775,7 @@ class HashTable : private AllocPolicy
}
template <typename... Args>
MOZ_MUST_USE bool add(AddPtr& p, Args&&... args)
[[nodiscard]] bool add(AddPtr& p, Args&&... args)
{
mozilla::ReentrancyGuard g(*this);
MOZ_ASSERT(table);
@@ -1828,7 +1828,7 @@ class HashTable : private AllocPolicy
// Note: |l| may be alias arguments in |args|, so this function must take
// care not to use |l| after moving |args|.
template <typename... Args>
MOZ_MUST_USE bool putNew(const Lookup& l, Args&&... args)
[[nodiscard]] bool putNew(const Lookup& l, Args&&... args)
{
if (!this->checkSimulatedOOM())
return false;
@@ -1846,7 +1846,7 @@ class HashTable : private AllocPolicy
// Note: |l| may be a reference to a piece of |u|, so this function
// must take care not to use |l| after moving |u|.
template <typename... Args>
MOZ_MUST_USE bool relookupOrAdd(AddPtr& p, const Lookup& l, Args&&... args)
[[nodiscard]] bool relookupOrAdd(AddPtr& p, const Lookup& l, Args&&... args)
{
// Check for error from ensureHash() here.
if (p.isValid())
+1 -1
View File
@@ -1274,7 +1274,7 @@ class MutableWrappedPtrOperations<UniquePtr<T, D>, Container>
UniquePtr<T, D>& uniquePtr() { return static_cast<Container*>(this)->get(); }
public:
MOZ_MUST_USE typename UniquePtr<T, D>::Pointer release() { return uniquePtr().release(); }
[[nodiscard]] typename UniquePtr<T, D>::Pointer release() { return uniquePtr().release(); }
void reset(T* ptr = T()) { uniquePtr().reset(ptr); }
};
+11 -11
View File
@@ -285,7 +285,7 @@ class BaseStackFrame {
// simplifies the principals check into the boolean isSystem() state. This
// is fine because we only expose JS::ubi::Stack to devtools and chrome
// code, and not to the web platform.
virtual MOZ_MUST_USE bool constructSavedFrameStack(JSContext* cx,
[[nodiscard]] virtual bool constructSavedFrameStack(JSContext* cx,
MutableHandleObject outSavedFrameStack)
const = 0;
@@ -416,7 +416,7 @@ class StackFrame {
StackFrame parent() const { return base()->parent(); }
bool isSystem() const { return base()->isSystem(); }
bool isSelfHosted(JSContext* cx) const { return base()->isSelfHosted(cx); }
MOZ_MUST_USE bool constructSavedFrameStack(JSContext* cx,
[[nodiscard]] bool constructSavedFrameStack(JSContext* cx,
MutableHandleObject outSavedFrameStack) const {
return base()->constructSavedFrameStack(cx, outSavedFrameStack);
}
@@ -449,7 +449,7 @@ class ConcreteStackFrame<void> : public BaseStackFrame {
uint64_t identifier() const override { return 0; }
void trace(JSTracer* trc) override { }
MOZ_MUST_USE bool constructSavedFrameStack(JSContext* cx, MutableHandleObject out)
[[nodiscard]] bool constructSavedFrameStack(JSContext* cx, MutableHandleObject out)
const override
{
out.set(nullptr);
@@ -465,7 +465,7 @@ class ConcreteStackFrame<void> : public BaseStackFrame {
bool isSelfHosted(JSContext* cx) const override { MOZ_CRASH("null JS::ubi::StackFrame"); }
};
MOZ_MUST_USE JS_PUBLIC_API(bool)
[[nodiscard]] JS_PUBLIC_API(bool)
ConstructSavedFrameStackSlow(JSContext* cx,
JS::ubi::StackFrame& frame,
MutableHandleObject outSavedFrameStack);
@@ -628,7 +628,7 @@ class JS_PUBLIC_API(Base) {
// Otherwise, place nullptr in the out parameter. Caller maintains ownership
// of the out parameter. True is returned on success, false is returned on
// OOM.
virtual MOZ_MUST_USE bool jsObjectConstructorName(JSContext* cx, UniqueTwoByteChars& outName)
[[nodiscard]] virtual bool jsObjectConstructorName(JSContext* cx, UniqueTwoByteChars& outName)
const
{
outName.reset(nullptr);
@@ -778,7 +778,7 @@ class Node {
JS::Zone* zone() const { return base()->zone(); }
JSCompartment* compartment() const { return base()->compartment(); }
const char* jsObjectClassName() const { return base()->jsObjectClassName(); }
MOZ_MUST_USE bool jsObjectConstructorName(JSContext* cx, UniqueTwoByteChars& outName) const {
[[nodiscard]] bool jsObjectConstructorName(JSContext* cx, UniqueTwoByteChars& outName) const {
return base()->jsObjectConstructorName(cx, outName);
}
@@ -981,12 +981,12 @@ class MOZ_STACK_CLASS JS_PUBLIC_API(RootList) {
RootList(JSContext* cx, Maybe<AutoCheckCannotGC>& noGC, bool wantNames = false);
// Find all GC roots.
MOZ_MUST_USE bool init();
[[nodiscard]] bool init();
// Find only GC roots in the provided set of |JSCompartment|s.
MOZ_MUST_USE bool init(CompartmentSet& debuggees);
[[nodiscard]] bool init(CompartmentSet& debuggees);
// Find only GC roots in the given Debugger object's set of debuggee
// compartments.
MOZ_MUST_USE bool init(HandleObject debuggees);
[[nodiscard]] bool init(HandleObject debuggees);
// Returns true if the RootList has been initialized successfully, false
// otherwise.
@@ -995,7 +995,7 @@ class MOZ_STACK_CLASS JS_PUBLIC_API(RootList) {
// Explicitly add the given Node as a root in this RootList. If wantNames is
// true, you must pass an edgeName. The RootList does not take ownership of
// edgeName.
MOZ_MUST_USE bool addRoot(Node node, const char16_t* edgeName = nullptr);
[[nodiscard]] bool addRoot(Node node, const char16_t* edgeName = nullptr);
};
@@ -1100,7 +1100,7 @@ class JS_PUBLIC_API(Concrete<JSObject>) : public TracerConcreteWithCompartment<J
}
const char* jsObjectClassName() const override;
MOZ_MUST_USE bool jsObjectConstructorName(JSContext* cx, UniqueTwoByteChars& outName)
[[nodiscard]] bool jsObjectConstructorName(JSContext* cx, UniqueTwoByteChars& outName)
const override;
Size size(mozilla::MallocSizeOf mallocSizeOf) const override;
+11 -11
View File
@@ -104,14 +104,14 @@ struct CountType {
// Implement the 'count' method for counts returned by this CountType
// instance's 'newCount' method.
virtual MOZ_MUST_USE bool count(CountBase& count,
mozilla::MallocSizeOf mallocSizeOf,
const Node& node) = 0;
[[nodiscard]] virtual bool count(CountBase& count,
mozilla::MallocSizeOf mallocSizeOf,
const Node& node) = 0;
// Implement the 'report' method for counts returned by this CountType
// instance's 'newCount' method.
virtual MOZ_MUST_USE bool report(JSContext* cx, CountBase& count,
MutableHandleValue report) = 0;
[[nodiscard]] virtual bool report(JSContext* cx, CountBase& count,
MutableHandleValue report) = 0;
};
using CountTypePtr = js::UniquePtr<CountType>;
@@ -135,7 +135,7 @@ class CountBase {
{ }
// Categorize and count |node| as appropriate for this count's type.
MOZ_MUST_USE bool count(mozilla::MallocSizeOf mallocSizeOf, const Node& node) {
[[nodiscard]] bool count(mozilla::MallocSizeOf mallocSizeOf, const Node& node) {
total_++;
auto id = node.identifier();
@@ -158,7 +158,7 @@ class CountBase {
// Construct a JavaScript object reporting the counts recorded in this
// count, and store it in |report|. Return true on success, or false on
// failure.
MOZ_MUST_USE bool report(JSContext* cx, MutableHandleValue report) {
[[nodiscard]] bool report(JSContext* cx, MutableHandleValue report) {
return type.report(cx, *this, report);
}
@@ -202,7 +202,7 @@ struct Census {
explicit Census(JSContext* cx) : cx(cx), atomsZone(nullptr) { }
MOZ_MUST_USE JS_PUBLIC_API(bool) init();
[[nodiscard]] JS_PUBLIC_API(bool) init();
};
// A BreadthFirst handler type that conducts a census, using a CountBase to
@@ -219,14 +219,14 @@ class CensusHandler {
mallocSizeOf(mallocSizeOf)
{ }
MOZ_MUST_USE bool report(JSContext* cx, MutableHandleValue report) {
[[nodiscard]] bool report(JSContext* cx, MutableHandleValue report) {
return rootCount->report(cx, report);
}
// This class needs to retain no per-node data.
class NodeData { };
MOZ_MUST_USE JS_PUBLIC_API(bool) operator() (BreadthFirst<CensusHandler>& traversal,
[[nodiscard]] JS_PUBLIC_API(bool) operator() (BreadthFirst<CensusHandler>& traversal,
Node origin, const Edge& edge,
NodeData* referentData, bool first);
};
@@ -235,7 +235,7 @@ using CensusTraversal = BreadthFirst<CensusHandler>;
// Examine the census options supplied by the API consumer, and (among other
// things) use that to build a CountType tree.
MOZ_MUST_USE JS_PUBLIC_API(bool) ParseCensusOptions(JSContext* cx,
[[nodiscard]] JS_PUBLIC_API(bool) ParseCensusOptions(JSContext* cx,
Census& census, HandleObject options,
CountTypePtr& outResult);
+9 -9
View File
@@ -322,9 +322,9 @@ class DominatorTree
// Do the post order traversal of the heap graph and populate our
// predecessor sets.
static MOZ_MUST_USE bool doTraversal(JSContext* cx, AutoCheckCannotGC& noGC, const Node& root,
JS::ubi::Vector<Node>& postOrder,
PredecessorSets& predecessorSets) {
[[nodiscard]] static bool doTraversal(JSContext* cx, AutoCheckCannotGC& noGC, const Node& root,
JS::ubi::Vector<Node>& postOrder,
PredecessorSets& predecessorSets) {
uint32_t nodeCount = 0;
auto onNode = [&](const Node& node) {
nodeCount++;
@@ -356,8 +356,8 @@ class DominatorTree
// Populates the given `map` with an entry for each node to its index in
// `postOrder`.
static MOZ_MUST_USE bool mapNodesToTheirIndices(JS::ubi::Vector<Node>& postOrder,
NodeToIndexMap& map) {
[[nodiscard]] static bool mapNodesToTheirIndices(JS::ubi::Vector<Node>& postOrder,
NodeToIndexMap& map) {
MOZ_ASSERT(!map.initialized());
MOZ_ASSERT(postOrder.length() < UINT32_MAX);
uint32_t length = postOrder.length();
@@ -370,7 +370,7 @@ class DominatorTree
// Convert the Node -> NodeSet predecessorSets to a index -> Vector<index>
// form.
static MOZ_MUST_USE bool convertPredecessorSetsToVectors(
[[nodiscard]] static bool convertPredecessorSetsToVectors(
const Node& root,
JS::ubi::Vector<Node>& postOrder,
PredecessorSets& predecessorSets,
@@ -409,7 +409,7 @@ class DominatorTree
// Initialize `doms` such that the immediate dominator of the `root` is the
// `root` itself and all others are `UNDEFINED`.
static MOZ_MUST_USE bool initializeDominators(JS::ubi::Vector<uint32_t>& doms,
[[nodiscard]] static bool initializeDominators(JS::ubi::Vector<uint32_t>& doms,
uint32_t length) {
MOZ_ASSERT(doms.length() == 0);
if (!doms.growByUninitialized(length))
@@ -426,7 +426,7 @@ class DominatorTree
MOZ_ASSERT_IF(retainedSizes.isSome(), postOrder.length() == retainedSizes->length());
}
MOZ_MUST_USE bool computeRetainedSizes(mozilla::MallocSizeOf mallocSizeOf) {
[[nodiscard]] bool computeRetainedSizes(mozilla::MallocSizeOf mallocSizeOf) {
MOZ_ASSERT(retainedSizes.isNothing());
auto length = postOrder.length();
@@ -651,7 +651,7 @@ class DominatorTree
* `outSize`, or 0 if `node` is not a member of the dominator tree. Returns
* false on OOM failure, leaving `outSize` unchanged.
*/
MOZ_MUST_USE bool getRetainedSize(const Node& node, mozilla::MallocSizeOf mallocSizeOf,
[[nodiscard]] bool getRetainedSize(const Node& node, mozilla::MallocSizeOf mallocSizeOf,
Node::Size& outSize) {
assertSanity();
auto ptr = nodeToPostOrderIndex.lookup(node);
+5 -5
View File
@@ -90,7 +90,7 @@ struct PostOrder {
#endif
private:
MOZ_MUST_USE bool fillEdgesFromRange(EdgeVector& edges, js::UniquePtr<EdgeRange>& range) {
[[nodiscard]] bool fillEdgesFromRange(EdgeVector& edges, js::UniquePtr<EdgeRange>& range) {
MOZ_ASSERT(range);
for ( ; !range->empty(); range->popFront()) {
if (!edges.append(mozilla::Move(range->front())))
@@ -99,7 +99,7 @@ struct PostOrder {
return true;
}
MOZ_MUST_USE bool pushForTraversing(const Node& node) {
[[nodiscard]] bool pushForTraversing(const Node& node) {
EdgeVector edges;
auto range = node.edges(cx, /* wantNames */ false);
return range &&
@@ -124,11 +124,11 @@ struct PostOrder {
{ }
// Initialize this traversal object. Return false on OOM.
MOZ_MUST_USE bool init() { return seen.init(); }
[[nodiscard]] bool init() { return seen.init(); }
// Add `node` as a starting point for the traversal. You may add
// as many starting points as you like. Returns false on OOM.
MOZ_MUST_USE bool addStart(const Node& node) {
[[nodiscard]] bool addStart(const Node& node) {
if (!seen.put(node))
return false;
return pushForTraversing(node);
@@ -144,7 +144,7 @@ struct PostOrder {
// Return false on OOM or error return from `onNode::operator()` or
// `onEdge::operator()`.
template<typename NodeVisitor, typename EdgeVisitor>
MOZ_MUST_USE bool traverse(NodeVisitor onNode, EdgeVisitor onEdge) {
[[nodiscard]] bool traverse(NodeVisitor onNode, EdgeVisitor onEdge) {
#ifdef DEBUG
MOZ_ASSERT(!traversed, "Can only traverse() once!");
traversed = true;
+2 -2
View File
@@ -32,7 +32,7 @@ struct JS_PUBLIC_API(BackEdge)
BackEdge() : predecessor_(), name_(nullptr) { }
MOZ_MUST_USE bool init(const Node& predecessor, Edge& edge) {
[[nodiscard]] bool init(const Node& predecessor, Edge& edge) {
MOZ_ASSERT(!predecessor_);
MOZ_ASSERT(!name_);
@@ -289,7 +289,7 @@ struct JS_PUBLIC_API(ShortestPaths)
* the given target, in which case `func` will not be invoked.
*/
template <class Func>
MOZ_MUST_USE bool forEachPath(const Node& target, Func func) {
[[nodiscard]] bool forEachPath(const Node& target, Func func) {
MOZ_ASSERT(initialized());
MOZ_ASSERT(targets_.has(target));
+2 -2
View File
@@ -352,7 +352,7 @@ namespace js {
* instances of type |T|. Return false if the calculation overflowed.
*/
template <typename T>
MOZ_MUST_USE inline bool
[[nodiscard]] inline bool
CalculateAllocSize(size_t numElems, size_t* bytesOut)
{
*bytesOut = numElems * sizeof(T);
@@ -365,7 +365,7 @@ CalculateAllocSize(size_t numElems, size_t* bytesOut)
* false if the calculation overflowed.
*/
template <typename T, typename Extra>
MOZ_MUST_USE inline bool
[[nodiscard]] inline bool
CalculateAllocSizeWithExtra(size_t numExtra, size_t* bytesOut)
{
*bytesOut = sizeof(T) + numExtra * sizeof(Extra);
+17 -17
View File
@@ -21,21 +21,21 @@ class AtomicsObject : public JSObject
public:
static const Class class_;
static JSObject* initClass(JSContext* cx, Handle<GlobalObject*> global);
static MOZ_MUST_USE bool toString(JSContext* cx, unsigned int argc, Value* vp);
[[nodiscard]] static bool toString(JSContext* cx, unsigned int argc, Value* vp);
};
MOZ_MUST_USE bool atomics_compareExchange(JSContext* cx, unsigned argc, Value* vp);
MOZ_MUST_USE bool atomics_exchange(JSContext* cx, unsigned argc, Value* vp);
MOZ_MUST_USE bool atomics_load(JSContext* cx, unsigned argc, Value* vp);
MOZ_MUST_USE bool atomics_store(JSContext* cx, unsigned argc, Value* vp);
MOZ_MUST_USE bool atomics_add(JSContext* cx, unsigned argc, Value* vp);
MOZ_MUST_USE bool atomics_sub(JSContext* cx, unsigned argc, Value* vp);
MOZ_MUST_USE bool atomics_and(JSContext* cx, unsigned argc, Value* vp);
MOZ_MUST_USE bool atomics_or(JSContext* cx, unsigned argc, Value* vp);
MOZ_MUST_USE bool atomics_xor(JSContext* cx, unsigned argc, Value* vp);
MOZ_MUST_USE bool atomics_isLockFree(JSContext* cx, unsigned argc, Value* vp);
MOZ_MUST_USE bool atomics_wait(JSContext* cx, unsigned argc, Value* vp);
MOZ_MUST_USE bool atomics_notify(JSContext* cx, unsigned argc, Value* vp);
[[nodiscard]] bool atomics_compareExchange(JSContext* cx, unsigned argc, Value* vp);
[[nodiscard]] bool atomics_exchange(JSContext* cx, unsigned argc, Value* vp);
[[nodiscard]] bool atomics_load(JSContext* cx, unsigned argc, Value* vp);
[[nodiscard]] bool atomics_store(JSContext* cx, unsigned argc, Value* vp);
[[nodiscard]] bool atomics_add(JSContext* cx, unsigned argc, Value* vp);
[[nodiscard]] bool atomics_sub(JSContext* cx, unsigned argc, Value* vp);
[[nodiscard]] bool atomics_and(JSContext* cx, unsigned argc, Value* vp);
[[nodiscard]] bool atomics_or(JSContext* cx, unsigned argc, Value* vp);
[[nodiscard]] bool atomics_xor(JSContext* cx, unsigned argc, Value* vp);
[[nodiscard]] bool atomics_isLockFree(JSContext* cx, unsigned argc, Value* vp);
[[nodiscard]] bool atomics_wait(JSContext* cx, unsigned argc, Value* vp);
[[nodiscard]] bool atomics_notify(JSContext* cx, unsigned argc, Value* vp);
/* asm.js callouts */
namespace wasm { class Instance; }
@@ -52,14 +52,14 @@ class FutexRuntime
friend class AutoLockFutexAPI;
public:
static MOZ_MUST_USE bool initialize();
[[nodiscard]] static bool initialize();
static void destroy();
static void lock();
static void unlock();
FutexRuntime();
MOZ_MUST_USE bool initInstance();
[[nodiscard]] bool initInstance();
void destroyInstance();
// Parameters to notify().
@@ -83,8 +83,8 @@ public:
// wait.
//
// wait() will not wake up spuriously.
MOZ_MUST_USE bool wait(JSContext* cx, js::UniqueLock<js::Mutex>& locked,
mozilla::Maybe<mozilla::TimeDuration>& timeout, WaitResult* result);
[[nodiscard]] bool wait(JSContext* cx, js::UniqueLock<js::Mutex>& locked,
mozilla::Maybe<mozilla::TimeDuration>& timeout, WaitResult* result);
// Notify the thread represented by this Runtime.
//
+3 -3
View File
@@ -16,17 +16,17 @@ namespace js {
// JSOP_EVAL which in turn calls DirectEval. Thus, even though IndirectEval is
// the callee function object for *all* calls to eval, it is by construction
// only ever called in the case indirect eval.
extern MOZ_MUST_USE bool
[[nodiscard]] extern bool
IndirectEval(JSContext* cx, unsigned argc, Value* vp);
// Performs a direct eval of |v| (a string containing code, or another value
// that will be vacuously returned), which must correspond to the currently-
// executing stack frame, which must be a script frame.
extern MOZ_MUST_USE bool
[[nodiscard]] extern bool
DirectEval(JSContext* cx, HandleValue v, MutableHandleValue vp);
// Performs a direct eval called from Ion code.
extern MOZ_MUST_USE bool
[[nodiscard]] extern bool
DirectEvalStringFromIon(JSContext* cx,
HandleObject scopeObj, HandleScript callerScript,
HandleValue newTargetValue, HandleString str,
+3 -3
View File
@@ -476,7 +476,7 @@ class js::OrderedHashTableRef : public gc::BufferableRef
};
template <typename ObjectT>
inline static MOZ_MUST_USE bool
[[nodiscard]] inline static bool
WriteBarrierPostImpl(JSRuntime* rt, ObjectT* obj, const Value& keyValue)
{
if (MOZ_LIKELY(!keyValue.isObject()))
@@ -501,13 +501,13 @@ WriteBarrierPostImpl(JSRuntime* rt, ObjectT* obj, const Value& keyValue)
return true;
}
inline static MOZ_MUST_USE bool
[[nodiscard]] inline static bool
WriteBarrierPost(JSRuntime* rt, MapObject* map, const Value& key)
{
return WriteBarrierPostImpl(rt, map, key);
}
inline static MOZ_MUST_USE bool
[[nodiscard]] inline static bool
WriteBarrierPost(JSRuntime* rt, SetObject* set, const Value& key)
{
return WriteBarrierPostImpl(rt, set, key);
+53 -53
View File
@@ -41,7 +41,7 @@ class HashableValue
HashableValue() : value(UndefinedValue()) {}
MOZ_MUST_USE bool setValue(JSContext* cx, HandleValue v);
[[nodiscard]] bool setValue(JSContext* cx, HandleValue v);
HashNumber hash(const mozilla::HashCodeScrambler& hcs) const;
bool operator==(const HashableValue& other) const;
HashableValue mark(JSTracer* trc) const;
@@ -66,7 +66,7 @@ class MutableWrappedPtrOperations<HashableValue, Wrapper>
: public WrappedPtrOperations<HashableValue, Wrapper>
{
public:
MOZ_MUST_USE bool setValue(JSContext* cx, HandleValue v) {
[[nodiscard]] bool setValue(JSContext* cx, HandleValue v) {
return static_cast<Wrapper*>(this)->get().setValue(cx, v);
}
};
@@ -107,26 +107,26 @@ class MapObject : public NativeObject {
enum { NurseryKeysSlot, SlotCount };
static MOZ_MUST_USE bool getKeysAndValuesInterleaved(JSContext* cx, HandleObject obj,
[[nodiscard]] static bool getKeysAndValuesInterleaved(JSContext* cx, HandleObject obj,
JS::MutableHandle<GCVector<JS::Value>> entries);
static MOZ_MUST_USE bool entries(JSContext* cx, unsigned argc, Value* vp);
static MOZ_MUST_USE bool has(JSContext* cx, unsigned argc, Value* vp);
[[nodiscard]] static bool entries(JSContext* cx, unsigned argc, Value* vp);
[[nodiscard]] static bool has(JSContext* cx, unsigned argc, Value* vp);
static MapObject* create(JSContext* cx, HandleObject proto = nullptr);
// Publicly exposed Map calls for JSAPI access (webidl maplike/setlike
// interfaces, etc.)
static uint32_t size(JSContext *cx, HandleObject obj);
static MOZ_MUST_USE bool get(JSContext *cx, HandleObject obj, HandleValue key,
[[nodiscard]] static bool get(JSContext *cx, HandleObject obj, HandleValue key,
MutableHandleValue rval);
static MOZ_MUST_USE bool has(JSContext *cx, HandleObject obj, HandleValue key, bool* rval);
static MOZ_MUST_USE bool delete_(JSContext *cx, HandleObject obj, HandleValue key, bool* rval);
[[nodiscard]] static bool has(JSContext *cx, HandleObject obj, HandleValue key, bool* rval);
[[nodiscard]] static bool delete_(JSContext *cx, HandleObject obj, HandleValue key, bool* rval);
// Set call for public JSAPI exposure. Does not actually return map object
// as stated in spec, expects caller to return a value. for instance, with
// webidl maplike/setlike, should return interface object.
static MOZ_MUST_USE bool set(JSContext *cx, HandleObject obj, HandleValue key, HandleValue val);
static MOZ_MUST_USE bool clear(JSContext *cx, HandleObject obj);
static MOZ_MUST_USE bool iterator(JSContext *cx, IteratorKind kind, HandleObject obj,
[[nodiscard]] static bool set(JSContext *cx, HandleObject obj, HandleValue key, HandleValue val);
[[nodiscard]] static bool clear(JSContext *cx, HandleObject obj);
[[nodiscard]] static bool iterator(JSContext *cx, IteratorKind kind, HandleObject obj,
MutableHandleValue iter);
using UnbarrieredTable = OrderedHashMap<Value, Value, UnbarrieredHashPolicy, RuntimeAllocPolicy>;
@@ -143,29 +143,29 @@ class MapObject : public NativeObject {
static ValueMap& extract(const CallArgs& args);
static void mark(JSTracer* trc, JSObject* obj);
static void finalize(FreeOp* fop, JSObject* obj);
static MOZ_MUST_USE bool construct(JSContext* cx, unsigned argc, Value* vp);
[[nodiscard]] static bool construct(JSContext* cx, unsigned argc, Value* vp);
static bool is(HandleValue v);
static bool is(HandleObject o);
static MOZ_MUST_USE bool iterator_impl(JSContext* cx, const CallArgs& args, IteratorKind kind);
[[nodiscard]] static bool iterator_impl(JSContext* cx, const CallArgs& args, IteratorKind kind);
static MOZ_MUST_USE bool size_impl(JSContext* cx, const CallArgs& args);
static MOZ_MUST_USE bool size(JSContext* cx, unsigned argc, Value* vp);
static MOZ_MUST_USE bool get_impl(JSContext* cx, const CallArgs& args);
static MOZ_MUST_USE bool get(JSContext* cx, unsigned argc, Value* vp);
static MOZ_MUST_USE bool has_impl(JSContext* cx, const CallArgs& args);
static MOZ_MUST_USE bool set_impl(JSContext* cx, const CallArgs& args);
static MOZ_MUST_USE bool set(JSContext* cx, unsigned argc, Value* vp);
static MOZ_MUST_USE bool delete_impl(JSContext* cx, const CallArgs& args);
static MOZ_MUST_USE bool delete_(JSContext* cx, unsigned argc, Value* vp);
static MOZ_MUST_USE bool keys_impl(JSContext* cx, const CallArgs& args);
static MOZ_MUST_USE bool keys(JSContext* cx, unsigned argc, Value* vp);
static MOZ_MUST_USE bool values_impl(JSContext* cx, const CallArgs& args);
static MOZ_MUST_USE bool values(JSContext* cx, unsigned argc, Value* vp);
static MOZ_MUST_USE bool entries_impl(JSContext* cx, const CallArgs& args);
static MOZ_MUST_USE bool clear_impl(JSContext* cx, const CallArgs& args);
static MOZ_MUST_USE bool clear(JSContext* cx, unsigned argc, Value* vp);
[[nodiscard]] static bool size_impl(JSContext* cx, const CallArgs& args);
[[nodiscard]] static bool size(JSContext* cx, unsigned argc, Value* vp);
[[nodiscard]] static bool get_impl(JSContext* cx, const CallArgs& args);
[[nodiscard]] static bool get(JSContext* cx, unsigned argc, Value* vp);
[[nodiscard]] static bool has_impl(JSContext* cx, const CallArgs& args);
[[nodiscard]] static bool set_impl(JSContext* cx, const CallArgs& args);
[[nodiscard]] static bool set(JSContext* cx, unsigned argc, Value* vp);
[[nodiscard]] static bool delete_impl(JSContext* cx, const CallArgs& args);
[[nodiscard]] static bool delete_(JSContext* cx, unsigned argc, Value* vp);
[[nodiscard]] static bool keys_impl(JSContext* cx, const CallArgs& args);
[[nodiscard]] static bool keys(JSContext* cx, unsigned argc, Value* vp);
[[nodiscard]] static bool values_impl(JSContext* cx, const CallArgs& args);
[[nodiscard]] static bool values(JSContext* cx, unsigned argc, Value* vp);
[[nodiscard]] static bool entries_impl(JSContext* cx, const CallArgs& args);
[[nodiscard]] static bool clear_impl(JSContext* cx, const CallArgs& args);
[[nodiscard]] static bool clear(JSContext* cx, unsigned argc, Value* vp);
};
class MapIteratorObject : public NativeObject
@@ -187,7 +187,7 @@ class MapIteratorObject : public NativeObject
MapObject::IteratorKind kind);
static void finalize(FreeOp* fop, JSObject* obj);
static MOZ_MUST_USE bool next(Handle<MapIteratorObject*> mapIterator,
[[nodiscard]] static bool next(Handle<MapIteratorObject*> mapIterator,
HandleArrayObject resultPairObj, JSContext* cx);
static JSObject* createResultPair(JSContext* cx);
@@ -213,21 +213,21 @@ class SetObject : public NativeObject {
enum { NurseryKeysSlot, SlotCount };
static MOZ_MUST_USE bool keys(JSContext *cx, HandleObject obj,
[[nodiscard]] static bool keys(JSContext *cx, HandleObject obj,
JS::MutableHandle<GCVector<JS::Value>> keys);
static MOZ_MUST_USE bool values(JSContext *cx, unsigned argc, Value *vp);
static MOZ_MUST_USE bool add(JSContext *cx, HandleObject obj, HandleValue key);
static MOZ_MUST_USE bool has(JSContext *cx, unsigned argc, Value *vp);
[[nodiscard]] static bool values(JSContext *cx, unsigned argc, Value *vp);
[[nodiscard]] static bool add(JSContext *cx, HandleObject obj, HandleValue key);
[[nodiscard]] static bool has(JSContext *cx, unsigned argc, Value *vp);
// Publicly exposed Set calls for JSAPI access (webidl maplike/setlike
// interfaces, etc.)
static SetObject* create(JSContext *cx, HandleObject proto = nullptr);
static uint32_t size(JSContext *cx, HandleObject obj);
static MOZ_MUST_USE bool has(JSContext *cx, HandleObject obj, HandleValue key, bool* rval);
static MOZ_MUST_USE bool clear(JSContext *cx, HandleObject obj);
static MOZ_MUST_USE bool iterator(JSContext *cx, IteratorKind kind, HandleObject obj,
[[nodiscard]] static bool has(JSContext *cx, HandleObject obj, HandleValue key, bool* rval);
[[nodiscard]] static bool clear(JSContext *cx, HandleObject obj);
[[nodiscard]] static bool iterator(JSContext *cx, IteratorKind kind, HandleObject obj,
MutableHandleValue iter);
static MOZ_MUST_USE bool delete_(JSContext *cx, HandleObject obj, HandleValue key, bool *rval);
[[nodiscard]] static bool delete_(JSContext *cx, HandleObject obj, HandleValue key, bool *rval);
using UnbarrieredTable = OrderedHashSet<Value, UnbarrieredHashPolicy, RuntimeAllocPolicy>;
friend class OrderedHashTableRef<SetObject>;
@@ -251,20 +251,20 @@ class SetObject : public NativeObject {
static bool isBuiltinAdd(HandleValue add, JSContext* cx);
static MOZ_MUST_USE bool iterator_impl(JSContext* cx, const CallArgs& args, IteratorKind kind);
[[nodiscard]] static bool iterator_impl(JSContext* cx, const CallArgs& args, IteratorKind kind);
static MOZ_MUST_USE bool size_impl(JSContext* cx, const CallArgs& args);
static MOZ_MUST_USE bool size(JSContext* cx, unsigned argc, Value* vp);
static MOZ_MUST_USE bool has_impl(JSContext* cx, const CallArgs& args);
static MOZ_MUST_USE bool add_impl(JSContext* cx, const CallArgs& args);
static MOZ_MUST_USE bool add(JSContext* cx, unsigned argc, Value* vp);
static MOZ_MUST_USE bool delete_impl(JSContext* cx, const CallArgs& args);
static MOZ_MUST_USE bool delete_(JSContext* cx, unsigned argc, Value* vp);
static MOZ_MUST_USE bool values_impl(JSContext* cx, const CallArgs& args);
static MOZ_MUST_USE bool entries_impl(JSContext* cx, const CallArgs& args);
static MOZ_MUST_USE bool entries(JSContext* cx, unsigned argc, Value* vp);
static MOZ_MUST_USE bool clear_impl(JSContext* cx, const CallArgs& args);
static MOZ_MUST_USE bool clear(JSContext* cx, unsigned argc, Value* vp);
[[nodiscard]] static bool size_impl(JSContext* cx, const CallArgs& args);
[[nodiscard]] static bool size(JSContext* cx, unsigned argc, Value* vp);
[[nodiscard]] static bool has_impl(JSContext* cx, const CallArgs& args);
[[nodiscard]] static bool add_impl(JSContext* cx, const CallArgs& args);
[[nodiscard]] static bool add(JSContext* cx, unsigned argc, Value* vp);
[[nodiscard]] static bool delete_impl(JSContext* cx, const CallArgs& args);
[[nodiscard]] static bool delete_(JSContext* cx, unsigned argc, Value* vp);
[[nodiscard]] static bool values_impl(JSContext* cx, const CallArgs& args);
[[nodiscard]] static bool entries_impl(JSContext* cx, const CallArgs& args);
[[nodiscard]] static bool entries(JSContext* cx, unsigned argc, Value* vp);
[[nodiscard]] static bool clear_impl(JSContext* cx, const CallArgs& args);
[[nodiscard]] static bool clear(JSContext* cx, unsigned argc, Value* vp);
};
class SetIteratorObject : public NativeObject
@@ -286,7 +286,7 @@ class SetIteratorObject : public NativeObject
SetObject::IteratorKind kind);
static void finalize(FreeOp* fop, JSObject* obj);
static MOZ_MUST_USE bool next(Handle<SetIteratorObject*> setIterator,
[[nodiscard]] static bool next(Handle<SetIteratorObject*> setIterator,
HandleArrayObject resultObj, JSContext* cx);
static JSObject* createResult(JSContext* cx);
@@ -299,7 +299,7 @@ using SetInitGetPrototypeOp = NativeObject* (*)(JSContext*, Handle<GlobalObject*
using SetInitIsBuiltinOp = bool (*)(HandleValue, JSContext*);
template <SetInitGetPrototypeOp getPrototypeOp, SetInitIsBuiltinOp isBuiltinOp>
static MOZ_MUST_USE bool
[[nodiscard]] static bool
IsOptimizableInitForSet(JSContext* cx, HandleObject setObject, HandleValue iterable, bool* optimized)
{
MOZ_ASSERT(!*optimized);
+13 -13
View File
@@ -18,10 +18,10 @@ class Value;
namespace js {
// Object constructor native. Exposed only so the JIT can know its address.
MOZ_MUST_USE bool
[[nodiscard]] bool
obj_construct(JSContext* cx, unsigned argc, JS::Value* vp);
MOZ_MUST_USE bool
[[nodiscard]] bool
obj_propertyIsEnumerable(JSContext* cx, unsigned argc, Value* vp);
PlainObject*
@@ -32,32 +32,32 @@ PlainObject*
ObjectCreateWithTemplate(JSContext* cx, HandlePlainObject templateObj);
// Object methods exposed so they can be installed in the self-hosting global.
MOZ_MUST_USE bool
[[nodiscard]] bool
obj_create(JSContext* cx, unsigned argc, JS::Value* vp);
MOZ_MUST_USE bool
[[nodiscard]] bool
obj_defineProperty(JSContext* cx, unsigned argc, JS::Value* vp);
MOZ_MUST_USE bool
[[nodiscard]] bool
obj_getOwnPropertyNames(JSContext* cx, unsigned argc, JS::Value* vp);
MOZ_MUST_USE bool
[[nodiscard]] bool
obj_getOwnPropertyDescriptor(JSContext* cx, unsigned argc, JS::Value* vp);
MOZ_MUST_USE bool
[[nodiscard]] bool
obj_getPrototypeOf(JSContext* cx, unsigned argc, JS::Value* vp);
MOZ_MUST_USE bool
[[nodiscard]] bool
obj_hasOwnProperty(JSContext* cx, unsigned argc, JS::Value* vp);
MOZ_MUST_USE bool
[[nodiscard]] bool
obj_isExtensible(JSContext* cx, unsigned argc, JS::Value* vp);
MOZ_MUST_USE bool
[[nodiscard]] bool
obj_toString(JSContext* cx, unsigned argc, JS::Value* vp);
// Exposed so SelfHosting.cpp can use it in the OwnPropertyKeys intrinsic
MOZ_MUST_USE bool
[[nodiscard]] bool
GetOwnPropertyKeys(JSContext* cx, const JS::CallArgs& args, unsigned flags);
/*
@@ -65,7 +65,7 @@ GetOwnPropertyKeys(JSContext* cx, const JS::CallArgs& args, unsigned flags);
* exposing a jsid to script for Object.getOwnProperty{Names,Symbols}
* or scriptable proxy traps.
*/
MOZ_MUST_USE bool
[[nodiscard]] bool
IdToStringOrSymbol(JSContext* cx, JS::HandleId id, JS::MutableHandleValue result);
#if JS_HAS_TOSOURCE
@@ -74,7 +74,7 @@ JSString*
ObjectToSource(JSContext* cx, JS::HandleObject obj);
#endif // JS_HAS_TOSOURCE
extern MOZ_MUST_USE bool
[[nodiscard]] extern bool
WatchHandler(JSContext* cx, JSObject* obj, jsid id, const JS::Value& old,
JS::Value* nvp, void* closure);
+10 -10
View File
@@ -29,21 +29,21 @@ typedef int pid_t;
*
* Returns true if no profilers fail to start.
*/
extern MOZ_MUST_USE JS_PUBLIC_API(bool)
[[nodiscard]] extern JS_PUBLIC_API(bool)
JS_StartProfiling(const char* profileName, pid_t pid);
/**
* Stop any profilers that were previously started with JS_StartProfiling.
* Returns true if no profilers fail to stop.
*/
extern MOZ_MUST_USE JS_PUBLIC_API(bool)
[[nodiscard]] extern JS_PUBLIC_API(bool)
JS_StopProfiling(const char* profileName);
/**
* Write the current profile data to the given file, if applicable to whatever
* profiler is being used.
*/
extern MOZ_MUST_USE JS_PUBLIC_API(bool)
[[nodiscard]] extern JS_PUBLIC_API(bool)
JS_DumpProfile(const char* outfile, const char* profileName);
/**
@@ -51,13 +51,13 @@ JS_DumpProfile(const char* outfile, const char* profileName);
* whether any profilers failed to pause. (Profilers that do not support
* pause/resume do not count.)
*/
extern MOZ_MUST_USE JS_PUBLIC_API(bool)
[[nodiscard]] extern JS_PUBLIC_API(bool)
JS_PauseProfilers(const char* profileName);
/**
* Resume suspended profilers
*/
extern MOZ_MUST_USE JS_PUBLIC_API(bool)
[[nodiscard]] extern JS_PUBLIC_API(bool)
JS_ResumeProfilers(const char* profileName);
/**
@@ -70,23 +70,23 @@ JS_UnsafeGetLastProfilingError();
#ifdef MOZ_CALLGRIND
extern MOZ_MUST_USE JS_FRIEND_API(bool)
[[nodiscard]] extern JS_FRIEND_API(bool)
js_StopCallgrind();
extern MOZ_MUST_USE JS_FRIEND_API(bool)
[[nodiscard]] extern JS_FRIEND_API(bool)
js_StartCallgrind();
extern MOZ_MUST_USE JS_FRIEND_API(bool)
[[nodiscard]] extern JS_FRIEND_API(bool)
js_DumpCallgrind(const char* outfile);
#endif /* MOZ_CALLGRIND */
#ifdef __linux__
extern MOZ_MUST_USE JS_FRIEND_API(bool)
[[nodiscard]] extern JS_FRIEND_API(bool)
js_StartPerf();
extern MOZ_MUST_USE JS_FRIEND_API(bool)
[[nodiscard]] extern JS_FRIEND_API(bool)
js_StopPerf();
#endif /* __linux__ */
+69 -69
View File
@@ -311,7 +311,7 @@ class MutableWrappedPtrOperations<PromiseCombinatorElements, Wrapper>
elements().setElementNeedsWrapping = needsWrapping;
}
MOZ_MUST_USE bool pushUndefined(JSContext* cx) {
[[nodiscard]] bool pushUndefined(JSContext* cx) {
// Helper for the AutoCompartment we need to work with |array|. We mostly do this
// for performance; we could go ahead and do the define via a cross-
// compartment proxy instead...
@@ -335,7 +335,7 @@ class MutableWrappedPtrOperations<PromiseCombinatorElements, Wrapper>
// Promise.all/allSettled/any function, which isn't necessarily the same
// compartment as unwrappedArray as explained in NewPromiseCombinatorElements.
// So before storing |val| we may need to enter unwrappedArray's compartment.
MOZ_MUST_USE bool setElement(JSContext* cx, uint32_t index, HandleValue val) {
[[nodiscard]] bool setElement(JSContext* cx, uint32_t index, HandleValue val) {
// The index is guaranteed to be initialized to `undefined`.
MOZ_ASSERT(unwrappedArray()->getDenseElement(index).isUndefined());
@@ -560,7 +560,7 @@ MaybeGetAndClearException(JSContext* cx, MutableHandleValue rval)
return GetAndClearException(cx, rval);
}
static MOZ_MUST_USE bool RunResolutionFunction(JSContext *cx, HandleObject resolutionFun,
[[nodiscard]] static bool RunResolutionFunction(JSContext *cx, HandleObject resolutionFun,
HandleValue result, ResolutionMode mode,
HandleObject promiseObj);
@@ -778,7 +778,7 @@ static bool ResolvePromiseFunction(JSContext* cx, unsigned argc, Value* vp);
static bool RejectPromiseFunction(JSContext* cx, unsigned argc, Value* vp);
// ES2016, 25.4.1.3.
static MOZ_MUST_USE bool
[[nodiscard]] static bool
CreateResolvingFunctions(JSContext* cx, HandleObject promise,
MutableHandleObject resolveFn,
MutableHandleObject rejectFn)
@@ -823,11 +823,11 @@ IsSettledMaybeWrappedPromise(JSObject* promise)
}
// ES2016, 25.4.1.7.
static MOZ_MUST_USE bool
[[nodiscard]] static bool
RejectMaybeWrappedPromise(JSContext *cx, HandleObject promiseObj, HandleValue reason);
// ES2016, 25.4.1.7.
static MOZ_MUST_USE bool
[[nodiscard]] static bool
RejectPromiseInternal(JSContext* cx, Handle<PromiseObject*> promise, HandleValue reason);
// ES2016, 25.4.1.3.1.
@@ -874,15 +874,15 @@ RejectPromiseFunction(JSContext* cx, unsigned argc, Value* vp)
return true;
}
static MOZ_MUST_USE bool FulfillMaybeWrappedPromise(JSContext *cx, HandleObject promiseObj,
[[nodiscard]] static bool FulfillMaybeWrappedPromise(JSContext *cx, HandleObject promiseObj,
HandleValue value_);
static MOZ_MUST_USE bool EnqueuePromiseResolveThenableJob(JSContext* cx,
[[nodiscard]] static bool EnqueuePromiseResolveThenableJob(JSContext* cx,
HandleValue promiseToResolve,
HandleValue thenable,
HandleValue thenVal);
static MOZ_MUST_USE bool EnqueuePromiseResolveThenableBuiltinJob(JSContext* cx,
[[nodiscard]] static bool EnqueuePromiseResolveThenableBuiltinJob(JSContext* cx,
HandleObject promiseToResolve,
HandleObject thenable);
@@ -891,7 +891,7 @@ static bool Promise_then_impl(JSContext* cx, HandleValue promiseVal, HandleValue
HandleValue onRejected, MutableHandleValue rval, bool rvalUsed);
// ES2016, 25.4.1.3.2, steps 6-13.
static MOZ_MUST_USE bool
[[nodiscard]] static bool
ResolvePromiseInternal(JSContext* cx, HandleObject promise, HandleValue resolutionVal)
{
assertSameCompartment(cx, promise, resolutionVal);
@@ -1024,7 +1024,7 @@ static bool PromiseReactionJob(JSContext* cx, unsigned argc, Value* vp);
* targetState - The PromiseState this reaction job targets. This decides
* whether the onFulfilled or onRejected handler is called.
*/
MOZ_MUST_USE static bool
[[nodiscard]] static bool
EnqueuePromiseReactionJob(JSContext* cx, HandleObject reactionObj,
HandleValue handlerArg_, JS::PromiseState targetState)
{
@@ -1130,11 +1130,11 @@ EnqueuePromiseReactionJob(JSContext* cx, HandleObject reactionObj,
return cx->runtime()->enqueuePromiseJob(cx, job, promise, global);
}
static MOZ_MUST_USE bool TriggerPromiseReactions(JSContext* cx, HandleValue reactionsVal,
[[nodiscard]] static bool TriggerPromiseReactions(JSContext* cx, HandleValue reactionsVal,
JS::PromiseState state, HandleValue valueOrReason);
// ES2016, Commoned-out implementation of 25.4.1.4. and 25.4.1.7.
static MOZ_MUST_USE bool
[[nodiscard]] static bool
ResolvePromise(JSContext* cx, Handle<PromiseObject*> promise, HandleValue valueOrReason,
JS::PromiseState state)
{
@@ -1177,14 +1177,14 @@ ResolvePromise(JSContext* cx, Handle<PromiseObject*> promise, HandleValue valueO
}
// ES2016, 25.4.1.7.
static MOZ_MUST_USE bool
[[nodiscard]] static bool
RejectPromiseInternal(JSContext* cx, Handle<PromiseObject*> promise, HandleValue reason)
{
return ResolvePromise(cx, promise, reason, JS::PromiseState::Rejected);
}
// ES2016, 25.4.1.4.
static MOZ_MUST_USE bool
[[nodiscard]] static bool
FulfillMaybeWrappedPromise(JSContext *cx, HandleObject promiseObj, HandleValue value_)
{
Rooted<PromiseObject*> promise(cx);
@@ -1210,7 +1210,7 @@ FulfillMaybeWrappedPromise(JSContext *cx, HandleObject promiseObj, HandleValue v
static bool GetCapabilitiesExecutor(JSContext* cx, unsigned argc, Value* vp);
static bool PromiseConstructor(JSContext* cx, unsigned argc, Value* vp);
static MOZ_MUST_USE PromiseObject* CreatePromiseObjectInternal(JSContext* cx,
[[nodiscard]] static PromiseObject* CreatePromiseObjectInternal(JSContext* cx,
HandleObject proto = nullptr,
bool protoIsWrapped = false,
bool informDebugger = true);
@@ -1220,7 +1220,7 @@ enum GetCapabilitiesExecutorSlots {
GetCapabilitiesExecutorSlots_Reject
};
static MOZ_MUST_USE PromiseObject*
[[nodiscard]] static PromiseObject*
CreatePromiseObjectWithoutResolutionFunctions(JSContext* cx)
{
Rooted<PromiseObject*> promise(cx, CreatePromiseObjectInternal(cx));
@@ -1231,7 +1231,7 @@ CreatePromiseObjectWithoutResolutionFunctions(JSContext* cx)
return promise;
}
static MOZ_MUST_USE PromiseObject*
[[nodiscard]] static PromiseObject*
CreatePromiseWithDefaultResolutionFunctions(JSContext* cx, MutableHandleObject resolve,
MutableHandleObject reject)
{
@@ -1258,7 +1258,7 @@ CreatePromiseWithDefaultResolutionFunctions(JSContext* cx, MutableHandleObject r
}
// ES2016, 25.4.1.5.
static MOZ_MUST_USE bool
[[nodiscard]] static bool
NewPromiseCapability(JSContext* cx, HandleObject C, MutableHandle<PromiseCapability> capability,
bool canOmitResolutionFunctions)
{
@@ -1369,7 +1369,7 @@ GetCapabilitiesExecutor(JSContext* cx, unsigned argc, Value* vp)
}
// ES2016, 25.4.1.7.
static MOZ_MUST_USE bool
[[nodiscard]] static bool
RejectMaybeWrappedPromise(JSContext *cx, HandleObject promiseObj, HandleValue reason_)
{
Rooted<PromiseObject*> promise(cx);
@@ -1410,7 +1410,7 @@ RejectMaybeWrappedPromise(JSContext *cx, HandleObject promiseObj, HandleValue re
}
// ES2016, 25.4.1.8.
static MOZ_MUST_USE bool
[[nodiscard]] static bool
TriggerPromiseReactions(JSContext* cx, HandleValue reactionsVal, JS::PromiseState state,
HandleValue valueOrReason)
{
@@ -1440,7 +1440,7 @@ TriggerPromiseReactions(JSContext* cx, HandleValue reactionsVal, JS::PromiseStat
// Implements PromiseReactionJob optimized for the case when the reaction
// handler is one of the default resolving functions as created by the
// CreateResolvingFunctions abstract operation.
static MOZ_MUST_USE bool
[[nodiscard]] static bool
DefaultResolvingPromiseReactionJob(JSContext* cx, Handle<PromiseReactionRecord*> reaction,
MutableHandleValue rval)
{
@@ -1485,7 +1485,7 @@ DefaultResolvingPromiseReactionJob(JSContext* cx, Handle<PromiseReactionRecord*>
return true;
}
static MOZ_MUST_USE bool
[[nodiscard]] static bool
AsyncFunctionPromiseReactionJob(JSContext* cx, Handle<PromiseReactionRecord*> reaction,
MutableHandleValue rval)
{
@@ -1513,7 +1513,7 @@ AsyncFunctionPromiseReactionJob(JSContext* cx, Handle<PromiseReactionRecord*> re
return true;
}
static MOZ_MUST_USE bool
[[nodiscard]] static bool
AsyncGeneratorPromiseReactionJob(JSContext* cx, Handle<PromiseReactionRecord*> reaction,
MutableHandleValue rval)
{
@@ -1723,7 +1723,7 @@ PromiseResolveThenableJob(JSContext* cx, unsigned argc, Value* vp)
return Call(cx, rejectVal, UndefinedHandleValue, rval, &rval);
}
static MOZ_MUST_USE bool
[[nodiscard]] static bool
OriginalPromiseThenWithoutSettleHandlers(JSContext* cx, Handle<PromiseObject*> promise,
Handle<PromiseObject*> promiseToResolve);
@@ -1785,7 +1785,7 @@ PromiseResolveBuiltinThenableJob(JSContext* cx, unsigned argc, Value* vp)
* thenable_ - The thenable to resolve the Promise with.
* thenVal - The `then` function to invoke with the `thenable` as the receiver.
*/
static MOZ_MUST_USE bool
[[nodiscard]] static bool
EnqueuePromiseResolveThenableJob(JSContext* cx, HandleValue promiseToResolve_,
HandleValue thenable_, HandleValue thenVal)
{
@@ -1847,7 +1847,7 @@ EnqueuePromiseResolveThenableJob(JSContext* cx, HandleValue promiseToResolve_,
* promiseToResolve - The promise to resolve, obviously.
* thenable - The thenable to resolve the Promise with.
*/
static MOZ_MUST_USE bool
[[nodiscard]] static bool
EnqueuePromiseResolveThenableBuiltinJob(JSContext* cx, HandleObject promiseToResolve,
HandleObject thenable)
{
@@ -1869,11 +1869,11 @@ EnqueuePromiseResolveThenableBuiltinJob(JSContext* cx, HandleObject promiseToRes
return cx->runtime()->enqueuePromiseJob(cx, job, promiseToResolve, incumbentGlobal);
}
static MOZ_MUST_USE bool
[[nodiscard]] static bool
AddDummyPromiseReactionForDebugger(JSContext* cx, Handle<PromiseObject*> promise,
HandleObject dependentPromise);
static MOZ_MUST_USE bool
[[nodiscard]] static bool
AddPromiseReaction(JSContext* cx, Handle<PromiseObject*> promise,
Handle<PromiseReactionRecord*> reaction);
@@ -1947,7 +1947,7 @@ ClearResolutionFunctionSlots(JSFunction* resolutionFun)
}
// ES2016, 25.4.3.1. steps 3-7.
static MOZ_MUST_USE PromiseObject*
[[nodiscard]] static PromiseObject*
CreatePromiseObjectInternal(JSContext* cx, HandleObject proto /* = nullptr */,
bool protoIsWrapped /* = false */, bool informDebugger /* = true */)
{
@@ -2175,19 +2175,19 @@ class MOZ_STACK_CLASS PromiseForOfIterator : public JS::ForOfIterator {
}
};
static MOZ_MUST_USE bool
[[nodiscard]] static bool
PerformPromiseAll(JSContext *cx, PromiseForOfIterator& iterator, HandleObject C,
Handle<PromiseCapability> resultCapability, HandleValue promiseResolve, bool* done);
static MOZ_MUST_USE bool
[[nodiscard]] static bool
PerformPromiseAllSettled(JSContext *cx, PromiseForOfIterator& iterator, HandleObject C,
Handle<PromiseCapability> resultCapability, HandleValue promiseResolve, bool* done);
static MOZ_MUST_USE bool
[[nodiscard]] static bool
PerformPromiseAny(JSContext *cx, PromiseForOfIterator& iterator, HandleObject C,
Handle<PromiseCapability> resultCapability, HandleValue promiseResolve, bool* done);
static MOZ_MUST_USE bool
[[nodiscard]] static bool
PerformPromiseRace(JSContext* cx, PromiseForOfIterator& iterator, HandleObject C,
Handle<PromiseCapability> resultCapability, HandleValue promiseResolve, bool* done);
@@ -2204,7 +2204,7 @@ enum class CombinatorKind { All, AllSettled, Any, Race };
// https://tc39.es/proposal-promise-any/
//
// Promise.any ( iterable )
static MOZ_MUST_USE bool
[[nodiscard]] static bool
CommonPromiseCombinator(JSContext* cx, CallArgs& args, CombinatorKind mode)
{
HandleValue iterable = args.get(0);
@@ -2340,11 +2340,11 @@ static bool Promise_static_all(JSContext* cx, unsigned argc, Value* vp) {
return CommonPromiseCombinator(cx, args, CombinatorKind::All);
}
static MOZ_MUST_USE bool
[[nodiscard]] static bool
PerformPromiseThen(JSContext* cx, Handle<PromiseObject*> promise, HandleValue onFulfilled_,
HandleValue onRejected_, Handle<PromiseCapability> resultCapability);
static MOZ_MUST_USE bool
[[nodiscard]] static bool
PerformPromiseThenWithoutSettleHandlers(JSContext* cx, Handle<PromiseObject*> promise,
Handle<PromiseObject*> promiseToResolve,
Handle<PromiseCapability> resultCapability);
@@ -2356,7 +2356,7 @@ static JSFunction* NewPromiseCombinatorElementFunction(
static bool PromiseAllResolveElementFunction(JSContext* cx, unsigned argc, Value* vp);
// Unforgeable version of ES2016, 25.4.4.1.
MOZ_MUST_USE JSObject*
[[nodiscard]] JSObject*
js::GetWaitForAllPromise(JSContext* cx, const JS::AutoObjectVector& promises)
{
#ifdef DEBUG
@@ -2476,7 +2476,7 @@ js::GetWaitForAllPromise(JSContext* cx, const JS::AutoObjectVector& promises)
return resultCapability.promise();
}
static MOZ_MUST_USE bool
[[nodiscard]] static bool
RunResolutionFunction(JSContext *cx, HandleObject resolutionFun, HandleValue result,
ResolutionMode mode, HandleObject promiseObj)
{
@@ -2528,7 +2528,7 @@ RunResolutionFunction(JSContext *cx, HandleObject resolutionFun, HandleValue res
return RejectPromiseInternal(cx, promise, result);
}
static MOZ_MUST_USE JSObject*
[[nodiscard]] static JSObject*
CommonStaticResolveRejectImpl(JSContext* cx, HandleValue thisVal, HandleValue argVal,
ResolutionMode mode);
@@ -2544,7 +2544,7 @@ IsPromiseSpecies(JSContext* cx, JSFunction* species);
// https://tc39.es/proposal-promise-any/
// Runtime Semantics: PerformPromiseAny, steps 6-8.
template <typename T>
static MOZ_MUST_USE bool
[[nodiscard]] static bool
CommonPerformPromiseCombinator(JSContext *cx, PromiseForOfIterator& iterator, HandleObject C,
HandleObject resultPromise, HandleValue promiseResolve, bool* done,
bool resolveReturnsUndefined, T getResolveAndReject)
@@ -2810,7 +2810,7 @@ CommonPerformPromiseCombinator(JSContext *cx, PromiseForOfIterator& iterator, Ha
// Create the elements for the Promise combinators Promise.all and
// Promise.allSettled.
static MOZ_MUST_USE bool
[[nodiscard]] static bool
NewPromiseCombinatorElements(JSContext* cx, Handle<PromiseCapability> resultCapability,
MutableHandle<PromiseCombinatorElements> elements)
{
@@ -2862,7 +2862,7 @@ NewPromiseCombinatorElements(JSContext* cx, Handle<PromiseCapability> resultCapa
}
// Retrieve the combinator elements from the data holder.
static MOZ_MUST_USE bool
[[nodiscard]] static bool
GetPromiseCombinatorElements(JSContext* cx, Handle<PromiseCombinatorDataHolder*> data,
MutableHandle<PromiseCombinatorElements> elements)
{
@@ -2947,7 +2947,7 @@ PromiseCombinatorElementFunctionAlreadyCalled(const CallArgs& args,
// ES2020 draft rev a09fc232c137800dbf51b6204f37fdede4ba1646
// 25.6.4.1.1 PerformPromiseAll (iteratorRecord, constructor, resultCapability)
static MOZ_MUST_USE bool
[[nodiscard]] static bool
PerformPromiseAll(JSContext *cx, PromiseForOfIterator& iterator, HandleObject C,
Handle<PromiseCapability> resultCapability, HandleValue promiseResolve, bool* done)
{
@@ -3083,7 +3083,7 @@ Promise_static_race(JSContext* cx, unsigned argc, Value* vp)
// ES2020 draft rev a09fc232c137800dbf51b6204f37fdede4ba1646
// 25.6.4.3.1 PerformPromiseRace (iteratorRecord, constructor, resultCapability)
static MOZ_MUST_USE bool
[[nodiscard]] static bool
PerformPromiseRace(JSContext *cx, PromiseForOfIterator& iterator, HandleObject C,
Handle<PromiseCapability> resultCapability, HandleValue promiseResolve, bool* done)
{
@@ -3138,7 +3138,7 @@ static bool Promise_static_allSettled(JSContext* cx, unsigned argc, Value* vp) {
// 25.6.4.2 Promise.allSettled ( iterable )
//
// PerformPromiseAllSettled ( iteratorRecord, constructor, resultCapability )
static MOZ_MUST_USE bool PerformPromiseAllSettled(
[[nodiscard]] static bool PerformPromiseAllSettled(
JSContext* cx, PromiseForOfIterator& iterator, HandleObject C,
Handle<PromiseCapability> resultCapability, HandleValue promiseResolve, bool* done) {
*done = false;
@@ -3349,7 +3349,7 @@ static void ThrowAggregateError(JSContext* cx,
// https://tc39.es/proposal-promise-any/
//
// PerformPromiseAny ( iteratorRecord, constructor, resultCapability )
static MOZ_MUST_USE bool
[[nodiscard]] static bool
PerformPromiseAny(JSContext* cx, PromiseForOfIterator& iterator, HandleObject C,
Handle<PromiseCapability> resultCapability, HandleValue promiseResolve, bool* done)
{
@@ -3553,7 +3553,7 @@ ThrowAggregateError(JSContext* cx, Handle<PromiseCombinatorElements> errors, Han
// 25.6.4.4 Promise.reject ( r )
// 25.6.4.5 Promise.resolve ( x )
// 25.6.4.5.1 PromiseResolve ( C, x )
static MOZ_MUST_USE JSObject*
[[nodiscard]] static JSObject*
CommonStaticResolveRejectImpl(JSContext* cx, HandleValue thisVal, HandleValue argVal,
ResolutionMode mode)
{
@@ -3610,7 +3610,7 @@ CommonStaticResolveRejectImpl(JSContext* cx, HandleValue thisVal, HandleValue ar
return capability.promise();
}
MOZ_MUST_USE JSObject*
[[nodiscard]] JSObject*
js::PromiseResolve(JSContext* cx, HandleObject constructor, HandleValue value)
{
RootedValue C(cx, ObjectValue(*constructor));
@@ -3789,7 +3789,7 @@ PromiseThenNewPromiseCapability(JSContext* cx, HandleObject promiseObj,
}
// ES2016, 25.4.5.3., steps 3-5.
MOZ_MUST_USE bool
[[nodiscard]] bool
js::OriginalPromiseThen(JSContext* cx, Handle<PromiseObject*> promise,
HandleValue onFulfilled, HandleValue onRejected,
MutableHandleObject dependent, CreateDependentPromise createDependent)
@@ -3813,7 +3813,7 @@ js::OriginalPromiseThen(JSContext* cx, Handle<PromiseObject*> promise,
return true;
}
static MOZ_MUST_USE bool
[[nodiscard]] static bool
OriginalPromiseThenWithoutSettleHandlers(JSContext* cx, Handle<PromiseObject*> promise,
Handle<PromiseObject*> promiseToResolve)
{
@@ -3870,7 +3870,7 @@ OriginalPromiseThenBuiltin(JSContext* cx, HandleValue promiseVal, HandleValue on
return true;
}
MOZ_MUST_USE bool
[[nodiscard]] bool
js::RejectPromiseWithPendingError(JSContext* cx, Handle<PromiseObject*> promise)
{
// Not much we can do about uncatchable exceptions, just bail.
@@ -3880,7 +3880,7 @@ js::RejectPromiseWithPendingError(JSContext* cx, Handle<PromiseObject*> promise)
return PromiseObject::reject(cx, promise, exn);
}
static MOZ_MUST_USE bool PerformPromiseThenWithReaction(JSContext* cx,
[[nodiscard]] static bool PerformPromiseThenWithReaction(JSContext* cx,
Handle<PromiseObject*> promise,
Handle<PromiseReactionRecord*> reaction);
@@ -3888,7 +3888,7 @@ static MOZ_MUST_USE bool PerformPromiseThenWithReaction(JSContext* cx,
// js/src/builtin/AsyncFunction.cpp, to call Promise internal functions.
// ES 2018 draft 14.6.11 and 14.7.14 step 1.
MOZ_MUST_USE PromiseObject*
[[nodiscard]] PromiseObject*
js::CreatePromiseObjectForAsync(JSContext* cx, HandleValue generatorVal)
{
// Step 1.
@@ -3909,7 +3909,7 @@ js::IsPromiseForAsync(JSObject* promise)
}
// ES 2018 draft 25.5.5.2 steps 3.f, 3.g.
MOZ_MUST_USE bool
[[nodiscard]] bool
js::AsyncFunctionThrown(JSContext* cx, Handle<PromiseObject*> resultPromise)
{
// Step 3.f.
@@ -3925,7 +3925,7 @@ js::AsyncFunctionThrown(JSContext* cx, Handle<PromiseObject*> resultPromise)
}
// ES 2018 draft 25.5.5.2 steps 3.d-e, 3.g.
MOZ_MUST_USE bool
[[nodiscard]] bool
js::AsyncFunctionReturned(JSContext* cx, Handle<PromiseObject*> resultPromise, HandleValue value)
{
// Steps 3.d-e.
@@ -3939,7 +3939,7 @@ js::AsyncFunctionReturned(JSContext* cx, Handle<PromiseObject*> resultPromise, H
// Helper function that performs the equivalent steps as
// Async Iteration proposal 4.1 Await steps 2-3, 6-9 or similar.
template <typename T>
static MOZ_MUST_USE bool
[[nodiscard]] static bool
InternalAwait(JSContext* cx, HandleValue value, HandleObject resultPromise,
HandleValue onFulfilled, HandleValue onRejected, T extraStep)
{
@@ -3972,7 +3972,7 @@ InternalAwait(JSContext* cx, HandleValue value, HandleObject resultPromise,
}
// ES 2018 draft 25.5.5.3 steps 2-10.
MOZ_MUST_USE bool
[[nodiscard]] bool
js::AsyncFunctionAwait(JSContext* cx, Handle<PromiseObject*> resultPromise, HandleValue value)
{
// Steps 4-5.
@@ -3987,7 +3987,7 @@ js::AsyncFunctionAwait(JSContext* cx, Handle<PromiseObject*> resultPromise, Hand
}
// Async Iteration proposal 4.1 Await steps 2-9.
MOZ_MUST_USE bool
[[nodiscard]] bool
js::AsyncGeneratorAwait(JSContext* cx, Handle<AsyncGeneratorObject*> asyncGenObj,
HandleValue value)
{
@@ -4146,13 +4146,13 @@ enum class ResumeNextKind {
Enqueue, Reject, Resolve
};
static MOZ_MUST_USE bool
[[nodiscard]] static bool
AsyncGeneratorResumeNext(JSContext* cx, Handle<AsyncGeneratorObject*> asyncGenObj,
ResumeNextKind kind, HandleValue valueOrException = UndefinedHandleValue,
bool done = false);
// Async Iteration proposal 11.4.3.3.
MOZ_MUST_USE bool
[[nodiscard]] bool
js::AsyncGeneratorResolve(JSContext* cx, Handle<AsyncGeneratorObject*> asyncGenObj,
HandleValue value, bool done)
{
@@ -4160,7 +4160,7 @@ js::AsyncGeneratorResolve(JSContext* cx, Handle<AsyncGeneratorObject*> asyncGenO
}
// Async Iteration proposal 11.4.3.4.
MOZ_MUST_USE bool
[[nodiscard]] bool
js::AsyncGeneratorReject(JSContext* cx, Handle<AsyncGeneratorObject*> asyncGenObj,
HandleValue exception)
{
@@ -4168,7 +4168,7 @@ js::AsyncGeneratorReject(JSContext* cx, Handle<AsyncGeneratorObject*> asyncGenOb
}
// Async Iteration proposal 11.4.3.5.
static MOZ_MUST_USE bool
[[nodiscard]] static bool
AsyncGeneratorResumeNext(JSContext* cx, Handle<AsyncGeneratorObject*> asyncGenObj,
ResumeNextKind kind,
HandleValue valueOrException_ /* = UndefinedHandleValue */,
@@ -4349,7 +4349,7 @@ AsyncGeneratorResumeNext(JSContext* cx, Handle<AsyncGeneratorObject*> asyncGenOb
}
// Async Iteration proposal 11.4.3.6.
MOZ_MUST_USE bool
[[nodiscard]] bool
js::AsyncGeneratorEnqueue(JSContext* cx, HandleValue asyncGenVal,
CompletionKind completionKind, HandleValue completionValue,
MutableHandleValue result)
@@ -4540,7 +4540,7 @@ Promise_then(JSContext* cx, unsigned argc, Value* vp)
}
// ES2016, 25.4.5.3.1.
static MOZ_MUST_USE bool
[[nodiscard]] static bool
PerformPromiseThen(JSContext* cx, Handle<PromiseObject*> promise, HandleValue onFulfilled_,
HandleValue onRejected_, Handle<PromiseCapability> resultCapability)
{
@@ -4567,7 +4567,7 @@ PerformPromiseThen(JSContext* cx, Handle<PromiseObject*> promise, HandleValue on
return PerformPromiseThenWithReaction(cx, promise, reaction);
}
static MOZ_MUST_USE bool
[[nodiscard]] static bool
PerformPromiseThenWithoutSettleHandlers(JSContext* cx, Handle<PromiseObject*> promise,
Handle<PromiseObject*> promiseToResolve,
Handle<PromiseCapability> resultCapability)
@@ -4593,7 +4593,7 @@ PerformPromiseThenWithoutSettleHandlers(JSContext* cx, Handle<PromiseObject*> pr
return PerformPromiseThenWithReaction(cx, promise, reaction);
}
static MOZ_MUST_USE bool
[[nodiscard]] static bool
PerformPromiseThenWithReaction(JSContext* cx, Handle<PromiseObject*> promise,
Handle<PromiseReactionRecord*> reaction)
{
@@ -4637,7 +4637,7 @@ PerformPromiseThenWithReaction(JSContext* cx, Handle<PromiseObject*> promise,
return true;
}
static MOZ_MUST_USE bool
[[nodiscard]] static bool
AddPromiseReaction(JSContext* cx, Handle<PromiseObject*> promise,
Handle<PromiseReactionRecord*> reaction)
{
@@ -4705,7 +4705,7 @@ AddPromiseReaction(JSContext* cx, Handle<PromiseObject*> promise,
return true;
}
static MOZ_MUST_USE bool
[[nodiscard]] static bool
AddDummyPromiseReactionForDebugger(JSContext* cx, Handle<PromiseObject*> promise,
HandleObject dependentPromise)
{
+18 -18
View File
@@ -73,10 +73,10 @@ class PromiseObject : public NativeObject
return getFixedSlot(PromiseSlot_ReactionsOrResult);
}
static MOZ_MUST_USE bool resolve(JSContext* cx, Handle<PromiseObject*> promise,
HandleValue resolutionValue);
static MOZ_MUST_USE bool reject(JSContext* cx, Handle<PromiseObject*> promise,
HandleValue rejectionValue);
[[nodiscard]] static bool resolve(JSContext* cx, Handle<PromiseObject*> promise,
HandleValue resolutionValue);
[[nodiscard]] static bool reject(JSContext* cx, Handle<PromiseObject*> promise,
HandleValue rejectionValue);
static void onSettled(JSContext* cx, Handle<PromiseObject*> promise);
@@ -89,7 +89,7 @@ class PromiseObject : public NativeObject
MOZ_ASSERT(state() != JS::PromiseState::Pending);
return resolutionTime() - allocationTime();
}
MOZ_MUST_USE bool dependentPromises(JSContext* cx, MutableHandle<GCVector<Value>> values);
[[nodiscard]] bool dependentPromises(JSContext* cx, MutableHandle<GCVector<Value>> values);
uint64_t getID();
bool isUnhandled() {
MOZ_ASSERT(state() == JS::PromiseState::Rejected);
@@ -113,7 +113,7 @@ class PromiseObject : public NativeObject
* Asserts that all objects in the `promises` vector are, maybe wrapped,
* instances of `Promise` or a subclass of `Promise`.
*/
MOZ_MUST_USE JSObject*
[[nodiscard]] JSObject*
GetWaitForAllPromise(JSContext* cx, const JS::AutoObjectVector& promises);
enum class CreateDependentPromise {
@@ -132,7 +132,7 @@ enum class CreateDependentPromise {
* `promise` field that can contain null. That field is only ever used by
* devtools, which have to treat these reactions specially.
*/
MOZ_MUST_USE bool
[[nodiscard]] bool
OriginalPromiseThen(JSContext* cx, Handle<PromiseObject*> promise,
HandleValue onFulfilled, HandleValue onRejected,
MutableHandleObject dependent, CreateDependentPromise createDependent);
@@ -143,41 +143,41 @@ OriginalPromiseThen(JSContext* cx, Handle<PromiseObject*> promise,
* The abstract operation PromiseResolve, given a constructor and a value,
* returns a new promise resolved with that value.
*/
MOZ_MUST_USE JSObject*
[[nodiscard]] JSObject*
PromiseResolve(JSContext* cx, HandleObject constructor, HandleValue value);
MOZ_MUST_USE bool
[[nodiscard]] bool
RejectPromiseWithPendingError(JSContext* cx, Handle<PromiseObject*> promise);
MOZ_MUST_USE PromiseObject*
[[nodiscard]] PromiseObject*
CreatePromiseObjectForAsync(JSContext* cx, HandleValue generatorVal);
MOZ_MUST_USE bool
[[nodiscard]] bool
IsPromiseForAsync(JSObject* promise);
MOZ_MUST_USE bool
[[nodiscard]] bool
AsyncFunctionReturned(JSContext* cx, Handle<PromiseObject*> resultPromise, HandleValue value);
MOZ_MUST_USE bool
[[nodiscard]] bool
AsyncFunctionThrown(JSContext* cx, Handle<PromiseObject*> resultPromise);
MOZ_MUST_USE bool
[[nodiscard]] bool
AsyncFunctionAwait(JSContext* cx, Handle<PromiseObject*> resultPromise, HandleValue value);
class AsyncGeneratorObject;
MOZ_MUST_USE bool
[[nodiscard]] bool
AsyncGeneratorAwait(JSContext* cx, Handle<AsyncGeneratorObject*> asyncGenObj, HandleValue value);
MOZ_MUST_USE bool
[[nodiscard]] bool
AsyncGeneratorResolve(JSContext* cx, Handle<AsyncGeneratorObject*> asyncGenObj,
HandleValue value, bool done);
MOZ_MUST_USE bool
[[nodiscard]] bool
AsyncGeneratorReject(JSContext* cx, Handle<AsyncGeneratorObject*> asyncGenObj,
HandleValue exception);
MOZ_MUST_USE bool
[[nodiscard]] bool
AsyncGeneratorEnqueue(JSContext* cx, HandleValue asyncGenVal, CompletionKind completionKind,
HandleValue completionValue, MutableHandleValue result);
+2 -2
View File
@@ -17,10 +17,10 @@ InitReflect(JSContext* cx, js::HandleObject obj);
namespace js {
extern MOZ_MUST_USE bool
[[nodiscard]] extern bool
Reflect_getPrototypeOf(JSContext* cx, unsigned argc, Value* vp);
extern MOZ_MUST_USE bool
[[nodiscard]] extern bool
Reflect_isExtensible(JSContext* cx, unsigned argc, Value* vp);
}
+84 -84
View File
@@ -256,7 +256,7 @@ class NodeBuilder
userv(c)
{}
MOZ_MUST_USE bool init(HandleObject userobj = nullptr) {
[[nodiscard]] bool init(HandleObject userobj = nullptr) {
if (src) {
if (!atomValue(src, &srcval))
return false;
@@ -307,7 +307,7 @@ class NodeBuilder
}
private:
MOZ_MUST_USE bool callbackHelper(HandleValue fun, const InvokeArgs& args, size_t i,
[[nodiscard]] bool callbackHelper(HandleValue fun, const InvokeArgs& args, size_t i,
TokenPos* pos, MutableHandleValue dst)
{
// The end of the implementation of callback(). All arguments except
@@ -324,7 +324,7 @@ class NodeBuilder
// that convert to HandleValue, so this isn't as template-y as it seems,
// just variadic.
template <typename... Arguments>
MOZ_MUST_USE bool callbackHelper(HandleValue fun, const InvokeArgs& args, size_t i,
[[nodiscard]] bool callbackHelper(HandleValue fun, const InvokeArgs& args, size_t i,
HandleValue head, Arguments&&... tail)
{
// Recursive loop to store the arguments into args. This eventually
@@ -338,7 +338,7 @@ class NodeBuilder
// bool callback(HandleValue fun, HandleValue... args, TokenPos* pos,
// MutableHandleValue dst);
template <typename... Arguments>
MOZ_MUST_USE bool callback(HandleValue fun, Arguments&&... args) {
[[nodiscard]] bool callback(HandleValue fun, Arguments&&... args) {
InvokeArgs iargs(cx);
if (!iargs.init(cx, sizeof...(args) - 2 + size_t(saveLoc)))
return false;
@@ -355,7 +355,7 @@ class NodeBuilder
return v.isMagic(JS_SERIALIZE_NO_NODE) ? JS::UndefinedHandleValue : v;
}
MOZ_MUST_USE bool atomValue(const char* s, MutableHandleValue dst) {
[[nodiscard]] bool atomValue(const char* s, MutableHandleValue dst) {
/*
* Bug 575416: instead of Atomize, lookup constant atoms in tbl file
*/
@@ -367,7 +367,7 @@ class NodeBuilder
return true;
}
MOZ_MUST_USE bool newObject(MutableHandleObject dst) {
[[nodiscard]] bool newObject(MutableHandleObject dst) {
RootedPlainObject nobj(cx, NewBuiltinClassInstance<PlainObject>(cx));
if (!nobj)
return false;
@@ -376,11 +376,11 @@ class NodeBuilder
return true;
}
MOZ_MUST_USE bool newArray(NodeVector& elts, MutableHandleValue dst);
[[nodiscard]] bool newArray(NodeVector& elts, MutableHandleValue dst);
MOZ_MUST_USE bool createNode(ASTType type, TokenPos* pos, MutableHandleObject dst);
[[nodiscard]] bool createNode(ASTType type, TokenPos* pos, MutableHandleObject dst);
MOZ_MUST_USE bool newNodeHelper(HandleObject obj, MutableHandleValue dst) {
[[nodiscard]] bool newNodeHelper(HandleObject obj, MutableHandleValue dst) {
// The end of the implementation of newNode().
MOZ_ASSERT(obj);
dst.setObject(*obj);
@@ -388,7 +388,7 @@ class NodeBuilder
}
template <typename... Arguments>
MOZ_MUST_USE bool newNodeHelper(HandleObject obj, const char *name, HandleValue value,
[[nodiscard]] bool newNodeHelper(HandleObject obj, const char *name, HandleValue value,
Arguments&&... rest)
{
// Recursive loop to define properties. Note that the newNodeHelper()
@@ -407,13 +407,13 @@ class NodeBuilder
// {const char *name0, HandleValue value0,}...
// MutableHandleValue dst);
template <typename... Arguments>
MOZ_MUST_USE bool newNode(ASTType type, TokenPos* pos, Arguments&&... args) {
[[nodiscard]] bool newNode(ASTType type, TokenPos* pos, Arguments&&... args) {
RootedObject node(cx);
return createNode(type, pos, &node) &&
newNodeHelper(node, Forward<Arguments>(args)...);
}
MOZ_MUST_USE bool listNode(ASTType type, const char* propName, NodeVector& elts, TokenPos* pos,
[[nodiscard]] bool listNode(ASTType type, const char* propName, NodeVector& elts, TokenPos* pos,
MutableHandleValue dst) {
RootedValue array(cx);
if (!newArray(elts, &array))
@@ -426,7 +426,7 @@ class NodeBuilder
return newNode(type, pos, propName, array, dst);
}
MOZ_MUST_USE bool defineProperty(HandleObject obj, const char* name, HandleValue val) {
[[nodiscard]] bool defineProperty(HandleObject obj, const char* name, HandleValue val) {
MOZ_ASSERT_IF(val.isMagic(), val.whyMagic() == JS_SERIALIZE_NO_NODE);
/*
@@ -441,9 +441,9 @@ class NodeBuilder
return DefineProperty(cx, obj, atom->asPropertyName(), optVal);
}
MOZ_MUST_USE bool newNodeLoc(TokenPos* pos, MutableHandleValue dst);
[[nodiscard]] bool newNodeLoc(TokenPos* pos, MutableHandleValue dst);
MOZ_MUST_USE bool setNodeLoc(HandleObject node, TokenPos* pos);
[[nodiscard]] bool setNodeLoc(HandleObject node, TokenPos* pos);
public:
/*
@@ -459,27 +459,27 @@ class NodeBuilder
* misc nodes
*/
MOZ_MUST_USE bool program(NodeVector& elts, TokenPos* pos, MutableHandleValue dst);
[[nodiscard]] bool program(NodeVector& elts, TokenPos* pos, MutableHandleValue dst);
MOZ_MUST_USE bool literal(HandleValue val, TokenPos* pos, MutableHandleValue dst);
[[nodiscard]] bool literal(HandleValue val, TokenPos* pos, MutableHandleValue dst);
MOZ_MUST_USE bool identifier(HandleValue name, TokenPos* pos, MutableHandleValue dst);
[[nodiscard]] bool identifier(HandleValue name, TokenPos* pos, MutableHandleValue dst);
MOZ_MUST_USE bool function(ASTType type, TokenPos* pos,
[[nodiscard]] bool function(ASTType type, TokenPos* pos,
HandleValue id, NodeVector& args, NodeVector& defaults,
HandleValue body, HandleValue rest, GeneratorStyle generatorStyle,
bool isAsync, bool isExpression, MutableHandleValue dst);
MOZ_MUST_USE bool variableDeclarator(HandleValue id, HandleValue init, TokenPos* pos,
[[nodiscard]] bool variableDeclarator(HandleValue id, HandleValue init, TokenPos* pos,
MutableHandleValue dst);
MOZ_MUST_USE bool switchCase(HandleValue expr, NodeVector& elts, TokenPos* pos, MutableHandleValue dst);
[[nodiscard]] bool switchCase(HandleValue expr, NodeVector& elts, TokenPos* pos, MutableHandleValue dst);
MOZ_MUST_USE bool catchClause(HandleValue var, HandleValue guard, HandleValue body, TokenPos* pos,
[[nodiscard]] bool catchClause(HandleValue var, HandleValue guard, HandleValue body, TokenPos* pos,
MutableHandleValue dst);
MOZ_MUST_USE bool prototypeMutation(HandleValue val, TokenPos* pos, MutableHandleValue dst);
MOZ_MUST_USE bool propertyInitializer(HandleValue key, HandleValue val, PropKind kind,
[[nodiscard]] bool prototypeMutation(HandleValue val, TokenPos* pos, MutableHandleValue dst);
[[nodiscard]] bool propertyInitializer(HandleValue key, HandleValue val, PropKind kind,
bool isShorthand, bool isMethod, TokenPos* pos,
MutableHandleValue dst);
@@ -488,165 +488,165 @@ class NodeBuilder
* statements
*/
MOZ_MUST_USE bool blockStatement(NodeVector& elts, TokenPos* pos, MutableHandleValue dst);
[[nodiscard]] bool blockStatement(NodeVector& elts, TokenPos* pos, MutableHandleValue dst);
MOZ_MUST_USE bool expressionStatement(HandleValue expr, TokenPos* pos, MutableHandleValue dst);
[[nodiscard]] bool expressionStatement(HandleValue expr, TokenPos* pos, MutableHandleValue dst);
MOZ_MUST_USE bool emptyStatement(TokenPos* pos, MutableHandleValue dst);
[[nodiscard]] bool emptyStatement(TokenPos* pos, MutableHandleValue dst);
MOZ_MUST_USE bool ifStatement(HandleValue test, HandleValue cons, HandleValue alt, TokenPos* pos,
[[nodiscard]] bool ifStatement(HandleValue test, HandleValue cons, HandleValue alt, TokenPos* pos,
MutableHandleValue dst);
MOZ_MUST_USE bool breakStatement(HandleValue label, TokenPos* pos, MutableHandleValue dst);
[[nodiscard]] bool breakStatement(HandleValue label, TokenPos* pos, MutableHandleValue dst);
MOZ_MUST_USE bool continueStatement(HandleValue label, TokenPos* pos, MutableHandleValue dst);
[[nodiscard]] bool continueStatement(HandleValue label, TokenPos* pos, MutableHandleValue dst);
MOZ_MUST_USE bool labeledStatement(HandleValue label, HandleValue stmt, TokenPos* pos,
[[nodiscard]] bool labeledStatement(HandleValue label, HandleValue stmt, TokenPos* pos,
MutableHandleValue dst);
MOZ_MUST_USE bool throwStatement(HandleValue arg, TokenPos* pos, MutableHandleValue dst);
[[nodiscard]] bool throwStatement(HandleValue arg, TokenPos* pos, MutableHandleValue dst);
MOZ_MUST_USE bool returnStatement(HandleValue arg, TokenPos* pos, MutableHandleValue dst);
[[nodiscard]] bool returnStatement(HandleValue arg, TokenPos* pos, MutableHandleValue dst);
MOZ_MUST_USE bool forStatement(HandleValue init, HandleValue test, HandleValue update, HandleValue stmt,
[[nodiscard]] bool forStatement(HandleValue init, HandleValue test, HandleValue update, HandleValue stmt,
TokenPos* pos, MutableHandleValue dst);
MOZ_MUST_USE bool forInStatement(HandleValue var, HandleValue expr, HandleValue stmt,
[[nodiscard]] bool forInStatement(HandleValue var, HandleValue expr, HandleValue stmt,
bool isForEach, TokenPos* pos, MutableHandleValue dst);
MOZ_MUST_USE bool forOfStatement(HandleValue var, HandleValue expr, HandleValue stmt, TokenPos* pos,
[[nodiscard]] bool forOfStatement(HandleValue var, HandleValue expr, HandleValue stmt, TokenPos* pos,
MutableHandleValue dst);
MOZ_MUST_USE bool withStatement(HandleValue expr, HandleValue stmt, TokenPos* pos, MutableHandleValue dst);
[[nodiscard]] bool withStatement(HandleValue expr, HandleValue stmt, TokenPos* pos, MutableHandleValue dst);
MOZ_MUST_USE bool whileStatement(HandleValue test, HandleValue stmt, TokenPos* pos, MutableHandleValue dst);
[[nodiscard]] bool whileStatement(HandleValue test, HandleValue stmt, TokenPos* pos, MutableHandleValue dst);
MOZ_MUST_USE bool doWhileStatement(HandleValue stmt, HandleValue test, TokenPos* pos,
[[nodiscard]] bool doWhileStatement(HandleValue stmt, HandleValue test, TokenPos* pos,
MutableHandleValue dst);
MOZ_MUST_USE bool switchStatement(HandleValue disc, NodeVector& elts, bool lexical, TokenPos* pos,
[[nodiscard]] bool switchStatement(HandleValue disc, NodeVector& elts, bool lexical, TokenPos* pos,
MutableHandleValue dst);
MOZ_MUST_USE bool tryStatement(HandleValue body, NodeVector& guarded, HandleValue unguarded,
[[nodiscard]] bool tryStatement(HandleValue body, NodeVector& guarded, HandleValue unguarded,
HandleValue finally, TokenPos* pos, MutableHandleValue dst);
MOZ_MUST_USE bool debuggerStatement(TokenPos* pos, MutableHandleValue dst);
[[nodiscard]] bool debuggerStatement(TokenPos* pos, MutableHandleValue dst);
MOZ_MUST_USE bool importDeclaration(NodeVector& elts, HandleValue moduleSpec, TokenPos* pos, MutableHandleValue dst);
[[nodiscard]] bool importDeclaration(NodeVector& elts, HandleValue moduleSpec, TokenPos* pos, MutableHandleValue dst);
MOZ_MUST_USE bool importSpecifier(HandleValue importName, HandleValue bindingName, TokenPos* pos, MutableHandleValue dst);
[[nodiscard]] bool importSpecifier(HandleValue importName, HandleValue bindingName, TokenPos* pos, MutableHandleValue dst);
MOZ_MUST_USE bool exportDeclaration(HandleValue decl, NodeVector& elts, HandleValue moduleSpec,
[[nodiscard]] bool exportDeclaration(HandleValue decl, NodeVector& elts, HandleValue moduleSpec,
HandleValue isDefault, TokenPos* pos, MutableHandleValue dst);
MOZ_MUST_USE bool exportSpecifier(HandleValue bindingName, HandleValue exportName, TokenPos* pos, MutableHandleValue dst);
[[nodiscard]] bool exportSpecifier(HandleValue bindingName, HandleValue exportName, TokenPos* pos, MutableHandleValue dst);
MOZ_MUST_USE bool exportBatchSpecifier(TokenPos* pos, MutableHandleValue dst);
[[nodiscard]] bool exportBatchSpecifier(TokenPos* pos, MutableHandleValue dst);
MOZ_MUST_USE bool classDefinition(bool expr, HandleValue name, HandleValue heritage,
[[nodiscard]] bool classDefinition(bool expr, HandleValue name, HandleValue heritage,
HandleValue block, TokenPos* pos, MutableHandleValue dst);
MOZ_MUST_USE bool classMembers(NodeVector& members, MutableHandleValue dst);
MOZ_MUST_USE bool classMethod(HandleValue name, HandleValue body, PropKind kind, bool isStatic,
[[nodiscard]] bool classMembers(NodeVector& members, MutableHandleValue dst);
[[nodiscard]] bool classMethod(HandleValue name, HandleValue body, PropKind kind, bool isStatic,
TokenPos* pos, MutableHandleValue dst);
MOZ_MUST_USE bool classField(HandleValue name, HandleValue initializer,
[[nodiscard]] bool classField(HandleValue name, HandleValue initializer,
TokenPos* pos, MutableHandleValue dst);
MOZ_MUST_USE bool staticClassBlock(HandleValue body, TokenPos* pos, MutableHandleValue dst);
[[nodiscard]] bool staticClassBlock(HandleValue body, TokenPos* pos, MutableHandleValue dst);
/*
* expressions
*/
MOZ_MUST_USE bool binaryExpression(BinaryOperator op, HandleValue left, HandleValue right,
[[nodiscard]] bool binaryExpression(BinaryOperator op, HandleValue left, HandleValue right,
TokenPos* pos, MutableHandleValue dst);
MOZ_MUST_USE bool unaryExpression(UnaryOperator op, HandleValue expr, TokenPos* pos,
[[nodiscard]] bool unaryExpression(UnaryOperator op, HandleValue expr, TokenPos* pos,
MutableHandleValue dst);
MOZ_MUST_USE bool assignmentExpression(AssignmentOperator op, HandleValue lhs, HandleValue rhs,
[[nodiscard]] bool assignmentExpression(AssignmentOperator op, HandleValue lhs, HandleValue rhs,
TokenPos* pos, MutableHandleValue dst);
MOZ_MUST_USE bool updateExpression(HandleValue expr, bool incr, bool prefix, TokenPos* pos,
[[nodiscard]] bool updateExpression(HandleValue expr, bool incr, bool prefix, TokenPos* pos,
MutableHandleValue dst);
MOZ_MUST_USE bool logicalExpression(ParseNodeKind kind, HandleValue left, HandleValue right, TokenPos* pos,
[[nodiscard]] bool logicalExpression(ParseNodeKind kind, HandleValue left, HandleValue right, TokenPos* pos,
MutableHandleValue dst);
MOZ_MUST_USE bool conditionalExpression(HandleValue test, HandleValue cons, HandleValue alt,
[[nodiscard]] bool conditionalExpression(HandleValue test, HandleValue cons, HandleValue alt,
TokenPos* pos, MutableHandleValue dst);
MOZ_MUST_USE bool sequenceExpression(NodeVector& elts, TokenPos* pos, MutableHandleValue dst);
[[nodiscard]] bool sequenceExpression(NodeVector& elts, TokenPos* pos, MutableHandleValue dst);
MOZ_MUST_USE bool newExpression(HandleValue callee, NodeVector& args, TokenPos* pos,
[[nodiscard]] bool newExpression(HandleValue callee, NodeVector& args, TokenPos* pos,
MutableHandleValue dst);
MOZ_MUST_USE bool callExpression(HandleValue callee, NodeVector& args, TokenPos* pos,
[[nodiscard]] bool callExpression(HandleValue callee, NodeVector& args, TokenPos* pos,
MutableHandleValue dst, bool isOptional = false);
MOZ_MUST_USE bool memberExpression(bool computed, HandleValue expr, HandleValue member,
[[nodiscard]] bool memberExpression(bool computed, HandleValue expr, HandleValue member,
TokenPos* pos, MutableHandleValue dst,
bool isOptional = false);
MOZ_MUST_USE bool arrayExpression(NodeVector& elts, TokenPos* pos, MutableHandleValue dst);
[[nodiscard]] bool arrayExpression(NodeVector& elts, TokenPos* pos, MutableHandleValue dst);
MOZ_MUST_USE bool templateLiteral(NodeVector& elts, TokenPos* pos, MutableHandleValue dst);
[[nodiscard]] bool templateLiteral(NodeVector& elts, TokenPos* pos, MutableHandleValue dst);
MOZ_MUST_USE bool taggedTemplate(HandleValue callee, NodeVector& args, TokenPos* pos,
[[nodiscard]] bool taggedTemplate(HandleValue callee, NodeVector& args, TokenPos* pos,
MutableHandleValue dst);
MOZ_MUST_USE bool callSiteObj(NodeVector& raw, NodeVector& cooked, TokenPos* pos,
[[nodiscard]] bool callSiteObj(NodeVector& raw, NodeVector& cooked, TokenPos* pos,
MutableHandleValue dst);
MOZ_MUST_USE bool spreadExpression(HandleValue expr, TokenPos* pos, MutableHandleValue dst);
[[nodiscard]] bool spreadExpression(HandleValue expr, TokenPos* pos, MutableHandleValue dst);
MOZ_MUST_USE bool optionalExpression(HandleValue expr, TokenPos* pos, MutableHandleValue dst);
[[nodiscard]] bool optionalExpression(HandleValue expr, TokenPos* pos, MutableHandleValue dst);
MOZ_MUST_USE bool deleteOptionalExpression(HandleValue expr, TokenPos* pos,
[[nodiscard]] bool deleteOptionalExpression(HandleValue expr, TokenPos* pos,
MutableHandleValue dst);
MOZ_MUST_USE bool computedName(HandleValue name, TokenPos* pos, MutableHandleValue dst);
[[nodiscard]] bool computedName(HandleValue name, TokenPos* pos, MutableHandleValue dst);
MOZ_MUST_USE bool objectExpression(NodeVector& elts, TokenPos* pos, MutableHandleValue dst);
[[nodiscard]] bool objectExpression(NodeVector& elts, TokenPos* pos, MutableHandleValue dst);
MOZ_MUST_USE bool thisExpression(TokenPos* pos, MutableHandleValue dst);
[[nodiscard]] bool thisExpression(TokenPos* pos, MutableHandleValue dst);
MOZ_MUST_USE bool yieldExpression(HandleValue arg, YieldKind kind, TokenPos* pos,
[[nodiscard]] bool yieldExpression(HandleValue arg, YieldKind kind, TokenPos* pos,
MutableHandleValue dst);
MOZ_MUST_USE bool comprehensionBlock(HandleValue patt, HandleValue src, bool isForEach,
[[nodiscard]] bool comprehensionBlock(HandleValue patt, HandleValue src, bool isForEach,
bool isForOf, TokenPos* pos, MutableHandleValue dst);
MOZ_MUST_USE bool comprehensionIf(HandleValue test, TokenPos* pos, MutableHandleValue dst);
[[nodiscard]] bool comprehensionIf(HandleValue test, TokenPos* pos, MutableHandleValue dst);
MOZ_MUST_USE bool comprehensionExpression(HandleValue body, NodeVector& blocks,
[[nodiscard]] bool comprehensionExpression(HandleValue body, NodeVector& blocks,
HandleValue filter, bool isLegacy, TokenPos* pos,
MutableHandleValue dst);
MOZ_MUST_USE bool generatorExpression(HandleValue body, NodeVector& blocks, HandleValue filter,
[[nodiscard]] bool generatorExpression(HandleValue body, NodeVector& blocks, HandleValue filter,
bool isLegacy, TokenPos* pos, MutableHandleValue dst);
MOZ_MUST_USE bool metaProperty(HandleValue meta, HandleValue property, TokenPos* pos,
[[nodiscard]] bool metaProperty(HandleValue meta, HandleValue property, TokenPos* pos,
MutableHandleValue dst);
MOZ_MUST_USE bool callImportExpression(HandleValue ident, HandleValue arg, TokenPos* pos,
[[nodiscard]] bool callImportExpression(HandleValue ident, HandleValue arg, TokenPos* pos,
MutableHandleValue dst);
MOZ_MUST_USE bool super(TokenPos* pos, MutableHandleValue dst);
[[nodiscard]] bool super(TokenPos* pos, MutableHandleValue dst);
/*
* declarations
*/
MOZ_MUST_USE bool variableDeclaration(NodeVector& elts, VarDeclKind kind, TokenPos* pos,
[[nodiscard]] bool variableDeclaration(NodeVector& elts, VarDeclKind kind, TokenPos* pos,
MutableHandleValue dst);
/*
* patterns
*/
MOZ_MUST_USE bool arrayPattern(NodeVector& elts, TokenPos* pos, MutableHandleValue dst);
[[nodiscard]] bool arrayPattern(NodeVector& elts, TokenPos* pos, MutableHandleValue dst);
MOZ_MUST_USE bool objectPattern(NodeVector& elts, TokenPos* pos, MutableHandleValue dst);
[[nodiscard]] bool objectPattern(NodeVector& elts, TokenPos* pos, MutableHandleValue dst);
MOZ_MUST_USE bool propertyPattern(HandleValue key, HandleValue patt, bool isShorthand,
[[nodiscard]] bool propertyPattern(HandleValue key, HandleValue patt, bool isShorthand,
TokenPos* pos, MutableHandleValue dst);
};
+28 -28
View File
@@ -25,42 +25,42 @@ InitRegExpClass(JSContext* cx, HandleObject obj);
* |input| may be nullptr if there is no JSString corresponding to
* |chars| and |length|.
*/
MOZ_MUST_USE bool
[[nodiscard]] bool
ExecuteRegExpLegacy(JSContext* cx, RegExpStatics* res, Handle<RegExpObject*> reobj,
HandleLinearString input, size_t* lastIndex, bool test,
MutableHandleValue rval);
/* Translation from MatchPairs to a JS array in regexp_exec()'s output format. */
MOZ_MUST_USE bool
[[nodiscard]] bool
CreateRegExpMatchResult(JSContext* cx, RegExpShared& re,
HandleString input, const MatchPairs& matches,
MutableHandleValue rval);
extern MOZ_MUST_USE bool
[[nodiscard]] extern bool
RegExpMatcher(JSContext* cx, unsigned argc, Value* vp);
extern MOZ_MUST_USE bool
[[nodiscard]] extern bool
RegExpMatcherRaw(JSContext* cx, HandleObject regexp, HandleString input,
int32_t lastIndex, MatchPairs* maybeMatches, MutableHandleValue output);
extern MOZ_MUST_USE bool
[[nodiscard]] extern bool
RegExpSearcher(JSContext* cx, unsigned argc, Value* vp);
extern MOZ_MUST_USE bool
[[nodiscard]] extern bool
RegExpSearcherRaw(JSContext* cx, HandleObject regexp, HandleString input,
int32_t lastIndex, MatchPairs* maybeMatches, int32_t* result);
extern MOZ_MUST_USE bool
[[nodiscard]] extern bool
RegExpTester(JSContext* cx, unsigned argc, Value* vp);
extern MOZ_MUST_USE bool
[[nodiscard]] extern bool
RegExpTesterRaw(JSContext* cx, HandleObject regexp, HandleString input,
int32_t lastIndex, int32_t* endIndex);
extern MOZ_MUST_USE bool
[[nodiscard]] extern bool
intrinsic_GetElemBaseForLambda(JSContext* cx, unsigned argc, Value* vp);
extern MOZ_MUST_USE bool
[[nodiscard]] extern bool
intrinsic_GetStringDataProperty(JSContext* cx, unsigned argc, Value* vp);
/*
@@ -73,67 +73,67 @@ intrinsic_GetStringDataProperty(JSContext* cx, unsigned argc, Value* vp);
* Must be called without |new|.
* Dedicated function for RegExp.prototype[@@split] optimized path.
*/
extern MOZ_MUST_USE bool
[[nodiscard]] extern bool
regexp_construct_raw_flags(JSContext* cx, unsigned argc, Value* vp);
/*
* Clone given RegExp object, inheriting pattern and flags, ignoring other
* properties.
*/
extern MOZ_MUST_USE bool
[[nodiscard]] extern bool
regexp_clone(JSContext* cx, unsigned argc, Value* vp);
extern MOZ_MUST_USE bool
[[nodiscard]] extern bool
IsRegExp(JSContext* cx, HandleValue value, bool* result);
extern MOZ_MUST_USE bool
[[nodiscard]] extern bool
RegExpCreate(JSContext* cx, HandleValue pattern, HandleValue flags, MutableHandleValue rval);
extern MOZ_MUST_USE bool
[[nodiscard]] extern bool
RegExpPrototypeOptimizable(JSContext* cx, unsigned argc, Value* vp);
extern MOZ_MUST_USE bool
[[nodiscard]] extern bool
RegExpPrototypeOptimizableRaw(JSContext* cx, JSObject* proto);
extern MOZ_MUST_USE bool
[[nodiscard]] extern bool
RegExpInstanceOptimizable(JSContext* cx, unsigned argc, Value* vp);
extern MOZ_MUST_USE bool
[[nodiscard]] extern bool
RegExpInstanceOptimizableRaw(JSContext* cx, JSObject* obj, JSObject* proto);
extern MOZ_MUST_USE bool
[[nodiscard]] extern bool
RegExpGetSubstitution(JSContext* cx, HandleArrayObject matchResult, HandleLinearString string,
size_t position, HandleLinearString replacement, size_t firstDollarIndex,
HandleValue namedCaptures, MutableHandleValue rval);
extern MOZ_MUST_USE bool
[[nodiscard]] extern bool
GetFirstDollarIndex(JSContext* cx, unsigned argc, Value* vp);
extern MOZ_MUST_USE bool
[[nodiscard]] extern bool
GetFirstDollarIndexRaw(JSContext* cx, HandleString str, int32_t* index);
extern int32_t
GetFirstDollarIndexRawFlat(JSLinearString* text);
// RegExp ClassSpec members used in RegExpObject.cpp.
extern MOZ_MUST_USE bool
[[nodiscard]] extern bool
regexp_construct(JSContext* cx, unsigned argc, Value* vp);
extern const JSPropertySpec regexp_static_props[];
extern const JSPropertySpec regexp_properties[];
extern const JSFunctionSpec regexp_methods[];
// Used in RegExpObject::isOriginalFlagGetter.
extern MOZ_MUST_USE bool
[[nodiscard]] extern bool
regexp_global(JSContext* cx, unsigned argc, JS::Value* vp);
extern MOZ_MUST_USE bool
[[nodiscard]] extern bool
regexp_ignoreCase(JSContext* cx, unsigned argc, JS::Value* vp);
extern MOZ_MUST_USE bool
[[nodiscard]] extern bool
regexp_multiline(JSContext* cx, unsigned argc, JS::Value* vp);
extern MOZ_MUST_USE bool
[[nodiscard]] extern bool
regexp_sticky(JSContext* cx, unsigned argc, JS::Value* vp);
extern MOZ_MUST_USE bool
[[nodiscard]] extern bool
regexp_unicode(JSContext* cx, unsigned argc, JS::Value* vp);
extern MOZ_MUST_USE bool
[[nodiscard]] extern bool
regexp_dotAll(JSContext* cx, unsigned argc, JS::Value* vp);
} /* namespace js */
+147 -147
View File
File diff suppressed because it is too large. Load diff
+26 -26
View File
@@ -37,31 +37,31 @@ class ReadableStream : public NativeObject
JS::ReadableStreamMode mode() const;
static MOZ_MUST_USE bool close(JSContext* cx, Handle<ReadableStream*> stream);
static MOZ_MUST_USE JSObject* cancel(JSContext* cx, Handle<ReadableStream*> stream,
HandleValue reason);
static MOZ_MUST_USE bool error(JSContext* cx, Handle<ReadableStream*> stream,
HandleValue error);
[[nodiscard]] static bool close(JSContext* cx, Handle<ReadableStream*> stream);
[[nodiscard]] static JSObject* cancel(JSContext* cx, Handle<ReadableStream*> stream,
HandleValue reason);
[[nodiscard]] static bool error(JSContext* cx, Handle<ReadableStream*> stream,
HandleValue error);
static MOZ_MUST_USE NativeObject* getReader(JSContext* cx, Handle<ReadableStream*> stream,
JS::ReadableStreamReaderMode mode);
[[nodiscard]] static NativeObject* getReader(JSContext* cx, Handle<ReadableStream*> stream,
JS::ReadableStreamReaderMode mode);
static MOZ_MUST_USE bool tee(JSContext* cx,
Handle<ReadableStream*> stream, bool cloneForBranch2,
MutableHandle<ReadableStream*> branch1Stream,
MutableHandle<ReadableStream*> branch2Stream);
[[nodiscard]] static bool tee(JSContext* cx,
Handle<ReadableStream*> stream, bool cloneForBranch2,
MutableHandle<ReadableStream*> branch1Stream,
MutableHandle<ReadableStream*> branch2Stream);
static MOZ_MUST_USE bool enqueue(JSContext* cx, Handle<ReadableStream*> stream,
HandleValue chunk);
static MOZ_MUST_USE bool enqueueBuffer(JSContext* cx, Handle<ReadableStream*> stream,
Handle<ArrayBufferObject*> chunk);
static MOZ_MUST_USE bool getExternalSource(JSContext* cx, Handle<ReadableStream*> stream,
void** source);
[[nodiscard]] static bool enqueue(JSContext* cx, Handle<ReadableStream*> stream,
HandleValue chunk);
[[nodiscard]] static bool enqueueBuffer(JSContext* cx, Handle<ReadableStream*> stream,
Handle<ArrayBufferObject*> chunk);
[[nodiscard]] static bool getExternalSource(JSContext* cx, Handle<ReadableStream*> stream,
void** source);
void releaseExternalSource();
uint8_t embeddingFlags() const;
static MOZ_MUST_USE bool updateDataAvailableFromSource(JSContext* cx,
Handle<ReadableStream*> stream,
uint32_t availableData);
[[nodiscard]] static bool updateDataAvailableFromSource(JSContext* cx,
Handle<ReadableStream*> stream,
uint32_t availableData);
enum State {
Readable = 1 << 0,
@@ -71,7 +71,7 @@ class ReadableStream : public NativeObject
};
private:
static MOZ_MUST_USE ReadableStream* createStream(JSContext* cx, HandleObject proto = nullptr);
[[nodiscard]] static ReadableStream* createStream(JSContext* cx, HandleObject proto = nullptr);
public:
static bool constructor(JSContext* cx, unsigned argc, Value* vp);
@@ -84,7 +84,7 @@ class ReadableStream : public NativeObject
class ReadableStreamDefaultReader : public NativeObject
{
public:
static MOZ_MUST_USE JSObject* read(JSContext* cx, Handle<ReadableStreamDefaultReader*> reader);
[[nodiscard]] static JSObject* read(JSContext* cx, Handle<ReadableStreamDefaultReader*> reader);
static bool constructor(JSContext* cx, unsigned argc, Value* vp);
static const ClassSpec classSpec_;
@@ -96,8 +96,8 @@ class ReadableStreamDefaultReader : public NativeObject
class ReadableStreamBYOBReader : public NativeObject
{
public:
static MOZ_MUST_USE JSObject* read(JSContext* cx, Handle<ReadableStreamBYOBReader*> reader,
Handle<ArrayBufferViewObject*> view);
[[nodiscard]] static JSObject* read(JSContext* cx, Handle<ReadableStreamBYOBReader*> reader,
Handle<ArrayBufferViewObject*> view);
static bool constructor(JSContext* cx, unsigned argc, Value* vp);
static const ClassSpec classSpec_;
@@ -108,10 +108,10 @@ class ReadableStreamBYOBReader : public NativeObject
bool ReadableStreamReaderIsClosed(const JSObject* reader);
MOZ_MUST_USE bool ReadableStreamReaderCancel(JSContext* cx, HandleObject reader,
[[nodiscard]] bool ReadableStreamReaderCancel(JSContext* cx, HandleObject reader,
HandleValue reason);
MOZ_MUST_USE bool ReadableStreamReaderReleaseLock(JSContext* cx, HandleObject reader);
[[nodiscard]] bool ReadableStreamReaderReleaseLock(JSContext* cx, HandleObject reader);
class ReadableStreamDefaultController : public NativeObject
{
+10 -10
View File
@@ -38,22 +38,22 @@ class SymbolObject : public NativeObject
setFixedSlot(PRIMITIVE_VALUE_SLOT, SymbolValue(symbol));
}
static MOZ_MUST_USE bool construct(JSContext* cx, unsigned argc, Value* vp);
static [[nodiscard]] bool construct(JSContext* cx, unsigned argc, Value* vp);
// Static methods.
static MOZ_MUST_USE bool for_(JSContext* cx, unsigned argc, Value* vp);
static MOZ_MUST_USE bool keyFor(JSContext* cx, unsigned argc, Value* vp);
static [[nodiscard]] bool for_(JSContext* cx, unsigned argc, Value* vp);
static [[nodiscard]] bool keyFor(JSContext* cx, unsigned argc, Value* vp);
// Methods defined on Symbol.prototype.
static MOZ_MUST_USE bool toString_impl(JSContext* cx, const CallArgs& args);
static MOZ_MUST_USE bool toString(JSContext* cx, unsigned argc, Value* vp);
static MOZ_MUST_USE bool valueOf_impl(JSContext* cx, const CallArgs& args);
static MOZ_MUST_USE bool valueOf(JSContext* cx, unsigned argc, Value* vp);
static MOZ_MUST_USE bool toPrimitive(JSContext* cx, unsigned argc, Value* vp);
static [[nodiscard]] bool toString_impl(JSContext* cx, const CallArgs& args);
static [[nodiscard]] bool toString(JSContext* cx, unsigned argc, Value* vp);
static [[nodiscard]] bool valueOf_impl(JSContext* cx, const CallArgs& args);
static [[nodiscard]] bool valueOf(JSContext* cx, unsigned argc, Value* vp);
static [[nodiscard]] bool toPrimitive(JSContext* cx, unsigned argc, Value* vp);
// Properties defined on Symbol.prototype.
static MOZ_MUST_USE bool descriptionGetter_impl(JSContext* cx, const CallArgs& args);
static MOZ_MUST_USE bool descriptionGetter(JSContext* cx, unsigned argc, Value *vp);
static [[nodiscard]] bool descriptionGetter_impl(JSContext* cx, const CallArgs& args);
static [[nodiscard]] bool descriptionGetter(JSContext* cx, unsigned argc, Value *vp);
static const JSPropertySpec properties[];
static const JSFunctionSpec methods[];
+3 -3
View File
@@ -10,13 +10,13 @@
namespace js {
MOZ_MUST_USE bool
[[nodiscard]] bool
DefineTestingFunctions(JSContext* cx, HandleObject obj, bool fuzzingSafe, bool disableOOMFunctions);
MOZ_MUST_USE bool
[[nodiscard]] bool
testingFunc_assertFloat32(JSContext* cx, unsigned argc, Value* vp);
MOZ_MUST_USE bool
[[nodiscard]] bool
testingFunc_assertRecoveredOnBailout(JSContext* cx, unsigned argc, Value* vp);
} /* namespace js */
+59 -59
View File
@@ -176,7 +176,7 @@ class TypeDescr : public NativeObject
}
// Whether id is an 'own' property of objects with this descriptor.
MOZ_MUST_USE bool hasProperty(const JSAtomState& names, jsid id);
[[nodiscard]] bool hasProperty(const JSAtomState& names, jsid id);
// Type descriptors may contain a list of their references for use during
// scanning. Marking code is optimized to use this list to mark inline
@@ -188,7 +188,7 @@ class TypeDescr : public NativeObject
// The list is three consecutive arrays of int32_t offsets, with each array
// terminated by -1. The arrays store offsets of string, object, and value
// references in the descriptor, in that order.
MOZ_MUST_USE bool hasTraceList() const {
[[nodiscard]] bool hasTraceList() const {
return !getFixedSlot(JS_DESCR_SLOT_TRACE_LIST).isUndefined();
}
const int32_t* traceList() const {
@@ -257,7 +257,7 @@ class ScalarTypeDescr : public SimpleTypeDescr
return Type(getReservedSlot(JS_DESCR_SLOT_TYPE).toInt32());
}
static MOZ_MUST_USE bool call(JSContext* cx, unsigned argc, Value* vp);
[[nodiscard]] static bool call(JSContext* cx, unsigned argc, Value* vp);
};
// Enumerates the cases of ScalarTypeDescr::Type which have
@@ -310,7 +310,7 @@ class ReferenceTypeDescr : public SimpleTypeDescr
return typeName(type());
}
static MOZ_MUST_USE bool call(JSContext* cx, unsigned argc, Value* vp);
[[nodiscard]] static bool call(JSContext* cx, unsigned argc, Value* vp);
};
#define JS_FOR_EACH_REFERENCE_TYPE_REPR(macro_) \
@@ -333,7 +333,7 @@ class ComplexTypeDescr : public TypeDescr
bool IsTypedObjectClass(const Class* clasp); // Defined below
bool IsTypedObjectArray(JSObject& obj);
MOZ_MUST_USE bool CreateUserSizeAndAlignmentProperties(JSContext* cx, HandleTypeDescr obj);
[[nodiscard]] bool CreateUserSizeAndAlignmentProperties(JSContext* cx, HandleTypeDescr obj);
class ArrayTypeDescr;
@@ -371,7 +371,7 @@ class ArrayMetaTypeDescr : public NativeObject
// This is the function that gets called when the user
// does `new ArrayType(elem)`. It produces an array type object.
static MOZ_MUST_USE bool construct(JSContext* cx, unsigned argc, Value* vp);
[[nodiscard]] static bool construct(JSContext* cx, unsigned argc, Value* vp);
};
/*
@@ -422,7 +422,7 @@ class StructMetaTypeDescr : public NativeObject
// This is the function that gets called when the user
// does `new StructType(...)`. It produces a struct type object.
static MOZ_MUST_USE bool construct(JSContext* cx, unsigned argc, Value* vp);
[[nodiscard]] static bool construct(JSContext* cx, unsigned argc, Value* vp);
};
class StructTypeDescr : public ComplexTypeDescr
@@ -435,7 +435,7 @@ class StructTypeDescr : public ComplexTypeDescr
// Set `*out` to the index of the field named `id` and returns true,
// or return false if no such field exists.
MOZ_MUST_USE bool fieldIndex(jsid id, size_t* out) const;
[[nodiscard]] bool fieldIndex(jsid id, size_t* out) const;
// Return the name of the field at index `index`.
JSAtom& fieldName(size_t index) const;
@@ -475,45 +475,45 @@ class TypedObject : public ShapedObject
{
static const bool IsTypedObjectClass = true;
static MOZ_MUST_USE bool obj_getArrayElement(JSContext* cx,
Handle<TypedObject*> typedObj,
Handle<TypeDescr*> typeDescr,
uint32_t index,
MutableHandleValue vp);
[[nodiscard]] static bool obj_getArrayElement(JSContext* cx,
Handle<TypedObject*> typedObj,
Handle<TypeDescr*> typeDescr,
uint32_t index,
MutableHandleValue vp);
protected:
static const ObjectOps objectOps_;
static MOZ_MUST_USE bool obj_lookupProperty(JSContext* cx, HandleObject obj,
HandleId id, MutableHandleObject objp,
MutableHandle<PropertyResult> propp);
[[nodiscard]] static bool obj_lookupProperty(JSContext* cx, HandleObject obj,
HandleId id, MutableHandleObject objp,
MutableHandle<PropertyResult> propp);
static MOZ_MUST_USE bool obj_defineProperty(JSContext* cx, HandleObject obj, HandleId id,
Handle<PropertyDescriptor> desc,
ObjectOpResult& result);
[[nodiscard]] static bool obj_defineProperty(JSContext* cx, HandleObject obj, HandleId id,
Handle<PropertyDescriptor> desc,
ObjectOpResult& result);
static MOZ_MUST_USE bool obj_hasProperty(JSContext* cx, HandleObject obj, HandleId id,
bool* foundp);
[[nodiscard]] static bool obj_hasProperty(JSContext* cx, HandleObject obj, HandleId id,
bool* foundp);
static MOZ_MUST_USE bool obj_getProperty(JSContext* cx, HandleObject obj, HandleValue receiver,
HandleId id, MutableHandleValue vp);
[[nodiscard]] static bool obj_getProperty(JSContext* cx, HandleObject obj, HandleValue receiver,
HandleId id, MutableHandleValue vp);
static MOZ_MUST_USE bool obj_getElement(JSContext* cx, HandleObject obj, HandleValue receiver,
uint32_t index, MutableHandleValue vp);
[[nodiscard]] static bool obj_getElement(JSContext* cx, HandleObject obj, HandleValue receiver,
uint32_t index, MutableHandleValue vp);
static MOZ_MUST_USE bool obj_setProperty(JSContext* cx, HandleObject obj, HandleId id,
HandleValue v, HandleValue receiver,
ObjectOpResult& result);
[[nodiscard]] static bool obj_setProperty(JSContext* cx, HandleObject obj, HandleId id,
HandleValue v, HandleValue receiver,
ObjectOpResult& result);
static MOZ_MUST_USE bool obj_getOwnPropertyDescriptor(JSContext* cx, HandleObject obj,
HandleId id,
MutableHandle<PropertyDescriptor> desc);
[[nodiscard]] static bool obj_getOwnPropertyDescriptor(JSContext* cx, HandleObject obj,
HandleId id,
MutableHandle<PropertyDescriptor> desc);
static MOZ_MUST_USE bool obj_deleteProperty(JSContext* cx, HandleObject obj, HandleId id,
ObjectOpResult& result);
[[nodiscard]] static bool obj_deleteProperty(JSContext* cx, HandleObject obj, HandleId id,
ObjectOpResult& result);
static MOZ_MUST_USE bool obj_enumerate(JSContext* cx, HandleObject obj,
AutoIdVector& properties, bool enumerableOnly);
[[nodiscard]] static bool obj_enumerate(JSContext* cx, HandleObject obj,
AutoIdVector& properties, bool enumerableOnly);
uint8_t* typedMem() const;
@@ -548,7 +548,7 @@ class TypedObject : public ShapedObject
return typedMem(nogc) + offset;
}
inline MOZ_MUST_USE bool opaque() const;
[[nodiscard]] inline bool opaque() const;
// Creates a new typed object whose memory is freshly allocated and
// initialized with zeroes (or, in the case of references, an appropriate
@@ -558,11 +558,11 @@ class TypedObject : public ShapedObject
// User-accessible constructor (`new TypeDescriptor(...)`). Note that the
// callee here is the type descriptor.
static MOZ_MUST_USE bool construct(JSContext* cx, unsigned argc, Value* vp);
[[nodiscard]] static bool construct(JSContext* cx, unsigned argc, Value* vp);
/* Accessors for self hosted code. */
static MOZ_MUST_USE bool GetBuffer(JSContext* cx, unsigned argc, Value* vp);
static MOZ_MUST_USE bool GetByteOffset(JSContext* cx, unsigned argc, Value* vp);
[[nodiscard]] static bool GetBuffer(JSContext* cx, unsigned argc, Value* vp);
[[nodiscard]] static bool GetByteOffset(JSContext* cx, unsigned argc, Value* vp);
Shape** addressOfShapeFromGC() { return shape_.unsafeUnbarrieredForTracing(); }
};
@@ -733,14 +733,14 @@ class InlineOpaqueTypedObject : public InlineTypedObject
*
* Constructs a new, unattached instance of `Handle`.
*/
MOZ_MUST_USE bool NewOpaqueTypedObject(JSContext* cx, unsigned argc, Value* vp);
[[nodiscard]] bool NewOpaqueTypedObject(JSContext* cx, unsigned argc, Value* vp);
/*
* Usage: NewDerivedTypedObject(typeObj, owner, offset)
*
* Constructs a new, unattached instance of `Handle`.
*/
MOZ_MUST_USE bool NewDerivedTypedObject(JSContext* cx, unsigned argc, Value* vp);
[[nodiscard]] bool NewDerivedTypedObject(JSContext* cx, unsigned argc, Value* vp);
/*
* Usage: AttachTypedObject(typedObj, newDatum, newOffset)
@@ -748,7 +748,7 @@ MOZ_MUST_USE bool NewDerivedTypedObject(JSContext* cx, unsigned argc, Value* vp)
* Moves `typedObj` to point at the memory referenced by `newDatum` with
* the offset `newOffset`.
*/
MOZ_MUST_USE bool AttachTypedObject(JSContext* cx, unsigned argc, Value* vp);
[[nodiscard]] bool AttachTypedObject(JSContext* cx, unsigned argc, Value* vp);
/*
* Usage: SetTypedObjectOffset(typedObj, offset)
@@ -756,41 +756,41 @@ MOZ_MUST_USE bool AttachTypedObject(JSContext* cx, unsigned argc, Value* vp);
* Changes the offset for `typedObj` within its buffer to `offset`.
* `typedObj` must already be attached.
*/
MOZ_MUST_USE bool SetTypedObjectOffset(JSContext*, unsigned argc, Value* vp);
[[nodiscard]] bool SetTypedObjectOffset(JSContext*, unsigned argc, Value* vp);
/*
* Usage: ObjectIsTypeDescr(obj)
*
* True if `obj` is a type object.
*/
MOZ_MUST_USE bool ObjectIsTypeDescr(JSContext* cx, unsigned argc, Value* vp);
[[nodiscard]] bool ObjectIsTypeDescr(JSContext* cx, unsigned argc, Value* vp);
/*
* Usage: ObjectIsTypedObject(obj)
*
* True if `obj` is a transparent or opaque typed object.
*/
MOZ_MUST_USE bool ObjectIsTypedObject(JSContext* cx, unsigned argc, Value* vp);
[[nodiscard]] bool ObjectIsTypedObject(JSContext* cx, unsigned argc, Value* vp);
/*
* Usage: ObjectIsOpaqueTypedObject(obj)
*
* True if `obj` is an opaque typed object.
*/
MOZ_MUST_USE bool ObjectIsOpaqueTypedObject(JSContext* cx, unsigned argc, Value* vp);
[[nodiscard]] bool ObjectIsOpaqueTypedObject(JSContext* cx, unsigned argc, Value* vp);
/*
* Usage: ObjectIsTransparentTypedObject(obj)
*
* True if `obj` is a transparent typed object.
*/
MOZ_MUST_USE bool ObjectIsTransparentTypedObject(JSContext* cx, unsigned argc, Value* vp);
[[nodiscard]] bool ObjectIsTransparentTypedObject(JSContext* cx, unsigned argc, Value* vp);
/* Predicates on type descriptor objects. In all cases, 'obj' must be a type descriptor. */
MOZ_MUST_USE bool TypeDescrIsSimpleType(JSContext*, unsigned argc, Value* vp);
[[nodiscard]] bool TypeDescrIsSimpleType(JSContext*, unsigned argc, Value* vp);
MOZ_MUST_USE bool TypeDescrIsArrayType(JSContext*, unsigned argc, Value* vp);
[[nodiscard]] bool TypeDescrIsArrayType(JSContext*, unsigned argc, Value* vp);
/*
* Usage: TypedObjectIsAttached(obj)
@@ -798,21 +798,21 @@ MOZ_MUST_USE bool TypeDescrIsArrayType(JSContext*, unsigned argc, Value* vp);
* Given a TypedObject `obj`, returns true if `obj` is
* "attached" (i.e., its data pointer is nullptr).
*/
MOZ_MUST_USE bool TypedObjectIsAttached(JSContext* cx, unsigned argc, Value* vp);
[[nodiscard]] bool TypedObjectIsAttached(JSContext* cx, unsigned argc, Value* vp);
/*
* Usage: TypedObjectTypeDescr(obj)
*
* Given a TypedObject `obj`, returns the object's type descriptor.
*/
MOZ_MUST_USE bool TypedObjectTypeDescr(JSContext* cx, unsigned argc, Value* vp);
[[nodiscard]] bool TypedObjectTypeDescr(JSContext* cx, unsigned argc, Value* vp);
/*
* Usage: ClampToUint8(v)
*
* Same as the C function ClampDoubleToUint8. `v` must be a number.
*/
MOZ_MUST_USE bool ClampToUint8(JSContext* cx, unsigned argc, Value* vp);
[[nodiscard]] bool ClampToUint8(JSContext* cx, unsigned argc, Value* vp);
/*
* Usage: GetTypedObjectModule()
@@ -823,7 +823,7 @@ MOZ_MUST_USE bool ClampToUint8(JSContext* cx, unsigned argc, Value* vp);
* to access them; eventually this should be linked into the module
* system.
*/
MOZ_MUST_USE bool GetTypedObjectModule(JSContext* cx, unsigned argc, Value* vp);
[[nodiscard]] bool GetTypedObjectModule(JSContext* cx, unsigned argc, Value* vp);
/*
* Usage: Store_int8(targetDatum, targetOffset, value)
@@ -844,7 +844,7 @@ MOZ_MUST_USE bool GetTypedObjectModule(JSContext* cx, unsigned argc, Value* vp);
#define JS_STORE_SCALAR_CLASS_DEFN(_constant, T, _name) \
class StoreScalar##T { \
public: \
static MOZ_MUST_USE bool Func(JSContext* cx, unsigned argc, Value* vp); \
[[nodiscard]] static bool Func(JSContext* cx, unsigned argc, Value* vp); \
static const JSJitInfo JitInfo; \
};
@@ -864,11 +864,11 @@ class StoreScalar##T { \
#define JS_STORE_REFERENCE_CLASS_DEFN(_constant, T, _name) \
class StoreReference##_name { \
private: \
static MOZ_MUST_USE bool store(JSContext* cx, T* heap, const Value& v, \
TypedObject* obj, jsid id); \
[[nodiscard]] static bool store(JSContext* cx, T* heap, const Value& v, \
TypedObject* obj, jsid id); \
\
public: \
static MOZ_MUST_USE bool Func(JSContext* cx, unsigned argc, Value* vp); \
[[nodiscard]] static bool Func(JSContext* cx, unsigned argc, Value* vp); \
static const JSJitInfo JitInfo; \
};
@@ -883,7 +883,7 @@ class StoreReference##_name { \
#define JS_LOAD_SCALAR_CLASS_DEFN(_constant, T, _name) \
class LoadScalar##T { \
public: \
static MOZ_MUST_USE bool Func(JSContext* cx, unsigned argc, Value* vp); \
[[nodiscard]] static bool Func(JSContext* cx, unsigned argc, Value* vp); \
static const JSJitInfo JitInfo; \
};
@@ -901,7 +901,7 @@ class LoadReference##_name { \
static void load(T* heap, MutableHandleValue v); \
\
public: \
static MOZ_MUST_USE bool Func(JSContext* cx, unsigned argc, Value* vp); \
[[nodiscard]] static bool Func(JSContext* cx, unsigned argc, Value* vp); \
static const JSJitInfo JitInfo; \
};
+1 -1
View File
@@ -23,7 +23,7 @@ class WeakSetObject : public NativeObject
static const JSFunctionSpec methods[];
static WeakSetObject* create(JSContext* cx, HandleObject proto = nullptr);
static MOZ_MUST_USE bool construct(JSContext* cx, unsigned argc, Value* vp);
[[nodiscard]] static bool construct(JSContext* cx, unsigned argc, Value* vp);
static bool isBuiltinAdd(HandleValue add, JSContext* cx);
};
+4 -4
View File
@@ -49,7 +49,7 @@ CreateCollatorPrototype(JSContext* cx, JS::Handle<JSObject*> Intl,
*
* Usage: collator = intl_Collator(locales, options)
*/
extern MOZ_MUST_USE bool
[[nodiscard]] extern bool
intl_Collator(JSContext* cx, unsigned argc, Value* vp);
/**
@@ -60,7 +60,7 @@ intl_Collator(JSContext* cx, unsigned argc, Value* vp);
*
* Usage: collations = intl_availableCollations(locale)
*/
extern MOZ_MUST_USE bool
[[nodiscard]] extern bool
intl_availableCollations(JSContext* cx, unsigned argc, Value* vp);
/**
@@ -73,7 +73,7 @@ intl_availableCollations(JSContext* cx, unsigned argc, Value* vp);
*
* Usage: result = intl_CompareStrings(collator, x, y)
*/
extern MOZ_MUST_USE bool
[[nodiscard]] extern bool
intl_CompareStrings(JSContext* cx, unsigned argc, Value* vp);
/**
@@ -82,7 +82,7 @@ intl_CompareStrings(JSContext* cx, unsigned argc, Value* vp);
*
* Usage: result = intl_isUpperCaseFirst(locale)
*/
extern MOZ_MUST_USE bool
[[nodiscard]] extern bool
intl_isUpperCaseFirst(JSContext* cx, unsigned argc, Value* vp);
+10 -10
View File
@@ -51,7 +51,7 @@ CreateDateTimeFormatPrototype(JSContext* cx, JS::Handle<JSObject*> Intl,
*
* Usage: dateTimeFormat = intl_DateTimeFormat(locales, options)
*/
extern MOZ_MUST_USE bool
[[nodiscard]] extern bool
intl_DateTimeFormat(JSContext* cx, unsigned argc, Value* vp);
/**
@@ -62,7 +62,7 @@ intl_DateTimeFormat(JSContext* cx, unsigned argc, Value* vp);
*
* Usage: calendars = intl_availableCalendars(locale)
*/
extern MOZ_MUST_USE bool
[[nodiscard]] extern bool
intl_availableCalendars(JSContext* cx, unsigned argc, Value* vp);
/**
@@ -72,7 +72,7 @@ intl_availableCalendars(JSContext* cx, unsigned argc, Value* vp);
*
* Usage: calendar = intl_defaultCalendar(locale)
*/
extern MOZ_MUST_USE bool
[[nodiscard]] extern bool
intl_defaultCalendar(JSContext* cx, unsigned argc, Value* vp);
/**
@@ -85,7 +85,7 @@ intl_defaultCalendar(JSContext* cx, unsigned argc, Value* vp);
*
* Usage: ianaTimeZone = intl_IsValidTimeZoneName(timeZone)
*/
extern MOZ_MUST_USE bool
[[nodiscard]] extern bool
intl_IsValidTimeZoneName(JSContext* cx, unsigned argc, Value* vp);
/**
@@ -94,7 +94,7 @@ intl_IsValidTimeZoneName(JSContext* cx, unsigned argc, Value* vp);
*
* Usage: ianaTimeZone = intl_canonicalizeTimeZone(timeZone)
*/
extern MOZ_MUST_USE bool
[[nodiscard]] extern bool
intl_canonicalizeTimeZone(JSContext* cx, unsigned argc, Value* vp);
/**
@@ -102,7 +102,7 @@ intl_canonicalizeTimeZone(JSContext* cx, unsigned argc, Value* vp);
*
* Usage: icuDefaultTimeZone = intl_defaultTimeZone()
*/
extern MOZ_MUST_USE bool
[[nodiscard]] extern bool
intl_defaultTimeZone(JSContext* cx, unsigned argc, Value* vp);
/**
@@ -110,7 +110,7 @@ intl_defaultTimeZone(JSContext* cx, unsigned argc, Value* vp);
*
* Usage: defaultTimeZoneOffset = intl_defaultTimeZoneOffset()
*/
extern MOZ_MUST_USE bool
[[nodiscard]] extern bool
intl_defaultTimeZoneOffset(JSContext* cx, unsigned argc, Value* vp);
/**
@@ -121,7 +121,7 @@ intl_defaultTimeZoneOffset(JSContext* cx, unsigned argc, Value* vp);
*
* Usage: pattern = intl_patternForSkeleton(locale, skeleton, hourCycle)
*/
extern MOZ_MUST_USE bool
[[nodiscard]] extern bool
intl_patternForSkeleton(JSContext* cx, unsigned argc, Value* vp);
/**
@@ -155,7 +155,7 @@ intl_patternForSkeleton(JSContext* cx, unsigned argc, Value* vp);
* Usage: pattern = intl_patternForStyle(locale, dateStyle, timeStyle, timeZone,
* hour12, hourCycle)
*/
extern MOZ_MUST_USE bool
[[nodiscard]] extern bool
intl_patternForStyle(JSContext* cx, unsigned argc, Value* vp);
/**
@@ -167,7 +167,7 @@ intl_patternForStyle(JSContext* cx, unsigned argc, Value* vp);
*
* Usage: formatted = intl_FormatDateTime(dateTimeFormat, x, formatToParts)
*/
extern MOZ_MUST_USE bool
[[nodiscard]] extern bool
intl_FormatDateTime(JSContext* cx, unsigned argc, Value* vp);
Loaded 100 of 669 files, more files were not shown because too many files have changed in this diff. Show more