chromium: fix GCC 7 related build issues

Also clean up unused patches.
This commit is contained in:
Yuriy Taraday 2018-03-09 15:27:20 +04:00
parent 922d55aae8
commit ebce42146f
6 changed files with 113 additions and 315 deletions

View file

@ -139,27 +139,43 @@ let
patches = [
./patches/nix_plugin_paths_52.patch
# To enable ChromeCast, go to chrome://flags and set "Load Media Router Component Extension" to Enabled
## Fixes Chromecast: https://bugs.chromium.org/p/chromium/issues/detail?id=734325
## TODO investigate build error
#./patches/fix_network_api_crash.patch
# As major versions are added, you can trawl the gentoo and arch repos at
# https://gitweb.gentoo.org/repo/gentoo.git/plain/www-client/chromium/
# https://git.archlinux.org/svntogit/packages.git/tree/trunk?h=packages/chromium
# for updated patches and hints about build flags
# (gentooPatch "<patch>" "0000000000000000000000000000000000000000000000000000000000000000")
] ++ optionals (versionRange "65" "66") [
(gentooPatch "chromium-stdint.patch" "037gjnc8h087g6dpxz53nqvzbpa9mq0z47h25vix9p62s9nhz2a8")
(gentooPatch "chromium-webrtc-r0.patch" "0wp4zivbv2wpgiwmiznbq1aw4w98mvwjvdy36cpfmnvr8yw430pd")
(gentooPatch "chromium-math.h-r0.patch" "0dlzbdj0lvp9qklgifsvgbn6p1ppxbl3hkwqqqfsw1d9jka9wy8x")
# To enable ChromeCast, go to chrome://flags and set "Load Media Router Component Extension" to Enabled
# Fixes Chromecast: https://bugs.chromium.org/p/chromium/issues/detail?id=734325
(githubPatch "1517db71cccaec48a05cdf30208e0cba7ab9b9a8" "08ac502cwwb05ml3w4wzn66i5c2d1h22xs5rzszwlnhxckxfc0fk")
# GCC 7 fixes
(githubPatch "f64fadcd79aebe5ed893ecbf258d1123609d28f8" "1h255w1v327r08cnifs19s4bwmkinqjmdmbwihddc5dyl43sjnvv")
(githubPatch "4d8468a07f374c11425494271256151fb6fe0c34" "0kqqq8kj0zv5bi1n9mm0vnn8wsgi98mjmj7snpav21fh3pgiqjrm")
(githubPatch "ede5178322ccd297b0ad82ae4c59119ceaab9ea5" "0rsal0dy0yhgs4lhn8h1vy1s77xcssy4f5wals7hvrz5m08jqizj")
(githubPatch "7d721f438acb38db556ae9a9e6e8b718bd503216" "13lzvxm63zq3rd8p387ylq4bm9wr4r09vk2w4p81f838pf0v1kbj")
# Following commit doesn't apply cleanly to stable branch, replace with handcrafted one
#(githubPatch "4f2b52281ce1649ea8347489443965ad33262ecc" "1g59izkicn9cpcphamdgrijs306h5b9i7i4pmy134asn1ifiax5z")
./patches/PlaybackImageProvider-copy-constructor.patch
# * base/optional.h
(githubPatch "f1c8789c71dbdaeeef98ecd52c9715495824e6b0" "0w3d82s10cl10r6zq9vpsscmdhbdkcy0vbdiqy5pvbr031nfxw5w")
(githubPatch "5cae9645215d02cb1f986a181a208f8a4817fc86" "052y0f9nwq6y6jh2gvr1pm8qdcqghyi3jj5svvrp5aqirlkwb7ri")
# * ConfigurationPolicyProviders
(githubPatch "1ee888aed9f9a6291570ce360bcdd2d06bcc68cb" "1bm34p3bsny44sk60j842ghhhx8qaibwpqnfnyndfj96f7nb2az0")
(githubPatch "76da73abaeede740fc97479c09c92a52972bc477" "03rkf514ddj9d32d3zfcnf96kzzdk6cwxvrqj8acyv93vp1hvckr")
#(gentooPatch "<patch>" "0000000000000000000000000000000000000000000000000000000000000000")
] ++ optionals (versionRange "66" "67") [
(gentooPatch "chromium-stdint.patch" "037gjnc8h087g6dpxz53nqvzbpa9mq0z47h25vix9p62s9nhz2a8")
(gentooPatch "chromium-webrtc-r0.patch" "0wp4zivbv2wpgiwmiznbq1aw4w98mvwjvdy36cpfmnvr8yw430pd")
(gentooPatch "chromium-math.h-r0.patch" "0dlzbdj0lvp9qklgifsvgbn6p1ppxbl3hkwqqqfsw1d9jka9wy8x")
(gentooPatch "chromium-ffmpeg-r1.patch" "1k8agaqsvg0w0s6s5wh346ih02cc86vr0vwyshw2q9vafa0jvmq4")
# GCC 7 fixes
(githubPatch "f64fadcd79aebe5ed893ecbf258d1123609d28f8" "1h255w1v327r08cnifs19s4bwmkinqjmdmbwihddc5dyl43sjnvv")
(githubPatch "ede5178322ccd297b0ad82ae4c59119ceaab9ea5" "0rsal0dy0yhgs4lhn8h1vy1s77xcssy4f5wals7hvrz5m08jqizj")
(githubPatch "7d721f438acb38db556ae9a9e6e8b718bd503216" "13lzvxm63zq3rd8p387ylq4bm9wr4r09vk2w4p81f838pf0v1kbj")
(githubPatch "ba4141e451f4e0b1b19410b1b503bd32e150df06" "1cjxw1f9fin6z12b0mcxnxf2mdjb0n3chwz7mgvmp9yij8qhqnxj")
(githubPatch "b34ed1e6524479d61ee944ebf6ca7389ea47e563" "1s13zw93nsyr259dzck6gbhg4x46qg5sg14djf4bvrrc6hlkiczw")
(githubPatch "4f2b52281ce1649ea8347489443965ad33262ecc" "1g59izkicn9cpcphamdgrijs306h5b9i7i4pmy134asn1ifiax5z")
] ++ optional enableWideVine ./patches/widevine.patch;
postPatch = ''

View file

@ -0,0 +1,89 @@
--- a/cc/raster/playback_image_provider.cc
+++ b/cc/raster/playback_image_provider.cc
@@ -20,7 +20,7 @@
PlaybackImageProvider::PlaybackImageProvider(
ImageDecodeCache* cache,
const gfx::ColorSpace& target_color_space,
- base::Optional<Settings> settings)
+ base::Optional<Settings>&& settings)
: cache_(cache),
target_color_space_(target_color_space),
settings_(std::move(settings)) {
@@ -70,7 +70,10 @@
}
PlaybackImageProvider::Settings::Settings() = default;
-PlaybackImageProvider::Settings::Settings(const Settings& other) = default;
+PlaybackImageProvider::Settings::Settings(PlaybackImageProvider::Settings&&) =
+ default;
PlaybackImageProvider::Settings::~Settings() = default;
+PlaybackImageProvider::Settings& PlaybackImageProvider::Settings::operator=(
+ PlaybackImageProvider::Settings&&) = default;
} // namespace cc
--- a/cc/raster/playback_image_provider.h
+++ b/cc/raster/playback_image_provider.h
@@ -20,8 +20,10 @@
public:
struct CC_EXPORT Settings {
Settings();
- Settings(const Settings& other);
+ Settings(const Settings&) = delete;
+ Settings(Settings&&);
~Settings();
+ Settings& operator=(Settings&&);
// The set of image ids to skip during raster.
PaintImageIdFlatSet images_to_skip;
@@ -34,7 +36,7 @@
// If no settings are provided, all images are skipped during rasterization.
PlaybackImageProvider(ImageDecodeCache* cache,
const gfx::ColorSpace& target_color_space,
- base::Optional<Settings> settings);
+ base::Optional<Settings>&& settings);
~PlaybackImageProvider() override;
PlaybackImageProvider(PlaybackImageProvider&& other);
--- a/cc/raster/playback_image_provider_unittest.cc
+++ b/cc/raster/playback_image_provider_unittest.cc
@@ -84,7 +84,8 @@ TEST(PlaybackImageProviderTest, SkipsSomeImages) {
settings.emplace();
settings->images_to_skip = {skip_image.stable_id()};
- PlaybackImageProvider provider(&cache, gfx::ColorSpace(), settings);
+ PlaybackImageProvider provider(&cache, gfx::ColorSpace(),
+ std::move(settings));
provider.BeginRaster();
SkIRect rect = SkIRect::MakeWH(10, 10);
@@ -100,7 +101,8 @@ TEST(PlaybackImageProviderTest, RefAndUnrefDecode) {
base::Optional<PlaybackImageProvider::Settings> settings;
settings.emplace();
- PlaybackImageProvider provider(&cache, gfx::ColorSpace(), settings);
+ PlaybackImageProvider provider(&cache, gfx::ColorSpace(),
+ std::move(settings));
provider.BeginRaster();
{
@@ -133,7 +135,8 @@ TEST(PlaybackImageProviderTest, AtRasterImages) {
settings.emplace();
settings->at_raster_images = {draw_image1, draw_image2};
- PlaybackImageProvider provider(&cache, gfx::ColorSpace(), settings);
+ PlaybackImageProvider provider(&cache, gfx::ColorSpace(),
+ std::move(settings));
EXPECT_EQ(cache.refed_image_count(), 0);
provider.BeginRaster();
@@ -158,7 +161,8 @@ TEST(PlaybackImageProviderTest, SwapsGivenFrames) {
settings.emplace();
settings->image_to_current_frame_index = image_to_frame;
- PlaybackImageProvider provider(&cache, gfx::ColorSpace(), settings);
+ PlaybackImageProvider provider(&cache, gfx::ColorSpace(),
+ std::move(settings));
provider.BeginRaster();
SkIRect rect = SkIRect::MakeWH(10, 10);

View file

@ -1,98 +0,0 @@
--- a/third_party/WebKit/Source/platform/wtf/typed_arrays/ArrayBufferContents.h
+++ b/third_party/WebKit/Source/platform/wtf/typed_arrays/ArrayBufferContents.h
@@ -63,7 +63,7 @@ class WTF_EXPORT ArrayBufferContents {
allocation_length_(0),
data_(data),
data_length_(0),
- kind_(AllocationKind::kNormal),
+ kind_(WTF::ArrayBufferContents::AllocationKind::kNormal),
deleter_(deleter) {}
DataHandle(void* allocation_base,
size_t allocation_length,
@@ -94,11 +94,11 @@ class WTF_EXPORT ArrayBufferContents {
reinterpret_cast<uintptr_t>(allocation_base_) +
allocation_length_);
switch (kind_) {
- case AllocationKind::kNormal:
+ case WTF::ArrayBufferContents::AllocationKind::kNormal:
DCHECK(deleter_);
deleter_(data_);
return;
- case AllocationKind::kReservation:
+ case WTF::ArrayBufferContents::AllocationKind::kReservation:
ReleaseReservedMemory(allocation_base_, allocation_length_);
return;
}
--- a/third_party/webrtc/modules/audio_processing/aec3/aec_state.cc.orig 2017-08-15 12:45:59.433532111 +0000
+++ b/third_party/webrtc/modules/audio_processing/aec3/aec_state.cc 2017-08-15 17:52:59.691328825 +0000
@@ -10,7 +10,7 @@
#include "webrtc/modules/audio_processing/aec3/aec_state.h"
-#include <math.h>
+#include <cmath>
#include <numeric>
#include <vector>
--- a/gpu/ipc/common/mailbox_struct_traits.h
+++ b/gpu/ipc/common/mailbox_struct_traits.h
@@ -15,7 +15,7 @@ namespace mojo {
template <>
struct StructTraits<gpu::mojom::MailboxDataView, gpu::Mailbox> {
static base::span<const int8_t> name(const gpu::Mailbox& mailbox) {
- return mailbox.name;
+ return base::make_span(mailbox.name);
}
static bool Read(gpu::mojom::MailboxDataView data, gpu::Mailbox* out);
};
--- a/services/viz/public/cpp/compositing/filter_operation_struct_traits.h
+++ b/services/viz/public/cpp/compositing/filter_operation_struct_traits.h
@@ -134,7 +134,7 @@ struct StructTraits<viz::mojom::FilterOperationDataView, cc::FilterOperation> {
static base::span<const float> matrix(const cc::FilterOperation& operation) {
if (operation.type() != cc::FilterOperation::COLOR_MATRIX)
return base::span<const float>();
- return operation.matrix();
+ return base::make_span(operation.matrix());
}
static base::span<const gfx::Rect> shape(
--- a/services/viz/public/cpp/compositing/quads_struct_traits.h
+++ b/services/viz/public/cpp/compositing/quads_struct_traits.h
@@ -303,7 +303,7 @@ struct StructTraits<viz::mojom::TextureQuadStateDataView, viz::DrawQuad> {
static base::span<const float> vertex_opacity(const viz::DrawQuad& input) {
const viz::TextureDrawQuad* quad =
viz::TextureDrawQuad::MaterialCast(&input);
- return quad->vertex_opacity;
+ return base::make_span(quad->vertex_opacity);
}
static bool y_flipped(const viz::DrawQuad& input) {
--- a/third_party/WebKit/Source/platform/exported/WebCORS.cpp
+++ b/third_party/WebKit/Source/platform/exported/WebCORS.cpp
@@ -480,7 +480,7 @@ WebString AccessControlErrorString(
}
default:
NOTREACHED();
- return "";
+ return WebString();
}
}
@@ -512,7 +512,7 @@ WebString PreflightErrorString(const PreflightStatus status,
}
default:
NOTREACHED();
- return "";
+ return WebString();
}
}
@@ -533,7 +533,7 @@ WebString RedirectErrorString(const RedirectStatus status,
}
default:
NOTREACHED();
- return "";
+ return WebString();
}
}

View file

@ -1,98 +0,0 @@
From aab2cc3a20af9ebe9ddb8dfd15089f131f95817f Mon Sep 17 00:00:00 2001
From: Tomas Popela <tomas.popela@gmail.com>
Date: Fri, 20 Oct 2017 14:06:42 +0200
Subject: [PATCH] Fix the build of base/numerics with GCC
Initialize the uninitialized variables where the build is failing.
BUG=776705
Change-Id: I5782e18086a752b3676f8738930bf0553f3f97ad
---
base/numerics/checked_math_impl.h | 6 +++---
base/numerics/clamped_math_impl.h | 10 +++++-----
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/base/numerics/checked_math_impl.h b/base/numerics/checked_math_impl.h
index 2926b37b5e..e083389ebf 100644
--- a/base/numerics/checked_math_impl.h
+++ b/base/numerics/checked_math_impl.h
@@ -67,7 +67,7 @@ struct CheckedAddOp<T,
return false;
}
- Promotion presult;
+ Promotion presult = {};
bool is_valid = true;
if (IsIntegerArithmeticSafe<Promotion, T, U>::value) {
presult = static_cast<Promotion>(x) + static_cast<Promotion>(y);
@@ -127,7 +127,7 @@ struct CheckedSubOp<T,
return false;
}
- Promotion presult;
+ Promotion presult = {};
bool is_valid = true;
if (IsIntegerArithmeticSafe<Promotion, T, U>::value) {
presult = static_cast<Promotion>(x) - static_cast<Promotion>(y);
@@ -183,7 +183,7 @@ struct CheckedMulOp<T,
return false;
}
- Promotion presult;
+ Promotion presult = {};
bool is_valid = true;
if (CheckedMulFastOp<Promotion, Promotion>::is_supported) {
// The fast op may be available with the promoted type.
diff --git a/base/numerics/clamped_math_impl.h b/base/numerics/clamped_math_impl.h
index 7b5e4346f2..303a7e945a 100644
--- a/base/numerics/clamped_math_impl.h
+++ b/base/numerics/clamped_math_impl.h
@@ -87,7 +87,7 @@ struct ClampedAddOp<T,
"The saturation result cannot be determined from the "
"provided types.");
const V saturated = CommonMaxOrMin<V>(IsValueNegative(y));
- V result;
+ V result = {};
return BASE_NUMERICS_LIKELY((CheckedAddOp<T, U>::Do(x, y, &result)))
? result
: saturated;
@@ -114,7 +114,7 @@ struct ClampedSubOp<T,
"The saturation result cannot be determined from the "
"provided types.");
const V saturated = CommonMaxOrMin<V>(!IsValueNegative(y));
- V result;
+ V result = {};
return BASE_NUMERICS_LIKELY((CheckedSubOp<T, U>::Do(x, y, &result)))
? result
: saturated;
@@ -136,7 +136,7 @@ struct ClampedMulOp<T,
if (ClampedMulFastOp<T, U>::is_supported)
return ClampedMulFastOp<T, U>::template Do<V>(x, y);
- V result;
+ V result = {};
const V saturated =
CommonMaxOrMin<V>(IsValueNegative(x) ^ IsValueNegative(y));
return BASE_NUMERICS_LIKELY((CheckedMulOp<T, U>::Do(x, y, &result)))
@@ -156,7 +156,7 @@ struct ClampedDivOp<T,
using result_type = typename MaxExponentPromotion<T, U>::type;
template <typename V = result_type>
static constexpr V Do(T x, U y) {
- V result;
+ V result = {};
if (BASE_NUMERICS_LIKELY((CheckedDivOp<T, U>::Do(x, y, &result))))
return result;
// Saturation goes to max, min, or NaN (if x is zero).
@@ -176,7 +176,7 @@ struct ClampedModOp<T,
using result_type = typename MaxExponentPromotion<T, U>::type;
template <typename V = result_type>
static constexpr V Do(T x, U y) {
- V result;
+ V result = {};
return BASE_NUMERICS_LIKELY((CheckedModOp<T, U>::Do(x, y, &result)))
? result
: x;
--
2.14.2

View file

@ -1,77 +0,0 @@
Index: extensions/browser/api/networking_private/networking_private_linux.cc
===================================================================
--- a/extensions/browser/api/networking_private/networking_private_linux.cc.orig 2016-05-05 03:01:50.000000000 +0200
+++ b/extensions/browser/api/networking_private/networking_private_linux.cc 2016-05-10 16:16:42.431052917 +0200
@@ -215,12 +215,14 @@ void NetworkingPrivateLinux::GetState(
std::unique_ptr<base::DictionaryValue> network_properties(
new base::DictionaryValue);
+ std::string* erp = error.get();
+ base::DictionaryValue* npp = network_properties.get();
// Runs GetCachedNetworkProperties on |dbus_thread|.
dbus_thread_.task_runner()->PostTaskAndReply(
FROM_HERE, base::Bind(&NetworkingPrivateLinux::GetCachedNetworkProperties,
base::Unretained(this), guid,
- base::Unretained(network_properties.get()),
- base::Unretained(error.get())),
+ base::Unretained(npp),
+ base::Unretained(erp)),
base::Bind(&GetCachedNetworkPropertiesCallback, base::Passed(&error),
base::Passed(&network_properties), success_callback,
failure_callback));
@@ -301,11 +303,12 @@ void NetworkingPrivateLinux::GetNetworks
// Runs GetAllWiFiAccessPoints on the dbus_thread and returns the
// results back to OnAccessPointsFound where the callback is fired.
+ NetworkMap* nmp = network_map.get();
dbus_thread_.task_runner()->PostTaskAndReply(
FROM_HERE,
base::Bind(&NetworkingPrivateLinux::GetAllWiFiAccessPoints,
base::Unretained(this), configured_only, visible_only, limit,
- base::Unretained(network_map.get())),
+ base::Unretained(nmp)),
base::Bind(&NetworkingPrivateLinux::OnAccessPointsFound,
base::Unretained(this), base::Passed(&network_map),
success_callback, failure_callback));
@@ -321,11 +324,12 @@ bool NetworkingPrivateLinux::GetNetworks
// Runs GetAllWiFiAccessPoints on the dbus_thread and returns the
// results back to SendNetworkListChangedEvent to fire the event. No
// callbacks are used in this case.
+ NetworkMap* nmp = network_map.get();
dbus_thread_.task_runner()->PostTaskAndReply(
FROM_HERE, base::Bind(&NetworkingPrivateLinux::GetAllWiFiAccessPoints,
base::Unretained(this), false /* configured_only */,
false /* visible_only */, 0 /* limit */,
- base::Unretained(network_map.get())),
+ base::Unretained(nmp)),
base::Bind(&NetworkingPrivateLinux::OnAccessPointsFoundViaScan,
base::Unretained(this), base::Passed(&network_map)));
@@ -506,11 +510,12 @@ void NetworkingPrivateLinux::StartConnec
std::unique_ptr<std::string> error(new std::string);
+ std::string* erp = error.get();
// Runs ConnectToNetwork on |dbus_thread|.
dbus_thread_.task_runner()->PostTaskAndReply(
FROM_HERE,
base::Bind(&NetworkingPrivateLinux::ConnectToNetwork,
- base::Unretained(this), guid, base::Unretained(error.get())),
+ base::Unretained(this), guid, base::Unretained(erp)),
base::Bind(&OnNetworkConnectOperationCompleted, base::Passed(&error),
success_callback, failure_callback));
}
@@ -524,11 +529,12 @@ void NetworkingPrivateLinux::StartDiscon
std::unique_ptr<std::string> error(new std::string);
+ std::string* erp = error.get();
// Runs DisconnectFromNetwork on |dbus_thread|.
dbus_thread_.task_runner()->PostTaskAndReply(
FROM_HERE,
base::Bind(&NetworkingPrivateLinux::DisconnectFromNetwork,
- base::Unretained(this), guid, base::Unretained(error.get())),
+ base::Unretained(this), guid, base::Unretained(erp)),
base::Bind(&OnNetworkConnectOperationCompleted, base::Passed(&error),
success_callback, failure_callback));
}

View file

@ -1,34 +0,0 @@
From 7f90e2cceda0458cf56026eb6ccffb961a47804b Mon Sep 17 00:00:00 2001
From: Raphael Kubo da Costa <raphael.kubo.da.costa@intel.com>
Date: Fri, 13 Oct 2017 15:49:32 +0200
Subject: [PATCH] IWYU: Include math.h for round(3).
math.h was being implicitly included, which can break the build with
alternative libc implementations.
Bug: None
Change-Id: I969b320b65d0f44abb33d3e1036cfbcb859a4952
Reviewed-on: https://webrtc-review.googlesource.com/9384
Reviewed-by: Tommi <tommi@webrtc.org>
Commit-Queue: Raphael Kubo da Costa (rakuco) <raphael.kubo.da.costa@intel.com>
Cr-Commit-Position: refs/heads/master@{#20292}
---
p2p/base/port.cc | 2 ++
1 file changed, 2 insertions(+)
diff --git a/third_party/webrtc/p2p/base/port.cc b/third_party/webrtc/p2p/base/port.cc
index a1b478d11..81aa0aadb 100644
--- a/third_party/webrtc/p2p/base/port.cc
+++ b/third_party/webrtc/p2p/base/port.cc
@@ -10,6 +10,8 @@
#include "p2p/base/port.h"
+#include <math.h>
+
#include <algorithm>
#include <vector>
--
2.15.0