diff options
author | Ting-Wei Lan <lantw44@gmail.com> | 2018-04-21 18:52:12 +0800 |
---|---|---|
committer | Ting-Wei Lan <lantw44@gmail.com> | 2018-04-21 23:00:41 +0800 |
commit | ab1b40a44b34ed2703a48ec0167add88b746ce70 (patch) | |
tree | afde8dd4fd0941f1ad1a9dcdd67d6df9c1d142a8 | |
parent | 638ff4ae6f268a7670b4dea36b0f5f1ef424dbb7 (diff) | |
download | copr-rpm-spec-ab1b40a44b34ed2703a48ec0167add88b746ce70.tar copr-rpm-spec-ab1b40a44b34ed2703a48ec0167add88b746ce70.tar.gz copr-rpm-spec-ab1b40a44b34ed2703a48ec0167add88b746ce70.tar.bz2 copr-rpm-spec-ab1b40a44b34ed2703a48ec0167add88b746ce70.tar.lz copr-rpm-spec-ab1b40a44b34ed2703a48ec0167add88b746ce70.tar.xz copr-rpm-spec-ab1b40a44b34ed2703a48ec0167add88b746ce70.tar.zst copr-rpm-spec-ab1b40a44b34ed2703a48ec0167add88b746ce70.zip |
chromium: Chromium 65.0.3325.181 -> 66.0.3359.117
22 files changed, 191 insertions, 2974 deletions
diff --git a/chromium/chromium/chromium-disable-unrar.patch b/chromium/chromium/chromium-disable-unrar.patch new file mode 100644 index 0000000..76c674b --- /dev/null +++ b/chromium/chromium/chromium-disable-unrar.patch @@ -0,0 +1,16 @@ +diff --git a/chrome/services/file_util/public/cpp/BUILD.gn b/chrome/services/file_util/public/cpp/BUILD.gn +index 88c2008..f55e4fd 100644 +--- a/chrome/services/file_util/public/cpp/BUILD.gn ++++ b/chrome/services/file_util/public/cpp/BUILD.gn +@@ -26,11 +26,6 @@ source_set("cpp") { + ] + } + +- #TODO(crbug/750327): This dependency is here temporarily. +- deps = [ +- "//third_party/unrar:unrar", +- ] +- + public_deps += [ "//chrome/common/safe_browsing" ] + } + } diff --git a/chromium/chromium/chromium-ffmpeg-clean.sh b/chromium/chromium/chromium-ffmpeg-clean.sh index 4d74e2d..9f6f7cf 100755 --- a/chromium/chromium/chromium-ffmpeg-clean.sh +++ b/chromium/chromium/chromium-ffmpeg-clean.sh @@ -307,7 +307,6 @@ other_files=" BUILD.gn \ CREDITS.chromium \ ffmpeg_generated.gni \ ffmpeg_options.gni \ - ffmpegsumo.ver \ INSTALL.md \ LICENSE.md \ MAINTAINERS \ diff --git a/chromium/chromium/chromium-gcc7-r530663.patch b/chromium/chromium/chromium-gcc7-r530663.patch deleted file mode 100644 index e817c94..0000000 --- a/chromium/chromium/chromium-gcc7-r530663.patch +++ /dev/null @@ -1,183 +0,0 @@ -From f1c8789c71dbdaeeef98ecd52c9715495824e6b0 Mon Sep 17 00:00:00 2001 -From: Hidehiko Abe <hidehiko@chromium.org> -Date: Fri, 19 Jan 2018 23:50:24 +0000 -Subject: [PATCH] Fix non-copyable class's optional move. - -BUG=784732 -TEST=Ran base_unittests -gtest_filter=*Optional* - -Change-Id: Ibb5d7cc5d62deacdba7f811f5a7b83c1c58c3907 -Reviewed-on: https://chromium-review.googlesource.com/855976 -Reviewed-by: danakj <danakj@chromium.org> -Commit-Queue: Hidehiko Abe <hidehiko@chromium.org> -Cr-Commit-Position: refs/heads/master@{#530663} ---- - base/optional.h | 24 +++++++++++++-- - base/optional_unittest.cc | 74 +++++++++++++++++++++++++++++++++++++++++++---- - 2 files changed, 89 insertions(+), 9 deletions(-) - -diff --git a/base/optional.h b/base/optional.h -index f6619a5758..34e36fabeb 100644 ---- a/base/optional.h -+++ b/base/optional.h -@@ -44,6 +44,15 @@ struct OptionalStorageBase { - - // When T is not trivially destructible we must call its - // destructor before deallocating its memory. -+ // Note that this hides the (implicitly declared) move constructor, which -+ // would be used for constexpr move constructor in OptionalStorage<T>. -+ // It is needed iff T is trivially move constructible. However, the current -+ // is_trivially_{copy,move}_constructible implementation requires -+ // is_trivially_destructible (which looks a bug, cf: -+ // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51452 and -+ // http://cplusplus.github.io/LWG/lwg-active.html#2116), so it is not -+ // necessary for this case at the moment. Please see also the destructor -+ // comment in "is_trivially_destructible = true" specialization below. - ~OptionalStorageBase() { - if (!is_null_) - value_.~T(); -@@ -77,9 +86,18 @@ struct OptionalStorageBase<T, true /* trivially destructible */> { - : is_null_(false), value_(std::forward<Args>(args)...) {} - - // When T is trivially destructible (i.e. its destructor does nothing) there -- // is no need to call it. Explicitly defaulting the destructor means it's not -- // user-provided. Those two together make this destructor trivial. -- ~OptionalStorageBase() = default; -+ // is no need to call it. Implicitly defined destructor is trivial, because -+ // both members (bool and union containing only variants which are trivially -+ // destructible) are trivially destructible. -+ // Explicitly-defaulted destructor is also trivial, but do not use it here, -+ // because it hides the implicit move constructor. It is needed to implement -+ // constexpr move constructor in OptionalStorage iff T is trivially move -+ // constructible. Note that, if T is trivially move constructible, the move -+ // constructor of OptionalStorageBase<T> is also implicitly defined and it is -+ // trivially move constructor. If T is not trivially move constructible, -+ // "not declaring move constructor without destructor declaration" here means -+ // "delete move constructor", which works because any move constructor of -+ // OptionalStorage will not refer to it in that case. - - template <class... Args> - void Init(Args&&... args) { -diff --git a/base/optional_unittest.cc b/base/optional_unittest.cc -index 91e63e75d0..7cc05ef298 100644 ---- a/base/optional_unittest.cc -+++ b/base/optional_unittest.cc -@@ -115,6 +115,35 @@ class DeletedDefaultConstructor { - int foo_; - }; - -+class DeletedCopyConstructor { -+ public: -+ explicit DeletedCopyConstructor(int foo) : foo_(foo) {} -+ DeletedCopyConstructor(const DeletedCopyConstructor&) = delete; -+ DeletedCopyConstructor(DeletedCopyConstructor&&) = default; -+ -+ int foo() const { return foo_; } -+ -+ private: -+ int foo_; -+}; -+ -+class NonTriviallyDestructibleDeletedCopyConstructor { -+ public: -+ explicit NonTriviallyDestructibleDeletedCopyConstructor(int foo) -+ : foo_(foo) {} -+ NonTriviallyDestructibleDeletedCopyConstructor( -+ const NonTriviallyDestructibleDeletedCopyConstructor&) = delete; -+ NonTriviallyDestructibleDeletedCopyConstructor( -+ NonTriviallyDestructibleDeletedCopyConstructor&&) = default; -+ -+ ~NonTriviallyDestructibleDeletedCopyConstructor() {} -+ -+ int foo() const { return foo_; } -+ -+ private: -+ int foo_; -+}; -+ - class DeleteNewOperators { - public: - void* operator new(size_t) = delete; -@@ -168,6 +197,15 @@ TEST(OptionalTest, CopyConstructor) { - EXPECT_EQ(first, other); - } - -+ { -+ const Optional<std::string> first("foo"); -+ Optional<std::string> other(first); -+ -+ EXPECT_TRUE(other); -+ EXPECT_EQ(other.value(), "foo"); -+ EXPECT_EQ(first, other); -+ } -+ - { - Optional<TestObject> first(TestObject(3, 0.1)); - Optional<TestObject> other(first); -@@ -210,33 +248,57 @@ TEST(OptionalTest, MoveConstructor) { - constexpr Optional<float> first(0.1f); - constexpr Optional<float> second(std::move(first)); - -- EXPECT_TRUE(second); -+ EXPECT_TRUE(second.has_value()); - EXPECT_EQ(second.value(), 0.1f); - -- EXPECT_TRUE(first); -+ EXPECT_TRUE(first.has_value()); - } - - { - Optional<std::string> first("foo"); - Optional<std::string> second(std::move(first)); - -- EXPECT_TRUE(second); -+ EXPECT_TRUE(second.has_value()); - EXPECT_EQ("foo", second.value()); - -- EXPECT_TRUE(first); -+ EXPECT_TRUE(first.has_value()); - } - - { - Optional<TestObject> first(TestObject(3, 0.1)); - Optional<TestObject> second(std::move(first)); - -- EXPECT_TRUE(!!second); -+ EXPECT_TRUE(second.has_value()); - EXPECT_EQ(TestObject::State::MOVE_CONSTRUCTED, second->state()); - EXPECT_TRUE(TestObject(3, 0.1) == second.value()); - -- EXPECT_TRUE(!!first); -+ EXPECT_TRUE(first.has_value()); - EXPECT_EQ(TestObject::State::MOVED_FROM, first->state()); - } -+ -+ // Even if copy constructor is deleted, move constructor needs to work. -+ // Note that it couldn't be constexpr. -+ { -+ Optional<DeletedCopyConstructor> first(in_place, 42); -+ Optional<DeletedCopyConstructor> second(std::move(first)); -+ -+ EXPECT_TRUE(second.has_value()); -+ EXPECT_EQ(42, second->foo()); -+ -+ EXPECT_TRUE(first.has_value()); -+ } -+ -+ { -+ Optional<NonTriviallyDestructibleDeletedCopyConstructor> first(in_place, -+ 42); -+ Optional<NonTriviallyDestructibleDeletedCopyConstructor> second( -+ std::move(first)); -+ -+ EXPECT_TRUE(second.has_value()); -+ EXPECT_EQ(42, second->foo()); -+ -+ EXPECT_TRUE(first.has_value()); -+ } - } - - TEST(OptionalTest, MoveValueConstructor) { --- -2.14.3 - diff --git a/chromium/chromium/chromium-gcc7-r531722.patch b/chromium/chromium/chromium-gcc7-r531722.patch deleted file mode 100644 index e59b79a..0000000 --- a/chromium/chromium/chromium-gcc7-r531722.patch +++ /dev/null @@ -1,297 +0,0 @@ -From 0a5dd14ae173846fb5d67408790b7df4e44f38b6 Mon Sep 17 00:00:00 2001 -From: Chris Blume <cblume@chromium.org> -Date: Wed, 24 Jan 2018 22:35:40 +0000 -Subject: [PATCH] Use affirmative expression in base::Optional - -base::Optional has a negative expression to represent if a value is -being stored: storage_.is_null_. - -Because of this, memset(0) on a base::Optional will mark that optional -as actually storing a value (when it clearly doesn't). Using memset(0) -on base::Optional sounds a bit dirty but it can easily happen -indirectly. Someone might memset(0) a class with a private member of -base::Optional. - -Change the expression to be affirmative to preserve memset(0) intention -using storage_.is_populated_. - -BUG=805565 - -Change-Id: I9c5b85cdaa58960f15809160f2d0de6d0cc52c7b -Reviewed-on: https://chromium-review.googlesource.com/883946 -Reviewed-by: danakj <danakj@chromium.org> -Commit-Queue: Chris Blume <cblume@chromium.org> -Cr-Commit-Position: refs/heads/master@{#531722} ---- - base/optional.h | 84 +++++++++++++++++++++++++++++---------------------------- - 1 file changed, 43 insertions(+), 41 deletions(-) - -diff --git a/base/optional.h b/base/optional.h -index 34e36fabeb..e71f12c9f8 100644 ---- a/base/optional.h -+++ b/base/optional.h -@@ -40,7 +40,7 @@ struct OptionalStorageBase { - - template <class... Args> - constexpr explicit OptionalStorageBase(in_place_t, Args&&... args) -- : is_null_(false), value_(std::forward<Args>(args)...) {} -+ : is_populated_(true), value_(std::forward<Args>(args)...) {} - - // When T is not trivially destructible we must call its - // destructor before deallocating its memory. -@@ -54,18 +54,18 @@ struct OptionalStorageBase { - // necessary for this case at the moment. Please see also the destructor - // comment in "is_trivially_destructible = true" specialization below. - ~OptionalStorageBase() { -- if (!is_null_) -+ if (is_populated_) - value_.~T(); - } - - template <class... Args> - void Init(Args&&... args) { -- DCHECK(is_null_); -+ DCHECK(!is_populated_); - ::new (&value_) T(std::forward<Args>(args)...); -- is_null_ = false; -+ is_populated_ = true; - } - -- bool is_null_ = true; -+ bool is_populated_ = false; - union { - // |empty_| exists so that the union will always be initialized, even when - // it doesn't contain a value. Union members must be initialized for the -@@ -83,7 +83,7 @@ struct OptionalStorageBase<T, true /* trivially destructible */> { - - template <class... Args> - constexpr explicit OptionalStorageBase(in_place_t, Args&&... args) -- : is_null_(false), value_(std::forward<Args>(args)...) {} -+ : is_populated_(true), value_(std::forward<Args>(args)...) {} - - // When T is trivially destructible (i.e. its destructor does nothing) there - // is no need to call it. Implicitly defined destructor is trivial, because -@@ -101,12 +101,12 @@ struct OptionalStorageBase<T, true /* trivially destructible */> { - - template <class... Args> - void Init(Args&&... args) { -- DCHECK(is_null_); -+ DCHECK(!is_populated_); - ::new (&value_) T(std::forward<Args>(args)...); -- is_null_ = false; -+ is_populated_ = true; - } - -- bool is_null_ = true; -+ bool is_populated_ = false; - union { - // |empty_| exists so that the union will always be initialized, even when - // it doesn't contain a value. Union members must be initialized for the -@@ -132,7 +132,7 @@ struct OptionalStorage : OptionalStorageBase<T> { - - // Accessing the members of template base class requires explicit - // declaration. -- using OptionalStorageBase<T>::is_null_; -+ using OptionalStorageBase<T>::is_populated_; - using OptionalStorageBase<T>::value_; - using OptionalStorageBase<T>::Init; - -@@ -144,12 +144,12 @@ struct OptionalStorage : OptionalStorageBase<T> { - OptionalStorage() = default; - - OptionalStorage(const OptionalStorage& other) { -- if (!other.is_null_) -+ if (other.is_populated_) - Init(other.value_); - } - - OptionalStorage(OptionalStorage&& other) { -- if (!other.is_null_) -+ if (other.is_populated_) - Init(std::move(other.value_)); - } - }; -@@ -159,7 +159,7 @@ struct OptionalStorage<T, - true /* trivially copy constructible */, - false /* trivially move constructible */> - : OptionalStorageBase<T> { -- using OptionalStorageBase<T>::is_null_; -+ using OptionalStorageBase<T>::is_populated_; - using OptionalStorageBase<T>::value_; - using OptionalStorageBase<T>::Init; - using OptionalStorageBase<T>::OptionalStorageBase; -@@ -168,7 +168,7 @@ struct OptionalStorage<T, - OptionalStorage(const OptionalStorage& other) = default; - - OptionalStorage(OptionalStorage&& other) { -- if (!other.is_null_) -+ if (other.is_populated_) - Init(std::move(other.value_)); - } - }; -@@ -178,7 +178,7 @@ struct OptionalStorage<T, - false /* trivially copy constructible */, - true /* trivially move constructible */> - : OptionalStorageBase<T> { -- using OptionalStorageBase<T>::is_null_; -+ using OptionalStorageBase<T>::is_populated_; - using OptionalStorageBase<T>::value_; - using OptionalStorageBase<T>::Init; - using OptionalStorageBase<T>::OptionalStorageBase; -@@ -187,7 +187,7 @@ struct OptionalStorage<T, - OptionalStorage(OptionalStorage&& other) = default; - - OptionalStorage(const OptionalStorage& other) { -- if (!other.is_null_) -+ if (other.is_populated_) - Init(other.value_); - } - }; -@@ -222,7 +222,7 @@ class OptionalBase { - ~OptionalBase() = default; - - OptionalBase& operator=(const OptionalBase& other) { -- if (other.storage_.is_null_) { -+ if (!other.storage_.is_populated_) { - FreeIfNeeded(); - return *this; - } -@@ -232,7 +232,7 @@ class OptionalBase { - } - - OptionalBase& operator=(OptionalBase&& other) { -- if (other.storage_.is_null_) { -+ if (!other.storage_.is_populated_) { - FreeIfNeeded(); - return *this; - } -@@ -242,24 +242,24 @@ class OptionalBase { - } - - void InitOrAssign(const T& value) { -- if (storage_.is_null_) -+ if (!storage_.is_populated_) - storage_.Init(value); - else - storage_.value_ = value; - } - - void InitOrAssign(T&& value) { -- if (storage_.is_null_) -+ if (!storage_.is_populated_) - storage_.Init(std::move(value)); - else - storage_.value_ = std::move(value); - } - - void FreeIfNeeded() { -- if (storage_.is_null_) -+ if (!storage_.is_populated_) - return; - storage_.value_.~T(); -- storage_.is_null_ = true; -+ storage_.is_populated_ = false; - } - - OptionalStorage<T> storage_; -@@ -333,12 +333,12 @@ class Optional : public internal::OptionalBase<T> { - } - - constexpr const T* operator->() const { -- DCHECK(!storage_.is_null_); -+ DCHECK(storage_.is_populated_); - return &value(); - } - - constexpr T* operator->() { -- DCHECK(!storage_.is_null_); -+ DCHECK(storage_.is_populated_); - return &value(); - } - -@@ -350,27 +350,27 @@ class Optional : public internal::OptionalBase<T> { - - constexpr T&& operator*() && { return std::move(value()); } - -- constexpr explicit operator bool() const { return !storage_.is_null_; } -+ constexpr explicit operator bool() const { return storage_.is_populated_; } - -- constexpr bool has_value() const { return !storage_.is_null_; } -+ constexpr bool has_value() const { return storage_.is_populated_; } - - constexpr T& value() & { -- DCHECK(!storage_.is_null_); -+ DCHECK(storage_.is_populated_); - return storage_.value_; - } - - constexpr const T& value() const & { -- DCHECK(!storage_.is_null_); -+ DCHECK(storage_.is_populated_); - return storage_.value_; - } - - constexpr T&& value() && { -- DCHECK(!storage_.is_null_); -+ DCHECK(storage_.is_populated_); - return std::move(storage_.value_); - } - - constexpr const T&& value() const && { -- DCHECK(!storage_.is_null_); -+ DCHECK(storage_.is_populated_); - return std::move(storage_.value_); - } - -@@ -381,8 +381,9 @@ class Optional : public internal::OptionalBase<T> { - // "T must be copy constructible"); - static_assert(std::is_convertible<U, T>::value, - "U must be convertible to T"); -- return storage_.is_null_ ? static_cast<T>(std::forward<U>(default_value)) -- : value(); -+ return storage_.is_populated_ -+ ? value() -+ : static_cast<T>(std::forward<U>(default_value)); - } - - template <class U> -@@ -392,26 +393,27 @@ class Optional : public internal::OptionalBase<T> { - // "T must be move constructible"); - static_assert(std::is_convertible<U, T>::value, - "U must be convertible to T"); -- return storage_.is_null_ ? static_cast<T>(std::forward<U>(default_value)) -- : std::move(value()); -+ return storage_.is_populated_ -+ ? std::move(value()) -+ : static_cast<T>(std::forward<U>(default_value)); - } - - void swap(Optional& other) { -- if (storage_.is_null_ && other.storage_.is_null_) -+ if (!storage_.is_populated_ && !other.storage_.is_populated_) - return; - -- if (storage_.is_null_ != other.storage_.is_null_) { -- if (storage_.is_null_) { -- storage_.Init(std::move(other.storage_.value_)); -- other.FreeIfNeeded(); -- } else { -+ if (storage_.is_populated_ != other.storage_.is_populated_) { -+ if (storage_.is_populated_) { - other.storage_.Init(std::move(storage_.value_)); - FreeIfNeeded(); -+ } else { -+ storage_.Init(std::move(other.storage_.value_)); -+ other.FreeIfNeeded(); - } - return; - } - -- DCHECK(!storage_.is_null_ && !other.storage_.is_null_); -+ DCHECK(storage_.is_populated_ && other.storage_.is_populated_); - using std::swap; - swap(**this, *other); - } --- -2.14.3 - diff --git a/chromium/chromium/chromium-gcc7-r532004.patch b/chromium/chromium/chromium-gcc7-r532004.patch deleted file mode 100644 index 862348f..0000000 --- a/chromium/chromium/chromium-gcc7-r532004.patch +++ /dev/null @@ -1,226 +0,0 @@ -From 5cae9645215d02cb1f986a181a208f8a4817fc86 Mon Sep 17 00:00:00 2001 -From: Hidehiko Abe <hidehiko@chromium.org> -Date: Fri, 26 Jan 2018 18:01:11 +0000 -Subject: [PATCH] Implement conditional copy/move ctors/assign-operators. - -BUG=784732 -TEST=Ran trybot. - -Change-Id: Iec5f9eaa7482d4e23f5bf2eea4b34c9cd867f89d -Reviewed-on: https://chromium-review.googlesource.com/856021 -Commit-Queue: Hidehiko Abe <hidehiko@chromium.org> -Reviewed-by: danakj <danakj@chromium.org> -Cr-Commit-Position: refs/heads/master@{#532004} ---- - base/optional.h | 63 +++++++++++++++++++++++++++++++++++-- - base/optional_unittest.cc | 80 +++++++++++++++++++++++++++++++++++++++++++---- - 2 files changed, 134 insertions(+), 9 deletions(-) - -diff --git a/base/optional.h b/base/optional.h -index e71f12c9f8..dc77539087 100644 ---- a/base/optional.h -+++ b/base/optional.h -@@ -265,6 +265,58 @@ class OptionalBase { - OptionalStorage<T> storage_; - }; - -+// The following {Copy,Move}{Constructible,Assignable} structs are helpers to -+// implement constructor/assign-operator overloading. Specifically, if T is -+// is not movable but copyable, Optional<T>'s move constructor should not -+// participate in overload resolution. This inheritance trick implements that. -+template <bool is_copy_constructible> -+struct CopyConstructible {}; -+ -+template <> -+struct CopyConstructible<false> { -+ constexpr CopyConstructible() = default; -+ constexpr CopyConstructible(const CopyConstructible&) = delete; -+ constexpr CopyConstructible(CopyConstructible&&) = default; -+ CopyConstructible& operator=(const CopyConstructible&) = default; -+ CopyConstructible& operator=(CopyConstructible&&) = default; -+}; -+ -+template <bool is_move_constructible> -+struct MoveConstructible {}; -+ -+template <> -+struct MoveConstructible<false> { -+ constexpr MoveConstructible() = default; -+ constexpr MoveConstructible(const MoveConstructible&) = default; -+ constexpr MoveConstructible(MoveConstructible&&) = delete; -+ MoveConstructible& operator=(const MoveConstructible&) = default; -+ MoveConstructible& operator=(MoveConstructible&&) = default; -+}; -+ -+template <bool is_copy_assignable> -+struct CopyAssignable {}; -+ -+template <> -+struct CopyAssignable<false> { -+ constexpr CopyAssignable() = default; -+ constexpr CopyAssignable(const CopyAssignable&) = default; -+ constexpr CopyAssignable(CopyAssignable&&) = default; -+ CopyAssignable& operator=(const CopyAssignable&) = delete; -+ CopyAssignable& operator=(CopyAssignable&&) = default; -+}; -+ -+template <bool is_move_assignable> -+struct MoveAssignable {}; -+ -+template <> -+struct MoveAssignable<false> { -+ constexpr MoveAssignable() = default; -+ constexpr MoveAssignable(const MoveAssignable&) = default; -+ constexpr MoveAssignable(MoveAssignable&&) = default; -+ MoveAssignable& operator=(const MoveAssignable&) = default; -+ MoveAssignable& operator=(MoveAssignable&&) = delete; -+}; -+ - } // namespace internal - - // base::Optional is a Chromium version of the C++17 optional class: -@@ -279,12 +331,18 @@ class OptionalBase { - // - No exceptions are thrown, because they are banned from Chromium. - // - All the non-members are in the 'base' namespace instead of 'std'. - template <typename T> --class Optional : public internal::OptionalBase<T> { -+class Optional -+ : public internal::OptionalBase<T>, -+ public internal::CopyConstructible<std::is_copy_constructible<T>::value>, -+ public internal::MoveConstructible<std::is_move_constructible<T>::value>, -+ public internal::CopyAssignable<std::is_copy_constructible<T>::value && -+ std::is_copy_assignable<T>::value>, -+ public internal::MoveAssignable<std::is_move_constructible<T>::value && -+ std::is_move_assignable<T>::value> { - public: - using value_type = T; - - // Defer default/copy/move constructor implementation to OptionalBase. -- // TODO(hidehiko): Implement conditional enabling. - constexpr Optional() = default; - constexpr Optional(const Optional& other) = default; - constexpr Optional(Optional&& other) = default; -@@ -315,7 +373,6 @@ class Optional : public internal::OptionalBase<T> { - ~Optional() = default; - - // Defer copy-/move- assign operator implementation to OptionalBase. -- // TOOD(hidehiko): Implement conditional enabling. - Optional& operator=(const Optional& other) = default; - Optional& operator=(Optional&& other) = default; - -diff --git a/base/optional_unittest.cc b/base/optional_unittest.cc -index 7cc05ef298..09f3106bfa 100644 ---- a/base/optional_unittest.cc -+++ b/base/optional_unittest.cc -@@ -115,11 +115,29 @@ class DeletedDefaultConstructor { - int foo_; - }; - --class DeletedCopyConstructor { -+class DeletedCopy { - public: -- explicit DeletedCopyConstructor(int foo) : foo_(foo) {} -- DeletedCopyConstructor(const DeletedCopyConstructor&) = delete; -- DeletedCopyConstructor(DeletedCopyConstructor&&) = default; -+ explicit DeletedCopy(int foo) : foo_(foo) {} -+ DeletedCopy(const DeletedCopy&) = delete; -+ DeletedCopy(DeletedCopy&&) = default; -+ -+ DeletedCopy& operator=(const DeletedCopy&) = delete; -+ DeletedCopy& operator=(DeletedCopy&&) = default; -+ -+ int foo() const { return foo_; } -+ -+ private: -+ int foo_; -+}; -+ -+class DeletedMove { -+ public: -+ explicit DeletedMove(int foo) : foo_(foo) {} -+ DeletedMove(const DeletedMove&) = default; -+ DeletedMove(DeletedMove&&) = delete; -+ -+ DeletedMove& operator=(const DeletedMove&) = default; -+ DeletedMove& operator=(DeletedMove&&) = delete; - - int foo() const { return foo_; } - -@@ -279,8 +297,18 @@ TEST(OptionalTest, MoveConstructor) { - // Even if copy constructor is deleted, move constructor needs to work. - // Note that it couldn't be constexpr. - { -- Optional<DeletedCopyConstructor> first(in_place, 42); -- Optional<DeletedCopyConstructor> second(std::move(first)); -+ Optional<DeletedCopy> first(in_place, 42); -+ Optional<DeletedCopy> second(std::move(first)); -+ -+ EXPECT_TRUE(second.has_value()); -+ EXPECT_EQ(42, second->foo()); -+ -+ EXPECT_TRUE(first.has_value()); -+ } -+ -+ { -+ Optional<DeletedMove> first(in_place, 42); -+ Optional<DeletedMove> second(std::move(first)); - - EXPECT_TRUE(second.has_value()); - EXPECT_EQ(42, second->foo()); -@@ -465,6 +493,26 @@ TEST(OptionalTest, AssignObject) { - EXPECT_TRUE(a.value() == TestObject(3, 0.1)); - EXPECT_TRUE(a == b); - } -+ -+ { -+ Optional<DeletedMove> a(in_place, 42); -+ Optional<DeletedMove> b; -+ b = a; -+ -+ EXPECT_TRUE(!!a); -+ EXPECT_TRUE(!!b); -+ EXPECT_EQ(a->foo(), b->foo()); -+ } -+ -+ { -+ Optional<DeletedMove> a(in_place, 42); -+ Optional<DeletedMove> b(in_place, 1); -+ b = a; -+ -+ EXPECT_TRUE(!!a); -+ EXPECT_TRUE(!!b); -+ EXPECT_EQ(a->foo(), b->foo()); -+ } - } - - TEST(OptionalTest, AssignObject_rvalue) { -@@ -513,6 +561,26 @@ TEST(OptionalTest, AssignObject_rvalue) { - EXPECT_EQ(TestObject::State::MOVE_ASSIGNED, a->state()); - EXPECT_EQ(TestObject::State::MOVED_FROM, b->state()); - } -+ -+ { -+ Optional<DeletedMove> a(in_place, 42); -+ Optional<DeletedMove> b; -+ b = std::move(a); -+ -+ EXPECT_TRUE(!!a); -+ EXPECT_TRUE(!!b); -+ EXPECT_EQ(42, b->foo()); -+ } -+ -+ { -+ Optional<DeletedMove> a(in_place, 42); -+ Optional<DeletedMove> b(in_place, 1); -+ b = std::move(a); -+ -+ EXPECT_TRUE(!!a); -+ EXPECT_TRUE(!!b); -+ EXPECT_EQ(42, b->foo()); -+ } - } - - TEST(OptionalTest, AssignNull) { --- -2.14.3 - diff --git a/chromium/chromium/chromium-gcc7-r532865.patch b/chromium/chromium/chromium-gcc7-r532865.patch deleted file mode 100644 index 1541cb9..0000000 --- a/chromium/chromium/chromium-gcc7-r532865.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 1ee888aed9f9a6291570ce360bcdd2d06bcc68cb Mon Sep 17 00:00:00 2001 -From: Andrew Wilson <atwilson@chromium.org> -Date: Tue, 30 Jan 2018 14:47:47 +0000 -Subject: [PATCH] Clear the testing provider on shutdown. - -Restore code to clean up the test instance of the PolicyProvider, so unit tests -that set the PolicyProvider no longer crash when run in succession. - -Bug: None -Test: Run unit_tests --gtest_filter=ProfilePolicyConnectorTest* -Change-Id: I3a90fb04f3736c7e1351791b52886d726913aeed -Reviewed-on: https://chromium-review.googlesource.com/893098 -Reviewed-by: Julian Pastarmov <pastarmovj@chromium.org> -Commit-Queue: Drew Wilson <atwilson@chromium.org> -Cr-Commit-Position: refs/heads/master@{#532865} ---- - components/policy/core/browser/browser_policy_connector_base.cc | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/components/policy/core/browser/browser_policy_connector_base.cc b/components/policy/core/browser/browser_policy_connector_base.cc -index 35ce760506..cc9625f4f8 100644 ---- a/components/policy/core/browser/browser_policy_connector_base.cc -+++ b/components/policy/core/browser/browser_policy_connector_base.cc -@@ -60,6 +60,9 @@ void BrowserPolicyConnectorBase::Shutdown() { - for (const auto& provider : *policy_providers_) - provider->Shutdown(); - } -+ // Drop g_testing_provider so that tests executed with --single_process can -+ // call SetPolicyProviderForTesting() again. It is still owned by the test. -+ g_testing_provider = nullptr; - g_created_policy_service = false; - } - --- -2.14.3 - diff --git a/chromium/chromium/chromium-gcc7-r533126.patch b/chromium/chromium/chromium-gcc7-r533126.patch deleted file mode 100644 index 2b22b61..0000000 --- a/chromium/chromium/chromium-gcc7-r533126.patch +++ /dev/null @@ -1,706 +0,0 @@ -From 76da73abaeede740fc97479c09c92a52972bc477 Mon Sep 17 00:00:00 2001 -From: Scott Violet <sky@chromium.org> -Date: Wed, 31 Jan 2018 00:58:18 +0000 -Subject: [PATCH] cleanup how ConfigurationPolicyProviders are set - -It's expected that the providers are available when the service is -committed, so it make it explicit. - -BUG=none -TEST=none - -Change-Id: Ibc2f9be6ecec9261e1a2b9ebef18b16557882398 -Reviewed-on: https://chromium-review.googlesource.com/890722 -Commit-Queue: Scott Violet <sky@chromium.org> -Reviewed-by: Maksim Ivanov <emaxx@chromium.org> -Cr-Commit-Position: refs/heads/master@{#533126} ---- - .../browser/aw_browser_policy_connector.cc | 11 ++-- - .../browser/aw_browser_policy_connector.h | 15 +++-- - chrome/browser/browser_process_impl.cc | 1 - - .../policy/browser_policy_connector_chromeos.cc | 8 ++- - .../policy/browser_policy_connector_chromeos.h | 5 +- - ...cloud_external_data_policy_observer_unittest.cc | 6 +- - .../network_configuration_updater_unittest.cc | 3 +- - .../policy/chrome_browser_policy_connector.cc | 28 +++++---- - .../policy/chrome_browser_policy_connector.h | 12 +--- - chrome/browser/policy/profile_policy_connector.cc | 5 +- - .../policy/profile_policy_connector_factory.cc | 3 +- - chrome/browser/prefs/proxy_policy_unittest.cc | 3 +- - chrome/test/base/testing_profile.cc | 3 +- - .../core/browser/browser_policy_connector_base.cc | 67 +++++++++------------- - .../core/browser/browser_policy_connector_base.h | 19 +++--- - .../configuration_policy_pref_store_test.cc | 3 +- - .../core/browser/proxy_policy_handler_unittest.cc | 3 +- - .../policy/core/common/policy_service_impl.cc | 50 ++++++---------- - .../policy/core/common/policy_service_impl.h | 18 ++---- - .../core/common/policy_service_impl_unittest.cc | 6 +- - remoting/host/policy_watcher.cc | 3 +- - 21 files changed, 113 insertions(+), 159 deletions(-) - -diff --git a/android_webview/browser/aw_browser_policy_connector.cc b/android_webview/browser/aw_browser_policy_connector.cc -index df0be7eaa5..523da4a491 100644 ---- a/android_webview/browser/aw_browser_policy_connector.cc -+++ b/android_webview/browser/aw_browser_policy_connector.cc -@@ -62,14 +62,17 @@ std::unique_ptr<policy::ConfigurationPolicyHandlerList> BuildHandlerList( - } // namespace - - AwBrowserPolicyConnector::AwBrowserPolicyConnector() -- : BrowserPolicyConnectorBase(base::Bind(&BuildHandlerList)) { -+ : BrowserPolicyConnectorBase(base::Bind(&BuildHandlerList)) {} -+ -+AwBrowserPolicyConnector::~AwBrowserPolicyConnector() = default; -+ -+std::vector<std::unique_ptr<policy::ConfigurationPolicyProvider>> -+AwBrowserPolicyConnector::CreatePolicyProviders() { - std::vector<std::unique_ptr<policy::ConfigurationPolicyProvider>> providers; - providers.push_back( - std::make_unique<policy::android::AndroidCombinedPolicyProvider>( - GetSchemaRegistry())); -- SetPolicyProviders(std::move(providers)); -+ return providers; - } - --AwBrowserPolicyConnector::~AwBrowserPolicyConnector() {} -- - } // namespace android_webview -diff --git a/android_webview/browser/aw_browser_policy_connector.h b/android_webview/browser/aw_browser_policy_connector.h -index 4530657c51..65b2cce56f 100644 ---- a/android_webview/browser/aw_browser_policy_connector.h -+++ b/android_webview/browser/aw_browser_policy_connector.h -@@ -13,12 +13,17 @@ namespace android_webview { - // Sets up and keeps the browser-global policy objects such as the PolicyService - // and the platform-specific PolicyProvider. - class AwBrowserPolicyConnector : public policy::BrowserPolicyConnectorBase { --public: -- AwBrowserPolicyConnector(); -- ~AwBrowserPolicyConnector() override; -+ public: -+ AwBrowserPolicyConnector(); -+ ~AwBrowserPolicyConnector() override; - --private: -- DISALLOW_COPY_AND_ASSIGN(AwBrowserPolicyConnector); -+ protected: -+ // policy::BrowserPolicyConnectorBase: -+ std::vector<std::unique_ptr<policy::ConfigurationPolicyProvider>> -+ CreatePolicyProviders() override; -+ -+ private: -+ DISALLOW_COPY_AND_ASSIGN(AwBrowserPolicyConnector); - }; - - } // namespace android_webview -diff --git a/chrome/browser/browser_process_impl.cc b/chrome/browser/browser_process_impl.cc -index d96fa3319a..a7b5b1323b 100644 ---- a/chrome/browser/browser_process_impl.cc -+++ b/chrome/browser/browser_process_impl.cc -@@ -650,7 +650,6 @@ BrowserProcessImpl::browser_policy_connector() { - DCHECK(!browser_policy_connector_); - browser_policy_connector_ = platform_part_->CreateBrowserPolicyConnector(); - created_browser_policy_connector_ = true; -- browser_policy_connector_->InitPolicyProviders(); - } - return browser_policy_connector_.get(); - } -diff --git a/chrome/browser/chromeos/policy/browser_policy_connector_chromeos.cc b/chrome/browser/chromeos/policy/browser_policy_connector_chromeos.cc -index 809baa402c..15e9a3841e 100644 ---- a/chrome/browser/chromeos/policy/browser_policy_connector_chromeos.cc -+++ b/chrome/browser/chromeos/policy/browser_policy_connector_chromeos.cc -@@ -355,11 +355,13 @@ void BrowserPolicyConnectorChromeOS::OnDeviceCloudPolicyManagerDisconnected() { - RestartDeviceCloudPolicyInitializer(); - } - --void BrowserPolicyConnectorChromeOS::BuildPolicyProviders( -- std::vector<std::unique_ptr<ConfigurationPolicyProvider>>* providers) { -+std::vector<std::unique_ptr<policy::ConfigurationPolicyProvider>> -+BrowserPolicyConnectorChromeOS::CreatePolicyProviders() { -+ auto providers = ChromeBrowserPolicyConnector::CreatePolicyProviders(); - for (auto& provider_ptr : providers_for_init_) -- providers->push_back(std::move(provider_ptr)); -+ providers.push_back(std::move(provider_ptr)); - providers_for_init_.clear(); -+ return providers; - } - - void BrowserPolicyConnectorChromeOS::SetTimezoneIfPolicyAvailable() { -diff --git a/chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h b/chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h -index d79f700a37..c72c00cbba 100644 ---- a/chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h -+++ b/chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h -@@ -180,9 +180,8 @@ class BrowserPolicyConnectorChromeOS - - protected: - // ChromeBrowserPolicyConnector: -- void BuildPolicyProviders( -- std::vector<std::unique_ptr<ConfigurationPolicyProvider>>* providers) -- override; -+ std::vector<std::unique_ptr<policy::ConfigurationPolicyProvider>> -+ CreatePolicyProviders() override; - - private: - // Set the timezone as soon as the policies are available. -diff --git a/chrome/browser/chromeos/policy/cloud_external_data_policy_observer_unittest.cc b/chrome/browser/chromeos/policy/cloud_external_data_policy_observer_unittest.cc -index 70da940dae..40465dc207 100644 ---- a/chrome/browser/chromeos/policy/cloud_external_data_policy_observer_unittest.cc -+++ b/chrome/browser/chromeos/policy/cloud_external_data_policy_observer_unittest.cc -@@ -334,8 +334,7 @@ void CloudExternalDataPolicyObserverTest::LogInAsDeviceLocalAccount( - providers.push_back(device_local_account_policy_provider_.get()); - TestingProfile::Builder builder; - std::unique_ptr<PolicyServiceImpl> policy_service = -- std::make_unique<PolicyServiceImpl>(); -- policy_service->SetProviders(providers); -+ std::make_unique<PolicyServiceImpl>(std::move(providers)); - builder.SetPolicyService(std::move(policy_service)); - builder.SetPath(chromeos::ProfileHelper::Get()->GetProfilePathByUserIdHash( - chromeos::ProfileHelper::GetUserIdHashByUserIdForTesting( -@@ -370,8 +369,7 @@ void CloudExternalDataPolicyObserverTest::LogInAsRegularUser() { - providers.push_back(&user_policy_provider_); - TestingProfile::Builder builder; - std::unique_ptr<PolicyServiceImpl> policy_service = -- std::make_unique<PolicyServiceImpl>(); -- policy_service->SetProviders(providers); -+ std::make_unique<PolicyServiceImpl>(std::move(providers)); - builder.SetPolicyService(std::move(policy_service)); - builder.SetPath(chromeos::ProfileHelper::Get()->GetProfilePathByUserIdHash( - chromeos::ProfileHelper::GetUserIdHashByUserIdForTesting( -diff --git a/chrome/browser/chromeos/policy/network_configuration_updater_unittest.cc b/chrome/browser/chromeos/policy/network_configuration_updater_unittest.cc -index 6dfce500da..a184fd8953 100644 ---- a/chrome/browser/chromeos/policy/network_configuration_updater_unittest.cc -+++ b/chrome/browser/chromeos/policy/network_configuration_updater_unittest.cc -@@ -220,8 +220,7 @@ class NetworkConfigurationUpdaterTest : public testing::Test { - provider_.Init(); - PolicyServiceImpl::Providers providers; - providers.push_back(&provider_); -- policy_service_ = std::make_unique<PolicyServiceImpl>(); -- policy_service_->SetProviders(providers); -+ policy_service_ = std::make_unique<PolicyServiceImpl>(std::move(providers)); - - std::unique_ptr<base::DictionaryValue> fake_toplevel_onc = - chromeos::onc::ReadDictionaryFromJson(kFakeONC); -diff --git a/chrome/browser/policy/chrome_browser_policy_connector.cc b/chrome/browser/policy/chrome_browser_policy_connector.cc -index 4facd0f2fe..683e9ad3a2 100644 ---- a/chrome/browser/policy/chrome_browser_policy_connector.cc -+++ b/chrome/browser/policy/chrome_browser_policy_connector.cc -@@ -71,18 +71,6 @@ void ChromeBrowserPolicyConnector::OnResourceBundleCreated() { - BrowserPolicyConnectorBase::OnResourceBundleCreated(); - } - --void ChromeBrowserPolicyConnector::InitPolicyProviders() { -- std::vector<std::unique_ptr<ConfigurationPolicyProvider>> providers; -- std::unique_ptr<ConfigurationPolicyProvider> platform_provider = -- CreatePlatformProvider(); -- if (platform_provider) { -- platform_provider_ = platform_provider.get(); -- providers.push_back(std::move(platform_provider)); -- } -- BuildPolicyProviders(&providers); -- SetPolicyProviders(std::move(providers)); --} -- - void ChromeBrowserPolicyConnector::Init( - PrefService* local_state, - scoped_refptr<net::URLRequestContextGetter> request_context) { -@@ -104,6 +92,19 @@ ChromeBrowserPolicyConnector::GetPlatformProvider() { - return provider ? provider : platform_provider_; - } - -+std::vector<std::unique_ptr<policy::ConfigurationPolicyProvider>> -+ChromeBrowserPolicyConnector::CreatePolicyProviders() { -+ auto providers = BrowserPolicyConnector::CreatePolicyProviders(); -+ std::unique_ptr<ConfigurationPolicyProvider> platform_provider = -+ CreatePlatformProvider(); -+ if (platform_provider) { -+ platform_provider_ = platform_provider.get(); -+ // PlatformProvider should be before all other providers (highest priority). -+ providers.insert(providers.begin(), std::move(platform_provider)); -+ } -+ return providers; -+} -+ - std::unique_ptr<ConfigurationPolicyProvider> - ChromeBrowserPolicyConnector::CreatePlatformProvider() { - #if defined(OS_WIN) -@@ -140,7 +141,4 @@ ChromeBrowserPolicyConnector::CreatePlatformProvider() { - #endif - } - --void ChromeBrowserPolicyConnector::BuildPolicyProviders( -- std::vector<std::unique_ptr<ConfigurationPolicyProvider>>* providers) {} -- - } // namespace policy -diff --git a/chrome/browser/policy/chrome_browser_policy_connector.h b/chrome/browser/policy/chrome_browser_policy_connector.h -index 14f1ddfae8..5b21e20fd5 100644 ---- a/chrome/browser/policy/chrome_browser_policy_connector.h -+++ b/chrome/browser/policy/chrome_browser_policy_connector.h -@@ -42,9 +42,6 @@ class ChromeBrowserPolicyConnector : public BrowserPolicyConnector { - // class to notify observers. - void OnResourceBundleCreated(); - -- // TODO(sky): remove. Temporary until resolve ordering. -- void InitPolicyProviders(); -- - void Init( - PrefService* local_state, - scoped_refptr<net::URLRequestContextGetter> request_context) override; -@@ -52,12 +49,9 @@ class ChromeBrowserPolicyConnector : public BrowserPolicyConnector { - ConfigurationPolicyProvider* GetPlatformProvider(); - - protected: -- // Called from Init() to build the list of ConfigurationPolicyProviders that -- // is supplied to SetPolicyProviders(). This implementation does nothing -- // and is provided for subclasses. NOTE: |providers| may already contain -- // some providers, generally subclasses should append. -- virtual void BuildPolicyProviders( -- std::vector<std::unique_ptr<ConfigurationPolicyProvider>>* providers); -+ // BrowserPolicyConnector: -+ std::vector<std::unique_ptr<policy::ConfigurationPolicyProvider>> -+ CreatePolicyProviders() override; - - private: - std::unique_ptr<ConfigurationPolicyProvider> CreatePlatformProvider(); -diff --git a/chrome/browser/policy/profile_policy_connector.cc b/chrome/browser/policy/profile_policy_connector.cc -index 1ca34bab0e..de4286dcdb 100644 ---- a/chrome/browser/policy/profile_policy_connector.cc -+++ b/chrome/browser/policy/profile_policy_connector.cc -@@ -104,10 +104,7 @@ void ProfilePolicyConnector::Init( - } - #endif - -- std::unique_ptr<PolicyServiceImpl> policy_service = -- std::make_unique<PolicyServiceImpl>(); -- policy_service->SetProviders(policy_providers_); -- policy_service_ = std::move(policy_service); -+ policy_service_ = std::make_unique<PolicyServiceImpl>(policy_providers_); - - #if defined(OS_CHROMEOS) - if (is_primary_user_) { -diff --git a/chrome/browser/policy/profile_policy_connector_factory.cc b/chrome/browser/policy/profile_policy_connector_factory.cc -index e96938ca1e..e8a5f0814d 100644 ---- a/chrome/browser/policy/profile_policy_connector_factory.cc -+++ b/chrome/browser/policy/profile_policy_connector_factory.cc -@@ -154,8 +154,7 @@ ProfilePolicyConnectorFactory::CreateForBrowserContextInternal( - providers.push_back(test_providers_.front()); - test_providers_.pop_front(); - std::unique_ptr<PolicyServiceImpl> service = -- std::make_unique<PolicyServiceImpl>(); -- service->SetProviders(providers); -+ std::make_unique<PolicyServiceImpl>(std::move(providers)); - connector->InitForTesting(std::move(service)); - } - -diff --git a/chrome/browser/prefs/proxy_policy_unittest.cc b/chrome/browser/prefs/proxy_policy_unittest.cc -index 4ed5293dee..f387aa4640 100644 ---- a/chrome/browser/prefs/proxy_policy_unittest.cc -+++ b/chrome/browser/prefs/proxy_policy_unittest.cc -@@ -98,8 +98,7 @@ class ProxyPolicyTest : public testing::Test { - - PolicyServiceImpl::Providers providers; - providers.push_back(&provider_); -- policy_service_ = std::make_unique<PolicyServiceImpl>(); -- policy_service_->SetProviders(providers); -+ policy_service_ = std::make_unique<PolicyServiceImpl>(std::move(providers)); - provider_.Init(); - } - -diff --git a/chrome/test/base/testing_profile.cc b/chrome/test/base/testing_profile.cc -index 19a9b0e57d..429b1cfa6d 100644 ---- a/chrome/test/base/testing_profile.cc -+++ b/chrome/test/base/testing_profile.cc -@@ -800,8 +800,7 @@ void TestingProfile::CreateProfilePolicyConnector() { - if (!policy_service_) { - std::vector<policy::ConfigurationPolicyProvider*> providers; - std::unique_ptr<policy::PolicyServiceImpl> policy_service = -- std::make_unique<policy::PolicyServiceImpl>(); -- policy_service->SetProviders(providers); -+ std::make_unique<policy::PolicyServiceImpl>(std::move(providers)); - policy_service_ = std::move(policy_service); - } - profile_policy_connector_.reset(new policy::ProfilePolicyConnector()); -diff --git a/components/policy/core/browser/browser_policy_connector_base.cc b/components/policy/core/browser/browser_policy_connector_base.cc -index cc9625f4f8..ccac080728 100644 ---- a/components/policy/core/browser/browser_policy_connector_base.cc -+++ b/components/policy/core/browser/browser_policy_connector_base.cc -@@ -26,8 +26,7 @@ ConfigurationPolicyProvider* g_testing_provider = nullptr; - } // namespace - - BrowserPolicyConnectorBase::BrowserPolicyConnectorBase( -- const HandlerListFactory& handler_list_factory) -- : is_initialized_(false) { -+ const HandlerListFactory& handler_list_factory) { - // GetPolicyService() must be ready after the constructor is done. - // The connector is created very early during startup, when the browser - // threads aren't running yet; initialize components that need local_state, -@@ -56,10 +55,8 @@ void BrowserPolicyConnectorBase::Shutdown() { - is_initialized_ = false; - if (g_testing_provider) - g_testing_provider->Shutdown(); -- if (policy_providers_) { -- for (const auto& provider : *policy_providers_) -- provider->Shutdown(); -- } -+ for (const auto& provider : policy_providers_) -+ provider->Shutdown(); - // Drop g_testing_provider so that tests executed with --single_process can - // call SetPolicyProviderForTesting() again. It is still owned by the test. - g_testing_provider = nullptr; -@@ -75,12 +72,23 @@ CombinedSchemaRegistry* BrowserPolicyConnectorBase::GetSchemaRegistry() { - } - - PolicyService* BrowserPolicyConnectorBase::GetPolicyService() { -- if (!policy_service_) { -- g_created_policy_service = true; -- policy_service_ = std::make_unique<PolicyServiceImpl>(); -- if (policy_providers_ || g_testing_provider) -- policy_service_->SetProviders(GetProvidersForPolicyService()); -- } -+ if (policy_service_) -+ return policy_service_.get(); -+ -+ DCHECK(!is_initialized_); -+ is_initialized_ = true; -+ -+ policy_providers_ = CreatePolicyProviders(); -+ -+ if (g_testing_provider) -+ g_testing_provider->Init(GetSchemaRegistry()); -+ -+ for (const auto& provider : policy_providers_) -+ provider->Init(GetSchemaRegistry()); -+ -+ g_created_policy_service = true; -+ policy_service_ = -+ std::make_unique<PolicyServiceImpl>(GetProvidersForPolicyService()); - return policy_service_.get(); - } - -@@ -111,32 +119,6 @@ BrowserPolicyConnectorBase::GetPolicyProviderForTesting() { - return g_testing_provider; - } - --void BrowserPolicyConnectorBase::SetPolicyProviders( -- std::vector<std::unique_ptr<ConfigurationPolicyProvider>> providers) { -- // SetPolicyProviders() should only called once. -- DCHECK(!is_initialized_); -- policy_providers_ = std::move(providers); -- -- if (g_testing_provider) -- g_testing_provider->Init(GetSchemaRegistry()); -- -- for (const auto& provider : *policy_providers_) -- provider->Init(GetSchemaRegistry()); -- -- is_initialized_ = true; -- -- if (policy_service_) { -- if (!policy_service_->has_providers()) { -- policy_service_->SetProviders(GetProvidersForPolicyService()); -- } else { -- // GetPolicyService() triggers calling SetProviders() if -- // |g_testing_provider| has been set. That's the only way that should -- // result in ending up in this branch. -- DCHECK(g_testing_provider); -- } -- } --} -- - std::vector<ConfigurationPolicyProvider*> - BrowserPolicyConnectorBase::GetProvidersForPolicyService() { - std::vector<ConfigurationPolicyProvider*> providers; -@@ -144,12 +126,17 @@ BrowserPolicyConnectorBase::GetProvidersForPolicyService() { - providers.push_back(g_testing_provider); - return providers; - } -- providers.reserve(policy_providers_->size()); -- for (const auto& policy : *policy_providers_) -+ providers.reserve(policy_providers_.size()); -+ for (const auto& policy : policy_providers_) - providers.push_back(policy.get()); - return providers; - } - -+std::vector<std::unique_ptr<ConfigurationPolicyProvider>> -+BrowserPolicyConnectorBase::CreatePolicyProviders() { -+ return {}; -+} -+ - void BrowserPolicyConnectorBase::OnResourceBundleCreated() { - std::vector<base::OnceClosure> resource_bundle_callbacks; - std::swap(resource_bundle_callbacks, resource_bundle_callbacks_); -diff --git a/components/policy/core/browser/browser_policy_connector_base.h b/components/policy/core/browser/browser_policy_connector_base.h -index a7674b55cd..d2d05f788c 100644 ---- a/components/policy/core/browser/browser_policy_connector_base.h -+++ b/components/policy/core/browser/browser_policy_connector_base.h -@@ -10,7 +10,6 @@ - - #include "base/callback_forward.h" - #include "base/macros.h" --#include "base/optional.h" - #include "components/policy/core/browser/configuration_policy_handler_list.h" - #include "components/policy/core/common/schema.h" - #include "components/policy/core/common/schema_registry.h" -@@ -73,10 +72,11 @@ class POLICY_EXPORT BrowserPolicyConnectorBase { - explicit BrowserPolicyConnectorBase( - const HandlerListFactory& handler_list_factory); - -- // Sets the set of providers, in decreasing order of priority. May only be -- // called once. -- void SetPolicyProviders( -- std::vector<std::unique_ptr<ConfigurationPolicyProvider>> providers); -+ // Called from GetPolicyService() to create the set of -+ // ConfigurationPolicyProviders that are used, in decreasing order of -+ // priority. -+ virtual std::vector<std::unique_ptr<ConfigurationPolicyProvider>> -+ CreatePolicyProviders(); - - // Must be called when ui::ResourceBundle has been loaded, results in running - // any callbacks scheduled in NotifyWhenResourceBundleReady(). -@@ -88,8 +88,10 @@ class POLICY_EXPORT BrowserPolicyConnectorBase { - // called. - std::vector<ConfigurationPolicyProvider*> GetProvidersForPolicyService(); - -- // Whether SetPolicyProviders() but not Shutdown() has been invoked. -- bool is_initialized_; -+ // Set to true when the PolicyService has been created, and false in -+ // Shutdown(). Once created the PolicyService is destroyed in the destructor, -+ // not Shutdown(). -+ bool is_initialized_ = false; - - // Used to convert policies to preferences. The providers declared below - // may trigger policy updates during shutdown, which will result in -@@ -105,8 +107,7 @@ class POLICY_EXPORT BrowserPolicyConnectorBase { - CombinedSchemaRegistry schema_registry_; - - // The browser-global policy providers, in decreasing order of priority. -- base::Optional<std::vector<std::unique_ptr<ConfigurationPolicyProvider>>> -- policy_providers_; -+ std::vector<std::unique_ptr<ConfigurationPolicyProvider>> policy_providers_; - - // Must be deleted before all the policy providers. - std::unique_ptr<PolicyServiceImpl> policy_service_; -diff --git a/components/policy/core/browser/configuration_policy_pref_store_test.cc b/components/policy/core/browser/configuration_policy_pref_store_test.cc -index fbdc51e938..efd4559a95 100644 ---- a/components/policy/core/browser/configuration_policy_pref_store_test.cc -+++ b/components/policy/core/browser/configuration_policy_pref_store_test.cc -@@ -30,8 +30,7 @@ ConfigurationPolicyPrefStoreTest::ConfigurationPolicyPrefStoreTest() - .WillRepeatedly(Return(false)); - provider_.Init(); - providers_.push_back(&provider_); -- policy_service_ = std::make_unique<PolicyServiceImpl>(); -- policy_service_->SetProviders(providers_); -+ policy_service_ = std::make_unique<PolicyServiceImpl>(providers_); - store_ = new ConfigurationPolicyPrefStore( - nullptr, policy_service_.get(), &handler_list_, POLICY_LEVEL_MANDATORY); - } -diff --git a/components/policy/core/browser/proxy_policy_handler_unittest.cc b/components/policy/core/browser/proxy_policy_handler_unittest.cc -index 8ee359336b..6bd9bd54c8 100644 ---- a/components/policy/core/browser/proxy_policy_handler_unittest.cc -+++ b/components/policy/core/browser/proxy_policy_handler_unittest.cc -@@ -32,8 +32,7 @@ class ProxyPolicyHandlerTest - // preprocessor. The previous store must be nulled out first so that it - // removes itself from the service's observer list. - store_ = nullptr; -- policy_service_ = std::make_unique<PolicyServiceImpl>(); -- policy_service_->SetProviders(providers_); -+ policy_service_ = std::make_unique<PolicyServiceImpl>(providers_); - store_ = new ConfigurationPolicyPrefStore( - nullptr, policy_service_.get(), &handler_list_, POLICY_LEVEL_MANDATORY); - } -diff --git a/components/policy/core/common/policy_service_impl.cc b/components/policy/core/common/policy_service_impl.cc -index 42b6138c85..dd555a1463 100644 ---- a/components/policy/core/common/policy_service_impl.cc -+++ b/components/policy/core/common/policy_service_impl.cc -@@ -72,25 +72,12 @@ void RemapProxyPolicies(PolicyMap* policies) { - - } // namespace - --PolicyServiceImpl::PolicyServiceImpl() : update_task_ptr_factory_(this) { -- for (int domain = 0; domain < POLICY_DOMAIN_SIZE; ++domain) -- initialization_complete_[domain] = false; --} -- --PolicyServiceImpl::~PolicyServiceImpl() { -- DCHECK(thread_checker_.CalledOnValidThread()); -- if (providers_) { -- for (auto* provider : *providers_) -- provider->RemoveObserver(this); -- } --} -- --void PolicyServiceImpl::SetProviders(Providers providers) { -- DCHECK(!providers_); -+PolicyServiceImpl::PolicyServiceImpl(Providers providers) -+ : update_task_ptr_factory_(this) { - providers_ = std::move(providers); - for (int domain = 0; domain < POLICY_DOMAIN_SIZE; ++domain) - initialization_complete_[domain] = true; -- for (auto* provider : *providers_) { -+ for (auto* provider : providers_) { - provider->AddObserver(this); - for (int domain = 0; domain < POLICY_DOMAIN_SIZE; ++domain) { - initialization_complete_[domain] &= -@@ -102,6 +89,12 @@ void PolicyServiceImpl::SetProviders(Providers providers) { - MergeAndTriggerUpdates(); - } - -+PolicyServiceImpl::~PolicyServiceImpl() { -+ DCHECK(thread_checker_.CalledOnValidThread()); -+ for (auto* provider : providers_) -+ provider->RemoveObserver(this); -+} -+ - void PolicyServiceImpl::AddObserver(PolicyDomain domain, - PolicyService::Observer* observer) { - DCHECK(thread_checker_.CalledOnValidThread()); -@@ -143,7 +136,7 @@ void PolicyServiceImpl::RefreshPolicies(const base::Closure& callback) { - if (!callback.is_null()) - refresh_callbacks_.push_back(callback); - -- if (!providers_ || providers_->empty()) { -+ if (providers_.empty()) { - // Refresh is immediately complete if there are no providers. See the note - // on OnUpdatePolicy() about why this is a posted task. - update_task_ptr_factory_.InvalidateWeakPtrs(); -@@ -153,15 +146,15 @@ void PolicyServiceImpl::RefreshPolicies(const base::Closure& callback) { - } else { - // Some providers might invoke OnUpdatePolicy synchronously while handling - // RefreshPolicies. Mark all as pending before refreshing. -- for (auto* provider : *providers_) -+ for (auto* provider : providers_) - refresh_pending_.insert(provider); -- for (auto* provider : *providers_) -+ for (auto* provider : providers_) - provider->RefreshPolicies(); - } - } - - void PolicyServiceImpl::OnUpdatePolicy(ConfigurationPolicyProvider* provider) { -- DCHECK_EQ(1, std::count(providers_->begin(), providers_->end(), provider)); -+ DCHECK_EQ(1, std::count(providers_.begin(), providers_.end(), provider)); - refresh_pending_.erase(provider); - - // Note: a policy change may trigger further policy changes in some providers. -@@ -194,13 +187,11 @@ void PolicyServiceImpl::MergeAndTriggerUpdates() { - // Merge from each provider in their order of priority. - const PolicyNamespace chrome_namespace(POLICY_DOMAIN_CHROME, std::string()); - PolicyBundle bundle; -- if (providers_) { -- for (auto* provider : *providers_) { -- PolicyBundle provided_bundle; -- provided_bundle.CopyFrom(provider->policies()); -- RemapProxyPolicies(&provided_bundle.Get(chrome_namespace)); -- bundle.MergeFrom(provided_bundle); -- } -+ for (auto* provider : providers_) { -+ PolicyBundle provided_bundle; -+ provided_bundle.CopyFrom(provider->policies()); -+ RemapProxyPolicies(&provided_bundle.Get(chrome_namespace)); -+ bundle.MergeFrom(provided_bundle); - } - - // Swap first, so that observers that call GetPolicies() see the current -@@ -247,9 +238,6 @@ void PolicyServiceImpl::MergeAndTriggerUpdates() { - void PolicyServiceImpl::CheckInitializationComplete() { - DCHECK(thread_checker_.CalledOnValidThread()); - -- if (!providers_) -- return; -- - // Check if all the providers just became initialized for each domain; if so, - // notify that domain's observers. - for (int domain = 0; domain < POLICY_DOMAIN_SIZE; ++domain) { -@@ -259,7 +247,7 @@ void PolicyServiceImpl::CheckInitializationComplete() { - PolicyDomain policy_domain = static_cast<PolicyDomain>(domain); - - bool all_complete = true; -- for (auto* provider : *providers_) { -+ for (auto* provider : providers_) { - if (!provider->IsInitializationComplete(policy_domain)) { - all_complete = false; - break; -diff --git a/components/policy/core/common/policy_service_impl.h b/components/policy/core/common/policy_service_impl.h -index 0e6003e87b..985b27e257 100644 ---- a/components/policy/core/common/policy_service_impl.h -+++ b/components/policy/core/common/policy_service_impl.h -@@ -15,7 +15,6 @@ - #include "base/macros.h" - #include "base/memory/weak_ptr.h" - #include "base/observer_list.h" --#include "base/optional.h" - #include "base/threading/thread_checker.h" - #include "components/policy/core/common/configuration_policy_provider.h" - #include "components/policy/core/common/policy_bundle.h" -@@ -32,18 +31,11 @@ class POLICY_EXPORT PolicyServiceImpl - public: - using Providers = std::vector<ConfigurationPolicyProvider*>; - -- // Creates a new PolicyServiceImpl, it is expected SetProviders() is called -- // once to complete initialization. -- PolicyServiceImpl(); -- -+ // Creates a new PolicyServiceImpl with the list of -+ // ConfigurationPolicyProviders, in order of decreasing priority. -+ explicit PolicyServiceImpl(Providers providers); - ~PolicyServiceImpl() override; - -- // Sets the providers; see description of constructor for details. -- void SetProviders(Providers providers); -- -- // Returns true if SetProviders() was called. -- bool has_providers() const { return providers_.has_value(); } -- - // PolicyService overrides: - void AddObserver(PolicyDomain domain, - PolicyService::Observer* observer) override; -@@ -76,8 +68,8 @@ class POLICY_EXPORT PolicyServiceImpl - // Invokes all the refresh callbacks if there are no more refreshes pending. - void CheckRefreshComplete(); - -- // The providers set via SetProviders(), in order of decreasing priority. -- base::Optional<Providers> providers_; -+ // The providers, in order of decreasing priority. -+ Providers providers_; - - // Maps each policy namespace to its current policies. - PolicyBundle policy_bundle_; -diff --git a/components/policy/core/common/policy_service_impl_unittest.cc b/components/policy/core/common/policy_service_impl_unittest.cc -index 857e38226e..bc84baa9d6 100644 ---- a/components/policy/core/common/policy_service_impl_unittest.cc -+++ b/components/policy/core/common/policy_service_impl_unittest.cc -@@ -120,8 +120,7 @@ class PolicyServiceTest : public testing::Test { - providers.push_back(&provider0_); - providers.push_back(&provider1_); - providers.push_back(&provider2_); -- policy_service_ = std::make_unique<PolicyServiceImpl>(); -- policy_service_->SetProviders(providers); -+ policy_service_ = std::make_unique<PolicyServiceImpl>(std::move(providers)); - } - - void TearDown() override { -@@ -561,8 +560,7 @@ TEST_F(PolicyServiceTest, IsInitializationComplete) { - providers.push_back(&provider0_); - providers.push_back(&provider1_); - providers.push_back(&provider2_); -- policy_service_ = std::make_unique<PolicyServiceImpl>(); -- policy_service_->SetProviders(providers); -+ policy_service_ = std::make_unique<PolicyServiceImpl>(std::move(providers)); - EXPECT_FALSE(policy_service_->IsInitializationComplete(POLICY_DOMAIN_CHROME)); - EXPECT_FALSE( - policy_service_->IsInitializationComplete(POLICY_DOMAIN_EXTENSIONS)); -diff --git a/remoting/host/policy_watcher.cc b/remoting/host/policy_watcher.cc -index 297dcd7b2a..c428bad430 100644 ---- a/remoting/host/policy_watcher.cc -+++ b/remoting/host/policy_watcher.cc -@@ -376,8 +376,7 @@ std::unique_ptr<PolicyWatcher> PolicyWatcher::CreateFromPolicyLoader( - policy::PolicyServiceImpl::Providers providers; - providers.push_back(policy_provider.get()); - std::unique_ptr<policy::PolicyServiceImpl> policy_service = -- std::make_unique<policy::PolicyServiceImpl>(); -- policy_service->SetProviders(providers); -+ std::make_unique<policy::PolicyServiceImpl>(std::move(providers)); - - policy::PolicyService* borrowed_policy_service = policy_service.get(); - return base::WrapUnique(new PolicyWatcher( --- -2.14.3 - diff --git a/chromium/chromium/chromium-gcc7-r533185.patch b/chromium/chromium/chromium-gcc7-r533185.patch deleted file mode 100644 index 04e45b7..0000000 --- a/chromium/chromium/chromium-gcc7-r533185.patch +++ /dev/null @@ -1,208 +0,0 @@ -From d39417a581d92178fea880cc5e4768e17db265f9 Mon Sep 17 00:00:00 2001 -From: Hidehiko Abe <hidehiko@chromium.org> -Date: Wed, 31 Jan 2018 03:22:42 +0000 -Subject: [PATCH] Implement converting constructors from Optional<U>. - -BUG=784732 -TEST=Ran trybot. - -Change-Id: Icbb9c5596b045ca0c684cdad0343a2605d00dbb1 -Reviewed-on: https://chromium-review.googlesource.com/856296 -Reviewed-by: danakj <danakj@chromium.org> -Commit-Queue: Hidehiko Abe <hidehiko@chromium.org> -Cr-Commit-Position: refs/heads/master@{#533185} ---- - base/optional.h | 78 ++++++++++++++++++++++++++++++++++++++++++++++- - base/optional_unittest.cc | 59 +++++++++++++++++++++++++++++++++++ - 2 files changed, 136 insertions(+), 1 deletion(-) - -diff --git a/base/optional.h b/base/optional.h -index dc77539087..8e56ca640b 100644 ---- a/base/optional.h -+++ b/base/optional.h -@@ -30,6 +30,10 @@ constexpr in_place_t in_place = {}; - // http://en.cppreference.com/w/cpp/utility/optional/nullopt - constexpr nullopt_t nullopt(0); - -+// Forward declaration, which is refered by following helpers. -+template <typename T> -+class Optional; -+ - namespace internal { - - template <typename T, bool = std::is_trivially_destructible<T>::value> -@@ -219,6 +223,19 @@ class OptionalBase { - constexpr explicit OptionalBase(in_place_t, Args&&... args) - : storage_(in_place, std::forward<Args>(args)...) {} - -+ // Implementation of converting constructors. -+ template <typename U> -+ explicit OptionalBase(const OptionalBase<U>& other) { -+ if (other.storage_.is_populated_) -+ storage_.Init(other.storage_.value_); -+ } -+ -+ template <typename U> -+ explicit OptionalBase(OptionalBase<U>&& other) { -+ if (other.storage_.is_populated_) -+ storage_.Init(std::move(other.storage_.value_)); -+ } -+ - ~OptionalBase() = default; - - OptionalBase& operator=(const OptionalBase& other) { -@@ -262,6 +279,11 @@ class OptionalBase { - storage_.is_populated_ = false; - } - -+ // For implementing conversion, allow access to other typed OptionalBase -+ // class. -+ template <typename U> -+ friend class OptionalBase; -+ - OptionalStorage<T> storage_; - }; - -@@ -317,6 +339,20 @@ struct MoveAssignable<false> { - MoveAssignable& operator=(MoveAssignable&&) = delete; - }; - -+// Helper to conditionally enable converting constructors. -+template <typename T, typename U> -+struct IsConvertibleFromOptional -+ : std::integral_constant< -+ bool, -+ std::is_constructible<T, Optional<U>&>::value || -+ std::is_constructible<T, const Optional<U>&>::value || -+ std::is_constructible<T, Optional<U>&&>::value || -+ std::is_constructible<T, const Optional<U>&&>::value || -+ std::is_convertible<Optional<U>&, T>::value || -+ std::is_convertible<const Optional<U>&, T>::value || -+ std::is_convertible<Optional<U>&&, T>::value || -+ std::is_convertible<const Optional<U>&&, T>::value> {}; -+ - } // namespace internal - - // base::Optional is a Chromium version of the C++17 optional class: -@@ -347,7 +383,47 @@ class Optional - constexpr Optional(const Optional& other) = default; - constexpr Optional(Optional&& other) = default; - -- constexpr Optional(nullopt_t) {} -+ constexpr Optional(nullopt_t) {} // NOLINT(runtime/explicit) -+ -+ // Converting copy constructor. "explicit" only if -+ // std::is_convertible<const U&, T>::value is false. It is implemented by -+ // declaring two almost same constructors, but that condition in enable_if_t -+ // is different, so that either one is chosen, thanks to SFINAE. -+ template < -+ typename U, -+ std::enable_if_t<std::is_constructible<T, const U&>::value && -+ !internal::IsConvertibleFromOptional<T, U>::value && -+ std::is_convertible<const U&, T>::value, -+ bool> = false> -+ Optional(const Optional<U>& other) : internal::OptionalBase<T>(other) {} -+ -+ template < -+ typename U, -+ std::enable_if_t<std::is_constructible<T, const U&>::value && -+ !internal::IsConvertibleFromOptional<T, U>::value && -+ !std::is_convertible<const U&, T>::value, -+ bool> = false> -+ explicit Optional(const Optional<U>& other) -+ : internal::OptionalBase<T>(other) {} -+ -+ // Converting move constructor. Similar to converting copy constructor, -+ // declaring two (explicit and non-explicit) constructors. -+ template < -+ typename U, -+ std::enable_if_t<std::is_constructible<T, U&&>::value && -+ !internal::IsConvertibleFromOptional<T, U>::value && -+ std::is_convertible<U&&, T>::value, -+ bool> = false> -+ Optional(Optional<U>&& other) : internal::OptionalBase<T>(std::move(other)) {} -+ -+ template < -+ typename U, -+ std::enable_if_t<std::is_constructible<T, U&&>::value && -+ !internal::IsConvertibleFromOptional<T, U>::value && -+ !std::is_convertible<U&&, T>::value, -+ bool> = false> -+ explicit Optional(Optional<U>&& other) -+ : internal::OptionalBase<T>(std::move(other)) {} - - constexpr Optional(const T& value) - : internal::OptionalBase<T>(in_place, value) {} -diff --git a/base/optional_unittest.cc b/base/optional_unittest.cc -index 09f3106bfa..da3ac2da94 100644 ---- a/base/optional_unittest.cc -+++ b/base/optional_unittest.cc -@@ -364,6 +364,65 @@ TEST(OptionalTest, MoveValueConstructor) { - } - } - -+TEST(OptionalTest, ConvertingCopyConstructor) { -+ { -+ Optional<int> first(1); -+ Optional<double> second(first); -+ EXPECT_TRUE(second.has_value()); -+ EXPECT_EQ(1.0, second.value()); -+ } -+ -+ // Make sure explicit is not marked for convertible case. -+ { -+ Optional<int> o(1); -+ ignore_result<Optional<double>>(o); -+ } -+} -+ -+TEST(OptionalTest, ConvertingMoveConstructor) { -+ { -+ Optional<int> first(1); -+ Optional<double> second(std::move(first)); -+ EXPECT_TRUE(second.has_value()); -+ EXPECT_EQ(1.0, second.value()); -+ } -+ -+ // Make sure explicit is not marked for convertible case. -+ { -+ Optional<int> o(1); -+ ignore_result<Optional<double>>(std::move(o)); -+ } -+ -+ { -+ class Test1 { -+ public: -+ explicit Test1(int foo) : foo_(foo) {} -+ -+ int foo() const { return foo_; } -+ -+ private: -+ int foo_; -+ }; -+ -+ // Not copyable but convertible from Test1. -+ class Test2 { -+ public: -+ Test2(const Test2&) = delete; -+ explicit Test2(Test1&& other) : bar_(other.foo()) {} -+ -+ double bar() const { return bar_; } -+ -+ private: -+ double bar_; -+ }; -+ -+ Optional<Test1> first(in_place, 42); -+ Optional<Test2> second(std::move(first)); -+ EXPECT_TRUE(second.has_value()); -+ EXPECT_EQ(42.0, second->bar()); -+ } -+} -+ - TEST(OptionalTest, ConstructorForwardArguments) { - { - constexpr Optional<float> a(base::in_place, 0.1f); --- -2.14.3 - diff --git a/chromium/chromium/chromium-gcc7-r538032.patch b/chromium/chromium/chromium-gcc7-r538032.patch deleted file mode 100644 index c3f7fe9..0000000 --- a/chromium/chromium/chromium-gcc7-r538032.patch +++ /dev/null @@ -1,184 +0,0 @@ -From 14f92bee690d0b1884864db08f3e7f03abc85c00 Mon Sep 17 00:00:00 2001 -From: Hidehiko Abe <hidehiko@chromium.org> -Date: Wed, 21 Feb 2018 06:01:28 +0000 -Subject: [PATCH] Implement value forward constructor. - -So, older constructors taking const T& or T&& is removed. - -BUG=784732 -TEST=Ran trybot. - -Change-Id: I806b1880bf3bd2bd25da764f7592299a1a742366 -Reviewed-on: https://chromium-review.googlesource.com/856380 -Commit-Queue: Hidehiko Abe <hidehiko@chromium.org> -Reviewed-by: danakj <danakj@chromium.org> -Cr-Commit-Position: refs/heads/master@{#538032} ---- - base/optional.h | 41 +++++++++++++++++++++---- - base/optional_unittest.cc | 77 +++++++++++++++++++++++++++++++++++++++++++++++ - 2 files changed, 112 insertions(+), 6 deletions(-) - -diff --git a/base/optional.h b/base/optional.h -index 8e56ca640b..9599baf03b 100644 ---- a/base/optional.h -+++ b/base/optional.h -@@ -353,6 +353,10 @@ struct IsConvertibleFromOptional - std::is_convertible<Optional<U>&&, T>::value || - std::is_convertible<const Optional<U>&&, T>::value> {}; - -+// Forward compatibility for C++20. -+template <typename T> -+using RemoveCvRefT = std::remove_cv_t<std::remove_reference_t<T>>; -+ - } // namespace internal - - // base::Optional is a Chromium version of the C++17 optional class: -@@ -366,6 +370,13 @@ struct IsConvertibleFromOptional - // - 'constexpr' might be missing in some places for reasons specified locally. - // - No exceptions are thrown, because they are banned from Chromium. - // - All the non-members are in the 'base' namespace instead of 'std'. -+// -+// Note that T cannot have a constructor T(Optional<T>) etc. Optional<T> checks -+// T's constructor (specifically via IsConvertibleFromOptional), and in the -+// check whether T can be constructible from Optional<T>, which is recursive -+// so it does not work. As of Feb 2018, std::optional C++17 implementation in -+// both clang and gcc has same limitation. MSVC SFINAE looks to have different -+// behavior, but anyway it reports an error, too. - template <typename T> - class Optional - : public internal::OptionalBase<T>, -@@ -425,12 +436,6 @@ class Optional - explicit Optional(Optional<U>&& other) - : internal::OptionalBase<T>(std::move(other)) {} - -- constexpr Optional(const T& value) -- : internal::OptionalBase<T>(in_place, value) {} -- -- constexpr Optional(T&& value) -- : internal::OptionalBase<T>(in_place, std::move(value)) {} -- - template <class... Args> - constexpr explicit Optional(in_place_t, Args&&... args) - : internal::OptionalBase<T>(in_place, std::forward<Args>(args)...) {} -@@ -446,6 +451,30 @@ class Optional - Args&&... args) - : internal::OptionalBase<T>(in_place, il, std::forward<Args>(args)...) {} - -+ // Forward value constructor. Similar to converting constructors, -+ // conditionally explicit. -+ template < -+ typename U = value_type, -+ std::enable_if_t< -+ std::is_constructible<T, U&&>::value && -+ !std::is_same<internal::RemoveCvRefT<U>, in_place_t>::value && -+ !std::is_same<internal::RemoveCvRefT<U>, Optional<T>>::value && -+ std::is_convertible<U&&, T>::value, -+ bool> = false> -+ constexpr Optional(U&& value) -+ : internal::OptionalBase<T>(in_place, std::forward<U>(value)) {} -+ -+ template < -+ typename U = value_type, -+ std::enable_if_t< -+ std::is_constructible<T, U&&>::value && -+ !std::is_same<internal::RemoveCvRefT<U>, in_place_t>::value && -+ !std::is_same<internal::RemoveCvRefT<U>, Optional<T>>::value && -+ !std::is_convertible<U&&, T>::value, -+ bool> = false> -+ constexpr explicit Optional(U&& value) -+ : internal::OptionalBase<T>(in_place, std::forward<U>(value)) {} -+ - ~Optional() = default; - - // Defer copy-/move- assign operator implementation to OptionalBase. -diff --git a/base/optional_unittest.cc b/base/optional_unittest.cc -index da3ac2da94..b098c0eef6 100644 ---- a/base/optional_unittest.cc -+++ b/base/optional_unittest.cc -@@ -465,6 +465,83 @@ TEST(OptionalTest, ConstructorForwardInitListAndArguments) { - } - } - -+TEST(OptionalTest, ForwardConstructor) { -+ { -+ Optional<double> a(1); -+ EXPECT_TRUE(a.has_value()); -+ EXPECT_EQ(1.0, a.value()); -+ } -+ -+ // Test that default type of 'U' is value_type. -+ { -+ struct TestData { -+ int a; -+ double b; -+ bool c; -+ }; -+ -+ Optional<TestData> a({1, 2.0, true}); -+ EXPECT_TRUE(a.has_value()); -+ EXPECT_EQ(1, a->a); -+ EXPECT_EQ(2.0, a->b); -+ EXPECT_TRUE(a->c); -+ } -+ -+ // If T has a constructor with a param Optional<U>, and another ctor with a -+ // param U, then T(Optional<U>) should be used for Optional<T>(Optional<U>) -+ // constructor. -+ { -+ enum class ParamType { -+ DEFAULT_CONSTRUCTED, -+ COPY_CONSTRUCTED, -+ MOVE_CONSTRUCTED, -+ INT, -+ IN_PLACE, -+ OPTIONAL_INT, -+ }; -+ struct Test { -+ Test() : param_type(ParamType::DEFAULT_CONSTRUCTED) {} -+ Test(const Test& param) : param_type(ParamType::COPY_CONSTRUCTED) {} -+ Test(Test&& param) : param_type(ParamType::MOVE_CONSTRUCTED) {} -+ explicit Test(int param) : param_type(ParamType::INT) {} -+ explicit Test(in_place_t param) : param_type(ParamType::IN_PLACE) {} -+ explicit Test(Optional<int> param) -+ : param_type(ParamType::OPTIONAL_INT) {} -+ -+ ParamType param_type; -+ }; -+ -+ // Overload resolution with copy-conversion constructor. -+ { -+ const Optional<int> arg(in_place, 1); -+ Optional<Test> testee(arg); -+ EXPECT_EQ(ParamType::OPTIONAL_INT, testee->param_type); -+ } -+ -+ // Overload resolution with move conversion constructor. -+ { -+ Optional<Test> testee(Optional<int>(in_place, 1)); -+ EXPECT_EQ(ParamType::OPTIONAL_INT, testee->param_type); -+ } -+ -+ // Default constructor should be used. -+ { -+ Optional<Test> testee(in_place); -+ EXPECT_EQ(ParamType::DEFAULT_CONSTRUCTED, testee->param_type); -+ } -+ } -+ -+ { -+ struct Test { -+ Test(int a) {} // NOLINT(runtime/explicit) -+ }; -+ // If T is convertible from U, it is not marked as explicit. -+ static_assert(std::is_convertible<int, Test>::value, -+ "Int should be convertible to Test."); -+ ([](Optional<Test> param) {})(1); -+ } -+} -+ - TEST(OptionalTest, NulloptConstructor) { - constexpr Optional<int> a(base::nullopt); - EXPECT_FALSE(a); --- -2.14.3 - diff --git a/chromium/chromium/chromium-gcc7-r538699.patch b/chromium/chromium/chromium-gcc7-r538699.patch deleted file mode 100644 index 55ce87c..0000000 --- a/chromium/chromium/chromium-gcc7-r538699.patch +++ /dev/null @@ -1,443 +0,0 @@ -From 40ee4aee34e39b711f266bbe3e03f4c033b9cf71 Mon Sep 17 00:00:00 2001 -From: Hidehiko Abe <hidehiko@chromium.org> -Date: Fri, 23 Feb 2018 04:24:12 +0000 -Subject: [PATCH] Update (non-copy, non-move) assign operators. - -Fix perfect-forwarded assign operator to look at condition to -decide whether it should participate in overload resolution. - -Add Optional<U> copy- and move-like assign operators. -For that implementation, OptionalBase's copy-/move-assign -operators are slightly refactored. - -BUG=784732 -TEST=Ran trybot. - -Change-Id: I69db9def857a1cce8e7b05f0c6e11922ee8d95db -Reviewed-on: https://chromium-review.googlesource.com/856539 -Reviewed-by: danakj <danakj@chromium.org> -Commit-Queue: Hidehiko Abe <hidehiko@chromium.org> -Cr-Commit-Position: refs/heads/master@{#538699} ---- - base/optional.h | 88 ++++++++++++----- - base/optional_unittest.cc | 245 ++++++++++++++++++++++++++++++++++++++++++++++ - 2 files changed, 309 insertions(+), 24 deletions(-) - -diff --git a/base/optional.h b/base/optional.h -index 9599baf03b..d65881bd7e 100644 ---- a/base/optional.h -+++ b/base/optional.h -@@ -239,37 +239,37 @@ class OptionalBase { - ~OptionalBase() = default; - - OptionalBase& operator=(const OptionalBase& other) { -- if (!other.storage_.is_populated_) { -- FreeIfNeeded(); -- return *this; -- } -- -- InitOrAssign(other.storage_.value_); -+ CopyAssign(other); - return *this; - } - - OptionalBase& operator=(OptionalBase&& other) { -- if (!other.storage_.is_populated_) { -- FreeIfNeeded(); -- return *this; -- } -- -- InitOrAssign(std::move(other.storage_.value_)); -+ MoveAssign(std::move(other)); - return *this; - } - -- void InitOrAssign(const T& value) { -- if (!storage_.is_populated_) -- storage_.Init(value); -+ template <typename U> -+ void CopyAssign(const OptionalBase<U>& other) { -+ if (other.storage_.is_populated_) -+ InitOrAssign(other.storage_.value_); - else -- storage_.value_ = value; -+ FreeIfNeeded(); - } - -- void InitOrAssign(T&& value) { -- if (!storage_.is_populated_) -- storage_.Init(std::move(value)); -+ template <typename U> -+ void MoveAssign(OptionalBase<U>&& other) { -+ if (other.storage_.is_populated_) -+ InitOrAssign(std::move(other.storage_.value_)); -+ else -+ FreeIfNeeded(); -+ } -+ -+ template <typename U> -+ void InitOrAssign(U&& value) { -+ if (storage_.is_populated_) -+ storage_.value_ = std::forward<U>(value); - else -- storage_.value_ = std::move(value); -+ storage_.Init(std::forward<U>(value)); - } - - void FreeIfNeeded() { -@@ -339,7 +339,7 @@ struct MoveAssignable<false> { - MoveAssignable& operator=(MoveAssignable&&) = delete; - }; - --// Helper to conditionally enable converting constructors. -+// Helper to conditionally enable converting constructors and assign operators. - template <typename T, typename U> - struct IsConvertibleFromOptional - : std::integral_constant< -@@ -353,6 +353,16 @@ struct IsConvertibleFromOptional - std::is_convertible<Optional<U>&&, T>::value || - std::is_convertible<const Optional<U>&&, T>::value> {}; - -+template <typename T, typename U> -+struct IsAssignableFromOptional -+ : std::integral_constant< -+ bool, -+ IsConvertibleFromOptional<T, U>::value || -+ std::is_assignable<T&, Optional<U>&>::value || -+ std::is_assignable<T&, const Optional<U>&>::value || -+ std::is_assignable<T&, Optional<U>&&>::value || -+ std::is_assignable<T&, const Optional<U>&&>::value> {}; -+ - // Forward compatibility for C++20. - template <typename T> - using RemoveCvRefT = std::remove_cv_t<std::remove_reference_t<T>>; -@@ -486,14 +496,42 @@ class Optional - return *this; - } - -- template <class U> -- typename std::enable_if<std::is_same<std::decay_t<U>, T>::value, -- Optional&>::type -+ // Perfect-forwarded assignment. -+ template <typename U> -+ std::enable_if_t< -+ !std::is_same<internal::RemoveCvRefT<U>, Optional<T>>::value && -+ std::is_constructible<T, U>::value && -+ std::is_assignable<T&, U>::value && -+ (!std::is_scalar<T>::value || -+ !std::is_same<std::decay_t<U>, T>::value), -+ Optional&> - operator=(U&& value) { - InitOrAssign(std::forward<U>(value)); - return *this; - } - -+ // Copy assign the state of other. -+ template <typename U> -+ std::enable_if_t<!internal::IsAssignableFromOptional<T, U>::value && -+ std::is_constructible<T, const U&>::value && -+ std::is_assignable<T&, const U&>::value, -+ Optional&> -+ operator=(const Optional<U>& other) { -+ CopyAssign(other); -+ return *this; -+ } -+ -+ // Move assign the state of other. -+ template <typename U> -+ std::enable_if_t<!internal::IsAssignableFromOptional<T, U>::value && -+ std::is_constructible<T, U>::value && -+ std::is_assignable<T&, U>::value, -+ Optional&> -+ operator=(Optional<U>&& other) { -+ MoveAssign(std::move(other)); -+ return *this; -+ } -+ - constexpr const T* operator->() const { - DCHECK(storage_.is_populated_); - return &value(); -@@ -605,8 +643,10 @@ class Optional - private: - // Accessing template base class's protected member needs explicit - // declaration to do so. -+ using internal::OptionalBase<T>::CopyAssign; - using internal::OptionalBase<T>::FreeIfNeeded; - using internal::OptionalBase<T>::InitOrAssign; -+ using internal::OptionalBase<T>::MoveAssign; - using internal::OptionalBase<T>::storage_; - }; - -diff --git a/base/optional_unittest.cc b/base/optional_unittest.cc -index b098c0eef6..17c9ee4f51 100644 ---- a/base/optional_unittest.cc -+++ b/base/optional_unittest.cc -@@ -649,6 +649,37 @@ TEST(OptionalTest, AssignObject) { - EXPECT_TRUE(!!b); - EXPECT_EQ(a->foo(), b->foo()); - } -+ -+ // Converting assignment. -+ { -+ Optional<int> a(in_place, 1); -+ Optional<double> b; -+ b = a; -+ -+ EXPECT_TRUE(!!a); -+ EXPECT_TRUE(!!b); -+ EXPECT_EQ(1, a.value()); -+ EXPECT_EQ(1.0, b.value()); -+ } -+ -+ { -+ Optional<int> a(in_place, 42); -+ Optional<double> b(in_place, 1); -+ b = a; -+ -+ EXPECT_TRUE(!!a); -+ EXPECT_TRUE(!!b); -+ EXPECT_EQ(42, a.value()); -+ EXPECT_EQ(42.0, b.value()); -+ } -+ -+ { -+ Optional<int> a; -+ Optional<double> b(in_place, 1); -+ b = a; -+ EXPECT_FALSE(!!a); -+ EXPECT_FALSE(!!b); -+ } - } - - TEST(OptionalTest, AssignObject_rvalue) { -@@ -717,6 +748,36 @@ TEST(OptionalTest, AssignObject_rvalue) { - EXPECT_TRUE(!!b); - EXPECT_EQ(42, b->foo()); - } -+ -+ // Converting assignment. -+ { -+ Optional<int> a(in_place, 1); -+ Optional<double> b; -+ b = std::move(a); -+ -+ EXPECT_TRUE(!!a); -+ EXPECT_TRUE(!!b); -+ EXPECT_EQ(1.0, b.value()); -+ } -+ -+ { -+ Optional<int> a(in_place, 42); -+ Optional<double> b(in_place, 1); -+ b = std::move(a); -+ -+ EXPECT_TRUE(!!a); -+ EXPECT_TRUE(!!b); -+ EXPECT_EQ(42.0, b.value()); -+ } -+ -+ { -+ Optional<int> a; -+ Optional<double> b(in_place, 1); -+ b = std::move(a); -+ -+ EXPECT_FALSE(!!a); -+ EXPECT_FALSE(!!b); -+ } - } - - TEST(OptionalTest, AssignNull) { -@@ -745,6 +806,190 @@ TEST(OptionalTest, AssignNull) { - } - } - -+TEST(OptionalTest, AssignOverload) { -+ struct Test1 { -+ enum class State { -+ CONSTRUCTED, -+ MOVED, -+ }; -+ State state = State::CONSTRUCTED; -+ }; -+ -+ // Here, Optional<Test2> can be assigned from Optioanl<Test1>. -+ // In case of move, marks MOVED to Test1 instance. -+ struct Test2 { -+ enum class State { -+ DEFAULT_CONSTRUCTED, -+ COPY_CONSTRUCTED_FROM_TEST1, -+ MOVE_CONSTRUCTED_FROM_TEST1, -+ COPY_ASSIGNED_FROM_TEST1, -+ MOVE_ASSIGNED_FROM_TEST1, -+ }; -+ -+ Test2() = default; -+ explicit Test2(const Test1& test1) -+ : state(State::COPY_CONSTRUCTED_FROM_TEST1) {} -+ explicit Test2(Test1&& test1) : state(State::MOVE_CONSTRUCTED_FROM_TEST1) { -+ test1.state = Test1::State::MOVED; -+ } -+ Test2& operator=(const Test1& test1) { -+ state = State::COPY_ASSIGNED_FROM_TEST1; -+ return *this; -+ } -+ Test2& operator=(Test1&& test1) { -+ state = State::MOVE_ASSIGNED_FROM_TEST1; -+ test1.state = Test1::State::MOVED; -+ return *this; -+ } -+ -+ State state = State::DEFAULT_CONSTRUCTED; -+ }; -+ -+ { -+ Optional<Test1> a(in_place); -+ Optional<Test2> b; -+ -+ b = a; -+ EXPECT_TRUE(!!a); -+ EXPECT_TRUE(!!b); -+ EXPECT_EQ(Test1::State::CONSTRUCTED, a->state); -+ EXPECT_EQ(Test2::State::COPY_CONSTRUCTED_FROM_TEST1, b->state); -+ } -+ -+ { -+ Optional<Test1> a(in_place); -+ Optional<Test2> b(in_place); -+ -+ b = a; -+ EXPECT_TRUE(!!a); -+ EXPECT_TRUE(!!b); -+ EXPECT_EQ(Test1::State::CONSTRUCTED, a->state); -+ EXPECT_EQ(Test2::State::COPY_ASSIGNED_FROM_TEST1, b->state); -+ } -+ -+ { -+ Optional<Test1> a(in_place); -+ Optional<Test2> b; -+ -+ b = std::move(a); -+ EXPECT_TRUE(!!a); -+ EXPECT_TRUE(!!b); -+ EXPECT_EQ(Test1::State::MOVED, a->state); -+ EXPECT_EQ(Test2::State::MOVE_CONSTRUCTED_FROM_TEST1, b->state); -+ } -+ -+ { -+ Optional<Test1> a(in_place); -+ Optional<Test2> b(in_place); -+ -+ b = std::move(a); -+ EXPECT_TRUE(!!a); -+ EXPECT_TRUE(!!b); -+ EXPECT_EQ(Test1::State::MOVED, a->state); -+ EXPECT_EQ(Test2::State::MOVE_ASSIGNED_FROM_TEST1, b->state); -+ } -+ -+ // Similar to Test2, but Test3 also has copy/move ctor and assign operators -+ // from Optional<Test1>, too. In this case, for a = b where a is -+ // Optional<Test3> and b is Optional<Test1>, -+ // Optional<T>::operator=(U&&) where U is Optional<Test1> should be used -+ // rather than Optional<T>::operator=(Optional<U>&&) where U is Test1. -+ struct Test3 { -+ enum class State { -+ DEFAULT_CONSTRUCTED, -+ COPY_CONSTRUCTED_FROM_TEST1, -+ MOVE_CONSTRUCTED_FROM_TEST1, -+ COPY_CONSTRUCTED_FROM_OPTIONAL_TEST1, -+ MOVE_CONSTRUCTED_FROM_OPTIONAL_TEST1, -+ COPY_ASSIGNED_FROM_TEST1, -+ MOVE_ASSIGNED_FROM_TEST1, -+ COPY_ASSIGNED_FROM_OPTIONAL_TEST1, -+ MOVE_ASSIGNED_FROM_OPTIONAL_TEST1, -+ }; -+ -+ Test3() = default; -+ explicit Test3(const Test1& test1) -+ : state(State::COPY_CONSTRUCTED_FROM_TEST1) {} -+ explicit Test3(Test1&& test1) : state(State::MOVE_CONSTRUCTED_FROM_TEST1) { -+ test1.state = Test1::State::MOVED; -+ } -+ explicit Test3(const Optional<Test1>& test1) -+ : state(State::COPY_CONSTRUCTED_FROM_OPTIONAL_TEST1) {} -+ explicit Test3(Optional<Test1>&& test1) -+ : state(State::MOVE_CONSTRUCTED_FROM_OPTIONAL_TEST1) { -+ // In the following senarios, given |test1| should always have value. -+ DCHECK(test1.has_value()); -+ test1->state = Test1::State::MOVED; -+ } -+ Test3& operator=(const Test1& test1) { -+ state = State::COPY_ASSIGNED_FROM_TEST1; -+ return *this; -+ } -+ Test3& operator=(Test1&& test1) { -+ state = State::MOVE_ASSIGNED_FROM_TEST1; -+ test1.state = Test1::State::MOVED; -+ return *this; -+ } -+ Test3& operator=(const Optional<Test1>& test1) { -+ state = State::COPY_ASSIGNED_FROM_OPTIONAL_TEST1; -+ return *this; -+ } -+ Test3& operator=(Optional<Test1>&& test1) { -+ state = State::MOVE_ASSIGNED_FROM_OPTIONAL_TEST1; -+ // In the following senarios, given |test1| should always have value. -+ DCHECK(test1.has_value()); -+ test1->state = Test1::State::MOVED; -+ return *this; -+ } -+ -+ State state = State::DEFAULT_CONSTRUCTED; -+ }; -+ -+ { -+ Optional<Test1> a(in_place); -+ Optional<Test3> b; -+ -+ b = a; -+ EXPECT_TRUE(!!a); -+ EXPECT_TRUE(!!b); -+ EXPECT_EQ(Test1::State::CONSTRUCTED, a->state); -+ EXPECT_EQ(Test3::State::COPY_CONSTRUCTED_FROM_OPTIONAL_TEST1, b->state); -+ } -+ -+ { -+ Optional<Test1> a(in_place); -+ Optional<Test3> b(in_place); -+ -+ b = a; -+ EXPECT_TRUE(!!a); -+ EXPECT_TRUE(!!b); -+ EXPECT_EQ(Test1::State::CONSTRUCTED, a->state); -+ EXPECT_EQ(Test3::State::COPY_ASSIGNED_FROM_OPTIONAL_TEST1, b->state); -+ } -+ -+ { -+ Optional<Test1> a(in_place); -+ Optional<Test3> b; -+ -+ b = std::move(a); -+ EXPECT_TRUE(!!a); -+ EXPECT_TRUE(!!b); -+ EXPECT_EQ(Test1::State::MOVED, a->state); -+ EXPECT_EQ(Test3::State::MOVE_CONSTRUCTED_FROM_OPTIONAL_TEST1, b->state); -+ } -+ -+ { -+ Optional<Test1> a(in_place); -+ Optional<Test3> b(in_place); -+ -+ b = std::move(a); -+ EXPECT_TRUE(!!a); -+ EXPECT_TRUE(!!b); -+ EXPECT_EQ(Test1::State::MOVED, a->state); -+ EXPECT_EQ(Test3::State::MOVE_ASSIGNED_FROM_OPTIONAL_TEST1, b->state); -+ } -+} -+ - TEST(OptionalTest, OperatorStar) { - { - Optional<float> a(0.1f); --- -2.14.3 - diff --git a/chromium/chromium/chromium-gcc7-r538717.patch b/chromium/chromium/chromium-gcc7-r538717.patch deleted file mode 100644 index 8f76066..0000000 --- a/chromium/chromium/chromium-gcc7-r538717.patch +++ /dev/null @@ -1,259 +0,0 @@ -From b467afef9550281b7c8763c765735c9e9b4d3f0d Mon Sep 17 00:00:00 2001 -From: Hidehiko Abe <hidehiko@chromium.org> -Date: Fri, 23 Feb 2018 07:01:30 +0000 -Subject: [PATCH] Update smaller parts of Optional to catch up with C++17 spec. - -This has several update parts. -- Remove DCHECK from operator->(), as redirected value() has same check. -- rvalue value_or is marked as constexpr. -- emplace now returns T&. -- Adds make_optional(Args&&... args) overloading. -- swap is now conditionally defined. - -BUG=784732 -TEST=Ran trybot. - -Change-Id: Ife12c56374f14fe3514aeee4f161c9bafce5c135 -Reviewed-on: https://chromium-review.googlesource.com/857357 -Commit-Queue: Hidehiko Abe <hidehiko@chromium.org> -Reviewed-by: danakj <danakj@chromium.org> -Cr-Commit-Position: refs/heads/master@{#538717} ---- - base/optional.h | 65 ++++++++++++++++++++++++++++++++--------------- - base/optional_unittest.cc | 46 ++++++++++++++++++++++++++------- - 2 files changed, 82 insertions(+), 29 deletions(-) - -diff --git a/base/optional.h b/base/optional.h -index d65881bd7e..d7c9db7c34 100644 ---- a/base/optional.h -+++ b/base/optional.h -@@ -363,6 +363,27 @@ struct IsAssignableFromOptional - std::is_assignable<T&, Optional<U>&&>::value || - std::is_assignable<T&, const Optional<U>&&>::value> {}; - -+// Forward compatibility for C++17. -+// Introduce one more deeper nested namespace to avoid leaking using std::swap. -+namespace swappable_impl { -+using std::swap; -+ -+struct IsSwappableImpl { -+ // Tests if swap can be called. Check<T&>(0) returns true_type iff swap -+ // is available for T. Otherwise, Check's overload resolution falls back -+ // to Check(...) declared below thanks to SFINAE, so returns false_type. -+ template <typename T> -+ static auto Check(int) -+ -> decltype(swap(std::declval<T>(), std::declval<T>()), std::true_type()); -+ -+ template <typename T> -+ static std::false_type Check(...); -+}; -+} // namespace swappable_impl -+ -+template <typename T> -+struct IsSwappable : decltype(swappable_impl::IsSwappableImpl::Check<T&>(0)) {}; -+ - // Forward compatibility for C++20. - template <typename T> - using RemoveCvRefT = std::remove_cv_t<std::remove_reference_t<T>>; -@@ -532,15 +553,9 @@ class Optional - return *this; - } - -- constexpr const T* operator->() const { -- DCHECK(storage_.is_populated_); -- return &value(); -- } -+ constexpr const T* operator->() const { return &value(); } - -- constexpr T* operator->() { -- DCHECK(storage_.is_populated_); -- return &value(); -- } -+ constexpr T* operator->() { return &value(); } - - constexpr const T& operator*() const& { return value(); } - -@@ -587,7 +602,7 @@ class Optional - } - - template <class U> -- T value_or(U&& default_value) && { -+ constexpr T value_or(U&& default_value) && { - // TODO(mlamouri): add the following assert when possible: - // static_assert(std::is_move_constructible<T>::value, - // "T must be move constructible"); -@@ -623,18 +638,17 @@ class Optional - } - - template <class... Args> -- void emplace(Args&&... args) { -+ T& emplace(Args&&... args) { - FreeIfNeeded(); - storage_.Init(std::forward<Args>(args)...); -+ return storage_.value_; - } - -- template < -- class U, -- class... Args, -- class = std::enable_if_t<std::is_constructible<value_type, -- std::initializer_list<U>&, -- Args...>::value>> -- T& emplace(std::initializer_list<U> il, Args&&... args) { -+ template <class U, class... Args> -+ std::enable_if_t< -+ std::is_constructible<T, std::initializer_list<U>&, Args&&...>::value, -+ T&> -+ emplace(std::initializer_list<U> il, Args&&... args) { - FreeIfNeeded(); - storage_.Init(il, std::forward<Args>(args)...); - return storage_.value_; -@@ -829,8 +843,13 @@ constexpr bool operator>=(const U& value, const Optional<T>& opt) { - } - - template <class T> --constexpr Optional<typename std::decay<T>::type> make_optional(T&& value) { -- return Optional<typename std::decay<T>::type>(std::forward<T>(value)); -+constexpr Optional<std::decay_t<T>> make_optional(T&& value) { -+ return Optional<std::decay_t<T>>(std::forward<T>(value)); -+} -+ -+template <class T, class... Args> -+constexpr Optional<T> make_optional(Args&&... args) { -+ return Optional<T>(in_place, std::forward<Args>(args)...); - } - - template <class T, class U, class... Args> -@@ -839,8 +858,14 @@ constexpr Optional<T> make_optional(std::initializer_list<U> il, - return Optional<T>(in_place, il, std::forward<Args>(args)...); - } - -+// Partial specialization for a function template is not allowed. Also, it is -+// not allowed to add overload function to std namespace, while it is allowed -+// to specialize the template in std. Thus, swap() (kind of) overloading is -+// defined in base namespace, instead. - template <class T> --void swap(Optional<T>& lhs, Optional<T>& rhs) { -+std::enable_if_t<std::is_move_constructible<T>::value && -+ internal::IsSwappable<T>::value> -+swap(Optional<T>& lhs, Optional<T>& rhs) { - lhs.swap(rhs); - } - -diff --git a/base/optional_unittest.cc b/base/optional_unittest.cc -index 17c9ee4f51..ecf2b07200 100644 ---- a/base/optional_unittest.cc -+++ b/base/optional_unittest.cc -@@ -1037,6 +1037,18 @@ TEST(OptionalTest, ValueOr) { - EXPECT_EQ(0.0f, a.value_or(0.0f)); - } - -+ // value_or() can be constexpr. -+ { -+ constexpr Optional<int> a(in_place, 1); -+ constexpr int value = a.value_or(10); -+ EXPECT_EQ(1, value); -+ } -+ { -+ constexpr Optional<int> a; -+ constexpr int value = a.value_or(10); -+ EXPECT_EQ(10, value); -+ } -+ - { - Optional<std::string> a; - EXPECT_EQ("bar", a.value_or("bar")); -@@ -1109,7 +1121,7 @@ TEST(OptionalTest, Swap_bothValue) { - TEST(OptionalTest, Emplace) { - { - Optional<float> a(0.1f); -- a.emplace(0.3f); -+ EXPECT_EQ(0.3f, a.emplace(0.3f)); - - EXPECT_TRUE(a); - EXPECT_EQ(0.3f, a.value()); -@@ -1117,7 +1129,7 @@ TEST(OptionalTest, Emplace) { - - { - Optional<std::string> a("foo"); -- a.emplace("bar"); -+ EXPECT_EQ("bar", a.emplace("bar")); - - EXPECT_TRUE(a); - EXPECT_EQ("bar", a.value()); -@@ -1125,7 +1137,7 @@ TEST(OptionalTest, Emplace) { - - { - Optional<TestObject> a(TestObject(0, 0.1)); -- a.emplace(TestObject(1, 0.2)); -+ EXPECT_EQ(TestObject(1, 0.2), a.emplace(TestObject(1, 0.2))); - - EXPECT_TRUE(!!a); - EXPECT_TRUE(TestObject(1, 0.2) == a.value()); -@@ -1883,34 +1895,34 @@ TEST(OptionalTest, NotEqualsNull) { - - TEST(OptionalTest, MakeOptional) { - { -- Optional<float> o = base::make_optional(32.f); -+ Optional<float> o = make_optional(32.f); - EXPECT_TRUE(o); - EXPECT_EQ(32.f, *o); - - float value = 3.f; -- o = base::make_optional(std::move(value)); -+ o = make_optional(std::move(value)); - EXPECT_TRUE(o); - EXPECT_EQ(3.f, *o); - } - - { -- Optional<std::string> o = base::make_optional(std::string("foo")); -+ Optional<std::string> o = make_optional(std::string("foo")); - EXPECT_TRUE(o); - EXPECT_EQ("foo", *o); - - std::string value = "bar"; -- o = base::make_optional(std::move(value)); -+ o = make_optional(std::move(value)); - EXPECT_TRUE(o); - EXPECT_EQ(std::string("bar"), *o); - } - - { -- Optional<TestObject> o = base::make_optional(TestObject(3, 0.1)); -+ Optional<TestObject> o = make_optional(TestObject(3, 0.1)); - EXPECT_TRUE(!!o); - EXPECT_TRUE(TestObject(3, 0.1) == *o); - - TestObject value = TestObject(0, 0.42); -- o = base::make_optional(std::move(value)); -+ o = make_optional(std::move(value)); - EXPECT_TRUE(!!o); - EXPECT_TRUE(TestObject(0, 0.42) == *o); - EXPECT_EQ(TestObject::State::MOVED_FROM, value.state()); -@@ -1920,6 +1932,22 @@ TEST(OptionalTest, MakeOptional) { - base::make_optional(std::move(value))->state()); - } - -+ { -+ struct Test { -+ Test(int a, double b, bool c) : a(a), b(b), c(c) {} -+ -+ int a; -+ double b; -+ bool c; -+ }; -+ -+ Optional<Test> o = make_optional<Test>(1, 2.0, true); -+ EXPECT_TRUE(!!o); -+ EXPECT_EQ(1, o->a); -+ EXPECT_EQ(2.0, o->b); -+ EXPECT_TRUE(o->c); -+ } -+ - { - auto str1 = make_optional<std::string>({'1', '2', '3'}); - EXPECT_EQ("123", *str1); --- -2.14.3 - diff --git a/chromium/chromium/chromium-gcc7-r538740.patch b/chromium/chromium/chromium-gcc7-r538740.patch deleted file mode 100644 index 9a67510..0000000 --- a/chromium/chromium/chromium-gcc7-r538740.patch +++ /dev/null @@ -1,102 +0,0 @@ -From 4d8468a07f374c11425494271256151fb6fe0c34 Mon Sep 17 00:00:00 2001 -From: Hidehiko Abe <hidehiko@chromium.org> -Date: Fri, 23 Feb 2018 09:50:41 +0000 -Subject: [PATCH] Workaround for g++7 is_trivially_copy_constructible failure. - -cf) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80654 -Please see also crbug.com/784732#27 for details. - -BUG=784732 -TEST=Some with GCC. - -Change-Id: I0a6d28d9c26ac9ed026d137e17fddbe86586f1e1 -Reviewed-on: https://chromium-review.googlesource.com/927942 -Commit-Queue: Hidehiko Abe <hidehiko@chromium.org> -Reviewed-by: danakj <danakj@chromium.org> -Cr-Commit-Position: refs/heads/master@{#538740} ---- - base/optional.h | 3 ++- - base/template_util.h | 18 ++++++++++++++++++ - base/template_util_unittest.cc | 9 +++++++++ - 3 files changed, 29 insertions(+), 1 deletion(-) - -diff --git a/base/optional.h b/base/optional.h -index d7c9db7c34..e3be1c89eb 100644 ---- a/base/optional.h -+++ b/base/optional.h -@@ -9,6 +9,7 @@ - #include <utility> - - #include "base/logging.h" -+#include "base/template_util.h" - - namespace base { - -@@ -128,7 +129,7 @@ struct OptionalStorageBase<T, true /* trivially destructible */> { - // compiler generated constexpr {copy,move} constructors). Note that - // placement-new is prohibited in constexpr. - template <typename T, -- bool = std::is_trivially_copy_constructible<T>::value, -+ bool = is_trivially_copy_constructible<T>::value, - bool = std::is_trivially_move_constructible<T>::value> - struct OptionalStorage : OptionalStorageBase<T> { - // This is no trivially {copy,move} constructible case. Other cases are -diff --git a/base/template_util.h b/base/template_util.h -index f76003d823..8544aa2945 100644 ---- a/base/template_util.h -+++ b/base/template_util.h -@@ -10,6 +10,7 @@ - #include <iterator> - #include <type_traits> - #include <utility> -+#include <vector> - - #include "build/build_config.h" - -@@ -127,6 +128,23 @@ template <class T> - using is_trivially_copyable = std::is_trivially_copyable<T>; - #endif - -+#if defined(__GNUC__) && !defined(__clang__) && __GNUC__ <= 7 -+// Workaround for g++7 and earlier family. -+// Due to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80654, without this -+// Optional<std::vector<T>> where T is non-copyable causes a compile error. -+// As we know it is not trivially copy constructible, explicitly declare so. -+template <typename T> -+struct is_trivially_copy_constructible -+ : std::is_trivially_copy_constructible<T> {}; -+ -+template <typename... T> -+struct is_trivially_copy_constructible<std::vector<T...>> : std::false_type {}; -+#else -+// Otherwise use std::is_trivially_copy_constructible as is. -+template <typename T> -+using is_trivially_copy_constructible = std::is_trivially_copy_constructible<T>; -+#endif -+ - } // namespace base - - #undef CR_USE_FALLBACKS_FOR_GCC_WITH_LIBCXX -diff --git a/base/template_util_unittest.cc b/base/template_util_unittest.cc -index 12e5d362dd..2c42445f78 100644 ---- a/base/template_util_unittest.cc -+++ b/base/template_util_unittest.cc -@@ -92,6 +92,15 @@ static_assert(!base::is_trivially_copyable<TrivialCopyButWithDestructor>::value, - "TrivialCopyButWithDestructor should not be detected as " - "trivially copyable"); - -+class NoCopy { -+ public: -+ NoCopy(const NoCopy&) = delete; -+}; -+ -+static_assert( -+ !base::is_trivially_copy_constructible<std::vector<NoCopy>>::value, -+ "is_trivially_copy_constructible<std::vector<T>> must be compiled."); -+ - } // namespace - - } // namespace base --- -2.14.3 - diff --git a/chromium/chromium/chromium-gcc7-r539012.patch b/chromium/chromium/chromium-gcc7-r539012.patch deleted file mode 100644 index d5cc598..0000000 --- a/chromium/chromium/chromium-gcc7-r539012.patch +++ /dev/null @@ -1,127 +0,0 @@ -From 3aa61df502c16c7231afb2bcef4e94ff30a16b0b Mon Sep 17 00:00:00 2001 -From: Hidehiko Abe <hidehiko@chromium.org> -Date: Sat, 24 Feb 2018 12:47:07 +0000 -Subject: [PATCH] Mark noexcept for Optional to catch up with C++17 spec. - -Although, exceptions are not used in chromium, -some standard libraries depend on noexcept markers. -Because Optional is an alternative of standard library, -it is nice to have such markers. - -BUG=784732 -TEST=Ran trybot. - -Change-Id: I958bc3f18e1d898d65cc106748795c6a27462650 -Reviewed-on: https://chromium-review.googlesource.com/857358 -Reviewed-by: danakj <danakj@chromium.org> -Commit-Queue: Hidehiko Abe <hidehiko@chromium.org> -Cr-Commit-Position: refs/heads/master@{#539012} ---- - base/optional.h | 16 ++++++++++------ - base/optional_unittest.cc | 37 +++++++++++++++++++++++++++++++++++++ - 2 files changed, 47 insertions(+), 6 deletions(-) - -diff --git a/base/optional.h b/base/optional.h -index e3be1c89eb..0b391b4539 100644 ---- a/base/optional.h -+++ b/base/optional.h -@@ -244,7 +244,9 @@ class OptionalBase { - return *this; - } - -- OptionalBase& operator=(OptionalBase&& other) { -+ OptionalBase& operator=(OptionalBase&& other) noexcept( -+ std::is_nothrow_move_assignable<T>::value&& -+ std::is_nothrow_move_constructible<T>::value) { - MoveAssign(std::move(other)); - return *this; - } -@@ -401,6 +403,7 @@ using RemoveCvRefT = std::remove_cv_t<std::remove_reference_t<T>>; - // - Constructors do not use 'constexpr' as it is a C++14 extension. - // - 'constexpr' might be missing in some places for reasons specified locally. - // - No exceptions are thrown, because they are banned from Chromium. -+// Marked noexcept for only move constructor and move assign operators. - // - All the non-members are in the 'base' namespace instead of 'std'. - // - // Note that T cannot have a constructor T(Optional<T>) etc. Optional<T> checks -@@ -424,7 +427,8 @@ class Optional - // Defer default/copy/move constructor implementation to OptionalBase. - constexpr Optional() = default; - constexpr Optional(const Optional& other) = default; -- constexpr Optional(Optional&& other) = default; -+ constexpr Optional(Optional&& other) noexcept( -+ std::is_nothrow_move_constructible<T>::value) = default; - - constexpr Optional(nullopt_t) {} // NOLINT(runtime/explicit) - -@@ -511,7 +515,9 @@ class Optional - - // Defer copy-/move- assign operator implementation to OptionalBase. - Optional& operator=(const Optional& other) = default; -- Optional& operator=(Optional&& other) = default; -+ Optional& operator=(Optional&& other) noexcept( -+ std::is_nothrow_move_assignable<T>::value&& -+ std::is_nothrow_move_constructible<T>::value) = default; - - Optional& operator=(nullopt_t) { - FreeIfNeeded(); -@@ -634,9 +640,7 @@ class Optional - swap(**this, *other); - } - -- void reset() { -- FreeIfNeeded(); -- } -+ void reset() { FreeIfNeeded(); } - - template <class... Args> - T& emplace(Args&&... args) { -diff --git a/base/optional_unittest.cc b/base/optional_unittest.cc -index ecf2b07200..d33ef62d2d 100644 ---- a/base/optional_unittest.cc -+++ b/base/optional_unittest.cc -@@ -2110,4 +2110,41 @@ TEST(OptionalTest, DontCallNewMemberFunction) { - EXPECT_TRUE(a.has_value()); - } - -+TEST(OptionalTest, Noexcept) { -+ // non-noexcept move-constructible. -+ struct Test1 { -+ Test1(Test1&&) {} -+ Test1& operator=(Test1&&) = default; -+ }; -+ // non-noexcept move-assignable. -+ struct Test2 { -+ Test2(Test2&&) = default; -+ Test2& operator=(Test2&&) { return *this; } -+ }; -+ -+ static_assert( -+ noexcept(Optional<int>(std::declval<Optional<int>>())), -+ "move constructor for noexcept move-constructible T must be noexcept"); -+ static_assert( -+ !noexcept(Optional<Test1>(std::declval<Optional<Test1>>())), -+ "move constructor for non-noexcept move-constructible T must not be " -+ "noexcept"); -+ static_assert( -+ noexcept(Optional<Test2>(std::declval<Optional<Test2>>())), -+ "move constructor for noexcept move-constructible T must be noexcept"); -+ -+ static_assert( -+ noexcept(std::declval<Optional<int>>() = std::declval<Optional<int>>()), -+ "move assign for noexcept move-constructible/move-assignable T " -+ "must be noexcept"); -+ static_assert( -+ !noexcept(std::declval<Optional<Test1>>() = -+ std::declval<Optional<Test1>>()), -+ "move assign for non-noexcept move-constructible T must not be noexcept"); -+ static_assert( -+ !noexcept(std::declval<Optional<Test2>>() = -+ std::declval<Optional<Test2>>()), -+ "move assign for non-noexcept move-assignable T must not be noexcept"); -+} -+ - } // namespace base --- -2.14.3 - diff --git a/chromium/chromium/chromium-gcc7-r540815.patch b/chromium/chromium/chromium-gcc7-r540815.patch deleted file mode 100644 index e722301..0000000 --- a/chromium/chromium/chromium-gcc7-r540815.patch +++ /dev/null @@ -1,41 +0,0 @@ -From ede5178322ccd297b0ad82ae4c59119ceaab9ea5 Mon Sep 17 00:00:00 2001 -From: Jose Dapena Paz <jose.dapena@lge.com> -Date: Mon, 5 Mar 2018 14:19:54 +0000 -Subject: [PATCH] GCC build fix: base::Optional<T> requires the full - declaration of T -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -In GCC 7.2/7.3, base::Optional<T> fails to compile, if T has still -only been forward declared, as it cannot properly resolve the -is_trivially_* declarations. In this case it is needed to include the -full declaration of the type, and not only the forward declaration. - -Change-Id: I63e5c6307394c6c2eda6af108c80395152bfc04f -Reviewed-on: https://chromium-review.googlesource.com/944401 -Commit-Queue: José Dapena Paz <jose.dapena@lge.com> -Reviewed-by: Bernhard Bauer <bauerb@chromium.org> -Cr-Commit-Position: refs/heads/master@{#540815} ---- - services/preferences/tracked/pref_hash_filter.h | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/services/preferences/tracked/pref_hash_filter.h b/services/preferences/tracked/pref_hash_filter.h -index bdc9b621c9..526c53f614 100644 ---- a/services/preferences/tracked/pref_hash_filter.h -+++ b/services/preferences/tracked/pref_hash_filter.h -@@ -21,9 +21,9 @@ - #include "services/preferences/public/interfaces/preferences.mojom.h" - #include "services/preferences/tracked/hash_store_contents.h" - #include "services/preferences/tracked/interceptable_pref_filter.h" -+#include "services/preferences/tracked/pref_hash_store.h" - #include "services/preferences/tracked/tracked_preference.h" - --class PrefHashStore; - class PrefService; - - namespace base { --- -2.14.3 - diff --git a/chromium/chromium/chromium-gcc7-r540828.patch b/chromium/chromium/chromium-gcc7-r540828.patch new file mode 100644 index 0000000..206dfac --- /dev/null +++ b/chromium/chromium/chromium-gcc7-r540828.patch @@ -0,0 +1,42 @@ +From b34ed1e6524479d61ee944ebf6ca7389ea47e563 Mon Sep 17 00:00:00 2001 +From: Jose Dapena Paz <jose.dapena@lge.com> +Date: Mon, 5 Mar 2018 15:59:12 +0000 +Subject: [PATCH] GCC: do not use initializer list for NoDestructor of a + flat_set. +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Compilation in GCC 7.x fails in SupervisedURLFilter, creating a +base::NoDestructor of a flat_set initialized with braces initializer +list syntax, as it fails to retrieve the right constructor (it states +the constructors are ambiguous). + +Workaround the problem explicitely declaring flat_set constructor. + +Change-Id: Icff5021685a6cbc727d5f4fb5fc6d2ce94fe9921 +Reviewed-on: https://chromium-review.googlesource.com/944405 +Commit-Queue: José Dapena Paz <jose.dapena@lge.com> +Reviewed-by: Bernhard Bauer <bauerb@chromium.org> +Reviewed-by: Marc Treib <treib@chromium.org> +Cr-Commit-Position: refs/heads/master@{#540828} +--- + chrome/browser/supervised_user/supervised_user_url_filter.cc | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/chrome/browser/supervised_user/supervised_user_url_filter.cc b/chrome/browser/supervised_user/supervised_user_url_filter.cc +index 64d6569088d1..a3a81d77f0a3 100644 +--- a/chrome/browser/supervised_user/supervised_user_url_filter.cc ++++ b/chrome/browser/supervised_user/supervised_user_url_filter.cc +@@ -368,7 +368,7 @@ SupervisedUserURLFilter::GetFilteringBehaviorForURL( + + // Allow navigations to whitelisted origins (currently families.google.com). + static const base::NoDestructor<base::flat_set<GURL>> kWhitelistedOrigins( +- {GURL(kFamiliesUrl).GetOrigin()}); ++ base::flat_set<GURL>({GURL(kFamiliesUrl).GetOrigin()})); + if (base::ContainsKey(*kWhitelistedOrigins, effective_url.GetOrigin())) + return ALLOW; + +-- +2.14.3 + diff --git a/chromium/chromium/chromium-gcc7-r541029.patch b/chromium/chromium/chromium-gcc7-r541029.patch index 6cb2369..96344c1 100644 --- a/chromium/chromium/chromium-gcc7-r541029.patch +++ b/chromium/chromium/chromium-gcc7-r541029.patch @@ -28,6 +28,7 @@ Cr-Commit-Position: refs/heads/master@{#541029} --- content/browser/appcache/appcache_request_handler.cc | 2 +- .../service_worker/service_worker_controllee_request_handler.cc | 2 +- + device/fido/device_response_converter.cc | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/content/browser/appcache/appcache_request_handler.cc b/content/browser/appcache/appcache_request_handler.cc @@ -56,3 +57,28 @@ index 2ed0c353cad3..5b09f6d670c4 100644 } void ServiceWorkerControlleeRequestHandler::PrepareForMainResource( +diff --git a/device/fido/device_response_converter.cc b/device/fido/device_response_converter.cc +index 050ff2fc5d10..096f9f44872b 100644 +--- a/device/fido/device_response_converter.cc ++++ b/device/fido/device_response_converter.cc +@@ -121,7 +121,7 @@ base::Optional<AuthenticatorGetAssertionResponse> ReadCTAPGetAssertionResponse( + response.SetNumCredentials(it->second.GetUnsigned()); + } + +- return response; ++ return base::Optional<AuthenticatorGetAssertionResponse>(std::move(response)); + } + + base::Optional<AuthenticatorGetInfoResponse> ReadCTAPGetInfoResponse( +@@ -241,7 +241,7 @@ base::Optional<AuthenticatorGetInfoResponse> ReadCTAPGetInfoResponse( + response.SetPinProtocols(std::move(supported_pin_protocols)); + } + +- return response; ++ return base::Optional<AuthenticatorGetInfoResponse>(std::move(response)); + } + + } // namespace device +-- +2.14.3 + diff --git a/chromium/chromium/chromium-gcc7-r541516.patch b/chromium/chromium/chromium-gcc7-r541516.patch deleted file mode 100644 index 5c071df..0000000 --- a/chromium/chromium/chromium-gcc7-r541516.patch +++ /dev/null @@ -1,76 +0,0 @@ -From f64fadcd79aebe5ed893ecbf258d1123609d28f8 Mon Sep 17 00:00:00 2001 -From: Jose Dapena Paz <jose.dapena@lge.com> -Date: Wed, 7 Mar 2018 18:50:50 +0000 -Subject: [PATCH] GCC build fix: mark is_trivially_copy_constructible for - WTF::Vector as false. -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Compilation in GCC fails because of https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80654 -if T in WTF::Optional<WTF::Vector<T>> is not trivially copy constructible. -The problem already happened in std::vector and was workarounded. This -change implements a similar fix for WTF::Vector. - -Bug: 816952 - -Change-Id: If87f01beb952e03eb49dcaf0c5db6efd745bf05e -Reviewed-on: https://chromium-review.googlesource.com/944404 -Commit-Queue: José Dapena Paz <jose.dapena@lge.com> -Reviewed-by: Kentaro Hara <haraken@chromium.org> -Cr-Commit-Position: refs/heads/master@{#541516} ---- - third_party/WebKit/Source/platform/wtf/DEPS | 1 + - third_party/WebKit/Source/platform/wtf/Vector.h | 17 +++++++++++++++++ - 2 files changed, 18 insertions(+) - -diff --git a/third_party/WebKit/Source/platform/wtf/DEPS b/third_party/WebKit/Source/platform/wtf/DEPS -index a2b6603245b4..bccf1e08c77d 100644 ---- a/third_party/WebKit/Source/platform/wtf/DEPS -+++ b/third_party/WebKit/Source/platform/wtf/DEPS -@@ -16,6 +16,7 @@ include_rules = [ - "+base/process/process_metrics.h", - "+base/rand_util.h", - "+base/strings", -+ "+base/template_util.h", - "+base/threading/thread_checker.h", - "+base/time/time.h", - "+base/tuple.h", -diff --git a/third_party/WebKit/Source/platform/wtf/Vector.h b/third_party/WebKit/Source/platform/wtf/Vector.h -index c356287b2f42..8421b135e162 100644 ---- a/third_party/WebKit/Source/platform/wtf/Vector.h -+++ b/third_party/WebKit/Source/platform/wtf/Vector.h -@@ -28,6 +28,7 @@ - #include <utility> - - #include "base/macros.h" -+#include "base/template_util.h" - #include "build/build_config.h" - #include "platform/wtf/Alignment.h" - #include "platform/wtf/ConditionalDestructor.h" -@@ -1995,6 +1996,22 @@ Vector<T, inlineCapacity, Allocator>::Trace(VisitorDispatcher visitor) { - - } // namespace WTF - -+namespace base { -+ -+#if defined(__GNUC__) && !defined(__clang__) && __GNUC__ <= 7 -+// Workaround for g++7 and earlier family. -+// Due to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80654, without this -+// Optional<WTF::Vector<T>> where T is non-copyable causes a compile error. -+// As we know it is not trivially copy constructible, explicitly declare so. -+// -+// It completes the declaration in base/template_util.h that was provided -+// for std::vector -+template <typename T> -+struct is_trivially_copy_constructible<WTF::Vector<T>> : std::false_type {}; -+#endif -+ -+} // namespace base -+ - using WTF::Vector; - - #endif // WTF_Vector_h --- -2.14.3 - diff --git a/chromium/chromium/chromium-gcc7-r541827.patch b/chromium/chromium/chromium-gcc7-r541827.patch index b2b06c8..31fdab5 100644 --- a/chromium/chromium/chromium-gcc7-r541827.patch +++ b/chromium/chromium/chromium-gcc7-r541827.patch @@ -18,12 +18,13 @@ Reviewed-by: David Reveman <reveman@chromium.org> Commit-Queue: José Dapena Paz <jose.dapena@lge.com> Cr-Commit-Position: refs/heads/master@{#541827} --- - cc/raster/playback_image_provider.cc | 7 +++++-- - cc/raster/playback_image_provider.h | 6 ++++-- - 2 files changed, 9 insertions(+), 4 deletions(-) + cc/raster/playback_image_provider.cc | 7 +++++-- + cc/raster/playback_image_provider.h | 6 ++++-- + cc/raster/playback_image_provider_unittest.cc | 15 ++++++++++----- + 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/cc/raster/playback_image_provider.cc b/cc/raster/playback_image_provider.cc -index f2a6682ae1..dbf8530b50 100644 +index 557b421bbaef..b2ace4dc4fa8 100644 --- a/cc/raster/playback_image_provider.cc +++ b/cc/raster/playback_image_provider.cc @@ -20,7 +20,7 @@ void UnrefImageFromCache(DrawImage draw_image, @@ -35,7 +36,7 @@ index f2a6682ae1..dbf8530b50 100644 : cache_(cache), target_color_space_(target_color_space), settings_(std::move(settings)) { -@@ -92,7 +92,10 @@ PlaybackImageProvider::GetDecodedDrawImage(const DrawImage& draw_image) { +@@ -70,7 +70,10 @@ PlaybackImageProvider::GetDecodedDrawImage(const DrawImage& draw_image) { } PlaybackImageProvider::Settings::Settings() = default; @@ -48,7 +49,7 @@ index f2a6682ae1..dbf8530b50 100644 } // namespace cc diff --git a/cc/raster/playback_image_provider.h b/cc/raster/playback_image_provider.h -index bae8c25bfd..8c1038e7ff 100644 +index 67974f3f341d..a33092d2b5b4 100644 --- a/cc/raster/playback_image_provider.h +++ b/cc/raster/playback_image_provider.h @@ -20,8 +20,10 @@ class CC_EXPORT PlaybackImageProvider : public ImageProvider { @@ -63,7 +64,7 @@ index bae8c25bfd..8c1038e7ff 100644 // The set of image ids to skip during raster. PaintImageIdFlatSet images_to_skip; -@@ -39,7 +41,7 @@ class CC_EXPORT PlaybackImageProvider : public ImageProvider { +@@ -34,7 +36,7 @@ class CC_EXPORT PlaybackImageProvider : public ImageProvider { // If no settings are provided, all images are skipped during rasterization. PlaybackImageProvider(ImageDecodeCache* cache, const gfx::ColorSpace& target_color_space, @@ -71,7 +72,61 @@ index bae8c25bfd..8c1038e7ff 100644 + base::Optional<Settings>&& settings); ~PlaybackImageProvider() override; - void BeginRaster() override; + PlaybackImageProvider(PlaybackImageProvider&& other); +diff --git a/cc/raster/playback_image_provider_unittest.cc b/cc/raster/playback_image_provider_unittest.cc +index 0206999d6e4a..40036e87032d 100644 +--- a/cc/raster/playback_image_provider_unittest.cc ++++ b/cc/raster/playback_image_provider_unittest.cc +@@ -85,7 +85,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)); + + SkIRect rect = SkIRect::MakeWH(10, 10); + SkMatrix matrix = SkMatrix::I(); +@@ -99,7 +100,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)); + + { + SkRect rect = SkRect::MakeWH(10, 10); +@@ -127,7 +129,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)); + + SkIRect rect = SkIRect::MakeWH(10, 10); + SkMatrix matrix = SkMatrix::I(); +@@ -143,7 +146,8 @@ TEST(PlaybackImageProviderTest, BitmapImages) { + + base::Optional<PlaybackImageProvider::Settings> settings; + settings.emplace(); +- PlaybackImageProvider provider(&cache, gfx::ColorSpace(), settings); ++ PlaybackImageProvider provider(&cache, gfx::ColorSpace(), ++ std::move(settings)); + + { + SkIRect rect = SkIRect::MakeWH(10, 10); +@@ -174,7 +178,8 @@ TEST(PlaybackImageProviderTest, TextureImages) { + MockDecodeCache cache; + base::Optional<PlaybackImageProvider::Settings> settings; + settings.emplace(); +- PlaybackImageProvider provider(&cache, gfx::ColorSpace(), settings); ++ PlaybackImageProvider provider(&cache, gfx::ColorSpace(), ++ std::move(settings)); + { + SkIRect rect = SkIRect::MakeWH(10, 10); + SkMatrix matrix = SkMatrix::I(); -- 2.14.3 diff --git a/chromium/chromium/chromium-latest.py b/chromium/chromium/chromium-latest.py index d46942b..2a216b3 100755 --- a/chromium/chromium/chromium-latest.py +++ b/chromium/chromium/chromium-latest.py @@ -33,6 +33,7 @@ # * xz -9 command is replaced by xz -0 command to reduce memory requirement. # * Function nacl_versions and download_chrome_latest_rpm are removed. # * Switch back to xz -9 but with -T 0 replaced by -T 2. +# * Add an option to delete unrar sources. try: import argparse @@ -233,6 +234,9 @@ if __name__ == '__main__': parser_add_argument( '--version', help='Download a specific version of Chromium') + parser_add_argument( + '--deleteunrar', action='store_true', + help='Delete unrar sources') # Parse the args if optparse: @@ -295,6 +299,9 @@ if __name__ == '__main__': os.system("./chromium-ffmpeg-clean.sh %s %d" % (latest_dir, 0 if args.ffmpegarm else 1)) print "Done!" + if (args.deleteunrar): + delete_chromium_dir('third_party/unrar') + if (not args.prep): print "Compressing cleaned tree, please wait..." os.chdir(chromium_root_dir) diff --git a/chromium/chromium/chromium-math.patch b/chromium/chromium/chromium-math.patch deleted file mode 100644 index 6c7c747..0000000 --- a/chromium/chromium/chromium-math.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 9f63f94a11abc34d40ede8b8712fa15b5844a8c0 Mon Sep 17 00:00:00 2001 -From: Tom Anderson <thomasanderson@chromium.org> -Date: Sat, 27 Jan 2018 20:03:37 +0000 -Subject: [PATCH] Fix build with glibc 2.27 - -BUG=806340 -TBR=hamelphi@chromium.org - -Change-Id: Ib4e5091212d874d9ad88f3e9a1fdfee3ed7e0d5e -Reviewed-on: https://chromium-review.googlesource.com/890059 -Reviewed-by: Thomas Anderson <thomasanderson@chromium.org> -Reviewed-by: Philippe Hamel <hamelphi@chromium.org> -Commit-Queue: Thomas Anderson <thomasanderson@chromium.org> -Cr-Commit-Position: refs/heads/master@{#532249} ---- - -diff --git a/components/assist_ranker/ranker_example_util.cc b/components/assist_ranker/ranker_example_util.cc -index 54d4dbd..ceedd8f 100644 ---- a/components/assist_ranker/ranker_example_util.cc -+++ b/components/assist_ranker/ranker_example_util.cc -@@ -2,6 +2,8 @@ - // Use of this source code is governed by a BSD-style license that can be - // found in the LICENSE file. - -+#include <math.h> -+ - #include "components/assist_ranker/ranker_example_util.h" - #include "base/bit_cast.h" - #include "base/format_macros.h" diff --git a/chromium/chromium/chromium-stdint.patch b/chromium/chromium/chromium-stdint.patch deleted file mode 100644 index 8774439..0000000 --- a/chromium/chromium/chromium-stdint.patch +++ /dev/null @@ -1,21 +0,0 @@ -From 0235c2b657d936f3cdb09053776e5929fc84704b Mon Sep 17 00:00:00 2001 -From: Tomas Popela <tomas.popela@gmail.com> -Date: Wed, 31 Jan 2018 18:57:07 +0000 -Subject: [PATCH] Add missing stdint include - -diff --git a/chrome/browser/vr/sample_queue.cc b/chrome/browser/vr/sample_queue.cc -index c2ca777ce90c..53cb3aab1576 100644 ---- a/chrome/browser/vr/sample_queue.cc -+++ b/chrome/browser/vr/sample_queue.cc -@@ -2,6 +2,8 @@ - // Use of this source code is governed by a BSD-style license that can be - // found in the LICENSE file. - -+#include <stdint.h> -+ - #include "chrome/browser/vr/sample_queue.h" - - namespace vr { --- -2.16.2 - diff --git a/chromium/chromium/chromium.spec b/chromium/chromium/chromium.spec index 4bd165d..2dd9f19 100644 --- a/chromium/chromium/chromium.spec +++ b/chromium/chromium/chromium.spec @@ -58,7 +58,7 @@ %bcond_with fedora_compilation_flags Name: chromium -Version: 65.0.3325.181 +Version: 66.0.3359.117 Release: 100%{?dist} Summary: A WebKit (Blink) powered web browser @@ -78,12 +78,17 @@ URL: https://www.chromium.org/Home # Source0: https://commondatastorage.googleapis.com/chromium-browser-official/chromium-%{version}.tar.xz # # The repackaged source tarball used here is produced by: -# ./chromium-latest.py --stable --ffmpegclean --ffmpegarm +# ./chromium-latest.py --stable --ffmpegclean --ffmpegarm --deleteunrar Source0: chromium-%{version}-clean.tar.xz Source1: chromium-latest.py Source2: chromium-ffmpeg-clean.sh Source3: chromium-ffmpeg-free-sources.py +# Upstream source tarball include an empty third_party/blink/tools/blinkpy/common directory +# https://git.archlinux.org/svntogit/packages.git/commit/trunk?h=packages/chromium&id=cfc1a07 +# https://bugs.chromium.org/p/chromium/issues/detail?id=832283 +Source4: https://chromium.googlesource.com/chromium/src/+archive/%{version}/third_party/blink/tools/blinkpy/common.tar.gz#/%{name}-%{version}-third_party-blink-tools-blinkpy-common.tar.gz + # The following two source files are copied and modified from # https://repos.fedorapeople.org/repos/spot/chromium/ Source10: chromium-browser.sh @@ -98,27 +103,13 @@ Source13: chromium-browser.appdata.xml # https://src.fedoraproject.org/cgit/rpms/chromium.git/commit/?id=0df9641 Patch10: chromium-last-commit-position.patch -# Add two patches from Gentoo to add the missing includes -# https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1b8e99b -Patch20: chromium-stdint.patch -Patch21: chromium-math.patch - -# Add a lot of patches from upstream to fix build on Fedora 26 -Patch50: chromium-gcc7-r530663.patch -Patch51: chromium-gcc7-r531722.patch -Patch52: chromium-gcc7-r532004.patch -Patch53: chromium-gcc7-r532865.patch -Patch54: chromium-gcc7-r533126.patch -Patch55: chromium-gcc7-r533185.patch -Patch56: chromium-gcc7-r538032.patch -Patch57: chromium-gcc7-r538699.patch -Patch58: chromium-gcc7-r538717.patch -Patch59: chromium-gcc7-r538740.patch -Patch60: chromium-gcc7-r539012.patch -Patch61: chromium-gcc7-r540815.patch -Patch62: chromium-gcc7-r541029.patch -Patch63: chromium-gcc7-r541516.patch -Patch64: chromium-gcc7-r541827.patch +# Disable non-free unrar +Patch20: chromium-disable-unrar.patch + +# Add patches from upstream to fix build with GCC +Patch50: chromium-gcc7-r540828.patch +Patch51: chromium-gcc7-r541029.patch +Patch52: chromium-gcc7-r541827.patch # I don't have time to test whether it work on other architectures ExclusiveArch: x86_64 @@ -218,12 +209,20 @@ Conflicts: chromedriver-unstable %global chromiumdir %{_libdir}/chromium-browser %global __provides_exclude_from ^%{chromiumdir}/.*$ +%if !%{with symbol} +%global debug_package %{nil} +%endif + %description %prep %autosetup -p1 +# Add missing source files from a git checkout +tar -xf %{SOURCE4} -C third_party/blink/tools/blinkpy/common +touch third_party/blink/tools/blinkpy/__init__.py + ./build/linux/unbundle/remove_bundled_libraries.py --do-remove \ base/third_party/dmg_fp \ base/third_party/dynamic_annotations \ @@ -235,6 +234,8 @@ Conflicts: chromedriver-unstable base/third_party/valgrind \ base/third_party/xdg_mime \ base/third_party/xdg_user_dirs \ + buildtools/third_party/libc++ \ + buildtools/third_party/libc++abi \ chrome/third_party/mozilla_security_manager \ courgette/third_party \ native_client/src/third_party/dlmalloc \ @@ -249,6 +250,10 @@ Conflicts: chromedriver-unstable third_party/angle/src/third_party/compiler \ third_party/angle/src/third_party/libXNVCtrl \ third_party/angle/src/third_party/trace_event \ + third_party/angle/third_party/glslang \ + third_party/angle/third_party/spirv-headers \ + third_party/angle/third_party/spirv-tools \ + third_party/angle/third_party/vulkan-validation-layers \ third_party/boringssl \ third_party/boringssl/src/third_party/fiat \ third_party/blink \ @@ -299,6 +304,7 @@ Conflicts: chromedriver-unstable third_party/leveldatabase \ third_party/libaddressinput \ third_party/libaom \ + third_party/libaom/source/libaom/third_party/x86inc \ third_party/libjingle \ third_party/libphonenumber \ third_party/libsecret \ @@ -321,7 +327,6 @@ Conflicts: chromedriver-unstable third_party/mesa \ third_party/metrics_proto \ third_party/modp_b64 \ - third_party/mt19937ar \ third_party/node \ third_party/node/node_modules/polymer-bundler/lib/third_party/UglifyJS2 \ third_party/openh264 \ @@ -331,12 +336,12 @@ Conflicts: chromedriver-unstable third_party/pdfium/third_party/agg23 \ third_party/pdfium/third_party/base \ third_party/pdfium/third_party/bigint \ - third_party/pdfium/third_party/build \ third_party/pdfium/third_party/freetype \ third_party/pdfium/third_party/lcms \ third_party/pdfium/third_party/libopenjpeg20 \ third_party/pdfium/third_party/libpng16 \ third_party/pdfium/third_party/libtiff \ + third_party/pdfium/third_party/skia_shared \ %if !%{with system_ply} third_party/ply \ %endif @@ -606,12 +611,17 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || : %dir %{chromiumdir}/swiftshader %{chromiumdir}/swiftshader/libEGL.so %{chromiumdir}/swiftshader/libGLESv2.so -%license LICENSE -%doc AUTHORS %changelog +* Wed Apr 18 2018 - Ting-Wei Lan <lantw44@gmail.com> - 66.0.3359.117-100 +- Update to 66.0.3359.117 +- Workaround empty third_party/blink/tools/blinkpy/common directory +- Disable debuginfo package when debug symbols are disabled +- Remove duplicate items in files section +- Remove unrar sources + * Wed Mar 21 2018 - Ting-Wei Lan <lantw44@gmail.com> - 65.0.3325.181-100 - Update to 65.0.3325.181 |