7
0

Accepting request 1272843 from home:dziobian:gulgul-ultron:19

- Update to 35.2.1
  * Chromium 134.0.6998.205
  * Node 22.14.0
  * V8 13.4
  * Removed AVIF image format
  * Added excludeUrls to webRequest filter and deprecated the use of empty arrays in urls property.
  * Added fromVersionID on ServiceWorkers to get an instance of ServiceWorkerMain.
  * Deprecated getPreloads and setPreloads on Session.
  * Moved 'console-message' arguments into event object.
  * Added ServiceWorkerMain class to interact with service workers in the main process.
  * Added contextBridge.executeInMainWorld to safely execute code across world boundaries.
  * Added frame to 'console-message' event.
  * Added optional animation parameter to BrowserWindow.setVibrancy.
  * Added permission support for document.executeCommand("paste").
  * Added support for service worker preload scripts.
  * Support Portal's globalShortcuts.
    Electron must be run with --enable-features=GlobalShortcutsPortal in order to have the feature working.
  * see https://github.com/electron/electron/releases/tag/v35.0.0 and https://www.electronjs.org/blog/electron-35-0 for more
- Remove Fedora 40 support
  * drop bundled-minizip.patch
  * drop quiche-absl-HexStringToBytes.patch
- Leap 15.6: use backported wayland-protocols
  * drop wayland-protocol-toplevel-icon.patch
  * drop wayland-protocol-toplevel-icon-2.patch
  * drop wayland-protocol-toplevel-drag.patch
- Build with LTO also on 15.6 (so now we enable it everywhere)
- Fedora: use system simdjson
  * merge system-ada-url.patch into use-system-libraries-in-node.patch
- Drop no longer applicable patches
  * account_id-missing-optional.patch
  * blink-platform-INSIDE_BLINK-Wodr.patch
  * boringssl-internal-addc-cxx.patch
  * build-without-extensions.patch
  * css_attr_value_tainting-missing-once_flag.patch
  * electron-13-fix-base-check-nomerge.patch
  * exception_context-missing-variant.patch
  * fix-build-without-safebrowsing.patch
  * fix-build-without-service-discovery.patch
  * ip_protection_data_types-missing-optional.patch
  * node-compiler.patch
  * skia_image_decoder_base-missing-stack.patch
  * vtt_scanner-missing-variant.patch
  * wayland_connection-Wchanges-meaning.patch
- Add backported or upstreamable patches
  * ax_platform_node_id-fpermissive.patch
  * browser_process_impl-fix-safe_browsing_mode-0.patch
  * content_browser_client-incomplete-WebUIController.patch
  * css_shape_value-constructor.patch
  * exception_state-constexpr-initializer.patch
  * fix-build-without-pdf.patch
  * fix-build-without-video-effects.patch
  * media_session_uma_helper-missing-optional.patch
  * object_paint_properties-explicit-specialization-in-non-namespace-scope.patch
  * perfetto-ThreadTrack-Current-null-dereference.patch
  * picture_in_picture_window_manager_uma_helper-missing-optional.patch
  * plugin_utils-build-without-electron_extensions.patch
  * raw_ptr-fpermissive.patch
  * resource_response-Wchanges-meaning.patch
  * resource-Wchanges-meaning.patch
  * string-hasher-flax-vector-conversions.patch
  * string_truncator-convert.patch
  * style_scope-unqualified-To.patch
  * to_vector-std-projected-gcc119888.patch
  * unexportable_key_service_impl-Wlto-type-mismatch.patch
  * xml_document_parser-Wmissing-template-keyword.patch
- merge remove-libphonenumber.patch & delete-old-language-detection-which-uses-tflite.patch
  into remove-ai-language-detection-factory-which-requires-tflite-and-libphonenumber.patch
- Revert upstream change which breaks build with old abseil
  * webrtc-make_ref_counted-absl2024-nullability.patch
- Conditionally (15.6) remove feature change which needs new spirv
  * angle-SPV_BINARY_TO_TEXT_OPTION_NESTED_INDENT.patch
- Use system sqlite in node (except 15.6)
  * system-sqlite.patch
- Remove more rust code
  * chromium-132-no-rust.patch
- Actually disable AVIF support without disabling AV1 video
  * disable-avif-really.patch
- Various other build fixes
  * absl_strings-missing-headers.patch
  * blink-shape_result-highway.patch
  * build-without-mesage-center.patch
  * fix-system-highway.patch
  * gn-logspam-breaks-install.patch
  * permission-gcc14.2.patch

OBS-URL: https://build.opensuse.org/request/show/1272843
OBS-URL: https://build.opensuse.org/package/show/devel:languages:nodejs/nodejs-electron?expand=0&rev=203
This commit is contained in:
2025-04-26 10:25:13 +00:00
committed by Git OBS Bridge
parent bfff7443fb
commit aee6a35a0e
25 changed files with 88 additions and 2980 deletions

View File

@@ -1,33 +0,0 @@
From dc9db222b929f5da415216134b77d7f3bf141813 Mon Sep 17 00:00:00 2001
From: Ivan Murashov <ivan.murashov@lge.com>
Date: Wed, 18 Sep 2024 19:25:42 +0000
Subject: [PATCH] IWYU: Add missing include for std::optional usage in
account_id.h
In the CL https://crrev.com/c/5834683 used std::optional in the
components/account_id/account_id.h, but corresponding include
was missed. Added missing include for std::optional usage.
Bug: 41455655
Change-Id: Ifea71ffb41a8c83051ce95763d9cb836488ca86f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5872821
Commit-Queue: Ivan Murashov <ivan.murashov@lge.com>
Reviewed-by: Hidehiko Abe <hidehiko@chromium.org>
Reviewed-by: Xiyuan Xia <xiyuan@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1357262}
---
components/account_id/account_id.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/components/account_id/account_id.h b/components/account_id/account_id.h
index 9804f179139063..e03b974cb481ba 100644
--- a/components/account_id/account_id.h
+++ b/components/account_id/account_id.h
@@ -8,6 +8,7 @@
#include <stddef.h>
#include <functional>
+#include <optional>
#include <ostream>
#include <string>
#include <string_view>

View File

@@ -1,45 +0,0 @@
--- src/third_party/blink/public/platform/web_crypto_algorithm.h.orig 2024-07-24 12:50:54.735798500 +0200
+++ src/third_party/blink/public/platform/web_crypto_algorithm.h 2024-08-04 16:11:13.938867200 +0200
@@ -74,18 +74,14 @@ enum WebCryptoAlgorithmId {
kWebCryptoAlgorithmIdPbkdf2,
kWebCryptoAlgorithmIdEd25519,
kWebCryptoAlgorithmIdX25519,
-#if INSIDE_BLINK
kWebCryptoAlgorithmIdLast = kWebCryptoAlgorithmIdX25519,
-#endif
};
enum WebCryptoNamedCurve {
kWebCryptoNamedCurveP256,
kWebCryptoNamedCurveP384,
kWebCryptoNamedCurveP521,
-#if INSIDE_BLINK
kWebCryptoNamedCurveLast = kWebCryptoNamedCurveP521,
-#endif
};
enum WebCryptoAlgorithmParamsType {
@@ -153,11 +149,9 @@ class WebCryptoAlgorithmPrivate;
// methods on it (other than destruction, assignment, or IsNull()).
class BLINK_PLATFORM_EXPORT WebCryptoAlgorithm {
public:
-#if INSIDE_BLINK
WebCryptoAlgorithm() = default;
WebCryptoAlgorithm(WebCryptoAlgorithmId,
std::unique_ptr<WebCryptoAlgorithmParams>);
-#endif
static WebCryptoAlgorithm CreateNull();
static WebCryptoAlgorithm AdoptParamsAndCreate(WebCryptoAlgorithmId,
--- src/third_party/blink/public/platform/web_crypto_key.h.orig 2024-07-24 12:50:54.735798500 +0200
+++ src/third_party/blink/public/platform/web_crypto_key.h 2024-08-04 16:11:34.638017900 +0200
@@ -51,9 +51,7 @@ enum WebCryptoKeyUsage {
kWebCryptoKeyUsageWrapKey = 1 << 5,
kWebCryptoKeyUsageUnwrapKey = 1 << 6,
kWebCryptoKeyUsageDeriveBits = 1 << 7,
-#if INSIDE_BLINK
kEndOfWebCryptoKeyUsage,
-#endif
};
// A bitfield of WebCryptoKeyUsage

View File

@@ -1,60 +0,0 @@
--- webrtc-6261b/third_party/boringssl/src/crypto/internal.h.orig 2024-03-13 22:27:36.595241500 +0000
+++ webrtc-6261b/third_party/boringssl/src/crypto/internal.h 2024-03-14 19:45:48.047485200 +0000
@@ -1146,11 +1146,28 @@ static inline uint64_t CRYPTO_rotr_u64(u
// bit. |carry| must be zero or one.
#if OPENSSL_HAS_BUILTIN(__builtin_addc)
+#ifdef __cplusplus
+extern "C++" {
+static constexpr unsigned CRYPTO_GENERIC_ADDC(unsigned x, unsigned y,
+ unsigned carry, unsigned *out_carry){
+ return __builtin_addc(x, y, carry, out_carry);
+}
+static constexpr unsigned long CRYPTO_GENERIC_ADDC(unsigned long x, unsigned long y,
+ unsigned long carry, unsigned long *out_carry){
+ return __builtin_addcl(x, y, carry, out_carry);
+}
+static constexpr unsigned long long CRYPTO_GENERIC_ADDC(unsigned long long x, unsigned long long y,
+ unsigned long long carry, unsigned long long *out_carry){
+ return __builtin_addcll(x, y, carry, out_carry);
+}
+}
+#else
#define CRYPTO_GENERIC_ADDC(x, y, carry, out_carry) \
(_Generic((x), \
unsigned: __builtin_addc, \
unsigned long: __builtin_addcl, \
unsigned long long: __builtin_addcll))((x), (y), (carry), (out_carry))
+#endif
static inline uint32_t CRYPTO_addc_u32(uint32_t x, uint32_t y, uint32_t carry,
uint32_t *out_carry) {
@@ -1198,11 +1215,28 @@ static inline uint64_t CRYPTO_addc_u64(u
// bit. |borrow| must be zero or one.
#if OPENSSL_HAS_BUILTIN(__builtin_subc)
+#ifdef __cplusplus
+extern "C++" {
+static constexpr unsigned CRYPTO_GENERIC_SUBC(unsigned x, unsigned y,
+ unsigned borrow, unsigned *out_borrow){
+ return __builtin_subc(x, y, borrow, out_borrow);
+}
+static constexpr unsigned long CRYPTO_GENERIC_SUBC(unsigned long x, unsigned long y,
+ unsigned long borrow, unsigned long *out_borrow){
+ return __builtin_subcl(x, y, borrow, out_borrow);
+}
+static constexpr unsigned long long CRYPTO_GENERIC_SUBC(unsigned long long x, unsigned long long y,
+ unsigned long long borrow, unsigned long long *out_borrow){
+ return __builtin_subcll(x, y, borrow, out_borrow);
+}
+}
+#else
#define CRYPTO_GENERIC_SUBC(x, y, borrow, out_borrow) \
(_Generic((x), \
unsigned: __builtin_subc, \
unsigned long: __builtin_subcl, \
unsigned long long: __builtin_subcll))((x), (y), (borrow), (out_borrow))
+#endif
static inline uint32_t CRYPTO_subc_u32(uint32_t x, uint32_t y, uint32_t borrow,
uint32_t *out_borrow) {

View File

@@ -1,29 +0,0 @@
Work around this linker error:
[ 9463s] /usr/lib64/gcc/x86_64-suse-linux/12/../../../../x86_64-suse-linux/bin/ld: obj/electron/chromium_src/chrome/extension_navigation_ui_data.o: warning: relocation against `_ZN10extensions12WebViewGuest4TypeE' in read-only section `.text'
[ 9463s] /usr/lib64/gcc/x86_64-suse-linux/12/../../../../x86_64-suse-linux/bin/ld: obj/electron/chromium_src/chrome/extension_navigation_ui_data.o: in function `guest_view::GuestView<extensions::WebViewGuest>::AsDerivedGuest(guest_view::GuestViewBase*)':
[ 9463s] /home/abuild/rpmbuild/BUILD/src/out/Release/../../components/guest_view/browser/guest_view.h:67:(.text+0xdd): undefined reference to `extensions::WebViewGuest::Type'
This is not upstreamable as the problem is due to Electron changes to chromium, and is in dead code that would be removed in LTO builds.
--- src/extensions/browser/guest_view/web_view/web_view_guest.cc.old 2023-09-28 10:14:03.660044621 +0200
+++ src/extensions/browser/guest_view/web_view/web_view_guest.cc 2023-09-29 08:05:41.827245244 +0200
@@ -285,7 +285,6 @@ std::string WebViewGuest::GetPartitionID
}
// static
-const char WebViewGuest::Type[] = "webview";
const guest_view::GuestViewHistogramValue WebViewGuest::HistogramValue =
guest_view::GuestViewHistogramValue::kWebView;
--- src/extensions/browser/guest_view/web_view/web_view_guest.h.old 2023-09-28 10:14:03.660044621 +0200
+++ src/extensions/browser/guest_view/web_view/web_view_guest.h 2023-09-29 08:06:13.200529820 +0200
@@ -49,7 +49,7 @@ class WebViewGuest : public guest_view::
int embedder_process_id,
int view_instance_id);
- static const char Type[];
+ constexpr static const char Type[] = "webview";
static const guest_view::GuestViewHistogramValue HistogramValue;
// Returns the WebView partition ID associated with the render process

View File

@@ -1,43 +0,0 @@
--- src/build/linux/unbundle/zlib.gn.orig 2024-02-21 20:06:19.015040200 +0000
+++ src/build/linux/unbundle/zlib.gn 2024-02-23 18:40:02.635135600 +0000
@@ -23,21 +23,27 @@ source_set("zlib") {
public_configs = [ ":system_zlib" ]
}
-shim_headers("minizip_shim") {
- root_path = "contrib"
- headers = [
- "minizip/crypt.h",
- "minizip/ioapi.h",
- "minizip/iowin32.h",
- "minizip/mztools.h",
- "minizip/unzip.h",
- "minizip/zip.h",
+static_library("minizip") {
+ include_dirs = [
+ ".",
+ "//third_party/zlib",
]
-}
-source_set("minizip") {
- deps = [ ":minizip_shim" ]
- libs = [ "minizip" ]
+ sources = [
+ "contrib/minizip/ioapi.c",
+ "contrib/minizip/ioapi.h",
+ "contrib/minizip/unzip.c",
+ "contrib/minizip/unzip.h",
+ "contrib/minizip/zip.c",
+ "contrib/minizip/zip.h",
+ ]
+
+ deps = [ ":zlib" ]
+
+ configs -= [ "//build/config/compiler:chromium_code" ]
+ configs += [ "//build/config/compiler:no_chromium_code" ]
+
+ public_configs = [ ":zlib_config" ]
}
static_library("zip") {

View File

@@ -1,32 +0,0 @@
From c502d310d8cb91f1c1098a7287e75114023e57f0 Mon Sep 17 00:00:00 2001
From: Jose Dapena Paz <jdapena@igalia.com>
Date: Thu, 19 Sep 2024 10:55:23 +0000
Subject: [PATCH] IWYU: missing include for usage of std::once_flag in
css_attr_value_tainting.cc
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Bug: 41455655
Change-Id: I8a8d486c1ee3b2a162accb41faaadaaa0664595f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5872634
Reviewed-by: Steinar H Gunderson <sesse@chromium.org>
Commit-Queue: José Dapena Paz <jdapena@igalia.com>
Cr-Commit-Position: refs/heads/main@{#1357539}
---
third_party/blink/renderer/core/css/css_attr_value_tainting.cc | 2 ++
1 file changed, 2 insertions(+)
diff --git a/third_party/blink/renderer/core/css/css_attr_value_tainting.cc b/third_party/blink/renderer/core/css/css_attr_value_tainting.cc
index 42525e92307f8b..a44ffc15be2335 100644
--- a/third_party/blink/renderer/core/css/css_attr_value_tainting.cc
+++ b/third_party/blink/renderer/core/css/css_attr_value_tainting.cc
@@ -4,6 +4,8 @@
#include "third_party/blink/renderer/core/css/css_attr_value_tainting.h"
+#include <mutex>
+
#include "base/containers/span.h"
#include "base/unguessable_token.h"
#include "third_party/blink/renderer/core/css/parser/css_parser_token_stream.h"

View File

@@ -1,57 +0,0 @@
From 12e89eee78a2dea41591fedc7937ca83e68c9168 Mon Sep 17 00:00:00 2001
From: Fergal Daly <fergal@chromium.org>
Date: Tue, 17 Dec 2024 22:06:08 -0800
Subject: [PATCH] Delete the old language detection API.
Bug: 349927087
Change-Id: I41458da3cf03e78ec9c25fe3fddea343c3e982d6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6054825
Reviewed-by: Jiacheng Guo <gjc@google.com>
Commit-Queue: Fergal Daly <fergal@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1397739}
---
.../bindings/generated_in_modules.gni | 2 -
.../renderer/bindings/idl_in_modules.gni | 1 -
.../ai_language_detector.idl | 5 ++
.../modules/on_device_translation/BUILD.gn | 2 -
.../language_detector.cc | 52 ----------------
.../on_device_translation/language_detector.h | 41 -------------
.../language_detector.idl | 23 --------
.../on_device_translation/translation.cc | 59 -------------------
.../on_device_translation/translation.h | 7 ---
.../on_device_translation/translation.idl | 16 -----
.../canDetect.tentative.window.js | 9 ---
.../detect-en.tentative.window.js | 14 -----
12 files changed, 5 insertions(+), 226 deletions(-)
delete mode 100644 third_party/blink/renderer/modules/on_device_translation/language_detector.cc
delete mode 100644 third_party/blink/renderer/modules/on_device_translation/language_detector.h
delete mode 100644 third_party/blink/renderer/modules/on_device_translation/language_detector.idl
delete mode 100644 third_party/blink/web_tests/external/wpt/ai/language_detection/canDetect.tentative.window.js
delete mode 100644 third_party/blink/web_tests/external/wpt/ai/language_detection/detect-en.tentative.window.js
diff --git a/third_party/blink/renderer/bindings/generated_in_modules.gni b/third_party/blink/renderer/bindings/generated_in_modules.gni
index 05b8fe33432374..0fa149cc2101ac 100644
--- a/third_party/blink/renderer/bindings/generated_in_modules.gni
+++ b/third_party/blink/renderer/bindings/generated_in_modules.gni
@@ -2827,8 +2825,6 @@ generated_interface_sources_in_modules = [
"$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_track_default_list.cc",
"$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_track_default_list.h",
"$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_translation.cc",
- "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_language_detector.cc",
- "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_language_detector.h",
"$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_translation.h",
"$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_url.cc",
"$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_url.h",
diff --git a/third_party/blink/renderer/modules/on_device_translation/BUILD.gn b/third_party/blink/renderer/modules/on_device_translation/BUILD.gn
index 21470f0869cfda..21772fce07cc5e 100644
--- a/third_party/blink/renderer/modules/on_device_translation/BUILD.gn
+++ b/third_party/blink/renderer/modules/on_device_translation/BUILD.gn
@@ -8,8 +8,6 @@ blink_modules_sources("on_device_translation") {
sources = [
"dom_translation.cc",
"dom_translation.h",
- "language_detector.cc",
- "language_detector.h",
"language_translator.cc",
"language_translator.h",
"translation.cc",

View File

@@ -1,14 +0,0 @@
Index: electron-17.1.0/base/compiler_specific.h
===================================================================
--- electron-17.1.0.orig/base/compiler_specific.h 2022-03-07 17:20:29.460807562 +0100
+++ electron-17.1.0/base/compiler_specific.h 2022-03-09 08:28:51.902933750 +0100
@@ -366,7 +366,8 @@ inline constexpr bool AnalyzerAssumeTrue
#endif // defined(__clang_analyzer__)
// Use nomerge attribute to disable optimization of merging multiple same calls.
-#if defined(__clang__) && HAS_ATTRIBUTE(nomerge)
+#if defined(__clang__) && (__clang_major__ >= 12) && \
+ __has_attribute(nomerge) && !defined(OS_CHROMEOS)
#define NOMERGE [[clang::nomerge]]
#else
#define NOMERGE

View File

@@ -1,32 +0,0 @@
From 47fb59539e5744467eb6f7aae52f5a169910d56c Mon Sep 17 00:00:00 2001
From: Jose Dapena Paz <jdapena@igalia.com>
Date: Thu, 19 Sep 2024 11:04:49 +0000
Subject: [PATCH] IWYU: missing include for usage of std::variant in
exception_context.h
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Bug: 41455655
Change-Id: I7c4a26c28481de40b22646f5a9f018235079dbca
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5872753
Commit-Queue: José Dapena Paz <jdapena@igalia.com>
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1357540}
---
.../blink/renderer/platform/bindings/exception_context.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/third_party/blink/renderer/platform/bindings/exception_context.h b/third_party/blink/renderer/platform/bindings/exception_context.h
index 82d20a29326432..afa27f00d03924 100644
--- a/third_party/blink/renderer/platform/bindings/exception_context.h
+++ b/third_party/blink/renderer/platform/bindings/exception_context.h
@@ -5,6 +5,8 @@
#ifndef THIRD_PARTY_BLINK_RENDERER_PLATFORM_BINDINGS_EXCEPTION_CONTEXT_H_
#define THIRD_PARTY_BLINK_RENDERER_PLATFORM_BINDINGS_EXCEPTION_CONTEXT_H_
+#include <variant>
+
#include "base/check_op.h"
#include "base/dcheck_is_on.h"
#include "base/notreached.h"

View File

@@ -1,31 +0,0 @@
--- src/chrome/browser/ui/exclusive_access/fullscreen_controller.cc.orig 2024-12-08 18:44:40.908024234 +0100
+++ src/chrome/browser/ui/exclusive_access/fullscreen_controller.cc 2024-12-18 13:07:47.764725866 +0100
@@ -20,7 +20,6 @@
#include "chrome/browser/browser_process.h"
#include "chrome/browser/history/history_service_factory.h"
#include "chrome/browser/profiles/profile.h"
-#include "chrome/browser/safe_browsing/safe_browsing_service.h"
#if 0
#include "chrome/browser/ui/blocked_content/popunder_preventer.h"
#endif
@@ -117,20 +116,6 @@ void RecordWebsiteStateAtApiRequest(hist
void CheckUrlForAllowlistAndRecordMetric(
const GURL& url,
history::HistoryLastVisitResult result) {
- if (!g_browser_process->safe_browsing_service() ||
- !g_browser_process->safe_browsing_service()->database_manager()) {
- RecordWebsiteStateAtApiRequest(result, std::nullopt);
- return;
- }
- g_browser_process->safe_browsing_service()
- ->database_manager()
- ->CheckUrlForHighConfidenceAllowlist(
- url,
- base::BindOnce(
- [](history::HistoryLastVisitResult result, bool on_allowlist) {
- RecordWebsiteStateAtApiRequest(result, on_allowlist);
- },
- result));
}
} // namespace

View File

@@ -1,10 +0,0 @@
--- src/chrome/browser/extensions/api/BUILD.gn.orig 2024-12-08 18:34:53.171339936 +0100
+++ src/chrome/browser/extensions/api/BUILD.gn 2025-01-01 21:24:35.512530556 +0100
@@ -34,7 +34,6 @@ group("api_implementations") {
"//chrome/browser/extensions/api/downloads_internal",
"//chrome/browser/extensions/api/experimental_ai_data",
"//chrome/browser/extensions/api/font_settings",
- "//chrome/browser/extensions/api/mdns",
"//chrome/browser/extensions/api/module",
"//chrome/browser/extensions/api/networking_private",
"//chrome/browser/extensions/api/omnibox",

View File

@@ -1,32 +0,0 @@
From 7e28832cd3320d2b603e6ef9468581e1c65c14f1 Mon Sep 17 00:00:00 2001
From: Jose Dapena Paz <jdapena@igalia.com>
Date: Thu, 19 Sep 2024 15:05:26 +0000
Subject: [PATCH] IWYU: missing include for usage of std::optional in
ip_protection_data_types.h
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Bug: 41455655
Change-Id: Id26fc5bc3a4bde79c2f9a3134d18eeaab68603ad
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5873261
Commit-Queue: José Dapena Paz <jdapena@igalia.com>
Reviewed-by: Dustin Mitchell <djmitche@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1357601}
---
components/ip_protection/common/ip_protection_data_types.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/components/ip_protection/common/ip_protection_data_types.h b/components/ip_protection/common/ip_protection_data_types.h
index 35648110915fc4..978dfac4ac74a5 100644
--- a/components/ip_protection/common/ip_protection_data_types.h
+++ b/components/ip_protection/common/ip_protection_data_types.h
@@ -5,6 +5,8 @@
#ifndef COMPONENTS_IP_PROTECTION_COMMON_IP_PROTECTION_DATA_TYPES_H_
#define COMPONENTS_IP_PROTECTION_COMMON_IP_PROTECTION_DATA_TYPES_H_
+#include <optional>
+
#include "base/time/time.h"
namespace ip_protection {

View File

@@ -1,26 +0,0 @@
--- src/v8/src/codegen/riscv/macro-assembler-riscv.h.orig 2025-04-24 18:27:30.451008724 +0200
+++ src/v8/src/codegen/riscv/macro-assembler-riscv.h 2025-04-24 23:48:27.554835902 +0200
@@ -400,10 +400,7 @@ class V8_EXPORT_PRIVATE MacroAssembler :
push_helper(rs...);
}
- template <>
- void push_helper(Register r) {
- StoreWord(r, MemOperand(sp, 0));
- }
+ void push_helper() {}
public:
// Push a number of registers. The leftmost register first (to the highest
@@ -548,10 +545,7 @@ class V8_EXPORT_PRIVATE MacroAssembler :
LoadWord(r, MemOperand(sp, sizeof...(rs) * kSystemPointerSize));
}
- template <>
- void pop_helper(Register r) {
- LoadWord(r, MemOperand(sp, 0));
- }
+ void pop_helper() {}
public:
// Pop a number of registers. The leftmost register last (from the highest

View File

@@ -1,93 +0,0 @@
Disable various compiler configs (currently warning suppression). Like chromium-102-compiler.patch but for node
--- src/third_party/electron_node/BUILD.gn.old
+++ src/third_party/electron_node/BUILD.gn
@@ -142,12 +142,6 @@ config("node_lib_config") {
config("node_lib_config") {
include_dirs = [ "src" ]
- cflags = [
- "-Wno-shadow",
- # FIXME(deepak1556): include paths should be corrected,
- # refer https://docs.google.com/presentation/d/1oxNHaVjA9Gn_rTzX6HIpJHP7nXRua_0URXxxJ3oYRq0/edit#slide=id.g71ecd450e_2_702
- "-Wno-microsoft-include",
- ]
configs = [ ":node_features" ]
@@ -250,17 +249,6 @@ component("node_lib") {
deps += [ "deps/histogram" ]
}
frameworks = []
- cflags_cc = [
- "-Wno-deprecated-declarations",
- "-Wno-implicit-fallthrough",
- "-Wno-return-type",
- "-Wno-sometimes-uninitialized",
- "-Wno-string-plus-int",
- "-Wno-unused-function",
- "-Wno-unused-label",
- "-Wno-unused-private-field",
- "-Wno-unused-variable",
- ]
if (v8_enable_i18n_support) {
deps += [ "//third_party/icu" ]
@@ -353,6 +340,5 @@ component("node_lib") {
"src/node_crypto.cc",
"src/node_crypto.h",
]
- cflags_cc += [ "-Wno-sign-compare" ]
}
}
--- src/third_party/electron_node/deps/histogram/BUILD.gn.old
+++ src/third_party/electron_node/deps/histogram/BUILD.gn
@@ -1,12 +1,6 @@
config("histogram_config") {
include_dirs = [ "include" ]
- cflags = [
- "-Wno-implicit-function-declaration",
- "-Wno-incompatible-pointer-types",
- "-Wno-unused-function",
- "-Wno-atomic-alignment",
- ]
}
static_library("histogram") {
--- src/third_party/electron_node/deps/llhttp/BUILD.gn.old
+++ src/third_party/electron_node/deps/llhttp/BUILD.gn
@@ -1,6 +1,5 @@
config("llhttp_config") {
include_dirs = [ "include" ]
- cflags = [ "-Wno-unreachable-code" ]
}
static_library("llhttp") {
--- src/third_party/electron_node/deps/uv/BUILD.gn.old
+++ src/third_party/electron_node/deps/uv/BUILD.gn
@@ -32,24 +32,6 @@ static_library("uv") {
# This only has an effect on Windows, where it will cause libuv's symbols to be exported in node.lib
defines += [ "BUILDING_UV_SHARED=1" ]
- cflags_c = [
- "-Wno-incompatible-pointer-types",
- "-Wno-bitwise-op-parentheses",
- "-Wno-implicit-fallthrough",
- "-Wno-implicit-function-declaration",
- "-Wno-missing-braces",
- "-Wno-sign-compare",
- "-Wno-sometimes-uninitialized",
- "-Wno-string-conversion",
- "-Wno-switch",
- "-Wno-unused-function",
- "-Wno-unused-result",
- "-Wno-unused-variable",
- "-Wno-unreachable-code",
- "-Wno-unreachable-code-return",
- "-Wno-unused-but-set-variable",
- "-Wno-shadow",
- ]
libs = []

View File

@@ -1,3 +1,91 @@
-------------------------------------------------------------------
Sat Apr 26 09:53:27 UTC 2025 - Bruno Pitrus <brunopitrus@hotmail.com>
- Update to 35.2.1
* Chromium 134.0.6998.205
* Node 22.14.0
* V8 13.4
* Removed AVIF image format
* Added excludeUrls to webRequest filter and deprecated the use of empty arrays in urls property.
* Added fromVersionID on ServiceWorkers to get an instance of ServiceWorkerMain.
* Deprecated getPreloads and setPreloads on Session.
* Moved 'console-message' arguments into event object.
* Added ServiceWorkerMain class to interact with service workers in the main process.
* Added contextBridge.executeInMainWorld to safely execute code across world boundaries.
* Added frame to 'console-message' event.
* Added optional animation parameter to BrowserWindow.setVibrancy.
* Added permission support for document.executeCommand("paste").
* Added support for service worker preload scripts.
* Support Portal's globalShortcuts.
Electron must be run with --enable-features=GlobalShortcutsPortal in order to have the feature working.
* see https://github.com/electron/electron/releases/tag/v35.0.0 and https://www.electronjs.org/blog/electron-35-0 for more
- Remove Fedora 40 support
* drop bundled-minizip.patch
* drop quiche-absl-HexStringToBytes.patch
- Leap 15.6: use backported wayland-protocols
* drop wayland-protocol-toplevel-icon.patch
* drop wayland-protocol-toplevel-icon-2.patch
* drop wayland-protocol-toplevel-drag.patch
- Build with LTO also on 15.6 (so now we enable it everywhere)
- Fedora: use system simdjson
* merge system-ada-url.patch into use-system-libraries-in-node.patch
- Drop no longer applicable patches
* account_id-missing-optional.patch
* blink-platform-INSIDE_BLINK-Wodr.patch
* boringssl-internal-addc-cxx.patch
* build-without-extensions.patch
* css_attr_value_tainting-missing-once_flag.patch
* electron-13-fix-base-check-nomerge.patch
* exception_context-missing-variant.patch
* fix-build-without-safebrowsing.patch
* fix-build-without-service-discovery.patch
* ip_protection_data_types-missing-optional.patch
* node-compiler.patch
* skia_image_decoder_base-missing-stack.patch
* vtt_scanner-missing-variant.patch
* wayland_connection-Wchanges-meaning.patch
- Add backported or upstreamable patches
* ax_platform_node_id-fpermissive.patch
* browser_process_impl-fix-safe_browsing_mode-0.patch
* content_browser_client-incomplete-WebUIController.patch
* css_shape_value-constructor.patch
* exception_state-constexpr-initializer.patch
* fix-build-without-pdf.patch
* fix-build-without-video-effects.patch
* media_session_uma_helper-missing-optional.patch
* object_paint_properties-explicit-specialization-in-non-namespace-scope.patch
* perfetto-ThreadTrack-Current-null-dereference.patch
* picture_in_picture_window_manager_uma_helper-missing-optional.patch
* plugin_utils-build-without-electron_extensions.patch
* raw_ptr-fpermissive.patch
* resource_response-Wchanges-meaning.patch
* resource-Wchanges-meaning.patch
* string-hasher-flax-vector-conversions.patch
* string_truncator-convert.patch
* style_scope-unqualified-To.patch
* to_vector-std-projected-gcc119888.patch
* unexportable_key_service_impl-Wlto-type-mismatch.patch
* xml_document_parser-Wmissing-template-keyword.patch
- merge remove-libphonenumber.patch & delete-old-language-detection-which-uses-tflite.patch
into remove-ai-language-detection-factory-which-requires-tflite-and-libphonenumber.patch
- Revert upstream change which breaks build with old abseil
* webrtc-make_ref_counted-absl2024-nullability.patch
- Conditionally (15.6) remove feature change which needs new spirv
* angle-SPV_BINARY_TO_TEXT_OPTION_NESTED_INDENT.patch
- Use system sqlite in node (except 15.6)
* system-sqlite.patch
- Remove more rust code
* chromium-132-no-rust.patch
- Actually disable AVIF support without disabling AV1 video
* disable-avif-really.patch
- Various other build fixes
* absl_strings-missing-headers.patch
* blink-shape_result-highway.patch
* build-without-mesage-center.patch
* fix-system-highway.patch
* gn-logspam-breaks-install.patch
* permission-gcc14.2.patch
-------------------------------------------------------------------
Sat Apr 19 08:45:19 UTC 2025 - Bruno Pitrus <brunopitrus@hotmail.com>

View File

@@ -212,15 +212,8 @@ Source410: aom3.10-AV1E_SET_MAX_CONSEC_FRAME_DROP_MS_CBR.patch
Source411: aom3.10-AV1E_SET_AUTO_TILES.patch
Source412: webrtc-aom3.8-AV1E_SET_MAX_CONSEC_FRAME_DROP_CBR.patch
Source413: webrtc-aom3.8-AV1E_SET_MAX_CONSEC_FRAME_DROP_CBR-2.patch
# and wayland protocol 1.32
#Source420: wayland-protocol-toplevel-icon.patch
#Source421: wayland-protocol-toplevel-icon-2.patch
#Source422: wayland-protocol-toplevel-drag.patch
#Source423: wayland_connection-Wchanges-meaning.patch
# and abseil 2407
#Source460: quiche-absl-HexStringToBytes.patch
Source461: webrtc-make_ref_counted-absl2024-nullability.patch
#Source462: quiche-absl-HexStringToBytes-2.patch
# and c-ares 1.19
Source470: node-cares-1.21.patch
# and spirv 2023
@@ -244,7 +237,6 @@ Patch75: gcc-asmflags.patch
Patch77: angle_link_glx.patch
Patch78: rdynamic.patch
Patch80: icon.patch
#Patch82: node-compiler.patch
Patch84: aarch64-Xclang.patch
Patch85: devtools-frontend-compress_files-oom.patch
Patch86: enable_stack_trace_line_numbers-symbol_level.patch
@@ -269,7 +261,6 @@ Patch586: aom-vpx-no-thread-wrapper.patch
Patch588: remove-password-manager-and-policy.patch
Patch589: remove-puffin.patch
Patch590: remove-sync.patch
#Patch591: fix-build-without-safebrowsing.patch
Patch592: fix-build-without-supervised-users.patch
Patch593: fix-build-without-screen-ai.patch
Patch594: build-without-speech-service.patch
@@ -280,8 +271,6 @@ Patch597: chromium-125-cloud_authenticator.patch
Patch598: chromium-127-crabby.patch
Patch599: chromium-132-no-rust.patch
#End gentoo patches
#Patch600: remove-libphonenumber.patch
#Patch601: delete-old-language-detection-which-uses-tflite.patch
Patch601: MakeSbixTypeface-null-pointer-call.patch
Patch602: remove-ai-language-detection-factory-which-requires-tflite-and-libphonenumber.patch
Patch603: build-without-mesage-center.patch
@@ -313,7 +302,6 @@ Patch1078: system-simdutf.patch
Patch1079: system-libm.patch
Patch1085: webp-no-sharpyuv.patch
Patch1086: zip_internal-missing-uLong-Z_DEFAULT_COMPRESSION.patch
#Patch1087: system-ada-url.patch
Patch1088: cr130-abseil-remove-unused-deps.patch
Patch1089: system-absl_algorithm.patch
Patch1090: cr130-absl-base.patch
@@ -325,18 +313,9 @@ Patch1094: absl_strings-missing-headers.patch
# PATCHES to fix interaction with third-party software
Patch2010: chromium-93-ffmpeg-4.4.patch
# Fixe builds with older clang versions that do not allow
# nomerge attributes on declaration. Otherwise, the following error
# is produced:
# 'nomerge' attribute cannot be applied to a declaration
# See https://reviews.llvm.org/D92800
#Patch2022: electron-13-fix-base-check-nomerge.patch
Patch2032: seccomp_bpf-no-lto.patch
Patch2034: swiftshader-LLVMJIT-AddressSanitizerPass-dead-code-remove.patch
Patch2035: RenderFrameHostImpl-use-after-free.patch
# https://github.com/electron/electron/pull/40032
#Patch2040: build-without-extensions.patch
%if %{without bro_11}
Patch2042: brotli-remove-shared-dictionary.patch
%else
@@ -344,7 +323,6 @@ Source2042: brotli-remove-shared-dictionary.patch
%endif
Patch2045: libxml-2.12-xmlCtxtGetLastError-const.patch
Patch2046: chromium-118-sigtrap_system_ffmpeg.patch
#Patch2047: bundled-minizip.patch
Patch2048: absl2023-encapsulated_web_transport-StrCat.patch
#Work around gcc14 overly aggressive optimizer.
Patch2058: v8-strict-aliasing.patch
@@ -373,18 +351,9 @@ Patch3134: swiftshader-llvm18-LLVMJIT-Host.patch
Patch3135: swiftshader-llvm18-LLVMJIT-CodeGenOptLevel.patch
Patch3138: distributed_point_functions-aes_128_fixed_key_hash-missing-StrCat.patch
Patch3144: mt21_util-flax-vector-conversions.patch
#Patch3149: boringssl-internal-addc-cxx.patch
Patch3151: distributed_point_functions-evaluate_prg_hwy-signature.patch
#Patch3173: blink-platform-INSIDE_BLINK-Wodr.patch
Patch3174: swiftshader-llvm19-LLVMJIT-getHostCPUFeatures.patch
Patch3175: swiftshader-llvm19-LLVMReactor-incomplete-Module.patch
#Patch3176: fix-build-without-service-discovery.patch
#Patch3178: ip_protection_data_types-missing-optional.patch
#Patch3179: account_id-missing-optional.patch
#Patch3180: skia_image_decoder_base-missing-stack.patch
#Patch3181: exception_context-missing-variant.patch
#Patch3182: css_attr_value_tainting-missing-once_flag.patch
#Patch3183: vtt_scanner-missing-variant.patch
Patch3184: electron_usb_delegate-incomplete-UsbDeviceInfo.patch
Patch3185: bsc1224178-font-gc.patch
Patch3186: string_view-incomplete-CodePointIterator.patch
@@ -410,8 +379,6 @@ Patch3205: plugin_utils-build-without-electron_extensions.patch
Patch3206: string-hasher-flax-vector-conversions.patch
Patch3207: unexportable_key_service_impl-Wlto-type-mismatch.patch
Patch3208: to_vector-std-projected-gcc119888.patch
Patch3209: macro-assembler-riscv-explicit-specialization-in-non-namespace-scope.patch
Patch3210: v8-macro-assembler-riscv-leaptiering.patch
# Patches to re-enable upstream force disabled features.
# There's no sense in submitting them but they may be reused as-is by other packagers.
@@ -751,10 +718,6 @@ providing better integration with desktop environments such as KDE.
# Sanity check if macro corresponds to the actual ABI
test $(grep ^node_module_version electron/build/args/all.gn | sed 's/.* = //') = %abi_version
%if %{without system_abseil}
#patch -R -p1 < %PATCH1076
%endif
#These ones depend on an aom nightly, reverting unconditionally
patch -R -p1 < %SOURCE411
@@ -1297,17 +1260,6 @@ myconf_gn+=' enable_perfetto_trace_processor_json=false'
myconf_gn+=' enable_perfetto_trace_processor_httpd=false'
myconf_gn+=' enable_perfetto_zlib=false'
#Otherwise mksnapshot crashes
#0 perfetto::ThreadTrack::Current () at ../../third_party/perfetto/src/tracing/track.cc:105
#1 0x0000555555815084 in v8::internal::GCTracer::GCTracer () at ../../v8/src/heap/gc-tracer.cc:184
#2 v8::internal::Heap::SetUpSpaces (this=0x555557507788, new_allocation_info=..., old_allocation_info=...) at ../../v8/src/heap/heap.cc:5788
#3 0x000055555704895b in v8::internal::Isolate::Init(v8::internal::SnapshotData*, v8::internal::SnapshotData*, v8::internal::SnapshotData*, bool) [clone .isra.0] () at ../../v8/src/execution/isolate.cc:5556
#4 0x0000555555b51ad3 in v8::internal::Isolate::InitWithoutSnapshot () at ../../v8/src/execution/isolate.cc:5184
#5 v8::internal::SnapshotCreatorImpl::InitInternal (this=0x55555750c130, blob=0x0) at ../../v8/src/snapshot/snapshot.cc:868
#6 0x0000555555654b15 in v8::internal::SnapshotCreatorImpl::SnapshotCreatorImpl () at ../../v8/src/snapshot/snapshot.cc:929
#7 v8::SnapshotCreator::SnapshotCreator () at ../../v8/src/api/api.cc:552
#8 main (argc=1465209528, argv=0x3ff0000000000000) at ../../v8/src/snapshot/mksnapshot.cc:298
#myconf_gn+=' v8_use_perfetto=false'

View File

@@ -1,116 +0,0 @@
From a484a561d3d36beca0d4dc9f5d4a2c083be03e1f Mon Sep 17 00:00:00 2001
From: awillia <awillia@google.com>
Date: Tue, 19 Mar 2024 17:22:54 -0700
Subject: [PATCH] Replace deprecated version of absl::HexStringToBytes in test
programs and remaining quic/ tests
Replaces the deprecated version of absl::HexStringToBytes that returns std::string with the version that returns bool and populates a passed in std::string. This CL isn't expected to change the behavior of any code used in production.
This allows the Chrome build of QUICHE to build without the `-Wno-deprecated-declarations` clang flag.
PiperOrigin-RevId: 617342915
---
.../web_transport_fingerprint_proof_verifier.cc | 12 ++++++++++--
quiche/quic/masque/masque_client_bin.cc | 7 ++++++-
quiche/quic/masque/masque_server_backend.cc | 5 ++++-
quiche/quic/tools/crypto_message_printer_bin.cc | 6 +++++-
quiche/quic/tools/quic_packet_printer_bin.cc | 6 +++++-
quiche/quic/tools/quic_toy_client.cc | 17 +++++++++--------
6 files changed, 39 insertions(+), 14 deletions(-)
diff --git a/quiche/quic/core/crypto/web_transport_fingerprint_proof_verifier.cc b/quiche/quic/core/crypto/web_transport_fingerprint_proof_verifier.cc
index 167e4efc4..fc8cffd40 100644
--- a/net/third_party/quiche/src/quiche/quic/core/crypto/web_transport_fingerprint_proof_verifier.cc
+++ b/net/third_party/quiche/src/quiche/quic/core/crypto/web_transport_fingerprint_proof_verifier.cc
@@ -18,6 +20,7 @@
#include "quiche/quic/core/quic_types.h"
#include "quiche/quic/core/quic_utils.h"
#include "quiche/quic/platform/api/quic_bug_tracker.h"
+#include "quiche/quic/platform/api/quic_logging.h"
#include "quiche/common/quiche_text_utils.h"
namespace quic {
@@ -83,8 +86,13 @@ bool WebTransportFingerprintProofVerifier::AddFingerprint(
std::string normalized =
absl::StrReplaceAll(fingerprint.fingerprint, {{":", ""}});
- hashes_.push_back(WebTransportHash{fingerprint.algorithm,
- absl::HexStringToBytes(normalized)});
+ std::string normalized_bytes;
+ if (!absl::HexStringToBytes(normalized, &normalized_bytes)) {
+ QUIC_DLOG(WARNING) << "Fingerprint hexadecimal is invalid";
+ return false;
+ }
+ hashes_.push_back(
+ WebTransportHash{fingerprint.algorithm, std::move(normalized_bytes)});
return true;
}
diff --git a/quiche/quic/masque/masque_client_bin.cc b/quiche/quic/masque/masque_client_bin.cc
index eefd002dc..06e6ed2b7 100644
--- a/net/third_party/quiche/src/quiche/quic/masque/masque_client_bin.cc
+++ b/net/third_party/quiche/src/quiche/quic/masque/masque_client_bin.cc
@@ -281,7 +281,12 @@ int RunMasqueClient(int argc, char* argv[]) {
QUIC_LOG(ERROR) << "Concealed authentication key ID cannot be empty";
return 1;
}
- private_key_seed = absl::HexStringToBytes(concealed_auth_param_split[1]);
+ if (!absl::HexStringToBytes(concealed_auth_param_split[1],
+ &private_key_seed)) {
+ QUIC_LOG(ERROR) << "Concealed authentication key hex value is invalid";
+ return 1;
+ }
+
if (private_key_seed.size() != kEd25519Rfc8032PrivateKeySize) {
QUIC_LOG(ERROR)
<< "Invalid Concealed authentication private key length "
diff --git a/quiche/quic/masque/masque_server_backend.cc b/quiche/quic/masque/masque_server_backend.cc
index f4ff2e0ed..66ca13c96 100644
--- a/net/third_party/quiche/src/quiche/quic/masque/masque_server_backend.cc
+++ b/net/third_party/quiche/src/quiche/quic/masque/masque_server_backend.cc
@@ -193,7 +193,10 @@ void MasqueServerBackend::SetSignatureAuth(absl::string_view signature_auth) {
quiche::QuicheTextUtils::RemoveLeadingAndTrailingWhitespace(&kv[1]);
ConcealedAuthCredential credential;
credential.key_id = std::string(kv[0]);
- std::string public_key = absl::HexStringToBytes(kv[1]);
+ std::string public_key;
+ if (!absl::HexStringToBytes(kv[1], &public_key)) {
+ QUIC_LOG(FATAL) << "Invalid concealed auth public key hex " << kv[1];
+ }
if (public_key.size() != sizeof(credential.public_key)) {
QUIC_LOG(FATAL) << "Invalid concealed auth public key length "
<< public_key.size();
diff --git a/quiche/quic/tools/crypto_message_printer_bin.cc b/quiche/quic/tools/crypto_message_printer_bin.cc
index eb7393d54..82850d94a 100644
--- a/net/third_party/quiche/src/quiche/quic/tools/crypto_message_printer_bin.cc
+++ b/net/third_party/quiche/src/quiche/quic/tools/crypto_message_printer_bin.cc
@@ -48,7 +48,11 @@ int main(int argc, char* argv[]) {
quic::CryptoFramer framer;
framer.set_visitor(&printer);
framer.set_process_truncated_messages(true);
- std::string input = absl::HexStringToBytes(messages[0]);
+ std::string input;
+ if (!absl::HexStringToBytes(messages[0], &input)) {
+ cerr << "Invalid hex string provided" << endl;
+ return 1;
+ }
if (!framer.ProcessInput(input)) {
return 1;
}
diff --git a/quiche/quic/tools/quic_packet_printer_bin.cc b/quiche/quic/tools/quic_packet_printer_bin.cc
index 5ed77010a..314cc20ea 100644
--- a/net/third_party/quiche/src/quiche/quic/tools/quic_packet_printer_bin.cc
+++ b/net/third_party/quiche/src/quiche/quic/tools/quic_packet_printer_bin.cc
@@ -270,7 +270,11 @@ int main(int argc, char* argv[]) {
quiche::QuichePrintCommandLineFlagHelp(usage);
return 1;
}
- std::string hex = absl::HexStringToBytes(args[1]);
+ std::string hex;
+ if (!absl::HexStringToBytes(args[1], &hex)) {
+ std::cerr << "Invalid hex string" << std::endl;
+ return 1;
+ }
quic::ParsedQuicVersionVector versions = quic::AllSupportedVersions();
// Fake a time since we're not actually generating acks.
quic::QuicTime start(quic::QuicTime::Zero());

View File

@@ -1,28 +0,0 @@
From 39583ff118920284de516d262979960e7159bcfc Mon Sep 17 00:00:00 2001
From: Jose Dapena Paz <jdapena@igalia.com>
Date: Thu, 19 Sep 2024 15:44:36 +0000
Subject: [PATCH] IWYU: missing include for usage of std::stack in
skia_image_decoder_base.cc
Bug: 41455655
Change-Id: Id9c09f951dacc34d46aadc4badc6b3fd250ad38b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5872492
Reviewed-by: Peter Kasting <pkasting@chromium.org>
Commit-Queue: Peter Kasting <pkasting@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1357626}
---
.../platform/image-decoders/skia/skia_image_decoder_base.cc | 1 +
1 file changed, 1 insertion(+)
diff --git a/third_party/blink/renderer/platform/image-decoders/skia/skia_image_decoder_base.cc b/third_party/blink/renderer/platform/image-decoders/skia/skia_image_decoder_base.cc
index 1d002cc258ae8b..84fd71c1e46139 100644
--- a/third_party/blink/renderer/platform/image-decoders/skia/skia_image_decoder_base.cc
+++ b/third_party/blink/renderer/platform/image-decoders/skia/skia_image_decoder_base.cc
@@ -5,6 +5,7 @@
#include "third_party/blink/renderer/platform/image-decoders/skia/skia_image_decoder_base.h"
#include <limits>
+#include <stack>
#include "third_party/blink/renderer/platform/image-decoders/segment_stream.h"
#include "third_party/skia/include/codec/SkCodec.h"

View File

@@ -1,19 +0,0 @@
--- src/third_party/electron_node/unofficial.gni.orig 2025-04-11 21:14:18.899221050 +0200
+++ src/third_party/electron_node/unofficial.gni 2025-04-11 21:14:28.715218444 +0200
@@ -143,7 +143,6 @@ template("node_gn_build") {
"deps/googletest:googletest_config",
]
public_deps = [
- "deps/ada",
"deps/uv",
"//electron:electron_js2c",
"deps/simdjson",
@@ -183,6 +182,8 @@ template("node_gn_build") {
configs -= [ "//build/config/gcc:symbol_visibility_hidden" ]
configs += [ "//build/config/gcc:symbol_visibility_default" ]
}
+ libs = [ "ada" ]
+ include_dirs = []
if (use_system_llhttp) {
libs += [ "llhttp" ]
} else {

View File

@@ -1,818 +0,0 @@
From 4d24761fae4b1de87a1ba7a507e98be157a64bf4 Mon Sep 17 00:00:00 2001
From: Alexey Pavlyutkin <alexey.pavlyutkin@syntacore.com>
Date: Thu, 13 Feb 2025 11:40:23 +0000
Subject: [PATCH] [riscv][leaptiering] Enable leaptiering support
Fix RISC-V build broken by unconditional enabling of leaptiering (see
6207491).
Change-Id: I72db70b09b98410ae83d40b3251495b8bcbda207
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/6249680
Reviewed-by: Yahan Lu (LuYahan) <yahan@iscas.ac.cn>
Reviewed-by: Ji Qiu <qiuji@iscas.ac.cn>
Commit-Queue: Ji Qiu <qiuji@iscas.ac.cn>
Cr-Commit-Position: refs/heads/main@{#98693}
---
src/builtins/riscv/builtins-riscv.cc | 27 +-
src/codegen/riscv/macro-assembler-riscv.cc | 321 +++++++++++-------
src/codegen/riscv/macro-assembler-riscv.h | 48 ++-
src/codegen/riscv/register-riscv.h | 3 +-
.../backend/riscv/code-generator-riscv.cc | 41 ++-
src/maglev/riscv/maglev-assembler-riscv.cc | 3 +
6 files changed, 286 insertions(+), 157 deletions(-)
diff --git a/src/builtins/riscv/builtins-riscv.cc b/src/builtins/riscv/builtins-riscv.cc
index 4d637bd281ee..54960a8cb0ef 100644
--- a/v8/src/builtins/riscv/builtins-riscv.cc
+++ b/v8/src/builtins/riscv/builtins-riscv.cc
@@ -996,6 +996,7 @@ void Builtins::Generate_BaselineOutOfLinePrologueDeopt(MacroAssembler* masm) {
}
void Builtins::Generate_BaselineOutOfLinePrologue(MacroAssembler* masm) {
+ ASM_CODE_COMMENT(masm);
UseScratchRegisterScope temps(masm);
temps.Include({kScratchReg, kScratchReg2, s1});
auto descriptor =
@@ -1016,11 +1017,14 @@ void Builtins::Generate_BaselineOutOfLinePrologue(MacroAssembler* masm) {
__ AssertFeedbackVector(feedback_vector, type);
}
+#ifndef V8_ENABLE_LEAPTIERING
// Check for an tiering state.
Label flags_need_processing;
Register flags = temps.Acquire();
__ LoadFeedbackVectorFlagsAndJumpIfNeedsProcessing(
flags, feedback_vector, CodeKind::BASELINE, &flags_need_processing);
+#endif
+
{
UseScratchRegisterScope temps(masm);
ResetFeedbackVectorOsrUrgency(masm, feedback_vector, temps.Acquire());
@@ -1096,6 +1100,7 @@ void Builtins::Generate_BaselineOutOfLinePrologue(MacroAssembler* masm) {
// TODO(v8:11429): Document this frame setup better.
__ Ret();
+#ifndef V8_ENABLE_LEAPTIERING
__ bind(&flags_need_processing);
{
ASM_CODE_COMMENT_STRING(masm, "Optimized marker check");
@@ -1104,6 +1109,7 @@ void Builtins::Generate_BaselineOutOfLinePrologue(MacroAssembler* masm) {
__ OptimizeCodeOrTailCallOptimizedCodeSlot(flags, feedback_vector);
__ Trap();
}
+#endif
__ bind(&call_stack_guard);
{
@@ -1157,15 +1163,16 @@ void Builtins::Generate_InterpreterEntryTrampoline(
__ LoadFeedbackVector(feedback_vector, closure, a4, &push_stack_frame);
#ifndef V8_JITLESS
+#ifndef V8_ENABLE_LEAPTIERING
// If feedback vector is valid, check for optimized code and update invocation
// count.
-
// Check the tiering state.
Label flags_need_processing;
Register flags = a4;
__ LoadFeedbackVectorFlagsAndJumpIfNeedsProcessing(
flags, feedback_vector, CodeKind::INTERPRETED_FUNCTION,
&flags_need_processing);
+#endif // V8_ENABLE_LEAPTIERING
ResetFeedbackVectorOsrUrgency(masm, feedback_vector, a4);
// Increment invocation count for the function.
@@ -1323,10 +1330,13 @@ void Builtins::Generate_InterpreterEntryTrampoline(
__ Branch(&after_stack_check_interrupt);
#ifndef V8_JITLESS
+#ifndef V8_ENABLE_LEAPTIERING
__ bind(&flags_need_processing);
__ OptimizeCodeOrTailCallOptimizedCodeSlot(flags, feedback_vector);
+#endif //! V8_ENABLE_LEAPTIERING
__ bind(&is_baseline);
{
+#ifndef V8_ENABLE_LEAPTIERING
// Load the feedback vector from the closure.
__ LoadTaggedField(
feedback_vector,
@@ -1347,7 +1357,6 @@ void Builtins::Generate_InterpreterEntryTrampoline(
__ LoadFeedbackVectorFlagsAndJumpIfNeedsProcessing(
flags, feedback_vector, CodeKind::BASELINE, &flags_need_processing);
-#ifndef V8_ENABLE_LEAPTIERING
// TODO(olivf, 42204201): This fastcase is difficult to support with the
// sandbox as it requires getting write access to the dispatch table. See
// `JSFunction::UpdateCode`. We might want to remove it for all
@@ -1357,9 +1366,9 @@ void Builtins::Generate_InterpreterEntryTrampoline(
static_assert(kJavaScriptCallCodeStartRegister == a2, "ABI mismatch");
__ ReplaceClosureCodeWithOptimizedCode(a2, closure);
__ JumpCodeObject(a2, kJSEntrypointTag);
-#endif // V8_ENABLE_LEAPTIERING
-
__ bind(&install_baseline_code);
+#endif // !V8_ENABLE_LEAPTIERING
+
__ GenerateTailCallToReturnedCode(Runtime::kInstallBaselineCode);
}
#endif // !V8_JITLESS
@@ -2630,9 +2639,13 @@ void Builtins::Generate_CallFunction(MacroAssembler* masm,
// -- cp : the function context.
// -----------------------------------
+#ifdef V8_ENABLE_LEAPTIERING
+ __ InvokeFunctionCode(a1, no_reg, a0, InvokeType::kJump);
+#else
__ Lhu(a2,
FieldMemOperand(a2, SharedFunctionInfo::kFormalParameterCountOffset));
__ InvokeFunctionCode(a1, no_reg, a2, a0, InvokeType::kJump);
+#endif
}
namespace {
@@ -5084,9 +5097,13 @@ void Builtins::Generate_RestartFrameTrampoline(MacroAssembler* masm) {
// Pop return address and frame.
__ LeaveFrame(StackFrame::INTERPRETED);
+#ifdef V8_ENABLE_LEAPTIERING
+ __ InvokeFunction(a1, a0, InvokeType::kJump,
+ ArgumentAdaptionMode::kDontAdapt);
+#else
__ li(a2, Operand(kDontAdaptArgumentsSentinel));
-
__ InvokeFunction(a1, a2, a0, InvokeType::kJump);
+#endif
}
#undef __
diff --git a/src/codegen/riscv/macro-assembler-riscv.cc b/src/codegen/riscv/macro-assembler-riscv.cc
index aca1e993183f..ae86dddd6777 100644
--- a/v8/src/codegen/riscv/macro-assembler-riscv.cc
+++ b/v8/src/codegen/riscv/macro-assembler-riscv.cc
@@ -209,24 +209,7 @@ void MacroAssembler::GenerateTailCallToReturnedCode(
Jump(a2);
}
-Condition MacroAssembler::LoadFeedbackVectorFlagsAndCheckIfNeedsProcessing(
- Register flags, Register feedback_vector, Register result,
- CodeKind current_code_kind) {
- ASM_CODE_COMMENT(this);
- DCHECK(!AreAliased(flags, feedback_vector));
- DCHECK(CodeKindCanTierUp(current_code_kind));
-
- Lhu(flags, FieldMemOperand(feedback_vector, FeedbackVector::kFlagsOffset));
- uint32_t kFlagsMask = FeedbackVector::kFlagsTieringStateIsAnyRequested |
- FeedbackVector::kFlagsMaybeHasTurbofanCode |
- FeedbackVector::kFlagsLogNextExecution;
- if (current_code_kind != CodeKind::MAGLEV) {
- kFlagsMask |= FeedbackVector::kFlagsMaybeHasMaglevCode;
- }
- And(result, flags, Operand(kFlagsMask));
- return ne;
-}
-
+#ifndef V8_ENABLE_LEAPTIERING
// Read off the flags in the feedback vector and check if there
// is optimized code or a tiering state that needs to be processed.
void MacroAssembler::LoadFeedbackVectorFlagsAndJumpIfNeedsProcessing(
@@ -248,22 +231,6 @@ void MacroAssembler::OptimizeCodeOrTailCallOptimizedCodeSlot(
Register flags, Register feedback_vector) {
ASM_CODE_COMMENT(this);
DCHECK(!AreAliased(flags, feedback_vector));
-#ifdef V8_ENABLE_LEAPTIERING
- // In the leaptiering case, we don't load optimized code from the feedback
- // vector so only need to call CompileOptimized or FunctionLogNextExecution
- // here. See also LoadFeedbackVectorFlagsAndJumpIfNeedsProcessing above.
- Label needs_logging;
- {
- UseScratchRegisterScope temps(this);
- Register scratch = temps.Acquire();
- And(scratch, flags,
- Operand(FeedbackVector::kFlagsTieringStateIsAnyRequested));
- Branch(&needs_logging, eq, scratch, Operand(zero_reg));
- }
- GenerateTailCallToReturnedCode(Runtime::kCompileOptimized);
- bind(&needs_logging);
- GenerateTailCallToReturnedCode(Runtime::kFunctionLogNextExecution);
-#else
UseScratchRegisterScope temps(this);
temps.Include(t0, t1);
Label maybe_has_optimized_code, maybe_needs_logging;
@@ -296,8 +263,8 @@ void MacroAssembler::OptimizeCodeOrTailCallOptimizedCodeSlot(
FeedbackVector::kMaybeOptimizedCodeOffset));
TailCallOptimizedCodeSlot(this, optimized_code_entry, temps.Acquire(),
temps.Acquire());
-#endif // V8_ENABLE_LEAPTIERING
}
+#endif // V8_ENABLE_LEAPTIERING
void MacroAssembler::LoadIsolateField(const Register& rd, IsolateFieldId id) {
li(rd, ExternalReference::Create(id));
@@ -5630,7 +5597,7 @@ void MacroAssembler::StackOverflowCheck(Register num_args, Register scratch1,
void MacroAssembler::InvokePrologue(Register expected_parameter_count,
Register actual_parameter_count,
- Label* done, InvokeType type) {
+ InvokeType type) {
Label regular_invoke;
// a0: actual arguments count
@@ -5649,8 +5616,7 @@ void MacroAssembler::InvokePrologue(Register expected_parameter_count,
Label stack_overflow;
{
UseScratchRegisterScope temps(this);
- StackOverflowCheck(expected_parameter_count, temps.Acquire(),
- temps.Acquire(), &stack_overflow);
+ StackOverflowCheck(expected_parameter_count, t0, t1, &stack_overflow);
}
// Underapplication. Move the arguments already in the stack, including the
// receiver and the return address.
@@ -5694,90 +5660,150 @@ void MacroAssembler::InvokePrologue(Register expected_parameter_count,
bind(&regular_invoke);
}
-void MacroAssembler::CheckDebugHook(Register fun, Register new_target,
- Register expected_parameter_count,
- Register actual_parameter_count) {
- Label skip_hook;
- {
- UseScratchRegisterScope temps(this);
- Register scratch = temps.Acquire();
- li(scratch,
- ExternalReference::debug_hook_on_function_call_address(isolate()));
- Lb(scratch, MemOperand(scratch));
- Branch(&skip_hook, eq, scratch, Operand(zero_reg));
+void MacroAssembler::CallDebugOnFunctionCall(
+ Register fun, Register new_target,
+ Register expected_parameter_count_or_dispatch_handle,
+ Register actual_parameter_count) {
+ ASM_CODE_COMMENT(this);
+ DCHECK(!AreAliased(t0, fun, new_target,
+ expected_parameter_count_or_dispatch_handle,
+ actual_parameter_count));
+
+ // Load receiver to pass it later to DebugOnFunctionCall hook.
+ LoadReceiver(t0);
+ FrameScope frame(
+ this, has_frame() ? StackFrame::NO_FRAME_TYPE : StackFrame::INTERNAL);
+
+ SmiTag(expected_parameter_count_or_dispatch_handle);
+ SmiTag(actual_parameter_count);
+ Push(expected_parameter_count_or_dispatch_handle, actual_parameter_count);
+
+ if (new_target.is_valid()) {
+ Push(new_target);
+ }
+ Push(fun, fun, t0);
+ CallRuntime(Runtime::kDebugOnFunctionCall);
+ Pop(fun);
+ if (new_target.is_valid()) {
+ Pop(new_target);
}
- {
- // Load receiver to pass it later to DebugOnFunctionCall hook.
- UseScratchRegisterScope temps(this);
- Register receiver = temps.Acquire();
- LoadReceiver(receiver);
- FrameScope frame(
- this, has_frame() ? StackFrame::NO_FRAME_TYPE : StackFrame::INTERNAL);
- SmiTag(expected_parameter_count);
- Push(expected_parameter_count);
+ Pop(expected_parameter_count_or_dispatch_handle, actual_parameter_count);
+ SmiUntag(actual_parameter_count);
+ SmiUntag(expected_parameter_count_or_dispatch_handle);
+}
- SmiTag(actual_parameter_count);
- Push(actual_parameter_count);
+#ifdef V8_ENABLE_LEAPTIERING
+void MacroAssembler::InvokeFunction(
+ Register function, Register actual_parameter_count, InvokeType type,
+ ArgumentAdaptionMode argument_adaption_mode) {
+ ASM_CODE_COMMENT(this);
+ // You can't call a function without a valid frame.
+ DCHECK(type == InvokeType::kJump || has_frame());
- if (new_target.is_valid()) {
- Push(new_target);
- }
- Push(fun);
- Push(fun);
- Push(receiver);
- CallRuntime(Runtime::kDebugOnFunctionCall);
- Pop(fun);
- if (new_target.is_valid()) {
- Pop(new_target);
- }
+ // Contract with called JS functions requires that function is passed in a1.
+ // (See FullCodeGenerator::Generate().)
+ DCHECK_EQ(function, a1);
- Pop(actual_parameter_count);
- SmiUntag(actual_parameter_count);
+ // Set up the context.
+ LoadTaggedField(cp, FieldMemOperand(function, JSFunction::kContextOffset));
- Pop(expected_parameter_count);
- SmiUntag(expected_parameter_count);
- }
- bind(&skip_hook);
+ InvokeFunctionCode(function, no_reg, actual_parameter_count, type,
+ argument_adaption_mode);
}
-void MacroAssembler::InvokeFunctionCode(Register function, Register new_target,
- Register expected_parameter_count,
- Register actual_parameter_count,
- InvokeType type) {
+void MacroAssembler::InvokeFunctionWithNewTarget(
+ Register function, Register new_target, Register actual_parameter_count,
+ InvokeType type) {
+ ASM_CODE_COMMENT(this);
+ // You can't call a function without a valid frame.
+ DCHECK(type == InvokeType::kJump || has_frame());
+
+ // Contract with called JS functions requires that function is passed in a1.
+ // (See FullCodeGenerator::Generate().)
+ DCHECK_EQ(function, a1);
+
+ LoadTaggedField(cp, FieldMemOperand(function, JSFunction::kContextOffset));
+
+ InvokeFunctionCode(function, new_target, actual_parameter_count, type);
+}
+
+void MacroAssembler::InvokeFunctionCode(
+ Register function, Register new_target, Register actual_parameter_count,
+ InvokeType type, ArgumentAdaptionMode argument_adaption_mode) {
+ ASM_CODE_COMMENT(this);
// You can't call a function without a valid frame.
DCHECK_IMPLIES(type == InvokeType::kCall, has_frame());
DCHECK_EQ(function, a1);
DCHECK_IMPLIES(new_target.is_valid(), new_target == a3);
+ Register dispatch_handle = kJavaScriptCallDispatchHandleRegister;
+ Lw(dispatch_handle,
+ FieldMemOperand(function, JSFunction::kDispatchHandleOffset));
+
// On function call, call into the debugger if necessary.
- CheckDebugHook(function, new_target, expected_parameter_count,
- actual_parameter_count);
+ Label debug_hook, continue_after_hook;
+ {
+ li(t0, ExternalReference::debug_hook_on_function_call_address(isolate()));
+ Lb(t0, MemOperand(t0, 0));
+ BranchShort(&debug_hook, ne, t0, Operand(zero_reg));
+ }
+ bind(&continue_after_hook);
// Clear the new.target register if not given.
if (!new_target.is_valid()) {
LoadRoot(a3, RootIndex::kUndefinedValue);
}
- Label done;
- InvokePrologue(expected_parameter_count, actual_parameter_count, &done, type);
+ Register scratch = s1;
+ if (argument_adaption_mode == ArgumentAdaptionMode::kAdapt) {
+ Register expected_parameter_count = a2;
+ LoadParameterCountFromJSDispatchTable(expected_parameter_count,
+ dispatch_handle, scratch);
+ InvokePrologue(expected_parameter_count, actual_parameter_count, type);
+ }
+
// We call indirectly through the code field in the function to
// allow recompilation to take effect without changing any of the
// call sites.
- constexpr int unused_argument_count = 0;
+ LoadEntrypointFromJSDispatchTable(kJavaScriptCallCodeStartRegister,
+ dispatch_handle, scratch);
switch (type) {
case InvokeType::kCall:
- CallJSFunction(function, unused_argument_count);
+ Call(kJavaScriptCallCodeStartRegister);
break;
case InvokeType::kJump:
- JumpJSFunction(function);
+ Jump(kJavaScriptCallCodeStartRegister);
break;
}
+ Label done;
+ Branch(&done);
+
+ // Deferred debug hook.
+ bind(&debug_hook);
+ CallDebugOnFunctionCall(function, new_target, dispatch_handle,
+ actual_parameter_count);
+ Branch(&continue_after_hook);
- // Continue here if InvokePrologue does handle the invocation due to
- // mismatched parameter counts.
bind(&done);
}
+#else // !V8_ENABLE_LEAPTIERING
+void MacroAssembler::InvokeFunction(Register function,
+ Register expected_parameter_count,
+ Register actual_parameter_count,
+ InvokeType type) {
+ // You can't call a function without a valid frame.
+ DCHECK_IMPLIES(type == InvokeType::kCall, has_frame());
+
+ // Contract with called JS functions requires that function is passed in a1.
+ DCHECK_EQ(function, a1);
+
+ // Get the function and setup the context.
+ LoadTaggedField(cp, FieldMemOperand(a1, JSFunction::kContextOffset));
+
+ InvokeFunctionCode(a1, no_reg, expected_parameter_count,
+ actual_parameter_count, type);
+}
void MacroAssembler::InvokeFunctionWithNewTarget(
Register function, Register new_target, Register actual_parameter_count,
@@ -5804,23 +5830,44 @@ void MacroAssembler::InvokeFunctionWithNewTarget(
actual_parameter_count, type);
}
-void MacroAssembler::InvokeFunction(Register function,
- Register expected_parameter_count,
- Register actual_parameter_count,
- InvokeType type) {
+void MacroAssembler::InvokeFunctionCode(Register function, Register new_target,
+ Register expected_parameter_count,
+ Register actual_parameter_count,
+ InvokeType type) {
// You can't call a function without a valid frame.
DCHECK_IMPLIES(type == InvokeType::kCall, has_frame());
-
- // Contract with called JS functions requires that function is passed in a1.
DCHECK_EQ(function, a1);
+ DCHECK_IMPLIES(new_target.is_valid(), new_target == a3);
- // Get the function and setup the context.
- LoadTaggedField(cp, FieldMemOperand(a1, JSFunction::kContextOffset));
+ // On function call, call into the debugger if necessary.
+ CheckDebugHook(function, new_target, expected_parameter_count,
+ actual_parameter_count);
- InvokeFunctionCode(a1, no_reg, expected_parameter_count,
- actual_parameter_count, type);
-}
+ // Clear the new.target register if not given.
+ if (!new_target.is_valid()) {
+ LoadRoot(a3, RootIndex::kUndefinedValue);
+ }
+
+ Label done;
+ InvokePrologue(expected_parameter_count, actual_parameter_count, &done, type);
+ // We call indirectly through the code field in the function to
+ // allow recompilation to take effect without changing any of the
+ // call sites.
+ constexpr int unused_argument_count = 0;
+ switch (type) {
+ case InvokeType::kCall:
+ CallJSFunction(function, unused_argument_count);
+ break;
+ case InvokeType::kJump:
+ JumpJSFunction(function);
+ break;
+ }
+ // Continue here if InvokePrologue does handle the invocation due to
+ // mismatched parameter counts.
+ bind(&done);
+}
+#endif // V8_ENABLE_LEAPTIERING
// ---------------------------------------------------------------------------
// Support functions.
@@ -7240,14 +7287,30 @@ void MacroAssembler::ComputeCodeStartAddress(Register dst) {
// 2. test kMarkedForDeoptimizationBit in those flags; and
// 3. if it is not zero then it jumps to the builtin.
void MacroAssembler::BailoutIfDeoptimized() {
- int offset = InstructionStream::kCodeOffset - InstructionStream::kHeaderSize;
- LoadProtectedPointerField(
- kScratchReg, MemOperand(kJavaScriptCallCodeStartRegister, offset));
- Lw(kScratchReg, FieldMemOperand(kScratchReg, Code::kFlagsOffset));
- And(kScratchReg, kScratchReg,
- Operand(1 << Code::kMarkedForDeoptimizationBit));
- TailCallBuiltin(Builtin::kCompileLazyDeoptimizedCode, ne, kScratchReg,
+ ASM_CODE_COMMENT(this);
+ UseScratchRegisterScope temps(this);
+ Register scratch = temps.Acquire();
+ if (v8_flags.debug_code || !V8_ENABLE_LEAPTIERING_BOOL) {
+ int offset =
+ InstructionStream::kCodeOffset - InstructionStream::kHeaderSize;
+ LoadProtectedPointerField(
+ scratch, MemOperand(kJavaScriptCallCodeStartRegister, offset));
+ Lw(scratch, FieldMemOperand(scratch, Code::kFlagsOffset));
+ }
+
+#ifdef V8_ENABLE_LEAPTIERING
+ if (v8_flags.debug_code) {
+ Label not_deoptimized;
+ And(scratch, scratch, Operand(1 << Code::kMarkedForDeoptimizationBit));
+ Branch(&not_deoptimized, eq, scratch, Operand(zero_reg));
+ Abort(AbortReason::kInvalidDeoptimizedCode);
+ bind(&not_deoptimized);
+ }
+#else
+ And(scratch, scratch, Operand(1 << Code::kMarkedForDeoptimizationBit));
+ TailCallBuiltin(Builtin::kCompileLazyDeoptimizedCode, ne, scratch,
Operand(zero_reg));
+#endif
}
void MacroAssembler::CallForDeoptimization(Builtin target, int, Label* exit,
@@ -7303,22 +7366,20 @@ void MacroAssembler::JumpCodeObject(Register code_object, CodeEntrypointTag tag,
}
void MacroAssembler::CallJSFunction(Register function_object,
- uint16_t argument_count) {
- DCHECK_WITH_MSG(!V8_ENABLE_LEAPTIERING_BOOL,
- "argument_count is only used with Leaptiering");
+ [[maybe_unused]] uint16_t argument_count) {
ASM_CODE_COMMENT(this);
Register code = kJavaScriptCallCodeStartRegister;
#ifdef V8_ENABLE_LEAPTIERING
- UseScratchRegisterScope temps(this);
- Register dispatch_handle = t0;
+ Register dispatch_handle = kJavaScriptCallDispatchHandleRegister;
Register parameter_count = t1;
+ UseScratchRegisterScope temps(this);
Register scratch = temps.Acquire();
Lw(dispatch_handle,
FieldMemOperand(function_object, JSFunction::kDispatchHandleOffset));
LoadEntrypointAndParameterCountFromJSDispatchTable(code, parameter_count,
dispatch_handle, scratch);
Label match;
- Branch(&match, le, parameter_count, Immediate(argument_count));
+ Branch(&match, le, parameter_count, Operand(argument_count));
// If the parameter count doesn't match, we force a safe crash by setting the
// code entrypoint to zero, causing a nullptr dereference during the call.
mv(code, zero_reg);
@@ -7366,13 +7427,14 @@ void MacroAssembler::JumpJSFunction(Register function_object,
ASM_CODE_COMMENT(this);
Register code = kJavaScriptCallCodeStartRegister;
#ifdef V8_ENABLE_LEAPTIERING
- LoadCodeEntrypointFromJSDispatchTable(
- code,
- FieldMemOperand(function_object, JSFunction::kDispatchHandleOffset));
+ Register dispatch_handle = kJavaScriptCallDispatchHandleRegister;
+ UseScratchRegisterScope temps(this);
+ Register scratch = temps.Acquire();
+ Lw(dispatch_handle,
+ FieldMemOperand(function_object, JSFunction::kDispatchHandleOffset));
+ LoadEntrypointFromJSDispatchTable(code, dispatch_handle, scratch);
DCHECK_EQ(jump_mode, JumpMode::kJump);
- DCHECK_NE(code, t6);
- mv(t6, code);
- Jump(t6);
+ Jump(code);
#elif V8_ENABLE_SANDBOX
// When the sandbox is enabled, we can directly fetch the entrypoint pointer
// from the code pointer table instead of going through the Code object. In
@@ -7465,11 +7527,13 @@ void MacroAssembler::LoadEntrypointFromJSDispatchTable(Register destination,
Register scratch) {
DCHECK(!AreAliased(destination, scratch));
ASM_CODE_COMMENT(this);
+ Register index = destination;
li(scratch, ExternalReference::js_dispatch_table_address());
srli(index, dispatch_handle, kJSDispatchHandleShift);
slli(index, index, kJSDispatchTableEntrySizeLog2);
AddWord(scratch, scratch, index);
- Ld(destination, MemOperand(scratch, JSDispatchEntry::kEntrypointOffset));
+ LoadWord(destination,
+ MemOperand(scratch, JSDispatchEntry::kEntrypointOffset));
}
void MacroAssembler::LoadEntrypointFromJSDispatchTable(
@@ -7486,7 +7550,7 @@ void MacroAssembler::LoadEntrypointFromJSDispatchTable(
static_assert(!JSDispatchTable::kSupportsCompaction);
int offset = JSDispatchTable::OffsetOfEntry(dispatch_handle) +
JSDispatchEntry::kEntrypointOffset;
- Ld(destination, MemOperand(scratch, offset));
+ LoadWord(destination, MemOperand(scratch, offset));
}
void MacroAssembler::LoadParameterCountFromJSDispatchTable(
@@ -7494,12 +7558,14 @@ void MacroAssembler::LoadParameterCountFromJSDispatchTable(
DCHECK(!AreAliased(destination, scratch));
ASM_CODE_COMMENT(this);
Register index = destination;
- li(scratch, ExternalReference::js_dispatch_table_address());
srli(index, dispatch_handle, kJSDispatchHandleShift);
slli(index, index, kJSDispatchTableEntrySizeLog2);
+ li(scratch, ExternalReference::js_dispatch_table_address());
AddWord(scratch, scratch, index);
+#ifdef V8_TARGET_ARCH_64_BIT
static_assert(JSDispatchEntry::kParameterCountMask == 0xffff);
- Lh(destination, MemOperand(scratch, JSDispatchEntry::kCodeObjectOffset));
+#endif
+ Lhu(destination, MemOperand(scratch, JSDispatchEntry::kCodeObjectOffset));
}
void MacroAssembler::LoadEntrypointAndParameterCountFromJSDispatchTable(
@@ -7512,10 +7578,11 @@ void MacroAssembler::LoadEntrypointAndParameterCountFromJSDispatchTable(
srli(index, dispatch_handle, kJSDispatchHandleShift);
slli(index, index, kJSDispatchTableEntrySizeLog2);
AddWord(scratch, scratch, index);
-
- Ld(entrypoint, MemOperand(scratch, JSDispatchEntry::kEntrypointOffset));
+ LoadWord(entrypoint, MemOperand(scratch, JSDispatchEntry::kEntrypointOffset));
+#ifdef V8_TARGET_ARCH_64_BIT
static_assert(JSDispatchEntry::kParameterCountMask == 0xffff);
- Lh(parameter_count, MemOperand(scratch, JSDispatchEntry::kCodeObjectOffset));
+#endif
+ Lhu(parameter_count, MemOperand(scratch, JSDispatchEntry::kCodeObjectOffset));
}
#endif
diff --git a/src/codegen/riscv/macro-assembler-riscv.h b/src/codegen/riscv/macro-assembler-riscv.h
index 12988bdf00c6..ca91407d21f0 100644
--- a/v8/src/codegen/riscv/macro-assembler-riscv.h
+++ b/v8/src/codegen/riscv/macro-assembler-riscv.h
@@ -1600,23 +1600,47 @@ class V8_EXPORT_PRIVATE MacroAssembler : public MacroAssemblerBase {
// -------------------------------------------------------------------------
// JavaScript invokes.
- // Invoke the JavaScript function code by either calling or jumping.
- void InvokeFunctionCode(Register function, Register new_target,
- Register expected_parameter_count,
- Register actual_parameter_count, InvokeType type);
+ // On function call, call into the debugger.
+ void CallDebugOnFunctionCall(
+ Register fun, Register new_target,
+ Register expected_parameter_count_or_dispatch_handle,
+ Register actual_parameter_count);
- // On function call, call into the debugger if necessary.
- void CheckDebugHook(Register fun, Register new_target,
- Register expected_parameter_count,
- Register actual_parameter_count);
+ // The way we invoke JSFunctions differs depending on whether leaptiering is
+ // enabled. As such, these functions exist in two variants. In the future,
+ // leaptiering will be used on all platforms. At that point, the
+ // non-leaptiering variants will disappear.
+#ifdef V8_ENABLE_LEAPTIERING
// Invoke the JavaScript function in the given register. Changes the
// current context to the context in the function before invoking.
+ void InvokeFunction(Register function, Register actual_parameter_count,
+ InvokeType type,
+ ArgumentAdaptionMode argument_adaption_mode =
+ ArgumentAdaptionMode::kAdapt);
+ // Invoke the JavaScript function in the given register.
+ // Changes the current context to the context in the function before invoking.
void InvokeFunctionWithNewTarget(Register function, Register new_target,
Register actual_parameter_count,
InvokeType type);
+ // Invoke the JavaScript function code by either calling or jumping.
+ void InvokeFunctionCode(Register function, Register new_target,
+ Register actual_parameter_count, InvokeType type,
+ ArgumentAdaptionMode argument_adaption_mode =
+ ArgumentAdaptionMode::kAdapt);
+#else
void InvokeFunction(Register function, Register expected_parameter_count,
Register actual_parameter_count, InvokeType type);
+ // Invoke the JavaScript function in the given register. Changes the
+ // current context to the context in the function before invoking.
+ void InvokeFunctionWithNewTarget(Register function, Register new_target,
+ Register actual_parameter_count,
+ InvokeType type);
+ // Invoke the JavaScript function code by either calling or jumping.
+ void InvokeFunctionCode(Register function, Register new_target,
+ Register expected_parameter_count,
+ Register actual_parameter_count, InvokeType type);
+#endif
// ---- InstructionStream generation helpers ----
@@ -1657,14 +1681,13 @@ class V8_EXPORT_PRIVATE MacroAssembler : public MacroAssemblerBase {
Register closure);
void GenerateTailCallToReturnedCode(Runtime::FunctionId function_id);
- Condition LoadFeedbackVectorFlagsAndCheckIfNeedsProcessing(
- Register flags, Register feedback_vector, Register result,
- CodeKind current_code_kind);
+#ifndef V8_ENABLE_LEAPTIERING
void LoadFeedbackVectorFlagsAndJumpIfNeedsProcessing(
Register flags, Register feedback_vector, CodeKind current_code_kind,
Label* flags_need_processing);
void OptimizeCodeOrTailCallOptimizedCodeSlot(Register flags,
Register feedback_vector);
+#endif
// -------------------------------------------------------------------------
// Support functions.
@@ -1883,8 +1906,7 @@ class V8_EXPORT_PRIVATE MacroAssembler : public MacroAssemblerBase {
// Helper functions for generating invokes.
void InvokePrologue(Register expected_parameter_count,
- Register actual_parameter_count, Label* done,
- InvokeType type);
+ Register actual_parameter_count, InvokeType type);
// Compute memory operands for safepoint stack slots.
static int SafepointRegisterStackIndex(int reg_code);
diff --git a/src/codegen/riscv/register-riscv.h b/src/codegen/riscv/register-riscv.h
index ddf2f879d495..67321defed53 100644
--- a/v8/src/codegen/riscv/register-riscv.h
+++ b/v8/src/codegen/riscv/register-riscv.h
@@ -301,8 +301,7 @@ constexpr Register kJavaScriptCallCodeStartRegister = a2;
constexpr Register kJavaScriptCallTargetRegister = kJSFunctionRegister;
constexpr Register kJavaScriptCallNewTargetRegister = a3;
constexpr Register kJavaScriptCallExtraArg1Register = a2;
-// Leaptiering is not currently available on riscv64.
-constexpr Register kJavaScriptCallDispatchHandleRegister = no_reg;
+constexpr Register kJavaScriptCallDispatchHandleRegister = a4;
constexpr Register kRuntimeCallFunctionRegister = a1;
constexpr Register kRuntimeCallArgCountRegister = a0;
diff --git a/src/compiler/backend/riscv/code-generator-riscv.cc b/src/compiler/backend/riscv/code-generator-riscv.cc
index 744123ebb283..678d661e58fc 100644
--- a/v8/src/compiler/backend/riscv/code-generator-riscv.cc
+++ b/v8/src/compiler/backend/riscv/code-generator-riscv.cc
@@ -706,6 +706,36 @@ void CodeGenerator::AssembleCodeStartRegisterCheck() {
kJavaScriptCallCodeStartRegister, Operand(kScratchReg));
}
+#ifdef V8_ENABLE_LEAPTIERING
+// Check that {kJavaScriptCallDispatchHandleRegister} is correct.
+void CodeGenerator::AssembleDispatchHandleRegisterCheck() {
+ DCHECK(linkage()->GetIncomingDescriptor()->IsJSFunctionCall());
+
+ // We currently don't check this for JS builtins as those are sometimes
+ // called directly (e.g. from other builtins) and not through the dispatch
+ // table. This is fine as builtin functions don't use the dispatch handle,
+ // but we could enable this check in the future if we make sure to pass the
+ // kInvalidDispatchHandle whenever we do a direct call to a JS builtin.
+ if (Builtins::IsBuiltinId(info()->builtin())) {
+ return;
+ }
+
+ // For now, we only ensure that the register references a valid dispatch
+ // entry with the correct parameter count. In the future, we may also be able
+ // to check that the entry points back to this code.
+ UseScratchRegisterScope temps(masm());
+ Register actual_parameter_count = temps.Acquire();
+ {
+ UseScratchRegisterScope temps(masm());
+ Register scratch = temps.Acquire();
+ __ LoadParameterCountFromJSDispatchTable(
+ actual_parameter_count, kJavaScriptCallDispatchHandleRegister, scratch);
+ }
+ __ Assert(eq, AbortReason::kWrongFunctionDispatchHandle,
+ actual_parameter_count, Operand(parameter_count_));
+}
+#endif // V8_ENABLE_LEAPTIERING
+
// Check if the code object is marked for deoptimization. If it is, then it
// jumps to the CompileLazyDeoptimizedCode builtin. In order to do this we need
// to:
@@ -713,16 +743,7 @@ void CodeGenerator::AssembleCodeStartRegisterCheck() {
// the flags in the referenced {Code} object;
// 2. test kMarkedForDeoptimizationBit in those flags; and
// 3. if it is not zero then it jumps to the builtin.
-void CodeGenerator::BailoutIfDeoptimized() {
- int offset = InstructionStream::kCodeOffset - InstructionStream::kHeaderSize;
- __ LoadProtectedPointerField(
- kScratchReg, MemOperand(kJavaScriptCallCodeStartRegister, offset));
- __ Lw(kScratchReg, FieldMemOperand(kScratchReg, Code::kFlagsOffset));
- __ And(kScratchReg, kScratchReg,
- Operand(1 << Code::kMarkedForDeoptimizationBit));
- __ TailCallBuiltin(Builtin::kCompileLazyDeoptimizedCode, ne, kScratchReg,
- Operand(zero_reg));
-}
+void CodeGenerator::BailoutIfDeoptimized() { __ BailoutIfDeoptimized(); }
// Assembles an instruction after register allocation, producing machine code.
CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
diff --git a/src/maglev/riscv/maglev-assembler-riscv.cc b/src/maglev/riscv/maglev-assembler-riscv.cc
index 9611e33d6b01..8fb87746e697 100644
--- a/v8/src/maglev/riscv/maglev-assembler-riscv.cc
+++ b/v8/src/maglev/riscv/maglev-assembler-riscv.cc
@@ -127,6 +127,7 @@ void MaglevAssembler::OSRPrologue(Graph* graph) {
}
void MaglevAssembler::Prologue(Graph* graph) {
+ ASM_CODE_COMMENT(this);
MaglevAssembler::TemporaryRegisterScope temps(this);
// We add two extra registers to the scope. Ideally we could add all the
// allocatable general registers, except Context, JSFunction, NewTarget and
@@ -147,6 +148,7 @@ void MaglevAssembler::Prologue(Graph* graph) {
}
// Tiering support.
+#ifndef V8_ENABLE_LEAPTIERING
if (v8_flags.turbofan) {
using D = MaglevOptimizeCodeOrTailCallOptimizedCodeSlotDescriptor;
Register flags = D::GetRegisterParameter(D::kFlags);
@@ -169,6 +171,7 @@ void MaglevAssembler::Prologue(Graph* graph) {
TailCallBuiltin(Builtin::kMaglevOptimizeCodeOrTailCallOptimizedCodeSlot,
needs_processing, flag_reg, Operand(zero_reg));
}
+#endif
EnterFrame(StackFrame::MAGLEV);
// Save arguments in frame.

View File

@@ -1,39 +0,0 @@
From 40c273b2c0f5f26e16e67428ceaafd8b339bb61f Mon Sep 17 00:00:00 2001
From: Ivan Murashov <ivan.murashov@lge.com>
Date: Fri, 20 Sep 2024 08:03:22 +0000
Subject: [PATCH] IWYU: Add missing include for std::variant usage in
vtt_scanner.h
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
In the CLs https://crrev.com/c/5832540 and https://crrev.com/c/5842227
used std::variant in the
third_party/blink/renderer/core/html/track/vtt/vtt_scanner.h, but
corresponding include was missed.
Added missing include for std::variant usage.
Bug: 41455655
Change-Id: I90d07b12239f8d58e32c8011c710b6c7ea31fb5b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5872861
Reviewed-by: Anders Hartvoll Ruud <andruud@chromium.org>
Reviewed-by: Fredrik Söderquist <fs@opera.com>
Commit-Queue: Anders Hartvoll Ruud <andruud@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1358046}
---
third_party/blink/renderer/core/html/track/vtt/vtt_scanner.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/third_party/blink/renderer/core/html/track/vtt/vtt_scanner.h b/third_party/blink/renderer/core/html/track/vtt/vtt_scanner.h
index 78fc6657e38824..1b466bc9c5f8c3 100644
--- a/third_party/blink/renderer/core/html/track/vtt/vtt_scanner.h
+++ b/third_party/blink/renderer/core/html/track/vtt/vtt_scanner.h
@@ -30,6 +30,8 @@
#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_HTML_TRACK_VTT_VTT_SCANNER_H_
#define THIRD_PARTY_BLINK_RENDERER_CORE_HTML_TRACK_VTT_VTT_SCANNER_H_
+#include <variant>
+
#include "base/check_op.h"
#include "third_party/blink/renderer/core/core_export.h"
#include "third_party/blink/renderer/platform/wtf/allocator/allocator.h"

View File

@@ -1,434 +0,0 @@
From 8f45d25c2f8f4849b66136b14734b79e2b4fe9c1 Mon Sep 17 00:00:00 2001
From: Robert Mader <robert.mader@collabora.com>
Date: Thu, 12 Sep 2024 19:11:15 +0000
Subject: [PATCH] ozone/wayland: Add support for xdg-toplevel-drag
Rebased and slighty updated version of https://chromium-review.googlesource.com/c/chromium/src/+/4400967
This implements a new protocol landed in wayland-protocols 1.34 that can
be found at
https://gitlab.freedesktop.org/wayland/wayland-protocols/-/blob/main/staging/xdg-toplevel-drag/xdg-toplevel-drag-v1.xml
It is intended to be a drop-in replacement for extended-drag-unstable-v1
with some features removed that were never implemented in Exo/Chromium.
If both the `extended-drag` and `xdg-toplevel-drag` protocols are
supported by the compositor - i.e. in Exo - the former is kept being
used by default. The later can be enabled via the
`WaylandXdgToplevelDrag` feature.
Original author: David Redondo <kde@david-redondo.de>
Bug: b:315000518
Bug: b:324170129
Change-Id: If251ac9944ec4395f2d8630b7c4ac74ca56a662d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5088752
Reviewed-by: Thomas Anderson <thomasanderson@chromium.org>
Reviewed-by: Antonio Gomes <tonikitoo@igalia.com>
Commit-Queue: Nick Yamane <nickdiego@igalia.com>
Reviewed-by: Nick Yamane <nickdiego@igalia.com>
Cr-Commit-Position: refs/heads/main@{#1354718}
---
AUTHORS | 1 +
ui/ozone/common/features.cc | 16 ++++
ui/ozone/common/features.h | 1 +
ui/ozone/platform/wayland/BUILD.gn | 1 +
.../platform/wayland/common/wayland_object.cc | 3 +
.../platform/wayland/common/wayland_object.h | 2 +
.../wayland/host/wayland_connection.cc | 10 +++
.../wayland/host/wayland_connection.h | 4 +
.../wayland/host/wayland_toplevel_window.cc | 13 +--
.../host/wayland_window_drag_controller.cc | 85 ++++++++++++++++---
.../host/wayland_window_drag_controller.h | 4 +
.../wayland/host/xdg_toplevel_wrapper_impl.h | 1 +
12 files changed, 121 insertions(+), 20 deletions(-)
diff --git a/AUTHORS b/AUTHORS
index 52d075125b8126..bd9327b5b477f2 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -337,6 +337,7 @@ David Leen <davileen@amazon.com>
David Manouchehri <david@davidmanouchehri.com>
David McAllister <mcdavid@amazon.com>
David Michael Barr <david.barr@samsung.com>
+David Redondo <kde@david-redondo.de>
David Sanders <dsanders11@ucsbalum.com>
David Spellman <dspell@amazon.com>
David Valachovic <adenflorian@gmail.com>
diff --git a/ui/ozone/common/features.cc b/ui/ozone/common/features.cc
index bd13d0e17f39a3..74ffde0cf5b85c 100644
--- a/ui/ozone/common/features.cc
+++ b/ui/ozone/common/features.cc
@@ -37,6 +37,18 @@ BASE_FEATURE(kWaylandFractionalScaleV1,
#endif
);
+// Controls whether support for the xdg-toplevel-drag protocol should be
+// enabled. On Lacros it will then be used even if the Exo-only extended-drag
+// protocol is supported.
+BASE_FEATURE(kWaylandXdgToplevelDrag,
+ "WaylandXdgToplevelDrag",
+#if BUILDFLAG(IS_LINUX)
+ base::FEATURE_ENABLED_BY_DEFAULT
+#else
+ base::FEATURE_DISABLED_BY_DEFAULT
+#endif
+);
+
// This debug/dev flag pretty-prints DRM modeset configuration logs for ease
// of reading. For more information, see: http://b/233006802
BASE_FEATURE(kPrettyPrintDrmModesetConfigLogs,
@@ -62,6 +74,10 @@ bool IsWaylandFractionalScaleV1Enabled() {
return base::FeatureList::IsEnabled(kWaylandFractionalScaleV1);
}
+bool IsWaylandXdgToplevelDragEnabled() {
+ return base::FeatureList::IsEnabled(kWaylandXdgToplevelDrag);
+}
+
bool IsPrettyPrintDrmModesetConfigLogsEnabled() {
return base::FeatureList::IsEnabled(kPrettyPrintDrmModesetConfigLogs);
}
diff --git a/ui/ozone/common/features.h b/ui/ozone/common/features.h
index 5d4c3c42af9ca7..1f88055f8975bc 100644
--- a/ui/ozone/common/features.h
+++ b/ui/ozone/common/features.h
@@ -18,6 +18,7 @@ BASE_DECLARE_FEATURE(kUseDynamicCursorSize);
bool IsWaylandSurfaceSubmissionInPixelCoordinatesEnabled();
bool IsWaylandOverlayDelegationEnabled();
bool IsWaylandFractionalScaleV1Enabled();
+bool IsWaylandXdgToplevelDragEnabled();
bool IsPrettyPrintDrmModesetConfigLogsEnabled();
bool IsUseDynamicCursorSizeEnabled();
diff --git a/ui/ozone/platform/wayland/BUILD.gn b/ui/ozone/platform/wayland/BUILD.gn
index 6d3ec34101498d..b87a7b5d2903f0 100644
--- a/ui/ozone/platform/wayland/BUILD.gn
+++ b/ui/ozone/platform/wayland/BUILD.gn
@@ -294,6 +294,7 @@ source_set("wayland") {
"//third_party/wayland-protocols:xdg_foreign",
"//third_party/wayland-protocols:xdg_output_protocol",
"//third_party/wayland-protocols:xdg_shell_protocol",
+ "//third_party/wayland-protocols:xdg_toplevel_drag_protocol",
"//third_party/wayland-protocols:xdg_toplevel_icon_protocol",
"//ui/base",
"//ui/base:buildflags",
diff --git a/ui/ozone/platform/wayland/common/wayland_object.cc b/ui/ozone/platform/wayland/common/wayland_object.cc
index e30367a19d7774..1534a735855dd3 100644
--- a/ui/ozone/platform/wayland/common/wayland_object.cc
+++ b/ui/ozone/platform/wayland/common/wayland_object.cc
@@ -44,6 +44,7 @@
#include <xdg-foreign-unstable-v2-client-protocol.h>
#include <xdg-output-unstable-v1-client-protocol.h>
#include <xdg-shell-client-protocol.h>
+#include <xdg-toplevel-drag-v1-client-protocol.h>
#include <xdg-toplevel-icon-v1-client-protocol.h>
#include "base/logging.h"
@@ -257,6 +258,8 @@ IMPLEMENT_WAYLAND_OBJECT_TRAITS(xdg_popup)
IMPLEMENT_WAYLAND_OBJECT_TRAITS(xdg_positioner)
IMPLEMENT_WAYLAND_OBJECT_TRAITS(xdg_surface)
IMPLEMENT_WAYLAND_OBJECT_TRAITS(xdg_toplevel)
+IMPLEMENT_WAYLAND_OBJECT_TRAITS(xdg_toplevel_drag_v1)
+IMPLEMENT_WAYLAND_OBJECT_TRAITS(xdg_toplevel_drag_manager_v1)
IMPLEMENT_WAYLAND_OBJECT_TRAITS(xdg_toplevel_icon_manager_v1)
IMPLEMENT_WAYLAND_OBJECT_TRAITS(xdg_toplevel_icon_v1)
IMPLEMENT_WAYLAND_OBJECT_TRAITS(xdg_wm_base)
diff --git a/ui/ozone/platform/wayland/common/wayland_object.h b/ui/ozone/platform/wayland/common/wayland_object.h
index 38213eff64de40..b279424d14784d 100644
--- a/ui/ozone/platform/wayland/common/wayland_object.h
+++ b/ui/ozone/platform/wayland/common/wayland_object.h
@@ -156,6 +156,8 @@ DECLARE_WAYLAND_OBJECT_TRAITS(xdg_popup)
DECLARE_WAYLAND_OBJECT_TRAITS(xdg_positioner)
DECLARE_WAYLAND_OBJECT_TRAITS(xdg_surface)
DECLARE_WAYLAND_OBJECT_TRAITS(xdg_toplevel)
+DECLARE_WAYLAND_OBJECT_TRAITS(xdg_toplevel_drag_v1)
+DECLARE_WAYLAND_OBJECT_TRAITS(xdg_toplevel_drag_manager_v1)
DECLARE_WAYLAND_OBJECT_TRAITS(xdg_toplevel_icon_manager_v1)
DECLARE_WAYLAND_OBJECT_TRAITS(xdg_toplevel_icon_v1)
DECLARE_WAYLAND_OBJECT_TRAITS(xdg_wm_base)
diff --git a/ui/ozone/platform/wayland/host/wayland_connection.cc b/ui/ozone/platform/wayland/host/wayland_connection.cc
index a1584eb682adf3..e595f500758492 100644
--- a/ui/ozone/platform/wayland/host/wayland_connection.cc
+++ b/ui/ozone/platform/wayland/host/wayland_connection.cc
@@ -91,6 +91,7 @@ constexpr uint32_t kMaxExplicitSyncVersion = 2;
constexpr uint32_t kMaxAlphaCompositingVersion = 1;
constexpr uint32_t kMaxXdgDecorationVersion = 1;
constexpr uint32_t kMaxExtendedDragVersion = 1;
+constexpr uint32_t kMaxXdgToplevelDragVersion = 1;
constexpr uint32_t kMaxXdgOutputManagerVersion = 3;
constexpr uint32_t kMaxKeyboardShortcutsInhibitManagerVersion = 1;
constexpr uint32_t kMaxStylusVersion = 2;
@@ -745,6 +746,15 @@ void WaylandConnection::HandleGlobal(wl_registry* registry,
LOG(ERROR) << "Failed to bind to zcr_extended_drag_v1 global";
return;
}
+ } else if (!xdg_toplevel_drag_manager_v1_ &&
+ strcmp(interface, "xdg_toplevel_drag_manager_v1") == 0 &&
+ IsWaylandXdgToplevelDragEnabled()) {
+ xdg_toplevel_drag_manager_v1_ = wl::Bind<::xdg_toplevel_drag_manager_v1>(
+ registry, name, std::min(version, kMaxXdgToplevelDragVersion));
+ if (!xdg_toplevel_drag_manager_v1_) {
+ LOG(ERROR) << "Failed to bind to xdg_toplevel_drag_manager_v1 global";
+ return;
+ }
} else if (!xdg_output_manager_ &&
strcmp(interface, "zxdg_output_manager_v1") == 0) {
// Responsibilities of zxdg_output_manager_v1 have been subsumed into the
diff --git a/ui/ozone/platform/wayland/host/wayland_connection.h b/ui/ozone/platform/wayland/host/wayland_connection.h
index b4633ad03c4508..79680db7189852 100644
--- a/ui/ozone/platform/wayland/host/wayland_connection.h
+++ b/ui/ozone/platform/wayland/host/wayland_connection.h
@@ -160,6 +160,9 @@ class WaylandConnection {
zcr_extended_drag_v1* extended_drag_v1() const {
return extended_drag_v1_.get();
}
+ xdg_toplevel_drag_manager_v1* xdg_toplevel_drag_manager_v1() const {
+ return xdg_toplevel_drag_manager_v1_.get();
+ }
zxdg_output_manager_v1* xdg_output_manager_v1() const {
return xdg_output_manager_.get();
@@ -500,6 +503,7 @@ class WaylandConnection {
linux_explicit_synchronization_;
wl::Object<zxdg_decoration_manager_v1> xdg_decoration_manager_;
wl::Object<zcr_extended_drag_v1> extended_drag_v1_;
+ wl::Object<::xdg_toplevel_drag_manager_v1> xdg_toplevel_drag_manager_v1_;
wl::Object<zxdg_output_manager_v1> xdg_output_manager_;
wl::Object<wp_fractional_scale_manager_v1> fractional_scale_manager_v1_;
wl::Object<xdg_toplevel_icon_manager_v1> toplevel_icon_manager_v1_;
diff --git a/ui/ozone/platform/wayland/host/wayland_toplevel_window.cc b/ui/ozone/platform/wayland/host/wayland_toplevel_window.cc
index 204e65c90ec374..5af9efc0d8acbf 100644
--- a/ui/ozone/platform/wayland/host/wayland_toplevel_window.cc
+++ b/ui/ozone/platform/wayland/host/wayland_toplevel_window.cc
@@ -858,7 +858,8 @@ void WaylandToplevelWindow::HideTooltip() {
bool WaylandToplevelWindow::IsClientControlledWindowMovementSupported() const {
auto* window_drag_controller = connection()->window_drag_controller();
DCHECK(window_drag_controller);
- return window_drag_controller->IsExtendedDragAvailable();
+ return window_drag_controller->IsExtendedDragAvailable() ||
+ window_drag_controller->IsXdgToplevelDragAvailable();
}
bool WaylandToplevelWindow::ShouldReleaseCaptureForDrag(
@@ -882,11 +883,11 @@ void WaylandToplevelWindow::StartWindowDraggingSessionIfNeeded(
ui::mojom::DragEventSource event_source,
bool allow_system_drag) {
DCHECK(connection()->window_drag_controller());
- // If extended drag is not available and |allow_system_drag| is set, this is
- // no-op and WaylandDataDragController is assumed to be used instead. i.e:
- // Fallback to a simpler window drag UX based on regular system drag-and-drop.
- if (!connection()->window_drag_controller()->IsExtendedDragAvailable() &&
- allow_system_drag) {
+ // If extended-drag and xdg-toplevel-drag are not available and
+ // |allow_system_drag| is set, this is no-op and WaylandDataDragController is
+ // assumed to be used instead. i.e: Fallback to a simpler window drag UX based
+ // on regular system drag-and-drop.
+ if (!IsClientControlledWindowMovementSupported() && allow_system_drag) {
return;
}
connection()->window_drag_controller()->StartDragSession(this, event_source);
diff --git a/ui/ozone/platform/wayland/host/wayland_window_drag_controller.cc b/ui/ozone/platform/wayland/host/wayland_window_drag_controller.cc
index 2e95a32417a4c1..6184684e308154 100644
--- a/ui/ozone/platform/wayland/host/wayland_window_drag_controller.cc
+++ b/ui/ozone/platform/wayland/host/wayland_window_drag_controller.cc
@@ -6,6 +6,7 @@
#include <extended-drag-unstable-v1-client-protocol.h>
#include <wayland-client-protocol.h>
+#include <xdg-toplevel-drag-v1-client-protocol.h>
#include <cstdint>
#include <memory>
@@ -36,8 +37,10 @@
#include "ui/gfx/geometry/point_conversions.h"
#include "ui/gfx/geometry/point_f.h"
#include "ui/gfx/geometry/vector2d.h"
+#include "ui/ozone/common/features.h"
#include "ui/ozone/platform/wayland/common/wayland_object.h"
#include "ui/ozone/platform/wayland/host/dump_util.h"
+#include "ui/ozone/platform/wayland/host/shell_toplevel_wrapper.h"
#include "ui/ozone/platform/wayland/host/wayland_connection.h"
#include "ui/ozone/platform/wayland/host/wayland_cursor_position.h"
#include "ui/ozone/platform/wayland/host/wayland_data_device_manager.h"
@@ -51,6 +54,7 @@
#include "ui/ozone/platform/wayland/host/wayland_surface.h"
#include "ui/ozone/platform/wayland/host/wayland_window.h"
#include "ui/ozone/platform/wayland/host/wayland_window_manager.h"
+#include "ui/ozone/platform/wayland/host/xdg_toplevel_wrapper_impl.h"
#include "ui/platform_window/platform_window_init_properties.h"
namespace ui {
@@ -101,6 +105,39 @@ class WaylandWindowDragController::ExtendedDragSource {
const raw_ref<WaylandConnection> connection_;
};
+class WaylandWindowDragController::XdgToplevelDrag {
+ public:
+ XdgToplevelDrag(WaylandConnection& connection, wl_data_source* source)
+ : connection_(connection) {
+ DCHECK(connection.xdg_toplevel_drag_manager_v1());
+ drag_.reset(xdg_toplevel_drag_manager_v1_get_xdg_toplevel_drag(
+ connection.xdg_toplevel_drag_manager_v1(), source));
+ DCHECK(drag_);
+ }
+
+ void SetDraggedWindow(WaylandToplevelWindow* window,
+ const gfx::Vector2d& offset) {
+ if (!window) {
+ // Detaching happens implicitly via wl_data_source.dnd_drop_performed (see
+ // OnDataSourceDropPerformed()) or when the toplevel gets unmapped.
+ return;
+ }
+ DCHECK(window->shell_toplevel() &&
+ window->shell_toplevel()->AsXDGToplevelWrapper());
+
+ auto* toplevel =
+ window->shell_toplevel()->AsXDGToplevelWrapper()->xdg_toplevel_.get();
+ DCHECK(toplevel);
+
+ xdg_toplevel_drag_v1_attach(drag_.get(), toplevel, offset.x(), offset.y());
+ connection_->Flush();
+ }
+
+ private:
+ wl::Object<xdg_toplevel_drag_v1> drag_;
+ const raw_ref<WaylandConnection> connection_;
+};
+
WaylandWindowDragController::WaylandWindowDragController(
WaylandConnection* connection,
WaylandDataDeviceManager* device_manager,
@@ -165,12 +202,16 @@ bool WaylandWindowDragController::StartDragSession(
data_source_->Offer({kMimeTypeChromiumWindow});
data_source_->SetDndActions(kDndActionWindowDrag);
- if (IsExtendedDragAvailableInternal()) {
+ if (IsXdgToplevelDragAvailable()) {
+ xdg_toplevel_drag_ = std::make_unique<XdgToplevelDrag>(
+ *connection_, data_source_->data_source());
+ } else if (IsExtendedDragAvailableInternal()) {
extended_drag_source_ = std::make_unique<ExtendedDragSource>(
*connection_, data_source_->data_source());
} else {
- LOG(ERROR) << "zcr_extended_drag_v1 extension not available! "
- << "Window/Tab dragging won't be fully functional.";
+ LOG(ERROR)
+ << "zcr_extended_drag_v1 and xdg_toplevel_drag_v1 extensions "
+ "not available! Window/Tab dragging won't be fully functional.";
}
data_device_->StartDrag(*data_source_, *origin_window_, serial->value,
@@ -441,17 +482,24 @@ void WaylandWindowDragController::OnDataSourceFinish(WaylandDataSource* source,
data_offer_.reset();
data_source_.reset();
extended_drag_source_.reset();
+ xdg_toplevel_drag_.reset();
origin_surface_.reset();
origin_window_ = nullptr;
has_received_enter_ = false;
- // When extended-drag is available and the drop happens while a non-null
- // surface was being dragged (i.e: detached mode) which had pointer focus
- // before the drag session, we must reset focus to it, otherwise it would be
- // wrongly kept to the latest surface received through wl_data_device::enter
- // (see OnDragEnter function).
- // In case of touch, though, we simply reset the focus altogether.
- if (IsExtendedDragAvailableInternal() && dragged_window_) {
+ // When extended-drag or xdg-toplevel-drag is available and the drop happens
+ // while a non-null surface was being dragged (i.e: detached mode) which had
+ // pointer focus before the drag session, we must reset focus to it, otherwise
+ // it would be wrongly kept to the latest surface received through
+ // wl_data_device::enter (see OnDragEnter function). In case of touch, though,
+ // we simply reset the focus altogether.
+ //
+ // TODO(crbug.com/324170129): Move drop handling logic below into
+ // OnDataSourceDropPerformed instead, otherwise dropping outside target
+ // surfaces will results in drag cancellation when xdg-toplevel-drag is used.
+ bool is_protocol_available =
+ IsExtendedDragAvailableInternal() || IsXdgToplevelDragAvailable();
+ if (is_protocol_available && dragged_window_) {
if (*drag_source_ == DragEventSource::kMouse) {
// TODO: check if this usage is correct.
@@ -467,9 +515,11 @@ void WaylandWindowDragController::OnDataSourceFinish(WaylandDataSource* source,
// Transition to |kDropped| state and determine the next action to take. If
// drop happened while the move loop was running (i.e: kDetached), ask to quit
// the loop, otherwise notify session end and reset state right away.
+ is_protocol_available =
+ IsExtendedDragAvailable() || IsXdgToplevelDragAvailable();
State state_when_dropped = std::exchange(
- state_, completed || !IsExtendedDragAvailable() ? State::kDropped
- : State::kCancelled);
+ state_, completed || !is_protocol_available ? State::kDropped
+ : State::kCancelled);
if (state_when_dropped == State::kDetached) {
VLOG(1) << "Quiting Loop : Detached";
QuitLoop();
@@ -673,9 +723,12 @@ void WaylandWindowDragController::SetDraggedWindow(
dragged_window_ = window;
drag_offset_ = offset;
- // TODO(crbug.com/40598679): Fallback when extended-drag is not available.
- if (extended_drag_source_)
+ // TODO(crbug.com/40598679): Fallback when no window drag protocol available.
+ if (extended_drag_source_) {
extended_drag_source_->SetDraggedWindow(dragged_window_, drag_offset_);
+ } else if (xdg_toplevel_drag_) {
+ xdg_toplevel_drag_->SetDraggedWindow(dragged_window_, drag_offset_);
+ }
}
bool WaylandWindowDragController::IsExtendedDragAvailable() const {
@@ -683,6 +736,10 @@ bool WaylandWindowDragController::IsExtendedDragAvailable() const {
IsExtendedDragAvailableInternal();
}
+bool WaylandWindowDragController::IsXdgToplevelDragAvailable() const {
+ return !!connection_->xdg_toplevel_drag_manager_v1();
+}
+
bool WaylandWindowDragController::IsActiveDragAndDropSession() const {
return !!data_source_;
}
diff --git a/ui/ozone/platform/wayland/host/wayland_window_drag_controller.h b/ui/ozone/platform/wayland/host/wayland_window_drag_controller.h
index de94ea22590990..fe523b85a2b340 100644
--- a/ui/ozone/platform/wayland/host/wayland_window_drag_controller.h
+++ b/ui/ozone/platform/wayland/host/wayland_window_drag_controller.h
@@ -88,6 +88,8 @@ class WaylandWindowDragController : public WaylandDataDevice::DragDelegate,
// Tells if "extended drag" extension is available.
bool IsExtendedDragAvailable() const;
+ // Tells if "xdg toplevel drag" extension is available.
+ bool IsXdgToplevelDragAvailable() const;
// Returns true if there there is currently an active drag-and-drop session.
// This is true if the `data_source_` exists (the session ends when this is
@@ -118,6 +120,7 @@ class WaylandWindowDragController : public WaylandDataDevice::DragDelegate,
private:
class ExtendedDragSource;
+ class XdgToplevelDrag;
friend class WaylandWindowDragControllerTest;
FRIEND_TEST_ALL_PREFIXES(WaylandWindowDragControllerTest,
@@ -204,6 +207,7 @@ class WaylandWindowDragController : public WaylandDataDevice::DragDelegate,
std::unique_ptr<WaylandDataOffer> data_offer_;
std::unique_ptr<ExtendedDragSource> extended_drag_source_;
+ std::unique_ptr<XdgToplevelDrag> xdg_toplevel_drag_;
// The current toplevel window being dragged, when in detached mode.
raw_ptr<WaylandToplevelWindow> dragged_window_ = nullptr;
diff --git a/ui/ozone/platform/wayland/host/xdg_toplevel_wrapper_impl.h b/ui/ozone/platform/wayland/host/xdg_toplevel_wrapper_impl.h
index f34cc782ffc82e..280efa771c3fe3 100644
--- a/ui/ozone/platform/wayland/host/xdg_toplevel_wrapper_impl.h
+++ b/ui/ozone/platform/wayland/host/xdg_toplevel_wrapper_impl.h
@@ -88,6 +88,7 @@ class XDGToplevelWrapperImpl : public ShellToplevelWrapper {
XDGSurfaceWrapperImpl* xdg_surface_wrapper() const;
private:
+ friend class WaylandWindowDragController;
// xdg_toplevel_listener callbacks:
static void OnToplevelConfigure(void* data,
xdg_toplevel* toplevel,

View File

@@ -1,545 +0,0 @@
From 900160bc0e224746bd4b7c30c63433dad66b95f6 Mon Sep 17 00:00:00 2001
From: Tom Anderson <thomasanderson@chromium.org>
Date: Thu, 8 Aug 2024 07:28:26 +0000
Subject: [PATCH] [Wayland] Implement setting icons with XDG toplevel icon
Note that this is untested since no compositors currently support
the protocol, though there is a merge request for server support in
KWin and merge requests for client support in QT, and SDL, and merged
client support in GameScope.
Once compositor support is added, this change can be tested by
installing the Youtube PWA and verifying that the icon changes
to the Youtube logo.
R=nickdiego
Change-Id: I6135d72879ecc025c26e7c65b68eb557dd72e854
Fixed: 356424077
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5755162
Auto-Submit: Thomas Anderson <thomasanderson@chromium.org>
Code-Coverage: findit-for-me@appspot.gserviceaccount.com <findit-for-me@appspot.gserviceaccount.com>
Reviewed-by: Maksim Sisov <msisov@igalia.com>
Commit-Queue: Maksim Sisov <msisov@igalia.com>
Reviewed-by: Nick Yamane <nickdiego@igalia.com>
Cr-Commit-Position: refs/heads/main@{#1338910}
---
ui/ozone/platform/wayland/BUILD.gn | 4 +
.../wayland/host/shell_toplevel_wrapper.h | 3 +
.../wayland/host/wayland_toplevel_window.cc | 14 +++
.../wayland/host/wayland_toplevel_window.h | 2 +
.../host/xdg_toplevel_icon_unittest.cc | 47 +++++++++
.../wayland/host/xdg_toplevel_wrapper_impl.cc | 53 ++++++++++-
.../wayland/host/xdg_toplevel_wrapper_impl.h | 1 +
.../wayland/test/mock_xdg_toplevel_icon.cc | 95 +++++++++++++++++++
.../wayland/test/mock_xdg_toplevel_icon.h | 79 +++++++++++++++
.../test/test_wayland_server_thread.cc | 3 +
.../wayland/test/test_wayland_server_thread.h | 6 ++
11 files changed, 303 insertions(+), 4 deletions(-)
create mode 100644 ui/ozone/platform/wayland/host/xdg_toplevel_icon_unittest.cc
create mode 100644 ui/ozone/platform/wayland/test/mock_xdg_toplevel_icon.cc
create mode 100644 ui/ozone/platform/wayland/test/mock_xdg_toplevel_icon.h
diff --git a/ui/ozone/platform/wayland/BUILD.gn b/ui/ozone/platform/wayland/BUILD.gn
index 4ba36222f03906..4f22bf74dd8d34 100644
--- a/ui/ozone/platform/wayland/BUILD.gn
+++ b/ui/ozone/platform/wayland/BUILD.gn
@@ -432,6 +432,8 @@ source_set("test_support") {
"test/mock_xdg_shell.h",
"test/mock_xdg_surface.cc",
"test/mock_xdg_surface.h",
+ "test/mock_xdg_toplevel_icon.cc",
+ "test/mock_xdg_toplevel_icon.h",
"test/mock_zcr_extended_text_input.cc",
"test/mock_zcr_extended_text_input.h",
"test/mock_zwp_linux_dmabuf.cc",
@@ -576,6 +578,7 @@ source_set("test_support") {
"//third_party/wayland-protocols:xdg_activation",
"//third_party/wayland-protocols:xdg_output_protocol",
"//third_party/wayland-protocols:xdg_shell_protocol",
+ "//third_party/wayland-protocols:xdg_toplevel_icon_protocol",
"//ui/display:test_support",
"//ui/gfx/geometry:geometry",
]
@@ -608,6 +611,7 @@ source_set("wayland_unittests") {
"host/wayland_zcr_color_manager_unittest.cc",
"host/wayland_zwp_pointer_gestures_unittest.cc",
"host/xdg_activation_unittest.cc",
+ "host/xdg_toplevel_icon_unittest.cc",
"host/zwp_text_input_wrapper_v1_unittest.cc",
"host/zwp_text_input_wrapper_v3_unittest.cc",
"mojom/wayland_overlay_config_mojom_traits_unittest.cc",
diff --git a/ui/ozone/platform/wayland/host/shell_toplevel_wrapper.h b/ui/ozone/platform/wayland/host/shell_toplevel_wrapper.h
index 735a218e6b5667..63b68902a7addd 100644
--- a/ui/ozone/platform/wayland/host/shell_toplevel_wrapper.h
+++ b/ui/ozone/platform/wayland/host/shell_toplevel_wrapper.h
@@ -12,6 +12,7 @@
#include "ui/platform_window/extensions/wayland_extension.h"
namespace gfx {
+class ImageSkia;
class Rect;
class RoundedCornersF;
}
@@ -210,6 +211,8 @@ class ShellToplevelWrapper {
virtual void AckRotateFocus(uint32_t serial, uint32_t handled) = 0;
+ virtual void SetIcon(const gfx::ImageSkia& icon) = 0;
+
// Casts `this` to XDGToplevelWrapperImpl, if it is of that type.
virtual XDGToplevelWrapperImpl* AsXDGToplevelWrapper();
};
diff --git a/ui/ozone/platform/wayland/host/wayland_toplevel_window.cc b/ui/ozone/platform/wayland/host/wayland_toplevel_window.cc
index 7ba2d52b575a21..204e65c90ec374 100644
--- a/ui/ozone/platform/wayland/host/wayland_toplevel_window.cc
+++ b/ui/ozone/platform/wayland/host/wayland_toplevel_window.cc
@@ -363,6 +363,20 @@ void WaylandToplevelWindow::Deactivate() {
WaylandWindow::Deactivate();
}
+void WaylandToplevelWindow::SetWindowIcons(const gfx::ImageSkia& window_icon,
+ const gfx::ImageSkia& app_icon) {
+ if (!shell_toplevel_) {
+ return;
+ }
+ // Let the app icon take precedence over the window icon.
+ if (!app_icon.isNull()) {
+ shell_toplevel_->SetIcon(app_icon);
+ } else {
+ shell_toplevel_->SetIcon(window_icon);
+ }
+ root_surface()->Commit(/*flush=*/true);
+}
+
void WaylandToplevelWindow::SizeConstraintsChanged() {
// Size constraints only make sense for normal windows.
if (!shell_toplevel_)
diff --git a/ui/ozone/platform/wayland/host/wayland_toplevel_window.h b/ui/ozone/platform/wayland/host/wayland_toplevel_window.h
index 40e16fef05f985..3491798f4c19da 100644
--- a/ui/ozone/platform/wayland/host/wayland_toplevel_window.h
+++ b/ui/ozone/platform/wayland/host/wayland_toplevel_window.h
@@ -126,6 +126,8 @@ class WaylandToplevelWindow : public WaylandWindow,
void Restore() override;
void Activate() override;
void Deactivate() override;
+ void SetWindowIcons(const gfx::ImageSkia& window_icon,
+ const gfx::ImageSkia& app_icon) override;
void SizeConstraintsChanged() override;
// `SetZOrderLevel()` must be called on `z_order_` in
// `SetUpShellIntegration()`.
diff --git a/ui/ozone/platform/wayland/host/xdg_toplevel_icon_unittest.cc b/ui/ozone/platform/wayland/host/xdg_toplevel_icon_unittest.cc
new file mode 100644
index 00000000000000..bd91e0641a7395
--- /dev/null
+++ b/ui/ozone/platform/wayland/host/xdg_toplevel_icon_unittest.cc
@@ -0,0 +1,47 @@
+// Copyright 2024 The Chromium Authors
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ui/ozone/platform/wayland/test/wayland_test.h"
+
+namespace ui {
+
+using XdgToplevelIconTest = WaylandTestSimple;
+
+TEST_F(XdgToplevelIconTest, Basic) {
+ SkBitmap bitmap;
+ bitmap.allocN32Pixels(128, 128);
+ gfx::ImageSkia icon = gfx::ImageSkia::CreateFrom1xBitmap(bitmap);
+ window_->SetWindowIcons(gfx::ImageSkia(), icon);
+
+ PostToServerAndWait([&](wl::TestWaylandServerThread* server) {
+ auto* const manager = server->xdg_toplevel_icon_manager_v1();
+ ASSERT_TRUE(manager);
+ wl::XdgToplevelIconResources expected_resources = {
+ wl::XdgToplevelIconResource(gfx::Size(128, 128), 1)};
+ EXPECT_EQ(manager->resources(), expected_resources);
+ });
+}
+
+TEST_F(XdgToplevelIconTest, AppIconTakesPrecedence) {
+ SkBitmap app_bitmap;
+ app_bitmap.allocN32Pixels(128, 128);
+ gfx::ImageSkia app_icon = gfx::ImageSkia::CreateFrom1xBitmap(app_bitmap);
+
+ SkBitmap window_bitmap;
+ window_bitmap.allocN32Pixels(64, 64);
+ gfx::ImageSkia window_icon =
+ gfx::ImageSkia::CreateFrom1xBitmap(window_bitmap);
+
+ window_->SetWindowIcons(window_icon, app_icon);
+
+ PostToServerAndWait([&](wl::TestWaylandServerThread* server) {
+ auto* const manager = server->xdg_toplevel_icon_manager_v1();
+ ASSERT_TRUE(manager);
+ wl::XdgToplevelIconResources expected_resources = {
+ wl::XdgToplevelIconResource(gfx::Size(128, 128), 1)};
+ EXPECT_EQ(manager->resources(), expected_resources);
+ });
+}
+
+} // namespace ui
diff --git a/ui/ozone/platform/wayland/host/xdg_toplevel_wrapper_impl.cc b/ui/ozone/platform/wayland/host/xdg_toplevel_wrapper_impl.cc
index 78a81356a5f01e..a716b337518f8c 100644
--- a/ui/ozone/platform/wayland/host/xdg_toplevel_wrapper_impl.cc
+++ b/ui/ozone/platform/wayland/host/xdg_toplevel_wrapper_impl.cc
@@ -6,6 +6,7 @@
#include <aura-shell-client-protocol.h>
#include <xdg-decoration-unstable-v1-client-protocol.h>
+#include <xdg-toplevel-icon-v1-client-protocol.h>
#include <optional>
@@ -15,6 +16,7 @@
#include "base/strings/utf_string_conversions.h"
#include "ui/base/hit_test.h"
#include "ui/base/ui_base_features.h"
+#include "ui/gfx/image/image_skia_rep_default.h"
#include "ui/ozone/common/features.h"
#include "ui/ozone/platform/wayland/common/wayland_object.h"
#include "ui/ozone/platform/wayland/common/wayland_util.h"
@@ -25,6 +27,7 @@
#include "ui/ozone/platform/wayland/host/wayland_output_manager.h"
#include "ui/ozone/platform/wayland/host/wayland_seat.h"
#include "ui/ozone/platform/wayland/host/wayland_serial_tracker.h"
+#include "ui/ozone/platform/wayland/host/wayland_shm_buffer.h"
#include "ui/ozone/platform/wayland/host/wayland_toplevel_window.h"
#include "ui/ozone/platform/wayland/host/wayland_window.h"
#include "ui/ozone/platform/wayland/host/wayland_zaura_shell.h"
@@ -104,8 +107,9 @@ bool XDGToplevelWrapperImpl::Initialize() {
return false;
}
- if (!xdg_surface_wrapper_)
+ if (!xdg_surface_wrapper_) {
return false;
+ }
xdg_toplevel_.reset(
xdg_surface_get_toplevel(xdg_surface_wrapper_->xdg_surface()));
@@ -233,9 +237,10 @@ void XDGToplevelWrapperImpl::SetMinimized() {
void XDGToplevelWrapperImpl::SurfaceMove(WaylandConnection* connection) {
DCHECK(xdg_toplevel_);
- if (auto serial = GetSerialForMoveResize(connection))
+ if (auto serial = GetSerialForMoveResize(connection)) {
xdg_toplevel_move(xdg_toplevel_.get(), connection->seat()->wl_object(),
serial->value);
+ }
}
void XDGToplevelWrapperImpl::SurfaceResize(WaylandConnection* connection,
@@ -261,8 +266,9 @@ void XDGToplevelWrapperImpl::SetTitle(const std::u16string& title) {
// length of the string so it would fit the message with some margin.
const size_t kMaxLengh = 4000;
auto short_title = base::UTF16ToUTF8(title);
- if (short_title.size() > kMaxLengh)
+ if (short_title.size() > kMaxLengh) {
short_title.resize(kMaxLengh);
+ }
xdg_toplevel_set_title(xdg_toplevel_.get(), short_title.c_str());
}
@@ -470,8 +476,9 @@ void XDGToplevelWrapperImpl::OnConfigureOcclusionState(
void XDGToplevelWrapperImpl::SetTopLevelDecorationMode(
DecorationMode requested_mode) {
- if (!zxdg_toplevel_decoration_ || requested_mode == decoration_mode_)
+ if (!zxdg_toplevel_decoration_ || requested_mode == decoration_mode_) {
return;
+ }
zxdg_toplevel_decoration_v1_set_mode(zxdg_toplevel_decoration_.get(),
ToInt32(requested_mode));
@@ -769,6 +776,44 @@ void XDGToplevelWrapperImpl::AckRotateFocus(uint32_t serial, uint32_t handled) {
connection_->Flush();
}
+void XDGToplevelWrapperImpl::SetIcon(const gfx::ImageSkia& icon) {
+ auto* manager = connection_->toplevel_icon_manager_v1();
+ if (!manager) {
+ return;
+ }
+
+ if (icon.isNull()) {
+ xdg_toplevel_icon_manager_v1_set_icon(manager, xdg_toplevel_.get(),
+ nullptr);
+ return;
+ }
+
+ std::vector<std::pair<WaylandShmBuffer, float>> buffers;
+ auto* xdg_icon = xdg_toplevel_icon_manager_v1_create_icon(manager);
+ for (const auto& rep : icon.image_reps()) {
+ const auto& bitmap = rep.GetBitmap();
+ gfx::Size image_size = gfx::SkISizeToSize(bitmap.dimensions());
+ if (image_size.IsEmpty() || image_size.width() != image_size.height()) {
+ // The toplevel icon protocol requires square icons.
+ continue;
+ }
+
+ WaylandShmBuffer buffer(connection_->buffer_factory(), image_size);
+ if (!buffer.IsValid()) {
+ LOG(ERROR) << "Failed to create SHM buffer for icon Bitmap.";
+ return;
+ }
+
+ wl::DrawBitmap(bitmap, &buffer);
+ buffers.emplace_back(std::move(buffer), rep.scale());
+ }
+ for (const auto& [buffer, scale] : buffers) {
+ xdg_toplevel_icon_v1_add_buffer(xdg_icon, buffer.get(), scale);
+ }
+ xdg_toplevel_icon_manager_v1_set_icon(manager, xdg_toplevel_.get(), xdg_icon);
+ xdg_toplevel_icon_v1_destroy(xdg_icon);
+}
+
XDGToplevelWrapperImpl* XDGToplevelWrapperImpl::AsXDGToplevelWrapper() {
return this;
}
diff --git a/ui/ozone/platform/wayland/host/xdg_toplevel_wrapper_impl.h b/ui/ozone/platform/wayland/host/xdg_toplevel_wrapper_impl.h
index 99db31788888b8..f34cc782ffc82e 100644
--- a/ui/ozone/platform/wayland/host/xdg_toplevel_wrapper_impl.h
+++ b/ui/ozone/platform/wayland/host/xdg_toplevel_wrapper_impl.h
@@ -81,6 +81,7 @@ class XDGToplevelWrapperImpl : public ShellToplevelWrapper {
void SetPersistable(bool persistable) const override;
void SetShape(std::unique_ptr<ShapeRects> shape_rects) override;
void AckRotateFocus(uint32_t serial, uint32_t handled) override;
+ void SetIcon(const gfx::ImageSkia& icon) override;
XDGToplevelWrapperImpl* AsXDGToplevelWrapper() override;
diff --git a/ui/ozone/platform/wayland/test/mock_xdg_toplevel_icon.cc b/ui/ozone/platform/wayland/test/mock_xdg_toplevel_icon.cc
new file mode 100644
index 00000000000000..464884e9e1124b
--- /dev/null
+++ b/ui/ozone/platform/wayland/test/mock_xdg_toplevel_icon.cc
@@ -0,0 +1,95 @@
+// Copyright 2024 The Chromium Authors
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ui/ozone/platform/wayland/test/mock_xdg_toplevel_icon.h"
+
+#include <wayland-server-core.h>
+
+#include "base/check_op.h"
+#include "ui/ozone/platform/wayland/host/wayland_shm_buffer.h"
+#include "ui/ozone/platform/wayland/test/server_object.h"
+
+namespace wl {
+
+namespace {
+
+void DestroyManager(struct wl_client* client, struct wl_resource* resource) {}
+
+void CreateIcon(struct wl_client* client,
+ struct wl_resource* resource,
+ uint32_t id) {
+ auto* global = GetUserDataAs<MockXdgToplevelIconManagerV1>(resource);
+ wl_resource* icon = CreateResourceWithImpl<MockXdgToplevelIconV1>(
+ client, &xdg_toplevel_icon_v1_interface, 1, &kMockXdgToplevelIconImpl, id,
+ global);
+ global->set_icon(GetUserDataAs<MockXdgToplevelIconV1>(icon));
+}
+
+void SetIcon(struct wl_client* client,
+ struct wl_resource* resource,
+ struct wl_resource* toplevel,
+ struct wl_resource* icon) {
+ auto* manager = GetUserDataAs<MockXdgToplevelIconManagerV1>(resource);
+ ASSERT_TRUE(manager);
+ auto* toplevel_icon = GetUserDataAs<MockXdgToplevelIconV1>(icon);
+ ASSERT_TRUE(toplevel_icon);
+ manager->resources() = toplevel_icon->resources();
+}
+
+} // namespace
+
+const struct xdg_toplevel_icon_manager_v1_interface
+ kMockXdgToplevelIconManagerImpl = {
+ .destroy = DestroyManager,
+ .create_icon = CreateIcon,
+ .set_icon = SetIcon,
+};
+
+MockXdgToplevelIconManagerV1::MockXdgToplevelIconManagerV1()
+ : GlobalObject(&xdg_toplevel_icon_manager_v1_interface,
+ &kMockXdgToplevelIconManagerImpl,
+ 1) {}
+
+MockXdgToplevelIconManagerV1::~MockXdgToplevelIconManagerV1() = default;
+
+namespace {
+
+void DestroyIcon(struct wl_client* client, struct wl_resource* resource) {}
+
+void SetName(struct wl_client* client,
+ struct wl_resource* resource,
+ const char* icon_name) {}
+
+void AddBuffer(struct wl_client* client,
+ struct wl_resource* resource,
+ struct wl_resource* buffer,
+ int32_t scale) {
+ auto* icon = GetUserDataAs<MockXdgToplevelIconV1>(resource);
+ ASSERT_TRUE(icon);
+ wl_shm_buffer* shm_buffer = wl_shm_buffer_get(buffer);
+ ASSERT_TRUE(buffer);
+ auto width = wl_shm_buffer_get_width(shm_buffer);
+ auto height = wl_shm_buffer_get_height(shm_buffer);
+ icon->resources().emplace_back(gfx::Size(width, height), scale);
+}
+
+} // namespace
+
+const struct xdg_toplevel_icon_v1_interface kMockXdgToplevelIconImpl = {
+ .destroy = DestroyIcon,
+ .set_name = SetName,
+ .add_buffer = AddBuffer,
+};
+
+MockXdgToplevelIconV1::MockXdgToplevelIconV1(
+ wl_resource* resource,
+ MockXdgToplevelIconManagerV1* global)
+ : ServerObject(resource), global_(global) {}
+
+MockXdgToplevelIconV1::~MockXdgToplevelIconV1() {
+ CHECK_EQ(global_->icon(), this);
+ global_->set_icon(nullptr);
+}
+
+} // namespace wl
diff --git a/ui/ozone/platform/wayland/test/mock_xdg_toplevel_icon.h b/ui/ozone/platform/wayland/test/mock_xdg_toplevel_icon.h
new file mode 100644
index 00000000000000..4272f362be0d18
--- /dev/null
+++ b/ui/ozone/platform/wayland/test/mock_xdg_toplevel_icon.h
@@ -0,0 +1,79 @@
+// Copyright 2024 The Chromium Authors
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef UI_OZONE_PLATFORM_WAYLAND_TEST_MOCK_XDG_TOPLEVEL_ICON_H_
+#define UI_OZONE_PLATFORM_WAYLAND_TEST_MOCK_XDG_TOPLEVEL_ICON_H_
+
+#include <xdg-toplevel-icon-v1-server-protocol.h>
+
+#include <vector>
+
+#include "base/check.h"
+#include "base/memory/raw_ptr.h"
+#include "testing/gmock/include/gmock/gmock.h"
+#include "ui/gfx/geometry/size.h"
+#include "ui/ozone/platform/wayland/test/global_object.h"
+#include "ui/ozone/platform/wayland/test/server_object.h"
+
+namespace wl {
+
+class MockXdgToplevelIconV1;
+
+struct XdgToplevelIconResource {
+ gfx::Size size;
+ int32_t scale;
+
+ bool operator==(const XdgToplevelIconResource& other) const {
+ return size == other.size && scale == other.scale;
+ }
+};
+
+using XdgToplevelIconResources = std::vector<XdgToplevelIconResource>;
+
+extern const struct xdg_toplevel_icon_manager_v1_interface
+ kMockXdgToplevelIconManagerImpl;
+extern const struct xdg_toplevel_icon_v1_interface kMockXdgToplevelIconImpl;
+
+class MockXdgToplevelIconManagerV1 : public GlobalObject {
+ public:
+ MockXdgToplevelIconManagerV1();
+
+ MockXdgToplevelIconManagerV1(const MockXdgToplevelIconManagerV1&) = delete;
+ MockXdgToplevelIconManagerV1& operator=(const MockXdgToplevelIconManagerV1&) =
+ delete;
+
+ ~MockXdgToplevelIconManagerV1() override;
+
+ void set_icon(MockXdgToplevelIconV1* icon) { icon_ = icon; }
+ MockXdgToplevelIconV1* icon() { return icon_; }
+
+ XdgToplevelIconResources& resources() { return resources_; }
+
+ private:
+ raw_ptr<MockXdgToplevelIconV1> icon_ = nullptr;
+
+ XdgToplevelIconResources resources_;
+};
+
+class MockXdgToplevelIconV1 : public ServerObject {
+ public:
+ MockXdgToplevelIconV1(wl_resource* resource,
+ MockXdgToplevelIconManagerV1* global);
+
+ MockXdgToplevelIconV1(const MockXdgToplevelIconV1&) = delete;
+ MockXdgToplevelIconV1& operator=(const MockXdgToplevelIconV1&) = delete;
+
+ ~MockXdgToplevelIconV1() override;
+
+ XdgToplevelIconResources& resources() { return resources_; }
+
+ private:
+ raw_ptr<MockXdgToplevelIconManagerV1> global_ = nullptr;
+
+ XdgToplevelIconResources resources_;
+};
+
+} // namespace wl
+
+#endif // UI_OZONE_PLATFORM_WAYLAND_TEST_MOCK_XDG_TOPLEVEL_ICON_H_
diff --git a/ui/ozone/platform/wayland/test/test_wayland_server_thread.cc b/ui/ozone/platform/wayland/test/test_wayland_server_thread.cc
index ab6f43e4a0cdb6..c925b27eb31cb4 100644
--- a/ui/ozone/platform/wayland/test/test_wayland_server_thread.cc
+++ b/ui/ozone/platform/wayland/test/test_wayland_server_thread.cc
@@ -171,6 +171,9 @@ bool TestWaylandServerThread::Start() {
if (!xdg_activation_v1_.Initialize(display_.get())) {
return false;
}
+ if (!xdg_toplevel_icon_manager_v1_.Initialize(display_.get())) {
+ return false;
+ }
client_ = wl_client_create(display_.get(), server_fd.release());
if (!client_)
diff --git a/ui/ozone/platform/wayland/test/test_wayland_server_thread.h b/ui/ozone/platform/wayland/test/test_wayland_server_thread.h
index d17deea735bc01..dd8f538ea23c18 100644
--- a/ui/ozone/platform/wayland/test/test_wayland_server_thread.h
+++ b/ui/ozone/platform/wayland/test/test_wayland_server_thread.h
@@ -23,6 +23,7 @@
#include "ui/ozone/platform/wayland/test/mock_wp_presentation.h"
#include "ui/ozone/platform/wayland/test/mock_xdg_activation_v1.h"
#include "ui/ozone/platform/wayland/test/mock_xdg_shell.h"
+#include "ui/ozone/platform/wayland/test/mock_xdg_toplevel_icon.h"
#include "ui/ozone/platform/wayland/test/mock_zwp_linux_dmabuf.h"
#include "ui/ozone/platform/wayland/test/test_alpha_compositing.h"
#include "ui/ozone/platform/wayland/test/test_compositor.h"
@@ -187,6 +188,10 @@ class TestWaylandServerThread : public TestOutput::Delegate,
MockXdgActivationV1* xdg_activation_v1() { return &xdg_activation_v1_; }
+ MockXdgToplevelIconManagerV1* xdg_toplevel_icon_manager_v1() {
+ return &xdg_toplevel_icon_manager_v1_;
+ }
+
void set_output_delegate(OutputDelegate* delegate) {
output_delegate_ = delegate;
}
@@ -260,6 +265,7 @@ class TestWaylandServerThread : public TestOutput::Delegate,
MockWpPresentation wp_presentation_;
TestWpPointerGestures wp_pointer_gestures_;
MockXdgActivationV1 xdg_activation_v1_;
+ MockXdgToplevelIconManagerV1 xdg_toplevel_icon_manager_v1_;
std::unique_ptr<TestSelectionDeviceManager> primary_selection_device_manager_;
std::vector<std::unique_ptr<GlobalObject>> globals_;

View File

@@ -1,335 +0,0 @@
From 6185a6e178fc236aad3502fbc969ddd38aabf020 Mon Sep 17 00:00:00 2001
From: Tom Anderson <thomasanderson@chromium.org>
Date: Tue, 6 Aug 2024 00:27:29 +0000
Subject: [PATCH] [Wayland] Add ToplevelIconManager
This CL is just the boilerplate. Actual implementation to follow.
R=nickdiego
Change-Id: I135d5366761fcbb132405d782738d6c09f52bdd8
Bug: 356424077
Low-Coverage-Reason: TESTS_IN_SEPARATE_CL: This CL adds the boilerplate. Tests will be added in a followup.
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5752291
Commit-Queue: Thomas Anderson <thomasanderson@chromium.org>
Auto-Submit: Thomas Anderson <thomasanderson@chromium.org>
Reviewed-by: Nick Yamane <nickdiego@igalia.com>
Cr-Commit-Position: refs/heads/main@{#1337593}
---
third_party/wayland-protocols/BUILD.gn | 4 ++
ui/ozone/platform/wayland/BUILD.gn | 3 ++
.../platform/wayland/common/wayland_object.cc | 50 ++++++++++++-------
.../platform/wayland/common/wayland_object.h | 2 +
.../wayland/host/toplevel_icon_manager.cc | 44 ++++++++++++++++
.../wayland/host/toplevel_icon_manager.h | 29 +++++++++++
.../wayland/host/wayland_connection.cc | 3 ++
.../wayland/host/wayland_connection.h | 6 +++
8 files changed, 123 insertions(+), 18 deletions(-)
create mode 100644 ui/ozone/platform/wayland/host/toplevel_icon_manager.cc
create mode 100644 ui/ozone/platform/wayland/host/toplevel_icon_manager.h
diff --git a/third_party/wayland-protocols/BUILD.gn b/third_party/wayland-protocols/BUILD.gn
index 67941c2c90cf5e..0bd73c2f56c380 100644
--- a/third_party/wayland-protocols/BUILD.gn
+++ b/third_party/wayland-protocols/BUILD.gn
@@ -207,3 +207,7 @@ wayland_protocol("xdg_shell_protocol") {
wayland_protocol("xdg_toplevel_drag_protocol") {
sources = [ "src/staging/xdg-toplevel-drag/xdg-toplevel-drag-v1.xml" ]
}
+
+wayland_protocol("xdg_toplevel_icon_protocol") {
+ sources = [ "src/staging/xdg-toplevel-icon/xdg-toplevel-icon-v1.xml" ]
+}
diff --git a/ui/ozone/platform/wayland/BUILD.gn b/ui/ozone/platform/wayland/BUILD.gn
index 0264365be7c6ce..4ba36222f03906 100644
--- a/ui/ozone/platform/wayland/BUILD.gn
+++ b/ui/ozone/platform/wayland/BUILD.gn
@@ -77,6 +77,8 @@ source_set("wayland") {
"host/single_pixel_buffer.h",
"host/surface_augmenter.cc",
"host/surface_augmenter.h",
+ "host/toplevel_icon_manager.cc",
+ "host/toplevel_icon_manager.h",
"host/wayland_bubble.cc",
"host/wayland_bubble.h",
"host/wayland_buffer_backing.cc",
@@ -291,6 +293,7 @@ source_set("wayland") {
"//third_party/wayland-protocols:xdg_foreign",
"//third_party/wayland-protocols:xdg_output_protocol",
"//third_party/wayland-protocols:xdg_shell_protocol",
+ "//third_party/wayland-protocols:xdg_toplevel_icon_protocol",
"//ui/base",
"//ui/base:buildflags",
"//ui/base:data_exchange",
diff --git a/ui/ozone/platform/wayland/common/wayland_object.cc b/ui/ozone/platform/wayland/common/wayland_object.cc
index cab61aa4409ca5..e30367a19d7774 100644
--- a/ui/ozone/platform/wayland/common/wayland_object.cc
+++ b/ui/ozone/platform/wayland/common/wayland_object.cc
@@ -44,6 +44,7 @@
#include <xdg-foreign-unstable-v2-client-protocol.h>
#include <xdg-output-unstable-v1-client-protocol.h>
#include <xdg-shell-client-protocol.h>
+#include <xdg-toplevel-icon-v1-client-protocol.h>
#include "base/logging.h"
@@ -77,31 +78,36 @@ void delete_output(wl_output* output) {
}
void delete_keyboard(wl_keyboard* keyboard) {
- if (wl::get_version_of_object(keyboard) >= WL_KEYBOARD_RELEASE_SINCE_VERSION)
+ if (wl::get_version_of_object(keyboard) >=
+ WL_KEYBOARD_RELEASE_SINCE_VERSION) {
wl_keyboard_release(keyboard);
- else
+ } else {
wl_keyboard_destroy(keyboard);
+ }
}
void delete_pointer(wl_pointer* pointer) {
- if (wl::get_version_of_object(pointer) >= WL_POINTER_RELEASE_SINCE_VERSION)
+ if (wl::get_version_of_object(pointer) >= WL_POINTER_RELEASE_SINCE_VERSION) {
wl_pointer_release(pointer);
- else
+ } else {
wl_pointer_destroy(pointer);
+ }
}
void delete_seat(wl_seat* seat) {
- if (wl::get_version_of_object(seat) >= WL_SEAT_RELEASE_SINCE_VERSION)
+ if (wl::get_version_of_object(seat) >= WL_SEAT_RELEASE_SINCE_VERSION) {
wl_seat_release(seat);
- else
+ } else {
wl_seat_destroy(seat);
+ }
}
void delete_touch(wl_touch* touch) {
- if (wl::get_version_of_object(touch) >= WL_TOUCH_RELEASE_SINCE_VERSION)
+ if (wl::get_version_of_object(touch) >= WL_TOUCH_RELEASE_SINCE_VERSION) {
wl_touch_release(touch);
- else
+ } else {
wl_touch_destroy(touch);
+ }
}
void delete_zaura_output_manager(zaura_output_manager* manager) {
@@ -113,39 +119,45 @@ void delete_zaura_output_manager_v2(zaura_output_manager_v2* manager) {
}
void delete_zaura_shell(zaura_shell* shell) {
- if (wl::get_version_of_object(shell) >= ZAURA_SHELL_RELEASE_SINCE_VERSION)
+ if (wl::get_version_of_object(shell) >= ZAURA_SHELL_RELEASE_SINCE_VERSION) {
zaura_shell_release(shell);
- else
+ } else {
zaura_shell_destroy(shell);
+ }
}
void delete_zaura_surface(zaura_surface* surface) {
- if (wl::get_version_of_object(surface) >= ZAURA_SURFACE_RELEASE_SINCE_VERSION)
+ if (wl::get_version_of_object(surface) >=
+ ZAURA_SURFACE_RELEASE_SINCE_VERSION) {
zaura_surface_release(surface);
- else
+ } else {
zaura_surface_destroy(surface);
+ }
}
void delete_zaura_output(zaura_output* output) {
- if (wl::get_version_of_object(output) >= ZAURA_OUTPUT_RELEASE_SINCE_VERSION)
+ if (wl::get_version_of_object(output) >= ZAURA_OUTPUT_RELEASE_SINCE_VERSION) {
zaura_output_release(output);
- else
+ } else {
zaura_output_destroy(output);
+ }
}
void delete_zaura_toplevel(zaura_toplevel* toplevel) {
if (wl::get_version_of_object(toplevel) >=
- ZAURA_TOPLEVEL_RELEASE_SINCE_VERSION)
+ ZAURA_TOPLEVEL_RELEASE_SINCE_VERSION) {
zaura_toplevel_release(toplevel);
- else
+ } else {
zaura_toplevel_destroy(toplevel);
+ }
}
void delete_zaura_popup(zaura_popup* popup) {
- if (wl::get_version_of_object(popup) >= ZAURA_POPUP_RELEASE_SINCE_VERSION)
+ if (wl::get_version_of_object(popup) >= ZAURA_POPUP_RELEASE_SINCE_VERSION) {
zaura_popup_release(popup);
- else
+ } else {
zaura_popup_destroy(popup);
+ }
}
} // namespace
@@ -245,6 +257,8 @@ IMPLEMENT_WAYLAND_OBJECT_TRAITS(xdg_popup)
IMPLEMENT_WAYLAND_OBJECT_TRAITS(xdg_positioner)
IMPLEMENT_WAYLAND_OBJECT_TRAITS(xdg_surface)
IMPLEMENT_WAYLAND_OBJECT_TRAITS(xdg_toplevel)
+IMPLEMENT_WAYLAND_OBJECT_TRAITS(xdg_toplevel_icon_manager_v1)
+IMPLEMENT_WAYLAND_OBJECT_TRAITS(xdg_toplevel_icon_v1)
IMPLEMENT_WAYLAND_OBJECT_TRAITS(xdg_wm_base)
IMPLEMENT_WAYLAND_OBJECT_TRAITS_WITH_DELETER(zaura_output_manager,
delete_zaura_output_manager)
diff --git a/ui/ozone/platform/wayland/common/wayland_object.h b/ui/ozone/platform/wayland/common/wayland_object.h
index ed4902d29edb8f..38213eff64de40 100644
--- a/ui/ozone/platform/wayland/common/wayland_object.h
+++ b/ui/ozone/platform/wayland/common/wayland_object.h
@@ -156,6 +156,8 @@ DECLARE_WAYLAND_OBJECT_TRAITS(xdg_popup)
DECLARE_WAYLAND_OBJECT_TRAITS(xdg_positioner)
DECLARE_WAYLAND_OBJECT_TRAITS(xdg_surface)
DECLARE_WAYLAND_OBJECT_TRAITS(xdg_toplevel)
+DECLARE_WAYLAND_OBJECT_TRAITS(xdg_toplevel_icon_manager_v1)
+DECLARE_WAYLAND_OBJECT_TRAITS(xdg_toplevel_icon_v1)
DECLARE_WAYLAND_OBJECT_TRAITS(xdg_wm_base)
DECLARE_WAYLAND_OBJECT_TRAITS(zaura_output)
DECLARE_WAYLAND_OBJECT_TRAITS(zaura_output_manager)
diff --git a/ui/ozone/platform/wayland/host/toplevel_icon_manager.cc b/ui/ozone/platform/wayland/host/toplevel_icon_manager.cc
new file mode 100644
index 00000000000000..44478f56c88a97
--- /dev/null
+++ b/ui/ozone/platform/wayland/host/toplevel_icon_manager.cc
@@ -0,0 +1,44 @@
+// Copyright 2024 The Chromium Authors
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ui/ozone/platform/wayland/host/toplevel_icon_manager.h"
+
+#include <xdg-toplevel-icon-v1-client-protocol.h>
+
+#include "base/check_op.h"
+#include "base/logging.h"
+#include "ui/ozone/platform/wayland/common/wayland_object.h"
+#include "ui/ozone/platform/wayland/host/wayland_connection.h"
+
+namespace ui {
+
+namespace {
+
+constexpr uint32_t kMaxVersion = 1;
+
+} // namespace
+
+// static
+void ToplevelIconManager::Instantiate(WaylandConnection* connection,
+ wl_registry* registry,
+ uint32_t name,
+ const std::string& interface,
+ uint32_t version) {
+ CHECK_EQ(interface, kInterfaceName) << "Expected \"" << kInterfaceName
+ << "\" but got \"" << interface << "\"";
+
+ if (connection->toplevel_icon_manager_v1_) {
+ return;
+ }
+
+ auto instance = wl::Bind<::xdg_toplevel_icon_manager_v1>(
+ registry, name, std::min(version, kMaxVersion));
+ if (!instance) {
+ LOG(ERROR) << "Failed to bind " << kInterfaceName;
+ return;
+ }
+ connection->toplevel_icon_manager_v1_ = std::move(instance);
+}
+
+} // namespace ui
diff --git a/ui/ozone/platform/wayland/host/toplevel_icon_manager.h b/ui/ozone/platform/wayland/host/toplevel_icon_manager.h
new file mode 100644
index 00000000000000..8525dd7cda62db
--- /dev/null
+++ b/ui/ozone/platform/wayland/host/toplevel_icon_manager.h
@@ -0,0 +1,29 @@
+// Copyright 2024 The Chromium Authors
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef UI_OZONE_PLATFORM_WAYLAND_HOST_TOPLEVEL_ICON_MANAGER_H_
+#define UI_OZONE_PLATFORM_WAYLAND_HOST_TOPLEVEL_ICON_MANAGER_H_
+
+#include "ui/ozone/platform/wayland/common/wayland_object.h"
+
+namespace ui {
+
+// Sets up the global xdg_toplevel_icon_manager_v1 instance.
+class ToplevelIconManager
+ : public wl::GlobalObjectRegistrar<ToplevelIconManager> {
+ public:
+ static constexpr char kInterfaceName[] = "xdg_toplevel_icon_manager_v1";
+
+ static void Instantiate(WaylandConnection* connection,
+ wl_registry* registry,
+ uint32_t name,
+ const std::string& interface,
+ uint32_t version);
+
+ ToplevelIconManager() = delete;
+};
+
+} // namespace ui
+
+#endif // UI_OZONE_PLATFORM_WAYLAND_HOST_TOPLEVEL_ICON_MANAGER_H_
diff --git a/ui/ozone/platform/wayland/host/wayland_connection.cc b/ui/ozone/platform/wayland/host/wayland_connection.cc
index fe695e355e26b8..51ca168a198bda 100644
--- a/ui/ozone/platform/wayland/host/wayland_connection.cc
+++ b/ui/ozone/platform/wayland/host/wayland_connection.cc
@@ -38,6 +38,7 @@
#include "ui/ozone/platform/wayland/host/proxy/wayland_proxy_impl.h"
#include "ui/ozone/platform/wayland/host/single_pixel_buffer.h"
#include "ui/ozone/platform/wayland/host/surface_augmenter.h"
+#include "ui/ozone/platform/wayland/host/toplevel_icon_manager.h"
#include "ui/ozone/platform/wayland/host/wayland_buffer_factory.h"
#include "ui/ozone/platform/wayland/host/wayland_buffer_manager_host.h"
#include "ui/ozone/platform/wayland/host/wayland_cursor.h"
@@ -152,6 +153,8 @@ bool WaylandConnection::Initialize(bool use_threaded_polling) {
&SinglePixelBuffer::Instantiate);
RegisterGlobalObjectFactory(SurfaceAugmenter::kInterfaceName,
&SurfaceAugmenter::Instantiate);
+ RegisterGlobalObjectFactory(ToplevelIconManager::kInterfaceName,
+ &ToplevelIconManager::Instantiate);
RegisterGlobalObjectFactory(WaylandZAuraOutputManagerV2::kInterfaceName,
&WaylandZAuraOutputManagerV2::Instantiate);
RegisterGlobalObjectFactory(WaylandDataDeviceManager::kInterfaceName,
diff --git a/ui/ozone/platform/wayland/host/wayland_connection.h b/ui/ozone/platform/wayland/host/wayland_connection.h
index 54eb0c234a44fc..10fe500d24e33f 100644
--- a/ui/ozone/platform/wayland/host/wayland_connection.h
+++ b/ui/ozone/platform/wayland/host/wayland_connection.h
@@ -169,6 +169,10 @@ class WaylandConnection {
return fractional_scale_manager_v1_.get();
}
+ xdg_toplevel_icon_manager_v1* toplevel_icon_manager_v1() const {
+ return toplevel_icon_manager_v1_.get();
+ }
+
void SetPlatformCursor(wl_cursor* cursor_data, int buffer_scale);
void SetCursorBufferListener(WaylandCursorBufferListener* listener);
@@ -384,6 +388,7 @@ class WaylandConnection {
friend class OverlayPrioritizer;
friend class SinglePixelBuffer;
friend class SurfaceAugmenter;
+ friend class ToplevelIconManager;
friend class WaylandDataDeviceManager;
friend class WaylandOutput;
friend class WaylandSeat;
@@ -489,6 +494,7 @@ class WaylandConnection {
wl::Object<zcr_extended_drag_v1> extended_drag_v1_;
wl::Object<zxdg_output_manager_v1> xdg_output_manager_;
wl::Object<wp_fractional_scale_manager_v1> fractional_scale_manager_v1_;
+ wl::Object<xdg_toplevel_icon_manager_v1> toplevel_icon_manager_v1_;
// Manages Wayland windows.
WaylandWindowManager window_manager_{this};

View File

@@ -1,61 +0,0 @@
From 04b25cdd531cf3826d7418141897492979d8f0fb Mon Sep 17 00:00:00 2001
From: Jose Dapena Paz <jdapena@igalia.com>
Date: Thu, 19 Sep 2024 10:13:04 +0000
Subject: [PATCH] GCC: avoid clash between type and getter in WaylandConnection
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
WaylandConnection::xdg_toplevel_drag_manager_v1 getter clashes with
the xdg_toplevel_drag_manager_v1 type. Renamed getter to
toplevel_drag_manager_v1 following the decision with other types.
Bug: 40565911
Change-Id: I7331be4bcb00f47cd48a74b043067f044b40dcbc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5875679
Reviewed-by: Nick Yamane <nickdiego@igalia.com>
Commit-Queue: José Dapena Paz <jdapena@igalia.com>
Cr-Commit-Position: refs/heads/main@{#1357526}
---
ui/ozone/platform/wayland/host/wayland_connection.h | 2 +-
.../platform/wayland/host/wayland_window_drag_controller.cc | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/ui/ozone/platform/wayland/host/wayland_connection.h b/ui/ozone/platform/wayland/host/wayland_connection.h
index 79680db7189852..55a89735882ff7 100644
--- a/ui/ozone/platform/wayland/host/wayland_connection.h
+++ b/ui/ozone/platform/wayland/host/wayland_connection.h
@@ -160,7 +160,7 @@ class WaylandConnection {
zcr_extended_drag_v1* extended_drag_v1() const {
return extended_drag_v1_.get();
}
- xdg_toplevel_drag_manager_v1* xdg_toplevel_drag_manager_v1() const {
+ xdg_toplevel_drag_manager_v1* toplevel_drag_manager_v1() const {
return xdg_toplevel_drag_manager_v1_.get();
}
diff --git a/ui/ozone/platform/wayland/host/wayland_window_drag_controller.cc b/ui/ozone/platform/wayland/host/wayland_window_drag_controller.cc
index 6184684e308154..6fbf3df07bfe68 100644
--- a/ui/ozone/platform/wayland/host/wayland_window_drag_controller.cc
+++ b/ui/ozone/platform/wayland/host/wayland_window_drag_controller.cc
@@ -109,9 +109,9 @@ class WaylandWindowDragController::XdgToplevelDrag {
public:
XdgToplevelDrag(WaylandConnection& connection, wl_data_source* source)
: connection_(connection) {
- DCHECK(connection.xdg_toplevel_drag_manager_v1());
+ DCHECK(connection.toplevel_drag_manager_v1());
drag_.reset(xdg_toplevel_drag_manager_v1_get_xdg_toplevel_drag(
- connection.xdg_toplevel_drag_manager_v1(), source));
+ connection.toplevel_drag_manager_v1(), source));
DCHECK(drag_);
}
@@ -737,7 +737,7 @@ bool WaylandWindowDragController::IsExtendedDragAvailable() const {
}
bool WaylandWindowDragController::IsXdgToplevelDragAvailable() const {
- return !!connection_->xdg_toplevel_drag_manager_v1();
+ return !!connection_->toplevel_drag_manager_v1();
}
bool WaylandWindowDragController::IsActiveDragAndDropSession() const {