diff options
author | Daniel Playfair Cal | 2019-10-23 23:43:59 +1100 |
---|---|---|
committer | Daniel Playfair Cal | 2019-10-23 23:43:59 +1100 |
commit | 6b8f93a9d7c2e44f2c791e407c3e8202281be830 (patch) | |
tree | c087ba7c9b2b49effb49da1efa75ab8519759c3a | |
parent | c501fb64bba470c857338bf2336fb1758a888d2c (diff) | |
download | aur-6b8f93a9d7c2e44f2c791e407c3e8202281be830.tar.gz |
78.0.3904.70-1
-rw-r--r-- | .SRCINFO | 37 | ||||
-rw-r--r-- | 0001-ozone-wayland-Sway-avoid-sending-presentation-early.patch | 380 | ||||
-rw-r--r-- | 0002-ozone-wayland-Use-mutex-before-accessing-surfaces-ma.patch | 276 | ||||
-rw-r--r-- | 0003-ozone-wayland-Stop-using-wl_display_roundtrip.patch | 472 | ||||
-rw-r--r-- | 0004-ozone-wayland-Extract-window-management-methods-to-o.patch | 810 | ||||
-rw-r--r-- | 0005-ozone-wayland-Do-not-use-possibly-blocking-dispatch-.patch | 314 | ||||
-rw-r--r-- | 0006-ozone-wayland-Implement-CreateNativePixmapAsync.patch | 63 | ||||
-rw-r--r-- | PKGBUILD | 70 | ||||
-rw-r--r-- | add-missing-include-for-unique_ptr.patch | 30 | ||||
-rw-r--r-- | chromium-system-zlib.patch | 32 | ||||
-rw-r--r-- | dns_util-make-DohUpgradeEntry-non-const.patch | 86 | ||||
-rw-r--r-- | fix-shutdown-crash-in-ProfileManager.patch | 45 | ||||
-rw-r--r-- | fix-spammy-unique-font-matching-log.patch | 13 | ||||
-rw-r--r-- | fix-wrong-string-initialization-in-LinkedHashSet.patch | 135 | ||||
-rw-r--r-- | include-limits-in-web_time_range.cc.patch | 31 | ||||
-rw-r--r-- | include-memory-in-one_euro_filter.h.patch | 32 | ||||
-rw-r--r-- | link-against-harfbuzz-subset.patch | 55 |
17 files changed, 222 insertions, 2659 deletions
@@ -1,6 +1,6 @@ pkgbase = chromium-ozone pkgdesc = Chromium built with patches for wayland support via Ozone - pkgver = 77.0.3865.120 + pkgver = 78.0.3904.70 pkgrel = 1 url = https://www.chromium.org/Home install = chromium.install @@ -38,7 +38,6 @@ pkgbase = chromium-ozone depends = libxml2 depends = fontconfig depends = harfbuzz - depends = libvpx depends = libjpeg depends = re2 depends = snappy @@ -57,40 +56,28 @@ pkgbase = chromium-ozone conflicts = chromium options = debug options = !strip - source = https://commondatastorage.googleapis.com/chromium-browser-official/chromium-77.0.3865.120.tar.xz + source = https://commondatastorage.googleapis.com/chromium-browser-official/chromium-78.0.3904.70.tar.xz source = chromium-launcher-6.tar.gz::https://github.com/foutrelis/chromium-launcher/archive/v6.tar.gz source = meta-browser-34ef417cdcf848839b59c086be046c2b4a96ac32.tar.gz::https://github.com/OSSystems/meta-browser/archive/34ef417cdcf848839b59c086be046c2b4a96ac32.tar.gz - source = include-memory-in-one_euro_filter.h.patch - source = link-against-harfbuzz-subset.patch - source = fix-wrong-string-initialization-in-LinkedHashSet.patch - source = include-limits-in-web_time_range.cc.patch + source = add-missing-include-for-unique_ptr.patch + source = dns_util-make-DohUpgradeEntry-non-const.patch + source = fix-shutdown-crash-in-ProfileManager.patch source = chromium-system-icu.patch source = chromium-system-zlib.patch + source = fix-spammy-unique-font-matching-log.patch source = chromium-widevine.patch source = chromium-skia-harmony.patch - source = 0001-ozone-wayland-Sway-avoid-sending-presentation-early.patch - source = 0002-ozone-wayland-Use-mutex-before-accessing-surfaces-ma.patch - source = 0003-ozone-wayland-Stop-using-wl_display_roundtrip.patch - source = 0004-ozone-wayland-Extract-window-management-methods-to-o.patch - source = 0005-ozone-wayland-Do-not-use-possibly-blocking-dispatch-.patch - source = 0006-ozone-wayland-Implement-CreateNativePixmapAsync.patch - sha256sums = d792f9b09b1dcfd64e68f47a611c540dd1383dd9abd78ca1e06b2a7e2ff06af8 + sha256sums = ddc5794097d65ba19c1ae359c2057b08921e7b38b7afe9d5ec45f5e8b9a87462 sha256sums = 04917e3cd4307d8e31bfb0027a5dce6d086edb10ff8a716024fbb8bb0c7dccf1 sha256sums = 892026717ac487e1a92073d7a363a7f4a12b06ed6ac61825842ad734eda857d7 - sha256sums = 33a5bcd1df2cc7aa7467fa882790ef143a4497d2b704c9e1ea86c8ede90c2d90 - sha256sums = ab986e4b723dfcedab1bc8dcada07526facae28a8a7ff3345f658532c1d99987 - sha256sums = 840f555020751ec284dca35b9317a9dd7dc69fcb910ea1cae2dd7cc9b237dfb7 - sha256sums = d3dfe3c86901a11636972a774ed6c941ac76e38c9e4a384f458043a0a03291a9 + sha256sums = 49052e8aa630c4aa57bf46823edc32b7b309493275163c3bb3f9fd390c73356e + sha256sums = 69694ab12a5ced389916c0c5e8c7bdc191544f576b134ddfb2fe9d4ed9ec4494 + sha256sums = 4f81612c28957987f7344d8ce2b95a4a63136a8319c9751819436b11c62df057 sha256sums = e73cc2ee8d3ea35aab18c478d76fdfc68ca4463e1e10306fa1e738c03b3f26b5 - sha256sums = 0f7ba6882844542a7226b419dfefc5b6a16b5b7882698bd773b5ee9148aa6e87 + sha256sums = eb67eda4945a89c3b90473fa8dc20637511ca4dcb58879a8ed6bf403700ca9c8 + sha256sums = 6fbffe59b886195b92c9a55137cef83021c16593f49714acb20023633e3ebb19 sha256sums = d081f2ef8793544685aad35dea75a7e6264a2cb987ff3541e6377f4a3650a28b sha256sums = 771292942c0901092a402cc60ee883877a99fb804cb54d568c8c6c94565a48e1 - sha256sums = c43f54e180a9eeed31ef6b0e05ec98afbb5fc1197c71e119293784bb37579439 - sha256sums = 3d83763a5ccd4a8dd59a4d1ffbae3fcfba7688e32b6acd03505f779c7bfa8d02 - sha256sums = 811567d57cf22139e6ace8c8fdbc329a24f586f68214daf6dd224f56cac792b3 - sha256sums = 5c4b5b596b2b3bdcf33b865d44f1daa0787fc52a2a1d6ac82a6f03287ca6355a - sha256sums = 231147345c0f175263cacddb62c97c7b13897870f5ebac9fa6feabf9cc28ea2d - sha256sums = bec73f9f8b88e2c83549fc851f21fd7d0a6db714f713147f253eb7de17508efc pkgname = chromium-ozone diff --git a/0001-ozone-wayland-Sway-avoid-sending-presentation-early.patch b/0001-ozone-wayland-Sway-avoid-sending-presentation-early.patch deleted file mode 100644 index ec17deaf3df3..000000000000 --- a/0001-ozone-wayland-Sway-avoid-sending-presentation-early.patch +++ /dev/null @@ -1,380 +0,0 @@ -From bd257de2d82e36aae112fe6e46f0e6313137da47 Mon Sep 17 00:00:00 2001 -From: Maksim Sisov <msisov@igalia.com> -Date: Tue, 30 Jul 2019 05:53:48 +0000 -Subject: [PATCH 1/6] [ozone/wayland] Sway: avoid sending presentation early. - -In Sway, presentation callbacks may come much earlier than we send -submission callbacks. That results in unexpected crashes in -GbmSurfacelessWayland, because of early presentation callbacks. -Briefly, a submitted frame may not receive the submission -callback and not be moved to the list waiting for presentation -frames. That means GbmSurfacelessWayland::OnPresentation accesses -an invalid pointer to a frame when the presentation feedback comes. - -Bug: 974456 -Change-Id: Iae7ab57a00d06f0dde6057ed05df885239e099bd -Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1719013 -Reviewed-by: Robert Kroeger <rjkroege@chromium.org> -Commit-Queue: Maksim Sisov <msisov@igalia.com> -Cr-Commit-Position: refs/heads/master@{#682157} ---- - ui/ozone/platform/wayland/BUILD.gn | 3 ++ - .../wayland/gpu/wayland_surface_gpu.h | 2 + - .../host/wayland_buffer_manager_host.cc | 25 +++++++-- - .../platform/wayland/test/mock_surface.cc | 44 ++++++++++++++- - ui/ozone/platform/wayland/test/mock_surface.h | 14 +++++ - .../wayland/test/mock_wp_presentation.cc | 53 +++++++++++++++++++ - .../wayland/test/mock_wp_presentation.h | 47 ++++++++++++++++ - .../test/test_wayland_server_thread.cc | 6 +++ - .../wayland/test/test_wayland_server_thread.h | 5 ++ - 9 files changed, 194 insertions(+), 5 deletions(-) - create mode 100644 ui/ozone/platform/wayland/test/mock_wp_presentation.cc - create mode 100644 ui/ozone/platform/wayland/test/mock_wp_presentation.h - -diff --git a/ui/ozone/platform/wayland/BUILD.gn b/ui/ozone/platform/wayland/BUILD.gn -index 91f497052fae..95f20b1fb288 100644 ---- a/ui/ozone/platform/wayland/BUILD.gn -+++ b/ui/ozone/platform/wayland/BUILD.gn -@@ -173,6 +173,8 @@ source_set("test_support") { - "test/mock_pointer.h", - "test/mock_surface.cc", - "test/mock_surface.h", -+ "test/mock_wp_presentation.cc", -+ "test/mock_wp_presentation.h", - "test/mock_xdg_popup.cc", - "test/mock_xdg_popup.h", - "test/mock_xdg_shell.cc", -@@ -225,6 +227,7 @@ source_set("test_support") { - "//testing/gmock", - "//third_party/wayland:wayland_server", - "//third_party/wayland-protocols:linux_dmabuf_protocol", -+ "//third_party/wayland-protocols:presentation_time_protocol", - "//third_party/wayland-protocols:text_input_protocol", - "//third_party/wayland-protocols:xdg_shell_protocol", - "//ui/gfx/geometry:geometry", -diff --git a/ui/ozone/platform/wayland/gpu/wayland_surface_gpu.h b/ui/ozone/platform/wayland/gpu/wayland_surface_gpu.h -index f3593766eed8..ace5279e838e 100644 ---- a/ui/ozone/platform/wayland/gpu/wayland_surface_gpu.h -+++ b/ui/ozone/platform/wayland/gpu/wayland_surface_gpu.h -@@ -22,6 +22,8 @@ namespace ui { - // the buffer. - class WaylandSurfaceGpu { - public: -+ virtual ~WaylandSurfaceGpu() {} -+ - // Tells the surface the result of the last swap of buffer with the - // |buffer_id|. - virtual void OnSubmission(uint32_t buffer_id, -diff --git a/ui/ozone/platform/wayland/host/wayland_buffer_manager_host.cc b/ui/ozone/platform/wayland/host/wayland_buffer_manager_host.cc -index 3f163a012c31..1bcf85261b41 100644 ---- a/ui/ozone/platform/wayland/host/wayland_buffer_manager_host.cc -+++ b/ui/ozone/platform/wayland/host/wayland_buffer_manager_host.cc -@@ -228,6 +228,12 @@ class WaylandBufferManagerHost::Surface { - // surface can tell the gpu about successful swap. - bool released = true; - -+ // In some cases, a presentation feedback can come earlier than we fire a -+ // submission callback. Thus, instead of sending it immediately to the GPU -+ // process, we store it and fire as soon as the submission callback is -+ // fired. -+ bool needs_send_feedback = false; -+ - gfx::PresentationFeedback feedback; - - DISALLOW_COPY_AND_ASSIGN(WaylandBuffer); -@@ -355,6 +361,11 @@ class WaylandBufferManagerHost::Surface { - void CompleteSubmission() { - DCHECK(submitted_buffer_); - auto id = submitted_buffer_->buffer_id; -+ -+ auto feedback = std::move(submitted_buffer_->feedback); -+ bool needs_send_feedback = submitted_buffer_->needs_send_feedback; -+ submitted_buffer_->needs_send_feedback = false; -+ - prev_submitted_buffer_ = submitted_buffer_; - submitted_buffer_ = nullptr; - // We can now complete the latest submission. We had to wait for this -@@ -370,14 +381,22 @@ class WaylandBufferManagerHost::Surface { - OnPresentation(id, gfx::PresentationFeedback( - base::TimeTicks::Now(), base::TimeDelta(), - GetPresentationKindFlags(0))); -+ } else if (needs_send_feedback) { -+ OnPresentation(id, std::move(feedback)); - } - } - - void OnPresentation(uint32_t buffer_id, - const gfx::PresentationFeedback& feedback) { -- // The order of submission and presentation callbacks is checked on the GPU -- // side, but it must never happen, because the Submission is called -- // immediately after the buffer is swapped. -+ // The order of submission and presentation callbacks cannot be controlled. -+ // Some Wayland compositors may fire presentation callbacks earlier than we -+ // are able to send submission callbacks and this is bad. Thus, handle it here. -+ if (submitted_buffer_ && submitted_buffer_->buffer_id == buffer_id) { -+ submitted_buffer_->needs_send_feedback = true; -+ submitted_buffer_->feedback = feedback; -+ return; -+ } -+ - buffer_manager_->OnPresentation(window_->GetWidget(), buffer_id, feedback); - } - -diff --git a/ui/ozone/platform/wayland/test/mock_surface.cc b/ui/ozone/platform/wayland/test/mock_surface.cc -index b086bdc85416..fa53a037669b 100644 ---- a/ui/ozone/platform/wayland/test/mock_surface.cc -+++ b/ui/ozone/platform/wayland/test/mock_surface.cc -@@ -13,7 +13,8 @@ void Attach(wl_client* client, - wl_resource* buffer_resource, - int32_t x, - int32_t y) { -- GetUserDataAs<MockSurface>(resource)->Attach(buffer_resource, x, y); -+ auto* surface = GetUserDataAs<MockSurface>(resource); -+ surface->AttachNewBuffer(buffer_resource, x, y); - } - - void SetOpaqueRegion(wl_client* client, -@@ -40,7 +41,13 @@ void Damage(wl_client* client, - void Frame(struct wl_client* client, - struct wl_resource* resource, - uint32_t callback) { -- GetUserDataAs<MockSurface>(resource)->Frame(callback); -+ auto* surface = GetUserDataAs<MockSurface>(resource); -+ -+ wl_resource* callback_resource = -+ wl_resource_create(client, &wl_callback_interface, 1, callback); -+ surface->set_frame_callback(callback_resource); -+ -+ surface->Frame(callback); - } - - void Commit(wl_client* client, wl_resource* resource) { -@@ -89,4 +96,37 @@ MockSurface* MockSurface::FromResource(wl_resource* resource) { - return GetUserDataAs<MockSurface>(resource); - } - -+void MockSurface::AttachNewBuffer(wl_resource* buffer_resource, -+ int32_t x, -+ int32_t y) { -+ if (attached_buffer_) { -+ DCHECK(!prev_attached_buffer_); -+ prev_attached_buffer_ = attached_buffer_; -+ } -+ attached_buffer_ = buffer_resource; -+ -+ Attach(buffer_resource, x, y); -+} -+ -+void MockSurface::ReleasePrevAttachedBuffer() { -+ if (!prev_attached_buffer_) -+ return; -+ -+ wl_buffer_send_release(prev_attached_buffer_); -+ wl_client_flush(wl_resource_get_client(prev_attached_buffer_)); -+ prev_attached_buffer_ = nullptr; -+} -+ -+void MockSurface::SendFrameCallback() { -+ if (!frame_callback_) -+ return; -+ -+ wl_callback_send_done( -+ frame_callback_, -+ 0 /* trequest-specific data for the callback. not used */); -+ wl_client_flush(wl_resource_get_client(frame_callback_)); -+ wl_resource_destroy(frame_callback_); -+ frame_callback_ = nullptr; -+} -+ - } // namespace wl -diff --git a/ui/ozone/platform/wayland/test/mock_surface.h b/ui/ozone/platform/wayland/test/mock_surface.h -index d283e44b2fe9..1d781d03d3dc 100644 ---- a/ui/ozone/platform/wayland/test/mock_surface.h -+++ b/ui/ozone/platform/wayland/test/mock_surface.h -@@ -51,10 +51,24 @@ class MockSurface : public ServerObject { - } - MockXdgPopup* xdg_popup() const { return xdg_popup_.get(); } - -+ void set_frame_callback(wl_resource* callback_resource) { -+ DCHECK(!frame_callback_); -+ frame_callback_ = callback_resource; -+ } -+ -+ void AttachNewBuffer(wl_resource* buffer_resource, int32_t x, int32_t y); -+ void ReleasePrevAttachedBuffer(); -+ void SendFrameCallback(); -+ - private: - std::unique_ptr<MockXdgSurface> xdg_surface_; - std::unique_ptr<MockXdgPopup> xdg_popup_; - -+ wl_resource* frame_callback_ = nullptr; -+ -+ wl_resource* attached_buffer_ = nullptr; -+ wl_resource* prev_attached_buffer_ = nullptr; -+ - DISALLOW_COPY_AND_ASSIGN(MockSurface); - }; - -diff --git a/ui/ozone/platform/wayland/test/mock_wp_presentation.cc b/ui/ozone/platform/wayland/test/mock_wp_presentation.cc -new file mode 100644 -index 000000000000..d24c13658aa4 ---- /dev/null -+++ b/ui/ozone/platform/wayland/test/mock_wp_presentation.cc -@@ -0,0 +1,53 @@ -+// Copyright 2019 The Chromium Authors. All rights reserved. -+// Use of this source code is governed by a BSD-style license that can be -+// found in the LICENSE file. -+ -+#include "ui/ozone/platform/wayland/test/mock_wp_presentation.h" -+ -+#include <wayland-server-core.h> -+ -+#include "ui/ozone/platform/wayland/test/server_object.h" -+ -+namespace wl { -+ -+namespace { -+ -+void Feedback(struct wl_client* client, -+ struct wl_resource* resource, -+ struct wl_resource* surface, -+ uint32_t callback) { -+ auto* wp_presentation = GetUserDataAs<MockWpPresentation>(resource); -+ wl_resource* presentation_feedback_resource = -+ wl_resource_create(client, &wp_presentation_feedback_interface, -+ wl_resource_get_version(resource), callback); -+ wp_presentation->set_presentation_callback(presentation_feedback_resource); -+ wp_presentation->Feedback(client, resource, surface, callback); -+} -+ -+} // namespace -+ -+const struct wp_presentation_interface kMockWpPresentationImpl = { -+ &DestroyResource, // destroy -+ &Feedback, // feedback -+}; -+ -+MockWpPresentation::MockWpPresentation() -+ : GlobalObject(&wp_presentation_interface, &kMockWpPresentationImpl, 1) {} -+ -+MockWpPresentation::~MockWpPresentation() {} -+ -+void MockWpPresentation::SendPresentationCallback() { -+ if (!presentation_callback_) -+ return; -+ -+ // TODO(msisov): add support for test provided presentation feedback values. -+ wp_presentation_feedback_send_presented( -+ presentation_callback_, 0 /* tv_sec_hi */, 0 /* tv_sec_lo */, -+ 0 /* tv_nsec */, 0 /* refresh */, 0 /* seq_hi */, 0 /* seq_lo */, -+ 0 /* flags */); -+ wl_client_flush(wl_resource_get_client(presentation_callback_)); -+ wl_resource_destroy(presentation_callback_); -+ presentation_callback_ = nullptr; -+} -+ -+} // namespace wl -diff --git a/ui/ozone/platform/wayland/test/mock_wp_presentation.h b/ui/ozone/platform/wayland/test/mock_wp_presentation.h -new file mode 100644 -index 000000000000..a1bb344fd5f1 ---- /dev/null -+++ b/ui/ozone/platform/wayland/test/mock_wp_presentation.h -@@ -0,0 +1,47 @@ -+// Copyright 2019 The Chromium Authors. All rights reserved. -+// Use of this source code is governed by a BSD-style license that can be -+// found in the LICENSE file. -+ -+#ifndef UI_OZONE_PLATFORM_WAYLAND_TEST_MOCK_WP_PRESENTATION_H_ -+#define UI_OZONE_PLATFORM_WAYLAND_TEST_MOCK_WP_PRESENTATION_H_ -+ -+#include <presentation-time-server-protocol.h> -+ -+#include "base/logging.h" -+#include "base/macros.h" -+#include "testing/gmock/include/gmock/gmock.h" -+#include "ui/ozone/platform/wayland/test/global_object.h" -+ -+namespace wl { -+ -+extern const struct wp_presentation_interface kMockWpPresentationImpl; -+ -+class MockWpPresentation : public GlobalObject { -+ public: -+ MockWpPresentation(); -+ ~MockWpPresentation() override; -+ -+ MOCK_METHOD2(Destroy, -+ void(struct wl_client* client, struct wl_resource* resource)); -+ MOCK_METHOD4(Feedback, -+ void(struct wl_client* client, -+ struct wl_resource* resource, -+ struct wl_resource* surface, -+ uint32_t callback)); -+ -+ void set_presentation_callback(wl_resource* callback_resource) { -+ DCHECK(!presentation_callback_); -+ presentation_callback_ = callback_resource; -+ } -+ -+ void SendPresentationCallback(); -+ -+ private: -+ wl_resource* presentation_callback_ = nullptr; -+ -+ DISALLOW_COPY_AND_ASSIGN(MockWpPresentation); -+}; -+ -+} // namespace wl -+ -+#endif // UI_OZONE_PLATFORM_WAYLAND_TEST_MOCK_WP_PRESENTATION_H_ -diff --git a/ui/ozone/platform/wayland/test/test_wayland_server_thread.cc b/ui/ozone/platform/wayland/test/test_wayland_server_thread.cc -index 22b1776ebc4e..1101cccb6922 100644 ---- a/ui/ozone/platform/wayland/test/test_wayland_server_thread.cc -+++ b/ui/ozone/platform/wayland/test/test_wayland_server_thread.cc -@@ -107,6 +107,12 @@ void TestWaylandServerThread::Resume() { - resume_event_.Signal(); - } - -+MockWpPresentation* TestWaylandServerThread::EnsureWpPresentation() { -+ if (wp_presentation_.Initialize(display_.get())) -+ return &wp_presentation_; -+ return nullptr; -+} -+ - void TestWaylandServerThread::DoPause() { - base::RunLoop().RunUntilIdle(); - pause_event_.Signal(); -diff --git a/ui/ozone/platform/wayland/test/test_wayland_server_thread.h b/ui/ozone/platform/wayland/test/test_wayland_server_thread.h -index fddd426db690..110e3ffbc1c2 100644 ---- a/ui/ozone/platform/wayland/test/test_wayland_server_thread.h -+++ b/ui/ozone/platform/wayland/test/test_wayland_server_thread.h -@@ -13,6 +13,7 @@ - #include "base/synchronization/waitable_event.h" - #include "base/threading/thread.h" - #include "ui/ozone/platform/wayland/test/global_object.h" -+#include "ui/ozone/platform/wayland/test/mock_wp_presentation.h" - #include "ui/ozone/platform/wayland/test/mock_xdg_shell.h" - #include "ui/ozone/platform/wayland/test/mock_zwp_linux_dmabuf.h" - #include "ui/ozone/platform/wayland/test/test_compositor.h" -@@ -53,6 +54,9 @@ class TestWaylandServerThread : public base::Thread, - // Resumes the server thread after flushing client connections. - void Resume(); - -+ // Initializes and returns WpPresentation. -+ MockWpPresentation* EnsureWpPresentation(); -+ - template <typename T> - T* GetObject(uint32_t id) { - wl_resource* resource = wl_client_get_object(client_, id); -@@ -104,6 +108,7 @@ class TestWaylandServerThread : public base::Thread, - MockZxdgShellV6 zxdg_shell_v6_; - TestZwpTextInputManagerV1 zwp_text_input_manager_v1_; - MockZwpLinuxDmabufV1 zwp_linux_dmabuf_v1_; -+ MockWpPresentation wp_presentation_; - - std::vector<std::unique_ptr<GlobalObject>> globals_; - --- -2.23.0 - diff --git a/0002-ozone-wayland-Use-mutex-before-accessing-surfaces-ma.patch b/0002-ozone-wayland-Use-mutex-before-accessing-surfaces-ma.patch deleted file mode 100644 index afc444445c70..000000000000 --- a/0002-ozone-wayland-Use-mutex-before-accessing-surfaces-ma.patch +++ /dev/null @@ -1,276 +0,0 @@ -From 32995db96a44b8110baae213b098a70cacbad9d3 Mon Sep 17 00:00:00 2001 -From: Maksim Sisov <msisov@igalia.com> -Date: Mon, 5 Aug 2019 16:14:47 +0300 -Subject: [PATCH 2/6] [ozone/wayland] Use mutex before accessing surfaces map. - -We must make sure that accessing surfaces map from different threads -is safe. Otherwise, this is subject to races and unexpected crashes. - -Bug: 987950 -Change-Id: I2e70e9c1ad48943be518c3571b7ca1fb91f8d51b ---- - ui/ozone/platform/wayland/BUILD.gn | 1 + - .../wayland/gpu/gbm_pixmap_wayland.cc | 6 +- - .../wayland/gpu/gbm_surfaceless_wayland.cc | 2 +- - .../wayland/gpu/wayland_buffer_manager_gpu.cc | 61 ++++++++----------- - .../wayland/gpu/wayland_buffer_manager_gpu.h | 14 ++++- - .../wayland/gpu/wayland_canvas_surface.cc | 2 +- - .../wayland/gpu/wayland_surface_gpu.cc | 16 +++++ - .../wayland/gpu/wayland_surface_gpu.h | 13 +++- - 8 files changed, 72 insertions(+), 43 deletions(-) - create mode 100644 ui/ozone/platform/wayland/gpu/wayland_surface_gpu.cc - -diff --git a/ui/ozone/platform/wayland/BUILD.gn b/ui/ozone/platform/wayland/BUILD.gn -index 95f20b1fb288..3dbb00bc6239 100644 ---- a/ui/ozone/platform/wayland/BUILD.gn -+++ b/ui/ozone/platform/wayland/BUILD.gn -@@ -30,6 +30,7 @@ source_set("wayland") { - "gpu/wayland_canvas_surface.h", - "gpu/wayland_surface_factory.cc", - "gpu/wayland_surface_factory.h", -+ "gpu/wayland_surface_gpu.cc", - "gpu/wayland_surface_gpu.h", - "host/wayland_buffer_manager_connector.cc", - "host/wayland_buffer_manager_connector.h", -diff --git a/ui/ozone/platform/wayland/gpu/gbm_pixmap_wayland.cc b/ui/ozone/platform/wayland/gpu/gbm_pixmap_wayland.cc -index 72d2419b5f84..48f2a7f655bd 100644 ---- a/ui/ozone/platform/wayland/gpu/gbm_pixmap_wayland.cc -+++ b/ui/ozone/platform/wayland/gpu/gbm_pixmap_wayland.cc -@@ -135,10 +135,10 @@ bool GbmPixmapWayland::ScheduleOverlayPlane( - const gfx::RectF& crop_rect, - bool enable_blend, - std::unique_ptr<gfx::GpuFence> gpu_fence) { -- auto* surface = buffer_manager_->GetSurface(widget); -- DCHECK(surface); -+ auto surface_weak = buffer_manager_->GetSurface(widget); -+ DCHECK(surface_weak); - GbmSurfacelessWayland* surfaceless = -- static_cast<GbmSurfacelessWayland*>(surface); -+ static_cast<GbmSurfacelessWayland*>(surface_weak.get()); - DCHECK(surfaceless); - - surfaceless->QueueOverlayPlane( -diff --git a/ui/ozone/platform/wayland/gpu/gbm_surfaceless_wayland.cc b/ui/ozone/platform/wayland/gpu/gbm_surfaceless_wayland.cc -index 70ea08acfa11..0554e772f5cb 100644 ---- a/ui/ozone/platform/wayland/gpu/gbm_surfaceless_wayland.cc -+++ b/ui/ozone/platform/wayland/gpu/gbm_surfaceless_wayland.cc -@@ -34,7 +34,7 @@ GbmSurfacelessWayland::GbmSurfacelessWayland( - has_implicit_external_sync_( - HasEGLExtension("EGL_ARM_implicit_external_sync")), - weak_factory_(this) { -- buffer_manager_->RegisterSurface(widget_, this); -+ buffer_manager_->RegisterSurface(widget_, GetWeakPtr()); - unsubmitted_frames_.push_back(std::make_unique<PendingFrame>()); - } - -diff --git a/ui/ozone/platform/wayland/gpu/wayland_buffer_manager_gpu.cc b/ui/ozone/platform/wayland/gpu/wayland_buffer_manager_gpu.cc -index 63bfa3032fde..f113a9887bdc 100644 ---- a/ui/ozone/platform/wayland/gpu/wayland_buffer_manager_gpu.cc -+++ b/ui/ozone/platform/wayland/gpu/wayland_buffer_manager_gpu.cc -@@ -43,19 +43,13 @@ void WaylandBufferManagerGpu::OnSubmission(gfx::AcceleratedWidget widget, - gfx::SwapResult swap_result) { - DCHECK(io_thread_runner_->BelongsToCurrentThread()); - DCHECK_NE(widget, gfx::kNullAcceleratedWidget); -- auto* surface = GetSurface(widget); -- // There can be a race between destruction and submitting the last frames. The -- // surface can be destroyed by the time the host receives a request to destroy -- // a buffer, and is able to call the OnSubmission for that specific buffer. -- if (surface) { -- // As long as mojo calls rerouted to the IO child thread, we have to reroute -- // them back to the same thread, where the original commit buffer call came -- // from. -- commit_thread_runner_->PostTask( -- FROM_HERE, -- base::Bind(&WaylandSurfaceGpu::OnSubmission, base::Unretained(surface), -- buffer_id, swap_result)); -- } -+ auto surface = GetSurface(widget); -+ // As long as mojo calls rerouted to the IO child thread, we have to reroute -+ // them back to the same thread, where the original commit buffer call came -+ // from. -+ commit_thread_runner_->PostTask( -+ FROM_HERE, base::Bind(&WaylandSurfaceGpu::OnSubmission, surface, -+ buffer_id, swap_result)); - } - - void WaylandBufferManagerGpu::OnPresentation( -@@ -64,36 +58,35 @@ void WaylandBufferManagerGpu::OnPresentation( - const gfx::PresentationFeedback& feedback) { - DCHECK(io_thread_runner_->BelongsToCurrentThread()); - DCHECK_NE(widget, gfx::kNullAcceleratedWidget); -- auto* surface = GetSurface(widget); -- // There can be a race between destruction and presenting the last frames. The -- // surface can be destroyed by the time the host receives a request to destroy -- // a buffer, and is able to call the OnPresentation for that specific buffer. -- if (surface) { -- // As long as mojo calls rerouted to the IO child thread, we have to reroute -- // them back to the same thread, where the original commit buffer call came -- // from. -- commit_thread_runner_->PostTask( -- FROM_HERE, base::Bind(&WaylandSurfaceGpu::OnPresentation, -- base::Unretained(surface), buffer_id, feedback)); -- } --} -- --void WaylandBufferManagerGpu::RegisterSurface(gfx::AcceleratedWidget widget, -- WaylandSurfaceGpu* surface) { -+ auto surface = GetSurface(widget); -+ // As long as mojo calls rerouted to the IO child thread, we have to reroute -+ // them back to the same thread, where the original commit buffer call came -+ // from. -+ commit_thread_runner_->PostTask( -+ FROM_HERE, base::Bind(&WaylandSurfaceGpu::OnPresentation, surface, -+ buffer_id, feedback)); -+} -+ -+void WaylandBufferManagerGpu::RegisterSurface( -+ gfx::AcceleratedWidget widget, -+ base::WeakPtr<WaylandSurfaceGpu> surface) { -+ base::AutoLock scoped_lock(lock_); - widget_to_surface_map_.insert(std::make_pair(widget, surface)); - } - - void WaylandBufferManagerGpu::UnregisterSurface(gfx::AcceleratedWidget widget) { -+ base::AutoLock scoped_lock(lock_); - widget_to_surface_map_.erase(widget); - } - --WaylandSurfaceGpu* WaylandBufferManagerGpu::GetSurface( -- gfx::AcceleratedWidget widget) const { -- WaylandSurfaceGpu* surface = nullptr; -+base::WeakPtr<WaylandSurfaceGpu> WaylandBufferManagerGpu::GetSurface( -+ gfx::AcceleratedWidget widget) { -+ base::AutoLock scoped_lock(lock_); -+ - auto it = widget_to_surface_map_.find(widget); - if (it != widget_to_surface_map_.end()) -- surface = it->second; -- return surface; -+ return it->second; -+ return nullptr; - } - - void WaylandBufferManagerGpu::CreateDmabufBasedBuffer( -diff --git a/ui/ozone/platform/wayland/gpu/wayland_buffer_manager_gpu.h b/ui/ozone/platform/wayland/gpu/wayland_buffer_manager_gpu.h -index 87439610cfc3..631d715e719e 100644 ---- a/ui/ozone/platform/wayland/gpu/wayland_buffer_manager_gpu.h -+++ b/ui/ozone/platform/wayland/gpu/wayland_buffer_manager_gpu.h -@@ -8,6 +8,8 @@ - #include <memory> - - #include "base/macros.h" -+#include "base/memory/weak_ptr.h" -+#include "base/synchronization/lock.h" - #include "base/threading/sequenced_task_runner_handle.h" - #include "base/threading/thread_checker.h" - #include "mojo/public/cpp/bindings/associated_binding.h" -@@ -64,9 +66,11 @@ class WaylandBufferManagerGpu : public ozone::mojom::WaylandBufferManagerGpu { - // result of the below operations, they must register themselves with the - // below APIs. - void RegisterSurface(gfx::AcceleratedWidget widget, -- WaylandSurfaceGpu* surface); -+ base::WeakPtr<WaylandSurfaceGpu> surface); - void UnregisterSurface(gfx::AcceleratedWidget widget); -- WaylandSurfaceGpu* GetSurface(gfx::AcceleratedWidget widget) const; -+ // A client of this method must always get and acquire lock before doing -+ // any manipulations with the surface. Once done, the lock must be released. -+ base::WeakPtr<WaylandSurfaceGpu> GetSurface(gfx::AcceleratedWidget widget); - - // Methods, which can be used when in both in-process-gpu and out of process - // modes. These calls are forwarded to the browser process through the -@@ -156,7 +160,8 @@ class WaylandBufferManagerGpu : public ozone::mojom::WaylandBufferManagerGpu { - mojo::AssociatedBinding<ozone::mojom::WaylandBufferManagerGpu> - associated_binding_; - -- std::map<gfx::AcceleratedWidget, WaylandSurfaceGpu*> widget_to_surface_map_; -+ std::map<gfx::AcceleratedWidget, base::WeakPtr<WaylandSurfaceGpu>> -+ widget_to_surface_map_; // Guarded by |lock_|. - - // This task runner can be used to pass messages back to the same thread, - // where the commit buffer request came from. For example, swap requests come -@@ -171,6 +176,9 @@ class WaylandBufferManagerGpu : public ozone::mojom::WaylandBufferManagerGpu { - // needed to ensure mojo calls happen on a right sequence. - scoped_refptr<base::SingleThreadTaskRunner> io_thread_runner_; - -+ // Protects access to |widget_to_surface_map_|. -+ base::Lock lock_; -+ - DISALLOW_COPY_AND_ASSIGN(WaylandBufferManagerGpu); - }; - -diff --git a/ui/ozone/platform/wayland/gpu/wayland_canvas_surface.cc b/ui/ozone/platform/wayland/gpu/wayland_canvas_surface.cc -index 231d590296d9..d1e244e910c6 100644 ---- a/ui/ozone/platform/wayland/gpu/wayland_canvas_surface.cc -+++ b/ui/ozone/platform/wayland/gpu/wayland_canvas_surface.cc -@@ -147,7 +147,7 @@ WaylandCanvasSurface::WaylandCanvasSurface( - WaylandBufferManagerGpu* buffer_manager, - gfx::AcceleratedWidget widget) - : buffer_manager_(buffer_manager), widget_(widget) { -- buffer_manager_->RegisterSurface(widget_, this); -+ buffer_manager_->RegisterSurface(widget_, GetWeakPtr()); - } - - WaylandCanvasSurface::~WaylandCanvasSurface() { -diff --git a/ui/ozone/platform/wayland/gpu/wayland_surface_gpu.cc b/ui/ozone/platform/wayland/gpu/wayland_surface_gpu.cc -new file mode 100644 -index 000000000000..85296edcca42 ---- /dev/null -+++ b/ui/ozone/platform/wayland/gpu/wayland_surface_gpu.cc -@@ -0,0 +1,16 @@ -+// Copyright 2019 The Chromium Authors. All rights reserved. -+// Use of this source code is governed by a BSD-style license that can be -+// found in the LICENSE file. -+ -+#include "ui/ozone/platform/wayland/gpu/wayland_surface_gpu.h" -+ -+namespace ui { -+ -+WaylandSurfaceGpu::WaylandSurfaceGpu() = default; -+WaylandSurfaceGpu::~WaylandSurfaceGpu() = default; -+ -+base::WeakPtr<WaylandSurfaceGpu> WaylandSurfaceGpu::GetWeakPtr() { -+ return weak_factory_.GetWeakPtr(); -+} -+ -+} // namespace ui -diff --git a/ui/ozone/platform/wayland/gpu/wayland_surface_gpu.h b/ui/ozone/platform/wayland/gpu/wayland_surface_gpu.h -index ace5279e838e..38d285317ab3 100644 ---- a/ui/ozone/platform/wayland/gpu/wayland_surface_gpu.h -+++ b/ui/ozone/platform/wayland/gpu/wayland_surface_gpu.h -@@ -8,6 +8,7 @@ - #include <memory> - - #include "base/macros.h" -+#include "base/memory/weak_ptr.h" - - namespace gfx { - enum class SwapResult; -@@ -22,7 +23,7 @@ namespace ui { - // the buffer. - class WaylandSurfaceGpu { - public: -- virtual ~WaylandSurfaceGpu() {} -+ virtual ~WaylandSurfaceGpu(); - - // Tells the surface the result of the last swap of buffer with the - // |buffer_id|. -@@ -33,6 +34,16 @@ class WaylandSurfaceGpu { - // |buffer_id|. - virtual void OnPresentation(uint32_t buffer_id, - const gfx::PresentationFeedback& feedback) = 0; -+ -+ protected: -+ WaylandSurfaceGpu(); -+ -+ base::WeakPtr<WaylandSurfaceGpu> GetWeakPtr(); -+ -+ private: -+ base::WeakPtrFactory<WaylandSurfaceGpu> weak_factory_{this}; -+ -+ DISALLOW_COPY_AND_ASSIGN(WaylandSurfaceGpu); - }; - - } // namespace ui --- -2.23.0 - diff --git a/0003-ozone-wayland-Stop-using-wl_display_roundtrip.patch b/0003-ozone-wayland-Stop-using-wl_display_roundtrip.patch deleted file mode 100644 index 68070c355ee6..000000000000 --- a/0003-ozone-wayland-Stop-using-wl_display_roundtrip.patch +++ /dev/null @@ -1,472 +0,0 @@ -From d246673a4c0563bda72857f47cdea9d94c6ea0d9 Mon Sep 17 00:00:00 2001 -From: Maksim Sisov <msisov@igalia.com> -Date: Thu, 8 Aug 2019 11:32:57 +0000 -Subject: [PATCH 3/6] [ozone/wayland] Stop using wl_display_roundtrip - -According to the Wayland documentation, wl_display_roundtrip is a -blocking call that can block if the event queue is empty. That is, -to be able to process buffer swap requests synchronously, -that call blocks until a frame callback comes or a wl_buffer -is attached. This results in blocking the CrBrowserMain thread. - -This change alters the logic so that the buffer manager processes -one pending buffer at a time asynchronously avoiding blocking -the thread if synchronous processing is not possible due to -two conditions: -1) a frame callback is not received, -2) a wl_frame buffer is not created. - -That is, on a frame no 1, the manager does not have a -frame callback installed and it may not process the buffer -synchronously if a wl_buffer is not created. -(note that wl_buffers can be created synchronously or asynchronously -depending on the protocol version of the zwp_linux_dmabuf[1]). -If such condition satisfies (there is no wl_buffer created), that -buffer is stored as a pending one and is processed on a -AttachWlBuffer call. Otherwise, the manager just processes -the buffer swap for the frame no 1 synchronously. - -On frames no 2 and onwards, the manager may not process -buffer swaps synchronously if a frame callback is set, but not -received. That is, whenever the manager attaches -buffers to surfaces and commits them, it sets frame callbacks, -which Wayland compositor runs whenever it is time to send next -frame. If such condition satisfies, the manager stores the buffer -and processes it on next OnFrameCallback call. Otherwise, the swap -request processed synchronously. - -[1] https://cs.chromium.org/chromium/src/ui/ozone/platform/wayland/host/wayland_zwp_linux_dmabuf.cc?g=0&l=67 - -Bug: 987821 -Test: WaylandBufferManagerTest.TestCommitBufferConditions -Change-Id: I153b2071a453856a40e23a7f0a15f61dbc01d27f -Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1726051 -Reviewed-by: Robert Kroeger <rjkroege@chromium.org> -Commit-Queue: Maksim Sisov <msisov@igalia.com> -Cr-Commit-Position: refs/heads/master@{#685143} ---- - .../host/wayland_buffer_manager_host.cc | 123 ++++++++++++------ - .../test/mock_zwp_linux_buffer_params.cc | 50 +++++-- - .../test/mock_zwp_linux_buffer_params.h | 17 +++ - .../wayland/test/mock_zwp_linux_dmabuf.cc | 34 ++++- - .../wayland/test/mock_zwp_linux_dmabuf.h | 12 ++ - 5 files changed, 175 insertions(+), 61 deletions(-) - -diff --git a/ui/ozone/platform/wayland/host/wayland_buffer_manager_host.cc b/ui/ozone/platform/wayland/host/wayland_buffer_manager_host.cc -index 1bcf85261b41..9355d47f2ec7 100644 ---- a/ui/ozone/platform/wayland/host/wayland_buffer_manager_host.cc -+++ b/ui/ozone/platform/wayland/host/wayland_buffer_manager_host.cc -@@ -63,10 +63,22 @@ class WaylandBufferManagerHost::Surface { - ~Surface() = default; - - bool CommitBuffer(uint32_t buffer_id, const gfx::Rect& damage_region) { -+ DCHECK(!pending_buffer_); -+ - WaylandBuffer* buffer = GetBuffer(buffer_id); - if (!buffer) - return false; - -+ buffer->damage_region = damage_region; -+ -+ // If the wl_buffer has been attached, but the wl_buffer still is null, it -+ // means the Wayland server failed to create the buffer and we have to fail -+ // here. -+ // -+ // TODO(msisov): should we ask to recreate buffers instead of failing? -+ if (buffer->attached && !buffer->wl_buffer) -+ return false; -+ - // This request may come earlier than the Wayland compositor has imported a - // wl_buffer. Wait until the buffer is created. The wait takes place only - // once. Though, the case when a request to attach a buffer comes earlier -@@ -78,46 +90,12 @@ class WaylandBufferManagerHost::Surface { - // Another case, which always happen is waiting until the frame callback is - // completed. Thus, wait here when the Wayland compositor fires the frame - // callback. -- while (!buffer->wl_buffer || !!wl_frame_callback_) { -- // If the wl_buffer has been attached, but the wl_buffer still has been -- // null, it means the Wayland server failed to create the buffer and we -- // have to fail here. -- if ((buffer->attached && !buffer->wl_buffer) || -- wl_display_roundtrip(connection_->display()) == -1) -- return false; -+ if (!buffer->wl_buffer || wl_frame_callback_) { -+ pending_buffer_ = buffer; -+ return true; - } - -- // Once the BufferRelease is called, the buffer will be released. -- DCHECK(buffer->released); -- buffer->released = false; -- -- DCHECK(!submitted_buffer_); -- submitted_buffer_ = buffer; -- -- AttachAndDamageBuffer(buffer, damage_region); -- -- SetupFrameCallback(); -- SetupPresentationFeedback(buffer_id); -- -- CommitSurface(); -- -- connection_->ScheduleFlush(); -- -- // If the contents were reset, there is no buffer attached. It means we have -- // to behave the same way as if it was the very first frame. Check the -- // comment below where the |contents_reset_| is declared. -- if (contents_reset_) { -- prev_submitted_buffer_ = nullptr; -- contents_reset_ = false; -- } -- -- // If it was the very first frame, the surface has not had a back buffer -- // before, and Wayland won't release the front buffer until next buffer is -- // attached. Thus, notify about successful submission immediately. -- if (!prev_submitted_buffer_) -- CompleteSubmission(); -- -- return true; -+ return CommitBufferInternal(buffer); - } - - bool CreateBuffer(const gfx::Size& size, uint32_t buffer_id) { -@@ -150,6 +128,9 @@ class WaylandBufferManagerHost::Surface { - if (prev_submitted_buffer_ == buffer) - prev_submitted_buffer_ = nullptr; - -+ if (pending_buffer_ == buffer) -+ pending_buffer_ = nullptr; -+ - auto result = buffers_.erase(buffer_id); - return result; - } -@@ -167,6 +148,9 @@ class WaylandBufferManagerHost::Surface { - - if (buffer->wl_buffer) - SetupBufferReleaseListener(buffer); -+ -+ if (pending_buffer_ == buffer) -+ ProcessPendingBuffer(); - } - - void ClearState() { -@@ -213,6 +197,10 @@ class WaylandBufferManagerHost::Surface { - // Actual buffer size. - const gfx::Size size; - -+ // Damage region this buffer describes. Must be emptied once buffer is -+ // submitted. -+ gfx::Rect damage_region; -+ - // The id of this buffer. - const uint32_t buffer_id; - -@@ -239,9 +227,45 @@ class WaylandBufferManagerHost::Surface { - DISALLOW_COPY_AND_ASSIGN(WaylandBuffer); - }; - -- void AttachAndDamageBuffer(WaylandBuffer* buffer, -- const gfx::Rect& damage_region) { -- gfx::Rect pending_damage_region = damage_region; -+ bool CommitBufferInternal(WaylandBuffer* buffer) { -+ DCHECK(buffer); -+ DCHECK(!pending_buffer_); -+ -+ // Once the BufferRelease is called, the buffer will be released. -+ DCHECK(buffer->released); -+ buffer->released = false; -+ -+ DCHECK(!submitted_buffer_); -+ submitted_buffer_ = buffer; -+ -+ AttachAndDamageBuffer(buffer); -+ -+ SetupFrameCallback(); -+ SetupPresentationFeedback(buffer->buffer_id); -+ -+ CommitSurface(); -+ -+ connection_->ScheduleFlush(); -+ -+ // If the contents were reset, there is no buffer attached. It means we have -+ // to behave the same way as if it was the very first frame. Check the -+ // comment below where the |contents_reset_| is declared. -+ if (contents_reset_) { -+ prev_submitted_buffer_ = nullptr; -+ contents_reset_ = false; -+ } -+ -+ // If it was the very first frame, the surface has not had a back buffer -+ // before, and Wayland won't release the front buffer until next buffer is -+ // attached. Thus, notify about successful submission immediately. -+ if (!prev_submitted_buffer_) -+ CompleteSubmission(); -+ -+ return true; -+ } -+ -+ void AttachAndDamageBuffer(WaylandBuffer* buffer) { -+ gfx::Rect pending_damage_region = std::move(buffer->damage_region); - // If the size of the damage region is empty, wl_surface_damage must be - // supplied with the actual size of the buffer, which is going to be - // committed. -@@ -299,6 +323,8 @@ class WaylandBufferManagerHost::Surface { - void OnFrameCallback(struct wl_callback* callback) { - DCHECK(wl_frame_callback_.get() == callback); - wl_frame_callback_.reset(); -+ -+ ProcessPendingBuffer(); - } - - // wl_callback_listener -@@ -390,7 +416,8 @@ class WaylandBufferManagerHost::Surface { - const gfx::PresentationFeedback& feedback) { - // The order of submission and presentation callbacks cannot be controlled. - // Some Wayland compositors may fire presentation callbacks earlier than we -- // are able to send submission callbacks and this is bad. Thus, handle it here. -+ // are able to send submission callbacks and this is bad. Thus, handle it -+ // here. - if (submitted_buffer_ && submitted_buffer_->buffer_id == buffer_id) { - submitted_buffer_->needs_send_feedback = true; - submitted_buffer_->feedback = feedback; -@@ -441,6 +468,15 @@ class WaylandBufferManagerHost::Surface { - gfx::PresentationFeedback::Failure()); - } - -+ void ProcessPendingBuffer() { -+ if (!pending_buffer_) -+ return; -+ -+ auto* buffer = pending_buffer_; -+ pending_buffer_ = nullptr; -+ CommitBufferInternal(buffer); -+ } -+ - // Widget this helper surface backs and has 1:1 relationship with the - // WaylandWindow. - -@@ -465,6 +501,9 @@ class WaylandBufferManagerHost::Surface { - // shown. - PresentationFeedbackQueue presentation_feedbacks_; - -+ // A buffer, which is pending to be submitted (look the comment in the -+ // CommitBuffer method). -+ WaylandBuffer* pending_buffer_ = nullptr; - // Current submitted buffer. - WaylandBuffer* submitted_buffer_ = nullptr; - // Previous submitted buffer. -diff --git a/ui/ozone/platform/wayland/test/mock_zwp_linux_buffer_params.cc b/ui/ozone/platform/wayland/test/mock_zwp_linux_buffer_params.cc -index ca7fa6add5b9..8ebe4e6444db 100644 ---- a/ui/ozone/platform/wayland/test/mock_zwp_linux_buffer_params.cc -+++ b/ui/ozone/platform/wayland/test/mock_zwp_linux_buffer_params.cc -@@ -5,6 +5,7 @@ - #include "ui/ozone/platform/wayland/test/mock_zwp_linux_buffer_params.h" - - #include "ui/ozone/platform/wayland/test/mock_buffer.h" -+#include "ui/ozone/platform/wayland/test/mock_zwp_linux_dmabuf.h" - - namespace wl { - -@@ -25,6 +26,20 @@ void Add(wl_client* client, - modifier_hi, modifier_lo); - } - -+void CreateCommon(MockZwpLinuxBufferParamsV1* buffer_params, -+ wl_client* client, -+ int32_t width, -+ int32_t height, -+ uint32_t format, -+ uint32_t flags) { -+ wl_resource* buffer_resource = -+ CreateResourceWithImpl<::testing::NiceMock<MockBuffer>>( -+ client, &wl_buffer_interface, 1, &kMockWlBufferImpl, 0, -+ std::move(buffer_params->fds_)); -+ -+ buffer_params->SetBufferResource(buffer_resource); -+} -+ - void Create(wl_client* client, - wl_resource* buffer_params_resource, - int32_t width, -@@ -33,28 +48,23 @@ void Create(wl_client* client, - uint32_t flags) { - auto* buffer_params = - GetUserDataAs<MockZwpLinuxBufferParamsV1>(buffer_params_resource); -- -- wl_resource* buffer_resource = -- CreateResourceWithImpl<::testing::NiceMock<MockBuffer>>( -- client, &wl_buffer_interface, 1, &kMockWlBufferImpl, 0, -- std::move(buffer_params->fds_)); -- -- zwp_linux_buffer_params_v1_send_created(buffer_params_resource, -- buffer_resource); -- -+ CreateCommon(buffer_params, client, width, height, format, flags); - buffer_params->Create(client, buffer_params_resource, width, height, format, - flags); - } - - void CreateImmed(wl_client* client, -- wl_resource* resource, -+ wl_resource* buffer_params_resource, - uint32_t buffer_id, - int32_t width, - int32_t height, - uint32_t format, - uint32_t flags) { -- GetUserDataAs<MockZwpLinuxBufferParamsV1>(resource)->CreateImmed( -- client, resource, buffer_id, width, height, format, flags); -+ auto* buffer_params = -+ GetUserDataAs<MockZwpLinuxBufferParamsV1>(buffer_params_resource); -+ CreateCommon(buffer_params, client, width, height, format, flags); -+ buffer_params->CreateImmed(client, buffer_params_resource, buffer_id, width, -+ height, format, flags); - } - - } // namespace -@@ -66,6 +76,20 @@ const struct zwp_linux_buffer_params_v1_interface - MockZwpLinuxBufferParamsV1::MockZwpLinuxBufferParamsV1(wl_resource* resource) - : ServerObject(resource) {} - --MockZwpLinuxBufferParamsV1::~MockZwpLinuxBufferParamsV1() {} -+MockZwpLinuxBufferParamsV1::~MockZwpLinuxBufferParamsV1() { -+ DCHECK(linux_dmabuf_); -+ linux_dmabuf_->OnBufferParamsDestroyed(this); -+} -+ -+void MockZwpLinuxBufferParamsV1::SetZwpLinuxDmabuf( -+ MockZwpLinuxDmabufV1* linux_dmabuf) { -+ DCHECK(!linux_dmabuf_); -+ linux_dmabuf_ = linux_dmabuf; -+} -+ -+void MockZwpLinuxBufferParamsV1::SetBufferResource(wl_resource* resource) { -+ DCHECK(!buffer_resource_); -+ buffer_resource_ = resource; -+} - - } // namespace wl -diff --git a/ui/ozone/platform/wayland/test/mock_zwp_linux_buffer_params.h b/ui/ozone/platform/wayland/test/mock_zwp_linux_buffer_params.h -index 57b4b9299a31..7da794a92c69 100644 ---- a/ui/ozone/platform/wayland/test/mock_zwp_linux_buffer_params.h -+++ b/ui/ozone/platform/wayland/test/mock_zwp_linux_buffer_params.h -@@ -20,6 +20,8 @@ namespace wl { - extern const struct zwp_linux_buffer_params_v1_interface - kMockZwpLinuxBufferParamsV1Impl; - -+class MockZwpLinuxDmabufV1; -+ - // Manage zwp_linux_buffer_params_v1 - class MockZwpLinuxBufferParamsV1 : public ServerObject { - public: -@@ -52,9 +54,24 @@ class MockZwpLinuxBufferParamsV1 : public ServerObject { - uint32_t format, - uint32_t flags)); - -+ wl_resource* buffer_resource() const { return buffer_resource_; } -+ -+ void SetZwpLinuxDmabuf(MockZwpLinuxDmabufV1* linux_dmabuf); -+ -+ void SetBufferResource(wl_resource* resource); -+ - std::vector<base::ScopedFD> fds_; - - private: -+ // Non-owned pointer to the linux dmabuf object, which created this params -+ // resource and holds a pointer to it. On destruction, must notify it about -+ // going out of scope. -+ MockZwpLinuxDmabufV1* linux_dmabuf_ = nullptr; -+ -+ // A buffer resource, which is created on Create or CreateImmed call. Can be -+ // null if not created/failed to be created. -+ wl_resource* buffer_resource_ = nullptr; -+ - DISALLOW_COPY_AND_ASSIGN(MockZwpLinuxBufferParamsV1); - }; - -diff --git a/ui/ozone/platform/wayland/test/mock_zwp_linux_dmabuf.cc b/ui/ozone/platform/wayland/test/mock_zwp_linux_dmabuf.cc -index c44d41a40bb7..006d55ff40f4 100644 ---- a/ui/ozone/platform/wayland/test/mock_zwp_linux_dmabuf.cc -+++ b/ui/ozone/platform/wayland/test/mock_zwp_linux_dmabuf.cc -@@ -17,12 +17,20 @@ namespace { - constexpr uint32_t kLinuxDmabufVersion = 1; - - void CreateParams(wl_client* client, wl_resource* resource, uint32_t id) { -- CreateResourceWithImpl<::testing::NiceMock<MockZwpLinuxBufferParamsV1>>( -- client, &zwp_linux_buffer_params_v1_interface, -- wl_resource_get_version(resource), &kMockZwpLinuxBufferParamsV1Impl, id); -+ wl_resource* params_resource = -+ CreateResourceWithImpl<::testing::NiceMock<MockZwpLinuxBufferParamsV1>>( -+ client, &zwp_linux_buffer_params_v1_interface, -+ wl_resource_get_version(resource), &kMockZwpLinuxBufferParamsV1Impl, -+ id); - -- GetUserDataAs<MockZwpLinuxDmabufV1>(resource)->CreateParams(client, resource, -- id); -+ auto* zwp_linux_dmabuf = GetUserDataAs<MockZwpLinuxDmabufV1>(resource); -+ auto* buffer_params = -+ GetUserDataAs<MockZwpLinuxBufferParamsV1>(params_resource); -+ -+ DCHECK(buffer_params); -+ zwp_linux_dmabuf->StoreBufferParams(buffer_params); -+ buffer_params->SetZwpLinuxDmabuf(zwp_linux_dmabuf); -+ zwp_linux_dmabuf->CreateParams(client, resource, id); - } - - } // namespace -@@ -37,6 +45,20 @@ MockZwpLinuxDmabufV1::MockZwpLinuxDmabufV1() - &kMockZwpLinuxDmabufV1Impl, - kLinuxDmabufVersion) {} - --MockZwpLinuxDmabufV1::~MockZwpLinuxDmabufV1() {} -+MockZwpLinuxDmabufV1::~MockZwpLinuxDmabufV1() { -+ DCHECK(buffer_params_.empty()); -+} -+ -+void MockZwpLinuxDmabufV1::StoreBufferParams( -+ MockZwpLinuxBufferParamsV1* params) { -+ buffer_params_.push_back(params); -+} -+ -+void MockZwpLinuxDmabufV1::OnBufferParamsDestroyed( -+ MockZwpLinuxBufferParamsV1* params) { -+ auto it = std::find(buffer_params_.begin(), buffer_params_.end(), params); -+ DCHECK(it != buffer_params_.end()); -+ buffer_params_.erase(it); -+} - - } // namespace wl -diff --git a/ui/ozone/platform/wayland/test/mock_zwp_linux_dmabuf.h b/ui/ozone/platform/wayland/test/mock_zwp_linux_dmabuf.h -index f63b92d34a50..9d2e1077d79f 100644 ---- a/ui/ozone/platform/wayland/test/mock_zwp_linux_dmabuf.h -+++ b/ui/ozone/platform/wayland/test/mock_zwp_linux_dmabuf.h -@@ -18,6 +18,8 @@ namespace wl { - - extern const struct zwp_linux_dmabuf_v1_interface kMockZwpLinuxDmabufV1Impl; - -+class MockZwpLinuxBufferParamsV1; -+ - // Manage zwp_linux_dmabuf_v1 object. - class MockZwpLinuxDmabufV1 : public GlobalObject { - public: -@@ -30,7 +32,17 @@ class MockZwpLinuxDmabufV1 : public GlobalObject { - wl_resource* resource, - uint32_t params_id)); - -+ const std::vector<MockZwpLinuxBufferParamsV1*>& buffer_params() const { -+ return buffer_params_; -+ } -+ -+ void StoreBufferParams(MockZwpLinuxBufferParamsV1* params); -+ -+ void OnBufferParamsDestroyed(MockZwpLinuxBufferParamsV1* params); -+ - private: -+ std::vector<MockZwpLinuxBufferParamsV1*> buffer_params_; -+ - DISALLOW_COPY_AND_ASSIGN(MockZwpLinuxDmabufV1); - }; - --- -2.23.0 - diff --git a/0004-ozone-wayland-Extract-window-management-methods-to-o.patch b/0004-ozone-wayland-Extract-window-management-methods-to-o.patch deleted file mode 100644 index 92b8e44600bd..000000000000 --- a/0004-ozone-wayland-Extract-window-management-methods-to-o.patch +++ /dev/null @@ -1,810 +0,0 @@ -From a2d8f90a8231633673f3545dba65c5582815ce3b Mon Sep 17 00:00:00 2001 -From: Maksim Sisov <msisov@igalia.com> -Date: Fri, 26 Jul 2019 04:56:22 +0000 -Subject: [PATCH 4/6] [ozone/wayland]: Extract window management methods to own - class - -WaylandConnection still has been overloaded with different tasks. - -Thus, to make code cleaner, extract window management methods into -a separate class called WaylandWindowManager, which is responsible -for managing windows. - -Bug: 987239 -Change-Id: Ic74291842e24e919dae7335ebb7c89b08a81a61c -Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1715193 -Commit-Queue: Maksim Sisov <msisov@igalia.com> -Reviewed-by: Antonio Gomes <tonikitoo@igalia.com> -Cr-Commit-Position: refs/heads/master@{#681191} ---- - ui/ozone/platform/wayland/BUILD.gn | 3 + - .../wayland/gpu/wayland_surface_factory.cc | 4 +- - .../wayland/host/wayland_connection.cc | 69 +----- - .../wayland/host/wayland_connection.h | 23 +- - .../wayland/host/wayland_data_device.cc | 4 +- - .../wayland/host/wayland_data_source.cc | 3 +- - .../host/wayland_input_method_context.cc | 3 +- - .../platform/wayland/host/wayland_screen.cc | 13 +- - .../platform/wayland/host/wayland_window.cc | 18 +- - .../wayland/host/wayland_window_manager.cc | 90 +++++++ - .../wayland/host/wayland_window_manager.h | 60 +++++ - .../host/wayland_window_manager_unittests.cc | 222 ++++++++++++++++++ - 12 files changed, 424 insertions(+), 88 deletions(-) - create mode 100644 ui/ozone/platform/wayland/host/wayland_window_manager.cc - create mode 100644 ui/ozone/platform/wayland/host/wayland_window_manager.h - create mode 100644 ui/ozone/platform/wayland/host/wayland_window_manager_unittests.cc - -diff --git a/ui/ozone/platform/wayland/BUILD.gn b/ui/ozone/platform/wayland/BUILD.gn -index 3dbb00bc6239..8c6f4a0dece6 100644 ---- a/ui/ozone/platform/wayland/BUILD.gn -+++ b/ui/ozone/platform/wayland/BUILD.gn -@@ -74,6 +74,8 @@ source_set("wayland") { - "host/wayland_touch.h", - "host/wayland_window.cc", - "host/wayland_window.h", -+ "host/wayland_window_manager.cc", -+ "host/wayland_window_manager.h", - "host/wayland_zwp_linux_dmabuf.cc", - "host/wayland_zwp_linux_dmabuf.h", - "host/xdg_popup_wrapper.h", -@@ -249,6 +251,7 @@ source_set("wayland_unittests") { - "host/wayland_pointer_unittest.cc", - "host/wayland_screen_unittest.cc", - "host/wayland_touch_unittest.cc", -+ "host/wayland_window_manager_unittests.cc", - "host/wayland_window_unittest.cc", - "test/wayland_test.cc", - "test/wayland_test.h", -diff --git a/ui/ozone/platform/wayland/gpu/wayland_surface_factory.cc b/ui/ozone/platform/wayland/gpu/wayland_surface_factory.cc -index b5dba5fd525b..a5db42ef1b18 100644 ---- a/ui/ozone/platform/wayland/gpu/wayland_surface_factory.cc -+++ b/ui/ozone/platform/wayland/gpu/wayland_surface_factory.cc -@@ -16,6 +16,7 @@ - #include "ui/ozone/platform/wayland/gpu/wayland_canvas_surface.h" - #include "ui/ozone/platform/wayland/host/wayland_connection.h" - #include "ui/ozone/platform/wayland/host/wayland_window.h" -+#include "ui/ozone/platform/wayland/host/wayland_window_manager.h" - - #if defined(WAYLAND_GBM) - #include "ui/ozone/platform/wayland/gpu/gbm_pixmap_wayland.h" -@@ -61,7 +62,8 @@ scoped_refptr<gl::GLSurface> GLOzoneEGLWayland::CreateViewGLSurface( - !connection_) - return nullptr; - -- WaylandWindow* window = connection_->GetWindow(widget); -+ WaylandWindow* window = -+ connection_->wayland_window_manager()->GetWindow(widget); - if (!window) - return nullptr; - -diff --git a/ui/ozone/platform/wayland/host/wayland_connection.cc b/ui/ozone/platform/wayland/host/wayland_connection.cc -index a949baf5a934..bf6d12717861 100644 ---- a/ui/ozone/platform/wayland/host/wayland_connection.cc -+++ b/ui/ozone/platform/wayland/host/wayland_connection.cc -@@ -45,7 +45,8 @@ constexpr uint32_t kMaxTextInputManagerVersion = 1; - constexpr uint32_t kMinWlOutputVersion = 2; - } // namespace - --WaylandConnection::WaylandConnection() : controller_(FROM_HERE) {} -+WaylandConnection::WaylandConnection() -+ : wayland_window_manager_(this), controller_(FROM_HERE) {} - - WaylandConnection::~WaylandConnection() = default; - -@@ -122,70 +123,17 @@ void WaylandConnection::ScheduleFlush() { - scheduled_flush_ = true; - } - --WaylandWindow* WaylandConnection::GetWindow( -- gfx::AcceleratedWidget widget) const { -- auto it = window_map_.find(widget); -- return it == window_map_.end() ? nullptr : it->second; --} -- --WaylandWindow* WaylandConnection::GetWindowWithLargestBounds() const { -- WaylandWindow* window_with_largest_bounds = nullptr; -- for (auto entry : window_map_) { -- if (!window_with_largest_bounds) { -- window_with_largest_bounds = entry.second; -- continue; -- } -- WaylandWindow* window = entry.second; -- if (window_with_largest_bounds->GetBounds() < window->GetBounds()) -- window_with_largest_bounds = window; -- } -- return window_with_largest_bounds; --} -- --WaylandWindow* WaylandConnection::GetCurrentFocusedWindow() const { -- for (auto entry : window_map_) { -- WaylandWindow* window = entry.second; -- if (window->has_pointer_focus()) -- return window; -- } -- return nullptr; --} -- --WaylandWindow* WaylandConnection::GetCurrentKeyboardFocusedWindow() const { -- for (auto entry : window_map_) { -- WaylandWindow* window = entry.second; -- if (window->has_keyboard_focus()) -- return window; -- } -- return nullptr; --} -- --std::vector<WaylandWindow*> WaylandConnection::GetWindowsOnOutput( -- uint32_t output_id) { -- std::vector<WaylandWindow*> result; -- for (auto entry : window_map_) { -- if (entry.second->entered_outputs_ids().count(output_id) > 0) -- result.push_back(entry.second); -- } -- return result; --} -- --void WaylandConnection::AddWindow(gfx::AcceleratedWidget widget, -- WaylandWindow* window) { -+void WaylandConnection::OnWindowAdded(WaylandWindow* window) { - DCHECK(buffer_manager_host_); - buffer_manager_host_->OnWindowAdded(window); -- -- window_map_[widget] = window; - } - --void WaylandConnection::RemoveWindow(gfx::AcceleratedWidget widget) { -+void WaylandConnection::OnWindowRemoved(WaylandWindow* window) { - if (touch_) -- touch_->RemoveTouchPoints(window_map_[widget]); -+ touch_->RemoveTouchPoints(window); - - DCHECK(buffer_manager_host_); -- buffer_manager_host_->OnWindowRemoved(window_map_[widget]); -- -- window_map_.erase(widget); -+ buffer_manager_host_->OnWindowRemoved(window); - } - - void WaylandConnection::SetCursorBitmap(const std::vector<SkBitmap>& bitmaps, -@@ -260,8 +208,9 @@ void WaylandConnection::DispatchUiEvent(Event* event) { - - void WaylandConnection::OnFileCanReadWithoutBlocking(int fd) { - wl_display_dispatch(display_.get()); -- for (const auto& window : window_map_) -- window.second->ApplyPendingBounds(); -+ std::vector<WaylandWindow*> windows = wayland_window_manager_.GetAllWindows(); -+ for (auto* window : windows) -+ window->ApplyPendingBounds(); - } - - void WaylandConnection::OnFileCanWriteWithoutBlocking(int fd) {} -diff --git a/ui/ozone/platform/wayland/host/wayland_connection.h b/ui/ozone/platform/wayland/host/wayland_connection.h -index 9ae6527337c6..8a56ebc6b921 100644 ---- a/ui/ozone/platform/wayland/host/wayland_connection.h -+++ b/ui/ozone/platform/wayland/host/wayland_connection.h -@@ -25,6 +25,7 @@ - #include "ui/ozone/platform/wayland/host/wayland_output.h" - #include "ui/ozone/platform/wayland/host/wayland_pointer.h" - #include "ui/ozone/platform/wayland/host/wayland_touch.h" -+#include "ui/ozone/platform/wayland/host/wayland_window_manager.h" - - namespace ui { - -@@ -46,6 +47,9 @@ class WaylandConnection : public PlatformEventSource, - // Schedules a flush of the Wayland connection. - void ScheduleFlush(); - -+ void OnWindowAdded(WaylandWindow* window); -+ void OnWindowRemoved(WaylandWindow* window); -+ - wl_display* display() const { return display_.get(); } - wl_compositor* compositor() const { return compositor_.get(); } - wl_subcompositor* subcompositor() const { return subcompositor_.get(); } -@@ -58,16 +62,6 @@ class WaylandConnection : public PlatformEventSource, - return text_input_manager_v1_.get(); - } - -- WaylandWindow* GetWindow(gfx::AcceleratedWidget widget) const; -- WaylandWindow* GetWindowWithLargestBounds() const; -- WaylandWindow* GetCurrentFocusedWindow() const; -- WaylandWindow* GetCurrentKeyboardFocusedWindow() const; -- // TODO(crbug.com/971525): remove this in favor of targeted subscription of -- // windows to their outputs. -- std::vector<WaylandWindow*> GetWindowsOnOutput(uint32_t output_id); -- void AddWindow(gfx::AcceleratedWidget widget, WaylandWindow* window); -- void RemoveWindow(gfx::AcceleratedWidget widget); -- - void set_serial(uint32_t serial) { serial_ = serial; } - uint32_t serial() const { return serial_; } - -@@ -102,6 +96,10 @@ class WaylandConnection : public PlatformEventSource, - - WaylandShm* shm() const { return shm_.get(); } - -+ WaylandWindowManager* wayland_window_manager() { -+ return &wayland_window_manager_; -+ } -+ - std::vector<gfx::BufferFormat> GetSupportedBufferFormats(); - - // Starts drag with |data| to be delivered, |operation| supported by the -@@ -166,8 +164,6 @@ class WaylandConnection : public PlatformEventSource, - // xdg_shell_listener - static void Ping(void* data, xdg_shell* shell, uint32_t serial); - -- base::flat_map<gfx::AcceleratedWidget, WaylandWindow*> window_map_; -- - wl::Object<wl_display> display_; - wl::Object<wl_registry> registry_; - wl::Object<wl_compositor> compositor_; -@@ -191,6 +187,9 @@ class WaylandConnection : public PlatformEventSource, - std::unique_ptr<WaylandShm> shm_; - std::unique_ptr<WaylandBufferManagerHost> buffer_manager_host_; - -+ // Manages Wayland windows. -+ WaylandWindowManager wayland_window_manager_; -+ - bool scheduled_flush_ = false; - bool watching_ = false; - base::MessagePumpLibevent::FdWatchController controller_; -diff --git a/ui/ozone/platform/wayland/host/wayland_data_device.cc b/ui/ozone/platform/wayland/host/wayland_data_device.cc -index f258e8ddba2d..a36cd3b7a888 100644 ---- a/ui/ozone/platform/wayland/host/wayland_data_device.cc -+++ b/ui/ozone/platform/wayland/host/wayland_data_device.cc -@@ -146,7 +146,9 @@ void WaylandDataDevice::DeliverDragData(const std::string& mime_type, - void WaylandDataDevice::StartDrag(wl_data_source* data_source, - const ui::OSExchangeData& data) { - DCHECK(data_source); -- WaylandWindow* window = connection_->GetCurrentFocusedWindow(); -+ -+ WaylandWindow* window = -+ connection_->wayland_window_manager()->GetCurrentFocusedWindow(); - if (!window) { - LOG(ERROR) << "Failed to get focused window."; - return; -diff --git a/ui/ozone/platform/wayland/host/wayland_data_source.cc b/ui/ozone/platform/wayland/host/wayland_data_source.cc -index f8ba38a0fa51..dcd6b75aa299 100644 ---- a/ui/ozone/platform/wayland/host/wayland_data_source.cc -+++ b/ui/ozone/platform/wayland/host/wayland_data_source.cc -@@ -50,7 +50,8 @@ void WaylandDataSource::Offer(const ui::OSExchangeData& data) { - mime_types.push_back(kTextMimeType); - mime_types.push_back(kTextMimeTypeUtf8); - -- source_window_ = connection_->GetCurrentFocusedWindow(); -+ source_window_ = -+ connection_->wayland_window_manager()->GetCurrentFocusedWindow(); - for (auto& mime_type : mime_types) - wl_data_source_offer(data_source_.get(), mime_type.data()); - } -diff --git a/ui/ozone/platform/wayland/host/wayland_input_method_context.cc b/ui/ozone/platform/wayland/host/wayland_input_method_context.cc -index 700232b9b36e..37feebecc9dc 100644 ---- a/ui/ozone/platform/wayland/host/wayland_input_method_context.cc -+++ b/ui/ozone/platform/wayland/host/wayland_input_method_context.cc -@@ -103,7 +103,8 @@ void WaylandInputMethodContext::Reset() { - } - - void WaylandInputMethodContext::Focus() { -- WaylandWindow* window = connection_->GetCurrentKeyboardFocusedWindow(); -+ WaylandWindow* window = -+ connection_->wayland_window_manager()->GetCurrentKeyboardFocusedWindow(); - if (!text_input_ || !window) - return; - -diff --git a/ui/ozone/platform/wayland/host/wayland_screen.cc b/ui/ozone/platform/wayland/host/wayland_screen.cc -index ef372ad794d3..126b252624ab 100644 ---- a/ui/ozone/platform/wayland/host/wayland_screen.cc -+++ b/ui/ozone/platform/wayland/host/wayland_screen.cc -@@ -81,7 +81,8 @@ void WaylandScreen::OnOutputMetricsChanged(uint32_t output_id, - changed_display, is_primary ? display::DisplayList::Type::PRIMARY - : display::DisplayList::Type::NOT_PRIMARY); - -- for (auto* window : connection_->GetWindowsOnOutput(output_id)) -+ auto* wayland_window_manager = connection_->wayland_window_manager(); -+ for (auto* window : wayland_window_manager->GetWindowsOnOutput(output_id)) - window->UpdateBufferScale(true); - } - -@@ -101,7 +102,7 @@ display::Display WaylandScreen::GetPrimaryDisplay() const { - - display::Display WaylandScreen::GetDisplayForAcceleratedWidget( - gfx::AcceleratedWidget widget) const { -- auto* window = connection_->GetWindow(widget); -+ auto* window = connection_->wayland_window_manager()->GetWindow(widget); - // A window might be destroyed by this time on shutting down the browser. - if (!window) - return GetPrimaryDisplay(); -@@ -139,6 +140,7 @@ display::Display WaylandScreen::GetDisplayForAcceleratedWidget( - } - - gfx::Point WaylandScreen::GetCursorScreenPoint() const { -+ auto* wayland_window_manager = connection_->wayland_window_manager(); - // Wayland does not provide either location of surfaces in global space - // coordinate system or location of a pointer. Instead, only locations of - // mouse/touch events are known. Given that Chromium assumes top-level windows -@@ -149,10 +151,10 @@ gfx::Point WaylandScreen::GetCursorScreenPoint() const { - // last known cursor position. Otherwise, return such a point, which is not - // contained by any of the windows. - auto* cursor_position = connection_->wayland_cursor_position(); -- if (connection_->GetCurrentFocusedWindow() && cursor_position) -+ if (wayland_window_manager->GetCurrentFocusedWindow() && cursor_position) - return cursor_position->GetCursorSurfacePoint(); - -- WaylandWindow* window = connection_->GetWindowWithLargestBounds(); -+ auto* window = wayland_window_manager->GetWindowWithLargestBounds(); - DCHECK(window); - const gfx::Rect bounds = window->GetBounds(); - return gfx::Point(bounds.width() + 10, bounds.height() + 10); -@@ -162,7 +164,8 @@ gfx::AcceleratedWidget WaylandScreen::GetAcceleratedWidgetAtScreenPoint( - const gfx::Point& point) const { - // It is safe to check only for focused windows and test if they contain the - // point or not. -- auto* window = connection_->GetCurrentFocusedWindow(); -+ auto* window = -+ connection_->wayland_window_manager()->GetCurrentFocusedWindow(); - if (window && window->GetBounds().Contains(point)) - return window->GetWidget(); - return gfx::kNullAcceleratedWidget; -diff --git a/ui/ozone/platform/wayland/host/wayland_window.cc b/ui/ozone/platform/wayland/host/wayland_window.cc -index cf4e41391056..64364a3064f3 100644 ---- a/ui/ozone/platform/wayland/host/wayland_window.cc -+++ b/ui/ozone/platform/wayland/host/wayland_window.cc -@@ -105,7 +105,7 @@ WaylandWindow::~WaylandWindow() { - } - - PlatformEventSource::GetInstance()->RemovePlatformEventDispatcher(this); -- connection_->RemoveWindow(GetWidget()); -+ connection_->wayland_window_manager()->RemoveWindow(GetWidget()); - - if (parent_window_) - parent_window_->set_child_window(nullptr); -@@ -165,7 +165,7 @@ bool WaylandWindow::Initialize(PlatformWindowInitProperties properties) { - - connection_->ScheduleFlush(); - -- connection_->AddWindow(GetWidget(), this); -+ connection_->wayland_window_manager()->AddWindow(GetWidget(), this); - PlatformEventSource::GetInstance()->AddPlatformEventDispatcher(this); - delegate_->OnAcceleratedWidgetAvailable(GetWidget()); - -@@ -249,7 +249,8 @@ void WaylandWindow::CreateXdgSurface() { - void WaylandWindow::CreateAndShowTooltipSubSurface() { - // Since Aura does not not provide a reference parent window, needed by - // Wayland, we get the current focused window to place and show the tooltips. -- parent_window_ = connection_->GetCurrentFocusedWindow(); -+ parent_window_ = -+ connection_->wayland_window_manager()->GetCurrentFocusedWindow(); - - // Tooltip creation is an async operation. By the time Aura actually creates - // the tooltip, it is possible that the user has already moved the -@@ -566,7 +567,8 @@ uint32_t WaylandWindow::DispatchEvent(const PlatformEvent& native_event) { - // Parent window of the main menu window is not a popup, but rather an - // xdg surface. - DCHECK(!parent_window_->xdg_popup() && parent_window_->xdg_surface()); -- WaylandWindow* window = connection_->GetCurrentFocusedWindow(); -+ auto* window = -+ connection_->wayland_window_manager()->GetCurrentFocusedWindow(); - if (window) { - ConvertEventLocationToTargetWindowLocation(GetBounds().origin(), - window->GetBounds().origin(), -@@ -803,7 +805,8 @@ void WaylandWindow::MaybeTriggerPendingStateChange() { - - WaylandWindow* WaylandWindow::GetParentWindow( - gfx::AcceleratedWidget parent_widget) { -- WaylandWindow* parent_window = connection_->GetWindow(parent_widget); -+ auto* parent_window = -+ connection_->wayland_window_manager()->GetWindow(parent_widget); - - // If propagated parent has already had a child, it means that |this| is a - // submenu of a 3-dot menu. In aura, the parent of a 3-dot menu and its -@@ -817,7 +820,7 @@ WaylandWindow* WaylandWindow::GetParentWindow( - if (parent_window && parent_window->child_window_) - return parent_window->child_window_; - if (!parent_window) -- return connection_->GetCurrentFocusedWindow(); -+ return connection_->wayland_window_manager()->GetCurrentFocusedWindow(); - return parent_window; - } - -@@ -874,7 +877,8 @@ void WaylandWindow::RemoveEnteredOutputId(struct wl_output* output) { - void WaylandWindow::UpdateCursorPositionFromEvent( - std::unique_ptr<Event> event) { - DCHECK(event->IsLocatedEvent()); -- auto* window = connection_->GetCurrentFocusedWindow(); -+ auto* window = -+ connection_->wayland_window_manager()->GetCurrentFocusedWindow(); - // This is a tricky part. Initially, Wayland sends events to surfaces the - // events are targeted for. But, in order to fulfill Chromium's assumptions - // about event targets, some of the events are rerouted and their locations -diff --git a/ui/ozone/platform/wayland/host/wayland_window_manager.cc b/ui/ozone/platform/wayland/host/wayland_window_manager.cc -new file mode 100644 -index 000000000000..c7cae0c9f937 ---- /dev/null -+++ b/ui/ozone/platform/wayland/host/wayland_window_manager.cc -@@ -0,0 +1,90 @@ -+// Copyright 2019 The Chromium Authors. All rights reserved. -+// Use of this source code is governed by a BSD-style license that can be -+// found in the LICENSE file. -+ -+#include "ui/ozone/platform/wayland/host/wayland_window_manager.h" -+ -+#include "ui/ozone/platform/wayland/host/wayland_connection.h" -+#include "ui/ozone/platform/wayland/host/wayland_window.h" -+ -+namespace ui { -+ -+WaylandWindowManager::WaylandWindowManager(WaylandConnection* connection) -+ : connection_(connection) {} -+ -+WaylandWindowManager::~WaylandWindowManager() = default; -+ -+WaylandWindow* WaylandWindowManager::GetWindow( -+ gfx::AcceleratedWidget widget) const { -+ auto it = window_map_.find(widget); -+ return it == window_map_.end() ? nullptr : it->second; -+} -+ -+WaylandWindow* WaylandWindowManager::GetWindowWithLargestBounds() const { -+ WaylandWindow* window_with_largest_bounds = nullptr; -+ for (auto entry : window_map_) { -+ if (!window_with_largest_bounds) { -+ window_with_largest_bounds = entry.second; -+ continue; -+ } -+ WaylandWindow* window = entry.second; -+ if (window_with_largest_bounds->GetBounds() < window->GetBounds()) -+ window_with_largest_bounds = window; -+ } -+ return window_with_largest_bounds; -+} -+ -+WaylandWindow* WaylandWindowManager::GetCurrentFocusedWindow() const { -+ for (auto entry : window_map_) { -+ WaylandWindow* window = entry.second; -+ if (window->has_pointer_focus()) -+ return window; -+ } -+ return nullptr; -+} -+ -+WaylandWindow* WaylandWindowManager::GetCurrentKeyboardFocusedWindow() const { -+ for (auto entry : window_map_) { -+ WaylandWindow* window = entry.second; -+ if (window->has_keyboard_focus()) -+ return window; -+ } -+ return nullptr; -+} -+ -+std::vector<WaylandWindow*> WaylandWindowManager::GetWindowsOnOutput( -+ uint32_t output_id) { -+ std::vector<WaylandWindow*> result; -+ for (auto entry : window_map_) { -+ if (entry.second->entered_outputs_ids().count(output_id) > 0) -+ result.push_back(entry.second); -+ } -+ return result; -+} -+ -+void WaylandWindowManager::AddWindow(gfx::AcceleratedWidget widget, -+ WaylandWindow* window) { -+ window_map_[widget] = window; -+ -+ // TODO(msisov): use observers instead. -+ connection_->OnWindowAdded(window); -+} -+ -+void WaylandWindowManager::RemoveWindow(gfx::AcceleratedWidget widget) { -+ auto* window = window_map_[widget]; -+ DCHECK(window); -+ -+ window_map_.erase(widget); -+ -+ // TODO(msisov): use observers instead. -+ connection_->OnWindowRemoved(window); -+} -+ -+std::vector<WaylandWindow*> WaylandWindowManager::GetAllWindows() const { -+ std::vector<WaylandWindow*> result; -+ for (auto entry : window_map_) -+ result.push_back(entry.second); -+ return result; -+} -+ -+} // namespace ui -diff --git a/ui/ozone/platform/wayland/host/wayland_window_manager.h b/ui/ozone/platform/wayland/host/wayland_window_manager.h -new file mode 100644 -index 000000000000..d149bda262d9 ---- /dev/null -+++ b/ui/ozone/platform/wayland/host/wayland_window_manager.h -@@ -0,0 +1,60 @@ -+// Copyright 2019 The Chromium Authors. All rights reserved. -+// Use of this source code is governed by a BSD-style license that can be -+// found in the LICENSE file. -+ -+#ifndef UI_OZONE_PLATFORM_WAYLAND_HOST_WAYLAND_WINDOW_MANAGER_H_ -+#define UI_OZONE_PLATFORM_WAYLAND_HOST_WAYLAND_WINDOW_MANAGER_H_ -+ -+#include <memory> -+ -+#include "base/containers/flat_map.h" -+#include "base/macros.h" -+#include "ui/gfx/native_widget_types.h" -+ -+namespace ui { -+ -+class WaylandConnection; -+class WaylandWindow; -+ -+// Stores and returns WaylandWindows. Clients that are interested in knowing -+// when a new window is added or removed, but set self as an observer. -+class WaylandWindowManager { -+ public: -+ // TODO(msisov): Do not pass WaylandConnection here. Instead, add support for -+ // observers. -+ explicit WaylandWindowManager(WaylandConnection* connection); -+ ~WaylandWindowManager(); -+ -+ // Returns a window found by |widget|. -+ WaylandWindow* GetWindow(gfx::AcceleratedWidget widget) const; -+ -+ // Returns a window with largests bounds. -+ WaylandWindow* GetWindowWithLargestBounds() const; -+ -+ // Returns a current focused window by pointer. -+ WaylandWindow* GetCurrentFocusedWindow() const; -+ -+ // Returns a current focused window by keyboard. -+ WaylandWindow* GetCurrentKeyboardFocusedWindow() const; -+ -+ // TODO(crbug.com/971525): remove this in favor of targeted subscription of -+ // windows to their outputs. -+ std::vector<WaylandWindow*> GetWindowsOnOutput(uint32_t output_id); -+ -+ // Returns all stored windows. -+ std::vector<WaylandWindow*> GetAllWindows() const; -+ -+ void AddWindow(gfx::AcceleratedWidget widget, WaylandWindow* window); -+ void RemoveWindow(gfx::AcceleratedWidget widget); -+ -+ private: -+ WaylandConnection* const connection_; -+ -+ base::flat_map<gfx::AcceleratedWidget, WaylandWindow*> window_map_; -+ -+ DISALLOW_COPY_AND_ASSIGN(WaylandWindowManager); -+}; -+ -+} // namespace ui -+ -+#endif // UI_OZONE_PLATFORM_WAYLAND_HOST_WAYLAND_WINDOW_MANAGER_H_ -diff --git a/ui/ozone/platform/wayland/host/wayland_window_manager_unittests.cc b/ui/ozone/platform/wayland/host/wayland_window_manager_unittests.cc -new file mode 100644 -index 000000000000..a38267564a0d ---- /dev/null -+++ b/ui/ozone/platform/wayland/host/wayland_window_manager_unittests.cc -@@ -0,0 +1,222 @@ -+// Copyright 2019 The Chromium Authors. All rights reserved. -+// Use of this source code is governed by a BSD-style license that can be -+// found in the LICENSE file. -+ -+#include "testing/gtest/include/gtest/gtest.h" -+#include "ui/ozone/platform/wayland/test/mock_pointer.h" -+#include "ui/ozone/platform/wayland/test/mock_surface.h" -+#include "ui/ozone/platform/wayland/test/test_keyboard.h" -+#include "ui/ozone/platform/wayland/test/wayland_test.h" -+#include "ui/ozone/test/mock_platform_window_delegate.h" -+ -+namespace ui { -+ -+namespace { -+ -+constexpr gfx::Rect kDefaultBounds(0, 0, 100, 100); -+ -+} // namespace -+ -+class WaylandWindowManagerTest : public WaylandTest { -+ public: -+ WaylandWindowManagerTest() {} -+ -+ void SetUp() override { -+ WaylandTest::SetUp(); -+ -+ manager_ = connection_->wayland_window_manager(); -+ DCHECK(manager_); -+ } -+ -+ protected: -+ std::unique_ptr<WaylandWindow> CreateWaylandWindowWithParams( -+ PlatformWindowType type, -+ const gfx::Rect bounds, -+ MockPlatformWindowDelegate* delegate) { -+ PlatformWindowInitProperties properties; -+ properties.bounds = bounds; -+ properties.type = type; -+ -+ std::unique_ptr<WaylandWindow> window = -+ std::make_unique<WaylandWindow>(delegate, connection_.get()); -+ -+ EXPECT_TRUE(window->Initialize(std::move(properties))); -+ return window; -+ } -+ -+ WaylandWindowManager* manager_ = nullptr; -+ -+ private: -+ DISALLOW_COPY_AND_ASSIGN(WaylandWindowManagerTest); -+}; -+ -+TEST_P(WaylandWindowManagerTest, GetWindow) { -+ MockPlatformWindowDelegate delegate; -+ -+ auto window1 = CreateWaylandWindowWithParams(PlatformWindowType::kWindow, -+ kDefaultBounds, &delegate); -+ gfx::AcceleratedWidget window1_widget = window1->GetWidget(); -+ -+ auto window2 = CreateWaylandWindowWithParams( -+ PlatformWindowType::kWindow, gfx::Rect(0, 0, 300, 300), &delegate); -+ -+ EXPECT_TRUE(window1.get() == manager_->GetWindow(window1->GetWidget())); -+ EXPECT_TRUE(window2.get() == manager_->GetWindow(window2->GetWidget())); -+ -+ window1.reset(); -+ -+ EXPECT_FALSE(manager_->GetWindow(window1_widget)); -+} -+ -+TEST_P(WaylandWindowManagerTest, GetWindowWithLargestBounds) { -+ MockPlatformWindowDelegate delegate; -+ -+ auto window1 = CreateWaylandWindowWithParams(PlatformWindowType::kWindow, -+ kDefaultBounds, &delegate); -+ // There is also default window create by the WaylandTest. Thus, make bounds -+ // of this window large enough. -+ auto window2 = CreateWaylandWindowWithParams( -+ PlatformWindowType::kWindow, gfx::Rect(0, 0, 3000, 3000), &delegate); -+ -+ EXPECT_TRUE(window2.get() == manager_->GetWindowWithLargestBounds()); -+} -+ -+TEST_P(WaylandWindowManagerTest, GetCurrentFocusedWindow) { -+ MockPlatformWindowDelegate delegate; -+ -+ wl_seat_send_capabilities(server_.seat()->resource(), -+ WL_SEAT_CAPABILITY_POINTER); -+ -+ Sync(); -+ -+ auto window1 = CreateWaylandWindowWithParams(PlatformWindowType::kWindow, -+ kDefaultBounds, &delegate); -+ -+ Sync(); -+ -+ EXPECT_FALSE(manager_->GetCurrentFocusedWindow()); -+ -+ auto* pointer = server_.seat()->pointer(); -+ ASSERT_TRUE(pointer); -+ -+ wl::MockSurface* surface = -+ server_.GetObject<wl::MockSurface>(window1->GetWidget()); -+ wl_pointer_send_enter(pointer->resource(), 1, surface->resource(), 0, 0); -+ -+ Sync(); -+ -+ EXPECT_FALSE(manager_->GetCurrentKeyboardFocusedWindow()); -+ EXPECT_TRUE(window1.get() == manager_->GetCurrentFocusedWindow()); -+ -+ wl_pointer_send_leave(pointer->resource(), 2, surface->resource()); -+ -+ Sync(); -+ -+ EXPECT_FALSE(manager_->GetCurrentFocusedWindow()); -+} -+ -+TEST_P(WaylandWindowManagerTest, GetCurrentKeyboardFocusedWindow) { -+ MockPlatformWindowDelegate delegate; -+ -+ wl_seat_send_capabilities(server_.seat()->resource(), -+ WL_SEAT_CAPABILITY_KEYBOARD); -+ -+ Sync(); -+ -+ auto window1 = CreateWaylandWindowWithParams(PlatformWindowType::kWindow, -+ kDefaultBounds, &delegate); -+ -+ Sync(); -+ -+ EXPECT_FALSE(manager_->GetCurrentKeyboardFocusedWindow()); -+ -+ auto* keyboard = server_.seat()->keyboard(); -+ ASSERT_TRUE(keyboard); -+ -+ wl::MockSurface* surface = -+ server_.GetObject<wl::MockSurface>(window1->GetWidget()); -+ -+ struct wl_array empty; -+ wl_array_init(&empty); -+ wl_keyboard_send_enter(keyboard->resource(), 1, surface->resource(), &empty); -+ -+ Sync(); -+ -+ EXPECT_FALSE(manager_->GetCurrentFocusedWindow()); -+ EXPECT_TRUE(window1.get() == manager_->GetCurrentKeyboardFocusedWindow()); -+ -+ wl_keyboard_send_leave(keyboard->resource(), 2, surface->resource()); -+ -+ Sync(); -+ -+ EXPECT_FALSE(manager_->GetCurrentKeyboardFocusedWindow()); -+} -+ -+TEST_P(WaylandWindowManagerTest, GetWindowsOnOutput) { -+ MockPlatformWindowDelegate delegate; -+ -+ wl::TestOutput* output = server_.CreateAndInitializeOutput(); -+ -+ auto window1 = CreateWaylandWindowWithParams(PlatformWindowType::kWindow, -+ kDefaultBounds, &delegate); -+ -+ auto window2 = CreateWaylandWindowWithParams(PlatformWindowType::kWindow, -+ kDefaultBounds, &delegate); -+ -+ Sync(); -+ -+ wl::MockSurface* surface = -+ server_.GetObject<wl::MockSurface>(window1->GetWidget()); -+ ASSERT_TRUE(surface); -+ wl_surface_send_enter(surface->resource(), output->resource()); -+ -+ Sync(); -+ -+ auto entered_outputs_window1 = window1->entered_outputs_ids(); -+ EXPECT_EQ(1u, entered_outputs_window1.size()); -+ -+ uint32_t output_id = *entered_outputs_window1.begin(); -+ -+ auto windows_on_output = manager_->GetWindowsOnOutput(output_id); -+ EXPECT_EQ(1u, windows_on_output.size()); -+ -+ EXPECT_TRUE(window1.get() == *windows_on_output.begin()); -+ -+ surface = server_.GetObject<wl::MockSurface>(window2->GetWidget()); -+ ASSERT_TRUE(surface); -+ wl_surface_send_enter(surface->resource(), output->resource()); -+ -+ Sync(); -+ -+ windows_on_output = manager_->GetWindowsOnOutput(output_id); -+ EXPECT_EQ(2u, windows_on_output.size()); -+} -+ -+TEST_P(WaylandWindowManagerTest, GetAllWindows) { -+ MockPlatformWindowDelegate delegate; -+ -+ // There is a default window created by WaylandTest. -+ auto windows = manager_->GetAllWindows(); -+ EXPECT_EQ(1u, windows.size()); -+ -+ window_.reset(); -+ -+ auto window1 = CreateWaylandWindowWithParams(PlatformWindowType::kWindow, -+ kDefaultBounds, &delegate); -+ -+ auto window2 = CreateWaylandWindowWithParams(PlatformWindowType::kWindow, -+ kDefaultBounds, &delegate); -+ -+ windows = manager_->GetAllWindows(); -+ EXPECT_EQ(2u, windows.size()); -+} -+ -+INSTANTIATE_TEST_SUITE_P(XdgVersionV5Test, -+ WaylandWindowManagerTest, -+ ::testing::Values(kXdgShellV5)); -+ -+INSTANTIATE_TEST_SUITE_P(XdgVersionV6Test, -+ WaylandWindowManagerTest, -+ ::testing::Values(kXdgShellV6)); -+ -+} // namespace ui --- -2.23.0 - diff --git a/0005-ozone-wayland-Do-not-use-possibly-blocking-dispatch-.patch b/0005-ozone-wayland-Do-not-use-possibly-blocking-dispatch-.patch deleted file mode 100644 index 97f9321b223d..000000000000 --- a/0005-ozone-wayland-Do-not-use-possibly-blocking-dispatch-.patch +++ /dev/null @@ -1,314 +0,0 @@ -From 7a008b2cb125667dabaac46e551a6f1dcc3981c5 Mon Sep 17 00:00:00 2001 -From: Maksim Sisov <msisov@igalia.com> -Date: Thu, 8 Aug 2019 11:47:41 +0000 -Subject: [PATCH 5/6] [ozone/wayland] Do not use possibly blocking dispatch API - -Using wl_display_dispatch is a wrong thing to do as it is a blocking -method (see [1]). It can cause freezes and deadlocks. - -Instead, we need to do something like this - - -while (wl_display_prepare_read_queue(display, queue) != 0) - wl_display_dispatch_queue_pending(display, queue); -wl_display_flush(display); - -ret = poll(fds, nfds, -1); -if (has_error(ret)) - wl_display_cancel_read(display); -else - wl_display_read_events(display); - -wl_display_dispatch_queue_pending(display, queue); - -However, there is no need to do a second poll as long -as we are notified by libevent that the display fd is -non-blocking. However, to ensure we can read, we have -to prepare the queue, which tells other clients we -are going to read from the queue. If prepare fails, -it means there is nothing to read. Thus, we push -the events into the queue and return early instead. - -We have also to add an "automatic" flush as part -of the polling mechanism. This poll must ensure -that all the data has been written to the queue. -If not, -1 is returned and EAGAIN is set. In this -case, we have to stop watching the fd for read -access and start watching it for the write access. - -As soon as all the data is written, we can get -back to reading. - -[1] https://people.freedesktop.org/~whot/wayland-doxygen/wayland/Client/classwl__display.html#a30a9c4f020f3e77581c7a81ecdb4913d - -Bug: 987821 -Change-Id: I536513034c18a47da079a2b56a75d32f20f72ad6 -Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1730159 -Reviewed-by: Robert Kroeger <rjkroege@chromium.org> -Commit-Queue: Maksim Sisov <msisov@igalia.com> -Cr-Commit-Position: refs/heads/master@{#685148} ---- - .../wayland/host/wayland_connection.cc | 74 +++++++++++++++---- - .../wayland/host/wayland_connection.h | 4 + - .../wayland/host/wayland_data_device.cc | 2 +- - .../wayland/host/wayland_data_source.cc | 2 +- - .../platform/wayland/host/wayland_keyboard.cc | 2 +- - .../platform/wayland/host/wayland_window.cc | 3 +- - .../wayland/host/wayland_window_unittest.cc | 17 +++-- - .../wayland/host/xdg_surface_wrapper_v5.cc | 1 + - .../wayland/host/xdg_surface_wrapper_v6.cc | 3 +- - 9 files changed, 84 insertions(+), 24 deletions(-) - -diff --git a/ui/ozone/platform/wayland/host/wayland_connection.cc b/ui/ozone/platform/wayland/host/wayland_connection.cc -index bf6d12717861..203db09c7f15 100644 ---- a/ui/ozone/platform/wayland/host/wayland_connection.cc -+++ b/ui/ozone/platform/wayland/host/wayland_connection.cc -@@ -101,20 +101,29 @@ bool WaylandConnection::StartProcessingEvents() { - return true; - - DCHECK(display_); -+ -+ MaybePrepareReadQueue(); -+ -+ // Displatch event from display to server. - wl_display_flush(display_.get()); - -- DCHECK(base::MessageLoopCurrentForUI::IsSet()); -- if (!base::MessageLoopCurrentForUI::Get()->WatchFileDescriptor( -- wl_display_get_fd(display_.get()), true, -- base::MessagePumpLibevent::WATCH_READ, &controller_, this)) -- return false; -+ return BeginWatchingFd(base::MessagePumpLibevent::WATCH_READ); -+} - -- watching_ = true; -- return true; -+void WaylandConnection::MaybePrepareReadQueue() { -+ if (prepared_) -+ return; -+ -+ if (wl_display_prepare_read(display()) != -1) { -+ prepared_ = true; -+ return; -+ } -+ // Nothing to read, send events to the queue. -+ wl_display_dispatch_pending(display()); - } - - void WaylandConnection::ScheduleFlush() { -- if (scheduled_flush_ || !watching_) -+ if (scheduled_flush_) - return; - DCHECK(base::MessageLoopCurrentForUI::IsSet()); - base::ThreadTaskRunnerHandle::Get()->PostTask( -@@ -207,13 +216,38 @@ void WaylandConnection::DispatchUiEvent(Event* event) { - } - - void WaylandConnection::OnFileCanReadWithoutBlocking(int fd) { -- wl_display_dispatch(display_.get()); -- std::vector<WaylandWindow*> windows = wayland_window_manager_.GetAllWindows(); -- for (auto* window : windows) -- window->ApplyPendingBounds(); -+ if (prepared_) { -+ prepared_ = false; -+ if (wl_display_read_events(display()) == -1) -+ return; -+ wl_display_dispatch_pending(display()); -+ } -+ -+ MaybePrepareReadQueue(); -+ -+ if (!prepared_) -+ return; -+ -+ // Automatic Flush. -+ int ret = wl_display_flush(display_.get()); -+ if (ret != -1 || errno != EAGAIN) -+ return; -+ -+ // if all data could not be written, errno will be set to EAGAIN and -1 -+ // returned. In that case, use poll on the display file descriptor to wait for -+ // it to become writable again. -+ BeginWatchingFd(base::MessagePumpLibevent::WATCH_WRITE); - } - --void WaylandConnection::OnFileCanWriteWithoutBlocking(int fd) {} -+void WaylandConnection::OnFileCanWriteWithoutBlocking(int fd) { -+ int ret = wl_display_flush(display_.get()); -+ if (ret != -1 || errno != EAGAIN) -+ BeginWatchingFd(base::MessagePumpLibevent::WATCH_READ); -+ else if (ret < 0 && errno != EPIPE && prepared_) -+ wl_display_cancel_read(display()); -+ -+ // Otherwise just continue watching in the same mode. -+} - - void WaylandConnection::EnsureDataDevice() { - if (!data_device_manager_ || !seat_) -@@ -225,6 +259,20 @@ void WaylandConnection::EnsureDataDevice() { - data_device_.get()); - } - -+bool WaylandConnection::BeginWatchingFd( -+ base::WatchableIOMessagePumpPosix::Mode mode) { -+ if (watching_) { -+ // Stop watching first. -+ watching_ = !controller_.StopWatchingFileDescriptor(); -+ DCHECK(!watching_); -+ } -+ -+ DCHECK(base::MessageLoopCurrentForUI::IsSet()); -+ watching_ = base::MessageLoopCurrentForUI::Get()->WatchFileDescriptor( -+ wl_display_get_fd(display_.get()), true, mode, &controller_, this); -+ return watching_; -+} -+ - // static - void WaylandConnection::Global(void* data, - wl_registry* registry, -diff --git a/ui/ozone/platform/wayland/host/wayland_connection.h b/ui/ozone/platform/wayland/host/wayland_connection.h -index 8a56ebc6b921..ff587ae9ee6f 100644 ---- a/ui/ozone/platform/wayland/host/wayland_connection.h -+++ b/ui/ozone/platform/wayland/host/wayland_connection.h -@@ -146,6 +146,9 @@ class WaylandConnection : public PlatformEventSource, - // Make sure data device is properly initialized - void EnsureDataDevice(); - -+ bool BeginWatchingFd(base::WatchableIOMessagePumpPosix::Mode mode); -+ void MaybePrepareReadQueue(); -+ - // wl_registry_listener - static void Global(void* data, - wl_registry* registry, -@@ -192,6 +195,7 @@ class WaylandConnection : public PlatformEventSource, - - bool scheduled_flush_ = false; - bool watching_ = false; -+ bool prepared_ = false; - base::MessagePumpLibevent::FdWatchController controller_; - - uint32_t serial_ = 0; -diff --git a/ui/ozone/platform/wayland/host/wayland_data_device.cc b/ui/ozone/platform/wayland/host/wayland_data_device.cc -index a36cd3b7a888..56e568fbd164 100644 ---- a/ui/ozone/platform/wayland/host/wayland_data_device.cc -+++ b/ui/ozone/platform/wayland/host/wayland_data_device.cc -@@ -355,7 +355,7 @@ void WaylandDataDevice::RegisterDeferredReadCallback() { - deferred_read_callback_.reset(wl_display_sync(connection_->display())); - wl_callback_add_listener(deferred_read_callback_.get(), - &kDeferredReadListener, this); -- wl_display_flush(connection_->display()); -+ connection_->ScheduleFlush(); - } - - void WaylandDataDevice::DeferredReadCallback(void* data, -diff --git a/ui/ozone/platform/wayland/host/wayland_data_source.cc b/ui/ozone/platform/wayland/host/wayland_data_source.cc -index dcd6b75aa299..1f41fd6786b9 100644 ---- a/ui/ozone/platform/wayland/host/wayland_data_source.cc -+++ b/ui/ozone/platform/wayland/host/wayland_data_source.cc -@@ -36,7 +36,7 @@ void WaylandDataSource::WriteToClipboard( - wl_data_device_set_selection(connection_->data_device(), data_source_.get(), - connection_->serial()); - -- wl_display_flush(connection_->display()); -+ connection_->ScheduleFlush(); - } - - void WaylandDataSource::UpdateDataMap( -diff --git a/ui/ozone/platform/wayland/host/wayland_keyboard.cc b/ui/ozone/platform/wayland/host/wayland_keyboard.cc -index c082b30133e5..fbadb0e3b1e2 100644 ---- a/ui/ozone/platform/wayland/host/wayland_keyboard.cc -+++ b/ui/ozone/platform/wayland/host/wayland_keyboard.cc -@@ -167,7 +167,7 @@ void WaylandKeyboard::FlushInput(base::OnceClosure closure) { - // get spurious repeats. - sync_callback_.reset(wl_display_sync(connection_->display())); - wl_callback_add_listener(sync_callback_.get(), &callback_listener_, this); -- wl_display_flush(connection_->display()); -+ connection_->ScheduleFlush(); - } - - void WaylandKeyboard::DispatchKey(uint32_t key, -diff --git a/ui/ozone/platform/wayland/host/wayland_window.cc b/ui/ozone/platform/wayland/host/wayland_window.cc -index 64364a3064f3..a03dde334c19 100644 ---- a/ui/ozone/platform/wayland/host/wayland_window.cc -+++ b/ui/ozone/platform/wayland/host/wayland_window.cc -@@ -285,7 +285,6 @@ void WaylandWindow::ApplyPendingBounds() { - - SetBoundsDip(pending_bounds_dip_); - xdg_surface_->SetWindowGeometry(pending_bounds_dip_); -- xdg_surface_->AckConfigure(); - pending_bounds_dip_ = gfx::Rect(); - connection_->ScheduleFlush(); - -@@ -662,6 +661,8 @@ void WaylandWindow::HandleSurfaceConfigure(int32_t width, - delegate_->OnWindowStateChanged(state_); - } - -+ ApplyPendingBounds(); -+ - if (did_active_change) - delegate_->OnActivationChanged(is_active_); - -diff --git a/ui/ozone/platform/wayland/host/wayland_window_unittest.cc b/ui/ozone/platform/wayland/host/wayland_window_unittest.cc -index 699d3cebe703..747b7dd60baf 100644 ---- a/ui/ozone/platform/wayland/host/wayland_window_unittest.cc -+++ b/ui/ozone/platform/wayland/host/wayland_window_unittest.cc -@@ -677,19 +677,26 @@ TEST_P(WaylandWindowTest, HasCaptureUpdatedOnPointerEvents) { - - TEST_P(WaylandWindowTest, ConfigureEvent) { - ScopedWlArray states; -- SendConfigureEvent(1000, 1000, 12, states.get()); -- SendConfigureEvent(1500, 1000, 13, states.get()); - -- // Make sure that the implementation does not call OnBoundsChanged for each -- // configure event if it receives multiple in a row. -- EXPECT_CALL(delegate_, OnBoundsChanged(Eq(gfx::Rect(0, 0, 1500, 1000)))); -+ // The surface must react on each configure event and send bounds to its -+ // delegate. -+ -+ EXPECT_CALL(delegate_, OnBoundsChanged(Eq(gfx::Rect(0, 0, 1000, 1000)))); - // Responding to a configure event, the window geometry in here must respect - // the sizing negotiations specified by the configure event. - // |xdg_surface_| must receive the following calls in both xdg_shell_v5 and - // xdg_shell_v6. Other calls like SetTitle or SetMaximized are recieved by - // xdg_toplevel in xdg_shell_v6 and by xdg_surface_ in xdg_shell_v5. -+ EXPECT_CALL(*xdg_surface_, SetWindowGeometry(0, 0, 1000, 1000)).Times(1); -+ EXPECT_CALL(*xdg_surface_, AckConfigure(12)); -+ SendConfigureEvent(1000, 1000, 12, states.get()); -+ -+ Sync(); -+ -+ EXPECT_CALL(delegate_, OnBoundsChanged(Eq(gfx::Rect(0, 0, 1500, 1000)))); - EXPECT_CALL(*xdg_surface_, SetWindowGeometry(0, 0, 1500, 1000)).Times(1); - EXPECT_CALL(*xdg_surface_, AckConfigure(13)); -+ SendConfigureEvent(1500, 1000, 13, states.get()); - } - - TEST_P(WaylandWindowTest, ConfigureEventWithNulledSize) { -diff --git a/ui/ozone/platform/wayland/host/xdg_surface_wrapper_v5.cc b/ui/ozone/platform/wayland/host/xdg_surface_wrapper_v5.cc -index 7d4172d2f0cb..c89fa87bff9b 100644 ---- a/ui/ozone/platform/wayland/host/xdg_surface_wrapper_v5.cc -+++ b/ui/ozone/platform/wayland/host/xdg_surface_wrapper_v5.cc -@@ -99,6 +99,7 @@ void XDGSurfaceWrapperV5::Configure(void* data, - surface->pending_configure_serial_ = serial; - surface->wayland_window_->HandleSurfaceConfigure(width, height, is_maximized, - is_fullscreen, is_activated); -+ surface->AckConfigure(); - } - - // static -diff --git a/ui/ozone/platform/wayland/host/xdg_surface_wrapper_v6.cc b/ui/ozone/platform/wayland/host/xdg_surface_wrapper_v6.cc -index 9cac792bf630..c7c9fc079590 100644 ---- a/ui/ozone/platform/wayland/host/xdg_surface_wrapper_v6.cc -+++ b/ui/ozone/platform/wayland/host/xdg_surface_wrapper_v6.cc -@@ -123,8 +123,7 @@ void XDGSurfaceWrapperV6::Configure(void* data, - XDGSurfaceWrapperV6* surface = static_cast<XDGSurfaceWrapperV6*>(data); - surface->pending_configure_serial_ = serial; - -- if (surface->surface_for_popup_) -- surface->AckConfigure(); -+ surface->AckConfigure(); - } - - // static --- -2.23.0 - diff --git a/0006-ozone-wayland-Implement-CreateNativePixmapAsync.patch b/0006-ozone-wayland-Implement-CreateNativePixmapAsync.patch deleted file mode 100644 index 2413a12bc8c0..000000000000 --- a/0006-ozone-wayland-Implement-CreateNativePixmapAsync.patch +++ /dev/null @@ -1,63 +0,0 @@ -From 3efec61426b3e4fa61a509047b835a7945248b5d Mon Sep 17 00:00:00 2001 -From: Maksim Sisov <msisov@igalia.com> -Date: Thu, 1 Aug 2019 08:22:39 +0000 -Subject: [PATCH 6/6] [ozone/wayland] Implement CreateNativePixmapAsync - -Fix native GpuMemoryBuffers for Ozone/Wayland by implementing -non implemented CreateNativePixmapAsync call. - -Bug: 989433 -Change-Id: Ic178ac2d4f0716e4c4a00a0abb6686e64b980b90 -Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1728655 -Reviewed-by: Robert Kroeger <rjkroege@chromium.org> -Commit-Queue: Maksim Sisov <msisov@igalia.com> -Cr-Commit-Position: refs/heads/master@{#683102} ---- - .../platform/wayland/gpu/wayland_surface_factory.cc | 13 +++++++++++++ - .../platform/wayland/gpu/wayland_surface_factory.h | 6 ++++++ - 2 files changed, 19 insertions(+) - -diff --git a/ui/ozone/platform/wayland/gpu/wayland_surface_factory.cc b/ui/ozone/platform/wayland/gpu/wayland_surface_factory.cc -index a5db42ef1b18..789488397808 100644 ---- a/ui/ozone/platform/wayland/gpu/wayland_surface_factory.cc -+++ b/ui/ozone/platform/wayland/gpu/wayland_surface_factory.cc -@@ -170,6 +170,19 @@ scoped_refptr<gfx::NativePixmap> WaylandSurfaceFactory::CreateNativePixmap( - #endif - } - -+void WaylandSurfaceFactory::CreateNativePixmapAsync( -+ gfx::AcceleratedWidget widget, -+ VkDevice vk_device, -+ gfx::Size size, -+ gfx::BufferFormat format, -+ gfx::BufferUsage usage, -+ NativePixmapCallback callback) { -+ // CreateNativePixmap is non-blocking operation. Thus, it is safe to call it -+ // and return the result with the provided callback. -+ std::move(callback).Run( -+ CreateNativePixmap(widget, vk_device, size, format, usage)); -+} -+ - scoped_refptr<gfx::NativePixmap> - WaylandSurfaceFactory::CreateNativePixmapFromHandle( - gfx::AcceleratedWidget widget, -diff --git a/ui/ozone/platform/wayland/gpu/wayland_surface_factory.h b/ui/ozone/platform/wayland/gpu/wayland_surface_factory.h -index 23f4f92a5959..53545ed9a328 100644 ---- a/ui/ozone/platform/wayland/gpu/wayland_surface_factory.h -+++ b/ui/ozone/platform/wayland/gpu/wayland_surface_factory.h -@@ -37,6 +37,12 @@ class WaylandSurfaceFactory : public SurfaceFactoryOzone { - gfx::Size size, - gfx::BufferFormat format, - gfx::BufferUsage usage) override; -+ void CreateNativePixmapAsync(gfx::AcceleratedWidget widget, -+ VkDevice vk_device, -+ gfx::Size size, -+ gfx::BufferFormat format, -+ gfx::BufferUsage usage, -+ NativePixmapCallback callback) override; - scoped_refptr<gfx::NativePixmap> CreateNativePixmapFromHandle( - gfx::AcceleratedWidget widget, - gfx::Size size, --- -2.23.0 - @@ -5,7 +5,7 @@ # Contributor: Daniel J Griffiths <ghost1227@archlinux.us> pkgname=chromium-ozone -pkgver=77.0.3865.120 +pkgver=78.0.3904.70 pkgrel=1 _launcher_ver=6 _meta_browser_sha=34ef417cdcf848839b59c086be046c2b4a96ac32 @@ -29,37 +29,25 @@ install=chromium.install source=(https://commondatastorage.googleapis.com/chromium-browser-official/chromium-$pkgver.tar.xz chromium-launcher-$_launcher_ver.tar.gz::https://github.com/foutrelis/chromium-launcher/archive/v$_launcher_ver.tar.gz meta-browser-${_meta_browser_sha}.tar.gz::https://github.com/OSSystems/meta-browser/archive/${_meta_browser_sha}.tar.gz - include-memory-in-one_euro_filter.h.patch - link-against-harfbuzz-subset.patch - fix-wrong-string-initialization-in-LinkedHashSet.patch - include-limits-in-web_time_range.cc.patch + add-missing-include-for-unique_ptr.patch + dns_util-make-DohUpgradeEntry-non-const.patch + fix-shutdown-crash-in-ProfileManager.patch chromium-system-icu.patch chromium-system-zlib.patch + fix-spammy-unique-font-matching-log.patch chromium-widevine.patch - chromium-skia-harmony.patch - 0001-ozone-wayland-Sway-avoid-sending-presentation-early.patch - 0002-ozone-wayland-Use-mutex-before-accessing-surfaces-ma.patch - 0003-ozone-wayland-Stop-using-wl_display_roundtrip.patch - 0004-ozone-wayland-Extract-window-management-methods-to-o.patch - 0005-ozone-wayland-Do-not-use-possibly-blocking-dispatch-.patch - 0006-ozone-wayland-Implement-CreateNativePixmapAsync.patch) -sha256sums=('d792f9b09b1dcfd64e68f47a611c540dd1383dd9abd78ca1e06b2a7e2ff06af8' + chromium-skia-harmony.patch) +sha256sums=('ddc5794097d65ba19c1ae359c2057b08921e7b38b7afe9d5ec45f5e8b9a87462' '04917e3cd4307d8e31bfb0027a5dce6d086edb10ff8a716024fbb8bb0c7dccf1' '892026717ac487e1a92073d7a363a7f4a12b06ed6ac61825842ad734eda857d7' - '33a5bcd1df2cc7aa7467fa882790ef143a4497d2b704c9e1ea86c8ede90c2d90' - 'ab986e4b723dfcedab1bc8dcada07526facae28a8a7ff3345f658532c1d99987' - '840f555020751ec284dca35b9317a9dd7dc69fcb910ea1cae2dd7cc9b237dfb7' - 'd3dfe3c86901a11636972a774ed6c941ac76e38c9e4a384f458043a0a03291a9' + '49052e8aa630c4aa57bf46823edc32b7b309493275163c3bb3f9fd390c73356e' + '69694ab12a5ced389916c0c5e8c7bdc191544f576b134ddfb2fe9d4ed9ec4494' + '4f81612c28957987f7344d8ce2b95a4a63136a8319c9751819436b11c62df057' 'e73cc2ee8d3ea35aab18c478d76fdfc68ca4463e1e10306fa1e738c03b3f26b5' - '0f7ba6882844542a7226b419dfefc5b6a16b5b7882698bd773b5ee9148aa6e87' + 'eb67eda4945a89c3b90473fa8dc20637511ca4dcb58879a8ed6bf403700ca9c8' + '6fbffe59b886195b92c9a55137cef83021c16593f49714acb20023633e3ebb19' 'd081f2ef8793544685aad35dea75a7e6264a2cb987ff3541e6377f4a3650a28b' - '771292942c0901092a402cc60ee883877a99fb804cb54d568c8c6c94565a48e1' - 'c43f54e180a9eeed31ef6b0e05ec98afbb5fc1197c71e119293784bb37579439' - '3d83763a5ccd4a8dd59a4d1ffbae3fcfba7688e32b6acd03505f779c7bfa8d02' - '811567d57cf22139e6ace8c8fdbc329a24f586f68214daf6dd224f56cac792b3' - '5c4b5b596b2b3bdcf33b865d44f1daa0787fc52a2a1d6ac82a6f03287ca6355a' - '231147345c0f175263cacddb62c97c7b13897870f5ebac9fa6feabf9cc28ea2d' - 'bec73f9f8b88e2c83549fc851f21fd7d0a6db714f713147f253eb7de17508efc') + '771292942c0901092a402cc60ee883877a99fb804cb54d568c8c6c94565a48e1') # Possible replacements are listed in build/linux/unbundle/replace_gn_files.py # Keys are the names in the above script; values are the dependencies in Arch @@ -73,7 +61,7 @@ declare -gA _system_libs=( [libdrm]= [libjpeg]=libjpeg #[libpng]=libpng # https://crbug.com/752403#c10 - [libvpx]=libvpx + #[libvpx]=libvpx # https://github.com/webmproject/libvpx/commit/5a0242ba5c [libwebp]=libwebp [libxml]=libxml2 [libxslt]=libxslt @@ -103,14 +91,7 @@ _mb_wayland_patches=( # 'V4L2/0002-Add-mmap-via-libv4l-to-generic_v4l2_device.patch' ) -_bugfix_patches=( - '0001-ozone-wayland-Sway-avoid-sending-presentation-early.patch' - '0002-ozone-wayland-Use-mutex-before-accessing-surfaces-ma.patch' - '0003-ozone-wayland-Stop-using-wl_display_roundtrip.patch' - '0004-ozone-wayland-Extract-window-management-methods-to-o.patch' - '0005-ozone-wayland-Do-not-use-possibly-blocking-dispatch-.patch' - '0006-ozone-wayland-Implement-CreateNativePixmapAsync.patch' -) +_bugfix_patches=() prepare() { cd "$srcdir/chromium-$pkgver" @@ -125,22 +106,22 @@ prepare() { third_party/blink/renderer/core/xml/parser/xml_document_parser.cc \ third_party/libxml/chromium/libxml_utils.cc - # https://crbug.com/819294 - patch -Np1 -i ../include-memory-in-one_euro_filter.h.patch - - # https://groups.google.com/a/chromium.org/d/msg/chromium-packagers/UyJsVJ5QqWo/jSv5z7-rEQAJ - patch -Np1 -i ../link-against-harfbuzz-subset.patch + # Missing include in third_party/blink/public/platform/web_rtc_rtp_source.h + patch -Np1 -i ../add-missing-include-for-unique_ptr.patch - # https://crbug.com/980025 - patch -Np1 -i ../fix-wrong-string-initialization-in-LinkedHashSet.patch + # https://crbug.com/957519#c23 + patch -Np1 -i ../dns_util-make-DohUpgradeEntry-non-const.patch - # https://crbug.com/992832 - patch -Np1 -i ../include-limits-in-web_time_range.cc.patch + # https://crbug.com/1005244 + patch -Np1 -i ../fix-shutdown-crash-in-ProfileManager.patch # Fixes from Gentoo patch -Np1 -i ../chromium-system-icu.patch patch -Np1 -i ../chromium-system-zlib.patch + # https://crbug.com/1005508 + patch -Np1 -i ../fix-spammy-unique-font-matching-log.patch + # Load Widevine CDM if available patch -Np1 -i ../chromium-widevine.patch @@ -211,7 +192,8 @@ build() { 'enable_widevine=true' 'use_ozone=true' 'ozone_platform_wayland=true' - 'ozone_auto_platforms=false' + 'ozone_platform_x11=true' + 'ozone_auto_platforms=fals e' 'use_xkbcommon=true' 'use_system_libwayland=true' 'use_system_minigbm=true' diff --git a/add-missing-include-for-unique_ptr.patch b/add-missing-include-for-unique_ptr.patch new file mode 100644 index 000000000000..113e08f4a7c6 --- /dev/null +++ b/add-missing-include-for-unique_ptr.patch @@ -0,0 +1,30 @@ +From bbfe2665923225b4a7c436ba2b6c7e5f695f2e52 Mon Sep 17 00:00:00 2001 +From: David Landell <landell@vewd.com> +Date: Fri, 13 Sep 2019 12:24:13 +0000 +Subject: [PATCH] Add missing include for unique_ptr +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Change-Id: I614d2f42868d563eb6a92dfb2aae08286e20d687 +Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1803137 +Reviewed-by: Henrik Boström <hbos@chromium.org> +Commit-Queue: Henrik Boström <hbos@chromium.org> +Cr-Commit-Position: refs/heads/master@{#696355} +--- + third_party/blink/public/platform/web_rtc_rtp_source.h | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/third_party/blink/public/platform/web_rtc_rtp_source.h b/third_party/blink/public/platform/web_rtc_rtp_source.h +index 959440f7a5..c3fd5421aa 100644 +--- a/third_party/blink/public/platform/web_rtc_rtp_source.h ++++ b/third_party/blink/public/platform/web_rtc_rtp_source.h +@@ -5,6 +5,8 @@ + #ifndef THIRD_PARTY_BLINK_PUBLIC_PLATFORM_WEB_RTC_RTP_SOURCE_H_ + #define THIRD_PARTY_BLINK_PUBLIC_PLATFORM_WEB_RTC_RTP_SOURCE_H_ + ++#include <memory> ++ + #include "base/optional.h" + #include "third_party/blink/public/platform/web_common.h" + diff --git a/chromium-system-zlib.patch b/chromium-system-zlib.patch index d6c45ad816d8..951a2adb196a 100644 --- a/chromium-system-zlib.patch +++ b/chromium-system-zlib.patch @@ -1,25 +1,13 @@ -From e1bbdec720a333937bd1b990ae0f7ee97db0d3b0 Mon Sep 17 00:00:00 2001 -From: Your Name <you@example.com> -Date: Fri, 28 Jun 2019 15:56:23 +0000 -Subject: [PATCH] update zlib - ---- - third_party/perfetto/gn/BUILD.gn | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - diff --git a/third_party/perfetto/gn/BUILD.gn b/third_party/perfetto/gn/BUILD.gn -index c951f5f..297eee3 100644 +index 3bc618a..e0ddf6d 100644 --- a/third_party/perfetto/gn/BUILD.gn +++ b/third_party/perfetto/gn/BUILD.gn -@@ -200,7 +200,7 @@ group("zlib") { - "//buildtools:zlib", - ] - } else if (build_with_chromium) { -- public_configs = [ "//third_party/zlib:zlib_config" ] -+ public_configs = [ "//third_party/zlib:system_zlib" ] - public_deps = [ - "//third_party/zlib", - ] --- -2.21.0 - +@@ -244,7 +244,7 @@ if (enable_perfetto_trace_processor || perfetto_build_standalone || + "//buildtools:zlib", + ] + } else { +- public_configs = [ "//third_party/zlib:zlib_config" ] ++ public_configs = [ "//third_party/zlib:system_zlib" ] + public_deps = [ + "//third_party/zlib", + ] diff --git a/dns_util-make-DohUpgradeEntry-non-const.patch b/dns_util-make-DohUpgradeEntry-non-const.patch new file mode 100644 index 000000000000..2d655e1ab1c8 --- /dev/null +++ b/dns_util-make-DohUpgradeEntry-non-const.patch @@ -0,0 +1,86 @@ +From f4c3c329588b78af63aad8b401da767242b86709 Mon Sep 17 00:00:00 2001 +From: Raphael Kubo da Costa <raphael.kubo.da.costa@intel.com> +Date: Mon, 16 Sep 2019 17:05:42 +0000 +Subject: [PATCH] dns_util: Make DohUpgradeEntry non-const when used with + std::vector<> + +This fixes the build with libstdc++ (with most other standard libraries +other than libc++, in fact) after commit f93a48e3 ("Allow upgrade to DoH +during automatic mode"): + +../../../../../../usr/bin/../lib/gcc/x86_64-redhat-linux/8/../../../../include/c++/8/bits/stl_vector.h:351:7: error: static_assert failed due to requirement 'is_same<typename remove_cv<const DohUpgradeEntry>::type, const DohUpgradeEntry>::value' "std::vector must have a non-const, non-volatile value_type" + static_assert(is_same<typename remove_cv<_Tp>::type, _Tp>::value, + ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +../../base/no_destructor.h:77:28: note: in instantiation of template class 'std::vector<const net::(anonymous namespace)::DohUpgradeEntry, std::allocator<const net::(anonymous namespace)::DohUpgradeEntry> >' requested here + alignas(T) char storage_[sizeof(T)]; + ^ +../../net/dns/dns_util.cc:147:7: note: in instantiation of template class 'base::NoDestructor<std::vector<const net::(anonymous namespace)::DohUpgradeEntry, std::allocator<const net::(anonymous namespace)::DohUpgradeEntry> > >' requested here + upgradable_servers({ + ^ +../../net/dns/dns_util.cc:230:36: error: invalid range expression of type 'const std::vector<const net::(anonymous namespace)::DohUpgradeEntry, std::allocator<const net::(anonymous namespace)::DohUpgradeEntry> >'; no viable 'begin' function available + for (const auto& upgrade_entry : upgradable_servers) { + ^ ~~~~~~~~~~~~~~~~~~ + +The C++ standard forbids containers of const elements. Callers of +GetDohUpgradeList() use it in a safe way anyway, and most of +DohUpgradeEntry's members are const. + +Bug: 957519 +Change-Id: I826a51823edb1184c0fae27105101e2894efe568 +Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1805636 +Auto-Submit: Raphael Kubo da Costa <raphael.kubo.da.costa@intel.com> +Commit-Queue: Eric Orth <ericorth@chromium.org> +Reviewed-by: Eric Orth <ericorth@chromium.org> +Cr-Commit-Position: refs/heads/master@{#696834} +--- + net/dns/dns_util.cc | 13 +++++-------- + 1 file changed, 5 insertions(+), 8 deletions(-) + +diff --git a/net/dns/dns_util.cc b/net/dns/dns_util.cc +index d83ff7c150..14997c48b2 100644 +--- a/net/dns/dns_util.cc ++++ b/net/dns/dns_util.cc +@@ -139,11 +139,11 @@ struct DohUpgradeEntry { + const DnsConfig::DnsOverHttpsServerConfig dns_over_https_config; + }; + +-const std::vector<const DohUpgradeEntry>& GetDohUpgradeList() { ++const std::vector<DohUpgradeEntry>& GetDohUpgradeList() { + // The provider names in these entries should be kept in sync with the + // DohProviderId histogram suffix list in + // tools/metrics/histograms/histograms.xml. +- static const base::NoDestructor<std::vector<const DohUpgradeEntry>> ++ static const base::NoDestructor<std::vector<DohUpgradeEntry>> + upgradable_servers({ + DohUpgradeEntry( + "CleanBrowsingAdult", +@@ -222,8 +222,7 @@ const std::vector<const DohUpgradeEntry>& GetDohUpgradeList() { + std::vector<const DohUpgradeEntry*> GetDohUpgradeEntriesFromNameservers( + const std::vector<IPEndPoint>& dns_servers, + const std::vector<std::string>& excluded_providers) { +- const std::vector<const DohUpgradeEntry>& upgradable_servers = +- GetDohUpgradeList(); ++ const std::vector<DohUpgradeEntry>& upgradable_servers = GetDohUpgradeList(); + std::vector<const DohUpgradeEntry*> entries; + + for (const auto& server : dns_servers) { +@@ -417,8 +416,7 @@ std::vector<DnsConfig::DnsOverHttpsServerConfig> + GetDohUpgradeServersFromDotHostname( + const std::string& dot_server, + const std::vector<std::string>& excluded_providers) { +- const std::vector<const DohUpgradeEntry>& upgradable_servers = +- GetDohUpgradeList(); ++ const std::vector<DohUpgradeEntry>& upgradable_servers = GetDohUpgradeList(); + std::vector<DnsConfig::DnsOverHttpsServerConfig> doh_servers; + + if (dot_server.empty()) +@@ -451,8 +449,7 @@ GetDohUpgradeServersFromNameservers( + + std::string GetDohProviderIdForHistogramFromDohConfig( + const DnsConfig::DnsOverHttpsServerConfig& doh_server) { +- const std::vector<const DohUpgradeEntry>& upgradable_servers = +- GetDohUpgradeList(); ++ const std::vector<DohUpgradeEntry>& upgradable_servers = GetDohUpgradeList(); + for (const auto& upgrade_entry : upgradable_servers) { + if (doh_server.server_template == + upgrade_entry.dns_over_https_config.server_template) { diff --git a/fix-shutdown-crash-in-ProfileManager.patch b/fix-shutdown-crash-in-ProfileManager.patch new file mode 100644 index 000000000000..01074eca5325 --- /dev/null +++ b/fix-shutdown-crash-in-ProfileManager.patch @@ -0,0 +1,45 @@ +From e73aed9a5ef15102f29ac31b70290faf5c90f9fe Mon Sep 17 00:00:00 2001 +From: Evan Stade <estade@chromium.org> +Date: Wed, 16 Oct 2019 16:01:32 +0000 +Subject: [PATCH] Fix shutdown crash in ProfileManager. + +OnProfileMarkedForPermanentDeletion should move from +ProfileManagerObserver to ProfileObserver, which would also +fix this bug. However, changing the order of members is the +quickest and most cherry-pick-able way to avoid the crash. + +Bug: 1005244 +Change-Id: If2db68c846dd418cd02864b57b9b543687fa1e03 +Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1863518 +Auto-Submit: Evan Stade <estade@chromium.org> +Reviewed-by: David Roger <droger@chromium.org> +Commit-Queue: Evan Stade <estade@chromium.org> +Cr-Commit-Position: refs/heads/master@{#706467} +--- + chrome/browser/profiles/profile_manager.h | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/chrome/browser/profiles/profile_manager.h b/chrome/browser/profiles/profile_manager.h +index b60df76d59..7d02af7f8f 100644 +--- a/chrome/browser/profiles/profile_manager.h ++++ b/chrome/browser/profiles/profile_manager.h +@@ -410,6 +410,10 @@ class ProfileManager : public content::NotificationObserver, + const base::FilePath& profile_dir); + #endif // !defined(OS_ANDROID) + ++ // Destroy after |profile_info_cache_| since Profile destruction may trigger ++ // some observers to unregister themselves. ++ base::ObserverList<ProfileManagerObserver> observers_; ++ + // Object to cache various information about profiles. Contains information + // about every profile which has been created for this instance of Chrome, + // if it has not been explicitly deleted. It must be destroyed after +@@ -451,8 +455,6 @@ class ProfileManager : public content::NotificationObserver, + // Controls whether to initialize some services. Only disabled for testing. + bool do_final_services_init_ = true; + +- base::ObserverList<ProfileManagerObserver> observers_; +- + // TODO(chrome/browser/profiles/OWNERS): Usage of this in profile_manager.cc + // should likely be turned into DCHECK_CURRENTLY_ON(BrowserThread::UI) for + // consistency with surrounding code in the same file but that wasn't trivial diff --git a/fix-spammy-unique-font-matching-log.patch b/fix-spammy-unique-font-matching-log.patch new file mode 100644 index 000000000000..9321a98a7254 --- /dev/null +++ b/fix-spammy-unique-font-matching-log.patch @@ -0,0 +1,13 @@ +diff --git a/content/child/child_process_sandbox_support_impl_linux.cc b/content/child/child_process_sandbox_support_impl_linux.cc +index 0a57543eb5..fe2ee491a2 100644 +--- a/content/child/child_process_sandbox_support_impl_linux.cc ++++ b/content/child/child_process_sandbox_support_impl_linux.cc +@@ -78,8 +78,6 @@ void WebSandboxSupportLinux::MatchFontByPostscriptNameOrFullFontName( + std::string family_name; + if (!font_loader_->MatchFontByPostscriptNameOrFullFontName(font_unique_name, + &font_identity)) { +- LOG(ERROR) << "FontService unique font name matching request did not " +- "receive a response."; + return; + } + diff --git a/fix-wrong-string-initialization-in-LinkedHashSet.patch b/fix-wrong-string-initialization-in-LinkedHashSet.patch deleted file mode 100644 index 0047c99f044d..000000000000 --- a/fix-wrong-string-initialization-in-LinkedHashSet.patch +++ /dev/null @@ -1,135 +0,0 @@ -From 74138b9febd37eac0fc26b8efb110014a83a52c6 Mon Sep 17 00:00:00 2001 -From: Jeremy Roman <jbroman@chromium.org> -Date: Wed, 7 Aug 2019 13:26:48 +0000 -Subject: [PATCH] WTF: Make LinkedHashSet understand values for which memset - initialization would be bad. - -Includes a unit test which fails before, and uses this to fix FontCacheKeyTraits. - -Bug: 980025 -Change-Id: If41f97444c7fd37b9b95d6dadaf3da5689079e9e -Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1739948 -Reviewed-by: Kentaro Hara <haraken@chromium.org> -Reviewed-by: Yutaka Hirano <yhirano@chromium.org> -Commit-Queue: Jeremy Roman <jbroman@chromium.org> -Cr-Commit-Position: refs/heads/master@{#684731} ---- - .../renderer/platform/fonts/font_cache_key.h | 4 ++ - .../renderer/platform/wtf/linked_hash_set.h | 10 ++++- - .../platform/wtf/list_hash_set_test.cc | 45 +++++++++++++++++-- - 3 files changed, 55 insertions(+), 4 deletions(-) - -diff --git a/third_party/blink/renderer/platform/fonts/font_cache_key.h b/third_party/blink/renderer/platform/fonts/font_cache_key.h -index 0efc8fb909..90063cb2ea 100644 ---- a/third_party/blink/renderer/platform/fonts/font_cache_key.h -+++ b/third_party/blink/renderer/platform/fonts/font_cache_key.h -@@ -133,6 +133,10 @@ struct FontCacheKeyHash { - - struct FontCacheKeyTraits : WTF::SimpleClassHashTraits<FontCacheKey> { - STATIC_ONLY(FontCacheKeyTraits); -+ -+ // std::string's empty state need not be zero in all implementations, -+ // and it is held within FontFaceCreationParams. -+ static const bool kEmptyValueIsZero = false; - }; - - } // namespace blink -diff --git a/third_party/blink/renderer/platform/wtf/linked_hash_set.h b/third_party/blink/renderer/platform/wtf/linked_hash_set.h -index b35b6e95f1..77e524c084 100644 ---- a/third_party/blink/renderer/platform/wtf/linked_hash_set.h -+++ b/third_party/blink/renderer/platform/wtf/linked_hash_set.h -@@ -146,6 +146,11 @@ class LinkedHashSetNode : public LinkedHashSetNodeBase { - LinkedHashSetNodeBase* next) - : LinkedHashSetNodeBase(prev, next), value_(value) {} - -+ LinkedHashSetNode(ValueArg&& value, -+ LinkedHashSetNodeBase* prev, -+ LinkedHashSetNodeBase* next) -+ : LinkedHashSetNodeBase(prev, next), value_(std::move(value)) {} -+ - LinkedHashSetNode(LinkedHashSetNode&& other) - : LinkedHashSetNodeBase(std::move(other)), - value_(std::move(other.value_)) {} -@@ -445,10 +450,13 @@ struct LinkedHashSetTraits - - // The slot is empty when the next_ field is zero so it's safe to zero - // the backing. -- static const bool kEmptyValueIsZero = true; -+ static const bool kEmptyValueIsZero = ValueTraits::kEmptyValueIsZero; - - static const bool kHasIsEmptyValueFunction = true; - static bool IsEmptyValue(const Node& node) { return !node.next_; } -+ static Node EmptyValue() { -+ return Node(ValueTraits::EmptyValue(), nullptr, nullptr); -+ } - - static const int kDeletedValue = -1; - -diff --git a/third_party/blink/renderer/platform/wtf/list_hash_set_test.cc b/third_party/blink/renderer/platform/wtf/list_hash_set_test.cc -index 4c3f8990b0..cd1be0089b 100644 ---- a/third_party/blink/renderer/platform/wtf/list_hash_set_test.cc -+++ b/third_party/blink/renderer/platform/wtf/list_hash_set_test.cc -@@ -487,6 +487,7 @@ struct Simple { - }; - - struct Complicated { -+ Complicated() : Complicated(0) {} - Complicated(int value) : simple_(value) { objects_constructed_++; } - - Complicated(const Complicated& other) : simple_(other.simple_) { -@@ -495,9 +496,6 @@ struct Complicated { - - Simple simple_; - static int objects_constructed_; -- -- private: -- Complicated() = delete; - }; - - int Complicated::objects_constructed_ = 0; -@@ -731,4 +729,45 @@ TYPED_TEST(ListOrLinkedHashSetMoveOnlyTest, MoveOnlyValue) { - - } // anonymous namespace - -+// A unit type which objects to its state being initialized wrong. -+struct InvalidZeroValue { -+ InvalidZeroValue() = default; -+ InvalidZeroValue(WTF::HashTableDeletedValueType) : deleted_(true) {} -+ ~InvalidZeroValue() { CHECK(ok_); } -+ bool IsHashTableDeletedValue() const { return deleted_; } -+ -+ bool ok_ = true; -+ bool deleted_ = false; -+}; -+ -+template <> -+struct HashTraits<InvalidZeroValue> : SimpleClassHashTraits<InvalidZeroValue> { -+ static const bool kEmptyValueIsZero = false; -+}; -+ -+template <> -+struct DefaultHash<InvalidZeroValue> { -+ struct Hash { -+ static unsigned GetHash(const InvalidZeroValue&) { return 0; } -+ static bool Equal(const InvalidZeroValue&, const InvalidZeroValue&) { -+ return true; -+ } -+ }; -+}; -+ -+template <typename Set> -+class ListOrLinkedHashSetInvalidZeroTest : public testing::Test {}; -+ -+using InvalidZeroValueSetTypes = -+ testing::Types<ListHashSet<InvalidZeroValue>, -+ ListHashSet<InvalidZeroValue, 1>, -+ LinkedHashSet<InvalidZeroValue>>; -+TYPED_TEST_SUITE(ListOrLinkedHashSetInvalidZeroTest, InvalidZeroValueSetTypes); -+ -+TYPED_TEST(ListOrLinkedHashSetInvalidZeroTest, InvalidZeroValue) { -+ using Set = TypeParam; -+ Set set; -+ set.insert(InvalidZeroValue()); -+} -+ - } // namespace WTF diff --git a/include-limits-in-web_time_range.cc.patch b/include-limits-in-web_time_range.cc.patch deleted file mode 100644 index 8ef9c77bcfb3..000000000000 --- a/include-limits-in-web_time_range.cc.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 5baf7df7f4c5971dab552897eeef94b194650ce5 Mon Sep 17 00:00:00 2001 -From: Dave Tapuska <dtapuska@chromium.org> -Date: Mon, 12 Aug 2019 22:30:13 +0000 -Subject: [PATCH] Fix build failure due to missing include for - std::numeric_limits usage. - -Some configurations fail to build, limits should have been included. - -BUG=992832 - -Change-Id: I894ba0543bfcef101c93259e39a31d12ae6d035c -Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1747981 -Commit-Queue: Dave Tapuska <dtapuska@chromium.org> -Reviewed-by: Mostyn Bramley-Moore <mostynb@vewd.com> -Cr-Commit-Position: refs/heads/master@{#686214} ---- - third_party/blink/renderer/platform/exported/web_time_range.cc | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/third_party/blink/renderer/platform/exported/web_time_range.cc b/third_party/blink/renderer/platform/exported/web_time_range.cc -index 384566a13e..68d83e14fe 100644 ---- a/third_party/blink/renderer/platform/exported/web_time_range.cc -+++ b/third_party/blink/renderer/platform/exported/web_time_range.cc -@@ -31,6 +31,7 @@ - #include "third_party/blink/public/platform/web_time_range.h" - - #include <cmath> -+#include <limits> - - namespace blink { - diff --git a/include-memory-in-one_euro_filter.h.patch b/include-memory-in-one_euro_filter.h.patch deleted file mode 100644 index d4a323f536fc..000000000000 --- a/include-memory-in-one_euro_filter.h.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 8c747a9c14ed4905f60f6680e2e09e33ea34163e Mon Sep 17 00:00:00 2001 -From: Jose Dapena Paz <jose.dapena@lge.com> -Date: Fri, 26 Jul 2019 16:18:17 +0000 -Subject: [PATCH] IWYU: include <memory> in one_euro_filter.h as it uses - std::unique_ptr -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Bug: 819294 -Change-Id: Ie1530f7046b0c8eb76e26adca530fa57c67ed876 -Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1720637 -Reviewed-by: Ella Ge <eirage@chromium.org> -Commit-Queue: José Dapena Paz <jose.dapena@lge.com> -Cr-Commit-Position: refs/heads/master@{#681321} ---- - third_party/one_euro_filter/src/one_euro_filter.h | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/third_party/one_euro_filter/src/one_euro_filter.h b/third_party/one_euro_filter/src/one_euro_filter.h -index 7f8d15b62a..a8cd0ab9a2 100644 ---- a/third_party/one_euro_filter/src/one_euro_filter.h -+++ b/third_party/one_euro_filter/src/one_euro_filter.h -@@ -1,6 +1,8 @@ - #ifndef ONE_EURO_ONE_EURO_FILTER_H_ - #define ONE_EURO_ONE_EURO_FILTER_H_ - -+#include <memory> -+ - #include "low_pass_filter.h" - - namespace one_euro_filter { diff --git a/link-against-harfbuzz-subset.patch b/link-against-harfbuzz-subset.patch deleted file mode 100644 index 05731a55b2b5..000000000000 --- a/link-against-harfbuzz-subset.patch +++ /dev/null @@ -1,55 +0,0 @@ -From 27e25336b8316ff3ec4e464058682ed85801fd06 Mon Sep 17 00:00:00 2001 -From: Raphael Kubo da Costa <raphael.kubo.da.costa@intel.com> -Date: Mon, 29 Jul 2019 10:54:28 +0000 -Subject: [PATCH] Also link against libharfbuzz-subset when use_system_harfbuzz - is true -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -When building HarfBuzz as part of Chromium, there is a single source set -with all the files we need in the build. - -Upstream HarfBuzz, on the other hand, produces a few different libraries: -harfbuzz, harfbuzz-icu and harfbuzz-subset. When |use_system_harfbuzz| is -true, we were only looking for (and using) harfbuzz.pc with pkg-config even -though we also use symbols from libharfbuzz-subset.so. This resulted in -errors when linking: - - ld: obj/skia/skia/SkPDFSubsetFont.o: in function `SkPDFSubsetFont(sk_sp<SkData>, SkPDFGlyphUse const&, SkPDF::Metadata::Subsetter, char const*, int)': - SkPDFSubsetFont.cpp:(.text._Z15SkPDFSubsetFont5sk_spI6SkDataERK13SkPDFGlyphUseN5SkPDF8Metadata9SubsetterEPKci+0x48a): undefined reference to `hb_subset_input_create_or_fail' - ld: SkPDFSubsetFont.cpp:(.text._Z15SkPDFSubsetFont5sk_spI6SkDataERK13SkPDFGlyphUseN5SkPDF8Metadata9SubsetterEPKci+0x4af): undefined reference to `hb_subset_input_glyph_set' - ld: SkPDFSubsetFont.cpp:(.text._Z15SkPDFSubsetFont5sk_spI6SkDataERK13SkPDFGlyphUseN5SkPDF8Metadata9SubsetterEPKci+0x5d7): undefined reference to `hb_subset_input_set_retain_gids' - ld: SkPDFSubsetFont.cpp:(.text._Z15SkPDFSubsetFont5sk_spI6SkDataERK13SkPDFGlyphUseN5SkPDF8Metadata9SubsetterEPKci+0x5e4): undefined reference to `hb_subset_input_set_drop_hints' - ld: SkPDFSubsetFont.cpp:(.text._Z15SkPDFSubsetFont5sk_spI6SkDataERK13SkPDFGlyphUseN5SkPDF8Metadata9SubsetterEPKci+0x5f3): undefined reference to `hb_subset' - ld: SkPDFSubsetFont.cpp:(.text._Z15SkPDFSubsetFont5sk_spI6SkDataERK13SkPDFGlyphUseN5SkPDF8Metadata9SubsetterEPKci+0x66f): undefined reference to `hb_subset_input_destroy' - -as reported in -https://groups.google.com/a/chromium.org/d/msg/chromium-packagers/UyJsVJ5QqWo/jSv5z7-rEQAJ - -Change-Id: I997af075c7b7263cd7cc71a63db5b0f93bd1ab59 -Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1715288 -Auto-Submit: Raphael Kubo da Costa <raphael.kubo.da.costa@intel.com> -Commit-Queue: Dominik Röttsches <drott@chromium.org> -Reviewed-by: Dominik Röttsches <drott@chromium.org> -Cr-Commit-Position: refs/heads/master@{#681760} ---- - third_party/harfbuzz-ng/BUILD.gn | 5 ++++- - 1 file changed, 4 insertions(+), 1 deletion(-) - -diff --git a/third_party/harfbuzz-ng/BUILD.gn b/third_party/harfbuzz-ng/BUILD.gn -index 37d8e334c2..72013eb1db 100644 ---- a/third_party/harfbuzz-ng/BUILD.gn -+++ b/third_party/harfbuzz-ng/BUILD.gn -@@ -16,7 +16,10 @@ if (use_system_harfbuzz) { - "//third_party:freetype_harfbuzz", - "//third_party/freetype:freetype_source", - ] -- packages = [ "harfbuzz" ] -+ packages = [ -+ "harfbuzz", -+ "harfbuzz-subset", -+ ] - } - } else { - config("harfbuzz_config") { |