mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Update include files for bracket style
This commit is contained in:
@ -73,8 +73,9 @@ class AutoReset {
|
||||
}
|
||||
|
||||
~AutoReset() {
|
||||
if (scoped_variable_)
|
||||
if (scoped_variable_) {
|
||||
*scoped_variable_ = std::move(original_value_);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -97,21 +97,20 @@ namespace base {
|
||||
/// Bind as OnceCallback.
|
||||
///
|
||||
template <typename Functor, typename... Args>
|
||||
inline OnceCallback<cef_internal::MakeUnboundRunType<Functor, Args...>> BindOnce(
|
||||
Functor&& functor,
|
||||
Args&&... args) {
|
||||
inline OnceCallback<cef_internal::MakeUnboundRunType<Functor, Args...>>
|
||||
BindOnce(Functor&& functor, Args&&... args) {
|
||||
static_assert(!cef_internal::IsOnceCallback<std::decay_t<Functor>>() ||
|
||||
(std::is_rvalue_reference<Functor&&>() &&
|
||||
!std::is_const<std::remove_reference_t<Functor>>()),
|
||||
"BindOnce requires non-const rvalue for OnceCallback binding."
|
||||
" I.e.: base::BindOnce(std::move(callback)).");
|
||||
static_assert(
|
||||
conjunction<
|
||||
cef_internal::AssertBindArgIsNotBasePassed<std::decay_t<Args>>...>::value,
|
||||
conjunction<cef_internal::AssertBindArgIsNotBasePassed<
|
||||
std::decay_t<Args>>...>::value,
|
||||
"Use std::move() instead of base::Passed() with base::BindOnce()");
|
||||
|
||||
return cef_internal::BindImpl<OnceCallback>(std::forward<Functor>(functor),
|
||||
std::forward<Args>(args)...);
|
||||
std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
///
|
||||
@ -124,8 +123,8 @@ BindRepeating(Functor&& functor, Args&&... args) {
|
||||
!cef_internal::IsOnceCallback<std::decay_t<Functor>>(),
|
||||
"BindRepeating cannot bind OnceCallback. Use BindOnce with std::move().");
|
||||
|
||||
return cef_internal::BindImpl<RepeatingCallback>(std::forward<Functor>(functor),
|
||||
std::forward<Args>(args)...);
|
||||
return cef_internal::BindImpl<RepeatingCallback>(
|
||||
std::forward<Functor>(functor), std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
///
|
||||
|
@ -163,7 +163,8 @@ class OnceCallback<R(Args...)> : public cef_internal::CallbackBase {
|
||||
};
|
||||
|
||||
template <typename R, typename... Args>
|
||||
class RepeatingCallback<R(Args...)> : public cef_internal::CallbackBaseCopyable {
|
||||
class RepeatingCallback<R(Args...)>
|
||||
: public cef_internal::CallbackBaseCopyable {
|
||||
public:
|
||||
using ResultType = R;
|
||||
using RunType = R(Args...);
|
||||
|
@ -242,8 +242,9 @@ class CallbackListBase {
|
||||
// the reentrant Notify() call.
|
||||
template <typename... RunArgs>
|
||||
void Notify(RunArgs&&... args) {
|
||||
if (empty())
|
||||
if (empty()) {
|
||||
return; // Nothing to do.
|
||||
}
|
||||
|
||||
{
|
||||
AutoReset<bool> iterating(&iterating_, true);
|
||||
@ -257,18 +258,20 @@ class CallbackListBase {
|
||||
});
|
||||
};
|
||||
for (auto it = next_valid(callbacks_.begin()); it != callbacks_.end();
|
||||
it = next_valid(it))
|
||||
it = next_valid(it)) {
|
||||
// NOTE: Intentionally does not call std::forward<RunArgs>(args)...,
|
||||
// since that would allow move-only arguments.
|
||||
static_cast<CallbackListImpl*>(this)->RunCallback(it++, args...);
|
||||
}
|
||||
}
|
||||
|
||||
// Re-entrant invocations shouldn't prune anything from the list. This can
|
||||
// invalidate iterators from underneath higher call frames. It's safe to
|
||||
// simply do nothing, since the outermost frame will continue through here
|
||||
// and prune all null callbacks below.
|
||||
if (iterating_)
|
||||
if (iterating_) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Any null callbacks remaining in the list were canceled due to
|
||||
// Subscription destruction during iteration, and can safely be erased now.
|
||||
@ -282,8 +285,9 @@ class CallbackListBase {
|
||||
// that were executed above have all been removed regardless of whether
|
||||
// they're counted in |erased_callbacks_|.
|
||||
if (removal_callback_ &&
|
||||
(erased_callbacks || IsOnceCallback<CallbackType>::value))
|
||||
(erased_callbacks || IsOnceCallback<CallbackType>::value)) {
|
||||
removal_callback_.Run(); // May delete |this|!
|
||||
}
|
||||
}
|
||||
|
||||
protected:
|
||||
@ -295,8 +299,9 @@ class CallbackListBase {
|
||||
private:
|
||||
// Cancels the callback pointed to by |it|, which is guaranteed to be valid.
|
||||
void CancelCallback(const typename Callbacks::iterator& it) {
|
||||
if (static_cast<CallbackListImpl*>(this)->CancelNullCallback(it))
|
||||
if (static_cast<CallbackListImpl*>(this)->CancelNullCallback(it)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (iterating_) {
|
||||
// Calling erase() here is unsafe, since the loop in Notify() may be
|
||||
@ -306,8 +311,9 @@ class CallbackListBase {
|
||||
it->Reset();
|
||||
} else {
|
||||
callbacks_.erase(it);
|
||||
if (removal_callback_)
|
||||
if (removal_callback_) {
|
||||
removal_callback_.Run(); // May delete |this|!
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -133,8 +133,9 @@ class CancelableCallbackImpl {
|
||||
|
||||
// Returns a callback that can be disabled by calling Cancel().
|
||||
CallbackType callback() const {
|
||||
if (!callback_)
|
||||
if (!callback_) {
|
||||
return CallbackType();
|
||||
}
|
||||
CallbackType forwarder;
|
||||
MakeForwarder(&forwarder);
|
||||
return forwarder;
|
||||
|
@ -105,13 +105,16 @@ class RefCountedBase {
|
||||
|
||||
#if DCHECK_IS_ON()
|
||||
DCHECK(!in_dtor_);
|
||||
if (ref_count_ == 0)
|
||||
if (ref_count_ == 0) {
|
||||
in_dtor_ = true;
|
||||
}
|
||||
|
||||
if (ref_count_ >= 1)
|
||||
if (ref_count_ >= 1) {
|
||||
DCHECK(CalledOnValidThread());
|
||||
if (ref_count_ == 1)
|
||||
}
|
||||
if (ref_count_ == 1) {
|
||||
thread_checker_.DetachFromThread();
|
||||
}
|
||||
#endif
|
||||
|
||||
return ref_count_ == 0;
|
||||
|
@ -229,8 +229,9 @@ class TRIVIAL_ABI scoped_refptr {
|
||||
// should move or copy construct from an existing scoped_refptr<T> to the
|
||||
// ref-counted object.
|
||||
scoped_refptr(T* p) : ptr_(p) {
|
||||
if (ptr_)
|
||||
if (ptr_) {
|
||||
AddRef(ptr_);
|
||||
}
|
||||
}
|
||||
|
||||
// Copy constructor. This is required in addition to the copy conversion
|
||||
@ -261,8 +262,9 @@ class TRIVIAL_ABI scoped_refptr {
|
||||
"It's unsafe to override the ref count preference."
|
||||
" Please remove REQUIRE_ADOPTION_FOR_REFCOUNTED_TYPE"
|
||||
" from subclasses.");
|
||||
if (ptr_)
|
||||
if (ptr_) {
|
||||
Release(ptr_);
|
||||
}
|
||||
}
|
||||
|
||||
T* get() const { return ptr_; }
|
||||
|
@ -97,21 +97,24 @@ class ScopedTypeRef {
|
||||
element_type object = Traits::InvalidValue(),
|
||||
base::scoped_policy::OwnershipPolicy policy = base::scoped_policy::ASSUME)
|
||||
: object_(object) {
|
||||
if (object_ && policy == base::scoped_policy::RETAIN)
|
||||
if (object_ && policy == base::scoped_policy::RETAIN) {
|
||||
object_ = Traits::Retain(object_);
|
||||
}
|
||||
}
|
||||
|
||||
ScopedTypeRef(const ScopedTypeRef<T, Traits>& that) : object_(that.object_) {
|
||||
if (object_)
|
||||
if (object_) {
|
||||
object_ = Traits::Retain(object_);
|
||||
}
|
||||
}
|
||||
|
||||
// This allows passing an object to a function that takes its superclass.
|
||||
template <typename R, typename RTraits>
|
||||
explicit ScopedTypeRef(const ScopedTypeRef<R, RTraits>& that_as_subclass)
|
||||
: object_(that_as_subclass.get()) {
|
||||
if (object_)
|
||||
if (object_) {
|
||||
object_ = Traits::Retain(object_);
|
||||
}
|
||||
}
|
||||
|
||||
ScopedTypeRef(ScopedTypeRef<T, Traits>&& that) : object_(that.object_) {
|
||||
@ -119,8 +122,9 @@ class ScopedTypeRef {
|
||||
}
|
||||
|
||||
~ScopedTypeRef() {
|
||||
if (object_)
|
||||
if (object_) {
|
||||
Traits::Release(object_);
|
||||
}
|
||||
}
|
||||
|
||||
ScopedTypeRef& operator=(const ScopedTypeRef<T, Traits>& that) {
|
||||
@ -143,10 +147,12 @@ class ScopedTypeRef {
|
||||
void reset(element_type object = Traits::InvalidValue(),
|
||||
base::scoped_policy::OwnershipPolicy policy =
|
||||
base::scoped_policy::ASSUME) {
|
||||
if (object && policy == base::scoped_policy::RETAIN)
|
||||
if (object && policy == base::scoped_policy::RETAIN) {
|
||||
object = Traits::Retain(object);
|
||||
if (object_)
|
||||
}
|
||||
if (object_) {
|
||||
Traits::Release(object_);
|
||||
}
|
||||
object_ = object;
|
||||
}
|
||||
|
||||
|
@ -73,9 +73,12 @@
|
||||
|
||||
namespace base {
|
||||
|
||||
template <class T> struct is_non_const_reference : std::false_type {};
|
||||
template <class T> struct is_non_const_reference<T&> : std::true_type {};
|
||||
template <class T> struct is_non_const_reference<const T&> : std::false_type {};
|
||||
template <class T>
|
||||
struct is_non_const_reference : std::false_type {};
|
||||
template <class T>
|
||||
struct is_non_const_reference<T&> : std::true_type {};
|
||||
template <class T>
|
||||
struct is_non_const_reference<const T&> : std::false_type {};
|
||||
|
||||
namespace internal {
|
||||
|
||||
|
@ -687,8 +687,9 @@ struct InvokeHelper<true, ReturnType> {
|
||||
static inline void MakeItSo(Functor&& functor,
|
||||
BoundWeakPtr&& weak_ptr,
|
||||
RunArgs&&... args) {
|
||||
if (!weak_ptr)
|
||||
if (!weak_ptr) {
|
||||
return;
|
||||
}
|
||||
using Traits = MakeFunctorTraits<Functor>;
|
||||
Traits::Invoke(std::forward<Functor>(functor),
|
||||
std::forward<BoundWeakPtr>(weak_ptr),
|
||||
@ -1304,12 +1305,16 @@ struct BindUnwrapTraits {
|
||||
|
||||
template <typename T>
|
||||
struct BindUnwrapTraits<cef_internal::UnretainedWrapper<T>> {
|
||||
static T* Unwrap(const cef_internal::UnretainedWrapper<T>& o) { return o.get(); }
|
||||
static T* Unwrap(const cef_internal::UnretainedWrapper<T>& o) {
|
||||
return o.get();
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct BindUnwrapTraits<cef_internal::RetainedRefWrapper<T>> {
|
||||
static T* Unwrap(const cef_internal::RetainedRefWrapper<T>& o) { return o.get(); }
|
||||
static T* Unwrap(const cef_internal::RetainedRefWrapper<T>& o) {
|
||||
return o.get();
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, typename Deleter>
|
||||
@ -1321,7 +1326,9 @@ struct BindUnwrapTraits<cef_internal::OwnedWrapper<T, Deleter>> {
|
||||
|
||||
template <typename T>
|
||||
struct BindUnwrapTraits<cef_internal::OwnedRefWrapper<T>> {
|
||||
static T& Unwrap(const cef_internal::OwnedRefWrapper<T>& o) { return o.get(); }
|
||||
static T& Unwrap(const cef_internal::OwnedRefWrapper<T>& o) {
|
||||
return o.get();
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
@ -1350,9 +1357,9 @@ template <typename Functor, typename... BoundArgs>
|
||||
struct CallbackCancellationTraits<
|
||||
Functor,
|
||||
std::tuple<BoundArgs...>,
|
||||
std::enable_if_t<
|
||||
cef_internal::IsWeakMethod<cef_internal::FunctorTraits<Functor>::is_method,
|
||||
BoundArgs...>::value>> {
|
||||
std::enable_if_t<cef_internal::IsWeakMethod<
|
||||
cef_internal::FunctorTraits<Functor>::is_method,
|
||||
BoundArgs...>::value>> {
|
||||
static constexpr bool is_cancellable = true;
|
||||
|
||||
template <typename Receiver, typename... Args>
|
||||
|
@ -38,7 +38,8 @@
|
||||
#include "include/base/cef_scoped_typeref_mac.h"
|
||||
|
||||
#if defined(__has_feature) && __has_feature(objc_arc)
|
||||
#error "Cannot include include/base/internal/cef_scoped_block_mac.h in file built with ARC."
|
||||
#error \
|
||||
"Cannot include include/base/internal/cef_scoped_block_mac.h in file built with ARC."
|
||||
#endif
|
||||
|
||||
namespace base {
|
||||
|
Reference in New Issue
Block a user