commit
f00233f737
@ -1,231 +0,0 @@
|
||||
From 144479ad7b4287bee4067f95e4218f614798a865 Mon Sep 17 00:00:00 2001
|
||||
From: Stephan Hartmann <stha09@googlemail.com>
|
||||
Date: Sun, 16 Jan 2022 19:15:26 +0000
|
||||
Subject: [PATCH] sql: make VirtualCursor standard layout type
|
||||
|
||||
sql::recover::VirtualCursor needs to be a standard layout type, but
|
||||
has members of type std::unique_ptr. However, std::unique_ptr is not
|
||||
guaranteed to be standard layout. Compiling with clang combined with
|
||||
gcc-11 libstdc++ fails because of this.
|
||||
|
||||
Bug: 1189788
|
||||
Change-Id: Ia6dc388cc5ef1c0f2afc75f8ca45b9f12687ca9c
|
||||
---
|
||||
|
||||
diff --git a/sql/recover_module/btree.cc b/sql/recover_module/btree.cc
|
||||
index cc9420e5..f12d8fa 100644
|
||||
--- a/sql/recover_module/btree.cc
|
||||
+++ b/sql/recover_module/btree.cc
|
||||
@@ -136,16 +136,22 @@
|
||||
"Move the destructor to the .cc file if it's non-trival");
|
||||
#endif // !DCHECK_IS_ON()
|
||||
|
||||
-LeafPageDecoder::LeafPageDecoder(DatabasePageReader* db_reader) noexcept
|
||||
- : page_id_(db_reader->page_id()),
|
||||
- db_reader_(db_reader),
|
||||
- cell_count_(ComputeCellCount(db_reader)),
|
||||
- next_read_index_(0),
|
||||
- last_record_size_(0) {
|
||||
+LeafPageDecoder::LeafPageDecoder() noexcept = default;
|
||||
+
|
||||
+void LeafPageDecoder::Initialize(DatabasePageReader* db_reader) {
|
||||
+ page_id_ = db_reader->page_id();
|
||||
+ db_reader_ = db_reader;
|
||||
+ cell_count_ = ComputeCellCount(db_reader);
|
||||
+ next_read_index_ = 0;
|
||||
+ last_record_size_ = 0;
|
||||
DCHECK(IsOnValidPage(db_reader));
|
||||
DCHECK(DatabasePageReader::IsValidPageId(page_id_));
|
||||
}
|
||||
|
||||
+void LeafPageDecoder::Reset() {
|
||||
+ db_reader_ = nullptr;
|
||||
+}
|
||||
+
|
||||
bool LeafPageDecoder::TryAdvance() {
|
||||
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
|
||||
DCHECK(CanAdvance());
|
||||
diff --git a/sql/recover_module/btree.h b/sql/recover_module/btree.h
|
||||
index eaa087a5..df0e0c9 100644
|
||||
--- a/sql/recover_module/btree.h
|
||||
+++ b/sql/recover_module/btree.h
|
||||
@@ -101,9 +101,7 @@
|
||||
public:
|
||||
// Creates a decoder for a DatabasePageReader's last read page.
|
||||
//
|
||||
- // |db_reader| must have been used to read an inner page of a table B-tree.
|
||||
- // |db_reader| must outlive this instance.
|
||||
- explicit LeafPageDecoder(DatabasePageReader* db_reader) noexcept;
|
||||
+ LeafPageDecoder() noexcept;
|
||||
~LeafPageDecoder() noexcept = default;
|
||||
|
||||
LeafPageDecoder(const LeafPageDecoder&) = delete;
|
||||
@@ -151,6 +149,17 @@
|
||||
// read as long as CanAdvance() returns true.
|
||||
bool TryAdvance();
|
||||
|
||||
+ // Initialize with DatabasePageReader
|
||||
+ // |db_reader| must have been used to read an inner page of a table B-tree.
|
||||
+ // |db_reader| must outlive this instance.
|
||||
+ void Initialize(DatabasePageReader* db_reader);
|
||||
+
|
||||
+ // Reset internal DatabasePageReader
|
||||
+ void Reset();
|
||||
+
|
||||
+ // True if DatabasePageReader is valid
|
||||
+ bool IsValid() { return (db_reader_ != nullptr); }
|
||||
+
|
||||
// True if the given reader may point to an inner page in a table B-tree.
|
||||
//
|
||||
// The last ReadPage() call on |db_reader| must have succeeded.
|
||||
@@ -164,14 +173,14 @@
|
||||
static int ComputeCellCount(DatabasePageReader* db_reader);
|
||||
|
||||
// The number of the B-tree page this reader is reading.
|
||||
- const int64_t page_id_;
|
||||
+ int64_t page_id_;
|
||||
// Used to read the tree page.
|
||||
//
|
||||
// Raw pointer usage is acceptable because this instance's owner is expected
|
||||
// to ensure that the DatabasePageReader outlives this.
|
||||
- DatabasePageReader* const db_reader_;
|
||||
+ DatabasePageReader* db_reader_;
|
||||
// Caches the ComputeCellCount() value for this reader's page.
|
||||
- const int cell_count_ = ComputeCellCount(db_reader_);
|
||||
+ int cell_count_;
|
||||
|
||||
// The reader's cursor state.
|
||||
//
|
||||
diff --git a/sql/recover_module/cursor.cc b/sql/recover_module/cursor.cc
|
||||
index 4f827ed..240de499 100644
|
||||
--- a/sql/recover_module/cursor.cc
|
||||
+++ b/sql/recover_module/cursor.cc
|
||||
@@ -28,7 +28,7 @@
|
||||
int VirtualCursor::First() {
|
||||
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
|
||||
inner_decoders_.clear();
|
||||
- leaf_decoder_ = nullptr;
|
||||
+ leaf_decoder_.Reset();
|
||||
|
||||
AppendPageDecoder(table_->root_page_id());
|
||||
return Next();
|
||||
@@ -38,18 +38,18 @@
|
||||
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
|
||||
record_reader_.Reset();
|
||||
|
||||
- while (!inner_decoders_.empty() || leaf_decoder_.get()) {
|
||||
- if (leaf_decoder_.get()) {
|
||||
- if (!leaf_decoder_->CanAdvance()) {
|
||||
+ while (!inner_decoders_.empty() || leaf_decoder_.IsValid()) {
|
||||
+ if (leaf_decoder_.IsValid()) {
|
||||
+ if (!leaf_decoder_.CanAdvance()) {
|
||||
// The leaf has been exhausted. Remove it from the DFS stack.
|
||||
- leaf_decoder_ = nullptr;
|
||||
+ leaf_decoder_.Reset();
|
||||
continue;
|
||||
}
|
||||
- if (!leaf_decoder_->TryAdvance())
|
||||
+ if (!leaf_decoder_.TryAdvance())
|
||||
continue;
|
||||
|
||||
- if (!payload_reader_.Initialize(leaf_decoder_->last_record_size(),
|
||||
- leaf_decoder_->last_record_offset())) {
|
||||
+ if (!payload_reader_.Initialize(leaf_decoder_.last_record_size(),
|
||||
+ leaf_decoder_.last_record_offset())) {
|
||||
continue;
|
||||
}
|
||||
if (!record_reader_.Initialize())
|
||||
@@ -101,13 +101,13 @@
|
||||
int64_t VirtualCursor::RowId() {
|
||||
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
|
||||
DCHECK(record_reader_.IsInitialized());
|
||||
- DCHECK(leaf_decoder_.get());
|
||||
- return leaf_decoder_->last_record_rowid();
|
||||
+ DCHECK(leaf_decoder_.IsValid());
|
||||
+ return leaf_decoder_.last_record_rowid();
|
||||
}
|
||||
|
||||
void VirtualCursor::AppendPageDecoder(int page_id) {
|
||||
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
|
||||
- DCHECK(leaf_decoder_.get() == nullptr)
|
||||
+ DCHECK(!leaf_decoder_.IsValid())
|
||||
<< __func__
|
||||
<< " must only be called when the current path has no leaf decoder";
|
||||
|
||||
@@ -115,7 +115,7 @@
|
||||
return;
|
||||
|
||||
if (LeafPageDecoder::IsOnValidPage(&db_reader_)) {
|
||||
- leaf_decoder_ = std::make_unique<LeafPageDecoder>(&db_reader_);
|
||||
+ leaf_decoder_.Initialize(&db_reader_);
|
||||
return;
|
||||
}
|
||||
|
||||
diff --git a/sql/recover_module/cursor.h b/sql/recover_module/cursor.h
|
||||
index 845b785..cc4e85f8 100644
|
||||
--- a/sql/recover_module/cursor.h
|
||||
+++ b/sql/recover_module/cursor.h
|
||||
@@ -130,7 +130,7 @@
|
||||
std::vector<std::unique_ptr<InnerPageDecoder>> inner_decoders_;
|
||||
|
||||
// Decodes the leaf page containing records.
|
||||
- std::unique_ptr<LeafPageDecoder> leaf_decoder_;
|
||||
+ LeafPageDecoder leaf_decoder_;
|
||||
|
||||
SEQUENCE_CHECKER(sequence_checker_);
|
||||
};
|
||||
diff --git a/sql/recover_module/pager.cc b/sql/recover_module/pager.cc
|
||||
index 58e75de..69d98cef 100644
|
||||
--- a/sql/recover_module/pager.cc
|
||||
+++ b/sql/recover_module/pager.cc
|
||||
@@ -23,8 +23,7 @@
|
||||
"ints are not appropriate for representing page IDs");
|
||||
|
||||
DatabasePageReader::DatabasePageReader(VirtualTable* table)
|
||||
- : page_data_(std::make_unique<uint8_t[]>(table->page_size())),
|
||||
- table_(table) {
|
||||
+ : page_data_(table->page_size()), table_(table) {
|
||||
DCHECK(table != nullptr);
|
||||
DCHECK(IsValidPageSize(table->page_size()));
|
||||
}
|
||||
@@ -58,7 +57,7 @@
|
||||
"The |read_offset| computation above may overflow");
|
||||
|
||||
int sqlite_status =
|
||||
- RawRead(sqlite_file, read_size, read_offset, page_data_.get());
|
||||
+ RawRead(sqlite_file, read_size, read_offset, page_data_.data());
|
||||
|
||||
// |page_id_| needs to be set to kInvalidPageId if the read failed.
|
||||
// Otherwise, future ReadPage() calls with the previous |page_id_| value
|
||||
diff --git a/sql/recover_module/pager.h b/sql/recover_module/pager.h
|
||||
index 07cac3cb..d08f093 100644
|
||||
--- a/sql/recover_module/pager.h
|
||||
+++ b/sql/recover_module/pager.h
|
||||
@@ -6,8 +6,8 @@
|
||||
#define SQL_RECOVER_MODULE_PAGER_H_
|
||||
|
||||
#include <cstdint>
|
||||
-#include <memory>
|
||||
#include <ostream>
|
||||
+#include <vector>
|
||||
|
||||
#include "base/check_op.h"
|
||||
#include "base/memory/raw_ptr.h"
|
||||
@@ -72,7 +72,7 @@
|
||||
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
|
||||
DCHECK_NE(page_id_, kInvalidPageId)
|
||||
<< "Successful ReadPage() required before accessing pager state";
|
||||
- return page_data_.get();
|
||||
+ return page_data_.data();
|
||||
}
|
||||
|
||||
// The number of bytes in the page read by the last ReadPage() call.
|
||||
@@ -139,7 +139,7 @@
|
||||
int page_id_ = kInvalidPageId;
|
||||
// Stores the bytes of the last page successfully read by ReadPage().
|
||||
// The content is undefined if the last call to ReadPage() did not succeed.
|
||||
- const std::unique_ptr<uint8_t[]> page_data_;
|
||||
+ std::vector<uint8_t> page_data_;
|
||||
// Raw pointer usage is acceptable because this instance's owner is expected
|
||||
// to ensure that the VirtualTable outlives this.
|
||||
const raw_ptr<VirtualTable> table_;
|
@ -1,86 +0,0 @@
|
||||
From 96ee2a8e20bb7a7c4fb19e27dc31ff5c6a472849 Mon Sep 17 00:00:00 2001
|
||||
From: Ryan Gonzalez <rymg19@gmail.com>
|
||||
Date: Mon, 06 Mar 2023 20:22:25 -0600
|
||||
Subject: [PATCH] AddressTrackerLinux: Increase the message buffer size
|
||||
|
||||
On non-4k-page systems, the message sizes may be too large to fit into
|
||||
the buffer, resulting in MSG_TRUNC. Instead of using the fixed 4kb size,
|
||||
follow the kernel documentation guidelines as to how large the buffer
|
||||
should be.
|
||||
|
||||
Originally found by Asahi Lina:
|
||||
|
||||
https://vt.social/@lina/109976892758680822
|
||||
|
||||
Bug: None
|
||||
Change-Id: I4790435190167a706fa7490ab57706db1f4a6120
|
||||
---
|
||||
|
||||
diff --git a/net/base/address_tracker_linux.cc b/net/base/address_tracker_linux.cc
|
||||
index 4976cae..f1a1fff 100644
|
||||
--- a/net/base/address_tracker_linux.cc
|
||||
+++ b/net/base/address_tracker_linux.cc
|
||||
@@ -14,6 +14,7 @@
|
||||
#include "base/files/scoped_file.h"
|
||||
#include "base/functional/callback_helpers.h"
|
||||
#include "base/logging.h"
|
||||
+#include "base/memory/page_size.h"
|
||||
#include "base/posix/eintr_wrapper.h"
|
||||
#include "base/task/current_thread.h"
|
||||
#include "base/threading/scoped_blocking_call.h"
|
||||
@@ -323,8 +324,30 @@
|
||||
*address_changed = false;
|
||||
*link_changed = false;
|
||||
*tunnel_changed = false;
|
||||
- char buffer[4096];
|
||||
bool first_loop = true;
|
||||
+
|
||||
+ // Varying sources have different opinions regarding the buffer size needed
|
||||
+ // for netlink messages to avoid truncation:
|
||||
+ // - The official documentation on netlink says messages are generally 8kb
|
||||
+ // or the system page size, whichever is *larger*:
|
||||
+ // https://www.kernel.org/doc/html/v6.2/userspace-api/netlink/intro.html#buffer-sizing
|
||||
+ // - The kernel headers would imply that messages are generally the system
|
||||
+ // page size or 8kb, whichever is *smaller*:
|
||||
+ // https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/include/linux/netlink.h?h=v6.2.2#n226
|
||||
+ // (libmnl follows this.)
|
||||
+ // - The netlink(7) man page's example always uses a fixed size 8kb buffer:
|
||||
+ // https://man7.org/linux/man-pages/man7/netlink.7.html
|
||||
+ // Here, we follow the guidelines in the documentation, for two primary
|
||||
+ // reasons:
|
||||
+ // - Erring on the side of a larger size is the safer way to go to avoid
|
||||
+ // MSG_TRUNC.
|
||||
+ // - Since this is heap-allocated anyway, there's no risk to the stack by
|
||||
+ // using the larger size.
|
||||
+
|
||||
+ constexpr size_t kMinNetlinkBufferSize = 8 * 1024;
|
||||
+ std::vector<char> buffer(
|
||||
+ std::max(base::GetPageSize(), kMinNetlinkBufferSize));
|
||||
+
|
||||
{
|
||||
absl::optional<base::ScopedBlockingCall> blocking_call;
|
||||
if (tracking_) {
|
||||
@@ -334,9 +357,10 @@
|
||||
}
|
||||
|
||||
for (;;) {
|
||||
- int rv = HANDLE_EINTR(recv(netlink_fd_.get(), buffer, sizeof(buffer),
|
||||
- // Block the first time through loop.
|
||||
- first_loop ? 0 : MSG_DONTWAIT));
|
||||
+ int rv =
|
||||
+ HANDLE_EINTR(recv(netlink_fd_.get(), buffer.data(), buffer.size(),
|
||||
+ // Block the first time through loop.
|
||||
+ first_loop ? 0 : MSG_DONTWAIT));
|
||||
first_loop = false;
|
||||
if (rv == 0) {
|
||||
LOG(ERROR) << "Unexpected shutdown of NETLINK socket.";
|
||||
@@ -348,7 +372,8 @@
|
||||
PLOG(ERROR) << "Failed to recv from netlink socket";
|
||||
return;
|
||||
}
|
||||
- HandleMessage(buffer, rv, address_changed, link_changed, tunnel_changed);
|
||||
+ HandleMessage(buffer.data(), rv, address_changed, link_changed,
|
||||
+ tunnel_changed);
|
||||
}
|
||||
}
|
||||
if (*link_changed || *address_changed)
|
@ -1,454 +0,0 @@
|
||||
diff --git a/chrome/browser/ui/BUILD.gn b/chrome/browser/ui/BUILD.gn
|
||||
index 3470da1..ff39851b 100644
|
||||
--- a/chrome/browser/ui/BUILD.gn
|
||||
+++ b/chrome/browser/ui/BUILD.gn
|
||||
@@ -5628,8 +5628,12 @@
|
||||
sources += [
|
||||
"views/chrome_browser_main_extra_parts_views_linux.cc",
|
||||
"views/chrome_browser_main_extra_parts_views_linux.h",
|
||||
+ "views/dark_mode_manager_linux.cc",
|
||||
+ "views/dark_mode_manager_linux.h",
|
||||
]
|
||||
deps += [
|
||||
+ "//components/dbus/thread_linux",
|
||||
+ "//dbus",
|
||||
"//ui/base/cursor",
|
||||
"//ui/ozone",
|
||||
]
|
||||
diff --git a/chrome/browser/ui/DEPS b/chrome/browser/ui/DEPS
|
||||
index fc3fab23..b56a704e 100644
|
||||
--- a/chrome/browser/ui/DEPS
|
||||
+++ b/chrome/browser/ui/DEPS
|
||||
@@ -42,6 +42,9 @@
|
||||
"browser_navigator_browsertest\.cc": [
|
||||
"+ash/shell.h",
|
||||
],
|
||||
+ "dark_mode_manager_linux\.cc": [
|
||||
+ "+dbus",
|
||||
+ ],
|
||||
"fullscreen_controller_interactive_browsertest\.cc": [
|
||||
"+ash/shell.h",
|
||||
],
|
||||
diff --git a/chrome/browser/ui/views/chrome_browser_main_extra_parts_views_linux.cc b/chrome/browser/ui/views/chrome_browser_main_extra_parts_views_linux.cc
|
||||
index dbc9cc4e..d7fad5b 100644
|
||||
--- a/chrome/browser/ui/views/chrome_browser_main_extra_parts_views_linux.cc
|
||||
+++ b/chrome/browser/ui/views/chrome_browser_main_extra_parts_views_linux.cc
|
||||
@@ -7,6 +7,7 @@
|
||||
#include "base/metrics/histogram_macros.h"
|
||||
#include "chrome/browser/themes/theme_service_aura_linux.h"
|
||||
#include "chrome/browser/ui/browser_list.h"
|
||||
+#include "chrome/browser/ui/views/dark_mode_manager_linux.h"
|
||||
#include "chrome/browser/ui/views/theme_profile_key.h"
|
||||
#include "ui/base/buildflags.h"
|
||||
#include "ui/base/cursor/cursor_factory.h"
|
||||
@@ -56,6 +57,8 @@
|
||||
UMA_HISTOGRAM_ENUMERATION("Linux.SystemTheme.Default",
|
||||
linux_ui_theme->GetNativeTheme()->system_theme());
|
||||
}
|
||||
+
|
||||
+ dark_mode_manager_ = std::make_unique<ui::DarkModeManagerLinux>();
|
||||
}
|
||||
|
||||
void ChromeBrowserMainExtraPartsViewsLinux::PreCreateThreads() {
|
||||
diff --git a/chrome/browser/ui/views/chrome_browser_main_extra_parts_views_linux.h b/chrome/browser/ui/views/chrome_browser_main_extra_parts_views_linux.h
|
||||
index 392d14c..6deb520 100644
|
||||
--- a/chrome/browser/ui/views/chrome_browser_main_extra_parts_views_linux.h
|
||||
+++ b/chrome/browser/ui/views/chrome_browser_main_extra_parts_views_linux.h
|
||||
@@ -13,6 +13,7 @@
|
||||
|
||||
namespace ui {
|
||||
class LinuxUiGetter;
|
||||
+class DarkModeManagerLinux;
|
||||
}
|
||||
|
||||
// Extra parts, which are used by both Ozone/X11/Wayland and inherited by the
|
||||
@@ -41,6 +42,8 @@
|
||||
absl::optional<display::ScopedDisplayObserver> display_observer_;
|
||||
|
||||
std::unique_ptr<ui::LinuxUiGetter> linux_ui_getter_;
|
||||
+
|
||||
+ std::unique_ptr<ui::DarkModeManagerLinux> dark_mode_manager_;
|
||||
};
|
||||
|
||||
#endif // CHROME_BROWSER_UI_VIEWS_CHROME_BROWSER_MAIN_EXTRA_PARTS_VIEWS_LINUX_H_
|
||||
diff --git a/chrome/browser/ui/views/dark_mode_manager_linux.cc b/chrome/browser/ui/views/dark_mode_manager_linux.cc
|
||||
new file mode 100644
|
||||
index 0000000..bb638f7
|
||||
--- /dev/null
|
||||
+++ b/chrome/browser/ui/views/dark_mode_manager_linux.cc
|
||||
@@ -0,0 +1,160 @@
|
||||
+// Copyright 2023 The Chromium Authors
|
||||
+// Use of this source code is governed by a BSD-style license that can be
|
||||
+// found in the LICENSE file.
|
||||
+
|
||||
+#include "chrome/browser/ui/views/dark_mode_manager_linux.h"
|
||||
+
|
||||
+#include "base/functional/bind.h"
|
||||
+#include "base/logging.h"
|
||||
+#include "components/dbus/thread_linux/dbus_thread_linux.h"
|
||||
+#include "dbus/bus.h"
|
||||
+#include "dbus/message.h"
|
||||
+#include "dbus/object_proxy.h"
|
||||
+#include "ui/linux/linux_ui.h"
|
||||
+#include "ui/linux/linux_ui_factory.h"
|
||||
+#include "ui/native_theme/native_theme.h"
|
||||
+
|
||||
+namespace {
|
||||
+
|
||||
+constexpr char kFreedesktopSettingsService[] = "org.freedesktop.portal.Desktop";
|
||||
+constexpr char kFreedesktopSettingsObjectPath[] =
|
||||
+ "/org/freedesktop/portal/desktop";
|
||||
+constexpr char kFreedesktopSettingsInterface[] =
|
||||
+ "org.freedesktop.portal.Settings";
|
||||
+constexpr char kSettingChangedSignal[] = "SettingChanged";
|
||||
+constexpr char kReadMethod[] = "Read";
|
||||
+constexpr char kSettingsNamespace[] = "org.freedesktop.appearance";
|
||||
+constexpr char kColorSchemeKey[] = "color-scheme";
|
||||
+constexpr int kFreedesktopColorSchemeDark = 1;
|
||||
+
|
||||
+scoped_refptr<dbus::Bus> CreateBus() {
|
||||
+ dbus::Bus::Options options;
|
||||
+ options.bus_type = dbus::Bus::SESSION;
|
||||
+ options.connection_type = dbus::Bus::PRIVATE;
|
||||
+ options.dbus_task_runner = dbus_thread_linux::GetTaskRunner();
|
||||
+ return base::MakeRefCounted<dbus::Bus>(options);
|
||||
+}
|
||||
+
|
||||
+} // namespace
|
||||
+
|
||||
+namespace ui {
|
||||
+
|
||||
+DarkModeManagerLinux::DarkModeManagerLinux()
|
||||
+ : bus_(CreateBus()),
|
||||
+ settings_proxy_(bus_->GetObjectProxy(
|
||||
+ kFreedesktopSettingsService,
|
||||
+ dbus::ObjectPath(kFreedesktopSettingsObjectPath))) {
|
||||
+ // Subscribe to changes in the color scheme preference.
|
||||
+ settings_proxy_->ConnectToSignal(
|
||||
+ kFreedesktopSettingsInterface, kSettingChangedSignal,
|
||||
+ base::BindRepeating(&DarkModeManagerLinux::OnPortalSettingChanged,
|
||||
+ weak_ptr_factory_.GetWeakPtr()),
|
||||
+ base::BindOnce(&DarkModeManagerLinux::OnSignalConnected,
|
||||
+ weak_ptr_factory_.GetWeakPtr()));
|
||||
+
|
||||
+ // Read initial color scheme preference.
|
||||
+ dbus::MethodCall method_call(kFreedesktopSettingsInterface, kReadMethod);
|
||||
+ dbus::MessageWriter writer(&method_call);
|
||||
+ writer.AppendString(kSettingsNamespace);
|
||||
+ writer.AppendString(kColorSchemeKey);
|
||||
+ settings_proxy_->CallMethod(
|
||||
+ &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
|
||||
+ base::BindOnce(&DarkModeManagerLinux::OnReadColorSchemeResponse,
|
||||
+ weak_ptr_factory_.GetWeakPtr()));
|
||||
+
|
||||
+ // Read the toolkit preference while asynchronously fetching the
|
||||
+ // portal preference.
|
||||
+ if (auto* linux_ui_theme = ui::GetDefaultLinuxUiTheme()) {
|
||||
+ auto* native_theme = linux_ui_theme->GetNativeTheme();
|
||||
+ native_theme_observer_.Observe(native_theme);
|
||||
+ SetColorScheme(native_theme->ShouldUseDarkColors());
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+DarkModeManagerLinux::~DarkModeManagerLinux() {
|
||||
+ settings_proxy_ = nullptr;
|
||||
+ dbus::Bus* const bus_ptr = bus_.get();
|
||||
+ bus_ptr->GetDBusTaskRunner()->PostTask(
|
||||
+ FROM_HERE, base::BindOnce(&dbus::Bus::ShutdownAndBlock, std::move(bus_)));
|
||||
+}
|
||||
+
|
||||
+void DarkModeManagerLinux::OnNativeThemeUpdated(
|
||||
+ ui::NativeTheme* observed_theme) {
|
||||
+ SetColorScheme(observed_theme->ShouldUseDarkColors());
|
||||
+}
|
||||
+
|
||||
+void DarkModeManagerLinux::OnSignalConnected(const std::string& interface_name,
|
||||
+ const std::string& signal_name,
|
||||
+ bool connected) {
|
||||
+ // Nothing to do. Continue using the toolkit setting if !connected.
|
||||
+}
|
||||
+
|
||||
+void DarkModeManagerLinux::OnPortalSettingChanged(dbus::Signal* signal) {
|
||||
+ dbus::MessageReader reader(signal);
|
||||
+
|
||||
+ std::string namespace_changed;
|
||||
+ std::string key_changed;
|
||||
+ dbus::MessageReader variant_reader(nullptr);
|
||||
+ if (!reader.PopString(&namespace_changed) ||
|
||||
+ !reader.PopString(&key_changed) || !reader.PopVariant(&variant_reader)) {
|
||||
+ LOG(ERROR) << "Received malformed Setting Changed signal from "
|
||||
+ "org.freedesktop.portal.Settings";
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ if (namespace_changed != kSettingsNamespace ||
|
||||
+ key_changed != kColorSchemeKey) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ uint32_t new_color_scheme;
|
||||
+ if (!variant_reader.PopUint32(&new_color_scheme)) {
|
||||
+ LOG(ERROR)
|
||||
+ << "Failed to read color-scheme value from SettingChanged signal";
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ SetColorScheme(new_color_scheme == kFreedesktopColorSchemeDark);
|
||||
+}
|
||||
+
|
||||
+void DarkModeManagerLinux::OnReadColorSchemeResponse(dbus::Response* response) {
|
||||
+ if (!response) {
|
||||
+ // Continue using the toolkit setting.
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ dbus::MessageReader reader(response);
|
||||
+ dbus::MessageReader variant_reader(nullptr);
|
||||
+ if (!reader.PopVariant(&variant_reader)) {
|
||||
+ LOG(ERROR) << "Failed to read variant from Read method response";
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ uint32_t new_color_scheme;
|
||||
+ if (!variant_reader.PopVariantOfUint32(&new_color_scheme)) {
|
||||
+ LOG(ERROR) << "Failed to read color-scheme value from Read "
|
||||
+ "method response";
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ // Ignore future updates from the toolkit theme.
|
||||
+ native_theme_observer_.Reset();
|
||||
+
|
||||
+ SetColorScheme(new_color_scheme == kFreedesktopColorSchemeDark);
|
||||
+}
|
||||
+
|
||||
+void DarkModeManagerLinux::SetColorScheme(bool prefer_dark_theme) {
|
||||
+ if (prefer_dark_theme_ == prefer_dark_theme) {
|
||||
+ return;
|
||||
+ }
|
||||
+ prefer_dark_theme_ = prefer_dark_theme;
|
||||
+
|
||||
+ NativeTheme* web_theme = NativeTheme::GetInstanceForWeb();
|
||||
+ web_theme->set_use_dark_colors(prefer_dark_theme_);
|
||||
+ web_theme->set_preferred_color_scheme(
|
||||
+ prefer_dark_theme_ ? NativeTheme::PreferredColorScheme::kDark
|
||||
+ : NativeTheme::PreferredColorScheme::kLight);
|
||||
+ web_theme->NotifyOnNativeThemeUpdated();
|
||||
+}
|
||||
+
|
||||
+} // namespace ui
|
||||
diff --git a/chrome/browser/ui/views/dark_mode_manager_linux.h b/chrome/browser/ui/views/dark_mode_manager_linux.h
|
||||
new file mode 100644
|
||||
index 0000000..34b07ff
|
||||
--- /dev/null
|
||||
+++ b/chrome/browser/ui/views/dark_mode_manager_linux.h
|
||||
@@ -0,0 +1,62 @@
|
||||
+// Copyright 2023 The Chromium Authors
|
||||
+// Use of this source code is governed by a BSD-style license that can be
|
||||
+// found in the LICENSE file.
|
||||
+
|
||||
+#ifndef CHROME_BROWSER_UI_VIEWS_DARK_MODE_MANAGER_LINUX_H_
|
||||
+#define CHROME_BROWSER_UI_VIEWS_DARK_MODE_MANAGER_LINUX_H_
|
||||
+
|
||||
+#include <string>
|
||||
+
|
||||
+#include "base/memory/scoped_refptr.h"
|
||||
+#include "base/memory/weak_ptr.h"
|
||||
+#include "base/scoped_observation.h"
|
||||
+#include "ui/native_theme/native_theme_observer.h"
|
||||
+
|
||||
+namespace dbus {
|
||||
+class Bus;
|
||||
+class ObjectProxy;
|
||||
+class Response;
|
||||
+class Signal;
|
||||
+} // namespace dbus
|
||||
+
|
||||
+namespace ui {
|
||||
+
|
||||
+// Observes the system color scheme preference using
|
||||
+// org.freedesktop.portal.Settings. Falls back to the toolkit preference if
|
||||
+// org.freedesktop.portal.Settings is unavailable. Propagates the dark mode
|
||||
+// preference to the web theme.
|
||||
+class DarkModeManagerLinux : public NativeThemeObserver {
|
||||
+ public:
|
||||
+ DarkModeManagerLinux();
|
||||
+ DarkModeManagerLinux(const DarkModeManagerLinux&) = delete;
|
||||
+ DarkModeManagerLinux& operator=(const DarkModeManagerLinux&) = delete;
|
||||
+ ~DarkModeManagerLinux() override;
|
||||
+
|
||||
+ private:
|
||||
+ // ui::NativeThemeObserver:
|
||||
+ void OnNativeThemeUpdated(ui::NativeTheme* observed_theme) override;
|
||||
+
|
||||
+ // D-Bus async handlers
|
||||
+ void OnSignalConnected(const std::string& interface_name,
|
||||
+ const std::string& signal_name,
|
||||
+ bool connected);
|
||||
+ void OnPortalSettingChanged(dbus::Signal* signal);
|
||||
+ void OnReadColorSchemeResponse(dbus::Response* response);
|
||||
+
|
||||
+ // Sets `prefer_dark_theme_` and propagates to the web theme.
|
||||
+ void SetColorScheme(bool prefer_dark_theme);
|
||||
+
|
||||
+ scoped_refptr<dbus::Bus> bus_;
|
||||
+ raw_ptr<dbus::ObjectProxy> settings_proxy_;
|
||||
+
|
||||
+ bool prefer_dark_theme_ = false;
|
||||
+
|
||||
+ base::ScopedObservation<NativeTheme, NativeThemeObserver>
|
||||
+ native_theme_observer_{this};
|
||||
+
|
||||
+ base::WeakPtrFactory<DarkModeManagerLinux> weak_ptr_factory_{this};
|
||||
+};
|
||||
+
|
||||
+} // namespace ui
|
||||
+
|
||||
+#endif // CHROME_BROWSER_UI_VIEWS_DARK_MODE_MANAGER_LINUX_H_
|
||||
diff --git a/chrome/common/chrome_features.cc b/chrome/common/chrome_features.cc
|
||||
index 91b1e98..7adddbd 100644
|
||||
--- a/chrome/common/chrome_features.cc
|
||||
+++ b/chrome/common/chrome_features.cc
|
||||
@@ -1448,17 +1448,17 @@
|
||||
BASE_FEATURE(kWebShare, "WebShare", base::FEATURE_DISABLED_BY_DEFAULT);
|
||||
#endif
|
||||
|
||||
-// Whether to enable "dark mode" enhancements in Mac Mojave or Windows 10 for
|
||||
-// UIs implemented with web technologies.
|
||||
+// Whether to enable "dark mode" enhancements in Mac Mojave, Windows 10, or
|
||||
+// Linux for UIs implemented with web technologies.
|
||||
BASE_FEATURE(kWebUIDarkMode,
|
||||
"WebUIDarkMode",
|
||||
#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_ANDROID) || \
|
||||
- BUILDFLAG(IS_CHROMEOS)
|
||||
+ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX)
|
||||
base::FEATURE_ENABLED_BY_DEFAULT
|
||||
#else
|
||||
base::FEATURE_DISABLED_BY_DEFAULT
|
||||
#endif // BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_ANDROID) ||
|
||||
- // BUILDFLAG(IS_CHROMEOS)
|
||||
+ // BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX)
|
||||
);
|
||||
|
||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
||||
diff --git a/ui/qt/qt_ui.cc b/ui/qt/qt_ui.cc
|
||||
index b188ad0..6c0d2cd 100644
|
||||
--- a/ui/qt/qt_ui.cc
|
||||
+++ b/ui/qt/qt_ui.cc
|
||||
@@ -98,6 +98,13 @@
|
||||
QtNativeTheme& operator=(const QtNativeTheme&) = delete;
|
||||
~QtNativeTheme() override = default;
|
||||
|
||||
+ void ThemeChanged(bool prefer_dark_theme) {
|
||||
+ set_use_dark_colors(IsForcedDarkMode() || prefer_dark_theme);
|
||||
+ set_preferred_color_scheme(CalculatePreferredColorScheme());
|
||||
+
|
||||
+ NotifyOnNativeThemeUpdated();
|
||||
+ }
|
||||
+
|
||||
// ui::NativeTheme:
|
||||
DISABLE_CFI_VCALL
|
||||
void PaintFrameTopArea(cc::PaintCanvas* canvas,
|
||||
@@ -387,7 +394,7 @@
|
||||
}
|
||||
|
||||
void QtUi::ThemeChanged() {
|
||||
- native_theme_->NotifyOnNativeThemeUpdated();
|
||||
+ native_theme_->ThemeChanged(PreferDarkTheme());
|
||||
}
|
||||
|
||||
DISABLE_CFI_VCALL
|
||||
diff --git a/chrome/browser/ui/BUILD.gn b/chrome/browser/ui/BUILD.gn
|
||||
index decfb02b6817e..108e2af907e25 100644
|
||||
--- a/chrome/browser/ui/BUILD.gn
|
||||
+++ b/chrome/browser/ui/BUILD.gn
|
||||
@@ -5632,20 +5632,24 @@ static_library("ui") {
|
||||
]
|
||||
}
|
||||
|
||||
- if (use_aura) {
|
||||
+ if (use_aura && (is_linux || is_chromeos_lacros)) {
|
||||
# These files can do Gtk+-based theming for builds with gtk enabled.
|
||||
- if (is_linux || is_chromeos_lacros) {
|
||||
+ sources += [
|
||||
+ "views/chrome_browser_main_extra_parts_views_linux.cc",
|
||||
+ "views/chrome_browser_main_extra_parts_views_linux.h",
|
||||
+ ]
|
||||
+ deps += [
|
||||
+ "//ui/base/cursor",
|
||||
+ "//ui/ozone",
|
||||
+ ]
|
||||
+ if (use_dbus) {
|
||||
sources += [
|
||||
- "views/chrome_browser_main_extra_parts_views_linux.cc",
|
||||
- "views/chrome_browser_main_extra_parts_views_linux.h",
|
||||
"views/dark_mode_manager_linux.cc",
|
||||
"views/dark_mode_manager_linux.h",
|
||||
]
|
||||
deps += [
|
||||
"//components/dbus/thread_linux",
|
||||
"//dbus",
|
||||
- "//ui/base/cursor",
|
||||
- "//ui/ozone",
|
||||
]
|
||||
}
|
||||
}
|
||||
diff --git a/chrome/browser/ui/views/chrome_browser_main_extra_parts_views_linux.cc b/chrome/browser/ui/views/chrome_browser_main_extra_parts_views_linux.cc
|
||||
index d7fad5b5b9007..23d0611fdb2b5 100644
|
||||
--- a/chrome/browser/ui/views/chrome_browser_main_extra_parts_views_linux.cc
|
||||
+++ b/chrome/browser/ui/views/chrome_browser_main_extra_parts_views_linux.cc
|
||||
@@ -7,7 +7,6 @@
|
||||
#include "base/metrics/histogram_macros.h"
|
||||
#include "chrome/browser/themes/theme_service_aura_linux.h"
|
||||
#include "chrome/browser/ui/browser_list.h"
|
||||
-#include "chrome/browser/ui/views/dark_mode_manager_linux.h"
|
||||
#include "chrome/browser/ui/views/theme_profile_key.h"
|
||||
#include "ui/base/buildflags.h"
|
||||
#include "ui/base/cursor/cursor_factory.h"
|
||||
@@ -19,6 +18,10 @@
|
||||
#include "ui/native_theme/native_theme.h"
|
||||
#include "ui/ozone/public/ozone_platform.h"
|
||||
|
||||
+#if defined(USE_DBUS)
|
||||
+#include "chrome/browser/ui/views/dark_mode_manager_linux.h"
|
||||
+#endif
|
||||
+
|
||||
namespace {
|
||||
|
||||
class LinuxUiGetterImpl : public ui::LinuxUiGetter {
|
||||
@@ -57,8 +60,9 @@ void ChromeBrowserMainExtraPartsViewsLinux::ToolkitInitialized() {
|
||||
UMA_HISTOGRAM_ENUMERATION("Linux.SystemTheme.Default",
|
||||
linux_ui_theme->GetNativeTheme()->system_theme());
|
||||
}
|
||||
-
|
||||
+#if defined(USE_DBUS)
|
||||
dark_mode_manager_ = std::make_unique<ui::DarkModeManagerLinux>();
|
||||
+#endif
|
||||
}
|
||||
|
||||
void ChromeBrowserMainExtraPartsViewsLinux::PreCreateThreads() {
|
||||
diff --git a/chrome/browser/ui/views/chrome_browser_main_extra_parts_views_linux.h b/chrome/browser/ui/views/chrome_browser_main_extra_parts_views_linux.h
|
||||
index 6deb5205d198a..bc9167bda1fc3 100644
|
||||
--- a/chrome/browser/ui/views/chrome_browser_main_extra_parts_views_linux.h
|
||||
+++ b/chrome/browser/ui/views/chrome_browser_main_extra_parts_views_linux.h
|
||||
@@ -13,7 +13,9 @@
|
||||
|
||||
namespace ui {
|
||||
class LinuxUiGetter;
|
||||
+#if defined(USE_DBUS)
|
||||
class DarkModeManagerLinux;
|
||||
+#endif
|
||||
}
|
||||
|
||||
// Extra parts, which are used by both Ozone/X11/Wayland and inherited by the
|
||||
@@ -42,8 +44,9 @@ class ChromeBrowserMainExtraPartsViewsLinux
|
||||
absl::optional<display::ScopedDisplayObserver> display_observer_;
|
||||
|
||||
std::unique_ptr<ui::LinuxUiGetter> linux_ui_getter_;
|
||||
-
|
||||
+#if defined(USE_DBUS)
|
||||
std::unique_ptr<ui::DarkModeManagerLinux> dark_mode_manager_;
|
||||
+#endif
|
||||
};
|
||||
|
||||
#endif // CHROME_BROWSER_UI_VIEWS_CHROME_BROWSER_MAIN_EXTRA_PARTS_VIEWS_LINUX_H_
|
@ -1,115 +0,0 @@
|
||||
diff -up chromium-113.0.5672.24/chrome/common/safe_browsing/BUILD.gn.nounrar chromium-113.0.5672.24/chrome/common/safe_browsing/BUILD.gn
|
||||
--- chromium-113.0.5672.24/chrome/common/safe_browsing/BUILD.gn.nounrar 2023-04-07 13:11:59.495927476 +0200
|
||||
+++ chromium-113.0.5672.24/chrome/common/safe_browsing/BUILD.gn 2023-04-07 13:47:57.004758029 +0200
|
||||
@@ -143,8 +143,6 @@ source_set("safe_browsing") {
|
||||
"protobuf_message_log_macros.h",
|
||||
"protobuf_message_read_macros.h",
|
||||
"protobuf_message_write_macros.h",
|
||||
- "rar_analyzer.cc",
|
||||
- "rar_analyzer.h",
|
||||
"seven_zip_analyzer.cc",
|
||||
"seven_zip_analyzer.h",
|
||||
"zip_analyzer.cc",
|
||||
@@ -160,7 +158,6 @@ source_set("safe_browsing") {
|
||||
"//components/safe_browsing/content/common:file_type_policies",
|
||||
"//components/safe_browsing/core/common",
|
||||
"//third_party/lzma_sdk/google:seven_zip_reader",
|
||||
- "//third_party/unrar:unrar",
|
||||
]
|
||||
|
||||
if (is_linux) {
|
||||
diff -up chromium-113.0.5672.24/chrome/common/safe_browsing/DEPS.nounrar chromium-113.0.5672.24/chrome/common/safe_browsing/DEPS
|
||||
--- chromium-113.0.5672.24/chrome/common/safe_browsing/DEPS.nounrar 2023-04-04 20:41:26.000000000 +0200
|
||||
+++ chromium-113.0.5672.24/chrome/common/safe_browsing/DEPS 2023-04-07 13:11:59.495927476 +0200
|
||||
@@ -3,7 +3,6 @@ include_rules = [
|
||||
"+components/safe_browsing/core/common",
|
||||
"+third_party/maldoca",
|
||||
"+third_party/protobuf",
|
||||
- "+third_party/unrar",
|
||||
"+third_party/zlib",
|
||||
"+third_party/lzma_sdk/google",
|
||||
]
|
||||
diff -up chromium-113.0.5672.24/chrome/services/file_util/BUILD.gn.nounrar chromium-113.0.5672.24/chrome/services/file_util/BUILD.gn
|
||||
diff -up chromium-113.0.5672.24/chrome/services/file_util/safe_archive_analyzer.cc.nounrar chromium-113.0.5672.24/chrome/services/file_util/safe_archive_analyzer.cc
|
||||
--- chromium-113.0.5672.24/chrome/services/file_util/safe_archive_analyzer.cc.nounrar 2023-04-07 13:11:59.495927476 +0200
|
||||
+++ chromium-113.0.5672.24/chrome/services/file_util/safe_archive_analyzer.cc 2023-04-07 13:52:52.998109006 +0200
|
||||
@@ -61,6 +61,7 @@ void SafeArchiveAnalyzer::AnalyzeRarFile
|
||||
base::File rar_file,
|
||||
mojo::PendingRemote<chrome::mojom::TemporaryFileGetter> temp_file_getter,
|
||||
AnalyzeRarFileCallback callback) {
|
||||
+#if 0
|
||||
DCHECK(rar_file.IsValid());
|
||||
temp_file_getter_.Bind(std::move(temp_file_getter));
|
||||
callback_ = std::move(callback);
|
||||
@@ -76,6 +77,9 @@ void SafeArchiveAnalyzer::AnalyzeRarFile
|
||||
rar_analyzer_.Init(std::move(rar_file), base::FilePath(),
|
||||
std::move(analysis_finished_callback),
|
||||
std::move(temp_file_getter_callback), &results_);
|
||||
+#else
|
||||
+ NOTREACHED();
|
||||
+#endif
|
||||
}
|
||||
|
||||
void SafeArchiveAnalyzer::AnalyzeSevenZipFile(
|
||||
diff -up chromium-113.0.5672.53/chrome/common/safe_browsing/zip_analyzer.cc.me chromium-113.0.5672.53/chrome/common/safe_browsing/zip_analyzer.cc
|
||||
--- chromium-113.0.5672.53/chrome/common/safe_browsing/zip_analyzer.cc.me 2023-04-23 18:10:06.103858362 +0200
|
||||
+++ chromium-113.0.5672.53/chrome/common/safe_browsing/zip_analyzer.cc 2023-04-23 18:12:05.428092347 +0200
|
||||
@@ -18,7 +18,7 @@
|
||||
#include "base/time/time.h"
|
||||
#include "build/build_config.h"
|
||||
#include "chrome/common/safe_browsing/archive_analyzer_results.h"
|
||||
-#include "chrome/common/safe_browsing/rar_analyzer.h"
|
||||
+//#include "chrome/common/safe_browsing/rar_analyzer.h"
|
||||
#include "components/safe_browsing/content/common/file_type_policies.h"
|
||||
#include "components/safe_browsing/core/common/features.h"
|
||||
#include "components/safe_browsing/core/common/proto/csd.pb.h"
|
||||
@@ -132,14 +132,14 @@ bool ZipAnalyzer::AnalyzeNestedArchive(
|
||||
std::move(nested_analysis_finished_callback),
|
||||
get_temp_file_callback_, results_);
|
||||
return true;
|
||||
- } else if (file_type == DownloadFileType::RAR) {
|
||||
+ } /* else if (file_type == DownloadFileType::RAR) {
|
||||
nested_rar_analyzer_ = std::make_unique<safe_browsing::RarAnalyzer>();
|
||||
nested_rar_analyzer_->Init(temp_file_.Duplicate(),
|
||||
root_zip_path_.Append(path),
|
||||
std::move(nested_analysis_finished_callback),
|
||||
get_temp_file_callback_, results_);
|
||||
return true;
|
||||
- }
|
||||
+ }*/
|
||||
return false;
|
||||
}
|
||||
|
||||
diff -up chromium-113.0.5672.53/chrome/common/safe_browsing/zip_analyzer.h.me chromium-113.0.5672.53/chrome/common/safe_browsing/zip_analyzer.h
|
||||
--- chromium-113.0.5672.53/chrome/common/safe_browsing/zip_analyzer.h.me 2023-04-23 18:12:11.316203496 +0200
|
||||
+++ chromium-113.0.5672.53/chrome/common/safe_browsing/zip_analyzer.h 2023-04-23 18:12:26.827498082 +0200
|
||||
@@ -78,7 +78,7 @@ class ZipAnalyzer {
|
||||
// DFS.
|
||||
// TODO(crbug.com/1426164) Create a common class to hold all analyzers.
|
||||
std::unique_ptr<safe_browsing::ZipAnalyzer> nested_zip_analyzer_;
|
||||
- std::unique_ptr<safe_browsing::RarAnalyzer> nested_rar_analyzer_;
|
||||
+// std::unique_ptr<safe_browsing::RarAnalyzer> nested_rar_analyzer_;
|
||||
|
||||
base::WeakPtrFactory<ZipAnalyzer> weak_factory_{this};
|
||||
};
|
||||
diff -up chromium-113.0.5672.53/chrome/services/file_util/safe_archive_analyzer.h.me chromium-113.0.5672.53/chrome/services/file_util/safe_archive_analyzer.h
|
||||
--- chromium-113.0.5672.53/chrome/services/file_util/safe_archive_analyzer.h.me 2023-04-23 18:06:26.476791520 +0200
|
||||
+++ chromium-113.0.5672.53/chrome/services/file_util/safe_archive_analyzer.h 2023-04-23 18:08:58.594606171 +0200
|
||||
@@ -6,7 +6,7 @@
|
||||
#define CHROME_SERVICES_FILE_UTIL_SAFE_ARCHIVE_ANALYZER_H_
|
||||
|
||||
#include "chrome/common/safe_browsing/archive_analyzer_results.h"
|
||||
-#include "chrome/common/safe_browsing/rar_analyzer.h"
|
||||
+//#include "chrome/common/safe_browsing/rar_analyzer.h"
|
||||
#include "chrome/services/file_util/public/mojom/safe_archive_analyzer.mojom.h"
|
||||
#include "mojo/public/cpp/bindings/remote.h"
|
||||
|
||||
@@ -59,7 +59,7 @@ class SafeArchiveAnalyzer : public chrom
|
||||
void Timeout();
|
||||
|
||||
safe_browsing::ZipAnalyzer zip_analyzer_;
|
||||
- safe_browsing::RarAnalyzer rar_analyzer_;
|
||||
+// safe_browsing::RarAnalyzer rar_analyzer_;
|
||||
|
||||
// A timer to ensure no archive takes too long to unpack.
|
||||
base::OneShotTimer timeout_timer_;
|
@ -1,30 +0,0 @@
|
||||
diff -up chromium-113.0.5672.63/third_party/blink/renderer/core/layout/ng/grid/ng_grid_layout_algorithm.cc.me chromium-113.0.5672.63/third_party/blink/renderer/core/layout/ng/grid/ng_grid_layout_algorithm.cc
|
||||
--- chromium-113.0.5672.63/third_party/blink/renderer/core/layout/ng/grid/ng_grid_layout_algorithm.cc.me 2023-05-03 16:30:34.244612573 +0200
|
||||
+++ chromium-113.0.5672.63/third_party/blink/renderer/core/layout/ng/grid/ng_grid_layout_algorithm.cc 2023-05-03 16:37:36.732278590 +0200
|
||||
@@ -516,8 +516,11 @@ wtf_size_t NGGridLayoutAlgorithm::BuildG
|
||||
row_auto_repetitions);
|
||||
|
||||
bool has_nested_subgrid = false;
|
||||
- auto& [grid_items, layout_data, subtree_size] =
|
||||
- sizing_tree->CreateSizingData();
|
||||
+
|
||||
+ auto& workaround_clang_bug = sizing_tree->CreateSizingData();
|
||||
+ auto& grid_items = workaround_clang_bug.grid_items;
|
||||
+ auto& layout_data = workaround_clang_bug.layout_data;
|
||||
+ auto& subtree_size = workaround_clang_bug.subtree_size;
|
||||
|
||||
if (!must_ignore_children) {
|
||||
// Construct grid items that are not subgridded.
|
||||
@@ -1540,8 +1543,10 @@ void NGGridLayoutAlgorithm::InitializeTr
|
||||
NGGridSizingTree* sizing_tree) const {
|
||||
DCHECK(sizing_tree && current_grid_index < sizing_tree->Size());
|
||||
|
||||
- auto& [grid_items, layout_data, subtree_size] =
|
||||
- sizing_tree->At(current_grid_index);
|
||||
+ auto& workaround_clang_bug = sizing_tree->At(current_grid_index);
|
||||
+ auto& grid_items = workaround_clang_bug.grid_items;
|
||||
+ auto& layout_data = workaround_clang_bug.layout_data;
|
||||
+ auto& subtree_size = workaround_clang_bug.subtree_size;
|
||||
|
||||
auto InitAndCacheTrackSizes = [&](GridTrackSizingDirection track_direction) {
|
||||
InitializeTrackCollection(opt_subgrid_data, track_direction, &layout_data);
|
@ -0,0 +1,545 @@
|
||||
commit 75f4b48eb71d4872ba3ac6c9fc3662a60eb4175d
|
||||
Author: Tom Anderson <thomasanderson@chromium.org>
|
||||
Date: Thu Apr 27 02:21:34 2023 +0000
|
||||
|
||||
Add QT6 LinuxUi backend
|
||||
|
||||
- Enable QT6 by default on KDE6
|
||||
- If QT6 load fails, fallback to QT5 (and vice versa)
|
||||
- Add use_qt6 build flag for packager control
|
||||
- Add --qt-version runtime flag for user control
|
||||
|
||||
R=thestig
|
||||
|
||||
Change-Id: Ib1d9f6183663ecf7b9ddfe9d7f3e3442e534ccda
|
||||
Fixed: 1434754
|
||||
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4475369
|
||||
Commit-Queue: Thomas Anderson <thomasanderson@chromium.org>
|
||||
Reviewed-by: Lei Zhang <thestig@chromium.org>
|
||||
Cr-Commit-Position: refs/heads/main@{#1136295}
|
||||
|
||||
diff --git a/chrome/installer/linux/BUILD.gn b/chrome/installer/linux/BUILD.gn
|
||||
index 5639b9ffc996e..3bacd3398d4a2 100644
|
||||
--- a/chrome/installer/linux/BUILD.gn
|
||||
+++ b/chrome/installer/linux/BUILD.gn
|
||||
@@ -109,6 +109,9 @@ if (use_qt) {
|
||||
# to prevent a hard dependency on QT for the package.
|
||||
packaging_files += [ "$root_out_dir/libqt5_shim.so" ]
|
||||
}
|
||||
+if (use_qt6) {
|
||||
+ packaging_files += [ "$root_out_dir/libqt6_shim.so" ]
|
||||
+}
|
||||
|
||||
action_foreach("calculate_deb_dependencies") {
|
||||
deps = [ ":installer_deps" ]
|
||||
@@ -249,6 +252,12 @@ if (use_qt) {
|
||||
deps = [ "//ui/qt:qt5_shim" ]
|
||||
}
|
||||
}
|
||||
+if (use_qt6) {
|
||||
+ strip_binary("strip_qt6_shim") {
|
||||
+ binary_input = "$root_out_dir/libqt6_shim.so"
|
||||
+ deps = [ "//ui/qt:qt6_shim" ]
|
||||
+ }
|
||||
+}
|
||||
|
||||
# This target builds all "normal" Linux installers. You must set
|
||||
# is_component_build=false before building this target.
|
||||
@@ -447,6 +456,12 @@ group("installer_deps") {
|
||||
"//ui/qt:qt5_shim",
|
||||
]
|
||||
}
|
||||
+ if (use_qt6) {
|
||||
+ public_deps += [
|
||||
+ ":strip_qt6_shim",
|
||||
+ "//ui/qt:qt6_shim",
|
||||
+ ]
|
||||
+ }
|
||||
}
|
||||
|
||||
# Creates .deb and .rpm (RPM for non-ChromeOS only) installer packages.
|
||||
diff --git a/chrome/installer/linux/common/installer.include b/chrome/installer/linux/common/installer.include
|
||||
index 8d76f1f280b01..439ef5ccb0f52 100644
|
||||
--- a/chrome/installer/linux/common/installer.include
|
||||
+++ b/chrome/installer/linux/common/installer.include
|
||||
@@ -254,6 +254,11 @@ stage_install_common() {
|
||||
strippedfile="${OUTPUTDIR}/${file}.stripped"
|
||||
install -m ${SHLIB_PERMS} "${strippedfile}" "${STAGEDIR}/${INSTALLDIR}/${file}"
|
||||
fi
|
||||
+ if [ -f "${OUTPUTDIR}/libqt6_shim.so" ]; then
|
||||
+ file="libqt6_shim.so"
|
||||
+ strippedfile="${OUTPUTDIR}/${file}.stripped"
|
||||
+ install -m ${SHLIB_PERMS} "${strippedfile}" "${STAGEDIR}/${INSTALLDIR}/${file}"
|
||||
+ fi
|
||||
|
||||
# libc++
|
||||
if [ -f "${OUTPUTDIR}/lib/libc++.so" ]; then
|
||||
diff --git a/ui/qt/BUILD.gn b/ui/qt/BUILD.gn
|
||||
index bbede00daa4d0..6a67961edc2f7 100644
|
||||
--- a/ui/qt/BUILD.gn
|
||||
+++ b/ui/qt/BUILD.gn
|
||||
@@ -11,13 +11,6 @@ assert(use_qt)
|
||||
assert(is_linux)
|
||||
assert(!is_castos)
|
||||
|
||||
-pkg_config("qt5_config") {
|
||||
- packages = [
|
||||
- "Qt5Core",
|
||||
- "Qt5Widgets",
|
||||
- ]
|
||||
-}
|
||||
-
|
||||
config("qt_internal_config") {
|
||||
if (is_clang) {
|
||||
# libstdc++ headers are incompatible with -fcomplete-member-pointers.
|
||||
@@ -56,40 +49,57 @@ if (!use_sysroot) {
|
||||
}
|
||||
}
|
||||
|
||||
-shared_library("qt5_shim") {
|
||||
- visibility = [
|
||||
- ":qt",
|
||||
- "//chrome/installer/linux:*",
|
||||
- ]
|
||||
-
|
||||
- # Since qt_shim is a shared library even in non-component builds, it shouldn't
|
||||
- # depend on any other targets since that would duplicate code between binaries
|
||||
- # leading to increased size and potential issues from duplicated global state.
|
||||
- no_default_deps = true
|
||||
- assert_no_deps = [
|
||||
- "//base",
|
||||
- "//buildtools/third_party/libc++",
|
||||
- ]
|
||||
- deps = [ ":qt_interface" ]
|
||||
-
|
||||
- configs -= [ "//build/config/compiler:runtime_library" ]
|
||||
- configs += [
|
||||
- ":qt_internal_config",
|
||||
- ":qt5_config",
|
||||
- ]
|
||||
+template("qt_shim") {
|
||||
+ pkg_config("qt" + invoker.qt_version + "_config") {
|
||||
+ packages = [
|
||||
+ "Qt" + invoker.qt_version + "Core",
|
||||
+ "Qt" + invoker.qt_version + "Widgets",
|
||||
+ ]
|
||||
+ }
|
||||
|
||||
- public = []
|
||||
- sources = [
|
||||
- "qt_shim.cc",
|
||||
- "qt_shim.h",
|
||||
- ]
|
||||
- if (use_sysroot) {
|
||||
- # This file is generated with gen_qt_shim_moc.sh on an amd64 system to
|
||||
- # avoid a build-time dependency on `moc` when using the sysroot.
|
||||
- sources += [ "qt_shim_moc.cc" ]
|
||||
- } else {
|
||||
- sources += get_target_outputs(":generate_moc")
|
||||
- deps += [ ":generate_moc" ]
|
||||
+ shared_library(target_name) {
|
||||
+ visibility = [
|
||||
+ ":qt",
|
||||
+ "//chrome/installer/linux:*",
|
||||
+ ]
|
||||
+
|
||||
+ # Since qt_shim is a shared library even in non-component builds, it shouldn't
|
||||
+ # depend on any other targets since that would duplicate code between binaries
|
||||
+ # leading to increased size and potential issues from duplicated global state.
|
||||
+ no_default_deps = true
|
||||
+ assert_no_deps = [
|
||||
+ "//base",
|
||||
+ "//buildtools/third_party/libc++",
|
||||
+ ]
|
||||
+ deps = [ ":qt_interface" ]
|
||||
+
|
||||
+ configs -= [ "//build/config/compiler:runtime_library" ]
|
||||
+ configs += [
|
||||
+ ":qt_internal_config",
|
||||
+ ":qt" + invoker.qt_version + "_config",
|
||||
+ ]
|
||||
+
|
||||
+ public = []
|
||||
+ sources = [
|
||||
+ "qt_shim.cc",
|
||||
+ "qt_shim.h",
|
||||
+ ]
|
||||
+ if (use_sysroot) {
|
||||
+ # This file is generated with gen_qt_shim_moc.sh on an amd64 system to
|
||||
+ # avoid a build-time dependency on `moc` when using the sysroot.
|
||||
+ sources += [ "qt" + invoker.qt_version + "_shim_moc.cc" ]
|
||||
+ } else {
|
||||
+ sources += get_target_outputs(":generate_moc")
|
||||
+ deps += [ ":generate_moc" ]
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+qt_shim("qt5_shim") {
|
||||
+ qt_version = "5"
|
||||
+}
|
||||
+if (use_qt6) {
|
||||
+ qt_shim("qt6_shim") {
|
||||
+ qt_version = "6"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,6 +110,9 @@ component("qt") {
|
||||
|
||||
# qt_shim is in data_deps since we want to load it manually.
|
||||
data_deps = [ ":qt5_shim" ]
|
||||
+ if (use_qt6) {
|
||||
+ data_deps += [ ":qt6_shim" ]
|
||||
+ }
|
||||
deps = [
|
||||
":qt_interface",
|
||||
"//base",
|
||||
diff --git a/ui/qt/gen_qt_shim_moc.sh b/ui/qt/gen_qt_shim_moc.sh
|
||||
index 74272d5611dab..9d02c2dfcb12f 100755
|
||||
--- a/ui/qt/gen_qt_shim_moc.sh
|
||||
+++ b/ui/qt/gen_qt_shim_moc.sh
|
||||
@@ -6,11 +6,15 @@
|
||||
set -o nounset
|
||||
set -o errexit
|
||||
|
||||
-URL="http://archive.debian.org/debian/pool/main/q/qtbase-opensource-src"
|
||||
-PACKAGE="qtbase5-dev-tools_5.3.2+dfsg-4+deb8u2_amd64.deb"
|
||||
-SHA256="7703754f2c230ce6b8b6030b6c1e7e030899aa9f45a415498df04bd5ec061a76"
|
||||
-SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
+URL5="http://archive.debian.org/debian/pool/main/q/qtbase-opensource-src"
|
||||
+PACKAGE5="qtbase5-dev-tools_5.3.2+dfsg-4+deb8u2_amd64.deb"
|
||||
+SHA256_5="7703754f2c230ce6b8b6030b6c1e7e030899aa9f45a415498df04bd5ec061a76"
|
||||
+
|
||||
+URL6="http://archive.ubuntu.com/ubuntu/pool/universe/q/qt6-base"
|
||||
+PACKAGE6="qt6-base-dev-tools_6.2.4+dfsg-2ubuntu1_amd64.deb"
|
||||
+SHA256_6="8dddfc79e7743185b07c478ca0f96a4ccc13d48ecccc42f44d2578c33c7d9b8b"
|
||||
|
||||
+SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
TMP_DIR=$(mktemp -d -p "$SCRIPT_DIR")
|
||||
function cleanup {
|
||||
rm -rf "$TMP_DIR"
|
||||
@@ -18,16 +22,22 @@ function cleanup {
|
||||
trap cleanup EXIT
|
||||
|
||||
cd "$TMP_DIR"
|
||||
-wget "$URL/$PACKAGE"
|
||||
-echo "$SHA256 $PACKAGE" | shasum -a 256 -c
|
||||
-dpkg -x "$PACKAGE" .
|
||||
-cat > ../qt_shim_moc.cc <<EOF
|
||||
-// Copyright 2022 The Chromium Authors
|
||||
+wget "$URL5/$PACKAGE5"
|
||||
+echo "$SHA256_5 $PACKAGE5" | shasum -a 256 -c
|
||||
+dpkg -x "$PACKAGE5" .
|
||||
+wget "$URL6/$PACKAGE6"
|
||||
+echo "$SHA256_6 $PACKAGE6" | shasum -a 256 -c
|
||||
+dpkg -x "$PACKAGE6" .
|
||||
+cat > ../qt5_shim_moc.cc <<EOF
|
||||
+// Copyright 2023 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
EOF
|
||||
cd "$SCRIPT_DIR/../.."
|
||||
+cp ui/qt/qt5_shim_moc.cc ui/qt/qt6_shim_moc.cc
|
||||
"$TMP_DIR/usr/lib/x86_64-linux-gnu/qt5/bin/moc" ui/qt/qt_shim.h \
|
||||
- >> ui/qt/qt_shim_moc.cc
|
||||
-git cl format ui/qt/qt_shim_moc.cc
|
||||
+ >> ui/qt/qt5_shim_moc.cc
|
||||
+"$TMP_DIR//usr/lib/qt6/libexec/moc" ui/qt/qt_shim.h \
|
||||
+ >> ui/qt/qt6_shim_moc.cc
|
||||
+git cl format ui/qt/qt5_shim_moc.cc ui/qt/qt6_shim_moc.cc
|
||||
diff --git a/ui/qt/qt.gni b/ui/qt/qt.gni
|
||||
index 27bb6375880b7..f45823270cb91 100644
|
||||
--- a/ui/qt/qt.gni
|
||||
+++ b/ui/qt/qt.gni
|
||||
@@ -4,9 +4,17 @@
|
||||
|
||||
import("//build/config/chromecast_build.gni")
|
||||
import("//build/config/sanitizers/sanitizers.gni")
|
||||
+import("//build/config/sysroot.gni")
|
||||
|
||||
declare_args() {
|
||||
# TODO(https://crbug.com/1424435): Allow QT in MSAN builds once QT is
|
||||
# added to the instrumented libraries.
|
||||
use_qt = is_linux && !is_castos && !is_msan
|
||||
}
|
||||
+
|
||||
+declare_args() {
|
||||
+ use_qt6 = use_qt && use_sysroot
|
||||
+}
|
||||
+
|
||||
+# use_qt6 => use_qt
|
||||
+assert(!use_qt6 || use_qt)
|
||||
diff --git a/ui/qt/qt_shim_moc.cc b/ui/qt/qt5_shim_moc.cc
|
||||
similarity index 95%
|
||||
rename from ui/qt/qt_shim_moc.cc
|
||||
rename to ui/qt/qt5_shim_moc.cc
|
||||
index dafbfadce56ba..8f8b6b57784a8 100644
|
||||
--- a/ui/qt/qt_shim_moc.cc
|
||||
+++ b/ui/qt/qt5_shim_moc.cc
|
||||
@@ -1,4 +1,4 @@
|
||||
-// Copyright 2022 The Chromium Authors
|
||||
+// Copyright 2023 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
@@ -89,26 +89,32 @@ const QMetaObject* qt::QtShim::metaObject() const {
|
||||
}
|
||||
|
||||
void* qt::QtShim::qt_metacast(const char* _clname) {
|
||||
- if (!_clname)
|
||||
+ if (!_clname) {
|
||||
return 0;
|
||||
- if (!strcmp(_clname, qt_meta_stringdata_qt__QtShim.stringdata))
|
||||
+ }
|
||||
+ if (!strcmp(_clname, qt_meta_stringdata_qt__QtShim.stringdata)) {
|
||||
return static_cast<void*>(const_cast<QtShim*>(this));
|
||||
- if (!strcmp(_clname, "QtInterface"))
|
||||
+ }
|
||||
+ if (!strcmp(_clname, "QtInterface")) {
|
||||
return static_cast<QtInterface*>(const_cast<QtShim*>(this));
|
||||
+ }
|
||||
return QObject::qt_metacast(_clname);
|
||||
}
|
||||
|
||||
int qt::QtShim::qt_metacall(QMetaObject::Call _c, int _id, void** _a) {
|
||||
_id = QObject::qt_metacall(_c, _id, _a);
|
||||
- if (_id < 0)
|
||||
+ if (_id < 0) {
|
||||
return _id;
|
||||
+ }
|
||||
if (_c == QMetaObject::InvokeMetaMethod) {
|
||||
- if (_id < 2)
|
||||
+ if (_id < 2) {
|
||||
qt_static_metacall(this, _c, _id, _a);
|
||||
+ }
|
||||
_id -= 2;
|
||||
} else if (_c == QMetaObject::RegisterMethodArgumentMetaType) {
|
||||
- if (_id < 2)
|
||||
+ if (_id < 2) {
|
||||
*reinterpret_cast<int*>(_a[0]) = -1;
|
||||
+ }
|
||||
_id -= 2;
|
||||
}
|
||||
return _id;
|
||||
diff --git a/ui/qt/qt6_shim_moc.cc b/ui/qt/qt6_shim_moc.cc
|
||||
new file mode 100644
|
||||
index 0000000000000..6d02ca317b65d
|
||||
--- /dev/null
|
||||
+++ b/ui/qt/qt6_shim_moc.cc
|
||||
@@ -0,0 +1,143 @@
|
||||
+// Copyright 2023 The Chromium Authors
|
||||
+// Use of this source code is governed by a BSD-style license that can be
|
||||
+// found in the LICENSE file.
|
||||
+
|
||||
+/****************************************************************************
|
||||
+** Meta object code from reading C++ file 'qt_shim.h'
|
||||
+**
|
||||
+** Created by: The Qt Meta Object Compiler version 68 (Qt 6.2.4)
|
||||
+**
|
||||
+** WARNING! All changes made in this file will be lost!
|
||||
+*****************************************************************************/
|
||||
+
|
||||
+#include <QtCore/qbytearray.h>
|
||||
+#include <QtCore/qmetatype.h>
|
||||
+#include <memory>
|
||||
+#include "ui/qt/qt_shim.h"
|
||||
+#if !defined(Q_MOC_OUTPUT_REVISION)
|
||||
+#error "The header file 'qt_shim.h' doesn't include <QObject>."
|
||||
+#elif Q_MOC_OUTPUT_REVISION != 68
|
||||
+#error "This file was generated using the moc from 6.2.4. It"
|
||||
+#error "cannot be used with the include files from this version of Qt."
|
||||
+#error "(The moc has changed too much.)"
|
||||
+#endif
|
||||
+
|
||||
+QT_BEGIN_MOC_NAMESPACE
|
||||
+QT_WARNING_PUSH
|
||||
+QT_WARNING_DISABLE_DEPRECATED
|
||||
+struct qt_meta_stringdata_qt__QtShim_t {
|
||||
+ const uint offsetsAndSize[12];
|
||||
+ char stringdata0[52];
|
||||
+};
|
||||
+#define QT_MOC_LITERAL(ofs, len) \
|
||||
+ uint(offsetof(qt_meta_stringdata_qt__QtShim_t, stringdata0) + ofs), len
|
||||
+static const qt_meta_stringdata_qt__QtShim_t qt_meta_stringdata_qt__QtShim = {
|
||||
+ {
|
||||
+ QT_MOC_LITERAL(0, 10), // "qt::QtShim"
|
||||
+ QT_MOC_LITERAL(11, 11), // "FontChanged"
|
||||
+ QT_MOC_LITERAL(23, 0), // ""
|
||||
+ QT_MOC_LITERAL(24, 4), // "font"
|
||||
+ QT_MOC_LITERAL(29, 14), // "PaletteChanged"
|
||||
+ QT_MOC_LITERAL(44, 7) // "palette"
|
||||
+
|
||||
+ },
|
||||
+ "qt::QtShim\0FontChanged\0\0font\0"
|
||||
+ "PaletteChanged\0palette"};
|
||||
+#undef QT_MOC_LITERAL
|
||||
+
|
||||
+static const uint qt_meta_data_qt__QtShim[] = {
|
||||
+
|
||||
+ // content:
|
||||
+ 10, // revision
|
||||
+ 0, // classname
|
||||
+ 0, 0, // classinfo
|
||||
+ 2, 14, // methods
|
||||
+ 0, 0, // properties
|
||||
+ 0, 0, // enums/sets
|
||||
+ 0, 0, // constructors
|
||||
+ 0, // flags
|
||||
+ 0, // signalCount
|
||||
+
|
||||
+ // slots: name, argc, parameters, tag, flags, initial metatype offsets
|
||||
+ 1, 1, 26, 2, 0x08, 1 /* Private */, 4, 1, 29, 2, 0x08, 3 /* Private */,
|
||||
+
|
||||
+ // slots: parameters
|
||||
+ QMetaType::Void, QMetaType::QFont, 3, QMetaType::Void, QMetaType::QPalette,
|
||||
+ 5,
|
||||
+
|
||||
+ 0 // eod
|
||||
+};
|
||||
+
|
||||
+void qt::QtShim::qt_static_metacall(QObject* _o,
|
||||
+ QMetaObject::Call _c,
|
||||
+ int _id,
|
||||
+ void** _a) {
|
||||
+ if (_c == QMetaObject::InvokeMetaMethod) {
|
||||
+ auto* _t = static_cast<QtShim*>(_o);
|
||||
+ (void)_t;
|
||||
+ switch (_id) {
|
||||
+ case 0:
|
||||
+ _t->FontChanged((*reinterpret_cast<std::add_pointer_t<QFont>>(_a[1])));
|
||||
+ break;
|
||||
+ case 1:
|
||||
+ _t->PaletteChanged(
|
||||
+ (*reinterpret_cast<std::add_pointer_t<QPalette>>(_a[1])));
|
||||
+ break;
|
||||
+ default:;
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+const QMetaObject qt::QtShim::staticMetaObject = {
|
||||
+ {QMetaObject::SuperData::link<QObject::staticMetaObject>(),
|
||||
+ qt_meta_stringdata_qt__QtShim.offsetsAndSize, qt_meta_data_qt__QtShim,
|
||||
+ qt_static_metacall, nullptr,
|
||||
+ qt_incomplete_metaTypeArray<
|
||||
+ qt_meta_stringdata_qt__QtShim_t,
|
||||
+ QtPrivate::TypeAndForceComplete<QtShim, std::true_type>,
|
||||
+ QtPrivate::TypeAndForceComplete<void, std::false_type>,
|
||||
+ QtPrivate::TypeAndForceComplete<const QFont&, std::false_type>,
|
||||
+ QtPrivate::TypeAndForceComplete<void, std::false_type>,
|
||||
+ QtPrivate::TypeAndForceComplete<const QPalette&, std::false_type>
|
||||
+
|
||||
+ >,
|
||||
+ nullptr}};
|
||||
+
|
||||
+const QMetaObject* qt::QtShim::metaObject() const {
|
||||
+ return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject()
|
||||
+ : &staticMetaObject;
|
||||
+}
|
||||
+
|
||||
+void* qt::QtShim::qt_metacast(const char* _clname) {
|
||||
+ if (!_clname) {
|
||||
+ return nullptr;
|
||||
+ }
|
||||
+ if (!strcmp(_clname, qt_meta_stringdata_qt__QtShim.stringdata0)) {
|
||||
+ return static_cast<void*>(this);
|
||||
+ }
|
||||
+ if (!strcmp(_clname, "QtInterface")) {
|
||||
+ return static_cast<QtInterface*>(this);
|
||||
+ }
|
||||
+ return QObject::qt_metacast(_clname);
|
||||
+}
|
||||
+
|
||||
+int qt::QtShim::qt_metacall(QMetaObject::Call _c, int _id, void** _a) {
|
||||
+ _id = QObject::qt_metacall(_c, _id, _a);
|
||||
+ if (_id < 0) {
|
||||
+ return _id;
|
||||
+ }
|
||||
+ if (_c == QMetaObject::InvokeMetaMethod) {
|
||||
+ if (_id < 2) {
|
||||
+ qt_static_metacall(this, _c, _id, _a);
|
||||
+ }
|
||||
+ _id -= 2;
|
||||
+ } else if (_c == QMetaObject::RegisterMethodArgumentMetaType) {
|
||||
+ if (_id < 2) {
|
||||
+ *reinterpret_cast<QMetaType*>(_a[0]) = QMetaType();
|
||||
+ }
|
||||
+ _id -= 2;
|
||||
+ }
|
||||
+ return _id;
|
||||
+}
|
||||
+QT_WARNING_POP
|
||||
+QT_END_MOC_NAMESPACE
|
||||
diff --git a/ui/qt/qt_ui.cc b/ui/qt/qt_ui.cc
|
||||
index d4052b7e8bc3d..6a3b58e9f930b 100644
|
||||
--- a/ui/qt/qt_ui.cc
|
||||
+++ b/ui/qt/qt_ui.cc
|
||||
@@ -14,7 +14,9 @@
|
||||
#include "base/check.h"
|
||||
#include "base/command_line.h"
|
||||
#include "base/compiler_specific.h"
|
||||
+#include "base/environment.h"
|
||||
#include "base/memory/raw_ptr.h"
|
||||
+#include "base/nix/xdg_util.h"
|
||||
#include "base/notreached.h"
|
||||
#include "base/path_service.h"
|
||||
#include "base/time/time.h"
|
||||
@@ -47,6 +49,45 @@ namespace qt {
|
||||
|
||||
namespace {
|
||||
|
||||
+const char kQtVersionFlag[] = "qt-version";
|
||||
+
|
||||
+void* LoadLibrary(const base::FilePath& path) {
|
||||
+ return dlopen(path.value().c_str(), RTLD_NOW | RTLD_GLOBAL);
|
||||
+}
|
||||
+
|
||||
+void* LoadLibraryOrFallback(const base::FilePath& path,
|
||||
+ const char* preferred,
|
||||
+ const char* fallback) {
|
||||
+ if (void* library = LoadLibrary(path.Append(preferred))) {
|
||||
+ return library;
|
||||
+ }
|
||||
+ return LoadLibrary(path.Append(fallback));
|
||||
+}
|
||||
+
|
||||
+bool PreferQt6() {
|
||||
+ auto* cmd = base::CommandLine::ForCurrentProcess();
|
||||
+ if (cmd->HasSwitch(kQtVersionFlag)) {
|
||||
+ std::string qt_version_string = cmd->GetSwitchValueASCII(kQtVersionFlag);
|
||||
+ unsigned int qt_version = 0;
|
||||
+ if (base::StringToUint(qt_version_string, &qt_version)) {
|
||||
+ switch (qt_version) {
|
||||
+ case 5:
|
||||
+ return false;
|
||||
+ case 6:
|
||||
+ return true;
|
||||
+ default:
|
||||
+ LOG(ERROR) << "Unsupported QT version " << qt_version;
|
||||
+ }
|
||||
+ } else {
|
||||
+ LOG(ERROR) << "Unable to parse QT version " << qt_version_string;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ auto env = base::Environment::Create();
|
||||
+ auto desktop = base::nix::GetDesktopEnvironment(env.get());
|
||||
+ return desktop == base::nix::DESKTOP_ENVIRONMENT_KDE6;
|
||||
+}
|
||||
+
|
||||
int QtWeightToCssWeight(int weight) {
|
||||
struct {
|
||||
int qt_weight;
|
||||
@@ -179,8 +220,10 @@ bool QtUi::Initialize() {
|
||||
base::FilePath path;
|
||||
if (!base::PathService::Get(base::DIR_MODULE, &path))
|
||||
return false;
|
||||
- path = path.Append("libqt5_shim.so");
|
||||
- void* libqt_shim = dlopen(path.value().c_str(), RTLD_NOW | RTLD_GLOBAL);
|
||||
+ void* libqt_shim =
|
||||
+ PreferQt6()
|
||||
+ ? LoadLibraryOrFallback(path, "libqt6_shim.so", "libqt5_shim.so")
|
||||
+ : LoadLibraryOrFallback(path, "libqt5_shim.so", "libqt6_shim.so");
|
||||
if (!libqt_shim)
|
||||
return false;
|
||||
void* create_qt_interface = dlsym(libqt_shim, "CreateQtInterface");
|
@ -0,0 +1,21 @@
|
||||
diff -up chromium-114.0.5735.26/components/omnibox/browser/omnibox_edit_model.cc.me chromium-114.0.5735.26/components/omnibox/browser/omnibox_edit_model.cc
|
||||
--- chromium-114.0.5735.26/components/omnibox/browser/omnibox_edit_model.cc.me 2023-05-14 09:14:10.886314480 +0200
|
||||
+++ chromium-114.0.5735.26/components/omnibox/browser/omnibox_edit_model.cc 2023-05-14 09:16:59.380054720 +0200
|
||||
@@ -79,7 +79,7 @@
|
||||
#include "ui/gfx/vector_icon_types.h"
|
||||
#endif
|
||||
|
||||
-#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
|
||||
+#ifdef GOOGLE_CHROME_BRANDING
|
||||
#include "components/vector_icons/vector_icons.h" // nogncheck
|
||||
#endif
|
||||
|
||||
@@ -628,7 +628,7 @@ bool OmniboxEditModel::ShouldShowCurrent
|
||||
}
|
||||
|
||||
ui::ImageModel OmniboxEditModel::GetSuperGIcon(int image_size, bool dark_mode) {
|
||||
-#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
|
||||
+#ifdef GOOGLE_CHROME_BRANDING
|
||||
if (dark_mode) {
|
||||
return ui::ImageModel::FromVectorIcon(
|
||||
vector_icons::kGoogleGLogoMonochromeIcon, ui::kColorRefPrimary100,
|
@ -0,0 +1,105 @@
|
||||
diff -up chromium-114.0.5735.35/chrome/browser/safe_browsing/download_protection/file_analyzer.cc.nounrar chromium-114.0.5735.35/chrome/browser/safe_browsing/download_protection/file_analyzer.cc
|
||||
--- chromium-114.0.5735.35/chrome/browser/safe_browsing/download_protection/file_analyzer.cc.nounrar 2023-05-18 00:37:47.000000000 +0200
|
||||
+++ chromium-114.0.5735.35/chrome/browser/safe_browsing/download_protection/file_analyzer.cc 2023-05-21 18:12:30.368425080 +0200
|
||||
@@ -77,8 +77,6 @@ void FileAnalyzer::Start(const base::Fil
|
||||
|
||||
if (inspection_type == DownloadFileType::ZIP) {
|
||||
StartExtractZipFeatures();
|
||||
- } else if (inspection_type == DownloadFileType::RAR) {
|
||||
- StartExtractRarFeatures();
|
||||
#if BUILDFLAG(IS_MAC)
|
||||
} else if (inspection_type == DownloadFileType::DMG) {
|
||||
StartExtractDmgFeatures();
|
||||
diff -up chromium-114.0.5735.35/chrome/common/safe_browsing/archive_analyzer.cc.nounrar chromium-114.0.5735.35/chrome/common/safe_browsing/archive_analyzer.cc
|
||||
--- chromium-114.0.5735.35/chrome/common/safe_browsing/archive_analyzer.cc.nounrar 2023-05-18 00:37:48.000000000 +0200
|
||||
+++ chromium-114.0.5735.35/chrome/common/safe_browsing/archive_analyzer.cc 2023-05-21 18:11:14.870058635 +0200
|
||||
@@ -8,7 +8,6 @@
|
||||
#include "build/build_config.h"
|
||||
#include "build/buildflag.h"
|
||||
#include "chrome/common/safe_browsing/archive_analyzer_results.h"
|
||||
-#include "chrome/common/safe_browsing/rar_analyzer.h"
|
||||
#include "chrome/common/safe_browsing/seven_zip_analyzer.h"
|
||||
#include "chrome/common/safe_browsing/zip_analyzer.h"
|
||||
#include "components/safe_browsing/content/common/proto/download_file_types.pb.h"
|
||||
@@ -23,9 +22,7 @@ namespace safe_browsing {
|
||||
// static
|
||||
std::unique_ptr<ArchiveAnalyzer> ArchiveAnalyzer::CreateForArchiveType(
|
||||
DownloadFileType_InspectionType file_type) {
|
||||
- if (file_type == DownloadFileType::RAR) {
|
||||
- return std::make_unique<RarAnalyzer>();
|
||||
- } else if (file_type == DownloadFileType::ZIP) {
|
||||
+ if (file_type == DownloadFileType::ZIP) {
|
||||
return std::make_unique<ZipAnalyzer>();
|
||||
} else if (file_type == DownloadFileType::SEVEN_ZIP) {
|
||||
return std::make_unique<SevenZipAnalyzer>();
|
||||
diff -up chromium-114.0.5735.35/chrome/common/safe_browsing/BUILD.gn.nounrar chromium-114.0.5735.35/chrome/common/safe_browsing/BUILD.gn
|
||||
--- chromium-114.0.5735.35/chrome/common/safe_browsing/BUILD.gn.nounrar 2023-05-18 00:37:48.000000000 +0200
|
||||
+++ chromium-114.0.5735.35/chrome/common/safe_browsing/BUILD.gn 2023-05-21 18:11:14.869058617 +0200
|
||||
@@ -145,8 +145,6 @@ source_set("safe_browsing") {
|
||||
"protobuf_message_log_macros.h",
|
||||
"protobuf_message_read_macros.h",
|
||||
"protobuf_message_write_macros.h",
|
||||
- "rar_analyzer.cc",
|
||||
- "rar_analyzer.h",
|
||||
"seven_zip_analyzer.cc",
|
||||
"seven_zip_analyzer.h",
|
||||
"zip_analyzer.cc",
|
||||
@@ -162,7 +160,6 @@ source_set("safe_browsing") {
|
||||
"//components/safe_browsing/content/common:file_type_policies",
|
||||
"//components/safe_browsing/core/common",
|
||||
"//third_party/lzma_sdk/google:seven_zip_reader",
|
||||
- "//third_party/unrar:unrar",
|
||||
]
|
||||
|
||||
if (is_linux) {
|
||||
diff -up chromium-114.0.5735.35/chrome/common/safe_browsing/zip_analyzer.cc.nounrar chromium-114.0.5735.35/chrome/common/safe_browsing/zip_analyzer.cc
|
||||
--- chromium-114.0.5735.35/chrome/common/safe_browsing/zip_analyzer.cc.nounrar 2023-05-18 00:37:48.000000000 +0200
|
||||
+++ chromium-114.0.5735.35/chrome/common/safe_browsing/zip_analyzer.cc 2023-05-21 18:11:14.869058617 +0200
|
||||
@@ -18,7 +18,6 @@
|
||||
#include "base/time/time.h"
|
||||
#include "build/build_config.h"
|
||||
#include "chrome/common/safe_browsing/archive_analyzer_results.h"
|
||||
-#include "chrome/common/safe_browsing/rar_analyzer.h"
|
||||
#include "components/safe_browsing/content/common/file_type_policies.h"
|
||||
#include "components/safe_browsing/core/common/features.h"
|
||||
#include "components/safe_browsing/core/common/proto/csd.pb.h"
|
||||
diff -up chromium-114.0.5735.35/chrome/services/file_util/safe_archive_analyzer.cc.nounrar chromium-114.0.5735.35/chrome/services/file_util/safe_archive_analyzer.cc
|
||||
--- chromium-114.0.5735.35/chrome/services/file_util/safe_archive_analyzer.cc.nounrar 2023-05-18 00:37:48.000000000 +0200
|
||||
+++ chromium-114.0.5735.35/chrome/services/file_util/safe_archive_analyzer.cc 2023-05-21 18:11:14.870058635 +0200
|
||||
@@ -71,6 +71,7 @@ void SafeArchiveAnalyzer::AnalyzeRarFile
|
||||
base::File rar_file,
|
||||
mojo::PendingRemote<chrome::mojom::TemporaryFileGetter> temp_file_getter,
|
||||
AnalyzeRarFileCallback callback) {
|
||||
+#if 0
|
||||
DCHECK(rar_file.IsValid());
|
||||
temp_file_getter_.Bind(std::move(temp_file_getter));
|
||||
callback_ = std::move(callback);
|
||||
@@ -86,6 +87,9 @@ void SafeArchiveAnalyzer::AnalyzeRarFile
|
||||
rar_analyzer_.Analyze(std::move(rar_file), base::FilePath(),
|
||||
std::move(analysis_finished_callback),
|
||||
std::move(temp_file_getter_callback), &results_);
|
||||
+#else
|
||||
+ NOTREACHED();
|
||||
+#endif
|
||||
}
|
||||
|
||||
void SafeArchiveAnalyzer::AnalyzeSevenZipFile(
|
||||
diff -up chromium-114.0.5735.35/chrome/services/file_util/safe_archive_analyzer.h.nounrar chromium-114.0.5735.35/chrome/services/file_util/safe_archive_analyzer.h
|
||||
--- chromium-114.0.5735.35/chrome/services/file_util/safe_archive_analyzer.h.nounrar 2023-05-18 00:37:48.000000000 +0200
|
||||
+++ chromium-114.0.5735.35/chrome/services/file_util/safe_archive_analyzer.h 2023-05-21 18:11:14.870058635 +0200
|
||||
@@ -6,7 +6,6 @@
|
||||
#define CHROME_SERVICES_FILE_UTIL_SAFE_ARCHIVE_ANALYZER_H_
|
||||
|
||||
#include "chrome/common/safe_browsing/archive_analyzer_results.h"
|
||||
-#include "chrome/common/safe_browsing/rar_analyzer.h"
|
||||
#include "chrome/common/safe_browsing/seven_zip_analyzer.h"
|
||||
#include "chrome/common/safe_browsing/zip_analyzer.h"
|
||||
#include "chrome/services/file_util/public/mojom/safe_archive_analyzer.mojom.h"
|
||||
@@ -63,7 +62,6 @@ class SafeArchiveAnalyzer : public chrom
|
||||
void Timeout();
|
||||
|
||||
safe_browsing::ZipAnalyzer zip_analyzer_;
|
||||
- safe_browsing::RarAnalyzer rar_analyzer_;
|
||||
safe_browsing::SevenZipAnalyzer seven_zip_analyzer_;
|
||||
#if BUILDFLAG(IS_MAC)
|
||||
safe_browsing::dmg::DMGAnalyzer dmg_analyzer_;
|
@ -0,0 +1,21 @@
|
||||
diff --git a/ui/qt/qt_ui.cc b/ui/qt/qt_ui.cc
|
||||
index bac5245a..a97fa8b 100644
|
||||
--- a/ui/qt/qt_ui.cc
|
||||
+++ b/ui/qt/qt_ui.cc
|
||||
@@ -422,12 +422,14 @@
|
||||
auto desc = shim_->GetFontDescription();
|
||||
|
||||
font_family_ = desc.family.c_str();
|
||||
+ // Points are defined at 72 DPI and pixels are 96 DPI by default.
|
||||
+ constexpr double kPointToPixelRatio = 96.0 / 72.0;
|
||||
if (desc.size_pixels > 0) {
|
||||
font_size_pixels_ = desc.size_pixels;
|
||||
- font_size_points_ = font_size_pixels_ / GetDeviceScaleFactor();
|
||||
+ font_size_points_ = std::round(font_size_pixels_ / kPointToPixelRatio);
|
||||
} else {
|
||||
font_size_points_ = desc.size_points;
|
||||
- font_size_pixels_ = font_size_points_ * GetDeviceScaleFactor();
|
||||
+ font_size_pixels_ = std::round(font_size_points_ * kPointToPixelRatio);
|
||||
}
|
||||
font_style_ = desc.is_italic ? gfx::Font::ITALIC : gfx::Font::NORMAL;
|
||||
font_weight_ = QtWeightToCssWeight(desc.weight);
|
@ -0,0 +1,574 @@
|
||||
commit c51d6447fd0d124903d16bf5952efccbf9e1ca92
|
||||
Author: Tom Anderson <thomasanderson@chromium.org>
|
||||
Date: Wed May 24 22:53:20 2023 +0000
|
||||
|
||||
[Qt] Handle scale factor changes
|
||||
|
||||
This is a speculative fix for https://crbug.com/1439149. I suspect
|
||||
the scale factor is not set immediately on QT initialization, but
|
||||
is set asynchronously shortly after. This CL adds a listener for
|
||||
QT scale changes.
|
||||
|
||||
R=thestig
|
||||
|
||||
Low-Coverage-Reason: No QT tests currently
|
||||
Change-Id: I7dea23e16a6bb26237564af2dc4e43480f6aea9f
|
||||
Bug: 1439149
|
||||
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4559732
|
||||
Reviewed-by: Lei Zhang <thestig@chromium.org>
|
||||
Commit-Queue: Thomas Anderson <thomasanderson@chromium.org>
|
||||
Auto-Submit: Thomas Anderson <thomasanderson@chromium.org>
|
||||
Cr-Commit-Position: refs/heads/main@{#1148805}
|
||||
|
||||
diff --git a/ui/qt/qt5_shim_moc.cc b/ui/qt/qt5_shim_moc.cc
|
||||
index 8f8b6b57784a8..6e504f23c603a 100644
|
||||
--- a/ui/qt/qt5_shim_moc.cc
|
||||
+++ b/ui/qt/qt5_shim_moc.cc
|
||||
@@ -23,8 +23,8 @@
|
||||
|
||||
QT_BEGIN_MOC_NAMESPACE
|
||||
struct qt_meta_stringdata_qt__QtShim_t {
|
||||
- QByteArrayData data[6];
|
||||
- char stringdata[52];
|
||||
+ QByteArrayData data[13];
|
||||
+ char stringdata[151];
|
||||
};
|
||||
#define QT_MOC_LITERAL(idx, ofs, len) \
|
||||
Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET( \
|
||||
@@ -33,9 +33,16 @@ struct qt_meta_stringdata_qt__QtShim_t {
|
||||
static const qt_meta_stringdata_qt__QtShim_t qt_meta_stringdata_qt__QtShim = {
|
||||
{QT_MOC_LITERAL(0, 0, 10), QT_MOC_LITERAL(1, 11, 11),
|
||||
QT_MOC_LITERAL(2, 23, 0), QT_MOC_LITERAL(3, 24, 4),
|
||||
- QT_MOC_LITERAL(4, 29, 14), QT_MOC_LITERAL(5, 44, 7)},
|
||||
+ QT_MOC_LITERAL(4, 29, 14), QT_MOC_LITERAL(5, 44, 7),
|
||||
+ QT_MOC_LITERAL(6, 52, 11), QT_MOC_LITERAL(7, 64, 8),
|
||||
+ QT_MOC_LITERAL(8, 73, 6), QT_MOC_LITERAL(9, 80, 13),
|
||||
+ QT_MOC_LITERAL(10, 94, 25), QT_MOC_LITERAL(11, 120, 3),
|
||||
+ QT_MOC_LITERAL(12, 124, 26)},
|
||||
"qt::QtShim\0FontChanged\0\0font\0"
|
||||
- "PaletteChanged\0palette"};
|
||||
+ "PaletteChanged\0palette\0ScreenAdded\0"
|
||||
+ "QScreen*\0screen\0ScreenRemoved\0"
|
||||
+ "LogicalDotsPerInchChanged\0dpi\0"
|
||||
+ "PhysicalDotsPerInchChanged"};
|
||||
#undef QT_MOC_LITERAL
|
||||
|
||||
static const uint qt_meta_data_qt__QtShim[] = {
|
||||
@@ -44,7 +51,7 @@ static const uint qt_meta_data_qt__QtShim[] = {
|
||||
7, // revision
|
||||
0, // classname
|
||||
0, 0, // classinfo
|
||||
- 2, 14, // methods
|
||||
+ 6, 14, // methods
|
||||
0, 0, // properties
|
||||
0, 0, // enums/sets
|
||||
0, 0, // constructors
|
||||
@@ -52,11 +59,15 @@ static const uint qt_meta_data_qt__QtShim[] = {
|
||||
0, // signalCount
|
||||
|
||||
// slots: name, argc, parameters, tag, flags
|
||||
- 1, 1, 24, 2, 0x08 /* Private */, 4, 1, 27, 2, 0x08 /* Private */,
|
||||
+ 1, 1, 44, 2, 0x08 /* Private */, 4, 1, 47, 2, 0x08 /* Private */, 6, 1, 50,
|
||||
+ 2, 0x08 /* Private */, 9, 1, 53, 2, 0x08 /* Private */, 10, 1, 56, 2,
|
||||
+ 0x08 /* Private */, 12, 1, 59, 2, 0x08 /* Private */,
|
||||
|
||||
// slots: parameters
|
||||
QMetaType::Void, QMetaType::QFont, 3, QMetaType::Void, QMetaType::QPalette,
|
||||
- 5,
|
||||
+ 5, QMetaType::Void, 0x80000000 | 7, 8, QMetaType::Void, 0x80000000 | 7, 8,
|
||||
+ QMetaType::Void, QMetaType::QReal, 11, QMetaType::Void, QMetaType::QReal,
|
||||
+ 11,
|
||||
|
||||
0 // eod
|
||||
};
|
||||
@@ -74,6 +85,18 @@ void qt::QtShim::qt_static_metacall(QObject* _o,
|
||||
case 1:
|
||||
_t->PaletteChanged((*reinterpret_cast<const QPalette(*)>(_a[1])));
|
||||
break;
|
||||
+ case 2:
|
||||
+ _t->ScreenAdded((*reinterpret_cast<QScreen*(*)>(_a[1])));
|
||||
+ break;
|
||||
+ case 3:
|
||||
+ _t->ScreenRemoved((*reinterpret_cast<QScreen*(*)>(_a[1])));
|
||||
+ break;
|
||||
+ case 4:
|
||||
+ _t->LogicalDotsPerInchChanged((*reinterpret_cast<qreal(*)>(_a[1])));
|
||||
+ break;
|
||||
+ case 5:
|
||||
+ _t->PhysicalDotsPerInchChanged((*reinterpret_cast<qreal(*)>(_a[1])));
|
||||
+ break;
|
||||
default:;
|
||||
}
|
||||
}
|
||||
@@ -107,15 +130,15 @@ int qt::QtShim::qt_metacall(QMetaObject::Call _c, int _id, void** _a) {
|
||||
return _id;
|
||||
}
|
||||
if (_c == QMetaObject::InvokeMetaMethod) {
|
||||
- if (_id < 2) {
|
||||
+ if (_id < 6) {
|
||||
qt_static_metacall(this, _c, _id, _a);
|
||||
}
|
||||
- _id -= 2;
|
||||
+ _id -= 6;
|
||||
} else if (_c == QMetaObject::RegisterMethodArgumentMetaType) {
|
||||
- if (_id < 2) {
|
||||
+ if (_id < 6) {
|
||||
*reinterpret_cast<int*>(_a[0]) = -1;
|
||||
}
|
||||
- _id -= 2;
|
||||
+ _id -= 6;
|
||||
}
|
||||
return _id;
|
||||
}
|
||||
diff --git a/ui/qt/qt6_shim_moc.cc b/ui/qt/qt6_shim_moc.cc
|
||||
index 6d02ca317b65d..a16515008d892 100644
|
||||
--- a/ui/qt/qt6_shim_moc.cc
|
||||
+++ b/ui/qt/qt6_shim_moc.cc
|
||||
@@ -26,8 +26,8 @@ QT_BEGIN_MOC_NAMESPACE
|
||||
QT_WARNING_PUSH
|
||||
QT_WARNING_DISABLE_DEPRECATED
|
||||
struct qt_meta_stringdata_qt__QtShim_t {
|
||||
- const uint offsetsAndSize[12];
|
||||
- char stringdata0[52];
|
||||
+ const uint offsetsAndSize[26];
|
||||
+ char stringdata0[151];
|
||||
};
|
||||
#define QT_MOC_LITERAL(ofs, len) \
|
||||
uint(offsetof(qt_meta_stringdata_qt__QtShim_t, stringdata0) + ofs), len
|
||||
@@ -38,11 +38,21 @@ static const qt_meta_stringdata_qt__QtShim_t qt_meta_stringdata_qt__QtShim = {
|
||||
QT_MOC_LITERAL(23, 0), // ""
|
||||
QT_MOC_LITERAL(24, 4), // "font"
|
||||
QT_MOC_LITERAL(29, 14), // "PaletteChanged"
|
||||
- QT_MOC_LITERAL(44, 7) // "palette"
|
||||
+ QT_MOC_LITERAL(44, 7), // "palette"
|
||||
+ QT_MOC_LITERAL(52, 11), // "ScreenAdded"
|
||||
+ QT_MOC_LITERAL(64, 8), // "QScreen*"
|
||||
+ QT_MOC_LITERAL(73, 6), // "screen"
|
||||
+ QT_MOC_LITERAL(80, 13), // "ScreenRemoved"
|
||||
+ QT_MOC_LITERAL(94, 25), // "LogicalDotsPerInchChanged"
|
||||
+ QT_MOC_LITERAL(120, 3), // "dpi"
|
||||
+ QT_MOC_LITERAL(124, 26) // "PhysicalDotsPerInchChanged"
|
||||
|
||||
},
|
||||
"qt::QtShim\0FontChanged\0\0font\0"
|
||||
- "PaletteChanged\0palette"};
|
||||
+ "PaletteChanged\0palette\0ScreenAdded\0"
|
||||
+ "QScreen*\0screen\0ScreenRemoved\0"
|
||||
+ "LogicalDotsPerInchChanged\0dpi\0"
|
||||
+ "PhysicalDotsPerInchChanged"};
|
||||
#undef QT_MOC_LITERAL
|
||||
|
||||
static const uint qt_meta_data_qt__QtShim[] = {
|
||||
@@ -51,7 +61,7 @@ static const uint qt_meta_data_qt__QtShim[] = {
|
||||
10, // revision
|
||||
0, // classname
|
||||
0, 0, // classinfo
|
||||
- 2, 14, // methods
|
||||
+ 6, 14, // methods
|
||||
0, 0, // properties
|
||||
0, 0, // enums/sets
|
||||
0, 0, // constructors
|
||||
@@ -59,11 +69,15 @@ static const uint qt_meta_data_qt__QtShim[] = {
|
||||
0, // signalCount
|
||||
|
||||
// slots: name, argc, parameters, tag, flags, initial metatype offsets
|
||||
- 1, 1, 26, 2, 0x08, 1 /* Private */, 4, 1, 29, 2, 0x08, 3 /* Private */,
|
||||
+ 1, 1, 50, 2, 0x08, 1 /* Private */, 4, 1, 53, 2, 0x08, 3 /* Private */, 6,
|
||||
+ 1, 56, 2, 0x08, 5 /* Private */, 9, 1, 59, 2, 0x08, 7 /* Private */, 10, 1,
|
||||
+ 62, 2, 0x08, 9 /* Private */, 12, 1, 65, 2, 0x08, 11 /* Private */,
|
||||
|
||||
// slots: parameters
|
||||
QMetaType::Void, QMetaType::QFont, 3, QMetaType::Void, QMetaType::QPalette,
|
||||
- 5,
|
||||
+ 5, QMetaType::Void, 0x80000000 | 7, 8, QMetaType::Void, 0x80000000 | 7, 8,
|
||||
+ QMetaType::Void, QMetaType::QReal, 11, QMetaType::Void, QMetaType::QReal,
|
||||
+ 11,
|
||||
|
||||
0 // eod
|
||||
};
|
||||
@@ -83,6 +97,22 @@ void qt::QtShim::qt_static_metacall(QObject* _o,
|
||||
_t->PaletteChanged(
|
||||
(*reinterpret_cast<std::add_pointer_t<QPalette>>(_a[1])));
|
||||
break;
|
||||
+ case 2:
|
||||
+ _t->ScreenAdded(
|
||||
+ (*reinterpret_cast<std::add_pointer_t<QScreen*>>(_a[1])));
|
||||
+ break;
|
||||
+ case 3:
|
||||
+ _t->ScreenRemoved(
|
||||
+ (*reinterpret_cast<std::add_pointer_t<QScreen*>>(_a[1])));
|
||||
+ break;
|
||||
+ case 4:
|
||||
+ _t->LogicalDotsPerInchChanged(
|
||||
+ (*reinterpret_cast<std::add_pointer_t<qreal>>(_a[1])));
|
||||
+ break;
|
||||
+ case 5:
|
||||
+ _t->PhysicalDotsPerInchChanged(
|
||||
+ (*reinterpret_cast<std::add_pointer_t<qreal>>(_a[1])));
|
||||
+ break;
|
||||
default:;
|
||||
}
|
||||
}
|
||||
@@ -98,7 +128,15 @@ const QMetaObject qt::QtShim::staticMetaObject = {
|
||||
QtPrivate::TypeAndForceComplete<void, std::false_type>,
|
||||
QtPrivate::TypeAndForceComplete<const QFont&, std::false_type>,
|
||||
QtPrivate::TypeAndForceComplete<void, std::false_type>,
|
||||
- QtPrivate::TypeAndForceComplete<const QPalette&, std::false_type>
|
||||
+ QtPrivate::TypeAndForceComplete<const QPalette&, std::false_type>,
|
||||
+ QtPrivate::TypeAndForceComplete<void, std::false_type>,
|
||||
+ QtPrivate::TypeAndForceComplete<QScreen*, std::false_type>,
|
||||
+ QtPrivate::TypeAndForceComplete<void, std::false_type>,
|
||||
+ QtPrivate::TypeAndForceComplete<QScreen*, std::false_type>,
|
||||
+ QtPrivate::TypeAndForceComplete<void, std::false_type>,
|
||||
+ QtPrivate::TypeAndForceComplete<qreal, std::false_type>,
|
||||
+ QtPrivate::TypeAndForceComplete<void, std::false_type>,
|
||||
+ QtPrivate::TypeAndForceComplete<qreal, std::false_type>
|
||||
|
||||
>,
|
||||
nullptr}};
|
||||
@@ -127,15 +165,15 @@ int qt::QtShim::qt_metacall(QMetaObject::Call _c, int _id, void** _a) {
|
||||
return _id;
|
||||
}
|
||||
if (_c == QMetaObject::InvokeMetaMethod) {
|
||||
- if (_id < 2) {
|
||||
+ if (_id < 6) {
|
||||
qt_static_metacall(this, _c, _id, _a);
|
||||
}
|
||||
- _id -= 2;
|
||||
+ _id -= 6;
|
||||
} else if (_c == QMetaObject::RegisterMethodArgumentMetaType) {
|
||||
- if (_id < 2) {
|
||||
+ if (_id < 6) {
|
||||
*reinterpret_cast<QMetaType*>(_a[0]) = QMetaType();
|
||||
}
|
||||
- _id -= 2;
|
||||
+ _id -= 6;
|
||||
}
|
||||
return _id;
|
||||
}
|
||||
diff --git a/ui/qt/qt_interface.h b/ui/qt/qt_interface.h
|
||||
index 6a362bc66c0e3..28dfc6603544f 100644
|
||||
--- a/ui/qt/qt_interface.h
|
||||
+++ b/ui/qt/qt_interface.h
|
||||
@@ -118,6 +118,7 @@ class QtInterface {
|
||||
|
||||
virtual void FontChanged() = 0;
|
||||
virtual void ThemeChanged() = 0;
|
||||
+ virtual void ScaleFactorMaybeChanged() = 0;
|
||||
};
|
||||
|
||||
QtInterface() = default;
|
||||
diff --git a/ui/qt/qt_shim.cc b/ui/qt/qt_shim.cc
|
||||
index 74d34ad196f18..0aec9c3aed4ad 100644
|
||||
--- a/ui/qt/qt_shim.cc
|
||||
+++ b/ui/qt/qt_shim.cc
|
||||
@@ -16,6 +16,7 @@
|
||||
#include <QMimeType>
|
||||
#include <QPainter>
|
||||
#include <QPalette>
|
||||
+#include <QScreen>
|
||||
#include <QStyle>
|
||||
#include <QStyleOptionTitleBar>
|
||||
|
||||
@@ -52,8 +53,9 @@ FontHinting QtHintingToFontHinting(QFont::HintingPreference hinting) {
|
||||
// Obtain the average color of a gradient.
|
||||
SkColor GradientColor(const QGradient& gradient) {
|
||||
QGradientStops stops = gradient.stops();
|
||||
- if (stops.empty())
|
||||
+ if (stops.empty()) {
|
||||
return qRgba(0, 0, 0, 0);
|
||||
+ }
|
||||
|
||||
float a = 0;
|
||||
float r = 0;
|
||||
@@ -86,11 +88,13 @@ SkColor GradientColor(const QGradient& gradient) {
|
||||
// Obtain the average color of a texture.
|
||||
SkColor TextureColor(QImage image) {
|
||||
size_t size = image.width() * image.height();
|
||||
- if (!size)
|
||||
+ if (!size) {
|
||||
return qRgba(0, 0, 0, 0);
|
||||
+ }
|
||||
|
||||
- if (image.format() != QImage::Format_ARGB32_Premultiplied)
|
||||
+ if (image.format() != QImage::Format_ARGB32_Premultiplied) {
|
||||
image = image.convertToFormat(QImage::Format_ARGB32_Premultiplied);
|
||||
+ }
|
||||
|
||||
size_t a = 0;
|
||||
size_t r = 0;
|
||||
@@ -203,6 +207,13 @@ QtShim::QtShim(QtInterface::Delegate* delegate, int* argc, char** argv)
|
||||
SLOT(FontChanged(const QFont&)));
|
||||
connect(&app_, SIGNAL(paletteChanged(const QPalette&)), this,
|
||||
SLOT(PaletteChanged(const QPalette&)));
|
||||
+ connect(&app_, SIGNAL(screenAdded(QScreen*)), this,
|
||||
+ SLOT(ScreenAdded(QScreen*)));
|
||||
+ connect(&app_, SIGNAL(screenRemoved(QScreen*)), this,
|
||||
+ SLOT(ScreenRemoved(QScreen*)));
|
||||
+ for (QScreen* screen : app_.screens()) {
|
||||
+ ScreenAdded(screen);
|
||||
+ }
|
||||
}
|
||||
|
||||
QtShim::~QtShim() = default;
|
||||
@@ -241,8 +252,9 @@ Image QtShim::GetIconForContentType(const String& content_type,
|
||||
auto icon = QIcon::fromTheme(name);
|
||||
auto pixmap = icon.pixmap(size);
|
||||
auto image = pixmap.toImage();
|
||||
- if (image.format() != QImage::Format_ARGB32_Premultiplied)
|
||||
+ if (image.format() != QImage::Format_ARGB32_Premultiplied) {
|
||||
image = image.convertToFormat(QImage::Format_ARGB32_Premultiplied);
|
||||
+ }
|
||||
if (auto bytes = image.sizeInBytes()) {
|
||||
return {image.width(), image.height(),
|
||||
static_cast<float>(image.devicePixelRatio()),
|
||||
@@ -283,6 +295,30 @@ void QtShim::PaletteChanged(const QPalette& palette) {
|
||||
delegate_->ThemeChanged();
|
||||
}
|
||||
|
||||
+DISABLE_CFI_VCALL
|
||||
+void QtShim::ScreenAdded(QScreen* screen) {
|
||||
+ connect(screen, SIGNAL(logicalDotsPerInchChanged(qreal)), this,
|
||||
+ SLOT(LogicalDotsPerInchChanged(qreal)));
|
||||
+ connect(screen, SIGNAL(physicalDotsPerInchChanged(qreal)), this,
|
||||
+ SLOT(PhysicalDotsPerInchChanged(qreal)));
|
||||
+ delegate_->ScaleFactorMaybeChanged();
|
||||
+}
|
||||
+
|
||||
+DISABLE_CFI_VCALL
|
||||
+void QtShim::ScreenRemoved(QScreen* screen) {
|
||||
+ delegate_->ScaleFactorMaybeChanged();
|
||||
+}
|
||||
+
|
||||
+DISABLE_CFI_VCALL
|
||||
+void QtShim::LogicalDotsPerInchChanged(qreal dpi) {
|
||||
+ delegate_->ScaleFactorMaybeChanged();
|
||||
+}
|
||||
+
|
||||
+DISABLE_CFI_VCALL
|
||||
+void QtShim::PhysicalDotsPerInchChanged(qreal dpi) {
|
||||
+ delegate_->ScaleFactorMaybeChanged();
|
||||
+}
|
||||
+
|
||||
Image QtShim::DrawHeader(int width,
|
||||
int height,
|
||||
SkColor default_color,
|
||||
@@ -309,8 +345,9 @@ QImage QtShim::DrawHeaderImpl(int width,
|
||||
QStyleOptionTitleBar opt;
|
||||
opt.rect = QRect(-kBorderWidth, -kBorderWidth, width + 2 * kBorderWidth,
|
||||
height + 2 * kBorderWidth);
|
||||
- if (state == ColorState::kNormal)
|
||||
+ if (state == ColorState::kNormal) {
|
||||
opt.titleBarState = QStyle::State_Active;
|
||||
+ }
|
||||
app_.style()->drawComplexControl(QStyle::CC_TitleBar, &opt, &painter,
|
||||
nullptr);
|
||||
} else {
|
||||
diff --git a/ui/qt/qt_shim.h b/ui/qt/qt_shim.h
|
||||
index 607e6fe22dfc0..d979c47d589d4 100644
|
||||
--- a/ui/qt/qt_shim.h
|
||||
+++ b/ui/qt/qt_shim.h
|
||||
@@ -42,6 +42,10 @@ class QtShim : public QObject, public QtInterface {
|
||||
private slots:
|
||||
void FontChanged(const QFont& font);
|
||||
void PaletteChanged(const QPalette& palette);
|
||||
+ void ScreenAdded(QScreen* screen);
|
||||
+ void ScreenRemoved(QScreen* screen);
|
||||
+ void LogicalDotsPerInchChanged(qreal dpi);
|
||||
+ void PhysicalDotsPerInchChanged(qreal dpi);
|
||||
|
||||
private:
|
||||
QImage DrawHeaderImpl(int width,
|
||||
diff --git a/ui/qt/qt_ui.cc b/ui/qt/qt_ui.cc
|
||||
index 6a3b58e9f930b..bac5245a069f9 100644
|
||||
--- a/ui/qt/qt_ui.cc
|
||||
+++ b/ui/qt/qt_ui.cc
|
||||
@@ -19,6 +19,7 @@
|
||||
#include "base/nix/xdg_util.h"
|
||||
#include "base/notreached.h"
|
||||
#include "base/path_service.h"
|
||||
+#include "base/task/single_thread_task_runner.h"
|
||||
#include "base/time/time.h"
|
||||
#include "cc/paint/paint_canvas.h"
|
||||
#include "chrome/browser/themes/theme_properties.h" // nogncheck
|
||||
@@ -36,6 +37,7 @@
|
||||
#include "ui/gfx/image/image.h"
|
||||
#include "ui/gfx/image/image_skia_rep.h"
|
||||
#include "ui/gfx/image/image_skia_source.h"
|
||||
+#include "ui/linux/device_scale_factor_observer.h"
|
||||
#include "ui/linux/linux_ui.h"
|
||||
#include "ui/linux/nav_button_provider.h"
|
||||
#include "ui/native_theme/native_theme_aura.h"
|
||||
@@ -194,16 +196,21 @@ void QtUi::GetDefaultFontDescription(std::string* family_out,
|
||||
int* style_out,
|
||||
int* weight_out,
|
||||
gfx::FontRenderParams* params_out) const {
|
||||
- if (family_out)
|
||||
+ if (family_out) {
|
||||
*family_out = font_family_;
|
||||
- if (size_pixels_out)
|
||||
+ }
|
||||
+ if (size_pixels_out) {
|
||||
*size_pixels_out = font_size_pixels_;
|
||||
- if (style_out)
|
||||
+ }
|
||||
+ if (style_out) {
|
||||
*style_out = font_style_;
|
||||
- if (weight_out)
|
||||
+ }
|
||||
+ if (weight_out) {
|
||||
*weight_out = font_weight_;
|
||||
- if (params_out)
|
||||
+ }
|
||||
+ if (params_out) {
|
||||
*params_out = font_params_;
|
||||
+ }
|
||||
}
|
||||
|
||||
ui::SelectFileDialog* QtUi::CreateSelectFileDialog(
|
||||
@@ -236,6 +245,7 @@ bool QtUi::Initialize() {
|
||||
ui::ColorProviderManager::Get().AppendColorProviderInitializer(
|
||||
base::BindRepeating(&QtUi::AddNativeColorMixer, base::Unretained(this)));
|
||||
FontChanged();
|
||||
+ scale_factor_ = shim_->GetScaleFactor();
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -246,8 +256,9 @@ ui::NativeTheme* QtUi::GetNativeTheme() const {
|
||||
|
||||
bool QtUi::GetColor(int id, SkColor* color, bool use_custom_frame) const {
|
||||
auto value = GetColor(id, use_custom_frame);
|
||||
- if (value)
|
||||
+ if (value) {
|
||||
*color = *value;
|
||||
+ }
|
||||
return value.has_value();
|
||||
}
|
||||
|
||||
@@ -297,8 +308,9 @@ gfx::Image QtUi::GetIconForContentType(const std::string& content_type,
|
||||
float scale) const {
|
||||
Image image =
|
||||
shim_->GetIconForContentType(String(content_type.c_str()), size * scale);
|
||||
- if (!image.data_argb.size())
|
||||
+ if (!image.data_argb.size()) {
|
||||
return {};
|
||||
+ }
|
||||
|
||||
SkImageInfo image_info = SkImageInfo::Make(
|
||||
image.width, image.height, kBGRA_8888_SkColorType, kPremul_SkAlphaType);
|
||||
@@ -345,14 +357,16 @@ bool QtUi::AnimationsEnabled() const {
|
||||
|
||||
void QtUi::AddWindowButtonOrderObserver(
|
||||
ui::WindowButtonOrderObserver* observer) {
|
||||
- if (fallback_linux_ui_)
|
||||
+ if (fallback_linux_ui_) {
|
||||
fallback_linux_ui_->AddWindowButtonOrderObserver(observer);
|
||||
+ }
|
||||
}
|
||||
|
||||
void QtUi::RemoveWindowButtonOrderObserver(
|
||||
ui::WindowButtonOrderObserver* observer) {
|
||||
- if (fallback_linux_ui_)
|
||||
+ if (fallback_linux_ui_) {
|
||||
fallback_linux_ui_->RemoveWindowButtonOrderObserver(observer);
|
||||
+ }
|
||||
}
|
||||
|
||||
std::unique_ptr<ui::NavButtonProvider> QtUi::CreateNavButtonProvider() {
|
||||
@@ -441,11 +455,24 @@ void QtUi::ThemeChanged() {
|
||||
native_theme_->ThemeChanged(PreferDarkTheme());
|
||||
}
|
||||
|
||||
+void QtUi::ScaleFactorMaybeChanged() {
|
||||
+ // This gets called whenever the monitor configuration changes. Handle the
|
||||
+ // scale change asynchronously to allow the change to propagate to QT's scale
|
||||
+ // factor. This also coalesces scale change events together.
|
||||
+ if (!scale_factor_task_active_) {
|
||||
+ scale_factor_task_active_ = true;
|
||||
+ base::SingleThreadTaskRunner::GetCurrentDefault()->PostTask(
|
||||
+ FROM_HERE, base::BindOnce(&QtUi::ScaleFactorMaybeChangedImpl,
|
||||
+ weak_factory_.GetWeakPtr()));
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
DISABLE_CFI_VCALL
|
||||
void QtUi::AddNativeColorMixer(ui::ColorProvider* provider,
|
||||
const ui::ColorProviderManager::Key& key) {
|
||||
- if (key.system_theme != ui::SystemTheme::kQt)
|
||||
+ if (key.system_theme != ui::SystemTheme::kQt) {
|
||||
return;
|
||||
+ }
|
||||
|
||||
ui::ColorMixer& mixer = provider->AddMixer();
|
||||
// These color constants are required by native_chrome_color_mixer_linux.cc
|
||||
@@ -494,8 +521,9 @@ void QtUi::AddNativeColorMixer(ui::ColorProvider* provider,
|
||||
ColorState::kInactive},
|
||||
{ui::kColorNativeToolbarBackground, ColorType::kButtonBg},
|
||||
};
|
||||
- for (const auto& map : kMaps)
|
||||
+ for (const auto& map : kMaps) {
|
||||
mixer[map.id] = {shim_->GetColor(map.role, map.state)};
|
||||
+ }
|
||||
|
||||
const bool use_custom_frame =
|
||||
key.frame_type == ui::ColorProviderManager::FrameType::kChromium;
|
||||
@@ -578,6 +606,20 @@ absl::optional<SkColor> QtUi::GetColor(int id, bool use_custom_frame) const {
|
||||
}
|
||||
}
|
||||
|
||||
+DISABLE_CFI_VCALL
|
||||
+void QtUi::ScaleFactorMaybeChangedImpl() {
|
||||
+ scale_factor_task_active_ = false;
|
||||
+ double scale = shim_->GetScaleFactor();
|
||||
+ if (scale == scale_factor_) {
|
||||
+ return;
|
||||
+ }
|
||||
+ scale_factor_ = scale;
|
||||
+ for (ui::DeviceScaleFactorObserver& observer :
|
||||
+ device_scale_factor_observer_list()) {
|
||||
+ observer.OnDeviceScaleFactorChanged();
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
std::unique_ptr<ui::LinuxUiAndTheme> CreateQtUi(
|
||||
ui::LinuxUi* fallback_linux_ui) {
|
||||
return std::make_unique<QtUi>(fallback_linux_ui);
|
||||
diff --git a/ui/qt/qt_ui.h b/ui/qt/qt_ui.h
|
||||
index b53ed93240708..3319edf1ea9bc 100644
|
||||
--- a/ui/qt/qt_ui.h
|
||||
+++ b/ui/qt/qt_ui.h
|
||||
@@ -8,6 +8,7 @@
|
||||
#include <memory>
|
||||
|
||||
#include "base/component_export.h"
|
||||
+#include "base/memory/weak_ptr.h"
|
||||
#include "printing/buildflags/buildflags.h"
|
||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
||||
#include "ui/color/color_provider.h"
|
||||
@@ -88,11 +89,14 @@ class QtUi : public ui::LinuxUiAndTheme, QtInterface::Delegate {
|
||||
// QtInterface::Delegate:
|
||||
void FontChanged() override;
|
||||
void ThemeChanged() override;
|
||||
+ void ScaleFactorMaybeChanged() override;
|
||||
|
||||
private:
|
||||
void AddNativeColorMixer(ui::ColorProvider* provider,
|
||||
const ui::ColorProviderManager::Key& key);
|
||||
|
||||
+ void ScaleFactorMaybeChangedImpl();
|
||||
+
|
||||
absl::optional<SkColor> GetColor(int id, bool use_custom_frame) const;
|
||||
|
||||
// TODO(https://crbug.com/1317782): This is a fallback for any unimplemented
|
||||
@@ -114,6 +118,11 @@ class QtUi : public ui::LinuxUiAndTheme, QtInterface::Delegate {
|
||||
std::unique_ptr<QtInterface> shim_;
|
||||
|
||||
std::unique_ptr<QtNativeTheme> native_theme_;
|
||||
+
|
||||
+ bool scale_factor_task_active_ = false;
|
||||
+ double scale_factor_ = 1.0;
|
||||
+
|
||||
+ base::WeakPtrFactory<QtUi> weak_factory_{this};
|
||||
};
|
||||
|
||||
// This should be the only symbol exported from this component.
|
@ -0,0 +1,87 @@
|
||||
diff -up chromium-114.0.5735.35/media/gpu/vaapi/vaapi_video_encode_accelerator.cc.me chromium-114.0.5735.35/media/gpu/vaapi/vaapi_video_encode_accelerator.cc
|
||||
--- chromium-114.0.5735.35/media/gpu/vaapi/vaapi_video_encode_accelerator.cc.me 2023-05-21 10:05:00.357860329 +0200
|
||||
+++ chromium-114.0.5735.35/media/gpu/vaapi/vaapi_video_encode_accelerator.cc 2023-05-21 10:18:09.665432735 +0200
|
||||
@@ -41,7 +41,6 @@
|
||||
#include "media/gpu/gpu_video_encode_accelerator_helpers.h"
|
||||
#include "media/gpu/h264_dpb.h"
|
||||
#include "media/gpu/macros.h"
|
||||
-#include "media/gpu/vaapi/av1_vaapi_video_encoder_delegate.h"
|
||||
#include "media/gpu/vaapi/h264_vaapi_video_encoder_delegate.h"
|
||||
#include "media/gpu/vaapi/va_surface.h"
|
||||
#include "media/gpu/vaapi/vaapi_common.h"
|
||||
@@ -200,7 +199,7 @@ bool VaapiVideoEncodeAccelerator::Initia
|
||||
|
||||
const VideoCodec codec = VideoCodecProfileToVideoCodec(config.output_profile);
|
||||
if (codec != VideoCodec::kH264 && codec != VideoCodec::kVP8 &&
|
||||
- codec != VideoCodec::kVP9 && codec != VideoCodec::kAV1) {
|
||||
+ codec != VideoCodec::kVP9) {
|
||||
MEDIA_LOG(ERROR, media_log.get())
|
||||
<< "Unsupported profile: " << GetProfileName(config.output_profile);
|
||||
return false;
|
||||
@@ -293,7 +292,6 @@ void VaapiVideoEncodeAccelerator::Initia
|
||||
break;
|
||||
case VideoCodec::kVP8:
|
||||
case VideoCodec::kVP9:
|
||||
- case VideoCodec::kAV1:
|
||||
mode = VaapiWrapper::kEncodeConstantQuantizationParameter;
|
||||
break;
|
||||
default:
|
||||
@@ -356,12 +354,6 @@ void VaapiVideoEncodeAccelerator::Initia
|
||||
vaapi_wrapper_, error_cb);
|
||||
}
|
||||
break;
|
||||
- case VideoCodec::kAV1:
|
||||
- if (!IsConfiguredForTesting()) {
|
||||
- encoder_ = std::make_unique<AV1VaapiVideoEncoderDelegate>(
|
||||
- vaapi_wrapper_, error_cb);
|
||||
- }
|
||||
- break;
|
||||
default:
|
||||
NOTREACHED() << "Unsupported codec type " << GetCodecName(output_codec_);
|
||||
return;
|
||||
@@ -835,10 +827,6 @@ VaapiVideoEncodeAccelerator::CreateEncod
|
||||
case VideoCodec::kVP9:
|
||||
picture = new VaapiVP9Picture(std::move(reconstructed_surface));
|
||||
break;
|
||||
- case VideoCodec::kAV1:
|
||||
- picture = new VaapiAV1Picture(/*display_va_surface=*/nullptr,
|
||||
- std::move(reconstructed_surface));
|
||||
- break;
|
||||
default:
|
||||
return nullptr;
|
||||
}
|
||||
diff -up chromium-114.0.5735.35/media/gpu/BUILD.gn.revert-av1enc chromium-114.0.5735.35/media/gpu/BUILD.gn
|
||||
--- chromium-114.0.5735.35/media/gpu/BUILD.gn.revert-av1enc 2023-05-18 00:37:57.000000000 +0200
|
||||
+++ chromium-114.0.5735.35/media/gpu/BUILD.gn 2023-05-20 13:14:10.755183630 +0200
|
||||
@@ -373,10 +373,7 @@ source_set("common") {
|
||||
"vp9_svc_layers.h",
|
||||
]
|
||||
configs += [ "//third_party/libvpx:libvpx_config" ]
|
||||
- deps += [
|
||||
- "//third_party/libaom:libaomrc",
|
||||
- "//third_party/libvpx:libvpxrc",
|
||||
- ]
|
||||
+ deps += [ "//third_party/libvpx:libvpxrc" ]
|
||||
}
|
||||
if (use_libgav1_parser) {
|
||||
sources += [
|
||||
diff -up chromium-114.0.5735.35/media/gpu/vaapi/BUILD.gn.revert-av1enc chromium-114.0.5735.35/media/gpu/vaapi/BUILD.gn
|
||||
--- chromium-114.0.5735.35/media/gpu/vaapi/BUILD.gn.revert-av1enc 2023-05-18 00:37:57.000000000 +0200
|
||||
+++ chromium-114.0.5735.35/media/gpu/vaapi/BUILD.gn 2023-05-20 13:14:10.756183626 +0200
|
||||
@@ -38,8 +38,6 @@ source_set("vaapi") {
|
||||
sources = [
|
||||
"av1_vaapi_video_decoder_delegate.cc",
|
||||
"av1_vaapi_video_decoder_delegate.h",
|
||||
- "av1_vaapi_video_encoder_delegate.cc",
|
||||
- "av1_vaapi_video_encoder_delegate.h",
|
||||
"h264_vaapi_video_decoder_delegate.cc",
|
||||
"h264_vaapi_video_decoder_delegate.h",
|
||||
"h264_vaapi_video_encoder_delegate.cc",
|
||||
@@ -107,7 +105,6 @@ source_set("vaapi") {
|
||||
"//media/gpu/chromeos:common",
|
||||
"//media/parsers",
|
||||
"//mojo/public/cpp/bindings",
|
||||
- "//third_party/libaom:libaomrc",
|
||||
"//third_party/libvpx:libvpxrc",
|
||||
"//third_party/libyuv",
|
||||
"//ui/gfx",
|
@ -0,0 +1,22 @@
|
||||
diff -up chromium-114.0.5735.26/sandbox/policy/linux/bpf_network_policy_linux.cc.me chromium-114.0.5735.26/sandbox/policy/linux/bpf_network_policy_linux.cc
|
||||
--- chromium-114.0.5735.26/sandbox/policy/linux/bpf_network_policy_linux.cc.me 2023-05-13 12:09:44.423727385 +0200
|
||||
+++ chromium-114.0.5735.26/sandbox/policy/linux/bpf_network_policy_linux.cc 2023-05-13 17:52:19.934347246 +0200
|
||||
@@ -11,7 +11,6 @@
|
||||
#include <linux/net.h>
|
||||
#include <linux/netlink.h>
|
||||
#include <linux/sockios.h>
|
||||
-#include <linux/wireless.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/tcp.h>
|
||||
#include <sys/inotify.h>
|
||||
@@ -48,6 +47,10 @@ using sandbox::syscall_broker::BrokerPro
|
||||
#define F2FS_IOC_GET_FEATURES _IOR(0xf5, 12, uint32_t)
|
||||
#endif
|
||||
|
||||
+#if !defined(SIOCGIWNAME)
|
||||
+#define SIOCGIWNAME 0x8B01
|
||||
+#endif
|
||||
+
|
||||
namespace sandbox::policy {
|
||||
|
||||
namespace {
|
@ -0,0 +1,81 @@
|
||||
diff -up chromium-114.0.5735.26/third_party/blink/renderer/core/layout/ng/grid/ng_grid_layout_algorithm.cc.workaround_clang_bug-structured_binding chromium-114.0.5735.26/third_party/blink/renderer/core/layout/ng/grid/ng_grid_layout_algorithm.cc
|
||||
--- chromium-114.0.5735.26/third_party/blink/renderer/core/layout/ng/grid/ng_grid_layout_algorithm.cc.workaround_clang_bug-structured_binding 2023-05-11 03:36:27.000000000 +0200
|
||||
+++ chromium-114.0.5735.26/third_party/blink/renderer/core/layout/ng/grid/ng_grid_layout_algorithm.cc 2023-05-14 11:49:42.558129164 +0200
|
||||
@@ -238,7 +238,10 @@ const NGLayoutResult* NGGridLayoutAlgori
|
||||
: BuildGridSizingTree(&oof_children);
|
||||
|
||||
LayoutUnit intrinsic_block_size;
|
||||
- auto& [grid_items, layout_data, tree_size] = grid_sizing_tree.TreeRootData();
|
||||
+ auto& [g_i, l_d, t_s] = grid_sizing_tree.TreeRootData();
|
||||
+ auto& grid_items = g_i;
|
||||
+ auto& layout_data = l_d;
|
||||
+ auto& tree_size = t_s;
|
||||
|
||||
if (IsBreakInside(BreakToken())) {
|
||||
// TODO(layout-dev): When we support variable inline-size fragments we'll
|
||||
@@ -520,8 +523,10 @@ wtf_size_t NGGridLayoutAlgorithm::BuildG
|
||||
row_auto_repetitions);
|
||||
|
||||
bool has_nested_subgrid = false;
|
||||
- auto& [grid_items, layout_data, subtree_size] =
|
||||
- sizing_tree->CreateSizingData(opt_subgrid_data);
|
||||
+ auto& [g_i, l_d, s_s] = sizing_tree->CreateSizingData(opt_subgrid_data);
|
||||
+ auto& grid_items = g_i;
|
||||
+ auto& layout_data = l_d;
|
||||
+ auto& subtree_size = s_s;
|
||||
|
||||
if (!must_ignore_children) {
|
||||
// Construct grid items that are not subgridded.
|
||||
@@ -650,8 +655,10 @@ NGGridSizingTree NGGridLayoutAlgorithm::
|
||||
NGGridSizingTree sizing_tree;
|
||||
|
||||
if (const auto* layout_subtree = ConstraintSpace().GridLayoutSubtree()) {
|
||||
- auto& [grid_items, layout_data, subtree_size] =
|
||||
- sizing_tree.CreateSizingData();
|
||||
+ auto& [g_i, l_d, s_s] = sizing_tree.CreateSizingData();
|
||||
+ auto& grid_items = g_i;
|
||||
+ auto& layout_data = l_d;
|
||||
+ auto& subtree_size = s_s;
|
||||
|
||||
const auto& node = Node();
|
||||
grid_items =
|
||||
@@ -1640,8 +1647,10 @@ void NGGridLayoutAlgorithm::InitializeTr
|
||||
const absl::optional<GridTrackSizingDirection>& opt_track_direction) const {
|
||||
DCHECK(sizing_subtree);
|
||||
|
||||
- auto& [grid_items, layout_data, subtree_size] =
|
||||
- sizing_subtree.SubtreeRootData();
|
||||
+ auto& [g_i, l_d, s_s] = sizing_subtree.SubtreeRootData();
|
||||
+ auto& grid_items = g_i;
|
||||
+ auto& layout_data = l_d;
|
||||
+ auto& subtree_size = s_s;
|
||||
|
||||
auto InitAndCacheTrackSizes = [&](GridTrackSizingDirection track_direction) {
|
||||
InitializeTrackCollection(opt_subgrid_data, track_direction, &layout_data);
|
||||
@@ -1825,8 +1834,10 @@ void NGGridLayoutAlgorithm::CompleteTrac
|
||||
bool* opt_needs_additional_pass) const {
|
||||
DCHECK(sizing_subtree);
|
||||
|
||||
- auto& [grid_items, layout_data, subtree_size] =
|
||||
- sizing_subtree.SubtreeRootData();
|
||||
+ auto& [g_i, l_d, s_s] = sizing_subtree.SubtreeRootData();
|
||||
+ auto& grid_items = g_i;
|
||||
+ auto& layout_data = l_d;
|
||||
+ auto& subtree_size = s_s;
|
||||
|
||||
const bool is_for_columns = track_direction == kForColumns;
|
||||
const bool has_non_definite_track =
|
||||
diff -up chromium-114.0.5735.26/media/base/cdm_promise_adapter.cc.me chromium-114.0.5735.26/media/base/cdm_promise_adapter.cc
|
||||
--- chromium-114.0.5735.26/media/base/cdm_promise_adapter.cc.me 2023-05-14 17:35:00.446844465 +0200
|
||||
+++ chromium-114.0.5735.26/media/base/cdm_promise_adapter.cc 2023-05-14 17:39:22.991733926 +0200
|
||||
@@ -94,7 +94,9 @@ void CdmPromiseAdapter::RejectPromise(ui
|
||||
void CdmPromiseAdapter::Clear(ClearReason reason) {
|
||||
// Reject all outstanding promises.
|
||||
DCHECK(thread_checker_.CalledOnValidThread());
|
||||
- for (auto& [promise_id, promise] : promises_) {
|
||||
+ for (auto& [p_i, p_e] : promises_) {
|
||||
+ auto& promise_id = p_i;
|
||||
+ auto& promise = p_e;
|
||||
TRACE_EVENT_NESTABLE_ASYNC_END1(
|
||||
"media", "CdmPromise", TRACE_ID_WITH_SCOPE("CdmPromise", promise_id),
|
||||
"status", "cleared");
|
@ -1,3 +1,3 @@
|
||||
SHA512 (node-v19.8.1-linux-arm64.tar.xz) = 86ff19085669e92ce7afe2fd7d4df0c5441df2d88c00f29d5463b805f3cf5625626db8aebf98349c9a495b772da1ce6d68263730018207ea98815058a1c81397
|
||||
SHA512 (node-v19.8.1-linux-x64.tar.xz) = 925c0037c6b7074d0b0245bced20d0a0d9b1300f53b808106f16b5018d763f5f5b00bc321b33fa1033d736b1e1076608da9b7fcae66aed53d27b100b1186e2c6
|
||||
SHA512 (chromium-113.0.5672.126-clean.tar.xz) = 1c7c48f2ea78f09f533dd42eee22876b0716517c8d6beb76b2c8ae1c616bfc050e179c8bda4fe1f9e6ab7fa9dc29077b0cdf149a6e27d10e2fac35d6ef8e6c99
|
||||
SHA512 (chromium-114.0.5735.45-clean.tar.xz) = fc5a0c7296247f31fbc9306fc2bf807cc77df20c0666ff8c21d1b3b9bed83bbd56608991a4c967e7290b3203bdef13411f28687403e2a77ba21673951c32da98
|
||||
|
Loading…
Reference in new issue