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 {
 | 
			
		||||
 
 | 
			
		||||
@@ -124,22 +124,26 @@ class CefRefCount {
 | 
			
		||||
/// Macro that provides a reference counting implementation for classes
 | 
			
		||||
/// extending CefBase.
 | 
			
		||||
///
 | 
			
		||||
#define IMPLEMENT_REFCOUNTING(ClassName)                             \
 | 
			
		||||
 public:                                                             \
 | 
			
		||||
  void AddRef() const override { ref_count_.AddRef(); }              \
 | 
			
		||||
  bool Release() const override {                                    \
 | 
			
		||||
    if (ref_count_.Release()) {                                      \
 | 
			
		||||
      delete static_cast<const ClassName*>(this);                    \
 | 
			
		||||
      return true;                                                   \
 | 
			
		||||
    }                                                                \
 | 
			
		||||
    return false;                                                    \
 | 
			
		||||
  }                                                                  \
 | 
			
		||||
  bool HasOneRef() const override { return ref_count_.HasOneRef(); } \
 | 
			
		||||
  bool HasAtLeastOneRef() const override {                           \
 | 
			
		||||
    return ref_count_.HasAtLeastOneRef();                            \
 | 
			
		||||
  }                                                                  \
 | 
			
		||||
                                                                     \
 | 
			
		||||
 private:                                                            \
 | 
			
		||||
#define IMPLEMENT_REFCOUNTING(ClassName)          \
 | 
			
		||||
 public:                                          \
 | 
			
		||||
  void AddRef() const override {                  \
 | 
			
		||||
    ref_count_.AddRef();                          \
 | 
			
		||||
  }                                               \
 | 
			
		||||
  bool Release() const override {                 \
 | 
			
		||||
    if (ref_count_.Release()) {                   \
 | 
			
		||||
      delete static_cast<const ClassName*>(this); \
 | 
			
		||||
      return true;                                \
 | 
			
		||||
    }                                             \
 | 
			
		||||
    return false;                                 \
 | 
			
		||||
  }                                               \
 | 
			
		||||
  bool HasOneRef() const override {               \
 | 
			
		||||
    return ref_count_.HasOneRef();                \
 | 
			
		||||
  }                                               \
 | 
			
		||||
  bool HasAtLeastOneRef() const override {        \
 | 
			
		||||
    return ref_count_.HasAtLeastOneRef();         \
 | 
			
		||||
  }                                               \
 | 
			
		||||
                                                  \
 | 
			
		||||
 private:                                         \
 | 
			
		||||
  CefRefCount ref_count_
 | 
			
		||||
 | 
			
		||||
#endif  // CEF_INCLUDE_CEF_BASE_H_
 | 
			
		||||
 
 | 
			
		||||
@@ -74,8 +74,9 @@ struct CefStringTraitsWide {
 | 
			
		||||
    memset(&cstr, 0, sizeof(cstr));
 | 
			
		||||
    cef_string_wide_to_utf8(s->str, s->length, &cstr);
 | 
			
		||||
    std::string str;
 | 
			
		||||
    if (cstr.length > 0)
 | 
			
		||||
    if (cstr.length > 0) {
 | 
			
		||||
      str = std::string(cstr.str, cstr.length);
 | 
			
		||||
    }
 | 
			
		||||
    cef_string_utf8_clear(&cstr);
 | 
			
		||||
    return str;
 | 
			
		||||
  }
 | 
			
		||||
@@ -183,8 +184,9 @@ struct CefStringTraitsUTF8 {
 | 
			
		||||
    memset(&cstr, 0, sizeof(cstr));
 | 
			
		||||
    cef_string_utf8_to_wide(s->str, s->length, &cstr);
 | 
			
		||||
    std::wstring str;
 | 
			
		||||
    if (cstr.length > 0)
 | 
			
		||||
    if (cstr.length > 0) {
 | 
			
		||||
      str = std::wstring(cstr.str, cstr.length);
 | 
			
		||||
    }
 | 
			
		||||
    cef_string_wide_clear(&cstr);
 | 
			
		||||
    return str;
 | 
			
		||||
  }
 | 
			
		||||
@@ -255,8 +257,9 @@ struct CefStringTraitsUTF16 {
 | 
			
		||||
    memset(&cstr, 0, sizeof(cstr));
 | 
			
		||||
    cef_string_utf16_to_utf8(s->str, s->length, &cstr);
 | 
			
		||||
    std::string str;
 | 
			
		||||
    if (cstr.length > 0)
 | 
			
		||||
    if (cstr.length > 0) {
 | 
			
		||||
      str = std::string(cstr.str, cstr.length);
 | 
			
		||||
    }
 | 
			
		||||
    cef_string_utf8_clear(&cstr);
 | 
			
		||||
    return str;
 | 
			
		||||
  }
 | 
			
		||||
@@ -274,8 +277,9 @@ struct CefStringTraitsUTF16 {
 | 
			
		||||
    memset(&cstr, 0, sizeof(cstr));
 | 
			
		||||
    cef_string_utf16_to_wide(s->str, s->length, &cstr);
 | 
			
		||||
    std::wstring str;
 | 
			
		||||
    if (cstr.length > 0)
 | 
			
		||||
    if (cstr.length > 0) {
 | 
			
		||||
      str = std::wstring(cstr.str, cstr.length);
 | 
			
		||||
    }
 | 
			
		||||
    cef_string_wide_clear(&cstr);
 | 
			
		||||
    return str;
 | 
			
		||||
  }
 | 
			
		||||
@@ -374,8 +378,9 @@ class CefStringBase {
 | 
			
		||||
  }
 | 
			
		||||
  CefStringBase(const char* src, size_t length = 0)
 | 
			
		||||
      : string_(NULL), owner_(false) {
 | 
			
		||||
    if (src)
 | 
			
		||||
    if (src) {
 | 
			
		||||
      FromString(src, length);
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  ///
 | 
			
		||||
@@ -388,8 +393,9 @@ class CefStringBase {
 | 
			
		||||
  }
 | 
			
		||||
  CefStringBase(const wchar_t* src, size_t length = 0)
 | 
			
		||||
      : string_(NULL), owner_(false) {
 | 
			
		||||
    if (src)
 | 
			
		||||
    if (src) {
 | 
			
		||||
      FromWString(src, length);
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  ///
 | 
			
		||||
@@ -402,8 +408,9 @@ class CefStringBase {
 | 
			
		||||
  }
 | 
			
		||||
  CefStringBase(const std::u16string::value_type* src, size_t length = 0)
 | 
			
		||||
      : string_(NULL), owner_(false) {
 | 
			
		||||
    if (src)
 | 
			
		||||
    if (src) {
 | 
			
		||||
      FromString16(src, length);
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
#if defined(WCHAR_T_IS_UTF32)
 | 
			
		||||
  CefStringBase(const char16* src, size_t length = 0)
 | 
			
		||||
@@ -423,8 +430,9 @@ class CefStringBase {
 | 
			
		||||
  ///
 | 
			
		||||
  CefStringBase(const char_type* src, size_t src_len, bool copy)
 | 
			
		||||
      : string_(NULL), owner_(false) {
 | 
			
		||||
    if (src && src_len > 0)
 | 
			
		||||
    if (src && src_len > 0) {
 | 
			
		||||
      FromString(src, src_len, copy);
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  ///
 | 
			
		||||
@@ -433,8 +441,9 @@ class CefStringBase {
 | 
			
		||||
  /// this class and will not be freed by this class.
 | 
			
		||||
  ///
 | 
			
		||||
  CefStringBase(const struct_type* src) : string_(NULL), owner_(false) {
 | 
			
		||||
    if (!src)
 | 
			
		||||
    if (!src) {
 | 
			
		||||
      return;
 | 
			
		||||
    }
 | 
			
		||||
    // Reference the existing structure without taking ownership.
 | 
			
		||||
    Attach(const_cast<struct_type*>(src), false);
 | 
			
		||||
  }
 | 
			
		||||
@@ -468,12 +477,15 @@ class CefStringBase {
 | 
			
		||||
  /// Compare this string to the specified string.
 | 
			
		||||
  ///
 | 
			
		||||
  int compare(const CefStringBase& str) const {
 | 
			
		||||
    if (empty() && str.empty())
 | 
			
		||||
    if (empty() && str.empty()) {
 | 
			
		||||
      return 0;
 | 
			
		||||
    if (empty())
 | 
			
		||||
    }
 | 
			
		||||
    if (empty()) {
 | 
			
		||||
      return -1;
 | 
			
		||||
    if (str.empty())
 | 
			
		||||
    }
 | 
			
		||||
    if (str.empty()) {
 | 
			
		||||
      return 1;
 | 
			
		||||
    }
 | 
			
		||||
    return traits::compare(string_, str.GetStruct());
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
@@ -481,8 +493,9 @@ class CefStringBase {
 | 
			
		||||
  /// Clear the string data.
 | 
			
		||||
  ///
 | 
			
		||||
  void clear() {
 | 
			
		||||
    if (string_)
 | 
			
		||||
    if (string_) {
 | 
			
		||||
      traits::clear(string_);
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  ///
 | 
			
		||||
@@ -524,8 +537,9 @@ class CefStringBase {
 | 
			
		||||
  /// will be freed if this class owns the structure.
 | 
			
		||||
  ///
 | 
			
		||||
  void ClearAndFree() {
 | 
			
		||||
    if (!string_)
 | 
			
		||||
    if (!string_) {
 | 
			
		||||
      return;
 | 
			
		||||
    }
 | 
			
		||||
    if (owner_) {
 | 
			
		||||
      clear();
 | 
			
		||||
      delete string_;
 | 
			
		||||
@@ -555,8 +569,9 @@ class CefStringBase {
 | 
			
		||||
    // Free the previous structure and data, if any.
 | 
			
		||||
    ClearAndFree();
 | 
			
		||||
 | 
			
		||||
    if (!str)
 | 
			
		||||
    if (!str) {
 | 
			
		||||
      return;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    AllocIfNeeded();
 | 
			
		||||
    owner_ = true;
 | 
			
		||||
@@ -583,8 +598,9 @@ class CefStringBase {
 | 
			
		||||
  /// this string class currently contains no data.
 | 
			
		||||
  ///
 | 
			
		||||
  userfree_struct_type DetachToUserFree() {
 | 
			
		||||
    if (empty())
 | 
			
		||||
    if (empty()) {
 | 
			
		||||
      return NULL;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    userfree_struct_type str = traits::userfree_alloc();
 | 
			
		||||
    if (owner_) {
 | 
			
		||||
@@ -637,8 +653,9 @@ class CefStringBase {
 | 
			
		||||
  /// necessary based on the underlying string type.
 | 
			
		||||
  ///
 | 
			
		||||
  std::string ToString() const {
 | 
			
		||||
    if (empty())
 | 
			
		||||
    if (empty()) {
 | 
			
		||||
      return std::string();
 | 
			
		||||
    }
 | 
			
		||||
    return traits::to_string(string_);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
@@ -678,8 +695,9 @@ class CefStringBase {
 | 
			
		||||
  /// necessary based on the underlying string type.
 | 
			
		||||
  ///
 | 
			
		||||
  std::wstring ToWString() const {
 | 
			
		||||
    if (empty())
 | 
			
		||||
    if (empty()) {
 | 
			
		||||
      return std::wstring();
 | 
			
		||||
    }
 | 
			
		||||
    return traits::to_wstring(string_);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
@@ -719,8 +737,9 @@ class CefStringBase {
 | 
			
		||||
  /// necessary based on the underlying string type.
 | 
			
		||||
  ///
 | 
			
		||||
  std::u16string ToString16() const {
 | 
			
		||||
    if (empty())
 | 
			
		||||
    if (empty()) {
 | 
			
		||||
      return std::u16string();
 | 
			
		||||
    }
 | 
			
		||||
    return traits::to_string16(string_);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -49,8 +49,9 @@ class CefStructBase : public traits::struct_type {
 | 
			
		||||
  virtual ~CefStructBase() {
 | 
			
		||||
    // Only clear this object's data if it isn't currently attached to a
 | 
			
		||||
    // structure.
 | 
			
		||||
    if (!attached_to_)
 | 
			
		||||
    if (!attached_to_) {
 | 
			
		||||
      Clear(this);
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  CefStructBase(const CefStructBase& r) {
 | 
			
		||||
@@ -69,8 +70,9 @@ class CefStructBase : public traits::struct_type {
 | 
			
		||||
  void AttachTo(struct_type& source) {
 | 
			
		||||
    // Only clear this object's data if it isn't currently attached to a
 | 
			
		||||
    // structure.
 | 
			
		||||
    if (!attached_to_)
 | 
			
		||||
    if (!attached_to_) {
 | 
			
		||||
      Clear(this);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // This object is now attached to the new structure.
 | 
			
		||||
    attached_to_ = &source;
 | 
			
		||||
 
 | 
			
		||||
@@ -103,22 +103,26 @@ struct CefDeleteOnFileUserBlockingThread
 | 
			
		||||
struct CefDeleteOnRendererThread : public CefDeleteOnThread<TID_RENDERER> {};
 | 
			
		||||
 | 
			
		||||
// Same as IMPLEMENT_REFCOUNTING() but using the specified Destructor.
 | 
			
		||||
#define IMPLEMENT_REFCOUNTING_EX(ClassName, Destructor)              \
 | 
			
		||||
 public:                                                             \
 | 
			
		||||
  void AddRef() const override { ref_count_.AddRef(); }              \
 | 
			
		||||
  bool Release() const override {                                    \
 | 
			
		||||
    if (ref_count_.Release()) {                                      \
 | 
			
		||||
      Destructor::Destruct(this);                                    \
 | 
			
		||||
      return true;                                                   \
 | 
			
		||||
    }                                                                \
 | 
			
		||||
    return false;                                                    \
 | 
			
		||||
  }                                                                  \
 | 
			
		||||
  bool HasOneRef() const override { return ref_count_.HasOneRef(); } \
 | 
			
		||||
  bool HasAtLeastOneRef() const override {                           \
 | 
			
		||||
    return ref_count_.HasAtLeastOneRef();                            \
 | 
			
		||||
  }                                                                  \
 | 
			
		||||
                                                                     \
 | 
			
		||||
 private:                                                            \
 | 
			
		||||
#define IMPLEMENT_REFCOUNTING_EX(ClassName, Destructor) \
 | 
			
		||||
 public:                                                \
 | 
			
		||||
  void AddRef() const override {                        \
 | 
			
		||||
    ref_count_.AddRef();                                \
 | 
			
		||||
  }                                                     \
 | 
			
		||||
  bool Release() const override {                       \
 | 
			
		||||
    if (ref_count_.Release()) {                         \
 | 
			
		||||
      Destructor::Destruct(this);                       \
 | 
			
		||||
      return true;                                      \
 | 
			
		||||
    }                                                   \
 | 
			
		||||
    return false;                                       \
 | 
			
		||||
  }                                                     \
 | 
			
		||||
  bool HasOneRef() const override {                     \
 | 
			
		||||
    return ref_count_.HasOneRef();                      \
 | 
			
		||||
  }                                                     \
 | 
			
		||||
  bool HasAtLeastOneRef() const override {              \
 | 
			
		||||
    return ref_count_.HasAtLeastOneRef();               \
 | 
			
		||||
  }                                                     \
 | 
			
		||||
                                                        \
 | 
			
		||||
 private:                                               \
 | 
			
		||||
  CefRefCount ref_count_
 | 
			
		||||
 | 
			
		||||
#define IMPLEMENT_REFCOUNTING_DELETE_ON_UIT(ClassName) \
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user