diff --git a/qtbase/src/corelib/thread/qmutex.cpp b/qtbase/src/corelib/thread/qmutex.cpp
index 310d1cb..1282a7c 100644
--- a/qtbase/src/corelib/thread/qmutex.cpp
+++ b/qtbase/src/corelib/thread/qmutex.cpp
@@ -801,7 +801,7 @@ inline void QRecursiveMutexPrivate::unlock() noexcept
 QT_END_NAMESPACE
 
 #ifdef QT_LINUX_FUTEX
-#  include "qmutex_linux.cpp"
+//#  include "qmutex_linux.cpp"
 #elif defined(Q_OS_MAC)
 #  include "qmutex_mac.cpp"
 #elif defined(Q_OS_WIN)
diff --git a/qtlocation/src/3rdparty/mapbox-gl-native/include/mbgl/util/geometry.hpp b/qtlocation/src/3rdparty/mapbox-gl-native/include/mbgl/util/geometry.hpp
index a28c59a..a41b3ab 100644
--- a/qtlocation/src/3rdparty/mapbox-gl-native/include/mbgl/util/geometry.hpp
+++ b/qtlocation/src/3rdparty/mapbox-gl-native/include/mbgl/util/geometry.hpp
@@ -4,6 +4,8 @@
 #include <mapbox/geometry/point_arithmetic.hpp>
 #include <mapbox/geometry/for_each_point.hpp>
 
+#include <cstdint>
+
 namespace mbgl {
 
 enum class FeatureType : uint8_t {
diff --git a/qtlocation/src/3rdparty/mapbox-gl-native/include/mbgl/util/string.hpp b/qtlocation/src/3rdparty/mapbox-gl-native/include/mbgl/util/string.hpp
index 13498cc..4dc82a8 100644
--- a/qtlocation/src/3rdparty/mapbox-gl-native/include/mbgl/util/string.hpp
+++ b/qtlocation/src/3rdparty/mapbox-gl-native/include/mbgl/util/string.hpp
@@ -4,6 +4,7 @@
 #include <string>
 #include <cassert>
 #include <cstdlib>
+#include <cstdint>
 #include <exception>
 
 // Polyfill needed by Qt when building for Android with GCC
diff --git a/qtlocation/src/3rdparty/mapbox-gl-native/mapbox-gl-native.pro b/qtlocation/src/3rdparty/mapbox-gl-native/mapbox-gl-native.pro
index ed974db..775bbe5 100644
--- a/qtlocation/src/3rdparty/mapbox-gl-native/mapbox-gl-native.pro
+++ b/qtlocation/src/3rdparty/mapbox-gl-native/mapbox-gl-native.pro
@@ -406,8 +406,6 @@ HEADERS += \
     platform/qt/src/timer_impl.hpp \
 
 INCLUDEPATH += \
-    deps/boost/1.65.1 \
-    deps/boost/1.65.1/include \
     deps/earcut/0.12.4 \
     deps/earcut/0.12.4/include \
     deps/geojson/0.4.2 \
@@ -422,10 +420,6 @@ INCLUDEPATH += \
     deps/optional/f27e7908/include \
     deps/polylabel/1.0.3 \
     deps/polylabel/1.0.3/include \
-    deps/protozero/1.5.2 \
-    deps/protozero/1.5.2/include \
-    deps/rapidjson/1.1.0 \
-    deps/rapidjson/1.1.0/include \
     deps/shelf-pack/2.1.1 \
     deps/shelf-pack/2.1.1/include \
     deps/supercluster/0.2.2 \
diff --git a/qtlocation/src/3rdparty/mapbox-gl-native/platform/default/thread.cpp b/qtlocation/src/3rdparty/mapbox-gl-native/platform/default/thread.cpp
index c7c79b4..cf11d0f 100644
--- a/qtlocation/src/3rdparty/mapbox-gl-native/platform/default/thread.cpp
+++ b/qtlocation/src/3rdparty/mapbox-gl-native/platform/default/thread.cpp
@@ -11,26 +11,32 @@ namespace platform {
 
 std::string getCurrentThreadName() {
     char name[32] = "unknown";
+#ifdef __linux__
     pthread_getname_np(pthread_self(), name, sizeof(name));
+#endif
 
     return name;
 }
 
 void setCurrentThreadName(const std::string& name) {
+#ifdef __linux__
     if (name.size() > 15) { // Linux hard limit (see manpages).
         pthread_setname_np(pthread_self(), name.substr(0, 15).c_str());
     } else {
         pthread_setname_np(pthread_self(), name.c_str());
     }
+#endif
 }
 
 void makeThreadLowPriority() {
+#ifdef SCHED_IDLE
     struct sched_param param;
     param.sched_priority = 0;
 
     if (sched_setscheduler(0, SCHED_IDLE, &param) != 0) {
         Log::Warning(Event::General, "Couldn't set thread scheduling policy");
     }
+#endif
 }
 
 } // namespace platform
diff --git a/qtlocation/src/3rdparty/mapbox-gl-native/src/mbgl/gl/stencil_mode.hpp b/qtlocation/src/3rdparty/mapbox-gl-native/src/mbgl/gl/stencil_mode.hpp
index bc959c9..50ebfe6 100644
--- a/qtlocation/src/3rdparty/mapbox-gl-native/src/mbgl/gl/stencil_mode.hpp
+++ b/qtlocation/src/3rdparty/mapbox-gl-native/src/mbgl/gl/stencil_mode.hpp
@@ -2,6 +2,8 @@
 
 #include <mbgl/util/variant.hpp>
 
+#include <cstdint>
+
 namespace mbgl {
 namespace gl {
 
diff --git a/qtlocation/src/3rdparty/mapbox-gl-native/src/mbgl/layout/symbol_projection.cpp b/qtlocation/src/3rdparty/mapbox-gl-native/src/mbgl/layout/symbol_projection.cpp
index ef669c6..6c6a35e 100644
--- a/qtlocation/src/3rdparty/mapbox-gl-native/src/mbgl/layout/symbol_projection.cpp
+++ b/qtlocation/src/3rdparty/mapbox-gl-native/src/mbgl/layout/symbol_projection.cpp
@@ -95,7 +95,7 @@ namespace mbgl {
     PointAndCameraDistance project(const Point<float>& point, const mat4& matrix) {
         vec4 pos = {{ point.x, point.y, 0, 1 }};
         matrix::transformMat4(pos, pos, matrix);
-        return {{ static_cast<float>(pos[0] / pos[3]), static_cast<float>(pos[1] / pos[3]) }, pos[3] };
+        return {{ static_cast<float>(pos[0] / pos[3]), static_cast<float>(pos[1] / pos[3]) }, static_cast<float>(pos[3]) };
     }
 
     float evaluateSizeForFeature(const ZoomEvaluatedSize& zoomEvaluatedSize, const PlacedSymbol& placedSymbol) {
diff --git a/qtlocation/src/location/configure.json b/qtlocation/src/location/configure.json
index 6d01a9a..d1e623a 100644
--- a/qtlocation/src/location/configure.json
+++ b/qtlocation/src/location/configure.json
@@ -9,7 +9,7 @@
             "label": "Qt.labs.location experimental QML plugin",
             "purpose": "Provides experimental QtLocation QML types",
             "section": "Location",
-            "condition": "config.opengl",
+            "condition": "features.opengl",
             "output": [ "privateFeature" ]
         },
         "geoservices_osm": {
diff --git a/qtlocation/src/location/labs/qsg/qgeomapobjectqsgsupport.cpp b/qtlocation/src/location/labs/qsg/qgeomapobjectqsgsupport.cpp
index a978573..11e1466 100644
--- a/qtlocation/src/location/labs/qsg/qgeomapobjectqsgsupport.cpp
+++ b/qtlocation/src/location/labs/qsg/qgeomapobjectqsgsupport.cpp
@@ -158,7 +158,7 @@ void QGeoMapObjectQSGSupport::updateMapObjects(QSGNode *root, QQuickWindow *wind
     if (!root)
         return;
 
-    if (m_mapObjectsRootNode && m_mapObjectsRootNode->parent())
+    if (m_mapObjectsRootNode && !m_mapObjectsRootNode->parent())
         root->appendChildNode(m_mapObjectsRootNode.get());
 
     if (!m_mapObjectsRootNode) {
diff --git a/qtlocation/src/plugins/position/position.pro b/qtlocation/src/plugins/position/position.pro
index 412bafe..f9cf27b 100644
--- a/qtlocation/src/plugins/position/position.pro
+++ b/qtlocation/src/plugins/position/position.pro
@@ -2,8 +2,8 @@ TEMPLATE = subdirs
 
 QT_FOR_CONFIG += positioning-private
 
-linux|freebsd|openbsd|netbsd:qtHaveModule(dbus):SUBDIRS += geoclue
-linux|freebsd|openbsd|netbsd:qtHaveModule(dbus):SUBDIRS += geoclue2
+linux|freebsd|openbsd|netbsd|hurd:qtHaveModule(dbus):SUBDIRS += geoclue
+linux|freebsd|openbsd|netbsd|hurd:qtHaveModule(dbus):SUBDIRS += geoclue2
 qtConfig(gypsy):SUBDIRS += gypsy
 qtConfig(winrt_geolocation):SUBDIRS += winrt
 qtHaveModule(simulator):SUBDIRS += simulator
diff --git a/qtquick3d/src/plugins/assetimporters/assimp/assimp.pro b/qtquick3d/src/plugins/assetimporters/assimp/assimp.pro
index ca5c499..174a075 100644
--- a/qtquick3d/src/plugins/assetimporters/assimp/assimp.pro
+++ b/qtquick3d/src/plugins/assetimporters/assimp/assimp.pro
@@ -10,7 +10,7 @@ QT_FOR_CONFIG += assetimporters-private
 include($$OUT_PWD/../qtassetimporters-config.pri)
 
 qtConfig(system-assimp):!if(cross_compile:host_build) {
-    QMAKE_USE_PRIVATE += assimp
+    QMAKE_USE_PRIVATE += quick3d-assimp
 } else {
     include(../../../3rdparty/assimp/assimp.pri)
 }
diff --git a/qtwebengine/examples/webenginewidgets/spellchecker/spellchecker.pro b/qtwebengine/examples/webenginewidgets/spellchecker/spellchecker.pro
index d652e4b..3c9c2d8 100644
--- a/qtwebengine/examples/webenginewidgets/spellchecker/spellchecker.pro
+++ b/qtwebengine/examples/webenginewidgets/spellchecker/spellchecker.pro
@@ -1,4 +1,3 @@
-include($$QTWEBENGINE_OUT_ROOT/src/core/qtwebenginecore-config.pri) # workaround for QTBUG-68093
 QT_FOR_CONFIG += webenginecore
 
 TEMPLATE = app
diff --git a/qtwebengine/examples/webenginewidgets/webenginewidgets.pro b/qtwebengine/examples/webenginewidgets/webenginewidgets.pro
index 31a214c..c8ae241 100644
--- a/qtwebengine/examples/webenginewidgets/webenginewidgets.pro
+++ b/qtwebengine/examples/webenginewidgets/webenginewidgets.pro
@@ -1,6 +1,3 @@
-load(functions)
-
-include($$QTWEBENGINE_OUT_ROOT/src/core/qtwebenginecore-config.pri) # workaround for QTBUG-68093
 QT_FOR_CONFIG += webenginecore webenginecore-private
 
 TEMPLATE=subdirs
@@ -9,22 +6,13 @@ SUBDIRS += \
     minimal \
     contentmanipulation \
     cookiebrowser \
+    html2pdf \
+    maps \
+    markdowneditor \
     notifications \
+    printme \
     simplebrowser \
+    spellchecker \
     stylesheetbrowser \
     videoplayer \
     webui
-
-qtConfig(webengine-geolocation): SUBDIRS += maps
-qtConfig(webengine-webchannel): SUBDIRS += markdowneditor
-
-qtConfig(webengine-printing-and-pdf) {
-    SUBDIRS += printme html2pdf
-}
-
-qtConfig(webengine-spellchecker):!qtConfig(webengine-native-spellchecker):!cross_compile:!isUniversal() {
-    SUBDIRS += spellchecker
-} else {
-    message("Spellcheck example will not be built because it depends on usage of Hunspell dictionaries.")
-}
-
diff --git a/qtwebengine/mkspecs/features/functions.prf b/qtwebengine/mkspecs/features/functions.prf
index 7f63058..951f4d2 100644
--- a/qtwebengine/mkspecs/features/functions.prf
+++ b/qtwebengine/mkspecs/features/functions.prf
@@ -44,11 +44,11 @@ defineReplace(which) {
 
 # Returns the unquoted path to the python executable.
 defineReplace(pythonPath) {
-    isEmpty(QMAKE_PYTHON2) {
+    isEmpty(QMAKE_PYTHON3) {
         # Fallback for building QtWebEngine with Qt < 5.8
-        QMAKE_PYTHON2 = python
+        QMAKE_PYTHON3 = python
     }
-    return($$QMAKE_PYTHON2)
+    return($$QMAKE_PYTHON3)
 }
 
 # Returns the python executable for use with shell / make targets.
diff --git a/qtwebengine/src/3rdparty/chromium/base/containers/id_map.h b/qtwebengine/src/3rdparty/chromium/base/containers/id_map.h
index 4caf8a2..4c77f1f 100644
--- a/qtwebengine/src/3rdparty/chromium/base/containers/id_map.h
+++ b/qtwebengine/src/3rdparty/chromium/base/containers/id_map.h
@@ -153,8 +153,8 @@ class IDMap final {
     }
 
     const Iterator& operator=(const Iterator& iter) {
-      map_ = iter.map;
-      iter_ = iter.iter;
+      map_ = iter.map_;
+      iter_ = iter.iter_;
       Init();
       return *this;
     }
diff --git a/qtwebengine/src/3rdparty/chromium/base/files/file_path.cc b/qtwebengine/src/3rdparty/chromium/base/files/file_path.cc
index 090ca74..6955386 100644
--- a/qtwebengine/src/3rdparty/chromium/base/files/file_path.cc
+++ b/qtwebengine/src/3rdparty/chromium/base/files/file_path.cc
@@ -19,7 +19,7 @@
 
 #if defined(OS_APPLE)
 #include "base/mac/scoped_cftyperef.h"
-#include "base/third_party/icu/icu_utf.h"
+#include <unicode/utf.h>
 #endif
 
 #if defined(OS_WIN)
@@ -1167,9 +1167,9 @@ inline int HFSReadNextNonIgnorableCodepoint(const char* string,
                                             int* index) {
   int codepoint = 0;
   while (*index < length && codepoint == 0) {
-    // CBU8_NEXT returns a value < 0 in error cases. For purposes of string
+    // U8_NEXT returns a value < 0 in error cases. For purposes of string
     // comparison, we just use that value and flag it with DCHECK.
-    CBU8_NEXT(string, *index, length, codepoint);
+    U8_NEXT(string, *index, length, codepoint);
     DCHECK_GT(codepoint, 0);
     if (codepoint > 0) {
       // Check if there is a subtable for this upper byte.
diff --git a/qtwebengine/src/3rdparty/chromium/base/json/string_escape.cc b/qtwebengine/src/3rdparty/chromium/base/json/string_escape.cc
index d1253e2..eeddd64 100644
--- a/qtwebengine/src/3rdparty/chromium/base/json/string_escape.cc
+++ b/qtwebengine/src/3rdparty/chromium/base/json/string_escape.cc
@@ -14,7 +14,7 @@
 #include "base/strings/stringprintf.h"
 #include "base/strings/utf_string_conversion_utils.h"
 #include "base/strings/utf_string_conversions.h"
-#include "base/third_party/icu/icu_utf.h"
+#include <unicode/utf.h>
 
 namespace base {
 
@@ -92,7 +92,7 @@ bool EscapeJSONStringImpl(const S& str, bool put_in_quotes, std::string* dest) {
   for (int32_t i = 0; i < length; ++i) {
     uint32_t code_point;
     if (!ReadUnicodeCharacter(str.data(), length, &i, &code_point) ||
-        code_point == static_cast<decltype(code_point)>(CBU_SENTINEL) ||
+        code_point == static_cast<decltype(code_point)>(U_SENTINEL) ||
         !IsValidCodepoint(code_point)) {
       code_point = kReplacementCodePoint;
       did_replacement = true;
diff --git a/qtwebengine/src/3rdparty/chromium/base/json/json_parser.cc b/qtwebengine/src/3rdparty/chromium/base/json/json_parser.cc
index fcb479c..abf56ab 100644
--- a/qtwebengine/src/3rdparty/chromium/base/json/json_parser.cc
+++ b/qtwebengine/src/3rdparty/chromium/base/json/json_parser.cc
@@ -19,7 +19,7 @@
 #include "base/strings/stringprintf.h"
 #include "base/strings/utf_string_conversion_utils.h"
 #include "base/strings/utf_string_conversions.h"
-#include "base/third_party/icu/icu_utf.h"
+#include <unicode/utf.h>
 
 namespace base {
 namespace internal {
@@ -639,9 +639,9 @@ bool JSONParser::DecodeUTF16(uint32_t* out_code_point) {
 
   // If this is a high surrogate, consume the next code unit to get the
   // low surrogate.
-  if (CBU16_IS_SURROGATE(code_unit16_high)) {
+  if (U16_IS_SURROGATE(code_unit16_high)) {
     // Make sure this is the high surrogate.
-    if (!CBU16_IS_SURROGATE_LEAD(code_unit16_high)) {
+    if (!U16_IS_SURROGATE_LEAD(code_unit16_high)) {
       if ((options_ & JSON_REPLACE_INVALID_CHARACTERS) == 0)
         return false;
       *out_code_point = kUnicodeReplacementPoint;
@@ -665,7 +665,7 @@ bool JSONParser::DecodeUTF16(uint32_t* out_code_point) {
     if (!UnprefixedHexStringToInt(*escape_sequence, &code_unit16_low))
       return false;
 
-    if (!CBU16_IS_TRAIL(code_unit16_low)) {
+    if (!U16_IS_TRAIL(code_unit16_low)) {
       if ((options_ & JSON_REPLACE_INVALID_CHARACTERS) == 0)
         return false;
       *out_code_point = kUnicodeReplacementPoint;
@@ -673,12 +673,12 @@ bool JSONParser::DecodeUTF16(uint32_t* out_code_point) {
     }
 
     uint32_t code_point =
-        CBU16_GET_SUPPLEMENTARY(code_unit16_high, code_unit16_low);
+        U16_GET_SUPPLEMENTARY(code_unit16_high, code_unit16_low);
 
     *out_code_point = code_point;
   } else {
     // Not a surrogate.
-    DCHECK(CBU16_IS_SINGLE(code_unit16_high));
+    DCHECK(U16_IS_SINGLE(code_unit16_high));
 
     *out_code_point = code_unit16_high;
   }
diff --git a/qtwebengine/src/3rdparty/chromium/base/strings/pattern.cc b/qtwebengine/src/3rdparty/chromium/base/strings/pattern.cc
index f3de0af..3cc32ab 100644
--- a/qtwebengine/src/3rdparty/chromium/base/strings/pattern.cc
+++ b/qtwebengine/src/3rdparty/chromium/base/strings/pattern.cc
@@ -4,13 +4,13 @@
 
 #include "base/strings/pattern.h"
 
-#include "base/third_party/icu/icu_utf.h"
+#include <unicode/utf.h>
 
 namespace base {
 
 namespace {
 
-constexpr bool IsWildcard(base_icu::UChar32 character) {
+constexpr bool IsWildcard(UChar32 character) {
   return character == '*' || character == '?';
 }
 
@@ -55,9 +55,9 @@ constexpr bool SearchForChars(const CHAR** pattern,
       // Check if the chars match, if so, increment the ptrs.
       const CHAR* pattern_next = *pattern;
       const CHAR* string_next = *string;
-      base_icu::UChar32 pattern_char = next(&pattern_next, pattern_end);
+      UChar32 pattern_char = next(&pattern_next, pattern_end);
       if (pattern_char == next(&string_next, string_end) &&
-          pattern_char != CBU_SENTINEL) {
+          pattern_char != U_SENTINEL) {
         *pattern = pattern_next;
         *string = string_next;
         continue;
@@ -121,20 +121,20 @@ constexpr bool MatchPatternT(const CHAR* eval,
 }
 
 struct NextCharUTF8 {
-  base_icu::UChar32 operator()(const char** p, const char* end) {
-    base_icu::UChar32 c;
+  UChar32 operator()(const char** p, const char* end) {
+    UChar32 c;
     int offset = 0;
-    CBU8_NEXT(*p, offset, end - *p, c);
+    U8_NEXT(*p, offset, end - *p, c);
     *p += offset;
     return c;
   }
 };
 
 struct NextCharUTF16 {
-  base_icu::UChar32 operator()(const char16** p, const char16* end) {
-    base_icu::UChar32 c;
+  UChar32 operator()(const char16** p, const char16* end) {
+    UChar32 c;
     int offset = 0;
-    CBU16_NEXT(*p, offset, end - *p, c);
+    U16_NEXT(*p, offset, end - *p, c);
     *p += offset;
     return c;
   }
diff --git a/qtwebengine/src/3rdparty/chromium/base/strings/utf_string_conversion_utils.cc b/qtwebengine/src/3rdparty/chromium/base/strings/utf_string_conversion_utils.cc
index f7682c1..a76272c 100644
--- a/qtwebengine/src/3rdparty/chromium/base/strings/utf_string_conversion_utils.cc
+++ b/qtwebengine/src/3rdparty/chromium/base/strings/utf_string_conversion_utils.cc
@@ -4,7 +4,7 @@
 
 #include "base/strings/utf_string_conversion_utils.h"
 
-#include "base/third_party/icu/icu_utf.h"
+#include <unicode/utf.h>
 #include "build/build_config.h"
 
 namespace base {
@@ -19,7 +19,7 @@ bool ReadUnicodeCharacter(const char* src,
   // use a signed type for code_point.  But this function returns false
   // on error anyway, so code_point_out is unsigned.
   int32_t code_point;
-  CBU8_NEXT(src, *char_index, src_len, code_point);
+  U8_NEXT(src, *char_index, src_len, code_point);
   *code_point_out = static_cast<uint32_t>(code_point);
 
   // The ICU macro above moves to the next char, we want to point to the last
@@ -34,16 +34,16 @@ bool ReadUnicodeCharacter(const char16* src,
                           int32_t src_len,
                           int32_t* char_index,
                           uint32_t* code_point) {
-  if (CBU16_IS_SURROGATE(src[*char_index])) {
-    if (!CBU16_IS_SURROGATE_LEAD(src[*char_index]) ||
+  if (U16_IS_SURROGATE(src[*char_index])) {
+    if (!U16_IS_SURROGATE_LEAD(src[*char_index]) ||
         *char_index + 1 >= src_len ||
-        !CBU16_IS_TRAIL(src[*char_index + 1])) {
+        !U16_IS_TRAIL(src[*char_index + 1])) {
       // Invalid surrogate pair.
       return false;
     }
 
     // Valid surrogate pair.
-    *code_point = CBU16_GET_SUPPLEMENTARY(src[*char_index],
+    *code_point = U16_GET_SUPPLEMENTARY(src[*char_index],
                                           src[*char_index + 1]);
     (*char_index)++;
   } else {
@@ -77,30 +77,30 @@ size_t WriteUnicodeCharacter(uint32_t code_point, std::string* output) {
   }
 
 
-  // CBU8_APPEND_UNSAFE can append up to 4 bytes.
+  // U8_APPEND_UNSAFE can append up to 4 bytes.
   size_t char_offset = output->length();
   size_t original_char_offset = char_offset;
-  output->resize(char_offset + CBU8_MAX_LENGTH);
+  output->resize(char_offset + U8_MAX_LENGTH);
 
-  CBU8_APPEND_UNSAFE(&(*output)[0], char_offset, code_point);
+  U8_APPEND_UNSAFE(&(*output)[0], char_offset, code_point);
 
-  // CBU8_APPEND_UNSAFE will advance our pointer past the inserted character, so
+  // U8_APPEND_UNSAFE will advance our pointer past the inserted character, so
   // it will represent the new length of the string.
   output->resize(char_offset);
   return char_offset - original_char_offset;
 }
 
 size_t WriteUnicodeCharacter(uint32_t code_point, string16* output) {
-  if (CBU16_LENGTH(code_point) == 1) {
+  if (U16_LENGTH(code_point) == 1) {
     // Thie code point is in the Basic Multilingual Plane (BMP).
     output->push_back(static_cast<char16>(code_point));
     return 1;
   }
   // Non-BMP characters use a double-character encoding.
   size_t char_offset = output->length();
-  output->resize(char_offset + CBU16_MAX_LENGTH);
-  CBU16_APPEND_UNSAFE(&(*output)[0], char_offset, code_point);
-  return CBU16_MAX_LENGTH;
+  output->resize(char_offset + U16_MAX_LENGTH);
+  U16_APPEND_UNSAFE(&(*output)[0], char_offset, code_point);
+  return U16_MAX_LENGTH;
 }
 
 // Generalized Unicode converter -----------------------------------------------
diff --git a/qtwebengine/src/3rdparty/chromium/base/strings/escape.cc b/qtwebengine/src/3rdparty/chromium/base/strings/escape.cc
index 6d985a8..194a93a 100644
--- a/qtwebengine/src/3rdparty/chromium/base/strings/escape.cc
+++ b/qtwebengine/src/3rdparty/chromium/base/strings/escape.cc
@@ -6,7 +6,7 @@
 
 #include "base/strings/string_util.h"
 #include "base/strings/utf_string_conversion_utils.h"
-#include "base/third_party/icu/icu_utf.h"
+#include <unicode/utf.h>
 
 namespace base {
 
@@ -83,14 +83,14 @@ bool UnescapeUTF8CharacterAtIndex(StringPiece escaped_text,
                                   std::string* unescaped_out) {
   DCHECK(unescaped_out->empty());
 
-  unsigned char bytes[CBU8_MAX_LENGTH];
+  unsigned char bytes[U8_MAX_LENGTH];
   if (!UnescapeUnsignedByteAtIndex(escaped_text, index, &bytes[0]))
     return false;
 
   size_t num_bytes = 1;
 
   // If this is a lead byte, need to collect trail bytes as well.
-  if (CBU8_IS_LEAD(bytes[0])) {
+  if (U8_IS_LEAD(bytes[0])) {
     // Look for the last trail byte of the UTF-8 character.  Give up once
     // reach max character length number of bytes, or hit an unescaped
     // character. No need to check length of escaped_text, as
@@ -98,7 +98,7 @@ bool UnescapeUTF8CharacterAtIndex(StringPiece escaped_text,
     while (num_bytes < size(bytes) &&
            UnescapeUnsignedByteAtIndex(escaped_text, index + num_bytes * 3,
                                        &bytes[num_bytes]) &&
-           CBU8_IS_TRAIL(bytes[num_bytes])) {
+           U8_IS_TRAIL(bytes[num_bytes])) {
       ++num_bytes;
     }
   }
diff --git a/qtwebengine/src/3rdparty/chromium/base/strings/string_split.cc b/qtwebengine/src/3rdparty/chromium/base/strings/string_split.cc
index 4ba0412..28d2803 100644
--- a/qtwebengine/src/3rdparty/chromium/base/strings/string_split.cc
+++ b/qtwebengine/src/3rdparty/chromium/base/strings/string_split.cc
@@ -9,7 +9,7 @@
 #include "base/logging.h"
 #include "base/strings/string_split_internal.h"
 #include "base/strings/string_util.h"
-#include "base/third_party/icu/icu_utf.h"
+#include <unicode/utf.h>
 
 namespace base {
 
diff --git a/qtwebengine/src/3rdparty/chromium/base/strings/string_util.cc b/qtwebengine/src/3rdparty/chromium/base/strings/string_util.cc
index a883c97..d948651 100644
--- a/qtwebengine/src/3rdparty/chromium/base/strings/string_util.cc
+++ b/qtwebengine/src/3rdparty/chromium/base/strings/string_util.cc
@@ -27,7 +27,7 @@
 #include "base/strings/string_util_internal.h"
 #include "base/strings/utf_string_conversion_utils.h"
 #include "base/strings/utf_string_conversions.h"
-#include "base/third_party/icu/icu_utf.h"
+#include <unicode/utf.h>
 #include "build/build_config.h"
 
 namespace base {
@@ -173,19 +173,19 @@ void TruncateUTF8ToByteSize(const std::string& input,
   }
   DCHECK_LE(byte_size,
             static_cast<uint32_t>(std::numeric_limits<int32_t>::max()));
-  // Note: This cast is necessary because CBU8_NEXT uses int32_ts.
+  // Note: This cast is necessary because U8_NEXT uses int32_ts.
   int32_t truncation_length = static_cast<int32_t>(byte_size);
   int32_t char_index = truncation_length - 1;
   const char* data = input.data();
 
-  // Using CBU8, we will move backwards from the truncation point
+  // Using U8, we will move backwards from the truncation point
   // to the beginning of the string looking for a valid UTF8
   // character.  Once a full UTF8 character is found, we will
   // truncate the string to the end of that character.
   while (char_index >= 0) {
     int32_t prev = char_index;
-    base_icu::UChar32 code_point = 0;
-    CBU8_NEXT(data, char_index, truncation_length, code_point);
+    UChar32 code_point = 0;
+    U8_NEXT(data, char_index, truncation_length, code_point);
     if (!IsValidCharacter(code_point) ||
         !IsValidCodepoint(code_point)) {
       char_index = prev - 1;
diff --git a/qtwebengine/src/3rdparty/chromium/base/strings/string_util_internal.h b/qtwebengine/src/3rdparty/chromium/base/strings/string_util_internal.h
index 3ec97a7..f3f28ed 100644
--- a/qtwebengine/src/3rdparty/chromium/base/strings/string_util_internal.h
+++ b/qtwebengine/src/3rdparty/chromium/base/strings/string_util_internal.h
@@ -10,7 +10,7 @@
 #include "base/logging.h"
 #include "base/notreached.h"
 #include "base/strings/string_piece.h"
-#include "base/third_party/icu/icu_utf.h"
+#include <unicode/utf.h>
 
 namespace base {
 
@@ -234,7 +234,7 @@ inline static bool DoIsStringUTF8(StringPiece str) {
 
   while (char_index < src_len) {
     int32_t code_point;
-    CBU8_NEXT(src, char_index, src_len, code_point);
+    U8_NEXT(src, char_index, src_len, code_point);
     if (!Validator(code_point))
       return false;
   }
diff --git a/qtwebengine/src/3rdparty/chromium/base/strings/utf_string_conversions.cc b/qtwebengine/src/3rdparty/chromium/base/strings/utf_string_conversions.cc
index 12ed1f3..b9fc9c1 100644
--- a/qtwebengine/src/3rdparty/chromium/base/strings/utf_string_conversions.cc
+++ b/qtwebengine/src/3rdparty/chromium/base/strings/utf_string_conversions.cc
@@ -12,7 +12,7 @@
 #include "base/strings/string_piece.h"
 #include "base/strings/string_util.h"
 #include "base/strings/utf_string_conversion_utils.h"
-#include "base/third_party/icu/icu_utf.h"
+#include <unicode/utf.h>
 #include "build/build_config.h"
 
 #if defined(OS_MAC)
@@ -79,12 +79,12 @@ using EnableIfBitsAre = std::enable_if_t<std::is_integral<Char>::value &&
 
 template <typename Char, EnableIfBitsAre<Char, 8> = true>
 void UnicodeAppendUnsafe(Char* out, int32_t* size, uint32_t code_point) {
-  CBU8_APPEND_UNSAFE(out, *size, code_point);
+  U8_APPEND_UNSAFE(out, *size, code_point);
 }
 
 template <typename Char, EnableIfBitsAre<Char, 16> = true>
 void UnicodeAppendUnsafe(Char* out, int32_t* size, uint32_t code_point) {
-  CBU16_APPEND_UNSAFE(out, *size, code_point);
+  U16_APPEND_UNSAFE(out, *size, code_point);
 }
 
 template <typename Char, EnableIfBitsAre<Char, 32> = true>
@@ -105,7 +105,7 @@ bool DoUTFConversion(const char* src,
 
   for (int32_t i = 0; i < src_len;) {
     int32_t code_point;
-    CBU8_NEXT(src, i, src_len, code_point);
+    U8_NEXT(src, i, src_len, code_point);
 
     if (!IsValidCodepoint(code_point)) {
       success = false;
@@ -126,7 +126,7 @@ bool DoUTFConversion(const char16* src,
   bool success = true;
 
   auto ConvertSingleChar = [&success](char16 in) -> int32_t {
-    if (!CBU16_IS_SINGLE(in) || !IsValidCodepoint(in)) {
+    if (!U16_IS_SINGLE(in) || !IsValidCodepoint(in)) {
       success = false;
       return kErrorCodePoint;
     }
@@ -140,8 +140,8 @@ bool DoUTFConversion(const char16* src,
   while (i < src_len - 1) {
     int32_t code_point;
 
-    if (CBU16_IS_LEAD(src[i]) && CBU16_IS_TRAIL(src[i + 1])) {
-      code_point = CBU16_GET_SUPPLEMENTARY(src[i], src[i + 1]);
+    if (U16_IS_LEAD(src[i]) && U16_IS_TRAIL(src[i + 1])) {
+      code_point = U16_GET_SUPPLEMENTARY(src[i], src[i + 1]);
       if (!IsValidCodepoint(code_point)) {
         code_point = kErrorCodePoint;
         success = false;
diff --git a/qtwebengine/src/3rdparty/chromium/base/time/pr_time_unittest.cc b/qtwebengine/src/3rdparty/chromium/base/time/pr_time_unittest.cc
index 3170e57..3646034 100644
--- a/qtwebengine/src/3rdparty/chromium/base/time/pr_time_unittest.cc
+++ b/qtwebengine/src/3rdparty/chromium/base/time/pr_time_unittest.cc
@@ -7,7 +7,7 @@
 
 #include "base/compiler_specific.h"
 #include "base/stl_util.h"
-#include "base/third_party/nspr/prtime.h"
+#include <nspr/prtime.h>
 #include "base/time/time.h"
 #include "build/build_config.h"
 #include "testing/gtest/include/gtest/gtest.h"
diff --git a/qtwebengine/src/3rdparty/chromium/base/time/time.cc b/qtwebengine/src/3rdparty/chromium/base/time/time.cc
index 2db074f..324331f 100644
--- a/qtwebengine/src/3rdparty/chromium/base/time/time.cc
+++ b/qtwebengine/src/3rdparty/chromium/base/time/time.cc
@@ -14,7 +14,7 @@
 #include "base/optional.h"
 #include "base/strings/string_util.h"
 #include "base/strings/stringprintf.h"
-#include "base/third_party/nspr/prtime.h"
+#include <nspr/prtime.h>
 #include "base/time/time_override.h"
 #include "build/build_config.h"
 
diff --git a/qtwebengine/src/3rdparty/chromium/base/BUILD.gn b/qtwebengine/src/3rdparty/chromium/base/BUILD.gn
index c15b2b2..9b3aa20 100644
--- a/qtwebengine/src/3rdparty/chromium/base/BUILD.gn
+++ b/qtwebengine/src/3rdparty/chromium/base/BUILD.gn
@@ -103,6 +103,10 @@ config("base_flags") {
       "-Wglobal-constructors",
     ]
   }
+  ldflags = [
+    "-lnspr4",
+    "-licuuc",
+  ]
 }
 
 config("base_implementation") {
@@ -726,10 +730,6 @@ jumbo_component("base") {
     "third_party/cityhash/city.h",
     "third_party/cityhash_v103/src/city_v103.cc",
     "third_party/cityhash_v103/src/city_v103.h",
-    "third_party/icu/icu_utf.cc",
-    "third_party/icu/icu_utf.h",
-    "third_party/nspr/prtime.cc",
-    "third_party/nspr/prtime.h",
     "third_party/superfasthash/superfasthash.c",
     "thread_annotations.h",
     "threading/hang_watcher.cc",
@@ -1280,6 +1280,7 @@ jumbo_component("base") {
     "//build:branding_buildflags",
     "//build:chromeos_buildflags",
     "//third_party/modp_b64",
+    "//third_party/icu:icuuc",
   ]
 
   # native_unwinder_android is intended for use solely via a dynamic feature
diff --git a/qtwebengine/src/3rdparty/chromium/build/print_python_deps.py b/qtwebengine/src/3rdparty/chromium/build/print_python_deps.py
index fd29c09..2a01185 100755
--- a/qtwebengine/src/3rdparty/chromium/build/print_python_deps.py
+++ b/qtwebengine/src/3rdparty/chromium/build/print_python_deps.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python2.7
+#!/usr/bin/python3
 # Copyright 2016 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.
@@ -152,7 +152,7 @@ def main():
 
   # Trybots run with vpython as default Python, but with a different config
   # from //.vpython. To make the is_vpython test work, and to match the behavior
-  # of dev machines, the shebang line must be run with python2.7.
+  # of dev machines, the shebang line must be run with python3.
   #
   # E.g. $HOME/.vpython-root/dd50d3/bin/python
   # E.g. /b/s/w/ir/cache/vpython/ab5c79/bin/python
diff --git a/qtwebengine/src/3rdparty/chromium/chrome/common/extensions/docs/server2/BUILD.gn b/qtwebengine/src/3rdparty/chromium/chrome/common/extensions/docs/server2/BUILD.gn
index 9da6184..2f2203a 100644
--- a/qtwebengine/src/3rdparty/chromium/chrome/common/extensions/docs/server2/BUILD.gn
+++ b/qtwebengine/src/3rdparty/chromium/chrome/common/extensions/docs/server2/BUILD.gn
@@ -38,6 +38,4 @@ group("extension_docserver_python_unittests") {
     "//tools/json_comment_eater/json_comment_eater.py",
     "//tools/json_schema_compiler/",
   ]
-
-  data_deps = [ "//third_party/catapult/third_party/typ" ]
 }
diff --git a/qtwebengine/src/3rdparty/chromium/chrome/test/BUILD.gn b/qtwebengine/src/3rdparty/chromium/chrome/test/BUILD.gn
index 1a369fa..eb5bc96 100644
--- a/qtwebengine/src/3rdparty/chromium/chrome/test/BUILD.gn
+++ b/qtwebengine/src/3rdparty/chromium/chrome/test/BUILD.gn
@@ -7103,8 +7103,6 @@ if (!is_fuchsia && !is_android) {
       "//chrome/test/data/password/captured_sites/",
       "//chrome/test/data/web_page_replay_go_helper_scripts/automation_helper.js",
       "//components/test/data/autofill/web_page_replay_support_files/",
-      "//third_party/catapult/telemetry/telemetry/bin/",
-      "//third_party/catapult/web_page_replay_go/deterministic.js",
     ]
 
     if (is_linux || is_chromeos || is_win) {
@@ -7141,7 +7139,6 @@ if (!is_fuchsia && !is_android) {
 
       # TODO(uwyiming@chromium.org) create a gn target for Web Page Replay Go (WPR Go) and only WPR Go.
       # So that test targets requiring WPR Go does not pull down the whole telemetry tool chain.
-      "//third_party/catapult:telemetry_chrome_test_support",
       "//third_party/hunspell",
       "//third_party/icu",
       "//third_party/libpng",
@@ -7171,7 +7168,6 @@ if (!is_fuchsia && !is_android) {
     deps = [ "//tools/perf/chrome_telemetry_build:telemetry_chrome_test" ]
 
     data = [
-      "//third_party/catapult/telemetry/telemetry/internal/bin/",
       "//tools/perf/run_telemetry_tests",
 
       # For isolate contract.
@@ -7189,7 +7185,6 @@ if (!is_fuchsia && !is_android) {
   group("telemetry_gpu_unittests") {
     testonly = true
     deps = [
-      "//third_party/catapult:telemetry_chrome_test_support",
       "//tools/metrics:metrics_python_tests",
     ]
     data = [
@@ -7313,7 +7308,6 @@ if (is_mac || is_win || is_android) {
       "//testing/scripts",
       "//testing/test_env.py",
       "//testing/xvfb.py",
-      "//third_party/catapult",
       "//tools",
     ]
   }
diff --git a/qtwebengine/src/3rdparty/chromium/chrome/chrome_paks.gni b/qtwebengine/src/3rdparty/chromium/chrome/chrome_paks.gni
index 9323a77..0362b65 100644
--- a/qtwebengine/src/3rdparty/chromium/chrome/chrome_paks.gni
+++ b/qtwebengine/src/3rdparty/chromium/chrome/chrome_paks.gni
@@ -94,7 +94,6 @@ template("chrome_extra_paks") {
       "$root_gen_dir/chrome/common_resources.pak",
       "$root_gen_dir/components/autofill/core/browser/autofill_address_rewriter_resources.pak",
       "$root_gen_dir/components/components_resources.pak",
-      "$root_gen_dir/content/browser/tracing/tracing_resources.pak",
       "$root_gen_dir/content/content_resources.pak",
       "$root_gen_dir/mojo/public/js/mojo_bindings_resources.pak",
       "$root_gen_dir/net/net_resources.pak",
@@ -110,7 +109,6 @@ template("chrome_extra_paks") {
       "//components/autofill/core/browser:autofill_address_rewriter_resources",
       "//components/resources",
       "//content:content_resources",
-      "//content/browser/tracing:resources",
       "//mojo/public/js:resources",
       "//net:net_resources",
       "//skia:skia_resources",
diff --git a/qtwebengine/src/3rdparty/chromium/components/download/internal/common/download_path_reservation_tracker.cc b/qtwebengine/src/3rdparty/chromium/components/download/internal/common/download_path_reservation_tracker.cc
index 814fdf6..46ce2ad 100644
--- a/qtwebengine/src/3rdparty/chromium/components/download/internal/common/download_path_reservation_tracker.cc
+++ b/qtwebengine/src/3rdparty/chromium/components/download/internal/common/download_path_reservation_tracker.cc
@@ -23,7 +23,7 @@
 #include "base/task/lazy_thread_pool_task_runner.h"
 #include "base/task/post_task.h"
 #include "base/task_runner_util.h"
-#include "base/third_party/icu/icu_utf.h"
+#include <unicode/utf.h>
 #include "base/time/time.h"
 #include "build/build_config.h"
 #include "components/download/public/common/download_features.h"
diff --git a/qtwebengine/src/3rdparty/chromium/components/filename_generation/filename_generation.cc b/qtwebengine/src/3rdparty/chromium/components/filename_generation/filename_generation.cc
index d7bcf32..bafa642 100644
--- a/qtwebengine/src/3rdparty/chromium/components/filename_generation/filename_generation.cc
+++ b/qtwebengine/src/3rdparty/chromium/components/filename_generation/filename_generation.cc
@@ -11,7 +11,7 @@
 #include "base/strings/string_util.h"
 #include "base/strings/sys_string_conversions.h"
 #include "base/strings/utf_string_conversions.h"
-#include "base/third_party/icu/icu_utf.h"
+#include <unicode/utf.h>
 #include "build/build_config.h"
 #include "components/url_formatter/url_formatter.h"
 #include "net/base/filename_util.h"
@@ -167,7 +167,7 @@ bool TruncateFilename(base::FilePath* path, size_t limit) {
 #elif defined(OS_WIN)
   // UTF-16.
   DCHECK(name.size() > limit);
-  truncated = name.substr(0, CBU16_IS_TRAIL(name[limit]) ? limit - 1 : limit);
+  truncated = name.substr(0, U16_IS_TRAIL(name[limit]) ? limit - 1 : limit);
 #else
 // We cannot generally assume that the file name encoding is in UTF-8 (see
 // the comment for FilePath::AsUTF8Unsafe), hence no safe way to truncate.
diff --git a/qtwebengine/src/3rdparty/chromium/components/resources/protobufs/binary_proto_generator.py b/qtwebengine/src/3rdparty/chromium/components/resources/protobufs/binary_proto_generator.py
index 7422ead..c8b11f1 100755
--- a/qtwebengine/src/3rdparty/chromium/components/resources/protobufs/binary_proto_generator.py
+++ b/qtwebengine/src/3rdparty/chromium/components/resources/protobufs/binary_proto_generator.py
@@ -7,9 +7,9 @@
  Converts a given ASCII proto into a binary resource.
 
 """
-
+from __future__ import print_function
 import abc
-import imp
+from importlib import util as imp_util
 import optparse
 import os
 import re
@@ -68,7 +68,11 @@ class GoogleProtobufModuleImporter:
       raise ImportError(fullname)
 
     filepath = self._fullname_to_filepath(fullname)
-    return imp.load_source(fullname, filepath)
+    spec = imp_util.spec_from_file_location(fullname, filepath)
+    loaded = imp_util.module_from_spec(spec)
+    spec.loader.exec_module(loaded)
+
+    return loaded
 
 class BinaryProtoGenerator:
 
@@ -196,12 +200,12 @@ class BinaryProtoGenerator:
     self._ImportProtoModules(opts.path)
 
     if not self.VerifyArgs(opts):
-      print "Wrong arguments"
+      print("Wrong arguments")
       return 1
 
     try:
       self._GenerateBinaryProtos(opts)
     except Exception as e:
-      print "ERROR: Failed to render binary version of %s:\n  %s\n%s" % (
-          opts.infile, str(e), traceback.format_exc())
+      print("ERROR: Failed to render binary version of %s:\n  %s\n%s" %
+            (opts.infile, str(e), traceback.format_exc()))
       return 1
diff --git a/qtwebengine/src/3rdparty/chromium/content/browser/devtools/devtools_stream_file.cc b/qtwebengine/src/3rdparty/chromium/content/browser/devtools/devtools_stream_file.cc
index c7d551b..0fb676e 100644
--- a/qtwebengine/src/3rdparty/chromium/content/browser/devtools/devtools_stream_file.cc
+++ b/qtwebengine/src/3rdparty/chromium/content/browser/devtools/devtools_stream_file.cc
@@ -10,7 +10,7 @@
 #include "base/sequenced_task_runner.h"
 #include "base/strings/string_util.h"
 #include "base/task/lazy_thread_pool_task_runner.h"
-#include "base/third_party/icu/icu_utf.h"
+#include <unicode/utf.h>
 #include "content/public/browser/browser_task_traits.h"
 #include "content/public/browser/browser_thread.h"
 #include "storage/browser/file_system/file_system_context.h"
@@ -104,7 +104,7 @@ void DevToolsStreamFile::ReadOnFileSequence(off_t position,
     } else {
       // Provided client has requested sufficient large block, make their
       // life easier by not truncating in the middle of a UTF-8 character.
-      if (size_got > 6 && !CBU8_IS_SINGLE(buffer[size_got - 1])) {
+      if (size_got > 6 && !U8_IS_SINGLE(buffer[size_got - 1])) {
         base::TruncateUTF8ToByteSize(buffer, size_got, &buffer);
         size_got = buffer.size();
       } else {
diff --git a/qtwebengine/src/3rdparty/chromium/content/browser/tracing/generate_trace_viewer_grd.py b/qtwebengine/src/3rdparty/chromium/content/browser/tracing/generate_trace_viewer_grd.py
index 037f949..be393d2 100755
--- a/qtwebengine/src/3rdparty/chromium/content/browser/tracing/generate_trace_viewer_grd.py
+++ b/qtwebengine/src/3rdparty/chromium/content/browser/tracing/generate_trace_viewer_grd.py
@@ -74,7 +74,7 @@ def main(argv):
   for filename in parsed_args.source_files:
     add_file_to_grd(doc, os.path.basename(filename))
 
-  with open(parsed_args.output_filename, 'w') as output_file:
+  with open(parsed_args.output_filename, 'wb') as output_file:
     output_file.write(doc.toxml(encoding='UTF-8'))
 
 
diff --git a/qtwebengine/src/3rdparty/chromium/content/browser/tracing/tracing_ui.cc b/qtwebengine/src/3rdparty/chromium/content/browser/tracing/tracing_ui.cc
index 2bffb5e..8965922 100644
--- a/qtwebengine/src/3rdparty/chromium/content/browser/tracing/tracing_ui.cc
+++ b/qtwebengine/src/3rdparty/chromium/content/browser/tracing/tracing_ui.cc
@@ -27,7 +27,6 @@
 #include "base/strings/stringprintf.h"
 #include "base/trace_event/trace_event.h"
 #include "base/values.h"
-#include "content/browser/tracing/grit/tracing_resources.h"
 #include "content/browser/tracing/tracing_controller_impl.h"
 #include "content/public/browser/browser_context.h"
 #include "content/public/browser/browser_thread.h"
@@ -242,8 +241,6 @@ TracingUI::TracingUI(WebUI* web_ui)
   WebUIDataSource* source = WebUIDataSource::Create(kChromeUITracingHost);
   source->DisableTrustedTypesCSP();
   source->UseStringsJs();
-  source->SetDefaultResource(IDR_TRACING_HTML);
-  source->AddResourcePath("tracing.js", IDR_TRACING_JS);
   source->SetRequestFilter(base::BindRepeating(OnShouldHandleRequest),
                            base::BindRepeating(OnTracingRequest));
   WebUIDataSource::Add(browser_context, source);
diff --git a/qtwebengine/src/3rdparty/chromium/content/browser/BUILD.gn b/qtwebengine/src/3rdparty/chromium/content/browser/BUILD.gn
index 1466f33..51039e0 100644
--- a/qtwebengine/src/3rdparty/chromium/content/browser/BUILD.gn
+++ b/qtwebengine/src/3rdparty/chromium/content/browser/BUILD.gn
@@ -2169,7 +2169,6 @@ jumbo_static_library("browser") {
   if (!is_android) {
     deps += [
       "//components/vector_icons",
-      "//content/browser/tracing:resources",
     ]
   }
 
diff --git a/qtwebengine/src/3rdparty/chromium/content/shell/BUILD.gn b/qtwebengine/src/3rdparty/chromium/content/shell/BUILD.gn
index 56c0e8b..6e4ffbe 100644
--- a/qtwebengine/src/3rdparty/chromium/content/shell/BUILD.gn
+++ b/qtwebengine/src/3rdparty/chromium/content/shell/BUILD.gn
@@ -390,7 +390,6 @@ repack("pak") {
   sources = [
     "$root_gen_dir/content/app/resources/content_resources_100_percent.pak",
     "$root_gen_dir/content/browser/resources/media/media_internals_resources.pak",
-    "$root_gen_dir/content/browser/tracing/tracing_resources.pak",
     "$root_gen_dir/content/browser/webrtc/resources/webrtc_internals_resources.pak",
     "$root_gen_dir/content/content_resources.pak",
     "$root_gen_dir/content/dev_ui_content_resources.pak",
@@ -413,7 +412,6 @@ repack("pak") {
     "//content:dev_ui_content_resources",
     "//content/app/resources",
     "//content/browser/resources/media:media_internals_resources",
-    "//content/browser/tracing:resources",
     "//content/browser/webrtc/resources",
     "//mojo/public/js:resources",
     "//net:net_resources",
diff --git a/qtwebengine/src/3rdparty/chromium/fuchsia/engine/BUILD.gn b/qtwebengine/src/3rdparty/chromium/fuchsia/engine/BUILD.gn
index a502b7f..39df2a7 100644
--- a/qtwebengine/src/3rdparty/chromium/fuchsia/engine/BUILD.gn
+++ b/qtwebengine/src/3rdparty/chromium/fuchsia/engine/BUILD.gn
@@ -43,7 +43,6 @@ repack("web_engine_pak") {
     "$root_gen_dir/components/components_resources.pak",
     "$root_gen_dir/components/strings/components_strings_en-US.pak",
     "$root_gen_dir/content/app/resources/content_resources_100_percent.pak",
-    "$root_gen_dir/content/browser/tracing/tracing_resources.pak",
     "$root_gen_dir/content/content_resources.pak",
     "$root_gen_dir/content/dev_ui_content_resources.pak",
     "$root_gen_dir/mojo/public/js/mojo_bindings_resources.pak",
@@ -66,7 +65,6 @@ repack("web_engine_pak") {
     "//content:content_resources",
     "//content:dev_ui_content_resources",
     "//content/app/resources",
-    "//content/browser/tracing:resources",
     "//gpu/command_buffer/service",
     "//mojo/public/js:resources",
     "//net:net_resources",
diff --git a/qtwebengine/src/3rdparty/chromium/headless/BUILD.gn b/qtwebengine/src/3rdparty/chromium/headless/BUILD.gn
index d2ab76a..15e4b78 100644
--- a/qtwebengine/src/3rdparty/chromium/headless/BUILD.gn
+++ b/qtwebengine/src/3rdparty/chromium/headless/BUILD.gn
@@ -37,7 +37,6 @@ repack("pak") {
     "$root_gen_dir/components/components_resources.pak",
     "$root_gen_dir/components/strings/components_strings_en-US.pak",
     "$root_gen_dir/content/app/resources/content_resources_100_percent.pak",
-    "$root_gen_dir/content/browser/tracing/tracing_resources.pak",
     "$root_gen_dir/content/content_resources.pak",
     "$root_gen_dir/content/dev_ui_content_resources.pak",
     "$root_gen_dir/headless/headless_lib_resources.pak",
@@ -65,7 +64,6 @@ repack("pak") {
     "//content:content_resources",
     "//content:dev_ui_content_resources",
     "//content/app/resources",
-    "//content/browser/tracing:resources",
     "//mojo/public/js:resources",
     "//net:net_resources",
     "//third_party/blink/public:resources",
diff --git a/qtwebengine/src/3rdparty/chromium/media/media_options.gni b/qtwebengine/src/3rdparty/chromium/media/media_options.gni
index 32c021e..acacfcd 100644
--- a/qtwebengine/src/3rdparty/chromium/media/media_options.gni
+++ b/qtwebengine/src/3rdparty/chromium/media/media_options.gni
@@ -100,7 +100,7 @@ declare_args() {
   # are combined and we could override more logging than expected.
   enable_logging_override = !use_jumbo_build && is_chromecast
 
-  enable_dav1d_decoder = !is_android && !is_ios
+  enable_dav1d_decoder = !is_android && !is_ios && target_cpu != "mipsel" && target_cpu != "mips64el"
 
   # Enable browser managed persistent metadata storage for EME persistent
   # session and persistent usage record session.
diff --git a/qtwebengine/src/3rdparty/chromium/mojo/public/tools/BUILD.gn b/qtwebengine/src/3rdparty/chromium/mojo/public/tools/BUILD.gn
index 4c68350..1cc0125 100644
--- a/qtwebengine/src/3rdparty/chromium/mojo/public/tools/BUILD.gn
+++ b/qtwebengine/src/3rdparty/chromium/mojo/public/tools/BUILD.gn
@@ -14,5 +14,4 @@ group("mojo_python_unittests") {
     "//testing/xvfb.py",
   ]
   deps = [ "//mojo/public/tools/mojom/mojom:tests" ]
-  data_deps = [ "//third_party/catapult/third_party/typ/" ]
 }
diff --git a/qtwebengine/src/3rdparty/chromium/mojo/public/tools/bindings/gen_data_files_list.py b/qtwebengine/src/3rdparty/chromium/mojo/public/tools/bindings/gen_data_files_list.py
index 79c9e50..8b78d09 100644
--- a/qtwebengine/src/3rdparty/chromium/mojo/public/tools/bindings/gen_data_files_list.py
+++ b/qtwebengine/src/3rdparty/chromium/mojo/public/tools/bindings/gen_data_files_list.py
@@ -18,7 +18,6 @@ import os
 import re
 import sys
 
-from cStringIO import StringIO
 from optparse import OptionParser
 
 sys.path.insert(
@@ -41,12 +40,9 @@ def main():
   pattern = re.compile(options.pattern)
   files = [f for f in os.listdir(options.directory) if pattern.match(f)]
 
-  stream = StringIO()
-  for f in files:
-    print(f, file=stream)
+  contents = '\n'.join(f for f in files) + '\n'
+  WriteFile(contents, options.output)
 
-  WriteFile(stream.getvalue(), options.output)
-  stream.close()
 
 if __name__ == '__main__':
   sys.exit(main())
diff --git a/qtwebengine/src/3rdparty/chromium/mojo/public/tools/bindings/generators/mojom_java_generator.py b/qtwebengine/src/3rdparty/chromium/mojo/public/tools/bindings/generators/mojom_java_generator.py
index 96b2fdf..00b9dcc 100644
--- a/qtwebengine/src/3rdparty/chromium/mojo/public/tools/bindings/generators/mojom_java_generator.py
+++ b/qtwebengine/src/3rdparty/chromium/mojo/public/tools/bindings/generators/mojom_java_generator.py
@@ -25,6 +25,10 @@ sys.path.append(os.path.join(os.path.dirname(__file__), os.pardir,
                              'build', 'android', 'gyp'))
 from util import build_utils
 
+# TODO(crbug.com/1174969): Remove this once Python2 is obsoleted.
+if sys.version_info.major != 2:
+  basestring = str
+  long = int
 
 GENERATOR_PREFIX = 'java'
 
diff --git a/qtwebengine/src/3rdparty/chromium/mojo/public/tools/bindings/BUILD.gn b/qtwebengine/src/3rdparty/chromium/mojo/public/tools/bindings/BUILD.gn
index fc04b5d..708958e 100644
--- a/qtwebengine/src/3rdparty/chromium/mojo/public/tools/bindings/BUILD.gn
+++ b/qtwebengine/src/3rdparty/chromium/mojo/public/tools/bindings/BUILD.gn
@@ -2,9 +2,11 @@
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
+import("//build/config/python.gni")
 import("//mojo/public/tools/bindings/mojom.gni")
 import("//third_party/jinja2/jinja2.gni")
 
+# TODO(crbug.com/1194274): Investigate nondeterminism in Py3 builds.
 action("precompile_templates") {
   sources = mojom_generator_sources
   sources += [
diff --git a/qtwebengine/src/3rdparty/chromium/mojo/public/tools/mojom/mojom/fileutil.py b/qtwebengine/src/3rdparty/chromium/mojo/public/tools/mojom/mojom/fileutil.py
index bf626f5..e1c823d 100644
--- a/qtwebengine/src/3rdparty/chromium/mojo/public/tools/mojom/mojom/fileutil.py
+++ b/qtwebengine/src/3rdparty/chromium/mojo/public/tools/mojom/mojom/fileutil.py
@@ -3,7 +3,6 @@
 # found in the LICENSE file.
 
 import errno
-import imp
 import os.path
 import sys
 
diff --git a/qtwebengine/src/3rdparty/chromium/mojo/public/tools/mojom/mojom/generate/template_expander.py b/qtwebengine/src/3rdparty/chromium/mojo/public/tools/mojom/mojom/generate/template_expander.py
index 7a30056..8d9e26f 100644
--- a/qtwebengine/src/3rdparty/chromium/mojo/public/tools/mojom/mojom/generate/template_expander.py
+++ b/qtwebengine/src/3rdparty/chromium/mojo/public/tools/mojom/mojom/generate/template_expander.py
@@ -75,9 +75,9 @@ def PrecompileTemplates(generator_modules, output_dir):
                 os.path.dirname(module.__file__), generator.GetTemplatePrefix())
         ]))
     jinja_env.filters.update(generator.GetFilters())
-    jinja_env.compile_templates(
-        os.path.join(output_dir, "%s.zip" % generator.GetTemplatePrefix()),
-        extensions=["tmpl"],
-        zip="stored",
-        py_compile=True,
-        ignore_errors=False)
+    jinja_env.compile_templates(os.path.join(
+        output_dir, "%s.zip" % generator.GetTemplatePrefix()),
+                                extensions=["tmpl"],
+                                zip="stored",
+                                py_compile=sys.version_info.major < 3,
+                                ignore_errors=False)
diff --git a/qtwebengine/src/3rdparty/chromium/mojo/public/tools/mojom/mojom/generate/generator.py b/qtwebengine/src/3rdparty/chromium/mojo/public/tools/mojom/mojom/generate/generator.py
index de62260..4a1c73f 100644
--- a/qtwebengine/src/3rdparty/chromium/mojo/public/tools/mojom/mojom/generate/generator.py
+++ b/qtwebengine/src/3rdparty/chromium/mojo/public/tools/mojom/mojom/generate/generator.py
@@ -136,9 +136,14 @@ class Stylizer(object):
 
 def WriteFile(contents, full_path):
   # If |contents| is same with the file content, we skip updating.
+  if not isinstance(contents, bytes):
+    data = contents.encode('utf8')
+  else:
+    data = contents
+
   if os.path.isfile(full_path):
     with open(full_path, 'rb') as destination_file:
-      if destination_file.read() == contents:
+      if destination_file.read() == data:
         return
 
   # Make sure the containing directory exists.
@@ -146,11 +151,8 @@ def WriteFile(contents, full_path):
   fileutil.EnsureDirectoryExists(full_dir)
 
   # Dump the data to disk.
-  with open(full_path, "wb") as f:
-    if not isinstance(contents, bytes):
-      f.write(contents.encode('utf-8'))
-    else:
-      f.write(contents)
+  with open(full_path, 'wb') as f:
+    f.write(data)
 
 
 def AddComputedData(module):
diff --git a/qtwebengine/src/3rdparty/chromium/mojo/public/tools/mojom/mojom/generate/module.py b/qtwebengine/src/3rdparty/chromium/mojo/public/tools/mojom/mojom/generate/module.py
index ebbc9b3..3d02642 100644
--- a/qtwebengine/src/3rdparty/chromium/mojo/public/tools/mojom/mojom/generate/module.py
+++ b/qtwebengine/src/3rdparty/chromium/mojo/public/tools/mojom/mojom/generate/module.py
@@ -398,7 +398,8 @@ class Field(object):
 
 
 class StructField(Field):
-  pass
+  def __hash__(self):
+    return super(Field, self).__hash__()
 
 
 class UnionField(Field):
diff --git a/qtwebengine/src/3rdparty/chromium/mojo/public/tools/mojom/mojom/parse/lexer.py b/qtwebengine/src/3rdparty/chromium/mojo/public/tools/mojom/mojom/parse/lexer.py
index 3e084bb..1e8b49f 100644
--- a/qtwebengine/src/3rdparty/chromium/mojo/public/tools/mojom/mojom/parse/lexer.py
+++ b/qtwebengine/src/3rdparty/chromium/mojo/public/tools/mojom/mojom/parse/lexer.py
@@ -2,7 +2,6 @@
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
-import imp
 import os.path
 import sys
 
diff --git a/qtwebengine/src/3rdparty/chromium/net/base/escape.cc b/qtwebengine/src/3rdparty/chromium/net/base/escape.cc
index 9d13001..fd9c3ed 100644
--- a/qtwebengine/src/3rdparty/chromium/net/base/escape.cc
+++ b/qtwebengine/src/3rdparty/chromium/net/base/escape.cc
@@ -9,7 +9,7 @@
 #include "base/strings/string_util.h"
 #include "base/strings/utf_string_conversion_utils.h"
 #include "base/strings/utf_string_conversions.h"
-#include "base/third_party/icu/icu_utf.h"
+#include <unicode/utf.h>
 
 namespace net {
 
diff --git a/qtwebengine/src/3rdparty/chromium/net/cert/internal/parse_name.cc b/qtwebengine/src/3rdparty/chromium/net/cert/internal/parse_name.cc
index 1ecba7d..e80d70d 100644
--- a/qtwebengine/src/3rdparty/chromium/net/cert/internal/parse_name.cc
+++ b/qtwebengine/src/3rdparty/chromium/net/cert/internal/parse_name.cc
@@ -11,7 +11,7 @@
 #include "base/strings/utf_string_conversion_utils.h"
 #include "base/strings/utf_string_conversions.h"
 #include "base/sys_byteorder.h"
-#include "base/third_party/icu/icu_utf.h"
+#include <unicode/utf.h>
 
 namespace net {
 
@@ -36,7 +36,7 @@ bool ConvertBmpStringValue(const der::Input& in, std::string* out) {
 
     // BMPString only supports codepoints in the Basic Multilingual Plane;
     // surrogates are not allowed.
-    if (CBU_IS_SURROGATE(c))
+    if (U_IS_SURROGATE(c))
       return false;
   }
   return base::UTF16ToUTF8(in_16bit.data(), in_16bit.size(), out);
@@ -56,7 +56,7 @@ bool ConvertUniversalStringValue(const der::Input& in, std::string* out) {
   for (const uint32_t c : in_32bit) {
     // UniversalString is UCS-4 in big-endian order.
     uint32_t codepoint = base::NetToHost32(c);
-    if (!CBU_IS_UNICODE_CHAR(codepoint))
+    if (!U_IS_UNICODE_CHAR(codepoint))
       return false;
 
     base::WriteUnicodeCharacter(codepoint, out);
diff --git a/qtwebengine/src/3rdparty/chromium/net/third_party/quiche/src/quic/core/quic_interval_deque.h b/qtwebengine/src/3rdparty/chromium/net/third_party/quiche/src/quic/core/quic_interval_deque.h
index 252d99c..8d8b1f9 100644
--- a/qtwebengine/src/3rdparty/chromium/net/third_party/quiche/src/quic/core/quic_interval_deque.h
+++ b/qtwebengine/src/3rdparty/chromium/net/third_party/quiche/src/quic/core/quic_interval_deque.h
@@ -198,12 +198,12 @@ class QUIC_NO_EXPORT QuicIntervalDeque {
     Iterator operator+(difference_type amount) const {
       Iterator copy = *this;
       copy.index_ += amount;
-      DCHECK(copy.index_ < copy.deque_->size());
+      DCHECK(copy.index_ < copy.deque_->Size());
       return copy;
     }
     Iterator& operator+=(difference_type amount) {
       index_ += amount;
-      DCHECK(index_ < deque_->size());
+      DCHECK(index_ < deque_->Size());
       return *this;
     }
     difference_type operator-(const Iterator& rhs) const {
diff --git a/qtwebengine/src/3rdparty/chromium/net/tools/transport_security_state_generator/BUILD.gn b/qtwebengine/src/3rdparty/chromium/net/tools/transport_security_state_generator/BUILD.gn
index 1c01def..7696b8a 100644
--- a/qtwebengine/src/3rdparty/chromium/net/tools/transport_security_state_generator/BUILD.gn
+++ b/qtwebengine/src/3rdparty/chromium/net/tools/transport_security_state_generator/BUILD.gn
@@ -43,6 +43,9 @@ source_set("transport_security_state_generator_test_sources") {
     "//testing/gtest",
     "//third_party/boringssl",
   ]
+  libs = [
+    "icuuc",
+  ]
 }
 
 executable("transport_security_state_generator") {
diff --git a/qtwebengine/src/3rdparty/chromium/sandbox/linux/bpf_dsl/linux_syscall_ranges.h b/qtwebengine/src/3rdparty/chromium/sandbox/linux/bpf_dsl/linux_syscall_ranges.h
index 313511f..642cedd 100644
--- a/qtwebengine/src/3rdparty/chromium/sandbox/linux/bpf_dsl/linux_syscall_ranges.h
+++ b/qtwebengine/src/3rdparty/chromium/sandbox/linux/bpf_dsl/linux_syscall_ranges.h
@@ -35,18 +35,11 @@
 #define MIN_GHOST_SYSCALL   (MIN_PRIVATE_SYSCALL + 0xfff0u)
 #define MAX_SYSCALL         (MIN_GHOST_SYSCALL + 4u)
 
-#elif defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)
+#elif defined(ARCH_CPU_MIPS_FAMILY)
 
-#include <asm/unistd.h>  // for __NR_O32_Linux and __NR_Linux_syscalls
-#define MIN_SYSCALL         __NR_O32_Linux
-#define MAX_PUBLIC_SYSCALL  (MIN_SYSCALL + __NR_Linux_syscalls)
-#define MAX_SYSCALL         MAX_PUBLIC_SYSCALL
-
-#elif defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_64_BITS)
-
-#include <asm/unistd.h>  // for __NR_64_Linux and __NR_64_Linux_syscalls
-#define MIN_SYSCALL         __NR_64_Linux
-#define MAX_PUBLIC_SYSCALL  (MIN_SYSCALL + __NR_64_Linux_syscalls)
+#include <asm/unistd.h>
+#define MIN_SYSCALL         __NR_Linux
+#define MAX_PUBLIC_SYSCALL  (MIN_SYSCALL + 999u)
 #define MAX_SYSCALL         MAX_PUBLIC_SYSCALL
 
 #elif defined(__aarch64__)
diff --git a/qtwebengine/src/3rdparty/chromium/sandbox/linux/seccomp-bpf-helpers/baseline_policy.cc b/qtwebengine/src/3rdparty/chromium/sandbox/linux/seccomp-bpf-helpers/baseline_policy.cc
index 5e650d9..a340f57 100644
--- a/qtwebengine/src/3rdparty/chromium/sandbox/linux/seccomp-bpf-helpers/baseline_policy.cc
+++ b/qtwebengine/src/3rdparty/chromium/sandbox/linux/seccomp-bpf-helpers/baseline_policy.cc
@@ -201,6 +201,11 @@ ResultExpr EvaluateSyscallImpl(int fs_denied_errno,
   if (sysno == __NR_futex)
     return RestrictFutex();
 
+#if defined(__NR_futex_time64)
+  if (sysno == __NR_futex_time64)
+    return RestrictFutex();
+#endif
+
   if (sysno == __NR_set_robust_list)
     return Error(EPERM);
 
diff --git a/qtwebengine/src/3rdparty/chromium/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.cc b/qtwebengine/src/3rdparty/chromium/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.cc
index 6ae09fb..da22c8f 100644
--- a/qtwebengine/src/3rdparty/chromium/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.cc
+++ b/qtwebengine/src/3rdparty/chromium/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.cc
@@ -42,8 +42,12 @@
 // the one in Ubuntu 16.04 LTS) is missing PTRACE_GET_THREAD_AREA.
 // asm/ptrace-abi.h doesn't exist on arm32 and PTRACE_GET_THREAD_AREA isn't
 // defined on aarch64, so don't try to include this on those platforms.
+#if defined(__mips__)
+#include <asm/ptrace.h>
+#else
 #include <asm/ptrace-abi.h>
 #endif
+#endif
 #endif  // !OS_NACL_NONSFI
 
 #if defined(OS_ANDROID)
diff --git a/qtwebengine/src/3rdparty/chromium/sandbox/linux/system_headers/linux_stat.h b/qtwebengine/src/3rdparty/chromium/sandbox/linux/system_headers/linux_stat.h
index e697dd6..5f49a95 100644
--- a/qtwebengine/src/3rdparty/chromium/sandbox/linux/system_headers/linux_stat.h
+++ b/qtwebengine/src/3rdparty/chromium/sandbox/linux/system_headers/linux_stat.h
@@ -11,11 +11,7 @@
 #include "sandbox/linux/system_headers/linux_syscalls.h"
 
 #if defined(ARCH_CPU_MIPS_FAMILY)
-#if defined(ARCH_CPU_64_BITS)
-struct kernel_stat {
-#else
 struct kernel_stat64 {
-#endif
   unsigned st_dev;
   unsigned __pad0[3];
   unsigned long long st_ino;
@@ -109,6 +105,28 @@ struct kernel_stat {
   uint64_t st_ctime_nsec_;
   int64_t __unused4[3];
 };
+#elif (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_64_BITS))
+struct kernel_stat {
+  unsigned st_dev;
+  unsigned __pad0[3];
+  unsigned long st_ino;
+  unsigned st_mode;
+  unsigned st_nlink;
+  unsigned st_uid;
+  unsigned st_gid;
+  unsigned st_rdev;
+  unsigned __pad1[3];
+  long st_size;
+  unsigned st_atime_;
+  unsigned st_atime_nsec_;
+  unsigned st_mtime_;
+  unsigned st_mtime_nsec_;
+  unsigned st_ctime_;
+  unsigned st_ctime_nsec_;
+  unsigned st_blksize;
+  unsigned __pad2;
+  unsigned long st_blocks;
+};
 #elif (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
 struct kernel_stat {
   unsigned st_dev;
diff --git a/qtwebengine/src/3rdparty/chromium/testing/BUILD.gn b/qtwebengine/src/3rdparty/chromium/testing/BUILD.gn
index 56ebf8d..7d51bc0 100644
--- a/qtwebengine/src/3rdparty/chromium/testing/BUILD.gn
+++ b/qtwebengine/src/3rdparty/chromium/testing/BUILD.gn
@@ -27,7 +27,6 @@ group("run_perf_test") {
 
   data_deps = [
     ":test_scripts_shared",
-    "//third_party/catapult/tracing:convert_chart_json",
   ]
 
   if (is_android) {
diff --git a/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/codegen_format.py b/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/codegen_format.py
index 87d26ee..f3e9d38 100644
--- a/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/codegen_format.py
+++ b/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/codegen_format.py
@@ -23,7 +23,7 @@ class _TemplateFormatter(string.Formatter):
         self._template_formatter_indexing_count_ = 0
 
     def get_value(self, key, args, kwargs):
-        if isinstance(key, (int, long)):
+        if isinstance(key, int):
             return args[key]
         assert isinstance(key, str)
         if not key:
diff --git a/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/mako_renderer.py b/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/mako_renderer.py
index b4c7055..f3a2fcd 100644
--- a/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/mako_renderer.py
+++ b/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/mako_renderer.py
@@ -105,7 +105,7 @@ class MakoRenderer(object):
             on_error = self._caller_stack_on_error
             if (len(current) <= len(on_error)
                     and all(current[i] == on_error[i]
-                            for i in xrange(len(current)))):
+                            for i in range(len(current)))):
                 pass  # Error happened in a deeper caller.
             else:
                 self._caller_stack_on_error = list(self._caller_stack)
diff --git a/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/style_format.py b/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/style_format.py
index dc3493c..017d3d4 100644
--- a/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/style_format.py
+++ b/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/style_format.py
@@ -70,8 +70,13 @@ def gn_format(contents, filename=None):
 
 
 def _invoke_format_command(command_line, filename, contents):
-    proc = subprocess.Popen(
-        command_line, stdin=subprocess.PIPE, stdout=subprocess.PIPE)
+    kwargs = {}
+    if sys.version_info.major != 2:
+        kwargs['encoding'] = 'utf-8'
+    proc = subprocess.Popen(command_line,
+                            stdin=subprocess.PIPE,
+                            stdout=subprocess.PIPE,
+                            **kwargs)
     stdout_output, stderr_output = proc.communicate(input=contents)
     exit_code = proc.wait()
 
diff --git a/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/blink_v8_bridge.py b/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/blink_v8_bridge.py
index 3225ecc..fc078d3 100644
--- a/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/blink_v8_bridge.py
+++ b/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/blink_v8_bridge.py
@@ -344,7 +344,7 @@ def make_default_value_expr(idl_type, default_value):
     """
     assert default_value.is_type_compatible_with(idl_type)
 
-    class DefaultValueExpr:
+    class DefaultValueExpr(object):
         _ALLOWED_SYMBOLS_IN_DEPS = ("isolate")
 
         def __init__(self, initializer_expr, initializer_deps,
@@ -502,7 +502,7 @@ def make_v8_to_blink_value(blink_var_name,
     assert isinstance(blink_var_name, str)
     assert isinstance(v8_value_expr, str)
     assert isinstance(idl_type, web_idl.IdlType)
-    assert (argument_index is None or isinstance(argument_index, (int, long)))
+    assert (argument_index is None or isinstance(argument_index, int))
     assert (default_value is None
             or isinstance(default_value, web_idl.LiteralConstant))
 
@@ -622,7 +622,7 @@ def make_v8_to_blink_value_variadic(blink_var_name, v8_array,
     """
     assert isinstance(blink_var_name, str)
     assert isinstance(v8_array, str)
-    assert isinstance(v8_array_start_index, (int, long))
+    assert isinstance(v8_array_start_index, int)
     assert isinstance(idl_type, web_idl.IdlType)
 
     pattern = ("auto&& ${{{_1}}} = "
diff --git a/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/callback_interface.py b/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/callback_interface.py
index 4a6df51..8b51f23 100644
--- a/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/callback_interface.py
+++ b/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/callback_interface.py
@@ -177,7 +177,7 @@ def generate_callback_interface(callback_interface_identifier):
          prop_install_mode=PropInstallMode.UNCONDITIONAL,
          trampoline_var_name=None,
          attribute_entries=[],
-         constant_entries=filter(is_unconditional, constant_entries),
+         constant_entries=list(filter(is_unconditional, constant_entries)),
          exposed_construct_entries=[],
          operation_entries=[])
     (install_interface_template_decl, install_interface_template_def,
diff --git a/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/code_node.py b/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/code_node.py
index 52972fe..e5ae9d9 100644
--- a/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/code_node.py
+++ b/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/code_node.py
@@ -503,13 +503,13 @@ class CompositeNode(CodeNode):
         gensym_kwargs = {}
         template_vars = {}
         for arg in args:
-            assert isinstance(arg, (CodeNode, int, long, str))
+            assert isinstance(arg, (CodeNode, int, str))
             gensym = CodeNode.gensym()
             gensym_args.append("${{{}}}".format(gensym))
             template_vars[gensym] = arg
         for key, value in kwargs.items():
-            assert isinstance(key, (int, long, str))
-            assert isinstance(value, (CodeNode, int, long, str))
+            assert isinstance(key, (int, str))
+            assert isinstance(value, (CodeNode, int, str))
             gensym = CodeNode.gensym()
             gensym_kwargs[key] = "${{{}}}".format(gensym)
             template_vars[gensym] = value
@@ -602,7 +602,7 @@ class ListNode(CodeNode):
     def insert(self, index, node):
         if node is None:
             return
-        assert isinstance(index, (int, long))
+        assert isinstance(index, int)
         assert isinstance(node, CodeNode)
         assert node.outer is None and node.prev is None
 
@@ -721,7 +721,7 @@ class SymbolScopeNode(SequenceNode):
             if not scope_chains:
                 return counts
 
-            self_index = iter(scope_chains).next().index(self)
+            self_index = next(iter(scope_chains)).index(self)
             scope_chains = map(
                 lambda scope_chain: scope_chain[self_index + 1:], scope_chains)
             scope_to_likeliness = {}
diff --git a/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/codegen_expr.py b/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/codegen_expr.py
index a229a6c..5fa288d 100644
--- a/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/codegen_expr.py
+++ b/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/codegen_expr.py
@@ -109,7 +109,7 @@ def expr_and(terms):
 
     if any(term.is_always_false for term in terms):
         return _Expr(False)
-    terms = filter(lambda x: not x.is_always_true, terms)
+    terms = list(filter(lambda x: not x.is_always_true, terms))
     if not terms:
         return _Expr(True)
     if len(terms) == 1:
@@ -124,7 +124,7 @@ def expr_or(terms):
 
     if any(term.is_always_true for term in terms):
         return _Expr(True)
-    terms = filter(lambda x: not x.is_always_false, terms)
+    terms = list(filter(lambda x: not x.is_always_false, terms))
     if not terms:
         return _Expr(False)
     if len(terms) == 1:
@@ -222,7 +222,7 @@ def expr_from_exposure(exposure,
     elif exposure.only_in_secure_contexts is False:
         secure_context_term = _Expr(True)
     else:
-        terms = map(ref_enabled, exposure.only_in_secure_contexts)
+        terms = list(map(ref_enabled, exposure.only_in_secure_contexts))
         secure_context_term = expr_or(
             [_Expr("${is_in_secure_context}"),
              expr_not(expr_and(terms))])
@@ -275,10 +275,11 @@ def expr_from_exposure(exposure,
 
     # [ContextEnabled]
     if exposure.context_enabled_features:
-        terms = map(
-            lambda feature: _Expr(
-                "${{context_feature_settings}}->is{}Enabled()".format(
-                    feature)), exposure.context_enabled_features)
+        terms = list(
+            map(
+                lambda feature: _Expr(
+                    "${{context_feature_settings}}->is{}Enabled()".format(
+                        feature)), exposure.context_enabled_features))
         context_enabled_terms.append(
             expr_and([_Expr("${context_feature_settings}"),
                       expr_or(terms)]))
diff --git a/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/codegen_utils.py b/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/codegen_utils.py
index 2bcc4fe..e72282a 100644
--- a/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/codegen_utils.py
+++ b/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/codegen_utils.py
@@ -116,4 +116,4 @@ def write_code_node_to_file(code_node, filepath):
 #                               stderr=format_result.error_message))
 #
 #    web_idl.file_io.write_to_file_if_changed(filepath, format_result.contents)
-    web_idl.file_io.write_to_file_if_changed(filepath, rendered_text)
+    web_idl.file_io.write_to_file_if_changed(filepath, rendered_text.encode('utf-8'))
diff --git a/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/dictionary.py b/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/dictionary.py
index b39f010..4d68202 100644
--- a/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/dictionary.py
+++ b/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/dictionary.py
@@ -993,7 +993,7 @@ def make_dict_trace_func(cg_context):
         _2 = _blink_member_name(member).value_var
         return TextNode(_format(pattern, _1=_1, _2=_2))
 
-    body.extend(map(make_trace_member_node, own_members))
+    body.extend(list(map(make_trace_member_node, own_members)))
     body.append(TextNode("BaseClass::Trace(visitor);"))
 
     return func_decl, func_def
diff --git a/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/interface.py b/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/interface.py
index 10ff306..bfdf712 100644
--- a/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/interface.py
+++ b/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/interface.py
@@ -582,7 +582,7 @@ def _make_blink_api_call(code_node,
                          overriding_args=None):
     assert isinstance(code_node, SymbolScopeNode)
     assert isinstance(cg_context, CodeGenContext)
-    assert num_of_args is None or isinstance(num_of_args, (int, long))
+    assert num_of_args is None or isinstance(num_of_args, int)
     assert (overriding_args is None
             or (isinstance(overriding_args, (list, tuple))
                 and all(isinstance(arg, str) for arg in overriding_args)))
@@ -1196,8 +1196,10 @@ def make_overload_dispatcher(cg_context):
             did_use_break = did_use_break or can_fail
 
         conditional = expr_or(
-            map(lambda item: expr_from_exposure(item.function_like.exposure),
-                items))
+            list(
+                map(
+                    lambda item: expr_from_exposure(item.function_like.exposure
+                                                    ), items)))
         if not conditional.is_always_true:
             node = CxxUnlikelyIfNode(cond=conditional, body=node)
 
@@ -4642,7 +4644,7 @@ class _PropEntryConstructorGroup(_PropEntryBase):
     def __init__(self, is_context_dependent, exposure_conditional, world,
                  constructor_group, ctor_callback_name, ctor_func_length):
         assert isinstance(ctor_callback_name, str)
-        assert isinstance(ctor_func_length, (int, long))
+        assert isinstance(ctor_func_length, int)
 
         _PropEntryBase.__init__(self, is_context_dependent,
                                 exposure_conditional, world, constructor_group)
@@ -4670,7 +4672,7 @@ class _PropEntryOperationGroup(_PropEntryBase):
                  op_func_length,
                  no_alloc_direct_callback_name=None):
         assert isinstance(op_callback_name, str)
-        assert isinstance(op_func_length, (int, long))
+        assert isinstance(op_func_length, int)
 
         _PropEntryBase.__init__(self, is_context_dependent,
                                 exposure_conditional, world, operation_group)
@@ -5175,9 +5177,9 @@ def make_install_interface_template(cg_context, function_name, class_name, api_c
     ])
 
     if class_like.identifier == "CSSStyleDeclaration":
-        css_properties = filter(
-            lambda attr: "CSSProperty" in attr.extended_attributes,
-            class_like.attributes)
+        css_properties = list(
+            filter(lambda attr: "CSSProperty" in attr.extended_attributes,
+                   class_like.attributes))
         if css_properties:
             prop_name_list = "".join(
                 map(lambda attr: "\"{}\", ".format(attr.identifier),
@@ -5567,8 +5569,8 @@ ${instance_object} = ${v8_context}->Global()->GetPrototype().As<v8::Object>();\
             "V8DOMConfiguration::InstallConstants(${isolate}, "
             "${interface_template}, ${prototype_template}, "
             "kConstantCallbackTable, base::size(kConstantCallbackTable));")
-    constant_callback_entries = filter(lambda entry: entry.const_callback_name,
-                                       constant_entries)
+    constant_callback_entries = list(filter(lambda entry: entry.const_callback_name,
+                                       constant_entries))
     install_properties(table_name, constant_callback_entries,
                        _make_constant_callback_registration_table,
                        installer_call_text)
@@ -5584,8 +5586,8 @@ ${instance_object} = ${v8_context}->Global()->GetPrototype().As<v8::Object>();\
             "V8DOMConfiguration::InstallConstants(${isolate}, "
             "${interface_template}, ${prototype_template}, "
             "kConstantValueTable, base::size(kConstantValueTable));")
-    constant_value_entries = filter(
-        lambda entry: not entry.const_callback_name, constant_entries)
+    constant_value_entries = list(filter(
+        lambda entry: not entry.const_callback_name, constant_entries))
     install_properties(table_name, constant_value_entries,
                        _make_constant_value_registration_table,
                        installer_call_text)
@@ -6336,8 +6338,8 @@ def make_v8_context_snapshot_api(cg_context, component, attribute_entries,
     assert isinstance(component, web_idl.Component)
 
     derived_interfaces = cg_context.interface.deriveds
-    derived_names = map(lambda interface: interface.identifier,
-                        derived_interfaces)
+    derived_names = list(
+        map(lambda interface: interface.identifier, derived_interfaces))
     derived_names.append(cg_context.interface.identifier)
     if not ("Window" in derived_names or "HTMLDocument" in derived_names):
         return None, None
@@ -6411,9 +6413,11 @@ def _make_v8_context_snapshot_get_reference_table_function(
     collect_callbacks(named_properties_object_callback_defs)
     collect_callbacks(cross_origin_property_callback_defs)
 
-    entry_nodes = map(
-        lambda name: TextNode("reinterpret_cast<intptr_t>({}),".format(name)),
-        filter(None, callback_names))
+    entry_nodes = list(
+        map(
+            lambda name: TextNode("reinterpret_cast<intptr_t>({}),".format(name
+                                                                           )),
+            filter(None, callback_names)))
     table_node = ListNode([
         TextNode("using namespace ${class_name}Callbacks;"),
         TextNode("static const intptr_t kReferenceTable[] = {"),
@@ -6451,10 +6455,11 @@ def _make_v8_context_snapshot_install_props_per_context_function(
         class_name=None,
         prop_install_mode=PropInstallMode.V8_CONTEXT_SNAPSHOT,
         trampoline_var_name=None,
-        attribute_entries=filter(selector, attribute_entries),
-        constant_entries=filter(selector, constant_entries),
-        exposed_construct_entries=filter(selector, exposed_construct_entries),
-        operation_entries=filter(selector, operation_entries))
+        attribute_entries=list(filter(selector, attribute_entries)),
+        constant_entries=list(filter(selector, constant_entries)),
+        exposed_construct_entries=list(
+            filter(selector, exposed_construct_entries)),
+        operation_entries=list(filter(selector, operation_entries)))
 
     return func_decl, func_def
 
@@ -6810,11 +6815,11 @@ def generate_interface(interface_identifier):
          class_name=impl_class_name,
          prop_install_mode=PropInstallMode.UNCONDITIONAL,
          trampoline_var_name=tp_install_unconditional_props,
-         attribute_entries=filter(is_unconditional, attribute_entries),
-         constant_entries=filter(is_unconditional, constant_entries),
-         exposed_construct_entries=filter(is_unconditional,
-                                          exposed_construct_entries),
-         operation_entries=filter(is_unconditional, operation_entries))
+         attribute_entries=list(filter(is_unconditional, attribute_entries)),
+         constant_entries=list(filter(is_unconditional, constant_entries)),
+         exposed_construct_entries=list(
+             filter(is_unconditional, exposed_construct_entries)),
+         operation_entries=list(filter(is_unconditional, operation_entries)))
     (install_context_independent_props_decl,
      install_context_independent_props_def,
      install_context_independent_props_trampoline) = make_install_properties(
@@ -6823,11 +6828,14 @@ def generate_interface(interface_identifier):
          class_name=impl_class_name,
          prop_install_mode=PropInstallMode.CONTEXT_INDEPENDENT,
          trampoline_var_name=tp_install_context_independent_props,
-         attribute_entries=filter(is_context_independent, attribute_entries),
-         constant_entries=filter(is_context_independent, constant_entries),
-         exposed_construct_entries=filter(is_context_independent,
-                                          exposed_construct_entries),
-         operation_entries=filter(is_context_independent, operation_entries))
+         attribute_entries=list(
+             filter(is_context_independent, attribute_entries)),
+         constant_entries=list(filter(is_context_independent,
+                                      constant_entries)),
+         exposed_construct_entries=list(
+             filter(is_context_independent, exposed_construct_entries)),
+         operation_entries=list(
+             filter(is_context_independent, operation_entries)))
     (install_context_dependent_props_decl, install_context_dependent_props_def,
      install_context_dependent_props_trampoline) = make_install_properties(
          cg_context,
@@ -6835,11 +6843,13 @@ def generate_interface(interface_identifier):
          class_name=impl_class_name,
          prop_install_mode=PropInstallMode.CONTEXT_DEPENDENT,
          trampoline_var_name=tp_install_context_dependent_props,
-         attribute_entries=filter(is_context_dependent, attribute_entries),
-         constant_entries=filter(is_context_dependent, constant_entries),
-         exposed_construct_entries=filter(is_context_dependent,
-                                          exposed_construct_entries),
-         operation_entries=filter(is_context_dependent, operation_entries))
+         attribute_entries=list(filter(is_context_dependent,
+                                       attribute_entries)),
+         constant_entries=list(filter(is_context_dependent, constant_entries)),
+         exposed_construct_entries=list(
+             filter(is_context_dependent, exposed_construct_entries)),
+         operation_entries=list(filter(is_context_dependent,
+                                       operation_entries)))
     (install_interface_template_decl, install_interface_template_def,
      install_interface_template_trampoline) = make_install_interface_template(
          cg_context,
diff --git a/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/task_queue.py b/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/task_queue.py
index 0d8f4c0..e666a9b 100644
--- a/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/task_queue.py
+++ b/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/task_queue.py
@@ -2,6 +2,7 @@
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
+import functools
 import multiprocessing
 
 from .package_initializer import package_initializer
@@ -76,7 +77,7 @@ class TaskQueue(object):
         if not report_progress:
             return
 
-        done_count = reduce(
+        done_count = functools.reduce(
             lambda count, worker_task: count + bool(worker_task.ready()),
             self._worker_tasks, 0)
         report_progress(len(self._worker_tasks), done_count)
@@ -85,4 +86,4 @@ class TaskQueue(object):
 def _task_queue_run_tasks(tasks):
     for task in tasks:
         func, args, kwargs = task
-        apply(func, args, kwargs)
+        func(*args, **kwargs)
diff --git a/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/code_generator.py b/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/code_generator.py
index e8280be..e49e6eb 100644
--- a/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/code_generator.py
+++ b/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/code_generator.py
@@ -13,6 +13,7 @@ import re
 import sys
 
 from idl_types import set_ancestors, IdlType
+from itertools import groupby
 from v8_globals import includes
 from v8_interface import constant_filters
 from v8_types import set_component_dirs
@@ -43,6 +44,7 @@ TEMPLATES_DIR = os.path.normpath(
 # after path[0] == invoking script dir
 sys.path.insert(1, THIRD_PARTY_DIR)
 import jinja2
+from jinja2.filters import make_attrgetter, environmentfilter
 
 
 def generate_indented_conditional(code, conditional):
@@ -88,6 +90,13 @@ def runtime_enabled_if(code, name):
     return generate_indented_conditional(code, function)
 
 
+@environmentfilter
+def do_stringify_key_group_by(environment, value, attribute):
+    expr = make_attrgetter(environment, attribute)
+    key = lambda item: '' if expr(item) is None else str(expr(item))
+    return groupby(sorted(value, key=key), expr)
+
+
 def initialize_jinja_env(cache_dir):
     jinja_env = jinja2.Environment(
         loader=jinja2.FileSystemLoader(TEMPLATES_DIR),
@@ -117,6 +126,7 @@ def initialize_jinja_env(cache_dir):
     })
     jinja_env.filters.update(constant_filters())
     jinja_env.filters.update(method_filters())
+    jinja_env.filters["stringifykeygroupby"] = do_stringify_key_group_by
     return jinja_env
 
 
diff --git a/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/idl_reader.py b/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/idl_reader.py
index 8d72865..b80eebd 100644
--- a/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/idl_reader.py
+++ b/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/idl_reader.py
@@ -55,8 +55,8 @@ def validate_blink_idl_definitions(idl_filename, idl_file_basename,
          definitions. There is no filename convention in this case.
        - Otherwise, an IDL file is invalid.
     """
-    targets = (
-        definitions.interfaces.values() + definitions.dictionaries.values())
+    targets = (list(definitions.interfaces.values()) +
+               list(definitions.dictionaries.values()))
     number_of_targets = len(targets)
     if number_of_targets > 1:
         raise Exception(
diff --git a/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/idl_types.py b/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/idl_types.py
index cd4f0c3..ab95e9c 100644
--- a/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/idl_types.py
+++ b/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/idl_types.py
@@ -349,7 +349,7 @@ class IdlUnionType(IdlTypeBase):
         return True
 
     def single_matching_member_type(self, predicate):
-        matching_types = filter(predicate, self.flattened_member_types)
+        matching_types = list(filter(predicate, self.flattened_member_types))
         if len(matching_types) > 1:
             raise ValueError('%s is ambiguous.' % self.name)
         return matching_types[0] if matching_types else None
diff --git a/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/web_idl/database.py b/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/web_idl/database.py
index c92cf48..f5d5912 100644
--- a/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/web_idl/database.py
+++ b/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/web_idl/database.py
@@ -156,4 +156,4 @@ class Database(object):
         return self._view_by_kind(Database._Kind.UNION)
 
     def _view_by_kind(self, kind):
-        return self._impl.find_by_kind(kind).values()
+        return list(self._impl.find_by_kind(kind).values())
diff --git a/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/web_idl/function_like.py b/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/web_idl/function_like.py
index 648c70d..1712f19 100644
--- a/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/web_idl/function_like.py
+++ b/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/web_idl/function_like.py
@@ -71,8 +71,9 @@ class FunctionLike(WithIdentifier):
     def num_of_required_arguments(self):
         """Returns the number of required arguments."""
         return len(
-            filter(lambda arg: not (arg.is_optional or arg.is_variadic),
-                   self.arguments))
+            list(
+                filter(lambda arg: not (arg.is_optional or arg.is_variadic),
+                       self.arguments)))
 
 
 class OverloadGroup(WithIdentifier):
@@ -171,8 +172,7 @@ class OverloadGroup(WithIdentifier):
         Returns the effective overload set.
         https://heycam.github.io/webidl/#compute-the-effective-overload-set
         """
-        assert argument_count is None or isinstance(argument_count,
-                                                    (int, long))
+        assert argument_count is None or isinstance(argument_count, int)
 
         N = argument_count
         S = []
@@ -188,21 +188,21 @@ class OverloadGroup(WithIdentifier):
 
             S.append(
                 OverloadGroup.EffectiveOverloadItem(
-                    X, map(lambda arg: arg.idl_type, X.arguments),
-                    map(lambda arg: arg.optionality, X.arguments)))
+                    X, list(map(lambda arg: arg.idl_type, X.arguments)),
+                    list(map(lambda arg: arg.optionality, X.arguments))))
 
             if X.is_variadic:
-                for i in xrange(n, max(maxarg, N)):
-                    t = map(lambda arg: arg.idl_type, X.arguments)
-                    o = map(lambda arg: arg.optionality, X.arguments)
-                    for _ in xrange(n, i + 1):
+                for i in range(n, max(maxarg, N)):
+                    t = list(map(lambda arg: arg.idl_type, X.arguments))
+                    o = list(map(lambda arg: arg.optionality, X.arguments))
+                    for _ in range(n, i + 1):
                         t.append(X.arguments[-1].idl_type)
                         o.append(X.arguments[-1].optionality)
                     S.append(OverloadGroup.EffectiveOverloadItem(X, t, o))
 
-            t = map(lambda arg: arg.idl_type, X.arguments)
-            o = map(lambda arg: arg.optionality, X.arguments)
-            for i in xrange(n - 1, -1, -1):
+            t = list(map(lambda arg: arg.idl_type, X.arguments))
+            o = list(map(lambda arg: arg.optionality, X.arguments))
+            for i in range(n - 1, -1, -1):
                 if X.arguments[i].optionality == IdlType.Optionality.REQUIRED:
                     break
                 S.append(OverloadGroup.EffectiveOverloadItem(X, t[:i], o[:i]))
@@ -222,7 +222,7 @@ class OverloadGroup(WithIdentifier):
             for item in items)
         assert len(items) > 1
 
-        for index in xrange(len(items[0].type_list)):
+        for index in range(len(items[0].type_list)):
             # Assume that the given items are valid, and we only need to test
             # the two types.
             if OverloadGroup.are_distinguishable_types(
diff --git a/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/web_idl/make_copy.py b/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/web_idl/make_copy.py
index a7a2b11..2f6b613 100644
--- a/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/web_idl/make_copy.py
+++ b/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/web_idl/make_copy.py
@@ -3,6 +3,13 @@
 # found in the LICENSE file.
 
 
+import sys
+
+# TODO: Remove this once Python2 is obsoleted.
+if sys.version_info.major != 2:
+    long = int
+    basestring = str
+
 def make_copy(obj, memo=None):
     """
     Creates a copy of the given object, which should be an IR or part of IR.
diff --git a/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/web_idl/callback_interface.py b/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/web_idl/callback_interface.py
index 13fb7c7..b73b771 100644
--- a/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/web_idl/callback_interface.py
+++ b/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/web_idl/callback_interface.py
@@ -91,11 +91,13 @@ class CallbackInterface(UserDefinedType, WithExtendedAttributes,
             for operation_ir in ir.operations
         ])
         self._operation_groups = tuple([
-            OperationGroup(
-                operation_group_ir,
-                filter(lambda x: x.identifier == operation_group_ir.identifier,
-                       self._operations),
-                owner=self) for operation_group_ir in ir.operation_groups
+            OperationGroup(operation_group_ir,
+                           list(
+                               filter(
+                                   lambda x: x.identifier == operation_group_ir
+                                   .identifier, self._operations)),
+                           owner=self)
+            for operation_group_ir in ir.operation_groups
         ])
 
     @property
diff --git a/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/web_idl/exposure.py b/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/web_idl/exposure.py
index abaeef3..e36cf74 100644
--- a/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/web_idl/exposure.py
+++ b/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/web_idl/exposure.py
@@ -8,8 +8,11 @@ from .runtime_enabled_features import RuntimeEnabledFeatures
 class _Feature(str):
     """Represents a runtime-enabled feature."""
 
+    def __new__(cls, value):
+        return str.__new__(cls, value)
+
     def __init__(self, value):
-        str.__init__(self, value)
+        str.__init__(self)
         self._is_context_dependent = (
             RuntimeEnabledFeatures.is_context_dependent(self))
 
diff --git a/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/web_idl/idl_compiler.py b/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/web_idl/idl_compiler.py
index c5ee2bd..5831507 100644
--- a/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/web_idl/idl_compiler.py
+++ b/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/web_idl/idl_compiler.py
@@ -149,8 +149,8 @@ class IdlCompiler(object):
         for old_ir in old_irs:
             new_ir = make_copy(old_ir)
             self._ir_map.add(new_ir)
-            new_ir.attributes = filter(not_disabled, new_ir.attributes)
-            new_ir.operations = filter(not_disabled, new_ir.operations)
+            new_ir.attributes = list(filter(not_disabled, new_ir.attributes))
+            new_ir.operations = list(filter(not_disabled, new_ir.operations))
 
     def _record_defined_in_partial_and_mixin(self):
         old_irs = self._ir_map.irs_of_kinds(
@@ -231,7 +231,7 @@ class IdlCompiler(object):
                       only_to_members_of_partial_or_mixin=False)
             propagate_to_exposure(propagate)
 
-            map(process_member_like, ir.iter_all_members())
+            list(map(process_member_like, ir.iter_all_members()))
 
         def process_member_like(ir):
             propagate = functools.partial(propagate_extattr, ir=ir)
@@ -257,7 +257,7 @@ class IdlCompiler(object):
 
         self._ir_map.move_to_new_phase()
 
-        map(process_interface_like, old_irs)
+        list(map(process_interface_like, old_irs))
 
     def _determine_blink_headers(self):
         irs = self._ir_map.irs_of_kinds(
@@ -422,9 +422,9 @@ class IdlCompiler(object):
             assert not new_interface.deriveds
             derived_set = identifier_to_derived_set.get(
                 new_interface.identifier, set())
-            new_interface.deriveds = map(
-                lambda id_: self._ref_to_idl_def_factory.create(id_),
-                sorted(derived_set))
+            new_interface.deriveds = list(
+                map(lambda id_: self._ref_to_idl_def_factory.create(id_),
+                    sorted(derived_set)))
 
     def _supplement_missing_html_constructor_operation(self):
         # Temporary mitigation of misuse of [HTMLConstructor]
@@ -553,7 +553,8 @@ class IdlCompiler(object):
             self._ir_map.add(new_ir)
 
             for group in new_ir.iter_all_overload_groups():
-                exposures = map(lambda overload: overload.exposure, group)
+                exposures = list(map(lambda overload: overload.exposure,
+                                     group))
 
                 # [Exposed]
                 if any(not exposure.global_names_and_features
@@ -653,8 +654,8 @@ class IdlCompiler(object):
             constructs = set()
             for global_name in global_names:
                 constructs.update(exposed_map.get(global_name, []))
-            new_ir.exposed_constructs = map(
-                self._ref_to_idl_def_factory.create, sorted(constructs))
+            new_ir.exposed_constructs = list(
+                map(self._ref_to_idl_def_factory.create, sorted(constructs)))
 
             assert not new_ir.legacy_window_aliases
             if new_ir.identifier != 'Window':
diff --git a/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/web_idl/interface.py b/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/web_idl/interface.py
index 65d24e5..067ef2e 100644
--- a/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/web_idl/interface.py
+++ b/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/web_idl/interface.py
@@ -180,8 +180,9 @@ class Interface(UserDefinedType, WithExtendedAttributes, WithCodeGeneratorInfo,
         self._constructor_groups = tuple([
             ConstructorGroup(
                 group_ir,
-                filter(lambda x: x.identifier == group_ir.identifier,
-                       self._constructors),
+                list(
+                    filter(lambda x: x.identifier == group_ir.identifier,
+                           self._constructors)),
                 owner=self) for group_ir in ir.constructor_groups
         ])
         assert len(self._constructor_groups) <= 1
@@ -192,8 +193,9 @@ class Interface(UserDefinedType, WithExtendedAttributes, WithCodeGeneratorInfo,
         self._named_constructor_groups = tuple([
             ConstructorGroup(
                 group_ir,
-                filter(lambda x: x.identifier == group_ir.identifier,
-                       self._named_constructors),
+                list(
+                    filter(lambda x: x.identifier == group_ir.identifier,
+                           self._named_constructors)),
                 owner=self) for group_ir in ir.named_constructor_groups
         ])
         self._operations = tuple([
@@ -203,22 +205,23 @@ class Interface(UserDefinedType, WithExtendedAttributes, WithCodeGeneratorInfo,
         self._operation_groups = tuple([
             OperationGroup(
                 group_ir,
-                filter(lambda x: x.identifier == group_ir.identifier,
-                       self._operations),
+                list(
+                    filter(lambda x: x.identifier == group_ir.identifier,
+                           self._operations)),
                 owner=self) for group_ir in ir.operation_groups
         ])
         self._exposed_constructs = tuple(ir.exposed_constructs)
         self._legacy_window_aliases = tuple(ir.legacy_window_aliases)
         self._indexed_and_named_properties = None
-        indexed_and_named_property_operations = filter(
-            lambda x: x.is_indexed_or_named_property_operation,
-            self._operations)
+        indexed_and_named_property_operations = list(
+            filter(lambda x: x.is_indexed_or_named_property_operation,
+                   self._operations))
         if indexed_and_named_property_operations:
             self._indexed_and_named_properties = IndexedAndNamedProperties(
                 indexed_and_named_property_operations, owner=self)
         self._stringifier = None
-        stringifier_operation_irs = filter(lambda x: x.is_stringifier,
-                                           ir.operations)
+        stringifier_operation_irs = list(
+            filter(lambda x: x.is_stringifier, ir.operations))
         if stringifier_operation_irs:
             assert len(stringifier_operation_irs) == 1
             op_ir = make_copy(stringifier_operation_irs[0])
@@ -231,8 +234,9 @@ class Interface(UserDefinedType, WithExtendedAttributes, WithCodeGeneratorInfo,
             attribute = None
             if operation.stringifier_attribute:
                 attr_id = operation.stringifier_attribute
-                attributes = filter(lambda x: x.identifier == attr_id,
-                                    self._attributes)
+                attributes = list(
+                    filter(lambda x: x.identifier == attr_id,
+                           self._attributes))
                 assert len(attributes) == 1
                 attribute = attributes[0]
             self._stringifier = Stringifier(operation, attribute, owner=self)
@@ -578,8 +582,9 @@ class Iterable(WithDebugInfo):
         self._operation_groups = tuple([
             OperationGroup(
                 group_ir,
-                filter(lambda x: x.identifier == group_ir.identifier,
-                       self._operations),
+                list(
+                    filter(lambda x: x.identifier == group_ir.identifier,
+                           self._operations)),
                 owner=owner) for group_ir in ir.operation_groups
         ])
 
@@ -666,8 +671,9 @@ class Maplike(WithDebugInfo):
         self._operation_groups = tuple([
             OperationGroup(
                 group_ir,
-                filter(lambda x: x.identifier == group_ir.identifier,
-                       self._operations),
+                list(
+                    filter(lambda x: x.identifier == group_ir.identifier,
+                           self._operations)),
                 owner=owner) for group_ir in ir.operation_groups
         ])
 
@@ -755,8 +761,9 @@ class Setlike(WithDebugInfo):
         self._operation_groups = tuple([
             OperationGroup(
                 group_ir,
-                filter(lambda x: x.identifier == group_ir.identifier,
-                       self._operations),
+                list(
+                    filter(lambda x: x.identifier == group_ir.identifier,
+                           self._operations)),
                 owner=owner) for group_ir in ir.operation_groups
         ])
 
diff --git a/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/web_idl/ir_builder.py b/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/web_idl/ir_builder.py
index e9aeff4..d80554d 100644
--- a/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/web_idl/ir_builder.py
+++ b/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/web_idl/ir_builder.py
@@ -2,6 +2,8 @@
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
+import sys
+
 from .argument import Argument
 from .ast_group import AstGroup
 from .attribute import Attribute
@@ -30,6 +32,11 @@ from .operation import Operation
 from .typedef import Typedef
 
 
+# TODO: Remove this once Python2 is obsoleted.
+if sys.version_info.major != 2:
+    long = int
+
+
 def load_and_register_idl_definitions(filepaths, register_ir,
                                       create_ref_to_idl_def, idl_type_factory):
     """
@@ -160,7 +167,7 @@ class _IRBuilder(object):
         child_nodes = list(node.GetChildren())
         extended_attributes = self._take_extended_attributes(child_nodes)
 
-        members = map(self._build_interface_member, child_nodes)
+        members = list(map(self._build_interface_member, child_nodes))
         attributes = []
         constants = []
         operations = []
@@ -302,7 +309,7 @@ class _IRBuilder(object):
         child_nodes = list(node.GetChildren())
         inherited = self._take_inheritance(child_nodes)
         extended_attributes = self._take_extended_attributes(child_nodes)
-        own_members = map(self._build_dictionary_member, child_nodes)
+        own_members = list(map(self._build_dictionary_member, child_nodes))
 
         return Dictionary.IR(
             identifier=Identifier(node.GetName()),
@@ -336,7 +343,7 @@ class _IRBuilder(object):
 
         child_nodes = list(node.GetChildren())
         extended_attributes = self._take_extended_attributes(child_nodes)
-        members = map(self._build_interface_member, child_nodes)
+        members = list(map(self._build_interface_member, child_nodes))
         constants = []
         operations = []
         for member in members:
@@ -456,8 +463,8 @@ class _IRBuilder(object):
                 assert len(child_nodes) == 1
                 child = child_nodes[0]
                 if child.GetClass() == 'Arguments':
-                    arguments = map(build_extattr_argument,
-                                    child.GetChildren())
+                    arguments = list(
+                        map(build_extattr_argument, child.GetChildren()))
                 elif child.GetClass() == 'Call':
                     assert len(child.GetChildren()) == 1
                     grand_child = child.GetChildren()[0]
@@ -486,7 +493,9 @@ class _IRBuilder(object):
 
         assert node.GetClass() == 'ExtAttributes'
         return ExtendedAttributes(
-            filter(None, map(build_extended_attribute, node.GetChildren())))
+            list(
+                filter(None, map(build_extended_attribute,
+                                 node.GetChildren()))))
 
     def _build_inheritance(self, node):
         assert node.GetClass() == 'Inherit'
@@ -506,7 +515,7 @@ class _IRBuilder(object):
 
     def _build_iterable(self, node):
         assert node.GetClass() == 'Iterable'
-        types = map(self._build_type, node.GetChildren())
+        types = list(map(self._build_type, node.GetChildren()))
         assert len(types) == 1 or len(types) == 2
         if len(types) == 1:  # value iterator
             key_type, value_type = (None, types[0])
@@ -584,7 +593,7 @@ class _IRBuilder(object):
     def _build_maplike(self, node, interface_identifier):
         assert node.GetClass() == 'Maplike'
         assert isinstance(interface_identifier, Identifier)
-        types = map(self._build_type, node.GetChildren())
+        types = list(map(self._build_type, node.GetChildren()))
         assert len(types) == 2
         key_type, value_type = types
         is_readonly = bool(node.GetProperty('READONLY'))
@@ -676,7 +685,7 @@ class _IRBuilder(object):
     def _build_setlike(self, node, interface_identifier):
         assert node.GetClass() == 'Setlike'
         assert isinstance(interface_identifier, Identifier)
-        types = map(self._build_type, node.GetChildren())
+        types = list(map(self._build_type, node.GetChildren()))
         assert len(types) == 1
         value_type = types[0]
         is_readonly = bool(node.GetProperty('READONLY'))
@@ -838,7 +847,7 @@ class _IRBuilder(object):
 
         def build_union_type(node, extended_attributes):
             return self._idl_type_factory.union_type(
-                member_types=map(self._build_type, node.GetChildren()),
+                member_types=list(map(self._build_type, node.GetChildren())),
                 is_optional=is_optional,
                 extended_attributes=extended_attributes,
                 debug_info=self._build_debug_info(node))
diff --git a/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/web_idl/namespace.py b/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/web_idl/namespace.py
index eeabef9..bd7e989 100644
--- a/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/web_idl/namespace.py
+++ b/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/web_idl/namespace.py
@@ -107,11 +107,13 @@ class Namespace(UserDefinedType, WithExtendedAttributes, WithCodeGeneratorInfo,
             for operation_ir in ir.operations
         ])
         self._operation_groups = tuple([
-            OperationGroup(
-                operation_group_ir,
-                filter(lambda x: x.identifier == operation_group_ir.identifier,
-                       self._operations),
-                owner=self) for operation_group_ir in ir.operation_groups
+            OperationGroup(operation_group_ir,
+                           list(
+                               filter(
+                                   lambda x: x.identifier == operation_group_ir
+                                   .identifier, self._operations)),
+                           owner=self)
+            for operation_group_ir in ir.operation_groups
         ])
 
     @property
diff --git a/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/generate_origin_trial_features.py b/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/generate_origin_trial_features.py
index 130004e..04c0fab 100755
--- a/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/generate_origin_trial_features.py
+++ b/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/generate_origin_trial_features.py
@@ -80,7 +80,7 @@ def read_idl_file(reader, idl_filename):
     assert len(interfaces) == 1, (
         "Expected one interface in file %r, found %d" %
         (idl_filename, len(interfaces)))
-    return (interfaces.values()[0], includes)
+    return (list(interfaces.values())[0], includes)
 
 
 def interface_is_global(interface):
@@ -281,7 +281,7 @@ def main():
 
     info_provider = create_component_info_provider(
         os.path.normpath(options.info_dir), options.target_component)
-    idl_filenames = map(str.strip, open(options.idl_files_list))
+    idl_filenames = list(map(str.strip, open(options.idl_files_list)))
 
     generate_origin_trial_features(info_provider, options, idl_filenames)
     return 0
diff --git a/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/idl_definitions.py b/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/idl_definitions.py
index 14e6e9d..b027818 100644
--- a/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/idl_definitions.py
+++ b/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/idl_definitions.py
@@ -394,7 +394,8 @@ class IdlInterface(object):
             else:
                 raise ValueError('Unrecognized node class: %s' % child_class)
 
-        if len(filter(None, [self.iterable, self.maplike, self.setlike])) > 1:
+        if len(list(filter(None,
+                           [self.iterable, self.maplike, self.setlike]))) > 1:
             raise ValueError(
                 'Interface can only have one of iterable<>, maplike<> and setlike<>.'
             )
@@ -512,6 +513,9 @@ class IdlAttribute(TypedObject):
     def accept(self, visitor):
         visitor.visit_attribute(self)
 
+    def __lt__(self, other):
+        return self.name < other.name
+
 
 ################################################################################
 # Constants
@@ -852,7 +856,7 @@ class IdlIncludes(object):
 ################################################################################
 
 
-class Exposure:
+class Exposure(object):
     """An Exposure holds one Exposed or RuntimeEnabled condition.
     Each exposure has two properties: exposed and runtime_enabled.
     Exposure(e, r) corresponds to [Exposed(e r)]. Exposure(e) corresponds to
diff --git a/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/utilities.py b/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/utilities.py
index e1677ee..3c5006f 100644
--- a/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/utilities.py
+++ b/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/utilities.py
@@ -196,8 +196,9 @@ class ComponentInfoProviderModules(ComponentInfoProvider):
 
     @property
     def callback_functions(self):
-        return dict(self._component_info_core['callback_functions'].items() +
-                    self._component_info_modules['callback_functions'].items())
+        return dict(
+            list(self._component_info_core['callback_functions'].items()) +
+            list(self._component_info_modules['callback_functions'].items()))
 
     @property
     def specifier_for_export(self):
@@ -209,8 +210,8 @@ class ComponentInfoProviderModules(ComponentInfoProvider):
 
 
 def load_interfaces_info_overall_pickle(info_dir):
-    with open(os.path.join(info_dir,
-                           'interfaces_info.pickle')) as interface_info_file:
+    with open(os.path.join(info_dir, 'interfaces_info.pickle'),
+              mode='rb') as interface_info_file:
         return pickle.load(interface_info_file)
 
 
@@ -236,23 +237,20 @@ def merge_dict_recursively(target, diff):
 
 def create_component_info_provider_core(info_dir):
     interfaces_info = load_interfaces_info_overall_pickle(info_dir)
-    with open(
-            os.path.join(info_dir, 'core',
-                         'component_info_core.pickle')) as component_info_file:
+    with open(os.path.join(info_dir, 'core', 'component_info_core.pickle'),
+              mode='rb') as component_info_file:
         component_info = pickle.load(component_info_file)
     return ComponentInfoProviderCore(interfaces_info, component_info)
 
 
 def create_component_info_provider_modules(info_dir):
     interfaces_info = load_interfaces_info_overall_pickle(info_dir)
-    with open(
-            os.path.join(info_dir, 'core',
-                         'component_info_core.pickle')) as component_info_file:
+    with open(os.path.join(info_dir, 'core', 'component_info_core.pickle'),
+              mode='rb') as component_info_file:
         component_info_core = pickle.load(component_info_file)
-    with open(
-            os.path.join(
-                info_dir, 'modules',
-                'component_info_modules.pickle')) as component_info_file:
+    with open(os.path.join(info_dir, 'modules',
+                           'component_info_modules.pickle'),
+              mode='rb') as component_info_file:
         component_info_modules = pickle.load(component_info_file)
     return ComponentInfoProviderModules(interfaces_info, component_info_core,
                                         component_info_modules)
@@ -356,7 +354,7 @@ def write_pickle_file(pickle_filename, data):
     pickle_filename = abs(pickle_filename)
     # If |data| is same with the file content, we skip updating.
     if os.path.isfile(pickle_filename):
-        with open(pickle_filename) as pickle_file:
+        with open(pickle_filename, 'rb') as pickle_file:
             try:
                 if pickle.load(pickle_file) == data:
                     return
diff --git a/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/v8_interface.py b/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/v8_interface.py
index a432604..a85b03a 100644
--- a/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/v8_interface.py
+++ b/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/v8_interface.py
@@ -189,7 +189,7 @@ def context_enabled_features(attributes):
         return sorted([
             member for member in members
             if member.get(KEY) and not member.get('exposed_test')
-        ])
+        ], key=lambda item: item['name'])
 
     def member_filter_by_name(members, name):
         return [member for member in members if member[KEY] == name]
@@ -612,7 +612,8 @@ def interface_context(interface, interfaces, component_info):
         sorted(
             origin_trial_features(interface, context['constants'],
                                   context['attributes'], context['methods']) +
-            context_enabled_features(context['attributes'])),
+            context_enabled_features(context['attributes']),
+            key=lambda item: item['name']),
     })
     if context['optional_features']:
         includes.add('platform/bindings/v8_per_context_data.h')
@@ -1356,9 +1357,9 @@ def resolution_tests_methods(effective_overloads):
 
     # Extract argument and IDL type to simplify accessing these in each loop.
     arguments = [method['arguments'][index] for method in methods]
-    arguments_methods = zip(arguments, methods)
+    arguments_methods = list(zip(arguments, methods))
     idl_types = [argument['idl_type_object'] for argument in arguments]
-    idl_types_methods = zip(idl_types, methods)
+    idl_types_methods = list(zip(idl_types, methods))
 
     # We can’t do a single loop through all methods or simply sort them, because
     # a method may be listed in multiple steps of the resolution algorithm, and
diff --git a/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/v8_methods.py b/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/v8_methods.py
index 5f1f89a..6ee8a40 100644
--- a/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/v8_methods.py
+++ b/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/v8_methods.py
@@ -46,6 +46,10 @@ import v8_types
 import v8_utilities
 from v8_utilities import (has_extended_attribute_value, is_unforgeable)
 
+# TODO: Remove this once Python2 is obsoleted.
+if sys.version_info.major != 2:
+    basestring = str
+
 
 def method_is_visible(method, interface_is_partial):
     if 'overloads' in method:
diff --git a/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/v8_utilities.py b/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/v8_utilities.py
index 2ecd692..fcfc483 100644
--- a/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/v8_utilities.py
+++ b/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/v8_utilities.py
@@ -271,7 +271,7 @@ EXPOSED_WORKERS = set([
 ])
 
 
-class ExposureSet:
+class ExposureSet(object):
     """An ExposureSet is a collection of Exposure instructions."""
 
     def __init__(self, exposures=None):
diff --git a/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/bindings/templates/dictionary_v8.cc.tmpl b/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/bindings/templates/dictionary_v8.cc.tmpl
index 0add9c4..dc910f6 100644
--- a/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/bindings/templates/dictionary_v8.cc.tmpl
+++ b/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/bindings/templates/dictionary_v8.cc.tmpl
@@ -59,9 +59,9 @@ void {{v8_class}}::ToImpl(v8::Isolate* isolate, v8::Local<v8::Value> v8_value, {
   DCHECK(executionContext);
   {% endif %}{# has_origin_trial_members #}
   {% endif %}{# members #}
-  {% for origin_trial_test, origin_trial_member_list in members | groupby('origin_trial_feature_name') %}
+  {% for origin_trial_test, origin_trial_member_list in members | stringifykeygroupby('origin_trial_feature_name') %}
   {% filter origin_trial_enabled(origin_trial_test, "executionContext") %}
-  {% for feature_name, member_list in origin_trial_member_list | groupby('runtime_enabled_feature_name') %}
+  {% for feature_name, member_list in origin_trial_member_list | stringifykeygroupby('runtime_enabled_feature_name') %}
   {% filter runtime_enabled(feature_name) %}
   {% for member in member_list %}
   v8::Local<v8::Value> {{member.v8_value}};
@@ -147,9 +147,9 @@ bool toV8{{cpp_class}}(const {{cpp_class}}* impl, v8::Local<v8::Object> dictiona
   DCHECK(executionContext);
   {% endif %}{# has_origin_trial_members #}
   {% endif %}{# members #}
-  {% for origin_trial_test, origin_trial_member_list in members | groupby('origin_trial_feature_name') %}
+  {% for origin_trial_test, origin_trial_member_list in members | stringifykeygroupby('origin_trial_feature_name') %}
   {% filter origin_trial_enabled(origin_trial_test, "executionContext") %}
-  {% for feature_name, member_list in origin_trial_member_list | groupby('runtime_enabled_feature_name') %}
+  {% for feature_name, member_list in origin_trial_member_list | stringifykeygroupby('runtime_enabled_feature_name') %}
   {% filter runtime_enabled(feature_name) %}
   {% for member in member_list %}
   v8::Local<v8::Value> {{member.v8_value}};
diff --git a/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/build/scripts/core/css/properties/make_css_property_instances.py b/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/build/scripts/core/css/properties/make_css_property_instances.py
index 75030ac..f72aade 100755
--- a/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/build/scripts/core/css/properties/make_css_property_instances.py
+++ b/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/build/scripts/core/css/properties/make_css_property_instances.py
@@ -42,8 +42,8 @@ class CSSPropertyInstancesWriter(json5_generator.Writer):
         aliases = self._css_properties.aliases
 
         # Lists of PropertyClassData.
-        self._property_classes_by_id = map(self.get_class, properties)
-        self._alias_classes_by_id = map(self.get_class, aliases)
+        self._property_classes_by_id = list(map(self.get_class, properties))
+        self._alias_classes_by_id = list(map(self.get_class, aliases))
 
         # Sort by enum value.
         self._property_classes_by_id.sort(key=lambda t: t.enum_value)
diff --git a/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/build/scripts/core/css/make_style_shorthands.py b/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/build/scripts/core/css/make_style_shorthands.py
index 1799cd5..5f43ffa 100755
--- a/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/build/scripts/core/css/make_style_shorthands.py
+++ b/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/build/scripts/core/css/make_style_shorthands.py
@@ -71,7 +71,7 @@ class Expansion(object):
     def enabled_longhands(self):
         include = lambda longhand: not longhand[
             'runtime_flag'] or self.is_enabled(longhand['runtime_flag'])
-        return filter(include, self._longhands)
+        return list(filter(include, self._longhands))
 
     @property
     def index(self):
@@ -87,8 +87,9 @@ class Expansion(object):
 
 def create_expansions(longhands):
     flags = collect_runtime_flags(longhands)
-    expansions = map(lambda mask: Expansion(longhands, flags, mask),
-                     range(1 << len(flags)))
+    expansions = list(
+        map(lambda mask: Expansion(longhands, flags, mask),
+            range(1 << len(flags))))
     assert len(expansions) > 0
     # We generate 2^N expansions for N flags, so enforce some limit.
     assert len(flags) <= 4, 'Too many runtime flags for a single shorthand'
@@ -114,14 +115,14 @@ class StylePropertyShorthandWriter(json5_generator.Writer):
 
         self._longhand_dictionary = defaultdict(list)
         for property_ in json5_properties.shorthands:
-            property_['longhand_enum_keys'] = map(enum_key_for_css_property,
-                                                  property_['longhands'])
-            property_['longhand_property_ids'] = map(id_for_css_property,
-                                                     property_['longhands'])
-
-            longhands = map(
-                lambda name: json5_properties.properties_by_name[name],
-                property_['longhands'])
+            property_['longhand_enum_keys'] = list(
+                map(enum_key_for_css_property, property_['longhands']))
+            property_['longhand_property_ids'] = list(
+                map(id_for_css_property, property_['longhands']))
+
+            longhands = list(
+                map(lambda name: json5_properties.properties_by_name[name],
+                    property_['longhands']))
             property_['expansions'] = create_expansions(longhands)
             for longhand_enum_key in property_['longhand_enum_keys']:
                 self._longhand_dictionary[longhand_enum_key].append(property_)
diff --git a/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/build/scripts/gperf.py b/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/build/scripts/gperf.py
index 5ee4905..db72660 100644
--- a/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/build/scripts/gperf.py
+++ b/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/build/scripts/gperf.py
@@ -95,7 +95,7 @@ def main():
 
     open(args.output_file, 'wb').write(
         generate_gperf(gperf_path,
-                       open(infile).read(), gperf_args))
+                       open(infile).read(), gperf_args).encode('utf-8'))
 
 
 if __name__ == '__main__':
diff --git a/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/build/scripts/in_file.py b/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/build/scripts/in_file.py
index 28adc05..5811348 100644
--- a/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/build/scripts/in_file.py
+++ b/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/build/scripts/in_file.py
@@ -66,7 +66,7 @@ class InFile(object):
         self._defaults = defaults
         self._valid_values = copy.deepcopy(
             valid_values if valid_values else {})
-        self._parse(map(str.strip, lines))
+        self._parse(list(map(str.strip, lines)))
 
     @classmethod
     def load_from_files(self, file_paths, defaults, valid_values,
diff --git a/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/build/scripts/in_generator.py b/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/build/scripts/in_generator.py
index e46740a..ab1981a 100644
--- a/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/build/scripts/in_generator.py
+++ b/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/build/scripts/in_generator.py
@@ -32,10 +32,15 @@ import os
 import os.path
 import shlex
 import shutil
+import sys
 import optparse
 
 from in_file import InFile
 
+# TODO: Remove this once Python2 is obsoleted.
+if sys.version_info.major != 2:
+    basestring = str
+
 
 #########################################################
 # This is now deprecated - use json5_generator.py instead
diff --git a/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/build/scripts/make_runtime_features.py b/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/build/scripts/make_runtime_features.py
index cafe8d9..6925a4f 100755
--- a/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/build/scripts/make_runtime_features.py
+++ b/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/build/scripts/make_runtime_features.py
@@ -138,7 +138,7 @@ class RuntimeFeatureWriter(BaseRuntimeFeatureWriter):
                 except Exception:
                     # If trouble unpickling, overwrite
                     pass
-        with open(os.path.abspath(file_name), 'w') as pickle_file:
+        with open(os.path.abspath(file_name), 'wb') as pickle_file:
             pickle.dump(features_map, pickle_file)
 
     def _template_inputs(self):
diff --git a/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/build/scripts/templates/element_type_helpers.h.tmpl b/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/build/scripts/templates/element_type_helpers.h.tmpl
index 1b5297d..edecc81 100644
--- a/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/build/scripts/templates/element_type_helpers.h.tmpl
+++ b/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/build/scripts/templates/element_type_helpers.h.tmpl
@@ -15,7 +15,7 @@ namespace blink {
 class Document;
 
 // Type checking.
-{% for tag in tags|sort if not tag.multipleTagNames and not tag.noTypeHelpers %}
+{% for tag in tags|sort(attribute='name') if not tag.multipleTagNames and not tag.noTypeHelpers %}
 class {{tag.interface}};
 template <>
 inline bool IsElementOfType<const {{tag.interface}}>(const Node& node) {
diff --git a/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/build/scripts/templates/macros.tmpl b/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/build/scripts/templates/macros.tmpl
index 0244433..dcdbb02 100644
--- a/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/build/scripts/templates/macros.tmpl
+++ b/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/build/scripts/templates/macros.tmpl
@@ -25,7 +25,7 @@
 
 
 {% macro trie_leaf(index, object, return_macro, lowercase_data) %}
-{% set name, value = object.items()[0] %}
+{% set name, value = (object.items()|list)[0] %}
 {% if name|length %}
 if (
     {%- for c in name -%}
@@ -45,7 +45,7 @@ return {{ return_macro(value) }};
 
 
 {% macro trie_switch(trie, index, return_macro, lowercase_data) %}
-{% if trie|length == 1 and trie.values()[0] is string %}
+{% if trie|length == 1 and (trie.values()|list)[0] is string %}
 {{ trie_leaf(index, trie, return_macro, lowercase_data) -}}
 {% else %}
     {% if lowercase_data %}
diff --git a/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/build/scripts/templates/make_qualified_names.h.tmpl b/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/build/scripts/templates/make_qualified_names.h.tmpl
index cb05c6c..bd5566b 100644
--- a/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/build/scripts/templates/make_qualified_names.h.tmpl
+++ b/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/build/scripts/templates/make_qualified_names.h.tmpl
@@ -24,12 +24,12 @@ namespace {{cpp_namespace}} {
 {{symbol_export}}extern const WTF::AtomicString& {{namespace_prefix}}NamespaceURI;
 
 // Tags
-{% for tag in tags|sort %}
+{% for tag in tags|sort(attribute='name') %}
 {{symbol_export}}extern const blink::{{namespace}}QualifiedName& {{tag|symbol}}Tag;
 {% endfor %}
 
 // Attributes
-{% for attr in attrs|sort %}
+{% for attr in attrs|sort(attribute='name') %}
 {{symbol_export}}extern const blink::QualifiedName& {{attr|symbol}}Attr;
 {% endfor %}
 
diff --git a/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/build/scripts/templates/element_factory.cc.tmpl b/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/build/scripts/templates/element_factory.cc.tmpl
index dc3f44c..3eefcf9 100644
--- a/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/build/scripts/templates/element_factory.cc.tmpl
+++ b/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/build/scripts/templates/element_factory.cc.tmpl
@@ -26,7 +26,7 @@ using {{namespace}}FunctionMap = HashMap<AtomicString, {{namespace}}ConstructorF
 
 static {{namespace}}FunctionMap* g_{{namespace|lower}}_constructors = nullptr;
 
-{% for tag in tags|sort if not tag.noConstructor %}
+{% for tag in tags|sort(attribute='name') if not tag.noConstructor %}
 static {{namespace}}Element* {{namespace}}{{tag.name.to_upper_camel_case()}}Constructor(
     Document& document, const CreateElementFlags flags) {
   {% if tag.runtimeEnabled %}
@@ -52,7 +52,7 @@ static void Create{{namespace}}FunctionMap() {
   // Empty array initializer lists are illegal [dcl.init.aggr] and will not
   // compile in MSVC. If tags list is empty, add check to skip this.
   static const Create{{namespace}}FunctionMapData data[] = {
-  {% for tag in tags|sort if not tag.noConstructor %}
+  {% for tag in tags|sort(attribute='name') if not tag.noConstructor %}
     { {{cpp_namespace}}::{{tag|symbol}}Tag, {{namespace}}{{tag.name.to_upper_camel_case()}}Constructor },
   {% endfor %}
   };
diff --git a/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/build/scripts/templates/element_type_helpers.cc.tmpl b/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/build/scripts/templates/element_type_helpers.cc.tmpl
index 9bfc489..5f86184 100644
--- a/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/build/scripts/templates/element_type_helpers.cc.tmpl
+++ b/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/build/scripts/templates/element_type_helpers.cc.tmpl
@@ -22,7 +22,7 @@ HTMLTypeMap CreateHTMLTypeMap() {
     const char* name;
     HTMLElementType type;
   } kTags[] = {
-    {% for tag in tags|sort %}
+    {% for tag in tags|sort(attribute='name') %}
     { "{{tag.name}}", HTMLElementType::k{{tag.js_interface}} },
     {% endfor %}
   };
@@ -42,7 +42,7 @@ HTMLElementType htmlElementTypeForTag(const AtomicString& tagName, const Documen
   if (it == html_type_map.end())
     return HTMLElementType::kHTMLUnknownElement;
 
-  {% for tag in tags|sort %}
+  {% for tag in tags|sort(attribute='name') %}
   {% if tag.runtimeEnabled %}
   if (tagName == "{{tag.name}}") {
     if (!RuntimeEnabledFeatures::{{tag.runtimeEnabled}}Enabled(document->GetExecutionContext())) {
diff --git a/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/platform/text/text_break_iterator.cc b/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/platform/text/text_break_iterator.cc
index e34b073..c0f9268 100644
--- a/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/platform/text/text_break_iterator.cc
+++ b/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/platform/text/text_break_iterator.cc
@@ -162,7 +162,9 @@ static const unsigned char kAsciiLineBreakTable[][(kAsciiLineBreakTableLastChar
 };
 // clang-format on
 
-#if U_ICU_VERSION_MAJOR_NUM >= 58
+#if U_ICU_VERSION_MAJOR_NUM >= 74
+#define BA_LB_COUNT (U_LB_COUNT - 8)
+#elif U_ICU_VERSION_MAJOR_NUM >= 58
 #define BA_LB_COUNT (U_LB_COUNT - 3)
 #else
 #define BA_LB_COUNT U_LB_COUNT
diff --git a/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/platform/wtf/hash_table.h b/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/platform/wtf/hash_table.h
index e222dca..942ce39 100644
--- a/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/platform/wtf/hash_table.h
+++ b/qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/platform/wtf/hash_table.h
@@ -1786,7 +1786,7 @@ HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits, Allocator>::
     }
   }
   table_ = temporary_table;
-  Allocator::template BackingWriteBarrier(&table_);
+  Allocator::template BackingWriteBarrier<>(&table_);
 
   if (Traits::kEmptyValueIsZero) {
     memset(original_table, 0, new_table_size * sizeof(ValueType));
@@ -1844,7 +1844,7 @@ HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits, Allocator>::
   // This swaps the newly allocated buffer with the current one. The store to
   // the current table has to be atomic to prevent races with concurrent marker.
   AsAtomicPtr(&table_)->store(new_hash_table.table_, std::memory_order_relaxed);
-  Allocator::template BackingWriteBarrier(&table_);
+  Allocator::template BackingWriteBarrier<>(&table_);
   table_size_ = new_table_size;
 
   new_hash_table.table_ = old_table;
@@ -2012,8 +2012,8 @@ void HashTable<Key,
   // on the mutator thread, which is also the only one that writes to them, so
   // there is *no* risk of data races when reading.
   AtomicWriteSwap(table_, other.table_);
-  Allocator::template BackingWriteBarrier(&table_);
-  Allocator::template BackingWriteBarrier(&other.table_);
+  Allocator::template BackingWriteBarrier<>(&table_);
+  Allocator::template BackingWriteBarrier<>(&other.table_);
   if (IsWeak<ValueType>::value) {
     // Weak processing is omitted when no backing store is present. In case such
     // an empty table is later on used it needs to be strongified.
diff --git a/qtwebengine/src/3rdparty/chromium/third_party/breakpad/BUILD.gn b/qtwebengine/src/3rdparty/chromium/third_party/breakpad/BUILD.gn
index b5452e1..4c7b53f 100644
--- a/qtwebengine/src/3rdparty/chromium/third_party/breakpad/BUILD.gn
+++ b/qtwebengine/src/3rdparty/chromium/third_party/breakpad/BUILD.gn
@@ -655,6 +655,12 @@ if (is_linux || is_chromeos || is_android) {
       "breakpad/src/client",
       "breakpad/src/third_party/linux/include",
     ]
+
+    if (is_linux) {
+      # Assume glibc.
+      defines = [ "HAVE_GETCONTEXT" ]
+      sources -= [ "breakpad/src/common/linux/breakpad_getcontext.S" ]
+    }
   }
 
   static_library("processor_support") {
diff --git a/qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad/client/crashpad_info_note.S b/qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad/client/crashpad_info_note.S
index b13d864..8f28916 100644
--- a/qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad/client/crashpad_info_note.S
+++ b/qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad/client/crashpad_info_note.S
@@ -42,7 +42,12 @@ name_end:
   .balign NOTE_ALIGN
 desc:
 #if defined(__LP64__)
+#if defined(__mips__)
+  .quad CRASHPAD_INFO_SYMBOL
+#else
   .quad CRASHPAD_INFO_SYMBOL - desc
+#endif
+
 #else
   .long CRASHPAD_INFO_SYMBOL - desc
 #endif  // __LP64__
diff --git a/qtwebengine/src/3rdparty/chromium/third_party/dawn/generator/generator_lib.py b/qtwebengine/src/3rdparty/chromium/third_party/dawn/generator/generator_lib.py
index 5e3734d..e3d46bd 100644
--- a/qtwebengine/src/3rdparty/chromium/third_party/dawn/generator/generator_lib.py
+++ b/qtwebengine/src/3rdparty/chromium/third_party/dawn/generator/generator_lib.py
@@ -201,6 +201,10 @@ def _compute_python_dependencies(root_dir=None):
 
     paths = set()
     for path in module_paths:
+        # Builtin/namespaced modules may return None for the file path.
+        if not path:
+            continue
+
         path = os.path.abspath(path)
 
         if not path.startswith(root_dir):
diff --git a/qtwebengine/src/3rdparty/chromium/third_party/devtools-frontend/src/scripts/build/generate_devtools_grd.py b/qtwebengine/src/3rdparty/chromium/third_party/devtools-frontend/src/scripts/build/generate_devtools_grd.py
index be510c4..c6a59c9 100644
--- a/qtwebengine/src/3rdparty/chromium/third_party/devtools-frontend/src/scripts/build/generate_devtools_grd.py
+++ b/qtwebengine/src/3rdparty/chromium/third_party/devtools-frontend/src/scripts/build/generate_devtools_grd.py
@@ -123,7 +123,7 @@ def main(argv):
 
     try:
         os.makedirs(path.join(output_directory, 'Images'))
-    except OSError, e:
+    except OSError as e:
         if e.errno != errno.EEXIST:
             raise e
 
@@ -147,7 +147,7 @@ def main(argv):
             shutil.copy(path.join(dirname, filename), path.join(output_directory, 'Images'))
             add_file_to_grd(doc, path.join('Images', filename))
 
-    with open(parsed_args.output_filename, 'w') as output_file:
+    with open(parsed_args.output_filename, 'wb') as output_file:
         output_file.write(doc.toxml(encoding='UTF-8'))
 
 
diff --git a/qtwebengine/src/3rdparty/chromium/third_party/devtools-frontend/src/scripts/build/build_inspector_overlay.py b/qtwebengine/src/3rdparty/chromium/third_party/devtools-frontend/src/scripts/build/build_inspector_overlay.py
index d6666e8..0f7a661 100644
--- a/qtwebengine/src/3rdparty/chromium/third_party/devtools-frontend/src/scripts/build/build_inspector_overlay.py
+++ b/qtwebengine/src/3rdparty/chromium/third_party/devtools-frontend/src/scripts/build/build_inspector_overlay.py
@@ -45,7 +45,8 @@ def rollup(input_path, output_path, filename, max_size, rollup_plugin):
         ['--format', 'iife', '-n', 'InspectorOverlay'] + ['--input', target] +
         ['--plugin', rollup_plugin],
         stdout=subprocess.PIPE,
-        stderr=subprocess.PIPE)
+        stderr=subprocess.PIPE,
+        text=True)
     out, error = rollup_process.communicate()
     if not out:
         raise Exception("rollup failed: " + error)
diff --git a/qtwebengine/src/3rdparty/chromium/third_party/devtools-frontend/src/scripts/build/build_release_applications.py b/qtwebengine/src/3rdparty/chromium/third_party/devtools-frontend/src/scripts/build/build_release_applications.py
index fa8e73d..7d0b84b 100644
--- a/qtwebengine/src/3rdparty/chromium/third_party/devtools-frontend/src/scripts/build/build_release_applications.py
+++ b/qtwebengine/src/3rdparty/chromium/third_party/devtools-frontend/src/scripts/build/build_release_applications.py
@@ -10,7 +10,7 @@ Builds applications in release mode:
 and the application loader into a single script.
 """
 
-from cStringIO import StringIO
+from io import StringIO
 from os import path
 from os.path import join
 import copy
@@ -145,8 +145,7 @@ class ReleaseBuilder(object):
             resource_content = read_file(path.join(self.application_dir, resource_name))
             if not (resource_name.endswith('.html')
                     or resource_name.endswith('md')):
-                resource_content += resource_source_url(resource_name).encode(
-                    'utf-8')
+                resource_content += resource_source_url(resource_name)
             resource_content = resource_content.replace('\\', '\\\\')
             resource_content = resource_content.replace('\n', '\\n')
             resource_content = resource_content.replace('"', '\\"')
@@ -173,7 +172,9 @@ class ReleaseBuilder(object):
     def _concatenate_application_script(self, output):
         output.write('Root.allDescriptors.push(...%s);' % self._release_module_descriptors())
         if self.descriptors.extends:
-            output.write('Root.applicationDescriptor.modules.push(...%s);' % json.dumps(self.descriptors.application.values()))
+            output.write(
+                'Root.applicationDescriptor.modules.push(...%s);' %
+                json.dumps(list(self.descriptors.application.values())))
         else:
             output.write('Root.applicationDescriptor = %s;' % self.descriptors.application_json())
 
diff --git a/qtwebengine/src/3rdparty/chromium/third_party/devtools-frontend/src/scripts/build/modular_build.py b/qtwebengine/src/3rdparty/chromium/third_party/devtools-frontend/src/scripts/build/modular_build.py
index 0ba695d..bb1da2f 100644
--- a/qtwebengine/src/3rdparty/chromium/third_party/devtools-frontend/src/scripts/build/modular_build.py
+++ b/qtwebengine/src/3rdparty/chromium/third_party/devtools-frontend/src/scripts/build/modular_build.py
@@ -7,6 +7,8 @@
 Utilities for the modular DevTools build.
 """
 
+from __future__ import print_function
+
 import collections
 from os import path
 import os
@@ -40,7 +42,7 @@ def load_and_parse_json(filename):
     try:
         return json.loads(read_file(filename))
     except:
-        print 'ERROR: Failed to parse %s' % filename
+        print('ERROR: Failed to parse %s' % filename)
         raise
 
 class Descriptors:
@@ -57,7 +59,7 @@ class Descriptors:
 
     def application_json(self):
         result = dict()
-        result['modules'] = self.application.values()
+        result['modules'] = list(self.application.values())
         return json.dumps(result)
 
     def all_compiled_files(self):
diff --git a/qtwebengine/src/3rdparty/chromium/third_party/devtools-frontend/src/BUILD.gn b/qtwebengine/src/3rdparty/chromium/third_party/devtools-frontend/src/BUILD.gn
index cd488e8..ea1dc3d 100644
--- a/qtwebengine/src/3rdparty/chromium/third_party/devtools-frontend/src/BUILD.gn
+++ b/qtwebengine/src/3rdparty/chromium/third_party/devtools-frontend/src/BUILD.gn
@@ -2,6 +2,8 @@
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
+import("//build/config/python.gni")
+
 import("//third_party/blink/public/public_features.gni")
 import("./all_devtools_files.gni")
 import("./all_devtools_modules.gni")
diff --git a/qtwebengine/src/3rdparty/chromium/third_party/ffmpeg/chromium/config/Chrome/linux/arm/config.h b/qtwebengine/src/3rdparty/chromium/third_party/ffmpeg/chromium/config/Chrome/linux/arm/config.h
index 6071f43..d341f3d 100644
--- a/qtwebengine/src/3rdparty/chromium/third_party/ffmpeg/chromium/config/Chrome/linux/arm/config.h
+++ b/qtwebengine/src/3rdparty/chromium/third_party/ffmpeg/chromium/config/Chrome/linux/arm/config.h
@@ -593,7 +593,7 @@
 #define CONFIG_NEON_CLOBBER_TEST 0
 #define CONFIG_OSSFUZZ 0
 #define CONFIG_PIC 1
-#define CONFIG_THUMB 1
+#define CONFIG_THUMB 0
 #define CONFIG_VALGRIND_BACKTRACE 0
 #define CONFIG_XMM_CLOBBER_TEST 0
 #define CONFIG_BSFS 1
diff --git a/qtwebengine/src/3rdparty/chromium/third_party/ffmpeg/libavcodec/x86/mathops.h b/qtwebengine/src/3rdparty/chromium/third_party/ffmpeg/libavcodec/x86/mathops.h
index 6298f5e..ca7e2df 100644
--- a/qtwebengine/src/3rdparty/chromium/third_party/ffmpeg/libavcodec/x86/mathops.h
+++ b/qtwebengine/src/3rdparty/chromium/third_party/ffmpeg/libavcodec/x86/mathops.h
@@ -35,12 +35,20 @@
 static av_always_inline av_const int MULL(int a, int b, unsigned shift)
 {
     int rt, dummy;
+    if (__builtin_constant_p(shift))
     __asm__ (
         "imull %3               \n\t"
         "shrdl %4, %%edx, %%eax \n\t"
         :"=a"(rt), "=d"(dummy)
-        :"a"(a), "rm"(b), "ci"((uint8_t)shift)
+        :"a"(a), "rm"(b), "i"(shift & 0x1F)
     );
+    else
+        __asm__ (
+            "imull %3               \n\t"
+            "shrdl %4, %%edx, %%eax \n\t"
+            :"=a"(rt), "=d"(dummy)
+            :"a"(a), "rm"(b), "c"((uint8_t)shift)
+        );
     return rt;
 }
 
@@ -113,19 +121,31 @@ __asm__ volatile(\
 // avoid +32 for shift optimization (gcc should do that ...)
 #define NEG_SSR32 NEG_SSR32
 static inline  int32_t NEG_SSR32( int32_t a, int8_t s){
+    if (__builtin_constant_p(s))
     __asm__ ("sarl %1, %0\n\t"
          : "+r" (a)
-         : "ic" ((uint8_t)(-s))
+         : "i" (-s & 0x1F)
     );
+    else
+        __asm__ ("sarl %1, %0\n\t"
+               : "+r" (a)
+               : "c" ((uint8_t)(-s))
+        );
     return a;
 }
 
 #define NEG_USR32 NEG_USR32
 static inline uint32_t NEG_USR32(uint32_t a, int8_t s){
+    if (__builtin_constant_p(s))
     __asm__ ("shrl %1, %0\n\t"
          : "+r" (a)
-         : "ic" ((uint8_t)(-s))
+         : "i" (-s & 0x1F)
     );
+    else
+        __asm__ ("shrl %1, %0\n\t"
+               : "+r" (a)
+               : "c" ((uint8_t)(-s))
+        );
     return a;
 }
 
diff --git a/qtwebengine/src/3rdparty/chromium/third_party/jinja2/tests.py b/qtwebengine/src/3rdparty/chromium/third_party/jinja2/tests.py
index 0adc3d4..b14f85f 100644
--- a/qtwebengine/src/3rdparty/chromium/third_party/jinja2/tests.py
+++ b/qtwebengine/src/3rdparty/chromium/third_party/jinja2/tests.py
@@ -10,7 +10,7 @@
 """
 import operator
 import re
-from collections import Mapping
+from collections.abc import Mapping
 from jinja2.runtime import Undefined
 from jinja2._compat import text_type, string_types, integer_types
 import decimal
diff --git a/qtwebengine/src/3rdparty/chromium/third_party/lss/linux_syscall_support.h b/qtwebengine/src/3rdparty/chromium/third_party/lss/linux_syscall_support.h
index e4ac226..e67df41 100644
--- a/qtwebengine/src/3rdparty/chromium/third_party/lss/linux_syscall_support.h
+++ b/qtwebengine/src/3rdparty/chromium/third_party/lss/linux_syscall_support.h
@@ -1440,8 +1440,8 @@ struct kernel_statfs {
 #ifndef __NR_ioprio_get
 #define __NR_ioprio_get         (__NR_Linux + 274)
 #endif
-#ifndef __NT_getrandom
-#define                         (__NR_Linux + 313)
+#ifndef __NR_getrandom
+#define __NR_getrandom          (__NR_Linux + 313)
 #endif
 /* End of MIPS (64bit API) definitions */
 #else
diff --git a/qtwebengine/src/3rdparty/chromium/third_party/openscreen/src/third_party/chromium_quic/build/base/BUILD.gn b/qtwebengine/src/3rdparty/chromium/third_party/openscreen/src/third_party/chromium_quic/build/base/BUILD.gn
index 72d3975..e31270c 100644
--- a/qtwebengine/src/3rdparty/chromium/third_party/openscreen/src/third_party/chromium_quic/build/base/BUILD.gn
+++ b/qtwebengine/src/3rdparty/chromium/third_party/openscreen/src/third_party/chromium_quic/build/base/BUILD.gn
@@ -427,8 +427,6 @@ source_set("base") {
     "../../src/base/test/fuzzed_data_provider.cc",
     "../../src/base/test/fuzzed_data_provider.h",
     "../../src/base/third_party/dynamic_annotations/dynamic_annotations.h",
-    "../../src/base/third_party/icu/icu_utf.cc",
-    "../../src/base/third_party/icu/icu_utf.h",
     "../../src/base/third_party/nspr/prtime.cc",
     "../../src/base/third_party/nspr/prtime.h",
     "../../src/base/third_party/superfasthash/superfasthash.c",
diff --git a/qtwebengine/src/3rdparty/chromium/third_party/pdfium/third_party/BUILD.gn b/qtwebengine/src/3rdparty/chromium/third_party/pdfium/third_party/BUILD.gn
index 3c1189a..3b66dfa 100644
--- a/qtwebengine/src/3rdparty/chromium/third_party/pdfium/third_party/BUILD.gn
+++ b/qtwebengine/src/3rdparty/chromium/third_party/pdfium/third_party/BUILD.gn
@@ -239,58 +239,19 @@ if (!pdf_use_skia && !pdf_use_skia_paths) {
   }
 }
 
-config("fx_lcms2_warnings") {
-  visibility = [ ":*" ]
-  if (is_clang) {
-    cflags = [
-      # cmslut.cc is sloppy with aggregate initialization. Version 2.7 of this
-      # library doesn't appear to have this problem.
-      "-Wno-missing-braces",
-    ]
-  }
+import("//build/shim_headers.gni")
+
+shim_headers("lcms2_shim") {
+  root_path = "lcms/include"
+  headers = [
+    "lcms2.h",
+    "lcms2_plugin.h",
+  ]
 }
 
 source_set("fx_lcms2") {
-  configs -= [ "//build/config/compiler:chromium_code" ]
-  configs += [
-    "//build/config/compiler:no_chromium_code",
-    "//build/config/sanitizers:cfi_icall_generalize_pointers",
-    ":pdfium_third_party_config",
-
-    # Must be after no_chromium_code for warning flags to be ordered correctly.
-    ":fx_lcms2_warnings",
-  ]
-  sources = [
-    "lcms/include/lcms2.h",
-    "lcms/include/lcms2_plugin.h",
-    "lcms/src/cmsalpha.c",
-    "lcms/src/cmscam02.c",
-    "lcms/src/cmscgats.c",
-    "lcms/src/cmscnvrt.c",
-    "lcms/src/cmserr.c",
-    "lcms/src/cmsgamma.c",
-    "lcms/src/cmsgmt.c",
-    "lcms/src/cmshalf.c",
-    "lcms/src/cmsintrp.c",
-    "lcms/src/cmsio0.c",
-    "lcms/src/cmsio1.c",
-    "lcms/src/cmslut.c",
-    "lcms/src/cmsmd5.c",
-    "lcms/src/cmsmtrx.c",
-    "lcms/src/cmsnamed.c",
-    "lcms/src/cmsopt.c",
-    "lcms/src/cmspack.c",
-    "lcms/src/cmspcs.c",
-    "lcms/src/cmsplugin.c",
-    "lcms/src/cmsps2.c",
-    "lcms/src/cmssamp.c",
-    "lcms/src/cmssm.c",
-    "lcms/src/cmstypes.c",
-    "lcms/src/cmsvirt.c",
-    "lcms/src/cmswtpnt.c",
-    "lcms/src/cmsxform.c",
-  ]
-  deps = [ "../core/fxcrt" ]
+  deps = [ ":lcms2_shim" ]
+  libs = ["lcms2"]
 }
 
 if (!build_with_chromium) {
diff --git a/qtwebengine/src/3rdparty/chromium/third_party/perfetto/include/perfetto/tracing/internal/track_event_data_source.h b/qtwebengine/src/3rdparty/chromium/third_party/perfetto/include/perfetto/tracing/internal/track_event_data_source.h
index bbae795..5a6538f 100644
--- a/qtwebengine/src/3rdparty/chromium/third_party/perfetto/include/perfetto/tracing/internal/track_event_data_source.h
+++ b/qtwebengine/src/3rdparty/chromium/third_party/perfetto/include/perfetto/tracing/internal/track_event_data_source.h
@@ -107,7 +107,7 @@ class TrackEventDataSource
   }
 
   static void Flush() {
-    Base::template Trace([](typename Base::TraceContext ctx) { ctx.Flush(); });
+    Base::Trace([](typename Base::TraceContext ctx) { ctx.Flush(); });
   }
 
   // Determine if tracing for the given static category is enabled.
@@ -121,7 +121,7 @@ class TrackEventDataSource
   static bool IsDynamicCategoryEnabled(
       const DynamicCategory& dynamic_category) {
     bool enabled = false;
-    Base::template Trace([&](typename Base::TraceContext ctx) {
+    Base::Trace([&](typename Base::TraceContext ctx) {
       enabled = IsDynamicCategoryEnabled(&ctx, dynamic_category);
     });
     return enabled;
@@ -428,7 +428,7 @@ class TrackEventDataSource
                                  const protos::gen::TrackDescriptor& desc) {
     PERFETTO_DCHECK(track.uuid == desc.uuid());
     TrackRegistry::Get()->UpdateTrack(track, desc.SerializeAsString());
-    Base::template Trace([&](typename Base::TraceContext ctx) {
+    Base::Trace([&](typename Base::TraceContext ctx) {
       TrackEventInternal::WriteTrackDescriptor(
           track, ctx.tls_inst_->trace_writer.get());
     });
@@ -545,7 +545,7 @@ class TrackEventDataSource
   static void TraceWithInstances(uint32_t instances,
                                  Lambda lambda) PERFETTO_ALWAYS_INLINE {
     if (CategoryIndex == TrackEventCategoryRegistry::kDynamicCategoryIndex) {
-      Base::template TraceWithInstances(instances, std::move(lambda));
+      Base::TraceWithInstances(instances, std::move(lambda));
     } else {
       Base::template TraceWithInstances<
           CategoryTracePointTraits<CategoryIndex>>(instances,
@@ -560,7 +560,7 @@ class TrackEventDataSource
       const TrackType& track,
       std::function<void(protos::pbzero::TrackDescriptor*)> callback) {
     TrackRegistry::Get()->UpdateTrack(track, std::move(callback));
-    Base::template Trace([&](typename Base::TraceContext ctx) {
+    Base::Trace([&](typename Base::TraceContext ctx) {
       TrackEventInternal::WriteTrackDescriptor(
           track, ctx.tls_inst_->trace_writer.get());
     });
diff --git a/qtwebengine/src/3rdparty/chromium/third_party/protobuf/third_party/six/six.py b/qtwebengine/src/3rdparty/chromium/third_party/protobuf/third_party/six/six.py
index 89b2188..25c4a5c 100644
--- a/qtwebengine/src/3rdparty/chromium/third_party/protobuf/third_party/six/six.py
+++ b/qtwebengine/src/3rdparty/chromium/third_party/protobuf/third_party/six/six.py
@@ -71,6 +71,11 @@ else:
             MAXSIZE = int((1 << 63) - 1)
         del X
 
+if PY34:
+    from importlib.util import spec_from_loader
+else:
+    spec_from_loader = None
+
 
 def _add_doc(func, doc):
     """Add documentation to a function."""
@@ -186,6 +191,11 @@ class _SixMetaPathImporter(object):
             return self
         return None
 
+    def find_spec(self, fullname, path, target=None):
+        if fullname in self.known_modules:
+            return spec_from_loader(fullname, self)
+        return None
+
     def __get_module(self, fullname):
         try:
             return self.known_modules[fullname]
diff --git a/qtwebengine/src/3rdparty/chromium/third_party/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.cc b/qtwebengine/src/3rdparty/chromium/third_party/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.cc
index 2640e93..c302a08 100644
--- a/qtwebengine/src/3rdparty/chromium/third_party/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.cc
+++ b/qtwebengine/src/3rdparty/chromium/third_party/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.cc
@@ -14,8 +14,14 @@
 #include <glib-object.h>
 #include <spa/param/format-utils.h>
 #include <spa/param/props.h>
+#if !PW_CHECK_VERSION(0, 3, 0)
 #include <spa/param/video/raw-utils.h>
 #include <spa/support/type-map.h>
+#endif
+
+#include <sys/ioctl.h>
+#include <sys/mman.h>
+#include <sys/syscall.h>
 
 #include <memory>
 #include <utility>
@@ -30,7 +36,11 @@
 #include "modules/desktop_capture/linux/pipewire_stubs.h"
 
 using modules_desktop_capture_linux::InitializeStubs;
-using modules_desktop_capture_linux::kModulePipewire;
+#if PW_CHECK_VERSION(0, 3, 0)
+using modules_desktop_capture_linux::kModulePipewire03;
+#else
+using modules_desktop_capture_linux::kModulePipewire02;
+#endif
 using modules_desktop_capture_linux::StubPathMap;
 #endif  // defined(WEBRTC_DLOPEN_PIPEWIRE)
 
@@ -47,9 +57,156 @@ const char kScreenCastInterfaceName[] = "org.freedesktop.portal.ScreenCast";
 const int kBytesPerPixel = 4;
 
 #if defined(WEBRTC_DLOPEN_PIPEWIRE)
+#if PW_CHECK_VERSION(0, 3, 0)
+const char kPipeWireLib[] = "libpipewire-0.3.so.0";
+#else
 const char kPipeWireLib[] = "libpipewire-0.2.so.1";
 #endif
+#endif
 
+// static
+struct dma_buf_sync {
+  uint64_t flags;
+};
+#define DMA_BUF_SYNC_READ (1 << 0)
+#define DMA_BUF_SYNC_START (0 << 2)
+#define DMA_BUF_SYNC_END (1 << 2)
+#define DMA_BUF_BASE 'b'
+#define DMA_BUF_IOCTL_SYNC _IOW(DMA_BUF_BASE, 0, struct dma_buf_sync)
+
+static void SyncDmaBuf(int fd, uint64_t start_or_end) {
+  struct dma_buf_sync sync = {0};
+
+  sync.flags = start_or_end | DMA_BUF_SYNC_READ;
+
+  while (true) {
+    int ret;
+    ret = ioctl(fd, DMA_BUF_IOCTL_SYNC, &sync);
+    if (ret == -1 && errno == EINTR) {
+      continue;
+    } else if (ret == -1) {
+      RTC_LOG(LS_ERROR) << "Failed to synchronize DMA buffer: "
+                        << g_strerror(errno);
+      break;
+    } else {
+      break;
+    }
+  }
+}
+
+class ScopedBuf {
+ public:
+  ScopedBuf() {}
+  ScopedBuf(unsigned char* map, int map_size, bool is_dma_buf, int fd)
+      : map_(map), map_size_(map_size), is_dma_buf_(is_dma_buf), fd_(fd) {}
+  ~ScopedBuf() {
+    if (map_ != MAP_FAILED) {
+      if (is_dma_buf_) {
+        SyncDmaBuf(fd_, DMA_BUF_SYNC_END);
+      }
+      munmap(map_, map_size_);
+    }
+  }
+
+  operator bool() { return map_ != MAP_FAILED; }
+
+  void initialize(unsigned char* map, int map_size, bool is_dma_buf, int fd) {
+    map_ = map;
+    map_size_ = map_size;
+    is_dma_buf_ = is_dma_buf;
+    fd_ = fd;
+  }
+
+  unsigned char* get() { return map_; }
+
+ protected:
+  unsigned char* map_ = nullptr;
+  int map_size_;
+  bool is_dma_buf_;
+  int fd_;
+};
+
+template <class T>
+class Scoped {
+ public:
+  Scoped() {}
+  explicit Scoped(T* val) { ptr_ = val; }
+  ~Scoped() { RTC_NOTREACHED(); }
+
+  T* operator->() { return ptr_; }
+
+  bool operator!() { return ptr_ == nullptr; }
+
+  T* get() { return ptr_; }
+
+  T** receive() {
+    RTC_CHECK(!ptr_);
+    return &ptr_;
+  }
+
+  Scoped& operator=(T* val) {
+    ptr_ = val;
+    return *this;
+  }
+
+ protected:
+  T* ptr_ = nullptr;
+};
+
+template <>
+Scoped<GError>::~Scoped() {
+  if (ptr_) {
+    g_error_free(ptr_);
+  }
+}
+
+template <>
+Scoped<gchar>::~Scoped() {
+  if (ptr_) {
+    g_free(ptr_);
+  }
+}
+
+template <>
+Scoped<GVariant>::~Scoped() {
+  if (ptr_) {
+    g_variant_unref(ptr_);
+  }
+}
+
+template <>
+Scoped<GVariantIter>::~Scoped() {
+  if (ptr_) {
+    g_variant_iter_free(ptr_);
+  }
+}
+
+template <>
+Scoped<GDBusMessage>::~Scoped() {
+  if (ptr_) {
+    g_object_unref(ptr_);
+  }
+}
+
+template <>
+Scoped<GUnixFDList>::~Scoped() {
+  if (ptr_) {
+    g_object_unref(ptr_);
+  }
+}
+
+#if PW_CHECK_VERSION(0, 3, 0)
+void BaseCapturerPipeWire::OnCoreError(void* data,
+                                       uint32_t id,
+                                       int seq,
+                                       int res,
+                                       const char* message) {
+  BaseCapturerPipeWire* that = static_cast<BaseCapturerPipeWire*>(data);
+  RTC_DCHECK(that);
+
+  RTC_LOG(LS_ERROR) << "PipeWire remote error: " << message;
+}
+#else
 // static
 void BaseCapturerPipeWire::OnStateChanged(void* data,
                                           pw_remote_state old_state,
@@ -64,7 +221,7 @@ void BaseCapturerPipeWire::OnStateChanged(void* data,
       break;
     case PW_REMOTE_STATE_CONNECTED:
       RTC_LOG(LS_INFO) << "PipeWire remote state: connected.";
-      that->CreateReceivingStream();
+      that->pw_stream_ = that->CreateReceivingStream();
       break;
     case PW_REMOTE_STATE_CONNECTING:
       RTC_LOG(LS_INFO) << "PipeWire remote state: connecting.";
@@ -74,6 +231,7 @@ void BaseCapturerPipeWire::OnStateChanged(void* data,
       break;
   }
 }
+#endif
 
 // static
 void BaseCapturerPipeWire::OnStreamStateChanged(void* data,
@@ -83,6 +241,18 @@ void BaseCapturerPipeWire::OnStreamStateChanged(void* data,
   BaseCapturerPipeWire* that = static_cast<BaseCapturerPipeWire*>(data);
   RTC_DCHECK(that);
 
+#if PW_CHECK_VERSION(0, 3, 0)
+  switch (state) {
+    case PW_STREAM_STATE_ERROR:
+      RTC_LOG(LS_ERROR) << "PipeWire stream state error: " << error_message;
+      break;
+    case PW_STREAM_STATE_PAUSED:
+    case PW_STREAM_STATE_STREAMING:
+    case PW_STREAM_STATE_UNCONNECTED:
+    case PW_STREAM_STATE_CONNECTING:
+      break;
+  }
+#else
   switch (state) {
     case PW_STREAM_STATE_ERROR:
       RTC_LOG(LS_ERROR) << "PipeWire stream state error: " << error_message;
@@ -97,36 +267,74 @@ void BaseCapturerPipeWire::OnStreamStateChanged(void* data,
     case PW_STREAM_STATE_STREAMING:
       break;
   }
+#endif
 }
 
 // static
+#if PW_CHECK_VERSION(0, 3, 0)
+void BaseCapturerPipeWire::OnStreamParamChanged(void* data,
+                                                uint32_t id,
+                                                const struct spa_pod* format) {
+#else
 void BaseCapturerPipeWire::OnStreamFormatChanged(void* data,
                                                  const struct spa_pod* format) {
+#endif
   BaseCapturerPipeWire* that = static_cast<BaseCapturerPipeWire*>(data);
   RTC_DCHECK(that);
 
   RTC_LOG(LS_INFO) << "PipeWire stream format changed.";
 
+#if PW_CHECK_VERSION(0, 3, 0)
+  if (!format || id != SPA_PARAM_Format) {
+#else
   if (!format) {
     pw_stream_finish_format(that->pw_stream_, /*res=*/0, /*params=*/nullptr,
                             /*n_params=*/0);
+#endif
     return;
   }
 
+#if PW_CHECK_VERSION(0, 3, 0)
+  spa_format_video_raw_parse(format, &that->spa_video_format_);
+#else
   that->spa_video_format_ = new spa_video_info_raw();
   spa_format_video_raw_parse(format, that->spa_video_format_,
                              &that->pw_type_->format_video);
+#endif
 
+#if PW_CHECK_VERSION(0, 3, 0)
+  auto width = that->spa_video_format_.size.width;
+  auto height = that->spa_video_format_.size.height;
+#else
   auto width = that->spa_video_format_->size.width;
   auto height = that->spa_video_format_->size.height;
+#endif
   auto stride = SPA_ROUND_UP_N(width * kBytesPerPixel, 4);
   auto size = height * stride;
 
+  that->desktop_size_ = DesktopSize(width, height);
+
   uint8_t buffer[1024] = {};
   auto builder = spa_pod_builder{buffer, sizeof(buffer)};
 
   // Setup buffers and meta header for new format.
-  const struct spa_pod* params[2];
+  const struct spa_pod* params[3];
+#if PW_CHECK_VERSION(0, 3, 0)
+  params[0] = reinterpret_cast<spa_pod*>(spa_pod_builder_add_object(
+      &builder, SPA_TYPE_OBJECT_ParamBuffers, SPA_PARAM_Buffers,
+      SPA_PARAM_BUFFERS_size, SPA_POD_Int(size), SPA_PARAM_BUFFERS_stride,
+      SPA_POD_Int(stride), SPA_PARAM_BUFFERS_buffers,
+      SPA_POD_CHOICE_RANGE_Int(8, 1, 32)));
+  params[1] = reinterpret_cast<spa_pod*>(spa_pod_builder_add_object(
+      &builder, SPA_TYPE_OBJECT_ParamMeta, SPA_PARAM_Meta, SPA_PARAM_META_type,
+      SPA_POD_Id(SPA_META_Header), SPA_PARAM_META_size,
+      SPA_POD_Int(sizeof(struct spa_meta_header))));
+  params[2] = reinterpret_cast<spa_pod*>(spa_pod_builder_add_object(
+      &builder, SPA_TYPE_OBJECT_ParamMeta, SPA_PARAM_Meta, SPA_PARAM_META_type,
+      SPA_POD_Id(SPA_META_VideoCrop), SPA_PARAM_META_size,
+      SPA_POD_Int(sizeof(struct spa_meta_region))));
+  pw_stream_update_params(that->pw_stream_, params, 3);
+#else
   params[0] = reinterpret_cast<spa_pod*>(spa_pod_builder_object(
       &builder,
       // id to enumerate buffer requirements
@@ -155,8 +363,18 @@ void BaseCapturerPipeWire::OnStreamFormatChanged(void* data,
       // Size: size of the metadata, specified as integer (i)
       ":", that->pw_core_type_->param_meta.size, "i",
       sizeof(struct spa_meta_header)));
-
-  pw_stream_finish_format(that->pw_stream_, /*res=*/0, params, /*n_params=*/2);
+  params[2] = reinterpret_cast<spa_pod*>(spa_pod_builder_object(
+      &builder,
+      // id to enumerate supported metadata
+      that->pw_core_type_->param.idMeta, that->pw_core_type_->param_meta.Meta,
+      // Type: specified as id or enum (I)
+      ":", that->pw_core_type_->param_meta.type, "I",
+      that->pw_core_type_->meta.VideoCrop,
+      // Size: size of the metadata, specified as integer (i)
+      ":", that->pw_core_type_->param_meta.size, "i",
+      sizeof(struct spa_meta_video_crop)));
+  pw_stream_finish_format(that->pw_stream_, /*res=*/0, params, /*n_params=*/3);
+#endif
 }
 
 // static
@@ -164,15 +382,26 @@ void BaseCapturerPipeWire::OnStreamProcess(void* data) {
   BaseCapturerPipeWire* that = static_cast<BaseCapturerPipeWire*>(data);
   RTC_DCHECK(that);
 
-  pw_buffer* buf = nullptr;
+  struct pw_buffer* next_buffer;
+  struct pw_buffer* buffer = nullptr;
+
+  next_buffer = pw_stream_dequeue_buffer(that->pw_stream_);
+  while (next_buffer) {
+    buffer = next_buffer;
+    next_buffer = pw_stream_dequeue_buffer(that->pw_stream_);
 
-  if (!(buf = pw_stream_dequeue_buffer(that->pw_stream_))) {
+    if (next_buffer) {
+      pw_stream_queue_buffer(that->pw_stream_, buffer);
+    }
+  }
+
+  if (!buffer) {
     return;
   }
 
-  that->HandleBuffer(buf);
+  that->HandleBuffer(buffer);
 
-  pw_stream_queue_buffer(that->pw_stream_, buf);
+  pw_stream_queue_buffer(that->pw_stream_, buffer);
 }
 
 BaseCapturerPipeWire::BaseCapturerPipeWire(CaptureSourceType source_type)
@@ -183,6 +412,7 @@ BaseCapturerPipeWire::~BaseCapturerPipeWire() {
     pw_thread_loop_stop(pw_main_loop_);
   }
 
+#if !PW_CHECK_VERSION(0, 3, 0)
   if (pw_type_) {
     delete pw_type_;
   }
@@ -190,30 +420,41 @@ BaseCapturerPipeWire::~BaseCapturerPipeWire() {
   if (spa_video_format_) {
     delete spa_video_format_;
   }
+#endif
 
   if (pw_stream_) {
     pw_stream_destroy(pw_stream_);
   }
 
+#if !PW_CHECK_VERSION(0, 3, 0)
   if (pw_remote_) {
     pw_remote_destroy(pw_remote_);
   }
+#endif
 
+#if PW_CHECK_VERSION(0, 3, 0)
+  if (pw_core_) {
+    pw_core_disconnect(pw_core_);
+  }
+
+  if (pw_context_) {
+    pw_context_destroy(pw_context_);
+  }
+#else
   if (pw_core_) {
     pw_core_destroy(pw_core_);
   }
+#endif
 
   if (pw_main_loop_) {
     pw_thread_loop_destroy(pw_main_loop_);
   }
 
+#if !PW_CHECK_VERSION(0, 3, 0)
   if (pw_loop_) {
     pw_loop_destroy(pw_loop_);
   }
-
-  if (current_frame_) {
-    free(current_frame_);
-  }
+#endif
 
   if (start_request_signal_id_) {
     g_dbus_connection_signal_unsubscribe(connection_, start_request_signal_id_);
@@ -228,18 +469,16 @@ BaseCapturerPipeWire::~BaseCapturerPipeWire() {
   }
 
   if (session_handle_) {
-    GDBusMessage* message = g_dbus_message_new_method_call(
-        kDesktopBusName, session_handle_, kSessionInterfaceName, "Close");
-    if (message) {
-      GError* error = nullptr;
-      g_dbus_connection_send_message(connection_, message,
+    Scoped<GDBusMessage> message(g_dbus_message_new_method_call(
+        kDesktopBusName, session_handle_, kSessionInterfaceName, "Close"));
+    if (message.get()) {
+      Scoped<GError> error;
+      g_dbus_connection_send_message(connection_, message.get(),
                                      G_DBUS_SEND_MESSAGE_FLAGS_NONE,
-                                     /*out_serial=*/nullptr, &error);
-      if (error) {
+                                     /*out_serial=*/nullptr, error.receive());
+      if (error.get()) {
         RTC_LOG(LS_ERROR) << "Failed to close the session: " << error->message;
-        g_error_free(error);
       }
-      g_object_unref(message);
     }
   }
 
@@ -274,7 +513,11 @@ void BaseCapturerPipeWire::InitPipeWire() {
   StubPathMap paths;
 
   // Check if the PipeWire library is available.
-  paths[kModulePipewire].push_back(kPipeWireLib);
+#if PW_CHECK_VERSION(0, 3, 0)
+  paths[kModulePipewire03].push_back(kPipeWireLib);
+#else
+  paths[kModulePipewire02].push_back(kPipeWireLib);
+#endif
   if (!InitializeStubs(paths)) {
     RTC_LOG(LS_ERROR) << "Failed to load the PipeWire library and symbols.";
     portal_init_failed_ = true;
@@ -284,16 +527,46 @@ void BaseCapturerPipeWire::InitPipeWire() {
 
   pw_init(/*argc=*/nullptr, /*argc=*/nullptr);
 
+#if PW_CHECK_VERSION(0, 3, 0)
+  pw_main_loop_ = pw_thread_loop_new("pipewire-main-loop", nullptr);
+
+  pw_thread_loop_lock(pw_main_loop_);
+
+  pw_context_ =
+      pw_context_new(pw_thread_loop_get_loop(pw_main_loop_), nullptr, 0);
+  if (!pw_context_) {
+    RTC_LOG(LS_ERROR) << "Failed to create PipeWire context";
+    return;
+  }
+
+  pw_core_ = pw_context_connect(pw_context_, nullptr, 0);
+  if (!pw_core_) {
+    RTC_LOG(LS_ERROR) << "Failed to connect PipeWire context";
+    return;
+  }
+#else
   pw_loop_ = pw_loop_new(/*properties=*/nullptr);
   pw_main_loop_ = pw_thread_loop_new(pw_loop_, "pipewire-main-loop");
 
+  pw_thread_loop_lock(pw_main_loop_);
+
   pw_core_ = pw_core_new(pw_loop_, /*properties=*/nullptr);
   pw_core_type_ = pw_core_get_type(pw_core_);
   pw_remote_ = pw_remote_new(pw_core_, nullptr, /*user_data_size=*/0);
 
   InitPipeWireTypes();
+#endif
 
   // Initialize event handlers, remote end and stream-related.
+#if PW_CHECK_VERSION(0, 3, 0)
+  pw_core_events_.version = PW_VERSION_CORE_EVENTS;
+  pw_core_events_.error = &OnCoreError;
+
+  pw_stream_events_.version = PW_VERSION_STREAM_EVENTS;
+  pw_stream_events_.state_changed = &OnStreamStateChanged;
+  pw_stream_events_.param_changed = &OnStreamParamChanged;
+  pw_stream_events_.process = &OnStreamProcess;
+#else
   pw_remote_events_.version = PW_VERSION_REMOTE_EVENTS;
   pw_remote_events_.state_changed = &OnStateChanged;
 
@@ -301,19 +574,33 @@ void BaseCapturerPipeWire::InitPipeWire() {
   pw_stream_events_.state_changed = &OnStreamStateChanged;
   pw_stream_events_.format_changed = &OnStreamFormatChanged;
   pw_stream_events_.process = &OnStreamProcess;
+#endif
 
+#if PW_CHECK_VERSION(0, 3, 0)
+  pw_core_add_listener(pw_core_, &spa_core_listener_, &pw_core_events_, this);
+
+  pw_stream_ = CreateReceivingStream();
+  if (!pw_stream_) {
+    RTC_LOG(LS_ERROR) << "Failed to create PipeWire stream";
+    return;
+  }
+#else
   pw_remote_add_listener(pw_remote_, &spa_remote_listener_, &pw_remote_events_,
                          this);
   pw_remote_connect_fd(pw_remote_, pw_fd_);
+#endif
 
   if (pw_thread_loop_start(pw_main_loop_) < 0) {
     RTC_LOG(LS_ERROR) << "Failed to start main PipeWire loop";
     portal_init_failed_ = true;
   }
 
+  pw_thread_loop_unlock(pw_main_loop_);
+
   RTC_LOG(LS_INFO) << "PipeWire remote opened.";
 }
 
+#if !PW_CHECK_VERSION(0, 3, 0)
 void BaseCapturerPipeWire::InitPipeWireTypes() {
   spa_type_map* map = pw_core_type_->map;
   pw_type_ = new PipeWireType();
@@ -323,23 +610,44 @@ void BaseCapturerPipeWire::InitPipeWireTypes() {
   spa_type_format_video_map(map, &pw_type_->format_video);
   spa_type_video_format_map(map, &pw_type_->video_format);
 }
+#endif
 
-void BaseCapturerPipeWire::CreateReceivingStream() {
+pw_stream* BaseCapturerPipeWire::CreateReceivingStream() {
+#if !PW_CHECK_VERSION(0, 3, 0)
+  if (pw_remote_get_state(pw_remote_, nullptr) != PW_REMOTE_STATE_CONNECTED) {
+    RTC_LOG(LS_ERROR) << "Cannot create pipewire stream";
+    return nullptr;
+  }
+#endif
   spa_rectangle pwMinScreenBounds = spa_rectangle{1, 1};
-  spa_rectangle pwScreenBounds =
-      spa_rectangle{static_cast<uint32_t>(desktop_size_.width()),
-                    static_cast<uint32_t>(desktop_size_.height())};
-
-  spa_fraction pwFrameRateMin = spa_fraction{0, 1};
-  spa_fraction pwFrameRateMax = spa_fraction{60, 1};
+  spa_rectangle pwMaxScreenBounds = spa_rectangle{UINT32_MAX, UINT32_MAX};
 
   pw_properties* reuseProps =
       pw_properties_new_string("pipewire.client.reuse=1");
-  pw_stream_ = pw_stream_new(pw_remote_, "webrtc-consume-stream", reuseProps);
+#if PW_CHECK_VERSION(0, 3, 0)
+  auto stream = pw_stream_new(pw_core_, "webrtc-consume-stream", reuseProps);
+#else
+  auto stream = pw_stream_new(pw_remote_, "webrtc-consume-stream", reuseProps);
+#endif
 
   uint8_t buffer[1024] = {};
   const spa_pod* params[1];
   spa_pod_builder builder = spa_pod_builder{buffer, sizeof(buffer)};
+
+#if PW_CHECK_VERSION(0, 3, 0)
+  params[0] = reinterpret_cast<spa_pod*>(spa_pod_builder_add_object(
+      &builder, SPA_TYPE_OBJECT_Format, SPA_PARAM_EnumFormat,
+      SPA_FORMAT_mediaType, SPA_POD_Id(SPA_MEDIA_TYPE_video),
+      SPA_FORMAT_mediaSubtype, SPA_POD_Id(SPA_MEDIA_SUBTYPE_raw),
+      SPA_FORMAT_VIDEO_format,
+      SPA_POD_CHOICE_ENUM_Id(5, SPA_VIDEO_FORMAT_BGRx, SPA_VIDEO_FORMAT_RGBx,
+                             SPA_VIDEO_FORMAT_RGBA, SPA_VIDEO_FORMAT_BGRx,
+                             SPA_VIDEO_FORMAT_BGRA),
+      SPA_FORMAT_VIDEO_size,
+      SPA_POD_CHOICE_RANGE_Rectangle(&pwMinScreenBounds, &pwMinScreenBounds,
+                                     &pwMaxScreenBounds),
+      0));
+#else
   params[0] = reinterpret_cast<spa_pod*>(spa_pod_builder_object(
       &builder,
       // id to enumerate formats
@@ -349,69 +657,218 @@ void BaseCapturerPipeWire::CreateReceivingStream() {
       // then allowed formats are enumerated (e) and the format is undecided (u)
       // to allow negotiation
       ":", pw_type_->format_video.format, "Ieu", pw_type_->video_format.BGRx,
-      SPA_POD_PROP_ENUM(2, pw_type_->video_format.RGBx,
-                        pw_type_->video_format.BGRx),
+      SPA_POD_PROP_ENUM(
+          4, pw_type_->video_format.RGBx, pw_type_->video_format.BGRx,
+          pw_type_->video_format.RGBA, pw_type_->video_format.BGRA),
       // Video size: specified as rectangle (R), preferred size is specified as
       // first parameter, then allowed size is defined as range (r) from min and
       // max values and the format is undecided (u) to allow negotiation
-      ":", pw_type_->format_video.size, "Rru", &pwScreenBounds, 2,
-      &pwMinScreenBounds, &pwScreenBounds,
-      // Frame rate: specified as fraction (F) and set to minimum frame rate
-      // value
-      ":", pw_type_->format_video.framerate, "F", &pwFrameRateMin,
-      // Max frame rate: specified as fraction (F), preferred frame rate is set
-      // to maximum value, then allowed frame rate is defined as range (r) from
-      // min and max values and it is undecided (u) to allow negotiation
-      ":", pw_type_->format_video.max_framerate, "Fru", &pwFrameRateMax, 2,
-      &pwFrameRateMin, &pwFrameRateMax));
-
-  pw_stream_add_listener(pw_stream_, &spa_stream_listener_, &pw_stream_events_,
+      ":", pw_type_->format_video.size, "Rru", &pwMinScreenBounds,
+      SPA_POD_PROP_MIN_MAX(&pwMinScreenBounds, &pwMaxScreenBounds)));
+#endif
+
+  pw_stream_add_listener(stream, &spa_stream_listener_, &pw_stream_events_,
                          this);
+#if PW_CHECK_VERSION(0, 3, 0)
+  if (pw_stream_connect(stream, PW_DIRECTION_INPUT, pw_stream_node_id_,
+                        PW_STREAM_FLAG_AUTOCONNECT, params, 1) != 0) {
+#else
   pw_stream_flags flags = static_cast<pw_stream_flags>(
-      PW_STREAM_FLAG_AUTOCONNECT | PW_STREAM_FLAG_INACTIVE |
-      PW_STREAM_FLAG_MAP_BUFFERS);
-  if (pw_stream_connect(pw_stream_, PW_DIRECTION_INPUT, /*port_path=*/nullptr,
+      PW_STREAM_FLAG_AUTOCONNECT | PW_STREAM_FLAG_INACTIVE);
+  if (pw_stream_connect(stream, PW_DIRECTION_INPUT, /*port_path=*/nullptr,
                         flags, params,
                         /*n_params=*/1) != 0) {
+#endif
     RTC_LOG(LS_ERROR) << "Could not connect receiving stream.";
     portal_init_failed_ = true;
-    return;
+    return nullptr;
   }
+
+  return stream;
 }
 
 void BaseCapturerPipeWire::HandleBuffer(pw_buffer* buffer) {
   spa_buffer* spaBuffer = buffer->buffer;
-  void* src = nullptr;
+  ScopedBuf map;
+  uint8_t* src = nullptr;
+
+  if (spaBuffer->datas[0].chunk->size == 0) {
+    RTC_LOG(LS_ERROR) << "Failed to get video stream: Zero size.";
+    return;
+  }
+
+#if PW_CHECK_VERSION(0, 3, 0)
+  if (spaBuffer->datas[0].type == SPA_DATA_MemFd ||
+      spaBuffer->datas[0].type == SPA_DATA_DmaBuf) {
+#else
+  if (spaBuffer->datas[0].type == pw_core_type_->data.MemFd ||
+      spaBuffer->datas[0].type == pw_core_type_->data.DmaBuf) {
+#endif
+    map.initialize(
+        static_cast<uint8_t*>(
+            mmap(nullptr,
+                 spaBuffer->datas[0].maxsize + spaBuffer->datas[0].mapoffset,
+                 PROT_READ, MAP_PRIVATE, spaBuffer->datas[0].fd, 0)),
+        spaBuffer->datas[0].maxsize + spaBuffer->datas[0].mapoffset,
+#if PW_CHECK_VERSION(0, 3, 0)
+        spaBuffer->datas[0].type == SPA_DATA_DmaBuf,
+#else
+        spaBuffer->datas[0].type == pw_core_type_->data.DmaBuf,
+#endif
+        spaBuffer->datas[0].fd);
+
+    if (!map) {
+      RTC_LOG(LS_ERROR) << "Failed to mmap the memory: "
+                        << std::strerror(errno);
+      return;
+    }
+
+#if PW_CHECK_VERSION(0, 3, 0)
+    if (spaBuffer->datas[0].type == SPA_DATA_DmaBuf) {
+#else
+    if (spaBuffer->datas[0].type == pw_core_type_->data.DmaBuf) {
+#endif
+      SyncDmaBuf(spaBuffer->datas[0].fd, DMA_BUF_SYNC_START);
+    }
+
+    src = SPA_MEMBER(map.get(), spaBuffer->datas[0].mapoffset, uint8_t);
+#if PW_CHECK_VERSION(0, 3, 0)
+  } else if (spaBuffer->datas[0].type == SPA_DATA_MemPtr) {
+#else
+  } else if (spaBuffer->datas[0].type == pw_core_type_->data.MemPtr) {
+#endif
+    src = static_cast<uint8_t*>(spaBuffer->datas[0].data);
+  }
 
-  if (!(src = spaBuffer->datas[0].data)) {
+  if (!src) {
+    return;
+  }
+
+#if PW_CHECK_VERSION(0, 3, 0)
+  struct spa_meta_region* video_metadata =
+      static_cast<struct spa_meta_region*>(spa_buffer_find_meta_data(
+          spaBuffer, SPA_META_VideoCrop, sizeof(*video_metadata)));
+#else
+  struct spa_meta_video_crop* video_metadata =
+      static_cast<struct spa_meta_video_crop*>(
+          spa_buffer_find_meta(spaBuffer, pw_core_type_->meta.VideoCrop));
+#endif
+
+  // Video size from metadata is bigger than an actual video stream size.
+  // The metadata are wrong or we should up-scale the video...in both cases
+  // just quit now.
+#if PW_CHECK_VERSION(0, 3, 0)
+  if (video_metadata && (video_metadata->region.size.width >
+                             static_cast<uint32_t>(desktop_size_.width()) ||
+                         video_metadata->region.size.height >
+                             static_cast<uint32_t>(desktop_size_.height()))) {
+#else
+  if (video_metadata && (video_metadata->width > desktop_size_.width() ||
+                         video_metadata->height > desktop_size_.height())) {
+#endif
+    RTC_LOG(LS_ERROR) << "Stream metadata sizes are wrong!";
     return;
   }
 
-  uint32_t maxSize = spaBuffer->datas[0].maxsize;
-  int32_t srcStride = spaBuffer->datas[0].chunk->stride;
-  if (srcStride != (desktop_size_.width() * kBytesPerPixel)) {
+  // Use video metadata when video size from metadata is set and smaller than
+  // video stream size, so we need to adjust it.
+  bool video_is_full_width = true;
+  bool video_is_full_height = true;
+#if PW_CHECK_VERSION(0, 3, 0)
+  if (video_metadata && video_metadata->region.size.width != 0 &&
+      video_metadata->region.size.height != 0) {
+    if (video_metadata->region.size.width <
+        static_cast<uint32_t>(desktop_size_.width())) {
+      video_is_full_width = false;
+    } else if (video_metadata->region.size.height <
+               static_cast<uint32_t>(desktop_size_.height())) {
+      video_is_full_height = false;
+    }
+  }
+#else
+  if (video_metadata && video_metadata->width != 0 &&
+      video_metadata->height != 0) {
+    if (video_metadata->width < desktop_size_.width()) {
+    } else if (video_metadata->height < desktop_size_.height()) {
+      video_is_full_height = false;
+    }
+  }
+#endif
+
+  DesktopSize video_size_prev = video_size_;
+  if (!video_is_full_height || !video_is_full_width) {
+#if PW_CHECK_VERSION(0, 3, 0)
+    video_size_ = DesktopSize(video_metadata->region.size.width,
+                              video_metadata->region.size.height);
+#else
+    video_size_ = DesktopSize(video_metadata->width, video_metadata->height);
+#endif
+  } else {
+    video_size_ = desktop_size_;
+  }
+
+  webrtc::MutexLock lock(&current_frame_lock_);
+  if (!current_frame_ || !video_size_.equals(video_size_prev)) {
+    current_frame_ = std::make_unique<uint8_t[]>(
+        video_size_.width() * video_size_.height() * kBytesPerPixel);
+  }
+
+  const int32_t dst_stride = video_size_.width() * kBytesPerPixel;
+  const int32_t src_stride = spaBuffer->datas[0].chunk->stride;
+
+  if (src_stride != (desktop_size_.width() * kBytesPerPixel)) {
     RTC_LOG(LS_ERROR) << "Got buffer with stride different from screen stride: "
-                      << srcStride
+                      << src_stride
                       << " != " << (desktop_size_.width() * kBytesPerPixel);
     portal_init_failed_ = true;
+
     return;
   }
 
-  if (!current_frame_) {
-    current_frame_ = static_cast<uint8_t*>(malloc(maxSize));
-  }
-  RTC_DCHECK(current_frame_ != nullptr);
-
-  // If both sides decided to go with the RGBx format we need to convert it to
-  // BGRx to match color format expected by WebRTC.
-  if (spa_video_format_->format == pw_type_->video_format.RGBx) {
-    uint8_t* tempFrame = static_cast<uint8_t*>(malloc(maxSize));
-    std::memcpy(tempFrame, src, maxSize);
-    ConvertRGBxToBGRx(tempFrame, maxSize);
-    std::memcpy(current_frame_, tempFrame, maxSize);
-    free(tempFrame);
-  } else {
-    std::memcpy(current_frame_, src, maxSize);
+  // Adjust source content based on metadata video position
+#if PW_CHECK_VERSION(0, 3, 0)
+  if (!video_is_full_height &&
+      (video_metadata->region.position.y + video_size_.height() <=
+       desktop_size_.height())) {
+    src += src_stride * video_metadata->region.position.y;
+  }
+  const int x_offset =
+      !video_is_full_width &&
+              (video_metadata->region.position.x + video_size_.width() <=
+               desktop_size_.width())
+          ? video_metadata->region.position.x * kBytesPerPixel
+          : 0;
+#else
+  if (!video_is_full_height &&
+      (video_metadata->y + video_size_.height() <= desktop_size_.height())) {
+    src += src_stride * video_metadata->y;
+  }
+
+  const int x_offset =
+      !video_is_full_width &&
+              (video_metadata->x + video_size_.width() <= desktop_size_.width())
+          ? video_metadata->x * kBytesPerPixel
+          : 0;
+#endif
+
+  uint8_t* dst = current_frame_.get();
+  for (int i = 0; i < video_size_.height(); ++i) {
+    // Adjust source content based on crop video position if needed
+    src += x_offset;
+    std::memcpy(dst, src, dst_stride);
+    // If both sides decided to go with the RGBx format we need to convert it to
+    // BGRx to match color format expected by WebRTC.
+#if PW_CHECK_VERSION(0, 3, 0)
+    if (spa_video_format_.format == SPA_VIDEO_FORMAT_RGBx ||
+        spa_video_format_.format == SPA_VIDEO_FORMAT_RGBA) {
+#else
+    if (spa_video_format_->format == pw_type_->video_format.RGBx ||
+        spa_video_format_->format == pw_type_->video_format.RGBA) {
+#endif
+      ConvertRGBxToBGRx(dst, dst_stride);
+    }
+    src += src_stride - x_offset;
+    dst += dst_stride;
   }
 }
 
@@ -441,14 +898,13 @@ void BaseCapturerPipeWire::OnProxyRequested(GObject* /*object*/,
   BaseCapturerPipeWire* that = static_cast<BaseCapturerPipeWire*>(user_data);
   RTC_DCHECK(that);
 
-  GError* error = nullptr;
-  GDBusProxy *proxy = g_dbus_proxy_new_finish(result, &error);
+  Scoped<GError> error;
+  GDBusProxy* proxy = g_dbus_proxy_new_finish(result, error.receive());
   if (!proxy) {
-    if (g_error_matches(error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
+    if (g_error_matches(error.get(), G_IO_ERROR, G_IO_ERROR_CANCELLED))
       return;
     RTC_LOG(LS_ERROR) << "Failed to create a proxy for the screen cast portal: "
                       << error->message;
-    g_error_free(error);
     that->portal_init_failed_ = true;
     return;
   }
@@ -462,38 +918,36 @@ void BaseCapturerPipeWire::OnProxyRequested(GObject* /*object*/,
 // static
 gchar* BaseCapturerPipeWire::PrepareSignalHandle(GDBusConnection* connection,
                                                  const gchar* token) {
-  gchar* sender = g_strdup(g_dbus_connection_get_unique_name(connection) + 1);
-  for (int i = 0; sender[i]; i++) {
-    if (sender[i] == '.') {
-      sender[i] = '_';
+  Scoped<gchar> sender(
+      g_strdup(g_dbus_connection_get_unique_name(connection) + 1));
+  for (int i = 0; sender.get()[i]; i++) {
+    if (sender.get()[i] == '.') {
+      sender.get()[i] = '_';
     }
   }
 
-  gchar* handle = g_strconcat(kDesktopRequestObjectPath, "/", sender, "/",
+  gchar* handle = g_strconcat(kDesktopRequestObjectPath, "/", sender.get(), "/",
                               token, /*end of varargs*/ nullptr);
-  g_free(sender);
 
   return handle;
 }
 
 void BaseCapturerPipeWire::SessionRequest() {
   GVariantBuilder builder;
-  gchar* variant_string;
+  Scoped<gchar> variant_string;
 
   g_variant_builder_init(&builder, G_VARIANT_TYPE_VARDICT);
   variant_string =
       g_strdup_printf("webrtc_session%d", g_random_int_range(0, G_MAXINT));
   g_variant_builder_add(&builder, "{sv}", "session_handle_token",
-                        g_variant_new_string(variant_string));
-  g_free(variant_string);
+                        g_variant_new_string(variant_string.get()));
   variant_string = g_strdup_printf("webrtc%d", g_random_int_range(0, G_MAXINT));
   g_variant_builder_add(&builder, "{sv}", "handle_token",
-                        g_variant_new_string(variant_string));
+                        g_variant_new_string(variant_string.get()));
 
-  portal_handle_ = PrepareSignalHandle(connection_, variant_string);
+  portal_handle_ = PrepareSignalHandle(connection_, variant_string.get());
   session_request_signal_id_ = SetupRequestResponseSignal(
       portal_handle_, OnSessionRequestResponseSignal);
-  g_free(variant_string);
 
   RTC_LOG(LS_INFO) << "Screen cast session requested.";
   g_dbus_proxy_call(
@@ -509,22 +963,21 @@ void BaseCapturerPipeWire::OnSessionRequested(GDBusProxy *proxy,
   BaseCapturerPipeWire* that = static_cast<BaseCapturerPipeWire*>(user_data);
   RTC_DCHECK(that);
 
-  GError* error = nullptr;
-  GVariant* variant = g_dbus_proxy_call_finish(proxy, result, &error);
+  Scoped<GError> error;
+  Scoped<GVariant> variant(
+      g_dbus_proxy_call_finish(proxy, result, error.receive()));
   if (!variant) {
-    if (g_error_matches(error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
+    if (g_error_matches(error.get(), G_IO_ERROR, G_IO_ERROR_CANCELLED))
       return;
     RTC_LOG(LS_ERROR) << "Failed to create a screen cast session: "
                       << error->message;
-    g_error_free(error);
     that->portal_init_failed_ = true;
     return;
   }
   RTC_LOG(LS_INFO) << "Initializing the screen cast session.";
 
-  gchar* handle = nullptr;
-  g_variant_get_child(variant, 0, "o", &handle);
-  g_variant_unref(variant);
+  Scoped<gchar> handle;
+  g_variant_get_child(variant.get(), 0, "o", &handle);
   if (!handle) {
     RTC_LOG(LS_ERROR) << "Failed to initialize the screen cast session.";
     if (that->session_request_signal_id_) {
@@ -536,8 +989,6 @@ void BaseCapturerPipeWire::OnSessionRequested(GDBusProxy *proxy,
     return;
   }
 
-  g_free(handle);
-
   RTC_LOG(LS_INFO) << "Subscribing to the screen cast session.";
 }
 
@@ -557,11 +1008,11 @@ void BaseCapturerPipeWire::OnSessionRequestResponseSignal(
       << "Received response for the screen cast session subscription.";
 
   guint32 portal_response;
-  GVariant* response_data;
-  g_variant_get(parameters, "(u@a{sv})", &portal_response, &response_data);
-  g_variant_lookup(response_data, "session_handle", "s",
+  Scoped<GVariant> response_data;
+  g_variant_get(parameters, "(u@a{sv})", &portal_response,
+                response_data.receive());
+  g_variant_lookup(response_data.get(), "session_handle", "s",
                    &that->session_handle_);
-  g_variant_unref(response_data);
 
   if (!that->session_handle_ || portal_response) {
     RTC_LOG(LS_ERROR)
@@ -575,23 +1026,23 @@ void BaseCapturerPipeWire::OnSessionRequestResponseSignal(
 
 void BaseCapturerPipeWire::SourcesRequest() {
   GVariantBuilder builder;
-  gchar* variant_string;
+  Scoped<gchar> variant_string;
 
   g_variant_builder_init(&builder, G_VARIANT_TYPE_VARDICT);
   // We want to record monitor content.
-  g_variant_builder_add(&builder, "{sv}", "types",
-                        g_variant_new_uint32(capture_source_type_));
+  g_variant_builder_add(
+      &builder, "{sv}", "types",
+      g_variant_new_uint32(static_cast<uint32_t>(capture_source_type_)));
   // We don't want to allow selection of multiple sources.
   g_variant_builder_add(&builder, "{sv}", "multiple",
                         g_variant_new_boolean(false));
   variant_string = g_strdup_printf("webrtc%d", g_random_int_range(0, G_MAXINT));
   g_variant_builder_add(&builder, "{sv}", "handle_token",
-                        g_variant_new_string(variant_string));
+                        g_variant_new_string(variant_string.get()));
 
-  sources_handle_ = PrepareSignalHandle(connection_, variant_string);
+  sources_handle_ = PrepareSignalHandle(connection_, variant_string.get());
   sources_request_signal_id_ = SetupRequestResponseSignal(
       sources_handle_, OnSourcesRequestResponseSignal);
-  g_free(variant_string);
 
   RTC_LOG(LS_INFO) << "Requesting sources from the screen cast session.";
   g_dbus_proxy_call(
@@ -608,22 +1059,21 @@ void BaseCapturerPipeWire::OnSourcesRequested(GDBusProxy *proxy,
   BaseCapturerPipeWire* that = static_cast<BaseCapturerPipeWire*>(user_data);
   RTC_DCHECK(that);
 
-  GError* error = nullptr;
-  GVariant* variant = g_dbus_proxy_call_finish(proxy, result, &error);
+  Scoped<GError> error;
+  Scoped<GVariant> variant(
+      g_dbus_proxy_call_finish(proxy, result, error.receive()));
   if (!variant) {
-    if (g_error_matches(error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
+    if (g_error_matches(error.get(), G_IO_ERROR, G_IO_ERROR_CANCELLED))
       return;
     RTC_LOG(LS_ERROR) << "Failed to request the sources: " << error->message;
-    g_error_free(error);
     that->portal_init_failed_ = true;
     return;
   }
 
   RTC_LOG(LS_INFO) << "Sources requested from the screen cast session.";
 
-  gchar* handle = nullptr;
-  g_variant_get_child(variant, 0, "o", &handle);
-  g_variant_unref(variant);
+  Scoped<gchar> handle;
+  g_variant_get_child(variant.get(), 0, "o", handle.receive());
   if (!handle) {
     RTC_LOG(LS_ERROR) << "Failed to initialize the screen cast session.";
     if (that->sources_request_signal_id_) {
@@ -635,8 +1085,6 @@ void BaseCapturerPipeWire::OnSourcesRequested(GDBusProxy *proxy,
     return;
   }
 
-  g_free(handle);
-
   RTC_LOG(LS_INFO) << "Subscribed to sources signal.";
 }
 
@@ -668,17 +1116,16 @@ void BaseCapturerPipeWire::OnSourcesRequestResponseSignal(
 
 void BaseCapturerPipeWire::StartRequest() {
   GVariantBuilder builder;
-  gchar* variant_string;
+  Scoped<gchar> variant_string;
 
   g_variant_builder_init(&builder, G_VARIANT_TYPE_VARDICT);
   variant_string = g_strdup_printf("webrtc%d", g_random_int_range(0, G_MAXINT));
   g_variant_builder_add(&builder, "{sv}", "handle_token",
-                        g_variant_new_string(variant_string));
+                        g_variant_new_string(variant_string.get()));
 
-  start_handle_ = PrepareSignalHandle(connection_, variant_string);
+  start_handle_ = PrepareSignalHandle(connection_, variant_string.get());
   start_request_signal_id_ =
       SetupRequestResponseSignal(start_handle_, OnStartRequestResponseSignal);
-  g_free(variant_string);
 
   // "Identifier for the application window", this is Wayland, so not "x11:...".
   const gchar parent_window[] = "";
@@ -698,23 +1145,22 @@ void BaseCapturerPipeWire::OnStartRequested(GDBusProxy *proxy,
   BaseCapturerPipeWire* that = static_cast<BaseCapturerPipeWire*>(user_data);
   RTC_DCHECK(that);
 
-  GError* error = nullptr;
-  GVariant* variant = g_dbus_proxy_call_finish(proxy, result, &error);
+  Scoped<GError> error;
+  Scoped<GVariant> variant(
+      g_dbus_proxy_call_finish(proxy, result, error.receive()));
   if (!variant) {
-    if (g_error_matches(error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
+    if (g_error_matches(error.get(), G_IO_ERROR, G_IO_ERROR_CANCELLED))
       return;
     RTC_LOG(LS_ERROR) << "Failed to start the screen cast session: "
                       << error->message;
-    g_error_free(error);
     that->portal_init_failed_ = true;
     return;
   }
 
   RTC_LOG(LS_INFO) << "Initializing the start of the screen cast session.";
 
-  gchar* handle = nullptr;
-  g_variant_get_child(variant, 0, "o", &handle);
-  g_variant_unref(variant);
+  Scoped<gchar> handle;
+  g_variant_get_child(variant.get(), 0, "o", handle.receive());
   if (!handle) {
     RTC_LOG(LS_ERROR)
         << "Failed to initialize the start of the screen cast session.";
@@ -727,8 +1173,6 @@ void BaseCapturerPipeWire::OnStartRequested(GDBusProxy *proxy,
     return;
   }
 
-  g_free(handle);
-
   RTC_LOG(LS_INFO) << "Subscribed to the start signal.";
 }
 
@@ -746,9 +1190,10 @@ void BaseCapturerPipeWire::OnStartRequestResponseSignal(
 
   RTC_LOG(LS_INFO) << "Start signal received.";
   guint32 portal_response;
-  GVariant* response_data;
-  GVariantIter* iter = nullptr;
-  g_variant_get(parameters, "(u@a{sv})", &portal_response, &response_data);
+  Scoped<GVariant> response_data;
+  Scoped<GVariantIter> iter;
+  g_variant_get(parameters, "(u@a{sv})", &portal_response,
+                response_data.receive());
   if (portal_response || !response_data) {
     RTC_LOG(LS_ERROR) << "Failed to start the screen cast session.";
     that->portal_init_failed_ = true;
@@ -758,28 +1203,28 @@ void BaseCapturerPipeWire::OnStartRequestResponseSignal(
   // Array of PipeWire streams. See
   // https://github.com/flatpak/xdg-desktop-portal/blob/master/data/org.freedesktop.portal.ScreenCast.xml
   // documentation for <method name="Start">.
-  if (g_variant_lookup(response_data, "streams", "a(ua{sv})", &iter)) {
-    GVariant* variant;
+  if (g_variant_lookup(response_data.get(), "streams", "a(ua{sv})",
+                       iter.receive())) {
+    Scoped<GVariant> variant;
 
-    while (g_variant_iter_next(iter, "@(ua{sv})", &variant)) {
+    while (g_variant_iter_next(iter.get(), "@(ua{sv})", variant.receive())) {
       guint32 stream_id;
-      gint32 width;
-      gint32 height;
-      GVariant* options;
+      guint32 type;
+      Scoped<GVariant> options;
 
-      g_variant_get(variant, "(u@a{sv})", &stream_id, &options);
-      RTC_DCHECK(options != nullptr);
+      g_variant_get(variant.get(), "(u@a{sv})", &stream_id, options.receive());
+      RTC_DCHECK(options.get());
 
-      g_variant_lookup(options, "size", "(ii)", &width, &height);
+      if (g_variant_lookup(options.get(), "source_type", "u", &type)) {
+        that->capture_source_type_ =
+            static_cast<BaseCapturerPipeWire::CaptureSourceType>(type);
+      }
 
-      that->desktop_size_.set(width, height);
+      that->pw_stream_node_id_ = stream_id;
 
-      g_variant_unref(options);
-      g_variant_unref(variant);
+      break;
     }
   }
-  g_variant_iter_free(iter);
-  g_variant_unref(response_data);
 
   that->OpenPipeWireRemote();
 }
@@ -807,35 +1252,30 @@ void BaseCapturerPipeWire::OnOpenPipeWireRemoteRequested(
   BaseCapturerPipeWire* that = static_cast<BaseCapturerPipeWire*>(user_data);
   RTC_DCHECK(that);
 
-  GError* error = nullptr;
-  GUnixFDList* outlist = nullptr;
-  GVariant* variant = g_dbus_proxy_call_with_unix_fd_list_finish(
-      proxy, &outlist, result, &error);
+  Scoped<GError> error;
+  Scoped<GUnixFDList> outlist;
+  Scoped<GVariant> variant(g_dbus_proxy_call_with_unix_fd_list_finish(
+      proxy, outlist.receive(), result, error.receive()));
   if (!variant) {
-    if (g_error_matches(error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
+    if (g_error_matches(error.get(), G_IO_ERROR, G_IO_ERROR_CANCELLED))
       return;
     RTC_LOG(LS_ERROR) << "Failed to open the PipeWire remote: "
                       << error->message;
-    g_error_free(error);
     that->portal_init_failed_ = true;
     return;
   }
 
   gint32 index;
-  g_variant_get(variant, "(h)", &index);
+  g_variant_get(variant.get(), "(h)", &index);
 
-  if ((that->pw_fd_ = g_unix_fd_list_get(outlist, index, &error)) == -1) {
+  if ((that->pw_fd_ =
+           g_unix_fd_list_get(outlist.get(), index, error.receive())) == -1) {
     RTC_LOG(LS_ERROR) << "Failed to get file descriptor from the list: "
                       << error->message;
-    g_error_free(error);
-    g_variant_unref(variant);
     that->portal_init_failed_ = true;
     return;
   }
 
-  g_variant_unref(variant);
-  g_object_unref(outlist);
-
   that->InitPipeWire();
 }
 
@@ -854,15 +1294,18 @@ void BaseCapturerPipeWire::CaptureFrame() {
     return;
   }
 
+  webrtc::MutexLock lock(&current_frame_lock_);
   if (!current_frame_) {
     callback_->OnCaptureResult(Result::ERROR_TEMPORARY, nullptr);
     return;
   }
 
-  std::unique_ptr<DesktopFrame> result(new BasicDesktopFrame(desktop_size_));
+  DesktopSize frame_size = video_size_;
+
+  std::unique_ptr<DesktopFrame> result(new BasicDesktopFrame(frame_size));
   result->CopyPixelsFrom(
-      current_frame_, (desktop_size_.width() * kBytesPerPixel),
-      DesktopRect::MakeWH(desktop_size_.width(), desktop_size_.height()));
+      current_frame_.get(), (frame_size.width() * kBytesPerPixel),
+      DesktopRect::MakeWH(frame_size.width(), frame_size.height()));
   if (!result) {
     callback_->OnCaptureResult(Result::ERROR_TEMPORARY, nullptr);
     return;
@@ -887,4 +1330,11 @@ bool BaseCapturerPipeWire::SelectSource(SourceId id) {
   return true;
 }
 
+// static
+std::unique_ptr<DesktopCapturer> BaseCapturerPipeWire::CreateRawCapturer(
+    const DesktopCaptureOptions& options) {
+  return std::make_unique<BaseCapturerPipeWire>(
+      BaseCapturerPipeWire::CaptureSourceType::kAny);
+}
+
 }  // namespace webrtc
diff --git a/qtwebengine/src/3rdparty/chromium/third_party/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.h b/qtwebengine/src/3rdparty/chromium/third_party/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.h
index f28d7a5..75d20db 100644
--- a/qtwebengine/src/3rdparty/chromium/third_party/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.h
+++ b/qtwebengine/src/3rdparty/chromium/third_party/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.h
@@ -10,18 +10,23 @@
 
 #ifndef MODULES_DESKTOP_CAPTURE_LINUX_BASE_CAPTURER_PIPEWIRE_H_
 #define MODULES_DESKTOP_CAPTURE_LINUX_BASE_CAPTURER_PIPEWIRE_H_
-
 #include <gio/gio.h>
 #define typeof __typeof__
 #include <pipewire/pipewire.h>
 #include <spa/param/video/format-utils.h>
+#if PW_CHECK_VERSION(0, 3, 0)
+#include <spa/utils/result.h>
+#endif
 
+#include "absl/types/optional.h"
 #include "modules/desktop_capture/desktop_capture_options.h"
 #include "modules/desktop_capture/desktop_capturer.h"
 #include "rtc_base/constructor_magic.h"
+#include "rtc_base/synchronization/mutex.h"
 
 namespace webrtc {
 
+#if !PW_CHECK_VERSION(0, 3, 0)
 class PipeWireType {
  public:
   spa_type_media_type media_type;
@@ -29,14 +34,25 @@ class PipeWireType {
   spa_type_format_video format_video;
   spa_type_video_format video_format;
 };
+#endif
 
 class BaseCapturerPipeWire : public DesktopCapturer {
  public:
-  enum CaptureSourceType { Screen = 1, Window };
+  // Values are set based on source type property in
+  // xdg-desktop-portal/screencast
+  // https://github.com/flatpak/xdg-desktop-portal/blob/master/data/org.freedesktop.portal.ScreenCast.xml
+  enum class CaptureSourceType : uint32_t {
+    kScreen = 0b01,
+    kWindow = 0b10,
+    kAny = 0b11
+  };
 
   explicit BaseCapturerPipeWire(CaptureSourceType source_type);
   ~BaseCapturerPipeWire() override;
 
+  static std::unique_ptr<DesktopCapturer> CreateRawCapturer(
+      const DesktopCaptureOptions& options);
+
   // DesktopCapturer interface.
   void Start(Callback* delegate) override;
   void CaptureFrame() override;
@@ -45,6 +61,21 @@ class BaseCapturerPipeWire : public DesktopCapturer {
 
  private:
   // PipeWire types -->
+#if PW_CHECK_VERSION(0, 3, 0)
+  struct pw_context* pw_context_ = nullptr;
+  struct pw_core* pw_core_ = nullptr;
+  struct pw_stream* pw_stream_ = nullptr;
+  struct pw_thread_loop* pw_main_loop_ = nullptr;
+
+  spa_hook spa_core_listener_;
+  spa_hook spa_stream_listener_;
+
+  // event handlers
+  pw_core_events pw_core_events_ = {};
+  pw_stream_events pw_stream_events_ = {};
+
+  struct spa_video_info_raw spa_video_format_;
+#else
   pw_core* pw_core_ = nullptr;
   pw_type* pw_core_type_ = nullptr;
   pw_stream* pw_stream_ = nullptr;
@@ -60,11 +91,13 @@ class BaseCapturerPipeWire : public DesktopCapturer {
   pw_remote_events pw_remote_events_ = {};
 
   spa_video_info_raw* spa_video_format_ = nullptr;
+#endif
 
+  guint32 pw_stream_node_id_ = 0;
   gint32 pw_fd_ = -1;
 
   CaptureSourceType capture_source_type_ =
-      BaseCapturerPipeWire::CaptureSourceType::Screen;
+      BaseCapturerPipeWire::CaptureSourceType::kScreen;
 
   // <-- end of PipeWire types
 
@@ -79,10 +112,12 @@ class BaseCapturerPipeWire : public DesktopCapturer {
   guint sources_request_signal_id_ = 0;
   guint start_request_signal_id_ = 0;
 
+  DesktopSize video_size_;
   DesktopSize desktop_size_ = {};
   DesktopCaptureOptions options_ = {};
 
-  uint8_t* current_frame_ = nullptr;
+  webrtc::Mutex current_frame_lock_;
+  std::unique_ptr<uint8_t[]> current_frame_;
   Callback* callback_ = nullptr;
 
   bool portal_init_failed_ = false;
@@ -91,21 +126,32 @@ class BaseCapturerPipeWire : public DesktopCapturer {
   void InitPipeWire();
   void InitPipeWireTypes();
 
-  void CreateReceivingStream();
+  pw_stream* CreateReceivingStream();
   void HandleBuffer(pw_buffer* buffer);
 
   void ConvertRGBxToBGRx(uint8_t* frame, uint32_t size);
 
+#if PW_CHECK_VERSION(0, 3, 0)
+  static void OnCoreError(void* data,
+                          uint32_t id,
+                          int seq,
+                          int res,
+                          const char* message);
+  static void OnStreamParamChanged(void* data,
+                                   uint32_t id,
+                                   const struct spa_pod* format);
+#else
   static void OnStateChanged(void* data,
                              pw_remote_state old_state,
                              pw_remote_state state,
                              const char* error);
+  static void OnStreamFormatChanged(void* data, const struct spa_pod* format);
+#endif
   static void OnStreamStateChanged(void* data,
                                    pw_stream_state old_state,
                                    pw_stream_state state,
                                    const char* error_message);
 
-  static void OnStreamFormatChanged(void* data, const struct spa_pod* format);
   static void OnStreamProcess(void* data);
   static void OnNewBuffer(void* data, uint32_t id);
 
diff --git a/qtwebengine/src/3rdparty/chromium/third_party/webrtc/modules/desktop_capture/screen_capturer_linux.cc b/qtwebengine/src/3rdparty/chromium/third_party/webrtc/modules/desktop_capture/screen_capturer_linux.cc
index 82dbae4..ed48b7d 100644
--- a/qtwebengine/src/3rdparty/chromium/third_party/webrtc/modules/desktop_capture/screen_capturer_linux.cc
+++ b/qtwebengine/src/3rdparty/chromium/third_party/webrtc/modules/desktop_capture/screen_capturer_linux.cc
@@ -14,7 +14,7 @@
 #include "modules/desktop_capture/desktop_capturer.h"
 
 #if defined(WEBRTC_USE_PIPEWIRE)
-#include "modules/desktop_capture/linux/screen_capturer_pipewire.h"
+#include "modules/desktop_capture/linux/base_capturer_pipewire.h"
 #endif  // defined(WEBRTC_USE_PIPEWIRE)
 
 #if defined(WEBRTC_USE_X11)
@@ -28,7 +28,7 @@ std::unique_ptr<DesktopCapturer> DesktopCapturer::CreateRawScreenCapturer(
     const DesktopCaptureOptions& options) {
 #if defined(WEBRTC_USE_PIPEWIRE)
   if (options.allow_pipewire() && DesktopCapturer::IsRunningUnderWayland()) {
-    return ScreenCapturerPipeWire::CreateRawScreenCapturer(options);
+    return BaseCapturerPipeWire::CreateRawCapturer(options);
   }
 #endif  // defined(WEBRTC_USE_PIPEWIRE)
 
diff --git a/qtwebengine/src/3rdparty/chromium/third_party/webrtc/modules/desktop_capture/window_capturer_linux.cc b/qtwebengine/src/3rdparty/chromium/third_party/webrtc/modules/desktop_capture/window_capturer_linux.cc
index 41dbf83..2b142ae 100644
--- a/qtwebengine/src/3rdparty/chromium/third_party/webrtc/modules/desktop_capture/window_capturer_linux.cc
+++ b/qtwebengine/src/3rdparty/chromium/third_party/webrtc/modules/desktop_capture/window_capturer_linux.cc
@@ -14,7 +14,7 @@
 #include "modules/desktop_capture/desktop_capturer.h"
 
 #if defined(WEBRTC_USE_PIPEWIRE)
-#include "modules/desktop_capture/linux/window_capturer_pipewire.h"
+#include "modules/desktop_capture/linux/base_capturer_pipewire.h"
 #endif  // defined(WEBRTC_USE_PIPEWIRE)
 
 #if defined(WEBRTC_USE_X11)
@@ -28,7 +28,7 @@ std::unique_ptr<DesktopCapturer> DesktopCapturer::CreateRawWindowCapturer(
     const DesktopCaptureOptions& options) {
 #if defined(WEBRTC_USE_PIPEWIRE)
   if (options.allow_pipewire() && DesktopCapturer::IsRunningUnderWayland()) {
-    return WindowCapturerPipeWire::CreateRawWindowCapturer(options);
+    return BaseCapturerPipeWire::CreateRawCapturer(options);
   }
 #endif  // defined(WEBRTC_USE_PIPEWIRE)
 
diff --git a/qtwebengine/src/3rdparty/chromium/third_party/webrtc/modules/desktop_capture/BUILD.gn b/qtwebengine/src/3rdparty/chromium/third_party/webrtc/modules/desktop_capture/BUILD.gn
index 5235512..8259442 100644
--- a/qtwebengine/src/3rdparty/chromium/third_party/webrtc/modules/desktop_capture/BUILD.gn
+++ b/qtwebengine/src/3rdparty/chromium/third_party/webrtc/modules/desktop_capture/BUILD.gn
@@ -11,6 +11,11 @@ import("//build/config/ui.gni")
 import("//tools/generate_stubs/rules.gni")
 import("../../webrtc.gni")
 
+if (rtc_use_pipewire) {
+  assert(rtc_pipewire_version == "0.2" || rtc_pipewire_version == "0.3",
+         "Unsupported PipeWire version")
+}
+
 use_desktop_capture_differ_sse2 = current_cpu == "x86" || current_cpu == "x64"
 
 config("x11_config") {
@@ -200,22 +205,41 @@ if (is_linux || is_chromeos) {
       ]
     }
 
-    if (rtc_link_pipewire) {
+    if (rtc_pipewire_version == "0.3") {
       pkg_config("pipewire") {
-        packages = [ "libpipewire-0.2" ]
+        packages = [ "libpipewire-0.3" ]
+        if (!rtc_link_pipewire) {
+          ignore_libs = true
+        }
       }
     } else {
+      pkg_config("pipewire") {
+        packages = [ "libpipewire-0.2" ]
+        if (!rtc_link_pipewire) {
+          ignore_libs = true
+        }
+      }
+    }
+
+    if (!rtc_link_pipewire) {
       # When libpipewire is not directly linked, use stubs to allow for dlopening of
       # the binary.
       generate_stubs("pipewire_stubs") {
-        configs = [ "../../:common_config" ]
+        configs = [
+          "../../:common_config",
+          ":pipewire",
+        ]
         deps = [ "../../rtc_base" ]
         extra_header = "linux/pipewire_stub_header.fragment"
         logging_function = "RTC_LOG(LS_VERBOSE)"
         logging_include = "rtc_base/logging.h"
         output_name = "linux/pipewire_stubs"
         path_from_source = "modules/desktop_capture/linux"
-        sigs = [ "linux/pipewire.sigs" ]
+        if (rtc_pipewire_version == "0.3") {
+          sigs = [ "linux/pipewire03.sigs" ]
+        } else {
+          sigs = [ "linux/pipewire02.sigs" ]
+        }
       }
     }
 
@@ -506,6 +530,7 @@ rtc_library("desktop_capture_generic") {
   absl_deps = [
     "//third_party/abseil-cpp/absl/memory",
     "//third_party/abseil-cpp/absl/strings",
+    "//third_party/abseil-cpp/absl/types:optional",
   ]
 
   if (rtc_use_x11_extensions) {
@@ -526,20 +551,15 @@ rtc_library("desktop_capture_generic") {
     sources += [
       "linux/base_capturer_pipewire.cc",
       "linux/base_capturer_pipewire.h",
-      "linux/screen_capturer_pipewire.cc",
-      "linux/screen_capturer_pipewire.h",
-      "linux/window_capturer_pipewire.cc",
-      "linux/window_capturer_pipewire.h",
     ]
 
     configs += [
       ":pipewire_config",
       ":gio",
+      ":pipewire",
     ]
 
-    if (rtc_link_pipewire) {
-      configs += [ ":pipewire" ]
-    } else {
+    if (!rtc_link_pipewire) {
       deps += [ ":pipewire_stubs" ]
     }
   }
diff --git a/qtwebengine/src/3rdparty/chromium/third_party/webrtc/test/BUILD.gn b/qtwebengine/src/3rdparty/chromium/third_party/webrtc/test/BUILD.gn
index 58d3dab..4832829 100644
--- a/qtwebengine/src/3rdparty/chromium/third_party/webrtc/test/BUILD.gn
+++ b/qtwebengine/src/3rdparty/chromium/third_party/webrtc/test/BUILD.gn
@@ -258,10 +258,6 @@ rtc_library("perf_test") {
   absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]
   if (rtc_enable_protobuf) {
     sources += [ "testsupport/perf_test_histogram_writer.cc" ]
-    deps += [
-      "//third_party/catapult/tracing/tracing:histogram",
-      "//third_party/catapult/tracing/tracing:reserved_infos",
-    ]
   } else {
     sources += [ "testsupport/perf_test_histogram_writer_no_protobuf.cc" ]
   }
@@ -566,7 +562,6 @@ if (rtc_include_tests) {
 
     if (rtc_enable_protobuf) {
       sources += [ "testsupport/perf_test_histogram_writer_unittest.cc" ]
-      deps += [ "//third_party/catapult/tracing/tracing:histogram" ]
     }
 
     data = test_support_unittests_resources
diff --git a/qtwebengine/src/3rdparty/chromium/third_party/webrtc/webrtc.gni b/qtwebengine/src/3rdparty/chromium/third_party/webrtc/webrtc.gni
index ca8acdb..505c975 100644
--- a/qtwebengine/src/3rdparty/chromium/third_party/webrtc/webrtc.gni
+++ b/qtwebengine/src/3rdparty/chromium/third_party/webrtc/webrtc.gni
@@ -117,6 +117,10 @@ declare_args() {
   # Set this to link PipeWire directly instead of using the dlopen.
   rtc_link_pipewire = false
 
+  # Set this to use certain PipeWire version
+  # Currently we support PipeWire 0.2 (default) and PipeWire 0.3
+  rtc_pipewire_version = "0.3"
+
   # Enable to use the Mozilla internal settings.
   build_with_mozilla = false
 
diff --git a/qtwebengine/src/3rdparty/chromium/tools/binary_size/BUILD.gn b/qtwebengine/src/3rdparty/chromium/tools/binary_size/BUILD.gn
index e6806bf..2c985d1 100644
--- a/qtwebengine/src/3rdparty/chromium/tools/binary_size/BUILD.gn
+++ b/qtwebengine/src/3rdparty/chromium/tools/binary_size/BUILD.gn
@@ -18,7 +18,6 @@ python_library("binary_size_trybot_py") {
 python_library("sizes_py") {
   testonly = true
   pydeps_file = "sizes.pydeps"
-  data_deps = [ "//third_party/catapult/tracing:convert_chart_json" ]
 }
 
 if (is_linux || is_chromeos) {
diff --git a/qtwebengine/src/3rdparty/chromium/tools/grit/BUILD.gn b/qtwebengine/src/3rdparty/chromium/tools/grit/BUILD.gn
index 1cd3c75..60c4cf2 100644
--- a/qtwebengine/src/3rdparty/chromium/tools/grit/BUILD.gn
+++ b/qtwebengine/src/3rdparty/chromium/tools/grit/BUILD.gn
@@ -33,7 +33,6 @@ group("grit_python_unittests") {
     "//testing/scripts/run_isolated_script_test.py",
     "//testing/xvfb.py",
     "//tools/grit/",
-    "//third_party/catapult/third_party/typ/",
   ]
 }
 
diff --git a/qtwebengine/src/3rdparty/chromium/tools/grit/grit/util.py b/qtwebengine/src/3rdparty/chromium/tools/grit/grit/util.py
index 528d766..6e8cdb0 100644
--- a/qtwebengine/src/3rdparty/chromium/tools/grit/grit/util.py
+++ b/qtwebengine/src/3rdparty/chromium/tools/grit/grit/util.py
@@ -211,7 +211,7 @@ def ReadFile(filename, encoding):
     mode = 'rb'
     encoding = None
   else:
-    mode = 'rU'
+    mode = 'r'
 
   with io.open(abs(filename), mode, encoding=encoding) as f:
     return f.read()
diff --git a/qtwebengine/src/3rdparty/chromium/tools/grit/third_party/six/__init__.py b/qtwebengine/src/3rdparty/chromium/tools/grit/third_party/six/__init__.py
index 56e4272..08a24bc 100644
--- a/qtwebengine/src/3rdparty/chromium/tools/grit/third_party/six/__init__.py
+++ b/qtwebengine/src/3rdparty/chromium/tools/grit/third_party/six/__init__.py
@@ -71,6 +71,11 @@ else:
             MAXSIZE = int((1 << 63) - 1)
         del X
 
+if PY34:
+    from importlib.util import spec_from_loader
+else:
+    spec_from_loader = None
+
 
 def _add_doc(func, doc):
     """Add documentation to a function."""
@@ -186,6 +191,11 @@ class _SixMetaPathImporter(object):
             return self
         return None
 
+    def find_spec(self, fullname, path, target=None):
+        if fullname in self.known_modules:
+            return spec_from_loader(fullname, self)
+        return None
+
     def __get_module(self, fullname):
         try:
             return self.known_modules[fullname]
diff --git a/qtwebengine/src/3rdparty/chromium/tools/gritsettings/resource_ids.spec b/qtwebengine/src/3rdparty/chromium/tools/gritsettings/resource_ids.spec
index d0a4545..80b0bf1 100644
--- a/qtwebengine/src/3rdparty/chromium/tools/gritsettings/resource_ids.spec
+++ b/qtwebengine/src/3rdparty/chromium/tools/gritsettings/resource_ids.spec
@@ -499,12 +499,6 @@
   "content/shell/shell_resources.grd": {
     "includes": [2940],
   },
-
-  # This file is generated during the build.
-  "<(SHARED_INTERMEDIATE_DIR)/content/browser/tracing/tracing_resources.grd": {
-    "META": {"sizes": {"includes": [20],}},
-    "includes": [2960],
-  },
   # END content/ section.
 
   # START ios/web/ section.
diff --git a/qtwebengine/src/3rdparty/chromium/tools/metrics/structured/model.py b/qtwebengine/src/3rdparty/chromium/tools/metrics/structured/model.py
index 2d90bf2..befea2e 100644
--- a/qtwebengine/src/3rdparty/chromium/tools/metrics/structured/model.py
+++ b/qtwebengine/src/3rdparty/chromium/tools/metrics/structured/model.py
@@ -26,7 +26,7 @@ _METRIC_TYPE =  models.ObjectNodeType(
     'metric',
     attributes=[
       ('name', unicode, r'^[A-Za-z0-9_.]+$'),
-      ('kind', unicode, r'^(?i)(|hashed-string|int)$'),
+      ('kind', unicode, r'(?i)^(|hashed-string|int)$'),
     ],
     alphabetization=[
         (_OBSOLETE_TYPE.tag, lambda _: 1),
diff --git a/qtwebengine/src/3rdparty/chromium/tools/metrics/ukm/gen_builders.py b/qtwebengine/src/3rdparty/chromium/tools/metrics/ukm/gen_builders.py
index f9f61d9..44e46fa 100755
--- a/qtwebengine/src/3rdparty/chromium/tools/metrics/ukm/gen_builders.py
+++ b/qtwebengine/src/3rdparty/chromium/tools/metrics/ukm/gen_builders.py
@@ -48,9 +48,10 @@ def ReadFilteredData(path):
     data = ukm_model.UKM_XML_TYPE.Parse(ukm_file.read())
     event_tag = ukm_model._EVENT_TYPE.tag
     metric_tag = ukm_model._METRIC_TYPE.tag
-    data[event_tag] = filter(ukm_model.IsNotObsolete, data[event_tag])
+    data[event_tag] = list(filter(ukm_model.IsNotObsolete, data[event_tag]))
     for event in data[event_tag]:
-      event[metric_tag] = filter(ukm_model.IsNotObsolete, event[metric_tag])
+      event[metric_tag] = list(
+          filter(ukm_model.IsNotObsolete, event[metric_tag]))
     return data
 
 
diff --git a/qtwebengine/src/3rdparty/chromium/tools/metrics/ukm/ukm_model.py b/qtwebengine/src/3rdparty/chromium/tools/metrics/ukm/ukm_model.py
index ec24dd5..57decab 100644
--- a/qtwebengine/src/3rdparty/chromium/tools/metrics/ukm/ukm_model.py
+++ b/qtwebengine/src/3rdparty/chromium/tools/metrics/ukm/ukm_model.py
@@ -42,7 +42,7 @@ _INDEX_TYPE = models.ObjectNodeType(
 _STATISTICS_TYPE =  models.ObjectNodeType(
     'statistics',
     attributes=[
-      ('export', str, r'^(?i)(|true|false)$'),
+      ('export', str, r'(?i)^(|true|false)$'),
     ],
     children=[
         models.ChildType(_QUANTILES_TYPE.tag, _QUANTILES_TYPE, multiple=False),
@@ -94,7 +94,7 @@ _EVENT_TYPE =  models.ObjectNodeType(
     'event',
     attributes=[
       ('name', str, r'^[A-Za-z0-9.]+$'),
-      ('singular', str, r'^(?i)(|true|false)$'),
+      ('singular', str, r'(?i)^(|true|false)$'),
     ],
     alphabetization=[
         (_OBSOLETE_TYPE.tag, _KEEP_ORDER),
diff --git a/qtwebengine/src/3rdparty/chromium/tools/metrics/BUILD.gn b/qtwebengine/src/3rdparty/chromium/tools/metrics/BUILD.gn
index 846d524..cb57d2b 100644
--- a/qtwebengine/src/3rdparty/chromium/tools/metrics/BUILD.gn
+++ b/qtwebengine/src/3rdparty/chromium/tools/metrics/BUILD.gn
@@ -56,7 +56,6 @@ group("metrics_python_tests") {
     "//testing/scripts/common.py",
     "//testing/xvfb.py",
     "//testing/test_env.py",
-    "//third_party/catapult/third_party/typ/",
 
     # Scripts we depend on. Their unit tests are also included.
     "//tools/json_comment_eater/json_comment_eater.py",
diff --git a/qtwebengine/src/3rdparty/chromium/tools/perf/chrome_telemetry_build/BUILD.gn b/qtwebengine/src/3rdparty/chromium/tools/perf/chrome_telemetry_build/BUILD.gn
index 280bb75..c287fdc 100644
--- a/qtwebengine/src/3rdparty/chromium/tools/perf/chrome_telemetry_build/BUILD.gn
+++ b/qtwebengine/src/3rdparty/chromium/tools/perf/chrome_telemetry_build/BUILD.gn
@@ -107,7 +107,6 @@ group("telemetry_chrome_test_without_chrome") {
     "//tools/perf/core/",  # chrome_telemetry_build/ depends on core/
   ]
   data_deps = [
-    "//third_party/catapult:telemetry_chrome_test_support",
     "//tools/metrics:metrics_python_tests",
   ]
 
@@ -151,7 +150,5 @@ group("telemetry_chrome_test_without_chrome") {
       "//build/android:devil_chromium_py",
       "//build/android:stack_tools",
     ]
-  } else if (!is_fuchsia) {
-    data_deps += [ "//third_party/catapult/telemetry:bitmaptools" ]
   }
 }
diff --git a/qtwebengine/src/3rdparty/chromium/tools/perf/core/perfetto_binary_roller/BUILD.gn b/qtwebengine/src/3rdparty/chromium/tools/perf/core/perfetto_binary_roller/BUILD.gn
index 7fe48cb..e9c7f02 100644
--- a/qtwebengine/src/3rdparty/chromium/tools/perf/core/perfetto_binary_roller/BUILD.gn
+++ b/qtwebengine/src/3rdparty/chromium/tools/perf/core/perfetto_binary_roller/BUILD.gn
@@ -7,7 +7,6 @@ import("//build/util/generate_wrapper.gni")
 generate_wrapper("upload_trace_processor") {
   testonly = true
   data_deps = [
-    "//third_party/catapult:telemetry_chrome_test_support",
     "//third_party/perfetto/src/trace_processor:trace_processor_shell",
   ]
   data = [
diff --git a/qtwebengine/src/3rdparty/chromium/tools/polymer/BUILD.gn b/qtwebengine/src/3rdparty/chromium/tools/polymer/BUILD.gn
index 092066b..d115144 100644
--- a/qtwebengine/src/3rdparty/chromium/tools/polymer/BUILD.gn
+++ b/qtwebengine/src/3rdparty/chromium/tools/polymer/BUILD.gn
@@ -10,6 +10,5 @@ group("polymer_tools_python_unittests") {
     "//testing/scripts/run_isolated_script_test.py",
     "//testing/xvfb.py",
     "//tools/polymer/",
-    "//third_party/catapult/third_party/typ/",
   ]
 }
diff --git a/qtwebengine/src/3rdparty/chromium/ui/base/ime/character_composer.cc b/qtwebengine/src/3rdparty/chromium/ui/base/ime/character_composer.cc
index ab03a0a..8b70539 100644
--- a/qtwebengine/src/3rdparty/chromium/ui/base/ime/character_composer.cc
+++ b/qtwebengine/src/3rdparty/chromium/ui/base/ime/character_composer.cc
@@ -13,7 +13,7 @@
 #include "base/strings/string_util.h"
 #include "base/strings/utf_string_conversion_utils.h"
 #include "base/strings/utf_string_conversions.h"
-#include "base/third_party/icu/icu_utf.h"
+#include <unicode/utf.h>
 #include "ui/events/event.h"
 #include "ui/events/keycodes/dom/dom_key.h"
 #include "ui/events/keycodes/dom/keycode_converter.h"
@@ -37,12 +37,12 @@ bool CheckCharacterComposeTable(
 bool UTF32CharacterToUTF16(uint32_t character, base::string16* output) {
   output->clear();
   // Reject invalid character. (e.g. codepoint greater than 0x10ffff)
-  if (!CBU_IS_UNICODE_CHAR(character))
+  if (!U_IS_UNICODE_CHAR(character))
     return false;
   if (character) {
-    output->resize(CBU16_LENGTH(character));
+    output->resize(U16_LENGTH(character));
     size_t i = 0;
-    CBU16_APPEND_UNSAFE(&(*output)[0], i, character);
+    U16_APPEND_UNSAFE(&(*output)[0], i, character);
   }
   return true;
 }
diff --git a/qtwebengine/src/3rdparty/chromium/ui/gfx/utf16_indexing.cc b/qtwebengine/src/3rdparty/chromium/ui/gfx/utf16_indexing.cc
index 4515ff6..48a9027 100644
--- a/qtwebengine/src/3rdparty/chromium/ui/gfx/utf16_indexing.cc
+++ b/qtwebengine/src/3rdparty/chromium/ui/gfx/utf16_indexing.cc
@@ -5,13 +5,13 @@
 #include "ui/gfx/utf16_indexing.h"
 
 #include "base/check_op.h"
-#include "base/third_party/icu/icu_utf.h"
+#include <unicode/utf.h>
 
 namespace gfx {
 
 bool IsValidCodePointIndex(const base::string16& s, size_t index) {
   return index == 0 || index == s.length() ||
-    !(CBU16_IS_TRAIL(s[index]) && CBU16_IS_LEAD(s[index - 1]));
+    !(U16_IS_TRAIL(s[index]) && U16_IS_LEAD(s[index - 1]));
 }
 
 ptrdiff_t UTF16IndexToOffset(const base::string16& s, size_t base, size_t pos) {
diff --git a/qtwebengine/src/3rdparty/chromium/ui/ozone/generate_constructor_list.py b/qtwebengine/src/3rdparty/chromium/ui/ozone/generate_constructor_list.py
index 8d80063..04fa18e 100755
--- a/qtwebengine/src/3rdparty/chromium/ui/ozone/generate_constructor_list.py
+++ b/qtwebengine/src/3rdparty/chromium/ui/ozone/generate_constructor_list.py
@@ -45,12 +45,15 @@ Example Output: ./ui/ozone/generate_constructor_list.py \
   }  // namespace ui
 """
 
+try:
+    from StringIO import StringIO  # for Python 2
+except ImportError:
+    from io import StringIO  # for Python 3
 import optparse
 import os
 import collections
 import re
 import sys
-import string
 
 
 def GetTypedefName(typename):
@@ -68,7 +71,7 @@ def GetConstructorName(typename, platform):
   This is just "Create" + typename + platform.
   """
 
-  return 'Create' + typename + string.capitalize(platform)
+  return 'Create' + typename + platform.capitalize()
 
 
 def GenerateConstructorList(out, namespace, export, typenames, platforms,
@@ -163,12 +166,14 @@ def main(argv):
     sys.exit(1)
 
   # Write to standard output or file specified by --output_cc.
-  out_cc = sys.stdout
+  out_cc = getattr(sys.stdout, 'buffer', sys.stdout)
   if options.output_cc:
     out_cc = open(options.output_cc, 'wb')
 
-  GenerateConstructorList(out_cc, options.namespace, options.export,
+  out_cc_str = StringIO()
+  GenerateConstructorList(out_cc_str, options.namespace, options.export,
                           typenames, platforms, includes, usings)
+  out_cc.write(out_cc_str.getvalue().encode('utf-8'))
 
   if options.output_cc:
     out_cc.close()
diff --git a/qtwebengine/src/3rdparty/chromium/ui/ozone/generate_ozone_platform_list.py b/qtwebengine/src/3rdparty/chromium/ui/ozone/generate_ozone_platform_list.py
index d47c398..2702b68 100755
--- a/qtwebengine/src/3rdparty/chromium/ui/ozone/generate_ozone_platform_list.py
+++ b/qtwebengine/src/3rdparty/chromium/ui/ozone/generate_ozone_platform_list.py
@@ -49,12 +49,15 @@ Example Output: ./generate_ozone_platform_list.py --default wayland dri wayland
 
 """
 
+try:
+    from StringIO import StringIO  # for Python 2
+except ImportError:
+    from io import StringIO  # for Python 3
 import optparse
 import os
 import collections
 import re
 import sys
-import string
 
 
 def GetConstantName(name):
@@ -63,7 +66,7 @@ def GetConstantName(name):
   We just capitalize the platform name and prepend "CreateOzonePlatform".
   """
 
-  return 'kPlatform' + string.capitalize(name)
+  return 'kPlatform' + name.capitalize()
 
 
 def GeneratePlatformListText(out, platforms):
@@ -149,9 +152,9 @@ def main(argv):
     platforms.insert(0, options.default)
 
   # Write to standard output or file specified by --output_{cc,h}.
-  out_cc = sys.stdout
-  out_h = sys.stdout
-  out_txt = sys.stdout
+  out_cc = getattr(sys.stdout, 'buffer', sys.stdout)
+  out_h = getattr(sys.stdout, 'buffer', sys.stdout)
+  out_txt = getattr(sys.stdout, 'buffer', sys.stdout)
   if options.output_cc:
     out_cc = open(options.output_cc, 'wb')
   if options.output_h:
@@ -159,9 +162,16 @@ def main(argv):
   if options.output_txt:
     out_txt = open(options.output_txt, 'wb')
 
-  GeneratePlatformListText(out_txt, platforms)
-  GeneratePlatformListHeader(out_h, platforms)
-  GeneratePlatformListSource(out_cc, platforms)
+  out_txt_str = StringIO()
+  out_h_str = StringIO()
+  out_cc_str = StringIO()
+
+  GeneratePlatformListText(out_txt_str, platforms)
+  out_txt.write(out_txt_str.getvalue().encode('utf-8'))
+  GeneratePlatformListHeader(out_h_str, platforms)
+  out_h.write(out_h_str.getvalue().encode('utf-8'))
+  GeneratePlatformListSource(out_cc_str, platforms)
+  out_cc.write(out_cc_str.getvalue().encode('utf-8'))
 
   if options.output_cc:
     out_cc.close()
diff --git a/qtwebengine/src/3rdparty/chromium/v8/include/v8-internal.h b/qtwebengine/src/3rdparty/chromium/v8/include/v8-internal.h
index 0d9cce8..d38ab81 100644
--- a/qtwebengine/src/3rdparty/chromium/v8/include/v8-internal.h
+++ b/qtwebengine/src/3rdparty/chromium/v8/include/v8-internal.h
@@ -196,7 +196,7 @@ class Internals {
 
   static const int kNodeClassIdOffset = 1 * kApiSystemPointerSize;
   static const int kNodeFlagsOffset = 1 * kApiSystemPointerSize + 3;
-  static const int kNodeStateMask = 0x7;
+  static const int kNodeStateMask = 0x3;
   static const int kNodeStateIsWeakValue = 2;
   static const int kNodeStateIsPendingValue = 3;
 
diff --git a/qtwebengine/src/3rdparty/chromium/v8/src/ast/ast.h b/qtwebengine/src/3rdparty/chromium/v8/src/ast/ast.h
index 4213c60..3106a75 100644
--- a/qtwebengine/src/3rdparty/chromium/v8/src/ast/ast.h
+++ b/qtwebengine/src/3rdparty/chromium/v8/src/ast/ast.h
@@ -998,7 +998,7 @@ class Literal final : public Expression {
   friend class AstNodeFactory;
   friend Zone;
 
-  using TypeField = Expression::NextBitField<Type, 4>;
+  using TypeField = Expression::NextBitField<Type, 3>;
 
   Literal(int smi, int position) : Expression(position, kLiteral), smi_(smi) {
     bit_field_ = TypeField::update(bit_field_, kSmi);
diff --git a/qtwebengine/src/3rdparty/chromium/v8/src/compiler/backend/instruction-codes.h b/qtwebengine/src/3rdparty/chromium/v8/src/compiler/backend/instruction-codes.h
index 8772a78..7552f53 100644
--- a/qtwebengine/src/3rdparty/chromium/v8/src/compiler/backend/instruction-codes.h
+++ b/qtwebengine/src/3rdparty/chromium/v8/src/compiler/backend/instruction-codes.h
@@ -187,7 +187,7 @@ V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream& os,
   V(None)                       \
   TARGET_ADDRESSING_MODE_LIST(V)
 
-enum AddressingMode {
+enum AddressingMode : uint8_t {
 #define DECLARE_ADDRESSING_MODE(Name) kMode_##Name,
   ADDRESSING_MODE_LIST(DECLARE_ADDRESSING_MODE)
 #undef DECLARE_ADDRESSING_MODE
diff --git a/qtwebengine/src/3rdparty/chromium/v8/src/compiler/backend/instruction.h b/qtwebengine/src/3rdparty/chromium/v8/src/compiler/backend/instruction.h
index 0419928..7098a73 100644
--- a/qtwebengine/src/3rdparty/chromium/v8/src/compiler/backend/instruction.h
+++ b/qtwebengine/src/3rdparty/chromium/v8/src/compiler/backend/instruction.h
@@ -563,8 +563,8 @@ class LocationOperand : public InstructionOperand {
   }
 
   STATIC_ASSERT(KindField::kSize == 3);
-  using LocationKindField = base::BitField64<LocationKind, 3, 2>;
-  using RepresentationField = base::BitField64<MachineRepresentation, 5, 8>;
+  using LocationKindField = base::BitField64<LocationKind, 3, 1>;
+  using RepresentationField = LocationKindField::Next<MachineRepresentation, 8>;
   using IndexField = base::BitField64<int32_t, 35, 29>;
 };
 
diff --git a/qtwebengine/src/3rdparty/chromium/v8/src/handles/global-handles.cc b/qtwebengine/src/3rdparty/chromium/v8/src/handles/global-handles.cc
index 7a91116..560b0de 100644
--- a/qtwebengine/src/3rdparty/chromium/v8/src/handles/global-handles.cc
+++ b/qtwebengine/src/3rdparty/chromium/v8/src/handles/global-handles.cc
@@ -407,8 +407,8 @@ class GlobalHandles::Node final : public NodeBase<GlobalHandles::Node> {
   };
 
   Node() {
-    STATIC_ASSERT(static_cast<int>(NodeState::kMask) ==
-                  Internals::kNodeStateMask);
+    /*STATIC_ASSERT(static_cast<int>(NodeState::kMask) ==
+                  Internals::kNodeStateMask);*/
     STATIC_ASSERT(WEAK == Internals::kNodeStateIsWeakValue);
     STATIC_ASSERT(PENDING == Internals::kNodeStateIsPendingValue);
     set_in_young_list(false);
diff --git a/qtwebengine/src/3rdparty/chromium/v8/src/logging/code-events.h b/qtwebengine/src/3rdparty/chromium/v8/src/logging/code-events.h
index b3fb960..8413ea0 100644
--- a/qtwebengine/src/3rdparty/chromium/v8/src/logging/code-events.h
+++ b/qtwebengine/src/3rdparty/chromium/v8/src/logging/code-events.h
@@ -65,7 +65,7 @@ using WasmName = Vector<const char>;
 class CodeEventListener {
  public:
 #define DECLARE_ENUM(enum_item, _) enum_item,
-  enum LogEventsAndTags {
+  enum LogEventsAndTags: uint8_t {
     LOG_EVENTS_AND_TAGS_LIST(DECLARE_ENUM) NUMBER_OF_LOG_EVENTS
   };
 #undef DECLARE_ENUM
diff --git a/qtwebengine/src/3rdparty/chromium/v8/src/snapshot/references.h b/qtwebengine/src/3rdparty/chromium/v8/src/snapshot/references.h
index eed4def..0601235 100644
--- a/qtwebengine/src/3rdparty/chromium/v8/src/snapshot/references.h
+++ b/qtwebengine/src/3rdparty/chromium/v8/src/snapshot/references.h
@@ -37,7 +37,7 @@ constexpr bool IsPreAllocatedSpace(SnapshotSpace space) {
 
 class SerializerReference {
  private:
-  enum SpecialValueType {
+  enum SpecialValueType: uint8_t {
     kInvalidValue,
     kAttachedReference,
     kOffHeapBackingStore,
diff --git a/qtwebengine/src/3rdparty/chromium/v8/src/wasm/wasm-code-manager.h b/qtwebengine/src/3rdparty/chromium/v8/src/wasm/wasm-code-manager.h
index 5e8ed54..c96f435 100644
--- a/qtwebengine/src/3rdparty/chromium/v8/src/wasm/wasm-code-manager.h
+++ b/qtwebengine/src/3rdparty/chromium/v8/src/wasm/wasm-code-manager.h
@@ -333,7 +333,7 @@ class V8_EXPORT_PRIVATE WasmCode final {
   int trap_handler_index_ = -1;
 
   // Bits encoded in {flags_}:
-  using KindField = base::BitField8<Kind, 0, 3>;
+  using KindField = base::BitField8<Kind, 0, 2>;
   using ExecutionTierField = KindField::Next<ExecutionTier, 2>;
   using ForDebuggingField = ExecutionTierField::Next<ForDebugging, 2>;
 
diff --git a/qtwebengine/src/3rdparty/chromium/v8/tools/BUILD.gn b/qtwebengine/src/3rdparty/chromium/v8/tools/BUILD.gn
index 2f8197d..83304b6 100644
--- a/qtwebengine/src/3rdparty/chromium/v8/tools/BUILD.gn
+++ b/qtwebengine/src/3rdparty/chromium/v8/tools/BUILD.gn
@@ -31,10 +31,6 @@ group("v8_android_test_runner_deps") {
 
   if (is_android && !build_with_chromium) {
     data_deps = [ "//build/android:test_runner_py" ]
-    data = [
-      # This is used by android.py, but not included by test_runner_py above.
-      "//third_party/catapult/devil/devil/android/perf/",
-    ]
   }
 }
 
diff --git a/qtwebengine/src/3rdparty/chromium/v8/BUILD.gn b/qtwebengine/src/3rdparty/chromium/v8/BUILD.gn
index ba99c75..c3013fd 100644
--- a/qtwebengine/src/3rdparty/chromium/v8/BUILD.gn
+++ b/qtwebengine/src/3rdparty/chromium/v8/BUILD.gn
@@ -898,7 +898,7 @@ config("toolchain") {
 
   if (is_clang) {
     cflags += [ "-Wmissing-field-initializers" ]
-
+    
     if (v8_current_cpu != "mips" && v8_current_cpu != "mipsel") {
       # We exclude MIPS because the IsMipsArchVariant macro causes trouble.
       cflags += [ "-Wunreachable-code" ]
diff --git a/qtwebengine/src/3rdparty/chromium/weblayer/shell/BUILD.gn b/qtwebengine/src/3rdparty/chromium/weblayer/shell/BUILD.gn
index 66984a7..1815fad 100644
--- a/qtwebengine/src/3rdparty/chromium/weblayer/shell/BUILD.gn
+++ b/qtwebengine/src/3rdparty/chromium/weblayer/shell/BUILD.gn
@@ -161,7 +161,6 @@ repack("support_pak") {
     "$root_gen_dir/components/strings/components_locale_settings_en-US.pak",
     "$root_gen_dir/components/strings/components_strings_en-US.pak",
     "$root_gen_dir/content/app/resources/content_resources_100_percent.pak",
-    "$root_gen_dir/content/browser/tracing/tracing_resources.pak",
     "$root_gen_dir/content/content_resources.pak",
     "$root_gen_dir/content/dev_ui_content_resources.pak",
     "$root_gen_dir/mojo/public/js/mojo_bindings_resources.pak",
@@ -182,7 +181,6 @@ repack("support_pak") {
     "//content:content_resources",
     "//content:dev_ui_content_resources",
     "//content/app/resources",
-    "//content/browser/tracing:resources",
     "//mojo/public/js:resources",
     "//net:net_resources",
     "//third_party/blink/public:resources",
diff --git a/qtwebengine/src/3rdparty/chromium/BUILD.gn b/qtwebengine/src/3rdparty/chromium/BUILD.gn
index 8d9657d..59e9447 100644
--- a/qtwebengine/src/3rdparty/chromium/BUILD.gn
+++ b/qtwebengine/src/3rdparty/chromium/BUILD.gn
@@ -239,7 +239,6 @@ group("gn_all") {
       "//media/capture:capture_unittests",
       "//media/cast:cast_unittests",
       "//third_party/angle/src/tests:angle_white_box_tests",
-      "//third_party/catapult/telemetry:bitmaptools($host_toolchain)",
     ]
   } else if (is_ios && !use_qt) {
     deps += [
@@ -354,7 +353,6 @@ group("gn_all") {
       "//net/android:net_junit_tests",
       "//services:services_junit_tests",
       "//testing/android/junit:junit_unit_tests",
-      "//third_party/catapult/devil",
       "//third_party/smhasher:murmurhash3",
       "//tools/android:android_tools",
       "//tools/android:memconsumer",
@@ -959,7 +957,6 @@ if (is_chromeos) {
       "//third_party/dawn/src/tests:dawn_unittests",
 
       # Blocked on https://github.com/catapult-project/catapult/issues/2297
-      #"//third_party/catapult/telemetry:bitmaptools",
       "//tools/perf/clear_system_cache",
       "//ui/ozone/gl:ozone_gl_unittests",
     ]
@@ -1037,7 +1034,6 @@ if (!is_ios && !use_qt) {
       data_deps = [
         "//chrome:chrome",
         "//chrome/test/chromedriver",
-        "//third_party/catapult/third_party/typ",
       ]
       if (is_win) {
         data_deps += [ "//build/win:copy_cdb_to_output" ]
@@ -1084,7 +1080,6 @@ if (!is_ios && !use_qt) {
       "//third_party/blink/public:blink_devtools_inspector_resources",
       "//third_party/blink/public/mojom:mojom_platform_js_data_deps",
       "//third_party/blink/renderer/core/html:js_files_for_form_controls_web_tests",
-      "//third_party/catapult/third_party/typ",
       "//third_party/mesa_headers",
       "//tools/imagediff",
     ]
@@ -1152,7 +1147,6 @@ if (!is_ios && !use_qt) {
 
     if (is_android) {
       data += [
-        "//third_party/catapult/",
         "//build/android/",
       ]
     }
@@ -1259,11 +1253,6 @@ if (!is_ios && !use_qt) {
       "//third_party/blink/web_tests/StaleTestExpectations",
       "//third_party/blink/web_tests/TestExpectations",
       "//third_party/blink/web_tests/VirtualTestSuites",
-      "//third_party/catapult/common/py_utils/",
-      "//third_party/catapult/devil/",
-      "//third_party/catapult/dependency_manager/",
-      "//third_party/catapult/third_party/zipfile/",
-      "//third_party/catapult/third_party/typ/",
       "//third_party/depot_tools/pylint",
       "//third_party/depot_tools/pylint-1.5",
       "//third_party/depot_tools/pylint_main.py",
diff --git a/qtwebengine/src/buildtools/config/linux.pri b/qtwebengine/src/buildtools/config/linux.pri
index 7507d51..ebe4def 100644
--- a/qtwebengine/src/buildtools/config/linux.pri
+++ b/qtwebengine/src/buildtools/config/linux.pri
@@ -164,6 +164,11 @@ host_build {
     } else {
         gn_args += use_system_libjpeg=false
     }
+    qtConfig(webengine-system-openjpeg2) {
+        gn_args += use_system_libopenjpeg2=true
+    } else {
+        gn_args += use_system_libopenjpeg2=false
+    }
     qtConfig(webengine-system-freetype) {
         gn_args += use_system_freetype=true
     } else {
diff --git a/qtwebengine/src/buildtools/config/support.pri b/qtwebengine/src/buildtools/config/support.pri
index e7f869a..3a5743c 100644
--- a/qtwebengine/src/buildtools/config/support.pri
+++ b/qtwebengine/src/buildtools/config/support.pri
@@ -21,7 +21,7 @@ defineReplace(qtwebengine_checkWebEngineCoreError) {
     !qtwebengine_checkForGperf(QtWebEngine):return(false)
     !qtwebengine_checkForBison(QtWebEngine):return(false)
     !qtwebengine_checkForFlex(QtWebEngine):return(false)
-    !qtwebengine_checkForPython2(QtWebEngine):return(false)
+    !qtwebengine_checkForPython3(QtWebEngine):return(false)
     !qtwebengine_checkForNodejs(QtWebEngine):return(false)
     !qtwebengine_checkForSanitizer(QtWebEngine):return(false)
     linux:!qtwebengine_checkForPkgCfg(QtWebEngine):return(false)
@@ -51,7 +51,7 @@ defineReplace(qtwebengine_checkPdfError) {
     !qtwebengine_checkForGperf(QtPdf):return(false)
     !qtwebengine_checkForBison(QtPdf):return(false)
     !qtwebengine_checkForFlex(QtPdf):return(false)
-    !qtwebengine_checkForPython2(QtPdf):return(false)
+    !qtwebengine_checkForPython3(QtPdf):return(false)
     !qtwebengine_checkForSanitizer(QtPdf):return(false)
     linux:!qtwebengine_checkForPkgCfg(QtPdf):return(false)
     linux:!qtwebengine_checkForHostPkgCfg(QtPdf):return(false)
@@ -143,10 +143,10 @@ defineTest(qtwebengine_checkForFlex) {
     return(true)
 }
 
-defineTest(qtwebengine_checkForPython2) {
+defineTest(qtwebengine_checkForPython3) {
     module = $$1
-    !qtConfig(webengine-python2) {
-        qtwebengine_skipBuild("Python version 2 (2.7.5 or later) is required to build $${module}.")
+    !qtConfig(webengine-python3) {
+        qtwebengine_skipBuild("Python version 3 is required to build $${module}.")
         return(false)
     }
     return(true)
diff --git a/qtwebengine/src/buildtools/configure.json b/qtwebengine/src/buildtools/configure.json
index 9e7a0c5..7bc819c 100644
--- a/qtwebengine/src/buildtools/configure.json
+++ b/qtwebengine/src/buildtools/configure.json
@@ -114,6 +114,12 @@
                 "-ljpeg"
             ]
         },
+        "webengine-openjpeg2": {
+            "label": "OpenJPEG 2",
+            "sources": [
+                { "type": "pkgConfig", "args": "libopenjp2" }
+            ]
+        },
         "webengine-libevent": {
             "label": "libevent",
             "sources": [
@@ -316,9 +322,9 @@
             "label": "system ninja",
             "type": "detectNinja"
         },
-        "webengine-python2": {
-            "label": "python2",
-            "type": "detectPython2",
+        "webengine-python3": {
+            "label": "python3",
+            "type": "detectPython3",
             "log": "location"
         },
         "webengine-winversion": {
@@ -395,7 +401,7 @@
                          && features.webengine-gperf
                          && features.webengine-bison
                          && features.webengine-flex
-                         && features.webengine-python2
+                         && features.webengine-python3
                          && features.webengine-nodejs
                          && (!config.sanitizer || features.webengine-sanitizer)
                          && (!config.linux || features.pkg-config)
@@ -421,7 +427,7 @@
                          && features.webengine-gperf
                          && features.webengine-bison
                          && features.webengine-flex
-                         && features.webengine-python2
+                         && features.webengine-python3
                          && (!config.sanitizer || features.webengine-sanitizer)
                          && (!config.linux || features.pkg-config)
                          && (!config.linux || features.webengine-host-pkg-config)
@@ -444,12 +450,12 @@
             "autoDetect": "features.private_tests",
             "output": [ "privateFeature" ]
         },
-        "webengine-python2": {
-            "label": "python2",
-            "condition": "tests.webengine-python2",
+        "webengine-python3": {
+            "label": "python3",
+            "condition": "tests.webengine-python3",
             "output": [
                 "privateFeature",
-                { "type": "varAssign", "name": "QMAKE_PYTHON2", "value": "tests.webengine-python2.location" }
+                { "type": "varAssign", "name": "QMAKE_PYTHON3", "value": "tests.webengine-python3.location" }
             ]
         },
         "webengine-gperf": {
@@ -632,6 +638,11 @@
             "condition": "config.unix && features.system-jpeg && libs.webengine-jpeglib",
             "output": [ "privateFeature" ]
         },
+        "webengine-system-openjpeg2" : {
+            "label": "OpenJPEG 2",
+            "condition": "config.unix && libs.webengine-openjpeg2",
+            "output": [ "privateFeature" ]
+        },
         "webengine-qt-jpeg" : {
            "label": "qtlibjpeg",
            "condition": "config.static && !features.system-jpeg && features.jpeg",
@@ -845,6 +856,7 @@
                         "webengine-system-lcms2",
                         "webengine-system-png",
                         "webengine-system-jpeg",
+                        "webengine-system-openjpeg2",
                         "webengine-system-harfbuzz",
                         "webengine-system-freetype"
                      ]
diff --git a/qtwebengine/src/buildtools/gn.pro b/qtwebengine/src/buildtools/gn.pro
index f94694d..4a7b354 100644
--- a/qtwebengine/src/buildtools/gn.pro
+++ b/qtwebengine/src/buildtools/gn.pro
@@ -33,7 +33,7 @@ build_pass|!debug_and_release {
             !system("$$pythonPathForSystem() $$gn_configure") {
                 error("GN generation error!")
             }
-            !system("cd $$system_quote($$system_path($$out_path)) && $$ninja_path $$basename(out)" ) {
+            !system("cd $$system_quote($$system_path($$out_path)) && $$ninja_path -v $$(NINJAJOBS) $$basename(out)" ) {
                 error("GN build error!")
             }
         }
diff --git a/qtwebengine/src/core/qtwebengine_resources.gni b/qtwebengine/src/core/qtwebengine_resources.gni
index 3bf1a5d..29fd260 100644
--- a/qtwebengine/src/core/qtwebengine_resources.gni
+++ b/qtwebengine/src/core/qtwebengine_resources.gni
@@ -27,7 +27,6 @@ repack("qtwebengine_repack_resources") {
     "$root_gen_dir/components/components_resources.pak",
     "$root_gen_dir/components/dev_ui_components_resources.pak",
     "$root_gen_dir/content/browser/resources/media/media_internals_resources.pak",
-    "$root_gen_dir/content/browser/tracing/tracing_resources.pak",
     "$root_gen_dir/content/content_resources.pak",
     "$root_gen_dir/content/dev_ui_content_resources.pak",
     "$root_gen_dir/mojo/public/js/mojo_bindings_resources.pak",
@@ -44,7 +43,6 @@ repack("qtwebengine_repack_resources") {
      "//components/resources:components_resources_grit",
      "//components/resources:dev_ui_components_resources_grit",
      "//content/browser/resources/media:media_internals_resources",
-     "//content/browser/tracing:resources",
      "//content:content_resources_grit",
      "//content:dev_ui_content_resources_grit",
      "//mojo/public/js:resources",
diff --git a/qtwebengine/configure.pri b/qtwebengine/configure.pri
index 3a33bdc..080f582 100644
--- a/qtwebengine/configure.pri
+++ b/qtwebengine/configure.pri
@@ -6,23 +6,6 @@ QTWEBENGINE_SOURCE_TREE = $$PWD
 
 equals(QMAKE_HOST.os, Windows): EXE_SUFFIX = .exe
 
-defineTest(isPythonVersionSupported) {
-    python = $$system_quote($$system_path($$1))
-    python_version = $$system('$$python -c "import sys; print(sys.version_info[0:3])"')
-    python_version ~= s/[()]//g
-    python_version = $$split(python_version, ',')
-    python_major_version = $$first(python_version)
-    greaterThan(python_major_version, 2) {
-        qtLog("Python version 3 is not supported by Chromium.")
-        return(false)
-    }
-    python_minor_version = $$member(python_version, 1)
-    python_patch_version = $$member(python_version, 2)
-    greaterThan(python_major_version, 1): greaterThan(python_minor_version, 6): greaterThan(python_patch_version, 4): return(true)
-    qtLog("Unsupported python version: $${python_major_version}.$${python_minor_version}.$${python_patch_version}.")
-    return(false)
-}
-
 defineTest(qtConfTest_detectJumboBuild) {
     mergeLimit = $$eval(config.input.merge_limit)
     mergeLimit = $$find(mergeLimit, "\\d")
@@ -52,22 +35,18 @@ defineTest(qtConfReport_jumboBuild) {
     qtConfReportPadded($${1}, $$mergeLimit)
 }
 
-defineTest(qtConfTest_detectPython2) {
-    python = $$qtConfFindInPath("python2$$EXE_SUFFIX")
+defineTest(qtConfTest_detectPython3) {
+    python = $$qtConfFindInPath("python3$$EXE_SUFFIX")
     isEmpty(python) {
-        qtLog("'python2$$EXE_SUFFIX' not found in PATH. Checking for 'python$$EXE_SUFFIX'.")
+        qtLog("'python3$$EXE_SUFFIX' not found in PATH. Checking for 'python$$EXE_SUFFIX'.")
         python = $$qtConfFindInPath("python$$EXE_SUFFIX")
     }
     isEmpty(python) {
         qtLog("'python$$EXE_SUFFIX' not found in PATH. Giving up.")
         return(false)
     }
-    !isPythonVersionSupported($$python) {
-        qtLog("A suitable Python 2 executable could not be located.")
-        return(false)
-    }
 
-    # Make tests.python2.location available in configure.json.
+    # Make tests.python3.location available in configure.json.
     $${1}.location = $$clean_path($$python)
     export($${1}.location)
     $${1}.cache += location
