Skip to content
This repository has been archived by the owner on May 24, 2024. It is now read-only.

Commit

Permalink
Backport fix for --ozone-platform-hint
Browse files Browse the repository at this point in the history
Partially fixes flathub/org.chromium.Chromium#385.

Signed-off-by: Ryan Gonzalez <[email protected]>
  • Loading branch information
refi64 authored and rany2 committed Apr 24, 2024
1 parent 8adc627 commit 79872a2
Show file tree
Hide file tree
Showing 2 changed files with 97 additions and 1 deletion.
95 changes: 95 additions & 0 deletions patches/chromium/Fix-ozone-platform-hint.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
From 2893d7921a7f7beb79445e7815dfb901a1835128 Mon Sep 17 00:00:00 2001
From: Tom Anderson <[email protected]>
Date: Wed, 20 Mar 2024 00:00:12 +0000
Subject: [PATCH] Fix --ozone-platform-hint

This fixes a regression after r1269993 which moved ozone platform
early initialization before the ozone platform hint flag was
processed. This CL ensures the flag processing happens even earlier.

R=sky

Change-Id: Icc9649beb0b86753265be2b6cdf3059611eb410f
Bug: None
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5375669
Reviewed-by: Scott Violet <[email protected]>
Auto-Submit: Thomas Anderson <[email protected]>
Commit-Queue: Thomas Anderson <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1275306}
---
chrome/app/chrome_main_delegate.cc | 6 ++++++
.../chrome_browser_main_extra_parts_linux.cc | 13 +++++++------
.../browser/chrome_browser_main_extra_parts_linux.h | 3 ++-
3 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/chrome/app/chrome_main_delegate.cc b/chrome/app/chrome_main_delegate.cc
index 73b6ab0934b14..0b4c44be679d0 100644
--- a/chrome/app/chrome_main_delegate.cc
+++ b/chrome/app/chrome_main_delegate.cc
@@ -249,6 +249,9 @@
#include "base/scoped_add_feature_flags.h"
#include "ui/base/ui_base_features.h"
#include "ui/ozone/public/ozone_platform.h"
+#if BUILDFLAG(IS_LINUX)
+#include "chrome/browser/chrome_browser_main_extra_parts_linux.h"
+#endif
#endif // BUILDFLAG(IS_OZONE)

base::LazyInstance<ChromeContentGpuClient>::DestructorAtExit
@@ -959,6 +962,9 @@ std::optional<int> ChromeMainDelegate::PostEarlyInitialization(
// Initialize Ozone platform and add required feature flags as per platform's
// properties. Must be added before feature list is created otherwise the
// added flag won't be picked up.
+#if BUILDFLAG(IS_LINUX)
+ ChromeBrowserMainExtraPartsLinux::InitOzonePlatformHint();
+#endif
ui::OzonePlatform::PreEarlyInitialization();
AddFeatureFlagsToCommandLine();
#endif // BUILDFLAG(IS_OZONE)
diff --git a/chrome/browser/chrome_browser_main_extra_parts_linux.cc b/chrome/browser/chrome_browser_main_extra_parts_linux.cc
index dba7b116ecaa0..ea0487022dcdc 100644
--- a/chrome/browser/chrome_browser_main_extra_parts_linux.cc
+++ b/chrome/browser/chrome_browser_main_extra_parts_linux.cc
@@ -168,7 +168,13 @@ ChromeBrowserMainExtraPartsLinux::ChromeBrowserMainExtraPartsLinux() = default;

ChromeBrowserMainExtraPartsLinux::~ChromeBrowserMainExtraPartsLinux() = default;

-void ChromeBrowserMainExtraPartsLinux::PreEarlyInitialization() {
+void ChromeBrowserMainExtraPartsLinux::PostBrowserStart() {
+ RecordDisplayServerProtocolSupport();
+ ChromeBrowserMainExtraPartsOzone::PostBrowserStart();
+}
+
+// static
+void ChromeBrowserMainExtraPartsLinux::InitOzonePlatformHint() {
#if BUILDFLAG(IS_LINUX)
// On the desktop, we fix the platform name if necessary.
// See https://crbug.com/1246928.
@@ -189,8 +195,3 @@ void ChromeBrowserMainExtraPartsLinux::PreEarlyInitialization() {
}
#endif // BUILDFLAG(IS_LINUX)
}
-
-void ChromeBrowserMainExtraPartsLinux::PostBrowserStart() {
- RecordDisplayServerProtocolSupport();
- ChromeBrowserMainExtraPartsOzone::PostBrowserStart();
-}
diff --git a/chrome/browser/chrome_browser_main_extra_parts_linux.h b/chrome/browser/chrome_browser_main_extra_parts_linux.h
index 3847bd2090e28..4f188a7bdfe38 100644
--- a/chrome/browser/chrome_browser_main_extra_parts_linux.h
+++ b/chrome/browser/chrome_browser_main_extra_parts_linux.h
@@ -17,9 +17,10 @@ class ChromeBrowserMainExtraPartsLinux
const ChromeBrowserMainExtraPartsLinux&) = delete;
~ChromeBrowserMainExtraPartsLinux() override;

+ static void InitOzonePlatformHint();
+
private:
// ChromeBrowserMainExtraParts overrides.
- void PreEarlyInitialization() override;
void PostBrowserStart() override;
};

--
2.44.0

3 changes: 2 additions & 1 deletion patches/chromium/_sources.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
"patches/chromium/clang-build-script-Support-disabling-the-bundled-libxml2.patch",
"patches/chromium/Clang-build-script-Don-t-build-against-the-sysroot.patch",
"patches/chromium/Clang-build-script-add-support-for-building-a-subset-of-ta.patch",
"patches/chromium/media-Add-libfdk_aac-to-the-audio-codec-allow-list.patch"
"patches/chromium/media-Add-libfdk_aac-to-the-audio-codec-allow-list.patch",
"patches/chromium/Fix-ozone-platform-hint.patch"
]
}
]

0 comments on commit 79872a2

Please sign in to comment.