diff options
author | Daniel Playfair Cal | 2020-04-09 00:33:29 +1000 |
---|---|---|
committer | Daniel Playfair Cal | 2020-04-09 00:33:29 +1000 |
commit | 7157d19e4cbf4fcedcb2cf49f25e457f9dac8220 (patch) | |
tree | 9d43262939ddc148953d9b1dc7545c44d584c4c4 | |
parent | 8bf929c865c8a35cb71002480f4d04190bd62349 (diff) | |
parent | d60157861037f70068f0b8c8a7427b8040230160 (diff) | |
download | aur-7157d19e4cbf4fcedcb2cf49f25e457f9dac8220.tar.gz |
81.0.4044.92-1
-rw-r--r-- | .SRCINFO | 23 | ||||
-rw-r--r-- | 0001-Add-missing-algorithm-header-in-bitmap_cursor_factor.patch | 48 | ||||
-rw-r--r-- | PKGBUILD | 49 | ||||
-rw-r--r-- | cros-search-service-Include-cmath-for-std-pow.patch | 35 | ||||
-rw-r--r-- | move-RemoteTreeNode-declaration.patch | 237 |
5 files changed, 9 insertions, 383 deletions
@@ -1,6 +1,6 @@ pkgbase = chromium-ozone pkgdesc = Chromium built with patches for wayland support via Ozone - pkgver = 80.0.3987.163 + pkgver = 81.0.4044.92 pkgrel = 1 url = https://www.chromium.org/Home install = chromium.install @@ -39,7 +39,6 @@ pkgbase = chromium-ozone depends = fontconfig depends = harfbuzz depends = libvpx - depends = libjpeg depends = re2 depends = snappy depends = ffmpeg @@ -58,30 +57,14 @@ pkgbase = chromium-ozone conflicts = chromium options = debug options = !strip - source = https://commondatastorage.googleapis.com/chromium-browser-official/chromium-80.0.3987.163.tar.xz + source = https://commondatastorage.googleapis.com/chromium-browser-official/chromium-81.0.4044.92.tar.xz source = chromium-launcher-6.tar.gz::https://github.com/foutrelis/chromium-launcher/archive/v6.tar.gz - source = 0001-Add-missing-algorithm-header-in-bitmap_cursor_factor.patch - source = cros-search-service-Include-cmath-for-std-pow.patch - source = move-RemoteTreeNode-declaration.patch - source = sync-enable-USSPasswords-by-default.patch - source = fix-shim-header-generation-when-unbundling-ICU.patch - source = fix-building-with-system-zlib.patch - source = remove-verbose-logging-in-local-unique-font-matching.patch - source = fix-building-with-unbundled-libxml.patch source = rename-Relayout-in-DesktopWindowTreeHostPlatform.patch source = rebuild-Linux-frame-button-cache-when-activation.patch source = chromium-widevine.patch source = chromium-skia-harmony.patch - sha256sums = b6ddefa9434877a9b923631b7525f7f2f80118dd986ecdac87f2c9f11f237346 + sha256sums = a2cf3fd07a66330b189724cdcb4549ddac72705fba6adb33020bc6444efb1a44 sha256sums = 04917e3cd4307d8e31bfb0027a5dce6d086edb10ff8a716024fbb8bb0c7dccf1 - sha256sums = 716c28bed9f6e9c32e3617e125c1b04806700aef691763923cd4ed14b8d23279 - sha256sums = 0a8d1af2a3734b5f99ea8462940e332db4acee7130fe436ad3e4b7ad133e5ae5 - sha256sums = 21f631851cdcb347f40793485b168cb5d0da65ae26ae39ba58d624c66197d0a5 - sha256sums = 08ef82476780e0864b5bf7f20eb19db320e73b9a5d4f595351e12e97dda8746f - sha256sums = e477aa48a11ca4d53927f66a9593567fcd053325fb38af30ac3508465f1dd1f6 - sha256sums = 18276e65c68a0c328601b12fefb7e8bfc632346f34b87e64944c9de8c95c5cfa - sha256sums = 5bc775c0ece84d67855f51b30eadcf96fa8163b416d2036e9f9ba19072f54dfe - sha256sums = e530d1b39504c2ab247e16f1602359c484e9e8be4ef6d4824d68b14d29a7f60b sha256sums = ae3bf107834bd8eda9a3ec7899fe35fde62e6111062e5def7d24bf49b53db3db sha256sums = 46f7fc9768730c460b27681ccf3dc2685c7e1fd22d70d3a82d9e57e3389bb014 sha256sums = 709e2fddba3c1f2ed4deb3a239fc0479bfa50c46e054e7f32db4fb1365fed070 diff --git a/0001-Add-missing-algorithm-header-in-bitmap_cursor_factor.patch b/0001-Add-missing-algorithm-header-in-bitmap_cursor_factor.patch deleted file mode 100644 index ba05707cb0ba..000000000000 --- a/0001-Add-missing-algorithm-header-in-bitmap_cursor_factor.patch +++ /dev/null @@ -1,48 +0,0 @@ -From 1def13d08fb76df631b604af75e754df94626c0c Mon Sep 17 00:00:00 2001 -From: Daniel Playfair Cal <daniel.playfair.cal@gmail.com> -Date: Fri, 13 Dec 2019 11:48:23 +0000 -Subject: [PATCH] Add missing algorithm header in - bitmap_cursor_factory_ozone.cc - -This is needed for the use of std::find_if - -Change-Id: Ica47d3d323f5b2e115463372824b1af84b2294bc -Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1963832 -Commit-Queue: Maksim Sisov <msisov@igalia.com> -Reviewed-by: Maksim Sisov <msisov@igalia.com> -Reviewed-by: Robert Kroeger <rjkroege@chromium.org> -Auto-Submit: Daniel Playfair Cal <daniel.playfair.cal@gmail.com> -Cr-Commit-Position: refs/heads/master@{#724589} ---- - AUTHORS | 1 + - ui/base/cursor/ozone/bitmap_cursor_factory_ozone.cc | 2 ++ - 2 files changed, 3 insertions(+) - -diff --git a/AUTHORS b/AUTHORS -index 751283238162..bf8810c3f109 100644 ---- a/AUTHORS -+++ b/AUTHORS -@@ -205,6 +205,7 @@ Daniel Johnson <danielj41@gmail.com> - Daniel Lockyer <thisisdaniellockyer@gmail.com> - Daniel Nishi <dhnishi@gmail.com> - Daniel Platz <daplatz@googlemail.com> -+Daniel Playfair Cal <daniel.playfair.cal@gmail.com> - Daniel Shaulov <dshaulov@ptc.com> - Daniel Trebbien <dtrebbien@gmail.com> - Daniel Waxweiler <daniel.waxweiler@gmail.com> -diff --git a/ui/base/cursor/ozone/bitmap_cursor_factory_ozone.cc b/ui/base/cursor/ozone/bitmap_cursor_factory_ozone.cc -index 71ec564b4803..f79d7932e236 100644 ---- a/ui/base/cursor/ozone/bitmap_cursor_factory_ozone.cc -+++ b/ui/base/cursor/ozone/bitmap_cursor_factory_ozone.cc -@@ -4,6 +4,8 @@ - - #include "ui/base/cursor/ozone/bitmap_cursor_factory_ozone.h" - -+#include <algorithm> -+ - #include "base/logging.h" - #include "third_party/skia/include/core/SkBitmap.h" - #include "ui/base/cursor/cursors_aura.h" --- -2.24.1 - @@ -5,7 +5,7 @@ # Contributor: Daniel J Griffiths <ghost1227@archlinux.us> pkgname=chromium-ozone -pkgver=80.0.3987.163 +pkgver=81.0.4044.92 pkgrel=1 _launcher_ver=6 pkgdesc="Chromium built with patches for wayland support via Ozone" @@ -28,28 +28,12 @@ optdepends=('pepper-flash: support for Flash content' 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 - 0001-Add-missing-algorithm-header-in-bitmap_cursor_factor.patch - cros-search-service-Include-cmath-for-std-pow.patch - move-RemoteTreeNode-declaration.patch - sync-enable-USSPasswords-by-default.patch - fix-shim-header-generation-when-unbundling-ICU.patch - fix-building-with-system-zlib.patch - remove-verbose-logging-in-local-unique-font-matching.patch - fix-building-with-unbundled-libxml.patch rename-Relayout-in-DesktopWindowTreeHostPlatform.patch rebuild-Linux-frame-button-cache-when-activation.patch chromium-widevine.patch chromium-skia-harmony.patch) -sha256sums=('b6ddefa9434877a9b923631b7525f7f2f80118dd986ecdac87f2c9f11f237346' +sha256sums=('a2cf3fd07a66330b189724cdcb4549ddac72705fba6adb33020bc6444efb1a44' '04917e3cd4307d8e31bfb0027a5dce6d086edb10ff8a716024fbb8bb0c7dccf1' - '716c28bed9f6e9c32e3617e125c1b04806700aef691763923cd4ed14b8d23279' - '0a8d1af2a3734b5f99ea8462940e332db4acee7130fe436ad3e4b7ad133e5ae5' - '21f631851cdcb347f40793485b168cb5d0da65ae26ae39ba58d624c66197d0a5' - '08ef82476780e0864b5bf7f20eb19db320e73b9a5d4f595351e12e97dda8746f' - 'e477aa48a11ca4d53927f66a9593567fcd053325fb38af30ac3508465f1dd1f6' - '18276e65c68a0c328601b12fefb7e8bfc632346f34b87e64944c9de8c95c5cfa' - '5bc775c0ece84d67855f51b30eadcf96fa8163b416d2036e9f9ba19072f54dfe' - 'e530d1b39504c2ab247e16f1602359c484e9e8be4ef6d4824d68b14d29a7f60b' 'ae3bf107834bd8eda9a3ec7899fe35fde62e6111062e5def7d24bf49b53db3db' '46f7fc9768730c460b27681ccf3dc2685c7e1fd22d70d3a82d9e57e3389bb014' '709e2fddba3c1f2ed4deb3a239fc0479bfa50c46e054e7f32db4fb1365fed070' @@ -65,7 +49,7 @@ declare -gA _system_libs=( [harfbuzz-ng]=harfbuzz [icu]=icu [libdrm]= - [libjpeg]=libjpeg + #[libjpeg]=libjpeg #[libpng]=libpng # https://crbug.com/752403#c10 [libvpx]=libvpx [libwebp]=libwebp @@ -79,7 +63,7 @@ declare -gA _system_libs=( ) _unwanted_bundled_libs=( ${!_system_libs[@]} - ${_system_libs[libjpeg]+libjpeg_turbo} + ${libjpeg_turbo} ) depends+=(${_system_libs[@]}) @@ -90,7 +74,7 @@ _google_api_key=AIzaSyDwr302FpOSkGRpLlUpPThNTDPbXcIn_FM _google_default_client_id=413772536636.apps.googleusercontent.com _google_default_client_secret=0ZChLK6AxeA3Isu96MkwqDR4 -# Branch point: 722274 +# Branch point: 737173 # Extra commits related specifically to wayland support: # These consist of the above commits and their dependencies @@ -111,28 +95,6 @@ prepare() { third_party/blink/renderer/core/xml/parser/xml_document_parser.cc \ third_party/libxml/chromium/*.cc - # build fixes - patch -Np1 -i ../0001-Add-missing-algorithm-header-in-bitmap_cursor_factor.patch - - # https://crbug.com/957519 - patch -Np1 -i ../cros-search-service-Include-cmath-for-std-pow.patch - patch -Np1 -i ../move-RemoteTreeNode-declaration.patch - - # https://crbug.com/1027929 - patch -Np1 -i ../sync-enable-USSPasswords-by-default.patch - - # https://crbug.com/989153 - patch -Np1 -i ../fix-shim-header-generation-when-unbundling-ICU.patch - - # https://crbug.com/977964 - patch -Np1 -i ../fix-building-with-system-zlib.patch - - # https://crbug.com/1005508 - patch -Np1 -i ../remove-verbose-logging-in-local-unique-font-matching.patch - - # https://crbug.com/1043042 - patch -Np1 -i ../fix-building-with-unbundled-libxml.patch - # https://crbug.com/1049258 patch -Np1 -i ../rename-Relayout-in-DesktopWindowTreeHostPlatform.patch patch -Np1 -i ../rebuild-Linux-frame-button-cache-when-activation.patch @@ -240,6 +202,7 @@ package() { cd "$srcdir/chromium-$pkgver" install -D out/Release/chrome "$pkgdir/usr/lib/chromium/chromium" + install -D out/Release/crashpad_handler "$pkgdir/usr/lib/chromium/crashpad_handler" install -Dm4755 out/Release/chrome_sandbox "$pkgdir/usr/lib/chromium/chrome-sandbox" ln -s /usr/lib/chromium/chromedriver "$pkgdir/usr/bin/chromedriver" diff --git a/cros-search-service-Include-cmath-for-std-pow.patch b/cros-search-service-Include-cmath-for-std-pow.patch deleted file mode 100644 index 410b968d0fe6..000000000000 --- a/cros-search-service-Include-cmath-for-std-pow.patch +++ /dev/null @@ -1,35 +0,0 @@ -From 8273f4d3130e06fd8b6bef87b07c936304b971d9 Mon Sep 17 00:00:00 2001 -From: Raphael Kubo da Costa <raphael.kubo.da.costa@intel.com> -Date: Tue, 10 Dec 2019 20:59:57 +0000 -Subject: [PATCH] [cros search service]: Include <cmath> for std::pow() - -IWYU. Follow up to commit 2b2ea3c09b ("[cros search service] Move shared -string matching functions to //chrome"), which broke the libstdc++ build: - - ../../chrome/common/string_matching/fuzzy_tokenized_string_match.cc:199:14: error: no member named 'pow' in namespace 'std' - std::pow(partial_match_penalty_rate, long_start - current - 1); - ~~~~~^ - -Bug: 957519 -Change-Id: I66f61cb4f93cfa0bfa3d1b00ba391ddd8f31a7fb -Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1960310 -Auto-Submit: Raphael Kubo da Costa <raphael.kubo.da.costa@intel.com> -Reviewed-by: Jia Meng <jiameng@chromium.org> -Commit-Queue: Raphael Kubo da Costa <raphael.kubo.da.costa@intel.com> -Cr-Commit-Position: refs/heads/master@{#723499} ---- - chrome/common/string_matching/fuzzy_tokenized_string_match.cc | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/chrome/common/string_matching/fuzzy_tokenized_string_match.cc b/chrome/common/string_matching/fuzzy_tokenized_string_match.cc -index 8351fa701e4..884ef638c61 100644 ---- a/chrome/common/string_matching/fuzzy_tokenized_string_match.cc -+++ b/chrome/common/string_matching/fuzzy_tokenized_string_match.cc -@@ -5,6 +5,7 @@ - #include "chrome/common/string_matching/fuzzy_tokenized_string_match.h" - - #include <algorithm> -+#include <cmath> - #include <iterator> - - #include "base/i18n/case_conversion.h" diff --git a/move-RemoteTreeNode-declaration.patch b/move-RemoteTreeNode-declaration.patch deleted file mode 100644 index 50fc78cdb47a..000000000000 --- a/move-RemoteTreeNode-declaration.patch +++ /dev/null @@ -1,237 +0,0 @@ -From cdf3e81ff49b200213d67d65558f2919222b60ab Mon Sep 17 00:00:00 2001 -From: Raphael Kubo da Costa <raphael.kubo.da.costa@intel.com> -Date: Mon, 16 Dec 2019 11:39:11 +0000 -Subject: [PATCH] BookmarkModelMerger: Move RemoteTreeNode declaration to - header. - -This fixes the build with libstdc++ after commit 8f5dad93e58 ("Fix CHECK -failure due to untracked local nodes"): - -/usr/lib/gcc/x86_64-redhat-linux/9/../../../../include/c++/9/bits/stl_pair.h:215:11: error: field has incomplete type 'sync_bookmarks::BookmarkModelMerger::RemoteTreeNode' - _T2 second; /// @c second is a copy of the second object - ^ -/usr/lib/gcc/x86_64-redhat-linux/9/../../../../include/c++/9/ext/aligned_buffer.h:91:28: note: in instantiation of template class 'std::pair<const std::__cxx11::basic_string<char>, sync_bookmarks::BookmarkModelMerger::RemoteTreeNode>' requested here - : std::aligned_storage<sizeof(_Tp), __alignof__(_Tp)> - ^ -/usr/lib/gcc/x86_64-redhat-linux/9/../../../../include/c++/9/bits/hashtable_policy.h:233:43: note: in instantiation of template class '__gnu_cxx::__aligned_buffer<std::pair<const std::__cxx11::basic_string<char>, sync_bookmarks::BookmarkModelMerger::RemoteTreeNode> >' requested here - __gnu_cxx::__aligned_buffer<_Value> _M_storage; - ^ -/usr/lib/gcc/x86_64-redhat-linux/9/../../../../include/c++/9/bits/hashtable_policy.h:264:39: note: in instantiation of template class 'std::__detail::_Hash_node_value_base<std::pair<const std::__cxx11::basic_string<char>, sync_bookmarks::BookmarkModelMerger::RemoteTreeNode> >' requested here - struct _Hash_node<_Value, true> : _Hash_node_value_base<_Value> - ^ -/usr/lib/gcc/x86_64-redhat-linux/9/../../../../include/c++/9/bits/hashtable_policy.h:2028:25: note: in instantiation of template class 'std::__detail::_Hash_node<std::pair<const std::__cxx11::basic_string<char>, sync_bookmarks::BookmarkModelMerger::RemoteTreeNode>, true>' requested here - rebind_traits<typename __node_type::value_type>; - ^ -/usr/lib/gcc/x86_64-redhat-linux/9/../../../../include/c++/9/bits/hashtable.h:184:15: note: in instantiation of template class 'std::__detail::_Hashtable_alloc<std::allocator<std::__detail::_Hash_node<std::pair<const std::__cxx11::basic_string<char>, sync_bookmarks::BookmarkModelMerger::RemoteTreeNode>, true> > > -' requested here - private __detail::_Hashtable_alloc< - ^ -/usr/lib/gcc/x86_64-redhat-linux/9/../../../../include/c++/9/bits/unordered_map.h:105:18: note: in instantiation of template class 'std::_Hashtable<std::__cxx11::basic_string<char>, std::pair<const std::__cxx11::basic_string<char>, sync_bookmarks::BookmarkModelMerger::RemoteTreeNode>, std::allocator<std::pair<con -st std::__cxx11::basic_string<char>, sync_bookmarks::BookmarkModelMerger::RemoteTreeNode> >, std::__detail::_Select1st, std::equal_to<std::__cxx11::basic_string<char> >, std::hash<std::string>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__deta -il::_Hashtable_traits<true, false, true> >' requested here - _Hashtable _M_h; - ^ -../../components/sync_bookmarks/bookmark_model_merger.h:146:22: note: in instantiation of template class 'std::unordered_map<std::__cxx11::basic_string<char>, sync_bookmarks::BookmarkModelMerger::RemoteTreeNode, std::hash<std::string>, std::equal_to<std::__cxx11::basic_string<char> >, std::allocator<std::pair<con -st std::__cxx11::basic_string<char>, sync_bookmarks::BookmarkModelMerger::RemoteTreeNode> > >' requested here - const RemoteForest remote_forest_; - ^ -../../components/sync_bookmarks/bookmark_model_merger.h:53:9: note: forward declaration of 'sync_bookmarks::BookmarkModelMerger::RemoteTreeNode' - class RemoteTreeNode; - ^ - -Essentially, the problem is that libstdc++'s std::unordered_map<T, U> -implementation requires both T and U to be fully declared. I raised the -problem in https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92770, and GCC's -position is that we are relying on undefined behavior according to the C++ -standard (https://eel.is/c++draft/requirements#res.on.functions-2.5). - -Bug: 957519 -Change-Id: Ife7e435e516932a795bfbe05b2c910c3272878f0 -Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1960156 -Commit-Queue: Raphael Kubo da Costa <raphael.kubo.da.costa@intel.com> -Reviewed-by: Mikel Astiz <mastiz@chromium.org> -Auto-Submit: Raphael Kubo da Costa <raphael.kubo.da.costa@intel.com> -Cr-Commit-Position: refs/heads/master@{#725070} ---- - .../sync_bookmarks/bookmark_model_merger.cc | 89 +++++++------------ - .../sync_bookmarks/bookmark_model_merger.h | 48 +++++++++- - 2 files changed, 80 insertions(+), 57 deletions(-) - -diff --git a/components/sync_bookmarks/bookmark_model_merger.cc b/components/sync_bookmarks/bookmark_model_merger.cc -index eae153eff95..579848ee664 100644 ---- a/components/sync_bookmarks/bookmark_model_merger.cc -+++ b/components/sync_bookmarks/bookmark_model_merger.cc -@@ -5,7 +5,6 @@ - #include "components/sync_bookmarks/bookmark_model_merger.h" - - #include <algorithm> --#include <memory> - #include <set> - #include <string> - #include <utility> -@@ -205,66 +204,44 @@ UpdatesPerParentId GroupValidUpdatesByParentId( - - } // namespace - --class BookmarkModelMerger::RemoteTreeNode final { -- public: -- // Constructs a tree given |update| as root and recursively all descendants by -- // traversing |*updates_per_parent_id|. |update| and |updates_per_parent_id| -- // must not be null. All updates |*updates_per_parent_id| must represent valid -- // updates. Updates corresponding from descendant nodes are moved away from -- // |*updates_per_parent_id|. -- static RemoteTreeNode BuildTree( -- std::unique_ptr<syncer::UpdateResponseData> update, -- UpdatesPerParentId* updates_per_parent_id); -- -- ~RemoteTreeNode() = default; -- -- // Allow moves, useful during construction. -- RemoteTreeNode(RemoteTreeNode&&) = default; -- RemoteTreeNode& operator=(RemoteTreeNode&&) = default; -- -- const syncer::EntityData& entity() const { return *update_->entity; } -- int64_t response_version() const { return update_->response_version; } -- -- // Direct children nodes, sorted by ascending unique position. These are -- // guaranteed to be valid updates (e.g. IsValidBookmarkSpecifics()). -- const std::vector<RemoteTreeNode>& children() const { return children_; } -- -- // Recursively emplaces all GUIDs (this node and descendants) into -- // |*guid_to_remote_node_map|, which must not be null. -- void EmplaceSelfAndDescendantsByGUID( -- std::unordered_map<std::string, const RemoteTreeNode*>* -- guid_to_remote_node_map) const { -- DCHECK(guid_to_remote_node_map); -- -- const std::string& guid = entity().specifics.bookmark().guid(); -- if (!guid.empty()) { -- DCHECK(base::IsValidGUID(guid)); -- -- // Duplicate GUIDs have been sorted out before. -- bool success = guid_to_remote_node_map->emplace(guid, this).second; -- DCHECK(success); -- } -+BookmarkModelMerger::RemoteTreeNode::RemoteTreeNode() = default; - -- for (const RemoteTreeNode& child : children_) { -- child.EmplaceSelfAndDescendantsByGUID(guid_to_remote_node_map); -- } -- } -+BookmarkModelMerger::RemoteTreeNode::~RemoteTreeNode() = default; -+ -+BookmarkModelMerger::RemoteTreeNode::RemoteTreeNode( -+ BookmarkModelMerger::RemoteTreeNode&&) = default; -+BookmarkModelMerger::RemoteTreeNode& BookmarkModelMerger::RemoteTreeNode:: -+operator=(BookmarkModelMerger::RemoteTreeNode&&) = default; -+ -+void BookmarkModelMerger::RemoteTreeNode::EmplaceSelfAndDescendantsByGUID( -+ std::unordered_map<std::string, const RemoteTreeNode*>* -+ guid_to_remote_node_map) const { -+ DCHECK(guid_to_remote_node_map); -+ -+ const std::string& guid = entity().specifics.bookmark().guid(); -+ if (!guid.empty()) { -+ DCHECK(base::IsValidGUID(guid)); - -- private: -- static bool UniquePositionLessThan(const RemoteTreeNode& lhs, -- const RemoteTreeNode& rhs) { -- const syncer::UniquePosition a_pos = -- syncer::UniquePosition::FromProto(lhs.entity().unique_position); -- const syncer::UniquePosition b_pos = -- syncer::UniquePosition::FromProto(rhs.entity().unique_position); -- return a_pos.LessThan(b_pos); -+ // Duplicate GUIDs have been sorted out before. -+ bool success = guid_to_remote_node_map->emplace(guid, this).second; -+ DCHECK(success); - } - -- RemoteTreeNode() = default; -+ for (const RemoteTreeNode& child : children_) { -+ child.EmplaceSelfAndDescendantsByGUID(guid_to_remote_node_map); -+ } -+} - -- std::unique_ptr<syncer::UpdateResponseData> update_; -- std::vector<RemoteTreeNode> children_; --}; -+// static -+bool BookmarkModelMerger::RemoteTreeNode::UniquePositionLessThan( -+ const RemoteTreeNode& lhs, -+ const RemoteTreeNode& rhs) { -+ const syncer::UniquePosition a_pos = -+ syncer::UniquePosition::FromProto(lhs.entity().unique_position); -+ const syncer::UniquePosition b_pos = -+ syncer::UniquePosition::FromProto(rhs.entity().unique_position); -+ return a_pos.LessThan(b_pos); -+} - - // static - BookmarkModelMerger::RemoteTreeNode -diff --git a/components/sync_bookmarks/bookmark_model_merger.h b/components/sync_bookmarks/bookmark_model_merger.h -index 9b592000dc5..bf0783ecf8e 100644 ---- a/components/sync_bookmarks/bookmark_model_merger.h -+++ b/components/sync_bookmarks/bookmark_model_merger.h -@@ -5,6 +5,7 @@ - #ifndef COMPONENTS_SYNC_BOOKMARKS_BOOKMARK_MODEL_MERGER_H_ - #define COMPONENTS_SYNC_BOOKMARKS_BOOKMARK_MODEL_MERGER_H_ - -+#include <memory> - #include <string> - #include <unordered_map> - #include <vector> -@@ -50,7 +51,52 @@ class BookmarkModelMerger { - - private: - // Internal representation of a remote tree, composed of nodes. -- class RemoteTreeNode; -+ class RemoteTreeNode final { -+ private: -+ using UpdatesPerParentId = -+ std::unordered_map<base::StringPiece, -+ syncer::UpdateResponseDataList, -+ base::StringPieceHash>; -+ -+ public: -+ // Constructs a tree given |update| as root and recursively all descendants -+ // by traversing |*updates_per_parent_id|. |update| and -+ // |updates_per_parent_id| must not be null. All updates -+ // |*updates_per_parent_id| must represent valid updates. Updates -+ // corresponding from descendant nodes are moved away from -+ // |*updates_per_parent_id|. -+ static RemoteTreeNode BuildTree( -+ std::unique_ptr<syncer::UpdateResponseData> update, -+ UpdatesPerParentId* updates_per_parent_id); -+ -+ ~RemoteTreeNode(); -+ -+ // Allow moves, useful during construction. -+ RemoteTreeNode(RemoteTreeNode&&); -+ RemoteTreeNode& operator=(RemoteTreeNode&&); -+ -+ const syncer::EntityData& entity() const { return *update_->entity; } -+ int64_t response_version() const { return update_->response_version; } -+ -+ // Direct children nodes, sorted by ascending unique position. These are -+ // guaranteed to be valid updates (e.g. IsValidBookmarkSpecifics()). -+ const std::vector<RemoteTreeNode>& children() const { return children_; } -+ -+ // Recursively emplaces all GUIDs (this node and descendants) into -+ // |*guid_to_remote_node_map|, which must not be null. -+ void EmplaceSelfAndDescendantsByGUID( -+ std::unordered_map<std::string, const RemoteTreeNode*>* -+ guid_to_remote_node_map) const; -+ -+ private: -+ static bool UniquePositionLessThan(const RemoteTreeNode& lhs, -+ const RemoteTreeNode& rhs); -+ -+ RemoteTreeNode(); -+ -+ std::unique_ptr<syncer::UpdateResponseData> update_; -+ std::vector<RemoteTreeNode> children_; -+ }; - - // A forest composed of multiple trees where the root of each tree represents - // a permanent node, keyed by server-defined unique tag of the root. |