diff options
Diffstat (limited to 'chromium/base/threading/sequence_bound.h')
-rw-r--r-- | chromium/base/threading/sequence_bound.h | 24 |
1 files changed, 3 insertions, 21 deletions
diff --git a/chromium/base/threading/sequence_bound.h b/chromium/base/threading/sequence_bound.h index b235fe221c3..3ee8ef6e4c9 100644 --- a/chromium/base/threading/sequence_bound.h +++ b/chromium/base/threading/sequence_bound.h @@ -94,26 +94,6 @@ namespace base { // SequenceBound<MyDerivedClass>(main_task_runner, ctor args); // auto c = new SomeConsumer(std::move(widget)); // upcasts to MyClass -namespace internal { - -// If we can't cast |Base*| into |Derived*|, then it's a virtual base if and -// only if |Base| is actually a base class of |Derived|. Otherwise (including -// unrelated types), it isn't. We default to Derived* so that the -// specialization below will apply when the cast to |Derived*| is valid. -template <typename Base, typename Derived, typename = Derived*> -struct is_virtual_base_of : public std::is_base_of<Base, Derived> {}; - -// If we can cast |Base*| into |Derived*|, then it's definitely not a virtual -// base. When this happens, we'll match the default third template argument. -template <typename Base, typename Derived> -struct is_virtual_base_of<Base, - Derived, - decltype(static_cast<Derived*>( - static_cast<Base*>(nullptr)))> : std::false_type { -}; - -} // namespace internal - template <typename T> class SequenceBound { public: @@ -134,7 +114,9 @@ class SequenceBound { Args&&... args) : impl_task_runner_(std::move(task_runner)) { // Allocate space for but do not construct an instance of |T|. - storage_ = AlignedAlloc(sizeof(T), alignof(T)); + // AlignedAlloc() requires alignment be a multiple of sizeof(void*). + storage_ = AlignedAlloc( + sizeof(T), sizeof(void*) > alignof(T) ? sizeof(void*) : alignof(T)); t_ = reinterpret_cast<T*>(storage_); // Post construction to the impl thread. |