Remove unused patches
(cherry picked from commit 36c5f2216ba0852d7f2ad5699fd378a21e4186df)
This commit is contained in:
parent
26533321c2
commit
e74c487d55
@ -1,74 +0,0 @@
|
||||
# HG changeset patch
|
||||
# User Lars T Hansen <lhansen@mozilla.com>
|
||||
# Date 1519822672 -3600
|
||||
# Wed Feb 28 13:57:52 2018 +0100
|
||||
# Node ID 672f0415217b202ae59a930769dffd9d6ba6b87c
|
||||
# Parent 825fd04dacc6297d3a980ec4184079405950b35d
|
||||
Bug 1375074 - Save and restore non-volatile x28 on ARM64 for generated unboxed object constructor.
|
||||
|
||||
diff --git a/js/src/jit-test/tests/bug1375074.js b/js/src/jit-test/tests/bug1375074.js
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/js/src/jit-test/tests/bug1375074.js
|
||||
@@ -0,0 +1,18 @@
|
||||
+// This forces the VM to start creating unboxed objects and thus stresses a
|
||||
+// particular path into generated code for a specialized unboxed object
|
||||
+// constructor.
|
||||
+
|
||||
+var K = 2000; // 2000 should be plenty
|
||||
+var s = "[";
|
||||
+var i;
|
||||
+for ( i=0; i < K-1; i++ )
|
||||
+ s = s + `{"i":${i}},`;
|
||||
+s += `{"i":${i}}]`;
|
||||
+var v = JSON.parse(s);
|
||||
+
|
||||
+assertEq(v.length == K, true);
|
||||
+
|
||||
+for ( i=0; i < K; i++) {
|
||||
+ assertEq(v[i] instanceof Object, true);
|
||||
+ assertEq(v[i].i, i);
|
||||
+}
|
||||
diff --git a/js/src/vm/UnboxedObject.cpp b/js/src/vm/UnboxedObject.cpp
|
||||
--- a/js/src/vm/UnboxedObject.cpp
|
||||
+++ b/js/src/vm/UnboxedObject.cpp
|
||||
@@ -95,7 +95,15 @@ UnboxedLayout::makeConstructorCode(JSCon
|
||||
#endif
|
||||
|
||||
#ifdef JS_CODEGEN_ARM64
|
||||
- // ARM64 communicates stack address via sp, but uses a pseudo-sp for addressing.
|
||||
+ // ARM64 communicates stack address via sp, but uses a pseudo-sp (PSP) for
|
||||
+ // addressing. The register we use for PSP may however also be used by
|
||||
+ // calling code, and it is nonvolatile, so save it. Do this as a special
|
||||
+ // case first because the generic save/restore code needs the PSP to be
|
||||
+ // initialized already.
|
||||
+ MOZ_ASSERT(PseudoStackPointer64.Is(masm.GetStackPointer64()));
|
||||
+ masm.Str(PseudoStackPointer64, vixl::MemOperand(sp, -16, vixl::PreIndex));
|
||||
+
|
||||
+ // Initialize the PSP from the SP.
|
||||
masm.initStackPtr();
|
||||
#endif
|
||||
|
||||
@@ -233,7 +241,22 @@ UnboxedLayout::makeConstructorCode(JSCon
|
||||
masm.pop(ScratchDoubleReg);
|
||||
masm.PopRegsInMask(savedNonVolatileRegisters);
|
||||
|
||||
+#ifdef JS_CODEGEN_ARM64
|
||||
+ // Now restore the value that was in the PSP register on entry, and return.
|
||||
+
|
||||
+ // Obtain the correct SP from the PSP.
|
||||
+ masm.Mov(sp, PseudoStackPointer64);
|
||||
+
|
||||
+ // Restore the saved value of the PSP register, this value is whatever the
|
||||
+ // caller had saved in it, not any actual SP value, and it must not be
|
||||
+ // overwritten subsequently.
|
||||
+ masm.Ldr(PseudoStackPointer64, vixl::MemOperand(sp, 16, vixl::PostIndex));
|
||||
+
|
||||
+ // Perform a plain Ret(), as abiret() will move SP <- PSP and that is wrong.
|
||||
+ masm.Ret(vixl::lr);
|
||||
+#else
|
||||
masm.abiret();
|
||||
+#endif
|
||||
|
||||
masm.bind(&failureStoreOther);
|
||||
|
||||
@ -1,13 +0,0 @@
|
||||
diff -up firefox-55.0.3/js/src/jit/ExecutableAllocator.h.wasm firefox-55.0.3/js/src/jit/ExecutableAllocator.h
|
||||
--- firefox-55.0.3/js/src/jit/ExecutableAllocator.h.wasm 2017-09-05 11:32:12.235909468 +0200
|
||||
+++ firefox-55.0.3/js/src/jit/ExecutableAllocator.h 2017-09-05 11:32:46.157916575 +0200
|
||||
@@ -219,7 +219,7 @@ class ExecutableAllocator
|
||||
|
||||
static void poisonCode(JSRuntime* rt, JitPoisonRangeVector& ranges);
|
||||
|
||||
-#if defined(JS_CODEGEN_X86) || defined(JS_CODEGEN_X64) || defined(JS_SIMULATOR_ARM64)
|
||||
+#if defined(JS_CODEGEN_X86) || defined(JS_CODEGEN_X64) || defined(JS_SIMULATOR_ARM64) || defined(JS_CODEGEN_NONE)
|
||||
static void cacheFlush(void*, size_t)
|
||||
{
|
||||
}
|
||||
diff -up firefox-55.0.3/js/src/jit-test/tests/wasm/bench/wasm_box2d.wasm firefox-55.0.3/js/src/jit-test/tests/wasm/bench/wasm_box2d
|
||||
@ -1,12 +0,0 @@
|
||||
diff -up firefox-60.5.0/js/src/jit/AtomicOperations.h.jit-atomic-lucky firefox-60.5.0/js/src/jit/AtomicOperations.h
|
||||
--- firefox-60.5.0/js/src/jit/AtomicOperations.h.jit-atomic-lucky 2019-01-22 10:20:27.993697161 +0100
|
||||
+++ firefox-60.5.0/js/src/jit/AtomicOperations.h 2019-01-22 10:23:15.337873762 +0100
|
||||
@@ -394,7 +394,7 @@ inline bool AtomicOperations::isLockfree
|
||||
#elif defined(__s390__) || defined(__s390x__)
|
||||
#include "jit/none/AtomicOperations-feeling-lucky.h"
|
||||
#else
|
||||
-#error "No AtomicOperations support provided for this platform"
|
||||
+#include "jit/none/AtomicOperations-feeling-lucky.h"
|
||||
#endif
|
||||
|
||||
#endif // jit_AtomicOperations_h
|
||||
@ -1,51 +0,0 @@
|
||||
diff -up firefox-55.0/js/src/jit/MIR.h.old firefox-55.0/js/src/jit/MIR.h
|
||||
--- firefox-55.0/js/src/jit/MIR.h.old 2017-08-08 14:04:44.528460099 +0200
|
||||
+++ firefox-55.0/js/src/jit/MIR.h 2017-08-08 14:05:11.045364831 +0200
|
||||
@@ -12434,7 +12434,7 @@ class MNearbyInt
|
||||
TRIVIAL_NEW_WRAPPERS
|
||||
|
||||
static bool HasAssemblerSupport(RoundingMode mode) {
|
||||
- return Assembler::HasRoundInstruction(mode);
|
||||
+ return false;
|
||||
}
|
||||
|
||||
RoundingMode roundingMode() const { return roundingMode_; }
|
||||
diff -up firefox-55.0/js/src/jit/ExecutableAllocator.h.old firefox-55.0/js/src/jit/ExecutableAllocator.h
|
||||
--- firefox-55.0/js/src/jit/ExecutableAllocator.h.old 2017-08-09 09:24:18.784983505 +0200
|
||||
+++ firefox-55.0/js/src/jit/ExecutableAllocator.h 2017-08-09 09:28:01.471100075 +0200
|
||||
@@ -307,6 +307,10 @@ class ExecutableAllocator
|
||||
{
|
||||
sync_instruction_memory((caddr_t)code, size);
|
||||
}
|
||||
+#else
|
||||
+ static void cacheFlush(void*, size_t)
|
||||
+ {
|
||||
+ }
|
||||
#endif
|
||||
|
||||
private:
|
||||
diff -up firefox-55.0/js/src/wasm/WasmBuiltins.cpp.old firefox-55.0/js/src/wasm/WasmBuiltins.cpp
|
||||
--- firefox-55.0/js/src/wasm/WasmBuiltins.cpp.old 2017-08-09 12:50:46.877450765 +0200
|
||||
+++ firefox-55.0/js/src/wasm/WasmBuiltins.cpp 2017-08-09 12:50:59.725406974 +0200
|
||||
@@ -881,7 +881,6 @@ wasm::EnsureBuiltinThunksInitialized()
|
||||
MOZ_ASSERT(!masm.numSymbolicAccesses());
|
||||
#endif
|
||||
|
||||
- ExecutableAllocator::cacheFlush(thunks->codeBase, thunks->codeSize);
|
||||
if (!ExecutableAllocator::makeExecutable(thunks->codeBase, thunks->codeSize))
|
||||
return false;
|
||||
|
||||
diff -up firefox-55.0/js/src/wasm/WasmCode.cpp.old firefox-55.0/js/src/wasm/WasmCode.cpp
|
||||
--- firefox-55.0/js/src/wasm/WasmCode.cpp.old 2017-08-09 12:50:37.205483731 +0200
|
||||
+++ firefox-55.0/js/src/wasm/WasmCode.cpp 2017-08-09 12:51:10.365370708 +0200
|
||||
@@ -287,8 +287,6 @@ CodeSegment::initialize(Tier tier,
|
||||
if (!StaticallyLink(*this, linkData))
|
||||
return false;
|
||||
|
||||
- ExecutableAllocator::cacheFlush(bytes_.get(), RoundupCodeLength(codeLength));
|
||||
-
|
||||
// Reprotect the whole region to avoid having separate RW and RX mappings.
|
||||
if (!ExecutableAllocator::makeExecutable(bytes_.get(), RoundupCodeLength(codeLength)))
|
||||
return false;
|
||||
diff -up firefox-55.0/media/libyuv/libyuv/tools_libyuv/autoroller/unittests/testdata/DEPS.chromium.old firefox-55.0/media/libyuv/libyuv/tools_libyuv/autoroller/unittests/testdata/DEPS.chromium
|
||||
diff -up firefox-55.0/media/webrtc/trunk/Makefile.old firefox-55.0/media/webrtc/trunk/Makefile
|
||||
@ -1,25 +0,0 @@
|
||||
diff -up firefox-55.0/build/moz.configure/rust.configure.rust-ppc64le firefox-55.0/build/moz.configure/rust.configure
|
||||
--- firefox-55.0/build/moz.configure/rust.configure.rust-ppc64le 2017-07-31 18:20:49.000000000 +0200
|
||||
+++ firefox-55.0/build/moz.configure/rust.configure 2017-08-02 10:19:03.254220003 +0200
|
||||
@@ -151,6 +151,9 @@ def rust_triple_alias(host_or_target):
|
||||
('sparc64', 'Linux'): 'sparc64-unknown-linux-gnu',
|
||||
('x86', 'Linux'): 'i686-unknown-linux-gnu',
|
||||
('x86_64', 'Linux'): 'x86_64-unknown-linux-gnu',
|
||||
+ ('ppc64le', 'Linux'): 'powerpc64le-unknown-linux-gnu',
|
||||
+ ('ppc64', 'Linux'): 'powerpc64-unknown-linux-gnu',
|
||||
+ ('s390x', 'Linux'): 's390x-unknown-linux-gnu',
|
||||
# OS X
|
||||
('x86', 'OSX'): 'i686-apple-darwin',
|
||||
('x86_64', 'OSX'): 'x86_64-apple-darwin',
|
||||
@@ -174,8 +177,10 @@ def rust_triple_alias(host_or_target):
|
||||
('sparc64', 'SunOS'): 'sparcv9-sun-solaris',
|
||||
}.get((host_or_target.cpu, os_or_kernel), None)
|
||||
|
||||
+ if (rustc_target == 'powerpc64-unknown-linux-gnu' and host_or_target.endianness == 'little'):
|
||||
+ rustc_target = 'powerpc64le-unknown-linux-gnu'
|
||||
if rustc_target is None:
|
||||
- die("Don't know how to translate {} for rustc".format(host_or_target.alias))
|
||||
+ die("Don't know how to translate {} for rustc, cpu: {}, os: {}".format(target.alias, target.cpu, os_or_kernel))
|
||||
|
||||
# Check to see whether our rustc has a reasonably functional stdlib
|
||||
# for our chosen target.
|
||||
@ -1,12 +0,0 @@
|
||||
diff -up firefox-78.0/toolkit/moz.configure.nss-version firefox-78.0/toolkit/moz.configure
|
||||
--- firefox-78.0/toolkit/moz.configure.nss-version 2020-06-30 08:47:09.657501414 +0200
|
||||
+++ firefox-78.0/toolkit/moz.configure 2020-06-30 08:47:12.652510169 +0200
|
||||
@@ -2089,7 +2089,7 @@ option('--with-system-nss', help='Use sy
|
||||
|
||||
imply_option('--with-system-nspr', True, when='--with-system-nss')
|
||||
|
||||
-nss_pkg = pkg_check_modules('NSS', 'nss >= 3.53.1', when='--with-system-nss', config=False)
|
||||
+nss_pkg = pkg_check_modules('NSS', 'nss >= 3.53.0', when='--with-system-nss', config=False)
|
||||
|
||||
set_config('MOZ_SYSTEM_NSS', True, when='--with-system-nss')
|
||||
|
||||
@ -1,834 +0,0 @@
|
||||
diff -up firefox-79.0/config/system-headers.mozbuild.firefox-pipewire-0-3 firefox-79.0/config/system-headers.mozbuild
|
||||
--- firefox-79.0/config/system-headers.mozbuild.firefox-pipewire-0-3 2020-07-21 00:49:36.000000000 +0200
|
||||
+++ firefox-79.0/config/system-headers.mozbuild 2020-07-28 10:06:59.485481599 +0200
|
||||
@@ -314,6 +314,7 @@ system_headers = [
|
||||
'Gestalt.h',
|
||||
'getopt.h',
|
||||
'gio/gio.h',
|
||||
+ 'gio/gunixfdlist.h',
|
||||
'glibconfig.h',
|
||||
'glib.h',
|
||||
'glib-object.h',
|
||||
@@ -607,6 +608,7 @@ system_headers = [
|
||||
'Pgenerr.h',
|
||||
'PGenErr.h',
|
||||
'Ph.h',
|
||||
+ 'pipewire/pipewire.h',
|
||||
'pixman.h',
|
||||
'pk11func.h',
|
||||
'pk11pqg.h',
|
||||
diff -up firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/BUILD.gn.firefox-pipewire-0-3 firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/BUILD.gn
|
||||
--- firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/BUILD.gn.firefox-pipewire-0-3 2020-07-20 22:53:33.000000000 +0200
|
||||
+++ firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/BUILD.gn 2020-07-28 10:06:59.485481599 +0200
|
||||
@@ -158,7 +158,7 @@ if (rtc_include_tests) {
|
||||
if (is_linux) {
|
||||
if (rtc_use_pipewire) {
|
||||
pkg_config("pipewire") {
|
||||
- packages = [ "libpipewire-0.2" ]
|
||||
+ packages = [ "libpipewire-0.3" ]
|
||||
|
||||
defines = [ "WEBRTC_USE_PIPEWIRE" ]
|
||||
}
|
||||
diff -up firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capture_generic_gn/moz.build.firefox-pipewire-0-3 firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capture_generic_gn/moz.build
|
||||
--- firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capture_generic_gn/moz.build.firefox-pipewire-0-3 2020-07-28 10:06:59.486481593 +0200
|
||||
+++ firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capture_generic_gn/moz.build 2020-07-28 10:11:51.231907101 +0200
|
||||
@@ -174,6 +174,28 @@ if CONFIG["OS_TARGET"] == "Linux":
|
||||
"/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_linux.cc"
|
||||
]
|
||||
|
||||
+# PipeWire specific files
|
||||
+if CONFIG["OS_TARGET"] == "Linux":
|
||||
+ DEFINES["WEBRTC_USE_PIPEWIRE"] = "1"
|
||||
+
|
||||
+ OS_LIBS += [
|
||||
+ "rt",
|
||||
+ "pipewire-0.3",
|
||||
+ "glib-2.0",
|
||||
+ "gio-2.0",
|
||||
+ "gobject-2.0"
|
||||
+ ]
|
||||
+
|
||||
+ CXXFLAGS += CONFIG['TK_CFLAGS']
|
||||
+ CXXFLAGS += [ "-I/usr/include/pipewire-0.3" ]
|
||||
+ CXXFLAGS += [ "-I/usr/include/spa-0.2" ]
|
||||
+
|
||||
+ UNIFIED_SOURCES += [
|
||||
+ "/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.cc",
|
||||
+ "/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/screen_capturer_pipewire.cc",
|
||||
+ "/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/window_capturer_pipewire.cc"
|
||||
+ ]
|
||||
+
|
||||
if CONFIG["OS_TARGET"] == "Darwin":
|
||||
|
||||
DEFINES["CR_XCODE_VERSION"] = "0920"
|
||||
diff -up firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capture_options.h.firefox-pipewire-0-3 firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capture_options.h
|
||||
--- firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capture_options.h.firefox-pipewire-0-3 2020-07-20 22:54:16.000000000 +0200
|
||||
+++ firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capture_options.h 2020-07-28 10:06:59.486481593 +0200
|
||||
@@ -141,7 +141,7 @@ class DesktopCaptureOptions {
|
||||
bool disable_effects_ = true;
|
||||
bool detect_updated_region_ = false;
|
||||
#if defined(WEBRTC_USE_PIPEWIRE)
|
||||
- bool allow_pipewire_ = false;
|
||||
+ bool allow_pipewire_ = true;
|
||||
#endif
|
||||
};
|
||||
|
||||
diff -up firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.cc.firefox-pipewire-0-3 firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.cc
|
||||
--- firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.cc.firefox-pipewire-0-3 2020-07-20 22:54:27.000000000 +0200
|
||||
+++ firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.cc 2020-07-28 10:06:59.500481514 +0200
|
||||
@@ -15,8 +15,11 @@
|
||||
|
||||
#include <spa/param/format-utils.h>
|
||||
#include <spa/param/props.h>
|
||||
-#include <spa/param/video/raw-utils.h>
|
||||
-#include <spa/support/type-map.h>
|
||||
+
|
||||
+#include <linux/dma-buf.h>
|
||||
+#include <sys/mman.h>
|
||||
+#include <sys/ioctl.h>
|
||||
+#include <sys/syscall.h>
|
||||
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
@@ -36,32 +39,37 @@ const char kSessionInterfaceName[] = "or
|
||||
const char kRequestInterfaceName[] = "org.freedesktop.portal.Request";
|
||||
const char kScreenCastInterfaceName[] = "org.freedesktop.portal.ScreenCast";
|
||||
|
||||
+
|
||||
// static
|
||||
-void BaseCapturerPipeWire::OnStateChanged(void* data,
|
||||
- pw_remote_state old_state,
|
||||
- pw_remote_state state,
|
||||
- const char* error_message) {
|
||||
- BaseCapturerPipeWire* that = static_cast<BaseCapturerPipeWire*>(data);
|
||||
- RTC_DCHECK(that);
|
||||
+void BaseCapturerPipeWire::SyncDmaBuf(int fd, uint64_t start_or_end) {
|
||||
+ struct dma_buf_sync sync = { 0 };
|
||||
|
||||
- switch (state) {
|
||||
- case PW_REMOTE_STATE_ERROR:
|
||||
- RTC_LOG(LS_ERROR) << "PipeWire remote state error: " << error_message;
|
||||
- break;
|
||||
- case PW_REMOTE_STATE_CONNECTED:
|
||||
- RTC_LOG(LS_INFO) << "PipeWire remote state: connected.";
|
||||
- that->CreateReceivingStream();
|
||||
- break;
|
||||
- case PW_REMOTE_STATE_CONNECTING:
|
||||
- RTC_LOG(LS_INFO) << "PipeWire remote state: connecting.";
|
||||
+ sync.flags = start_or_end | DMA_BUF_SYNC_READ;
|
||||
+
|
||||
+ while(true) {
|
||||
+ int ret;
|
||||
+ ret = ioctl (fd, DMA_BUF_IOCTL_SYNC, &sync);
|
||||
+ if (ret == -1 && errno == EINTR) {
|
||||
+ continue;
|
||||
+ } else if (ret == -1) {
|
||||
+ RTC_LOG(LS_ERROR) << "Failed to synchronize DMA buffer: " << g_strerror(errno);
|
||||
break;
|
||||
- case PW_REMOTE_STATE_UNCONNECTED:
|
||||
- RTC_LOG(LS_INFO) << "PipeWire remote state: unconnected.";
|
||||
+ } else {
|
||||
break;
|
||||
+ }
|
||||
}
|
||||
}
|
||||
|
||||
// static
|
||||
+void BaseCapturerPipeWire::OnCoreError(void *data,
|
||||
+ uint32_t id,
|
||||
+ int seq,
|
||||
+ int res,
|
||||
+ const char *message) {
|
||||
+ RTC_LOG(LS_ERROR) << "core error: " << message;
|
||||
+}
|
||||
+
|
||||
+// static
|
||||
void BaseCapturerPipeWire::OnStreamStateChanged(void* data,
|
||||
pw_stream_state old_state,
|
||||
pw_stream_state state,
|
||||
@@ -73,76 +81,54 @@ void BaseCapturerPipeWire::OnStreamState
|
||||
case PW_STREAM_STATE_ERROR:
|
||||
RTC_LOG(LS_ERROR) << "PipeWire stream state error: " << error_message;
|
||||
break;
|
||||
- case PW_STREAM_STATE_CONFIGURE:
|
||||
- pw_stream_set_active(that->pw_stream_, true);
|
||||
- break;
|
||||
- case PW_STREAM_STATE_UNCONNECTED:
|
||||
- case PW_STREAM_STATE_CONNECTING:
|
||||
- case PW_STREAM_STATE_READY:
|
||||
case PW_STREAM_STATE_PAUSED:
|
||||
case PW_STREAM_STATE_STREAMING:
|
||||
+ case PW_STREAM_STATE_UNCONNECTED:
|
||||
+ case PW_STREAM_STATE_CONNECTING:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// static
|
||||
-void BaseCapturerPipeWire::OnStreamFormatChanged(void* data,
|
||||
- const struct spa_pod* format) {
|
||||
+void BaseCapturerPipeWire::OnStreamParamChanged(void *data, uint32_t id,
|
||||
+ const struct spa_pod *format) {
|
||||
BaseCapturerPipeWire* that = static_cast<BaseCapturerPipeWire*>(data);
|
||||
RTC_DCHECK(that);
|
||||
|
||||
- RTC_LOG(LS_INFO) << "PipeWire stream format changed.";
|
||||
+ RTC_LOG(LS_INFO) << "PipeWire stream param changed.";
|
||||
|
||||
- if (!format) {
|
||||
- pw_stream_finish_format(that->pw_stream_, /*res=*/0, /*params=*/nullptr,
|
||||
- /*n_params=*/0);
|
||||
+ if (!format || id != SPA_PARAM_Format) {
|
||||
return;
|
||||
}
|
||||
|
||||
- that->spa_video_format_ = new spa_video_info_raw();
|
||||
- spa_format_video_raw_parse(format, that->spa_video_format_,
|
||||
- &that->pw_type_->format_video);
|
||||
+ spa_format_video_raw_parse(format, &that->spa_video_format_);
|
||||
|
||||
- auto width = that->spa_video_format_->size.width;
|
||||
- auto height = that->spa_video_format_->size.height;
|
||||
+ auto width = that->spa_video_format_.size.width;
|
||||
+ auto height = that->spa_video_format_.size.height;
|
||||
auto stride = SPA_ROUND_UP_N(width * kBytesPerPixel, 4);
|
||||
auto size = height * stride;
|
||||
|
||||
+ that->desktop_size_ = DesktopSize(width, height);
|
||||
+
|
||||
uint8_t buffer[1024] = {};
|
||||
auto builder = spa_pod_builder{buffer, sizeof(buffer)};
|
||||
|
||||
// Setup buffers and meta header for new format.
|
||||
- const struct spa_pod* params[2];
|
||||
- params[0] = reinterpret_cast<spa_pod*>(spa_pod_builder_object(
|
||||
- &builder,
|
||||
- // id to enumerate buffer requirements
|
||||
- that->pw_core_type_->param.idBuffers,
|
||||
- that->pw_core_type_->param_buffers.Buffers,
|
||||
- // Size: specified as integer (i) and set to specified size
|
||||
- ":", that->pw_core_type_->param_buffers.size, "i", size,
|
||||
- // Stride: specified as integer (i) and set to specified stride
|
||||
- ":", that->pw_core_type_->param_buffers.stride, "i", stride,
|
||||
- // Buffers: specifies how many buffers we want to deal with, set as
|
||||
- // integer (i) where preferred number is 8, then allowed number is defined
|
||||
- // as range (r) from min and max values and it is undecided (u) to allow
|
||||
- // negotiation
|
||||
- ":", that->pw_core_type_->param_buffers.buffers, "iru", 8,
|
||||
- SPA_POD_PROP_MIN_MAX(1, 32),
|
||||
- // Align: memory alignment of the buffer, set as integer (i) to specified
|
||||
- // value
|
||||
- ":", that->pw_core_type_->param_buffers.align, "i", 16));
|
||||
- params[1] = reinterpret_cast<spa_pod*>(spa_pod_builder_object(
|
||||
- &builder,
|
||||
- // id to enumerate supported metadata
|
||||
- that->pw_core_type_->param.idMeta, that->pw_core_type_->param_meta.Meta,
|
||||
- // Type: specified as id or enum (I)
|
||||
- ":", that->pw_core_type_->param_meta.type, "I",
|
||||
- that->pw_core_type_->meta.Header,
|
||||
- // Size: size of the metadata, specified as integer (i)
|
||||
- ":", that->pw_core_type_->param_meta.size, "i",
|
||||
- sizeof(struct spa_meta_header)));
|
||||
-
|
||||
- pw_stream_finish_format(that->pw_stream_, /*res=*/0, params, /*n_params=*/2);
|
||||
+ const struct spa_pod* params[3];
|
||||
+ params[0] = reinterpret_cast<spa_pod *>(spa_pod_builder_add_object(&builder,
|
||||
+ SPA_TYPE_OBJECT_ParamBuffers, SPA_PARAM_Buffers,
|
||||
+ SPA_PARAM_BUFFERS_size, SPA_POD_Int(size),
|
||||
+ SPA_PARAM_BUFFERS_stride, SPA_POD_Int(stride),
|
||||
+ SPA_PARAM_BUFFERS_buffers, SPA_POD_CHOICE_RANGE_Int(8, 1, 32)));
|
||||
+ params[1] = reinterpret_cast<spa_pod *>(spa_pod_builder_add_object(&builder,
|
||||
+ SPA_TYPE_OBJECT_ParamMeta, SPA_PARAM_Meta,
|
||||
+ SPA_PARAM_META_type, SPA_POD_Id(SPA_META_Header),
|
||||
+ SPA_PARAM_META_size, SPA_POD_Int(sizeof(struct spa_meta_header))));
|
||||
+ params[2] = reinterpret_cast<spa_pod *>(spa_pod_builder_add_object(&builder,
|
||||
+ SPA_TYPE_OBJECT_ParamMeta, SPA_PARAM_Meta,
|
||||
+ SPA_PARAM_META_type, SPA_POD_Id (SPA_META_VideoCrop),
|
||||
+ SPA_PARAM_META_size, SPA_POD_Int (sizeof(struct spa_meta_region))));
|
||||
+ pw_stream_update_params(that->pw_stream_, params, 3);
|
||||
}
|
||||
|
||||
// static
|
||||
@@ -150,15 +136,25 @@ void BaseCapturerPipeWire::OnStreamProce
|
||||
BaseCapturerPipeWire* that = static_cast<BaseCapturerPipeWire*>(data);
|
||||
RTC_DCHECK(that);
|
||||
|
||||
- pw_buffer* buf = nullptr;
|
||||
+ struct pw_buffer *next_buffer;
|
||||
+ struct pw_buffer *buffer = nullptr;
|
||||
+
|
||||
+ next_buffer = pw_stream_dequeue_buffer(that->pw_stream_);
|
||||
+ while (next_buffer) {
|
||||
+ buffer = next_buffer;
|
||||
+ next_buffer = pw_stream_dequeue_buffer(that->pw_stream_);
|
||||
+
|
||||
+ if (next_buffer)
|
||||
+ pw_stream_queue_buffer (that->pw_stream_, buffer);
|
||||
+ }
|
||||
|
||||
- if (!(buf = pw_stream_dequeue_buffer(that->pw_stream_))) {
|
||||
+ if (!buffer) {
|
||||
return;
|
||||
}
|
||||
|
||||
- that->HandleBuffer(buf);
|
||||
+ that->HandleBuffer(buffer);
|
||||
|
||||
- pw_stream_queue_buffer(that->pw_stream_, buf);
|
||||
+ pw_stream_queue_buffer(that->pw_stream_, buffer);
|
||||
}
|
||||
|
||||
BaseCapturerPipeWire::BaseCapturerPipeWire(CaptureSourceType source_type)
|
||||
@@ -169,38 +165,22 @@ BaseCapturerPipeWire::~BaseCapturerPipeW
|
||||
pw_thread_loop_stop(pw_main_loop_);
|
||||
}
|
||||
|
||||
- if (pw_type_) {
|
||||
- delete pw_type_;
|
||||
- }
|
||||
-
|
||||
- if (spa_video_format_) {
|
||||
- delete spa_video_format_;
|
||||
- }
|
||||
-
|
||||
if (pw_stream_) {
|
||||
pw_stream_destroy(pw_stream_);
|
||||
}
|
||||
|
||||
- if (pw_remote_) {
|
||||
- pw_remote_destroy(pw_remote_);
|
||||
+ if (pw_core_) {
|
||||
+ pw_core_disconnect(pw_core_);
|
||||
}
|
||||
|
||||
- if (pw_core_) {
|
||||
- pw_core_destroy(pw_core_);
|
||||
+ if (pw_context_) {
|
||||
+ pw_context_destroy(pw_context_);
|
||||
}
|
||||
|
||||
if (pw_main_loop_) {
|
||||
pw_thread_loop_destroy(pw_main_loop_);
|
||||
}
|
||||
|
||||
- if (pw_loop_) {
|
||||
- pw_loop_destroy(pw_loop_);
|
||||
- }
|
||||
-
|
||||
- if (current_frame_) {
|
||||
- free(current_frame_);
|
||||
- }
|
||||
-
|
||||
if (start_request_signal_id_) {
|
||||
g_dbus_connection_signal_unsubscribe(connection_, start_request_signal_id_);
|
||||
}
|
||||
@@ -250,27 +230,35 @@ void BaseCapturerPipeWire::InitPortal()
|
||||
void BaseCapturerPipeWire::InitPipeWire() {
|
||||
pw_init(/*argc=*/nullptr, /*argc=*/nullptr);
|
||||
|
||||
- pw_loop_ = pw_loop_new(/*properties=*/nullptr);
|
||||
- pw_main_loop_ = pw_thread_loop_new(pw_loop_, "pipewire-main-loop");
|
||||
-
|
||||
- pw_core_ = pw_core_new(pw_loop_, /*properties=*/nullptr);
|
||||
- pw_core_type_ = pw_core_get_type(pw_core_);
|
||||
- pw_remote_ = pw_remote_new(pw_core_, nullptr, /*user_data_size=*/0);
|
||||
+ pw_main_loop_ = pw_thread_loop_new("pipewire-main-loop", nullptr);
|
||||
+ pw_context_ = pw_context_new(pw_thread_loop_get_loop(pw_main_loop_), nullptr, 0);
|
||||
+ if (!pw_context_) {
|
||||
+ RTC_LOG(LS_ERROR) << "Failed to create PipeWire context";
|
||||
+ return;
|
||||
+ }
|
||||
|
||||
- InitPipeWireTypes();
|
||||
+ pw_core_ = pw_context_connect(pw_context_, nullptr, 0);
|
||||
+ if (!pw_core_) {
|
||||
+ RTC_LOG(LS_ERROR) << "Failed to connect PipeWire context";
|
||||
+ return;
|
||||
+ }
|
||||
|
||||
// Initialize event handlers, remote end and stream-related.
|
||||
- pw_remote_events_.version = PW_VERSION_REMOTE_EVENTS;
|
||||
- pw_remote_events_.state_changed = &OnStateChanged;
|
||||
+ pw_core_events_.version = PW_VERSION_CORE_EVENTS;
|
||||
+ pw_core_events_.error = &OnCoreError;
|
||||
|
||||
pw_stream_events_.version = PW_VERSION_STREAM_EVENTS;
|
||||
pw_stream_events_.state_changed = &OnStreamStateChanged;
|
||||
- pw_stream_events_.format_changed = &OnStreamFormatChanged;
|
||||
+ pw_stream_events_.param_changed = &OnStreamParamChanged;
|
||||
pw_stream_events_.process = &OnStreamProcess;
|
||||
|
||||
- pw_remote_add_listener(pw_remote_, &spa_remote_listener_, &pw_remote_events_,
|
||||
- this);
|
||||
- pw_remote_connect_fd(pw_remote_, pw_fd_);
|
||||
+ pw_core_add_listener(pw_core_, &spa_core_listener_, &pw_core_events_, this);
|
||||
+
|
||||
+ pw_stream_ = CreateReceivingStream();
|
||||
+ if (!pw_stream_) {
|
||||
+ RTC_LOG(LS_ERROR) << "Failed to create PipeWire stream";
|
||||
+ return;
|
||||
+ }
|
||||
|
||||
if (pw_thread_loop_start(pw_main_loop_) < 0) {
|
||||
RTC_LOG(LS_ERROR) << "Failed to start main PipeWire loop";
|
||||
@@ -278,81 +266,132 @@ void BaseCapturerPipeWire::InitPipeWire(
|
||||
}
|
||||
}
|
||||
|
||||
-void BaseCapturerPipeWire::InitPipeWireTypes() {
|
||||
- spa_type_map* map = pw_core_type_->map;
|
||||
- pw_type_ = new PipeWireType();
|
||||
+pw_stream* BaseCapturerPipeWire::CreateReceivingStream() {
|
||||
+ spa_rectangle pwMinScreenBounds = spa_rectangle{1, 1};
|
||||
+ spa_rectangle pwMaxScreenBounds = spa_rectangle{INT32_MAX, INT32_MAX};
|
||||
|
||||
- spa_type_media_type_map(map, &pw_type_->media_type);
|
||||
- spa_type_media_subtype_map(map, &pw_type_->media_subtype);
|
||||
- spa_type_format_video_map(map, &pw_type_->format_video);
|
||||
- spa_type_video_format_map(map, &pw_type_->video_format);
|
||||
-}
|
||||
+ auto stream = pw_stream_new(pw_core_, "webrtc-pipewire-stream", nullptr);
|
||||
|
||||
-void BaseCapturerPipeWire::CreateReceivingStream() {
|
||||
- spa_rectangle pwMinScreenBounds = spa_rectangle{1, 1};
|
||||
- spa_rectangle pwScreenBounds =
|
||||
- spa_rectangle{static_cast<uint32_t>(desktop_size_.width()),
|
||||
- static_cast<uint32_t>(desktop_size_.height())};
|
||||
-
|
||||
- spa_fraction pwFrameRateMin = spa_fraction{0, 1};
|
||||
- spa_fraction pwFrameRateMax = spa_fraction{60, 1};
|
||||
-
|
||||
- pw_properties* reuseProps = pw_properties_new("pipewire.client.reuse", "1",
|
||||
- /*end of varargs*/ nullptr);
|
||||
- pw_stream_ = pw_stream_new(pw_remote_, "webrtc-consume-stream", reuseProps);
|
||||
+ if (!stream) {
|
||||
+ RTC_LOG(LS_ERROR) << "Could not create receiving stream.";
|
||||
+ return nullptr;
|
||||
+ }
|
||||
|
||||
uint8_t buffer[1024] = {};
|
||||
- const spa_pod* params[1];
|
||||
- spa_pod_builder builder = spa_pod_builder{buffer, sizeof(buffer)};
|
||||
- params[0] = reinterpret_cast<spa_pod*>(spa_pod_builder_object(
|
||||
- &builder,
|
||||
- // id to enumerate formats
|
||||
- pw_core_type_->param.idEnumFormat, pw_core_type_->spa_format, "I",
|
||||
- pw_type_->media_type.video, "I", pw_type_->media_subtype.raw,
|
||||
- // Video format: specified as id or enum (I), preferred format is BGRx,
|
||||
- // then allowed formats are enumerated (e) and the format is undecided (u)
|
||||
- // to allow negotiation
|
||||
- ":", pw_type_->format_video.format, "Ieu", pw_type_->video_format.BGRx,
|
||||
- SPA_POD_PROP_ENUM(2, pw_type_->video_format.RGBx,
|
||||
- pw_type_->video_format.BGRx),
|
||||
- // Video size: specified as rectangle (R), preferred size is specified as
|
||||
- // first parameter, then allowed size is defined as range (r) from min and
|
||||
- // max values and the format is undecided (u) to allow negotiation
|
||||
- ":", pw_type_->format_video.size, "Rru", &pwScreenBounds, 2,
|
||||
- &pwMinScreenBounds, &pwScreenBounds,
|
||||
- // Frame rate: specified as fraction (F) and set to minimum frame rate
|
||||
- // value
|
||||
- ":", pw_type_->format_video.framerate, "F", &pwFrameRateMin,
|
||||
- // Max frame rate: specified as fraction (F), preferred frame rate is set
|
||||
- // to maximum value, then allowed frame rate is defined as range (r) from
|
||||
- // min and max values and it is undecided (u) to allow negotiation
|
||||
- ":", pw_type_->format_video.max_framerate, "Fru", &pwFrameRateMax, 2,
|
||||
- &pwFrameRateMin, &pwFrameRateMax));
|
||||
+ const spa_pod* params[2];
|
||||
+ spa_pod_builder builder = SPA_POD_BUILDER_INIT(buffer, sizeof (buffer));
|
||||
+
|
||||
+ params[0] = reinterpret_cast<spa_pod *>(spa_pod_builder_add_object(&builder,
|
||||
+ SPA_TYPE_OBJECT_Format, SPA_PARAM_EnumFormat,
|
||||
+ SPA_FORMAT_mediaType, SPA_POD_Id(SPA_MEDIA_TYPE_video),
|
||||
+ SPA_FORMAT_mediaSubtype, SPA_POD_Id(SPA_MEDIA_SUBTYPE_raw),
|
||||
+ SPA_FORMAT_VIDEO_format, SPA_POD_CHOICE_ENUM_Id(5, SPA_VIDEO_FORMAT_BGRx, SPA_VIDEO_FORMAT_RGBx, SPA_VIDEO_FORMAT_RGBA,
|
||||
+ SPA_VIDEO_FORMAT_BGRx, SPA_VIDEO_FORMAT_BGRA),
|
||||
+ SPA_FORMAT_VIDEO_size, SPA_POD_CHOICE_RANGE_Rectangle(&pwMinScreenBounds,
|
||||
+ &pwMinScreenBounds,
|
||||
+ &pwMaxScreenBounds),
|
||||
+ 0));
|
||||
+ pw_stream_add_listener(stream, &spa_stream_listener_, &pw_stream_events_, this);
|
||||
|
||||
- pw_stream_add_listener(pw_stream_, &spa_stream_listener_, &pw_stream_events_,
|
||||
- this);
|
||||
pw_stream_flags flags = static_cast<pw_stream_flags>(
|
||||
- PW_STREAM_FLAG_AUTOCONNECT | PW_STREAM_FLAG_INACTIVE |
|
||||
- PW_STREAM_FLAG_MAP_BUFFERS);
|
||||
- if (pw_stream_connect(pw_stream_, PW_DIRECTION_INPUT, /*port_path=*/nullptr,
|
||||
- flags, params,
|
||||
- /*n_params=*/1) != 0) {
|
||||
+ PW_STREAM_FLAG_AUTOCONNECT | PW_STREAM_FLAG_INACTIVE);
|
||||
+
|
||||
+ if (pw_stream_connect(stream, PW_DIRECTION_INPUT, pw_stream_node_id_, PW_STREAM_FLAG_AUTOCONNECT, params, 1) != 0) {
|
||||
RTC_LOG(LS_ERROR) << "Could not connect receiving stream.";
|
||||
portal_init_failed_ = true;
|
||||
- return;
|
||||
}
|
||||
+
|
||||
+ return stream;
|
||||
}
|
||||
|
||||
void BaseCapturerPipeWire::HandleBuffer(pw_buffer* buffer) {
|
||||
+ struct spa_meta_region* video_crop;
|
||||
spa_buffer* spaBuffer = buffer->buffer;
|
||||
- void* src = nullptr;
|
||||
+ uint8_t *map = nullptr;
|
||||
+ uint8_t* src = nullptr;
|
||||
+ uint8_t* dst = nullptr;
|
||||
+
|
||||
+ if (spaBuffer->datas[0].chunk->size == 0) {
|
||||
+ map = nullptr;
|
||||
+ src = nullptr;
|
||||
+ } else if (spaBuffer->datas[0].type == SPA_DATA_MemFd) {
|
||||
+ map = static_cast<uint8_t*>(mmap(
|
||||
+ nullptr, spaBuffer->datas[0].maxsize + spaBuffer->datas[0].mapoffset,
|
||||
+ PROT_READ, MAP_PRIVATE, spaBuffer->datas[0].fd, 0));
|
||||
+
|
||||
+ if (map == MAP_FAILED) {
|
||||
+ RTC_LOG(LS_ERROR) << "Failed to mmap the memory: " << std::strerror(errno);
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ src = SPA_MEMBER(map, spaBuffer->datas[0].mapoffset, uint8_t);
|
||||
+ } else if (spaBuffer->datas[0].type == SPA_DATA_DmaBuf) {
|
||||
+ int fd;
|
||||
+ fd = spaBuffer->datas[0].fd;
|
||||
+
|
||||
+ map = static_cast<uint8_t*>(mmap(
|
||||
+ nullptr, spaBuffer->datas[0].maxsize + spaBuffer->datas[0].mapoffset,
|
||||
+ PROT_READ, MAP_PRIVATE, fd, 0));
|
||||
+
|
||||
+ if (map == MAP_FAILED) {
|
||||
+ RTC_LOG(LS_ERROR) << "Failed to mmap the memory: " << std::strerror(errno);
|
||||
+ return;
|
||||
+ }
|
||||
|
||||
- if (!(src = spaBuffer->datas[0].data)) {
|
||||
+ SyncDmaBuf(fd, DMA_BUF_SYNC_START);
|
||||
+
|
||||
+ src = SPA_MEMBER(map, spaBuffer->datas[0].mapoffset, uint8_t);
|
||||
+ } else if (spaBuffer->datas[0].type == SPA_DATA_MemPtr) {
|
||||
+ map = nullptr;
|
||||
+ src = static_cast<uint8_t*>(spaBuffer->datas[0].data);
|
||||
+ } else {
|
||||
return;
|
||||
}
|
||||
|
||||
- uint32_t maxSize = spaBuffer->datas[0].maxsize;
|
||||
- int32_t srcStride = spaBuffer->datas[0].chunk->stride;
|
||||
+ if (!src) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ DesktopSize prev_crop_size = DesktopSize(0, 0);
|
||||
+ if (video_crop_size_initialized_) {
|
||||
+ prev_crop_size = video_crop_size_;
|
||||
+ }
|
||||
+
|
||||
+ if ((video_crop = static_cast<struct spa_meta_region*>(
|
||||
+ spa_buffer_find_meta_data(spaBuffer, SPA_META_VideoCrop, sizeof(*video_crop))))) {
|
||||
+ RTC_DCHECK(video_crop->region.size.width <= desktop_size_.width() &&
|
||||
+ video_crop->region.size.height <= desktop_size_.height());
|
||||
+ if ((video_crop->region.size.width != desktop_size_.width() ||
|
||||
+ video_crop->region.size.height != desktop_size_.height()) && video_crop->region.size.width && video_crop->region.size.height) {
|
||||
+ video_crop_size_ = DesktopSize(video_crop->region.size.width, video_crop->region.size.height);
|
||||
+ video_crop_size_initialized_ = true;
|
||||
+ } else {
|
||||
+ video_crop_size_initialized_ = false;
|
||||
+ }
|
||||
+ } else {
|
||||
+ video_crop_size_initialized_ = false;
|
||||
+ }
|
||||
+
|
||||
+ size_t frame_size;
|
||||
+ if (video_crop_size_initialized_) {
|
||||
+ frame_size =
|
||||
+ video_crop_size_.width() * video_crop_size_.height() * kBytesPerPixel;
|
||||
+ } else {
|
||||
+ frame_size =
|
||||
+ desktop_size_.width() * desktop_size_.height() * kBytesPerPixel;
|
||||
+ }
|
||||
+
|
||||
+ if (!current_frame_ ||
|
||||
+ (video_crop_size_initialized_ && !video_crop_size_.equals(prev_crop_size))) {
|
||||
+ current_frame_ = std::make_unique<uint8_t[]>(frame_size);
|
||||
+ }
|
||||
+ RTC_DCHECK(current_frame_ != nullptr);
|
||||
+
|
||||
+ const int32_t dstStride = video_crop_size_initialized_
|
||||
+ ? video_crop_size_.width() * kBytesPerPixel
|
||||
+ : desktop_size_.width() * kBytesPerPixel;
|
||||
+ const int32_t srcStride = spaBuffer->datas[0].chunk->stride;
|
||||
+
|
||||
if (srcStride != (desktop_size_.width() * kBytesPerPixel)) {
|
||||
RTC_LOG(LS_ERROR) << "Got buffer with stride different from screen stride: "
|
||||
<< srcStride
|
||||
@@ -361,21 +400,40 @@ void BaseCapturerPipeWire::HandleBuffer(
|
||||
return;
|
||||
}
|
||||
|
||||
- if (!current_frame_) {
|
||||
- current_frame_ = static_cast<uint8_t*>(malloc(maxSize));
|
||||
+ dst = current_frame_.get();
|
||||
+
|
||||
+ // Adjust source content based on crop video position
|
||||
+ if (video_crop_size_initialized_ &&
|
||||
+ (video_crop->region.position.y + video_crop_size_.height() <= desktop_size_.height())) {
|
||||
+ for (int i = 0; i < video_crop->region.position.y; ++i) {
|
||||
+ src += srcStride;
|
||||
+ }
|
||||
+ }
|
||||
+ const int xOffset =
|
||||
+ video_crop_size_initialized_ && (video_crop->region.position.x + video_crop_size_.width() <=
|
||||
+ desktop_size_.width())
|
||||
+ ? video_crop->region.position.x * kBytesPerPixel
|
||||
+ : 0;
|
||||
+ const int height = video_crop_size_initialized_ ? video_crop_size_.height() : desktop_size_.height();
|
||||
+ for (int i = 0; i < height; ++i) {
|
||||
+ // Adjust source content based on crop video position if needed
|
||||
+ src += xOffset;
|
||||
+ std::memcpy(dst, src, dstStride);
|
||||
+ // If both sides decided to go with the RGBx format we need to convert it to
|
||||
+ // BGRx to match color format expected by WebRTC.
|
||||
+ if (spa_video_format_.format == SPA_VIDEO_FORMAT_RGBx ||
|
||||
+ spa_video_format_.format == SPA_VIDEO_FORMAT_RGBA) {
|
||||
+ ConvertRGBxToBGRx(dst, dstStride);
|
||||
+ }
|
||||
+ src += srcStride - xOffset;
|
||||
+ dst += dstStride;
|
||||
}
|
||||
- RTC_DCHECK(current_frame_ != nullptr);
|
||||
|
||||
- // If both sides decided to go with the RGBx format we need to convert it to
|
||||
- // BGRx to match color format expected by WebRTC.
|
||||
- if (spa_video_format_->format == pw_type_->video_format.RGBx) {
|
||||
- uint8_t* tempFrame = static_cast<uint8_t*>(malloc(maxSize));
|
||||
- std::memcpy(tempFrame, src, maxSize);
|
||||
- ConvertRGBxToBGRx(tempFrame, maxSize);
|
||||
- std::memcpy(current_frame_, tempFrame, maxSize);
|
||||
- free(tempFrame);
|
||||
- } else {
|
||||
- std::memcpy(current_frame_, src, maxSize);
|
||||
+ if (map) {
|
||||
+ if (spaBuffer->datas[0].type == SPA_DATA_DmaBuf) {
|
||||
+ SyncDmaBuf(spaBuffer->datas[0].fd, DMA_BUF_SYNC_END);
|
||||
+ }
|
||||
+ munmap(map, spaBuffer->datas[0].maxsize + spaBuffer->datas[0].mapoffset);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -725,10 +783,7 @@ void BaseCapturerPipeWire::OnStartReques
|
||||
g_variant_get(variant, "(u@a{sv})", &stream_id, &options);
|
||||
RTC_DCHECK(options != nullptr);
|
||||
|
||||
- g_variant_lookup(options, "size", "(ii)", &width, &height);
|
||||
-
|
||||
- that->desktop_size_.set(width, height);
|
||||
-
|
||||
+ that->pw_stream_node_id_ = stream_id;
|
||||
g_variant_unref(options);
|
||||
g_variant_unref(variant);
|
||||
}
|
||||
@@ -813,10 +868,15 @@ void BaseCapturerPipeWire::CaptureFrame(
|
||||
return;
|
||||
}
|
||||
|
||||
- std::unique_ptr<DesktopFrame> result(new BasicDesktopFrame(desktop_size_));
|
||||
+ DesktopSize frame_size = desktop_size_;
|
||||
+ if (video_crop_size_initialized_) {
|
||||
+ frame_size = video_crop_size_;
|
||||
+ }
|
||||
+
|
||||
+ std::unique_ptr<DesktopFrame> result(new BasicDesktopFrame(frame_size));
|
||||
result->CopyPixelsFrom(
|
||||
- current_frame_, (desktop_size_.width() * kBytesPerPixel),
|
||||
- DesktopRect::MakeWH(desktop_size_.width(), desktop_size_.height()));
|
||||
+ current_frame_.get(), (frame_size.width() * kBytesPerPixel),
|
||||
+ DesktopRect::MakeWH(frame_size.width(), frame_size.height()));
|
||||
if (!result) {
|
||||
callback_->OnCaptureResult(Result::ERROR_TEMPORARY, nullptr);
|
||||
return;
|
||||
@@ -837,4 +897,22 @@ bool BaseCapturerPipeWire::SelectSource(
|
||||
return true;
|
||||
}
|
||||
|
||||
+// static
|
||||
+std::unique_ptr<DesktopCapturer>
|
||||
+BaseCapturerPipeWire::CreateRawScreenCapturer(
|
||||
+ const DesktopCaptureOptions& options) {
|
||||
+ std::unique_ptr<BaseCapturerPipeWire> capturer =
|
||||
+ std::make_unique<BaseCapturerPipeWire>(BaseCapturerPipeWire::CaptureSourceType::kAny);
|
||||
+ return std::move(capturer);}
|
||||
+
|
||||
+// static
|
||||
+std::unique_ptr<DesktopCapturer>
|
||||
+BaseCapturerPipeWire::CreateRawWindowCapturer(
|
||||
+ const DesktopCaptureOptions& options) {
|
||||
+
|
||||
+ std::unique_ptr<BaseCapturerPipeWire> capturer =
|
||||
+ std::make_unique<BaseCapturerPipeWire>(BaseCapturerPipeWire::CaptureSourceType::kAny);
|
||||
+ return std::move(capturer);
|
||||
+}
|
||||
+
|
||||
} // namespace webrtc
|
||||
diff -up firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.h.firefox-pipewire-0-3 firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.h
|
||||
--- firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.h.firefox-pipewire-0-3 2020-07-20 22:54:40.000000000 +0200
|
||||
+++ firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.h 2020-07-28 10:06:59.501481508 +0200
|
||||
@@ -22,17 +22,13 @@
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
-class PipeWireType {
|
||||
- public:
|
||||
- spa_type_media_type media_type;
|
||||
- spa_type_media_subtype media_subtype;
|
||||
- spa_type_format_video format_video;
|
||||
- spa_type_video_format video_format;
|
||||
-};
|
||||
-
|
||||
class BaseCapturerPipeWire : public DesktopCapturer {
|
||||
public:
|
||||
- enum CaptureSourceType { Screen = 1, Window };
|
||||
+ enum CaptureSourceType : uint32_t {
|
||||
+ kScreen = 0b01,
|
||||
+ kWindow = 0b10,
|
||||
+ kAny = 0b11
|
||||
+ };
|
||||
|
||||
explicit BaseCapturerPipeWire(CaptureSourceType source_type);
|
||||
~BaseCapturerPipeWire() override;
|
||||
@@ -43,28 +39,32 @@ class BaseCapturerPipeWire : public Desk
|
||||
bool GetSourceList(SourceList* sources) override;
|
||||
bool SelectSource(SourceId id) override;
|
||||
|
||||
+ static std::unique_ptr<DesktopCapturer> CreateRawScreenCapturer(
|
||||
+ const DesktopCaptureOptions& options);
|
||||
+
|
||||
+ static std::unique_ptr<DesktopCapturer> CreateRawWindowCapturer(
|
||||
+ const DesktopCaptureOptions& options);
|
||||
+
|
||||
private:
|
||||
// PipeWire types -->
|
||||
+ pw_context* pw_context_ = nullptr;
|
||||
pw_core* pw_core_ = nullptr;
|
||||
- pw_type* pw_core_type_ = nullptr;
|
||||
pw_stream* pw_stream_ = nullptr;
|
||||
- pw_remote* pw_remote_ = nullptr;
|
||||
- pw_loop* pw_loop_ = nullptr;
|
||||
pw_thread_loop* pw_main_loop_ = nullptr;
|
||||
- PipeWireType* pw_type_ = nullptr;
|
||||
|
||||
+ spa_hook spa_core_listener_ = {};
|
||||
spa_hook spa_stream_listener_ = {};
|
||||
- spa_hook spa_remote_listener_ = {};
|
||||
|
||||
+ pw_core_events pw_core_events_ = {};
|
||||
pw_stream_events pw_stream_events_ = {};
|
||||
- pw_remote_events pw_remote_events_ = {};
|
||||
|
||||
- spa_video_info_raw* spa_video_format_ = nullptr;
|
||||
+ struct spa_video_info_raw spa_video_format_;
|
||||
|
||||
+ guint32 pw_stream_node_id_ = 0;
|
||||
gint32 pw_fd_ = -1;
|
||||
|
||||
CaptureSourceType capture_source_type_ =
|
||||
- BaseCapturerPipeWire::CaptureSourceType::Screen;
|
||||
+ BaseCapturerPipeWire::CaptureSourceType::kAny;
|
||||
|
||||
// <-- end of PipeWire types
|
||||
|
||||
@@ -78,33 +78,37 @@ class BaseCapturerPipeWire : public Desk
|
||||
guint sources_request_signal_id_ = 0;
|
||||
guint start_request_signal_id_ = 0;
|
||||
|
||||
+ bool video_crop_size_initialized_ = false;
|
||||
+ DesktopSize video_crop_size_;;
|
||||
DesktopSize desktop_size_ = {};
|
||||
DesktopCaptureOptions options_ = {};
|
||||
|
||||
- uint8_t* current_frame_ = nullptr;
|
||||
+ std::unique_ptr<uint8_t[]> current_frame_;
|
||||
Callback* callback_ = nullptr;
|
||||
|
||||
bool portal_init_failed_ = false;
|
||||
|
||||
void InitPortal();
|
||||
void InitPipeWire();
|
||||
- void InitPipeWireTypes();
|
||||
|
||||
- void CreateReceivingStream();
|
||||
+ pw_stream* CreateReceivingStream();
|
||||
void HandleBuffer(pw_buffer* buffer);
|
||||
|
||||
void ConvertRGBxToBGRx(uint8_t* frame, uint32_t size);
|
||||
|
||||
- static void OnStateChanged(void* data,
|
||||
- pw_remote_state old_state,
|
||||
- pw_remote_state state,
|
||||
- const char* error);
|
||||
+ static void SyncDmaBuf(int fd, uint64_t start_or_end);
|
||||
+ static void OnCoreError(void *data,
|
||||
+ uint32_t id,
|
||||
+ int seq,
|
||||
+ int res,
|
||||
+ const char *message);
|
||||
+ static void OnStreamParamChanged(void *data,
|
||||
+ uint32_t id,
|
||||
+ const struct spa_pod *format);
|
||||
static void OnStreamStateChanged(void* data,
|
||||
pw_stream_state old_state,
|
||||
pw_stream_state state,
|
||||
const char* error_message);
|
||||
-
|
||||
- static void OnStreamFormatChanged(void* data, const struct spa_pod* format);
|
||||
static void OnStreamProcess(void* data);
|
||||
static void OnNewBuffer(void* data, uint32_t id);
|
||||
|
||||
diff -up firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/screen_capturer_pipewire.cc.firefox-pipewire-0-3 firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/screen_capturer_pipewire.cc
|
||||
--- firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/screen_capturer_pipewire.cc.firefox-pipewire-0-3 2020-07-20 22:53:57.000000000 +0200
|
||||
+++ firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/screen_capturer_pipewire.cc 2020-07-28 10:06:59.501481508 +0200
|
||||
@@ -15,7 +15,7 @@
|
||||
namespace webrtc {
|
||||
|
||||
ScreenCapturerPipeWire::ScreenCapturerPipeWire()
|
||||
- : BaseCapturerPipeWire(BaseCapturerPipeWire::CaptureSourceType::Screen) {}
|
||||
+ : BaseCapturerPipeWire(BaseCapturerPipeWire::CaptureSourceType::kScreen) {}
|
||||
ScreenCapturerPipeWire::~ScreenCapturerPipeWire() {}
|
||||
|
||||
// static
|
||||
diff -up firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/window_capturer_pipewire.cc.firefox-pipewire-0-3 firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/window_capturer_pipewire.cc
|
||||
--- firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/window_capturer_pipewire.cc.firefox-pipewire-0-3 2020-07-20 22:54:18.000000000 +0200
|
||||
+++ firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/window_capturer_pipewire.cc 2020-07-28 10:06:59.501481508 +0200
|
||||
@@ -15,7 +15,7 @@
|
||||
namespace webrtc {
|
||||
|
||||
WindowCapturerPipeWire::WindowCapturerPipeWire()
|
||||
- : BaseCapturerPipeWire(BaseCapturerPipeWire::CaptureSourceType::Window) {}
|
||||
+ : BaseCapturerPipeWire(BaseCapturerPipeWire::CaptureSourceType::kWindow) {}
|
||||
WindowCapturerPipeWire::~WindowCapturerPipeWire() {}
|
||||
|
||||
// static
|
||||
diff -up firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer_linux.cc.firefox-pipewire-0-3 firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer_linux.cc
|
||||
--- firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer_linux.cc.firefox-pipewire-0-3 2020-07-20 22:54:40.000000000 +0200
|
||||
+++ firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer_linux.cc 2020-07-28 10:06:59.501481508 +0200
|
||||
@@ -26,7 +26,7 @@ std::unique_ptr<DesktopCapturer> Desktop
|
||||
const DesktopCaptureOptions& options) {
|
||||
#if defined(WEBRTC_USE_PIPEWIRE)
|
||||
if (options.allow_pipewire() && DesktopCapturer::IsRunningUnderWayland()) {
|
||||
- return ScreenCapturerPipeWire::CreateRawScreenCapturer(options);
|
||||
+ return BaseCapturerPipeWire::CreateRawScreenCapturer(options);
|
||||
}
|
||||
#endif // defined(WEBRTC_USE_PIPEWIRE)
|
||||
|
||||
diff -up firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_linux.cc.firefox-pipewire-0-3 firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_linux.cc
|
||||
--- firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_linux.cc.firefox-pipewire-0-3 2020-07-20 22:53:32.000000000 +0200
|
||||
+++ firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_linux.cc 2020-07-28 10:06:59.501481508 +0200
|
||||
@@ -26,7 +26,7 @@ std::unique_ptr<DesktopCapturer> Desktop
|
||||
const DesktopCaptureOptions& options) {
|
||||
#if defined(WEBRTC_USE_PIPEWIRE)
|
||||
if (options.allow_pipewire() && DesktopCapturer::IsRunningUnderWayland()) {
|
||||
- return WindowCapturerPipeWire::CreateRawWindowCapturer(options);
|
||||
+ return BaseCapturerPipeWire::CreateRawWindowCapturer(options);
|
||||
}
|
||||
#endif // defined(WEBRTC_USE_PIPEWIRE)
|
||||
|
||||
15
firefox.spec
15
firefox.spec
@ -88,7 +88,7 @@
|
||||
Summary: Mozilla Firefox Web browser
|
||||
Name: firefox
|
||||
Version: 79.0
|
||||
Release: 10
|
||||
Release: 11
|
||||
URL: https://www.mozilla.org/firefox/
|
||||
License: MPLv1.1 or GPLv2+ or LGPLv2+
|
||||
Source0: https://archive.mozilla.org/pub/firefox/releases/%{version}/source/firefox-%{version}.source.tar.xz
|
||||
@ -116,14 +116,9 @@ Source34: firefox-search-provider.ini
|
||||
Patch3: mozilla-build-arm.patch
|
||||
Patch25: rhbz-1219542-s390-build.patch
|
||||
Patch26: build-icu-big-endian.patch
|
||||
Patch32: build-rust-ppc64le.patch
|
||||
Patch35: build-ppc-jit.patch
|
||||
Patch37: build-jit-atomic-always-lucky.patch
|
||||
Patch38: build-cacheFlush-missing.patch
|
||||
Patch40: build-aarch64-skia.patch
|
||||
Patch41: build-disable-elfhack.patch
|
||||
Patch44: build-arm-libopus.patch
|
||||
Patch46: firefox-nss-version.patch
|
||||
Patch48: build-arm-wasm.patch
|
||||
Patch49: build-arm-libaom.patch
|
||||
Patch51: mozilla-1640982.patch
|
||||
@ -133,17 +128,12 @@ Patch224: mozilla-1170092.patch
|
||||
Patch226: rhbz-1354671.patch
|
||||
Patch227: firefox-locale-debug.patch
|
||||
Patch402: mozilla-1196777.patch
|
||||
Patch412: mozilla-1337988.patch
|
||||
Patch417: bug1375074-save-restore-x28.patch
|
||||
Patch422: mozilla-1580174-webrtc-popup.patch
|
||||
Patch574: firefox-pipewire-0-2.patch
|
||||
Patch575: firefox-pipewire-0-3.patch
|
||||
Patch584: firefox-disable-ffvpx-with-vapi.patch
|
||||
Patch585: firefox-vaapi-extra-frames.patch
|
||||
Patch586: mozilla-1645671.patch
|
||||
Patch589: mozilla-1656436.patch
|
||||
Patch600: pgo.patch
|
||||
Patch601: mozilla-1516081.patch
|
||||
Patch602: mozilla-1516803.patch
|
||||
Patch603: CVE-2020-15664.patch
|
||||
Patch604: CVE-2020-15665.patch
|
||||
@ -825,6 +815,9 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
* Tue May 23 2023 wangkai <13474090681@163.com> - 79.0-11
|
||||
- Remove unused patches
|
||||
|
||||
* Fri Nov 18 2022 lvfei <lvfei@kylinos.cn> - 79.0-10
|
||||
- Fix fox expat CVE-2022-43680
|
||||
|
||||
|
||||
@ -1,496 +0,0 @@
|
||||
diff -up firefox-56.0/dom/plugins/base/nsJSNPRuntime.cpp.1337988 firefox-56.0/dom/plugins/base/nsJSNPRuntime.cpp
|
||||
--- firefox-56.0/dom/plugins/base/nsJSNPRuntime.cpp.1337988 2017-09-14 22:15:56.000000000 +0200
|
||||
+++ firefox-56.0/dom/plugins/base/nsJSNPRuntime.cpp 2017-09-25 10:34:11.205611698 +0200
|
||||
@@ -1719,7 +1719,7 @@ NPObjWrapper_ObjectMoved(JSObject *obj,
|
||||
auto entry =
|
||||
static_cast<NPObjWrapperHashEntry*>(sNPObjWrappers->Search(npobj));
|
||||
MOZ_ASSERT(entry && entry->mJSObj);
|
||||
- MOZ_ASSERT(entry->mJSObj == old);
|
||||
+ MOZ_ASSERT(entry->mJSObj.unbarrieredGetPtr() == old);
|
||||
entry->mJSObj = obj;
|
||||
}
|
||||
|
||||
diff -up firefox-56.0/js/ipc/JavaScriptShared.cpp.1337988 firefox-56.0/js/ipc/JavaScriptShared.cpp
|
||||
--- firefox-56.0/js/ipc/JavaScriptShared.cpp.1337988 2017-07-31 18:20:47.000000000 +0200
|
||||
+++ firefox-56.0/js/ipc/JavaScriptShared.cpp 2017-09-25 10:34:11.205611698 +0200
|
||||
@@ -101,7 +101,7 @@ IdToObjectMap::has(const ObjectId& id, c
|
||||
auto p = table_.lookup(id);
|
||||
if (!p)
|
||||
return false;
|
||||
- return p->value() == obj;
|
||||
+ return p->value().unbarrieredGet() == obj;
|
||||
}
|
||||
#endif
|
||||
|
||||
diff -up firefox-56.0/js/public/RootingAPI.h.1337988 firefox-56.0/js/public/RootingAPI.h
|
||||
--- firefox-56.0/js/public/RootingAPI.h.1337988 2017-07-31 18:20:47.000000000 +0200
|
||||
+++ firefox-56.0/js/public/RootingAPI.h 2017-09-25 10:34:11.206611695 +0200
|
||||
@@ -148,6 +148,10 @@ template<typename T>
|
||||
struct PersistentRootedMarker;
|
||||
} /* namespace gc */
|
||||
|
||||
+#define DECLARE_POINTER_COMPARISON_OPS(T) \
|
||||
+ bool operator==(const T& other) const { return get() == other; } \
|
||||
+ bool operator!=(const T& other) const { return get() != other; }
|
||||
+
|
||||
// Important: Return a reference so passing a Rooted<T>, etc. to
|
||||
// something that takes a |const T&| is not a GC hazard.
|
||||
#define DECLARE_POINTER_CONSTREF_OPS(T) \
|
||||
@@ -237,8 +241,6 @@ class Heap : public js::HeapBase<T, Heap
|
||||
static_assert(js::IsHeapConstructibleType<T>::value,
|
||||
"Type T must be a public GC pointer type");
|
||||
public:
|
||||
- using ElementType = T;
|
||||
-
|
||||
Heap() {
|
||||
static_assert(sizeof(T) == sizeof(Heap<T>),
|
||||
"Heap<T> must be binary compatible with T.");
|
||||
@@ -385,8 +387,6 @@ template <typename T>
|
||||
class TenuredHeap : public js::HeapBase<T, TenuredHeap<T>>
|
||||
{
|
||||
public:
|
||||
- using ElementType = T;
|
||||
-
|
||||
TenuredHeap() : bits(0) {
|
||||
static_assert(sizeof(T) == sizeof(TenuredHeap<T>),
|
||||
"TenuredHeap<T> must be binary compatible with T.");
|
||||
@@ -394,6 +394,9 @@ class TenuredHeap : public js::HeapBase<
|
||||
explicit TenuredHeap(T p) : bits(0) { setPtr(p); }
|
||||
explicit TenuredHeap(const TenuredHeap<T>& p) : bits(0) { setPtr(p.getPtr()); }
|
||||
|
||||
+ bool operator==(const TenuredHeap<T>& other) { return bits == other.bits; }
|
||||
+ bool operator!=(const TenuredHeap<T>& other) { return bits != other.bits; }
|
||||
+
|
||||
void setPtr(T newPtr) {
|
||||
MOZ_ASSERT((reinterpret_cast<uintptr_t>(newPtr) & flagsMask) == 0);
|
||||
if (newPtr)
|
||||
@@ -470,8 +473,6 @@ class MOZ_NONHEAP_CLASS Handle : public
|
||||
friend class JS::MutableHandle<T>;
|
||||
|
||||
public:
|
||||
- using ElementType = T;
|
||||
-
|
||||
/* Creates a handle from a handle of a type convertible to T. */
|
||||
template <typename S>
|
||||
MOZ_IMPLICIT Handle(Handle<S> handle,
|
||||
@@ -533,6 +534,7 @@ class MOZ_NONHEAP_CLASS Handle : public
|
||||
MOZ_IMPLICIT Handle(MutableHandle<S>& root,
|
||||
typename mozilla::EnableIf<mozilla::IsConvertible<S, T>::value, int>::Type dummy = 0);
|
||||
|
||||
+ DECLARE_POINTER_COMPARISON_OPS(T);
|
||||
DECLARE_POINTER_CONSTREF_OPS(T);
|
||||
DECLARE_NONPOINTER_ACCESSOR_METHODS(*ptr);
|
||||
|
||||
@@ -559,8 +561,6 @@ template <typename T>
|
||||
class MOZ_STACK_CLASS MutableHandle : public js::MutableHandleBase<T, MutableHandle<T>>
|
||||
{
|
||||
public:
|
||||
- using ElementType = T;
|
||||
-
|
||||
inline MOZ_IMPLICIT MutableHandle(Rooted<T>* root);
|
||||
inline MOZ_IMPLICIT MutableHandle(PersistentRooted<T>* root);
|
||||
|
||||
@@ -589,6 +589,7 @@ class MOZ_STACK_CLASS MutableHandle : pu
|
||||
return h;
|
||||
}
|
||||
|
||||
+ DECLARE_POINTER_COMPARISON_OPS(T);
|
||||
DECLARE_POINTER_CONSTREF_OPS(T);
|
||||
DECLARE_NONPOINTER_ACCESSOR_METHODS(*ptr);
|
||||
DECLARE_NONPOINTER_MUTABLE_ACCESSOR_METHODS(*ptr);
|
||||
@@ -805,8 +806,6 @@ class MOZ_RAII Rooted : public js::Roote
|
||||
}
|
||||
|
||||
public:
|
||||
- using ElementType = T;
|
||||
-
|
||||
template <typename RootingContext>
|
||||
explicit Rooted(const RootingContext& cx)
|
||||
: ptr(GCPolicy<T>::initial())
|
||||
@@ -839,6 +838,7 @@ class MOZ_RAII Rooted : public js::Roote
|
||||
ptr = mozilla::Move(value);
|
||||
}
|
||||
|
||||
+ DECLARE_POINTER_COMPARISON_OPS(T);
|
||||
DECLARE_POINTER_CONSTREF_OPS(T);
|
||||
DECLARE_POINTER_ASSIGN_OPS(Rooted, T);
|
||||
DECLARE_NONPOINTER_ACCESSOR_METHODS(ptr);
|
||||
@@ -903,14 +903,13 @@ template <typename T>
|
||||
class MOZ_RAII FakeRooted : public RootedBase<T, FakeRooted<T>>
|
||||
{
|
||||
public:
|
||||
- using ElementType = T;
|
||||
-
|
||||
template <typename CX>
|
||||
explicit FakeRooted(CX* cx) : ptr(JS::GCPolicy<T>::initial()) {}
|
||||
|
||||
template <typename CX>
|
||||
FakeRooted(CX* cx, T initial) : ptr(initial) {}
|
||||
|
||||
+ DECLARE_POINTER_COMPARISON_OPS(T);
|
||||
DECLARE_POINTER_CONSTREF_OPS(T);
|
||||
DECLARE_POINTER_ASSIGN_OPS(FakeRooted, T);
|
||||
DECLARE_NONPOINTER_ACCESSOR_METHODS(ptr);
|
||||
@@ -931,8 +930,6 @@ template <typename T>
|
||||
class FakeMutableHandle : public js::MutableHandleBase<T, FakeMutableHandle<T>>
|
||||
{
|
||||
public:
|
||||
- using ElementType = T;
|
||||
-
|
||||
MOZ_IMPLICIT FakeMutableHandle(T* t) {
|
||||
ptr = t;
|
||||
}
|
||||
@@ -1124,8 +1121,6 @@ class PersistentRooted : public js::Root
|
||||
}
|
||||
|
||||
public:
|
||||
- using ElementType = T;
|
||||
-
|
||||
PersistentRooted() : ptr(GCPolicy<T>::initial()) {}
|
||||
|
||||
explicit PersistentRooted(RootingContext* cx)
|
||||
@@ -1203,6 +1198,7 @@ class PersistentRooted : public js::Root
|
||||
}
|
||||
}
|
||||
|
||||
+ DECLARE_POINTER_COMPARISON_OPS(T);
|
||||
DECLARE_POINTER_CONSTREF_OPS(T);
|
||||
DECLARE_POINTER_ASSIGN_OPS(PersistentRooted, T);
|
||||
DECLARE_NONPOINTER_ACCESSOR_METHODS(ptr);
|
||||
@@ -1234,8 +1230,6 @@ class JS_PUBLIC_API(ObjectPtr)
|
||||
Heap<JSObject*> value;
|
||||
|
||||
public:
|
||||
- using ElementType = JSObject*;
|
||||
-
|
||||
ObjectPtr() : value(nullptr) {}
|
||||
|
||||
explicit ObjectPtr(JSObject* obj) : value(obj) {}
|
||||
@@ -1342,177 +1336,6 @@ Swap(JS::TenuredHeap<T>& aX, JS::Tenured
|
||||
|
||||
} /* namespace mozilla */
|
||||
|
||||
-namespace js {
|
||||
-namespace detail {
|
||||
-
|
||||
-// DefineComparisonOps is a trait which selects which wrapper classes to define
|
||||
-// operator== and operator!= for. It supplies a getter function to extract the
|
||||
-// value to compare. This is used to avoid triggering the automatic read
|
||||
-// barriers where appropriate.
|
||||
-//
|
||||
-// If DefineComparisonOps is not specialized for a particular wrapper you may
|
||||
-// get errors such as 'invalid operands to binary expression' or 'no match for
|
||||
-// operator==' when trying to compare against instances of the wrapper.
|
||||
-
|
||||
-template <typename T>
|
||||
-struct DefineComparisonOps : mozilla::FalseType {};
|
||||
-
|
||||
-template <typename T>
|
||||
-struct DefineComparisonOps<JS::Heap<T>> : mozilla::TrueType {
|
||||
- static const T& get(const JS::Heap<T>& v) { return v.unbarrieredGet(); }
|
||||
-};
|
||||
-
|
||||
-template <typename T>
|
||||
-struct DefineComparisonOps<JS::TenuredHeap<T>> : mozilla::TrueType {
|
||||
- static const T get(const JS::TenuredHeap<T>& v) { return v.unbarrieredGetPtr(); }
|
||||
-};
|
||||
-
|
||||
-template <>
|
||||
-struct DefineComparisonOps<JS::ObjectPtr> : mozilla::TrueType {
|
||||
- static const JSObject* get(const JS::ObjectPtr& v) { return v.unbarrieredGet(); }
|
||||
-};
|
||||
-
|
||||
-template <typename T>
|
||||
-struct DefineComparisonOps<JS::Rooted<T>> : mozilla::TrueType {
|
||||
- static const T& get(const JS::Rooted<T>& v) { return v.get(); }
|
||||
-};
|
||||
-
|
||||
-template <typename T>
|
||||
-struct DefineComparisonOps<JS::Handle<T>> : mozilla::TrueType {
|
||||
- static const T& get(const JS::Handle<T>& v) { return v.get(); }
|
||||
-};
|
||||
-
|
||||
-template <typename T>
|
||||
-struct DefineComparisonOps<JS::MutableHandle<T>> : mozilla::TrueType {
|
||||
- static const T& get(const JS::MutableHandle<T>& v) { return v.get(); }
|
||||
-};
|
||||
-
|
||||
-template <typename T>
|
||||
-struct DefineComparisonOps<JS::PersistentRooted<T>> : mozilla::TrueType {
|
||||
- static const T& get(const JS::PersistentRooted<T>& v) { return v.get(); }
|
||||
-};
|
||||
-
|
||||
-template <typename T>
|
||||
-struct DefineComparisonOps<js::FakeRooted<T>> : mozilla::TrueType {
|
||||
- static const T& get(const js::FakeRooted<T>& v) { return v.get(); }
|
||||
-};
|
||||
-
|
||||
-template <typename T>
|
||||
-struct DefineComparisonOps<js::FakeMutableHandle<T>> : mozilla::TrueType {
|
||||
- static const T& get(const js::FakeMutableHandle<T>& v) { return v.get(); }
|
||||
-};
|
||||
-
|
||||
-} /* namespace detail */
|
||||
-} /* namespace js */
|
||||
-
|
||||
-// Overload operator== and operator!= for all types with the DefineComparisonOps
|
||||
-// trait using the supplied getter.
|
||||
-//
|
||||
-// There are four cases:
|
||||
-
|
||||
-// Case 1: comparison between two wrapper objects.
|
||||
-
|
||||
-template <typename T, typename U>
|
||||
-typename mozilla::EnableIf<js::detail::DefineComparisonOps<T>::value &&
|
||||
- js::detail::DefineComparisonOps<U>::value, bool>::Type
|
||||
-operator==(const T& a, const U& b) {
|
||||
- return js::detail::DefineComparisonOps<T>::get(a) == js::detail::DefineComparisonOps<U>::get(b);
|
||||
-}
|
||||
-
|
||||
-template <typename T, typename U>
|
||||
-typename mozilla::EnableIf<js::detail::DefineComparisonOps<T>::value &&
|
||||
- js::detail::DefineComparisonOps<U>::value, bool>::Type
|
||||
-operator!=(const T& a, const U& b) {
|
||||
- return !(a == b);
|
||||
-}
|
||||
-
|
||||
-// Case 2: comparison between a wrapper object and its unwrapped element type.
|
||||
-
|
||||
-template <typename T>
|
||||
-typename mozilla::EnableIf<js::detail::DefineComparisonOps<T>::value, bool>::Type
|
||||
-operator==(const T& a, const typename T::ElementType& b) {
|
||||
- return js::detail::DefineComparisonOps<T>::get(a) == b;
|
||||
-}
|
||||
-
|
||||
-template <typename T>
|
||||
-typename mozilla::EnableIf<js::detail::DefineComparisonOps<T>::value, bool>::Type
|
||||
-operator!=(const T& a, const typename T::ElementType& b) {
|
||||
- return !(a == b);
|
||||
-}
|
||||
-
|
||||
-template <typename T>
|
||||
-typename mozilla::EnableIf<js::detail::DefineComparisonOps<T>::value, bool>::Type
|
||||
-operator==(const typename T::ElementType& a, const T& b) {
|
||||
- return a == js::detail::DefineComparisonOps<T>::get(b);
|
||||
-}
|
||||
-
|
||||
-template <typename T>
|
||||
-typename mozilla::EnableIf<js::detail::DefineComparisonOps<T>::value, bool>::Type
|
||||
-operator!=(const typename T::ElementType& a, const T& b) {
|
||||
- return !(a == b);
|
||||
-}
|
||||
-
|
||||
-// Case 3: For pointer wrappers, comparison between the wrapper and a const
|
||||
-// element pointer.
|
||||
-
|
||||
-template <typename T>
|
||||
-typename mozilla::EnableIf<js::detail::DefineComparisonOps<T>::value &&
|
||||
- mozilla::IsPointer<typename T::ElementType>::value, bool>::Type
|
||||
-operator==(const typename mozilla::RemovePointer<typename T::ElementType>::Type* a, const T& b) {
|
||||
- return a == js::detail::DefineComparisonOps<T>::get(b);
|
||||
-}
|
||||
-
|
||||
-template <typename T>
|
||||
-typename mozilla::EnableIf<js::detail::DefineComparisonOps<T>::value &&
|
||||
- mozilla::IsPointer<typename T::ElementType>::value, bool>::Type
|
||||
-operator!=(const typename mozilla::RemovePointer<typename T::ElementType>::Type* a, const T& b) {
|
||||
- return !(a == b);
|
||||
-}
|
||||
-
|
||||
-template <typename T>
|
||||
-typename mozilla::EnableIf<js::detail::DefineComparisonOps<T>::value &&
|
||||
- mozilla::IsPointer<typename T::ElementType>::value, bool>::Type
|
||||
-operator==(const T& a, const typename mozilla::RemovePointer<typename T::ElementType>::Type* b) {
|
||||
- return js::detail::DefineComparisonOps<T>::get(a) == b;
|
||||
-}
|
||||
-
|
||||
-template <typename T>
|
||||
-typename mozilla::EnableIf<js::detail::DefineComparisonOps<T>::value &&
|
||||
- mozilla::IsPointer<typename T::ElementType>::value, bool>::Type
|
||||
-operator!=(const T& a, const typename mozilla::RemovePointer<typename T::ElementType>::Type* b) {
|
||||
- return !(a == b);
|
||||
-}
|
||||
-
|
||||
-// Case 4: For pointer wrappers, comparison between the wrapper and nullptr.
|
||||
-
|
||||
-template <typename T>
|
||||
-typename mozilla::EnableIf<js::detail::DefineComparisonOps<T>::value &&
|
||||
- mozilla::IsPointer<typename T::ElementType>::value, bool>::Type
|
||||
-operator==(std::nullptr_t a, const T& b) {
|
||||
- return a == js::detail::DefineComparisonOps<T>::get(b);
|
||||
-}
|
||||
-
|
||||
-template <typename T>
|
||||
-typename mozilla::EnableIf<js::detail::DefineComparisonOps<T>::value &&
|
||||
- mozilla::IsPointer<typename T::ElementType>::value, bool>::Type
|
||||
-operator!=(std::nullptr_t a, const T& b) {
|
||||
- return !(a == b);
|
||||
-}
|
||||
-
|
||||
-template <typename T>
|
||||
-typename mozilla::EnableIf<js::detail::DefineComparisonOps<T>::value &&
|
||||
- mozilla::IsPointer<typename T::ElementType>::value, bool>::Type
|
||||
-operator==(const T& a, std::nullptr_t b) {
|
||||
- return js::detail::DefineComparisonOps<T>::get(a) == b;
|
||||
-}
|
||||
-
|
||||
-template <typename T>
|
||||
-typename mozilla::EnableIf<js::detail::DefineComparisonOps<T>::value &&
|
||||
- mozilla::IsPointer<typename T::ElementType>::value, bool>::Type
|
||||
-operator!=(const T& a, std::nullptr_t b) {
|
||||
- return !(a == b);
|
||||
-}
|
||||
-
|
||||
#undef DELETE_ASSIGNMENT_OPS
|
||||
|
||||
#endif /* js_RootingAPI_h */
|
||||
diff -up firefox-56.0/js/src/gc/Barrier.h.1337988 firefox-56.0/js/src/gc/Barrier.h
|
||||
--- firefox-56.0/js/src/gc/Barrier.h.1337988 2017-09-14 22:16:01.000000000 +0200
|
||||
+++ firefox-56.0/js/src/gc/Barrier.h 2017-09-25 10:34:11.206611695 +0200
|
||||
@@ -353,8 +353,8 @@ class WriteBarrieredBase : public Barrie
|
||||
explicit WriteBarrieredBase(const T& v) : BarrieredBase<T>(v) {}
|
||||
|
||||
public:
|
||||
- using ElementType = T;
|
||||
|
||||
+ DECLARE_POINTER_COMPARISON_OPS(T);
|
||||
DECLARE_POINTER_CONSTREF_OPS(T);
|
||||
|
||||
// Use this if the automatic coercion to T isn't working.
|
||||
@@ -612,13 +612,14 @@ class ReadBarriered : public ReadBarrier
|
||||
return *this;
|
||||
}
|
||||
|
||||
- const T& get() const {
|
||||
- if (InternalBarrierMethods<T>::isMarkable(this->value))
|
||||
- this->read();
|
||||
+ const T get() const {
|
||||
+ if (!InternalBarrierMethods<T>::isMarkable(this->value))
|
||||
+ return JS::GCPolicy<T>::initial();
|
||||
+ this->read();
|
||||
return this->value;
|
||||
}
|
||||
|
||||
- const T& unbarrieredGet() const {
|
||||
+ const T unbarrieredGet() const {
|
||||
return this->value;
|
||||
}
|
||||
|
||||
@@ -626,9 +627,9 @@ class ReadBarriered : public ReadBarrier
|
||||
return bool(this->value);
|
||||
}
|
||||
|
||||
- operator const T&() const { return get(); }
|
||||
+ operator const T() const { return get(); }
|
||||
|
||||
- const T& operator->() const { return get(); }
|
||||
+ const T operator->() const { return get(); }
|
||||
|
||||
T* unsafeGet() { return &this->value; }
|
||||
T const* unsafeGet() const { return &this->value; }
|
||||
@@ -955,35 +956,6 @@ typedef ReadBarriered<WasmTableObject*>
|
||||
|
||||
typedef ReadBarriered<Value> ReadBarrieredValue;
|
||||
|
||||
-namespace detail {
|
||||
-
|
||||
-template <typename T>
|
||||
-struct DefineComparisonOps<PreBarriered<T>> : mozilla::TrueType {
|
||||
- static const T& get(const PreBarriered<T>& v) { return v.get(); }
|
||||
-};
|
||||
-
|
||||
-template <typename T>
|
||||
-struct DefineComparisonOps<GCPtr<T>> : mozilla::TrueType {
|
||||
- static const T& get(const GCPtr<T>& v) { return v.get(); }
|
||||
-};
|
||||
-
|
||||
-template <typename T>
|
||||
-struct DefineComparisonOps<HeapPtr<T>> : mozilla::TrueType {
|
||||
- static const T& get(const HeapPtr<T>& v) { return v.get(); }
|
||||
-};
|
||||
-
|
||||
-template <typename T>
|
||||
-struct DefineComparisonOps<ReadBarriered<T>> : mozilla::TrueType {
|
||||
- static const T& get(const ReadBarriered<T>& v) { return v.unbarrieredGet(); }
|
||||
-};
|
||||
-
|
||||
-template <>
|
||||
-struct DefineComparisonOps<HeapSlot> : mozilla::TrueType {
|
||||
- static const Value& get(const HeapSlot& v) { return v.get(); }
|
||||
-};
|
||||
-
|
||||
-} /* namespace detail */
|
||||
-
|
||||
} /* namespace js */
|
||||
|
||||
#endif /* gc_Barrier_h */
|
||||
diff -up firefox-56.0/js/src/jsapi-tests/testGCHeapPostBarriers.cpp.1337988 firefox-56.0/js/src/jsapi-tests/testGCHeapPostBarriers.cpp
|
||||
--- firefox-56.0/js/src/jsapi-tests/testGCHeapPostBarriers.cpp.1337988 2017-09-14 22:16:02.000000000 +0200
|
||||
+++ firefox-56.0/js/src/jsapi-tests/testGCHeapPostBarriers.cpp 2017-09-25 10:34:11.206611695 +0200
|
||||
@@ -5,7 +5,6 @@
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
-#include "mozilla/TypeTraits.h"
|
||||
#include "mozilla/UniquePtr.h"
|
||||
|
||||
#include "js/RootingAPI.h"
|
||||
diff -up firefox-56.0/js/src/vm/SharedMem.h.1337988 firefox-56.0/js/src/vm/SharedMem.h
|
||||
--- firefox-56.0/js/src/vm/SharedMem.h.1337988 2017-06-15 22:52:29.000000000 +0200
|
||||
+++ firefox-56.0/js/src/vm/SharedMem.h 2017-09-25 10:34:11.206611695 +0200
|
||||
@@ -12,8 +12,8 @@
|
||||
template<typename T>
|
||||
class SharedMem
|
||||
{
|
||||
- // static_assert(mozilla::IsPointer<T>::value,
|
||||
- // "SharedMem encapsulates pointer types");
|
||||
+ static_assert(mozilla::IsPointer<T>::value,
|
||||
+ "SharedMem encapsulates pointer types");
|
||||
|
||||
enum Sharedness {
|
||||
IsUnshared,
|
||||
diff -up firefox-56.0/js/xpconnect/src/XPCInlines.h.1337988 firefox-56.0/js/xpconnect/src/XPCInlines.h
|
||||
--- firefox-56.0/js/xpconnect/src/XPCInlines.h.1337988 2017-09-14 22:16:03.000000000 +0200
|
||||
+++ firefox-56.0/js/xpconnect/src/XPCInlines.h 2017-09-25 10:34:11.206611695 +0200
|
||||
@@ -465,7 +465,7 @@ inline
|
||||
void XPCWrappedNativeTearOff::JSObjectMoved(JSObject* obj, const JSObject* old)
|
||||
{
|
||||
MOZ_ASSERT(!IsMarked());
|
||||
- MOZ_ASSERT(mJSObject == old);
|
||||
+ MOZ_ASSERT(mJSObject.unbarrieredGetPtr() == old);
|
||||
mJSObject = obj;
|
||||
}
|
||||
|
||||
diff -up firefox-56.0/js/xpconnect/src/XPCWrappedNative.cpp.1337988 firefox-56.0/js/xpconnect/src/XPCWrappedNative.cpp
|
||||
--- firefox-56.0/js/xpconnect/src/XPCWrappedNative.cpp.1337988 2017-09-14 22:16:03.000000000 +0200
|
||||
+++ firefox-56.0/js/xpconnect/src/XPCWrappedNative.cpp 2017-09-25 10:34:11.207611692 +0200
|
||||
@@ -874,7 +874,7 @@ void
|
||||
XPCWrappedNative::FlatJSObjectMoved(JSObject* obj, const JSObject* old)
|
||||
{
|
||||
JS::AutoAssertGCCallback inCallback;
|
||||
- MOZ_ASSERT(mFlatJSObject == old);
|
||||
+ MOZ_ASSERT(mFlatJSObject.unbarrieredGetPtr() == old);
|
||||
|
||||
nsWrapperCache* cache = nullptr;
|
||||
CallQueryInterface(mIdentity, &cache);
|
||||
diff -up firefox-56.0/js/xpconnect/src/XPCWrappedNativeProto.cpp.1337988 firefox-56.0/js/xpconnect/src/XPCWrappedNativeProto.cpp
|
||||
--- firefox-56.0/js/xpconnect/src/XPCWrappedNativeProto.cpp.1337988 2017-07-31 18:20:47.000000000 +0200
|
||||
+++ firefox-56.0/js/xpconnect/src/XPCWrappedNativeProto.cpp 2017-09-25 10:34:11.207611692 +0200
|
||||
@@ -101,7 +101,7 @@ XPCWrappedNativeProto::CallPostCreatePro
|
||||
void
|
||||
XPCWrappedNativeProto::JSProtoObjectFinalized(js::FreeOp* fop, JSObject* obj)
|
||||
{
|
||||
- MOZ_ASSERT(obj == mJSProtoObject, "huh?");
|
||||
+ MOZ_ASSERT(obj == mJSProtoObject.unbarrieredGet(), "huh?");
|
||||
|
||||
#ifdef DEBUG
|
||||
// Check that this object has already been swept from the map.
|
||||
@@ -117,7 +117,7 @@ XPCWrappedNativeProto::JSProtoObjectFina
|
||||
void
|
||||
XPCWrappedNativeProto::JSProtoObjectMoved(JSObject* obj, const JSObject* old)
|
||||
{
|
||||
- MOZ_ASSERT(mJSProtoObject == old);
|
||||
+ MOZ_ASSERT(mJSProtoObject.unbarrieredGet() == old);
|
||||
mJSProtoObject.init(obj); // Update without triggering barriers.
|
||||
}
|
||||
|
||||
@ -1,21 +0,0 @@
|
||||
diff -up firefox-71.0/build/moz.configure/lto-pgo.configure.1516081 firefox-71.0/build/moz.configure/lto-pgo.configure
|
||||
--- firefox-71.0/build/moz.configure/lto-pgo.configure.1516081 2019-11-26 01:02:19.000000000 +0100
|
||||
+++ firefox-71.0/build/moz.configure/lto-pgo.configure 2019-11-26 11:04:10.993077232 +0100
|
||||
@@ -71,7 +71,7 @@ set_config('PGO_PROFILE_PATH', pgo_profi
|
||||
def pgo_flags(compiler, target, profdata):
|
||||
if compiler.type == 'gcc':
|
||||
return namespace(
|
||||
- gen_cflags=['-fprofile-generate'],
|
||||
+ gen_cflags=['-fprofile-generate', '-DMOZ_PROFILE_INSTRUMENTATION'],
|
||||
gen_ldflags=['-fprofile-generate'],
|
||||
use_cflags=['-fprofile-use', '-fprofile-correction',
|
||||
'-Wcoverage-mismatch'],
|
||||
@@ -92,7 +92,7 @@ def pgo_flags(compiler, target, profdata
|
||||
gen_ldflags = ['-fprofile-generate']
|
||||
|
||||
return namespace(
|
||||
- gen_cflags=[prefix + '-fprofile-generate'],
|
||||
+ gen_cflags=[prefix + '-fprofile-generate', '-DMOZ_PROFILE_INSTRUMENTATION'],
|
||||
gen_ldflags=gen_ldflags,
|
||||
use_cflags=[prefix + '-fprofile-use=%s' % profdata,
|
||||
# Some error messages about mismatched profile data
|
||||
@ -1,51 +0,0 @@
|
||||
diff --git a/widget/gtk/nsWindow.cpp b/widget/gtk/nsWindow.cpp
|
||||
--- a/widget/gtk/nsWindow.cpp
|
||||
+++ b/widget/gtk/nsWindow.cpp
|
||||
@@ -1155,6 +1155,28 @@
|
||||
}
|
||||
}
|
||||
|
||||
+bool IsPopupWithoutToplevelParent(nsMenuPopupFrame* aMenuPopupFrame) {
|
||||
+ // Check if the popup is autocomplete (like tags autocomplete
|
||||
+ // in the bookmark edit popup).
|
||||
+ nsAtom* popupId = aMenuPopupFrame->GetContent()->GetID();
|
||||
+ if (popupId && popupId->Equals(NS_LITERAL_STRING("PopupAutoComplete"))) {
|
||||
+ return true;
|
||||
+ }
|
||||
+
|
||||
+ // Check if the popup is in popupnotificationcontent (like choosing capture
|
||||
+ // device when starting webrtc session).
|
||||
+ nsIFrame* parentFrame = aMenuPopupFrame->GetParent();
|
||||
+ if (!parentFrame) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ parentFrame = parentFrame->GetParent();
|
||||
+ if (parentFrame && parentFrame->GetContent()->NodeName().EqualsLiteral(
|
||||
+ "popupnotificationcontent")) {
|
||||
+ return true;
|
||||
+ }
|
||||
+ return false;
|
||||
+}
|
||||
+
|
||||
// Wayland keeps strong popup window hierarchy. We need to track active
|
||||
// (visible) popup windows and make sure we hide popup on the same level
|
||||
// before we open another one on that level. It means that every open
|
||||
@@ -1211,10 +1233,14 @@
|
||||
LOG(("...[%p] GetParentMenuWidget() = %p\n", (void*)this, parentWindow));
|
||||
|
||||
// If the popup is a regular menu but GetParentMenuWidget() returns
|
||||
- // nullptr which means it's connected non-menu parent
|
||||
- // (bookmark toolbar for instance).
|
||||
+ // nullptr which means is not a submenu of any other menu.
|
||||
// In this case use a parent given at nsWindow::Create().
|
||||
- if (!parentWindow && !menuPopupFrame->IsContextMenu()) {
|
||||
+ // But we have to avoid using mToplevelParentWindow in case the popup
|
||||
+ // is in 'popupnotificationcontent' element or autocomplete popup,
|
||||
+ // otherwise the popupnotification would disappear when for
|
||||
+ // example opening a popup with microphone selection.
|
||||
+ if (!parentWindow && !menuPopupFrame->IsContextMenu() &&
|
||||
+ !IsPopupWithoutToplevelParent(menuPopupFrame)) {
|
||||
parentWindow =
|
||||
get_window_for_gtk_widget(GTK_WIDGET(mToplevelParentWindow));
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user