diff --git a/CMakeLists.txt b/CMakeLists.txt index 1f187e608..5327bac70 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -52,7 +52,6 @@ include_directories( "${PROJECT_SOURCE_DIR}/vendors/StackWalker/Main/StackWalker" "${PROJECT_SOURCE_DIR}/vendors/ultralight/include" "${PROJECT_SOURCE_DIR}/vendors/directxtk" - "${PROJECT_SOURCE_DIR}/vendors/cef" "${PROJECT_SOURCE_DIR}/vendors/ultralight/include" "${PROJECT_SOURCE_DIR}/vendors" "${PROJECT_SOURCE_DIR}/code/framework/src/" diff --git a/README.md b/README.md index 68a850515..8e411f6d8 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ This codebase provides a suite of tools and libraries to simplify the developmen * **ECS**: Backed by a robust ECS framework that simplifies entity management and world streaming, it is also easily extensible. * **Scripting**: The **Node.js** scripting layer provides an easy way to create and manage game modes used on game servers. * **Logging**: It is always vital to log actions and errors, so the framework provides a simple way. -* **GUI**: It provides a simple way to create and manage GUI elements using the **Chromium Embedded Framework** library. +* **GUI**: It provides a simple way to create and manage GUI elements using the **Ultralight** library. * **Sentry**: The framework provides a simple way to report errors and exceptions to the **Sentry** service. * **Firebase**: It easily stores and retrieves data from the **Firebase** service. Including stats, player data, and more. * **Externals**: Contains wrappers for various libraries and services used within the framework. diff --git a/code/framework/src/graphics/types.h b/code/framework/src/graphics/types.h index 201285b9b..cbea6005a 100644 --- a/code/framework/src/graphics/types.h +++ b/code/framework/src/graphics/types.h @@ -11,7 +11,7 @@ namespace Framework::Graphics { enum class RendererBackend { BACKEND_D3D_9, BACKEND_D3D_11, BACKEND_D3D_12 }; - enum class RendererAPI { CEF, IMGUI, ULTRALIGHT }; + enum class RendererAPI { IMGUI, ULTRALIGHT }; enum class PlatformBackend { PLATFORM_WIN32, PLATFORM_SDL2 }; diff --git a/vendors/CMakeLists.txt b/vendors/CMakeLists.txt index 1524a57f1..de1b4e991 100644 --- a/vendors/CMakeLists.txt +++ b/vendors/CMakeLists.txt @@ -103,7 +103,6 @@ if (WIN32) add_subdirectory(sdl2) add_subdirectory(discord) add_subdirectory(directxtk) - add_subdirectory(cef) add_subdirectory(ultralight) # Lua diff --git a/vendors/cef/CMakeLists.txt b/vendors/cef/CMakeLists.txt deleted file mode 100644 index 0ecc02f19..000000000 --- a/vendors/cef/CMakeLists.txt +++ /dev/null @@ -1,12 +0,0 @@ -add_library(CEF STATIC dummy.cpp) -if(CMAKE_CL_64) - target_link_directories(CEF PUBLIC "lib/win_64/Release") -elseif(WIN32) - target_link_directories(CEF PUBLIC "lib/win_32") -elseif(APPLE) - target_link_directories(CEF PUBLIC "lib/darwin_x64") -else() - target_link_directories(CEF PUBLIC "lib/linux") -endif() -target_link_libraries(CEF PUBLIC libcef libcef_dll_wrapper) -target_include_directories(CEF PUBLIC "include") diff --git a/vendors/cef/dummy.cpp b/vendors/cef/dummy.cpp deleted file mode 100644 index e69de29bb..000000000 diff --git a/vendors/cef/include/base/cef_atomic_flag.h b/vendors/cef/include/base/cef_atomic_flag.h deleted file mode 100644 index 3a2fdbc1d..000000000 --- a/vendors/cef/include/base/cef_atomic_flag.h +++ /dev/null @@ -1,97 +0,0 @@ -// Copyright (c) 2014 Marshall A. Greenblatt. Portions copyright (c) 2011 -// Google Inc. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the name Chromium Embedded -// Framework nor the names of its contributors may be used to endorse -// or promote products derived from this software without specific prior -// written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -#ifndef CEF_INCLUDE_BASE_CEF_ATOMIC_FLAG_H_ -#define CEF_INCLUDE_BASE_CEF_ATOMIC_FLAG_H_ -#pragma once - -#if defined(USING_CHROMIUM_INCLUDES) -// When building CEF include the Chromium header directly. -#include "base/synchronization/atomic_flag.h" - -#else // !USING_CHROMIUM_INCLUDES -// The following is substantially similar to the Chromium implementation. -// If the Chromium implementation diverges the below implementation should be -// updated to match. - -#include - -#include - -#include "include/base/cef_thread_checker.h" - -namespace base { - -/// -/// A flag that can safely be set from one thread and read from other threads. -/// -/// This class IS NOT intended for synchronization between threads. -/// -class AtomicFlag { - public: - AtomicFlag(); - - AtomicFlag(const AtomicFlag&) = delete; - AtomicFlag& operator=(const AtomicFlag&) = delete; - - ~AtomicFlag(); - - /// - /// Set the flag. Must always be called from the same thread. - /// - void Set(); - - /// - /// Returns true iff the flag was set. If this returns true, the current - /// thread is guaranteed to be synchronized with all memory operations on the - /// thread which invoked Set() up until at least the first call to Set() on - /// it. - /// - bool IsSet() const { - // Inline here: this has a measurable performance impact on base::WeakPtr. - return flag_.load(std::memory_order_acquire) != 0; - } - - /// - /// Resets the flag. Be careful when using this: callers might not expect - /// IsSet() to return false after returning true once. - /// - void UnsafeResetForTesting(); - - private: - std::atomic flag_{0}; - base::ThreadChecker set_thread_checker_; -}; - -} // namespace base - -#endif // !USING_CHROMIUM_INCLUDES - -#endif // CEF_INCLUDE_BASE_CEF_ATOMIC_FLAG_H_ diff --git a/vendors/cef/include/base/cef_atomic_ref_count.h b/vendors/cef/include/base/cef_atomic_ref_count.h deleted file mode 100644 index 38e8f93b7..000000000 --- a/vendors/cef/include/base/cef_atomic_ref_count.h +++ /dev/null @@ -1,123 +0,0 @@ -// Copyright (c) 2014 Marshall A. Greenblatt. Portions copyright (c) 2011 -// Google Inc. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the name Chromium Embedded -// Framework nor the names of its contributors may be used to endorse -// or promote products derived from this software without specific prior -// written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// This is a low level implementation of atomic semantics for reference -// counting. Please use cef_ref_counted.h directly instead. -// -// The Chromium implementation includes annotations to avoid some false -// positives when using data race detection tools. Annotations are not -// currently supported by the CEF implementation. - -#ifndef CEF_INCLUDE_BASE_CEF_ATOMIC_REF_COUNT_H_ -#define CEF_INCLUDE_BASE_CEF_ATOMIC_REF_COUNT_H_ -#pragma once - -#if defined(USING_CHROMIUM_INCLUDES) -// When building CEF include the Chromium header directly. -#include "base/atomic_ref_count.h" - -#else // !USING_CHROMIUM_INCLUDES -// The following is substantially similar to the Chromium implementation. -// If the Chromium implementation diverges the below implementation should be -// updated to match. - -#include - -namespace base { - -class AtomicRefCount { - public: - constexpr AtomicRefCount() : ref_count_(0) {} - explicit constexpr AtomicRefCount(int initial_value) - : ref_count_(initial_value) {} - - /// - /// Increment a reference count. - /// Returns the previous value of the count. - /// - int Increment() { return Increment(1); } - - /// - /// Increment a reference count by "increment", which must exceed 0. - /// Returns the previous value of the count. - /// - int Increment(int increment) { - return ref_count_.fetch_add(increment, std::memory_order_relaxed); - } - - /// - /// Decrement a reference count, and return whether the result is non-zero. - /// Insert barriers to ensure that state written before the reference count - /// became zero will be visible to a thread that has just made the count zero. - /// - bool Decrement() { - // TODO(jbroman): Technically this doesn't need to be an acquire operation - // unless the result is 1 (i.e., the ref count did indeed reach zero). - // However, there are toolchain issues that make that not work as well at - // present (notably TSAN doesn't like it). - return ref_count_.fetch_sub(1, std::memory_order_acq_rel) != 1; - } - - /// - /// Return whether the reference count is one. If the reference count is used - /// in the conventional way, a refrerence count of 1 implies that the current - /// thread owns the reference and no other thread shares it. This call - /// performs the test for a reference count of one, and performs the memory - /// barrier needed for the owning thread to act on the object, knowing that it - /// has exclusive access to the object. - /// - bool IsOne() const { return ref_count_.load(std::memory_order_acquire) == 1; } - - /// - /// Return whether the reference count is zero. With conventional object - /// referencing counting, the object will be destroyed, so the reference count - /// should never be zero. Hence this is generally used for a debug check. - /// - bool IsZero() const { - return ref_count_.load(std::memory_order_acquire) == 0; - } - - /// - /// Returns the current reference count (with no barriers). This is subtle, - /// and should be used only for debugging. - /// - int SubtleRefCountForDebug() const { - return ref_count_.load(std::memory_order_relaxed); - } - - private: - std::atomic_int ref_count_; -}; - -} // namespace base - -#endif // !USING_CHROMIUM_INCLUDES - -#endif // CEF_INCLUDE_BASE_CEF_ATOMIC_REF_COUNT_H_ diff --git a/vendors/cef/include/base/cef_auto_reset.h b/vendors/cef/include/base/cef_auto_reset.h deleted file mode 100644 index be3a05da5..000000000 --- a/vendors/cef/include/base/cef_auto_reset.h +++ /dev/null @@ -1,90 +0,0 @@ -// Copyright (c) 2014 Marshall A. Greenblatt. Portions copyright (c) 2011 -// Google Inc. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the name Chromium Embedded -// Framework nor the names of its contributors may be used to endorse -// or promote products derived from this software without specific prior -// written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// base::AutoReset<> is useful for setting a variable to a new value only within -// a particular scope. An base::AutoReset<> object resets a variable to its -// original value upon destruction, making it an alternative to writing -// "var = false;" or "var = old_val;" at all of a block's exit points. -// -// This should be obvious, but note that an base::AutoReset<> instance should -// have a shorter lifetime than its scoped_variable, to prevent invalid memory -// writes when the base::AutoReset<> object is destroyed. - -#ifndef CEF_INCLUDE_BASE_CEF_AUTO_RESET_H_ -#define CEF_INCLUDE_BASE_CEF_AUTO_RESET_H_ -#pragma once - -#if defined(USING_CHROMIUM_INCLUDES) -// When building CEF include the Chromium header directly. -#include "base/auto_reset.h" -#else // !USING_CHROMIUM_INCLUDES -// The following is substantially similar to the Chromium implementation. -// If the Chromium implementation diverges the below implementation should be -// updated to match. - -#include - -namespace base { - -template -class AutoReset { - public: - template - AutoReset(T* scoped_variable, U&& new_value) - : scoped_variable_(scoped_variable), - original_value_( - std::exchange(*scoped_variable_, std::forward(new_value))) {} - - AutoReset(AutoReset&& other) - : scoped_variable_(std::exchange(other.scoped_variable_, nullptr)), - original_value_(std::move(other.original_value_)) {} - - AutoReset& operator=(AutoReset&& rhs) { - scoped_variable_ = std::exchange(rhs.scoped_variable_, nullptr); - original_value_ = std::move(rhs.original_value_); - return *this; - } - - ~AutoReset() { - if (scoped_variable_) { - *scoped_variable_ = std::move(original_value_); - } - } - - private: - T* scoped_variable_; - T original_value_; -}; - -} // namespace base - -#endif // !USING_CHROMIUM_INCLUDES - -#endif // CEF_INCLUDE_BASE_CEF_AUTO_RESET_H_ diff --git a/vendors/cef/include/base/cef_bind.h b/vendors/cef/include/base/cef_bind.h deleted file mode 100644 index e879b5694..000000000 --- a/vendors/cef/include/base/cef_bind.h +++ /dev/null @@ -1,390 +0,0 @@ -// Copyright (c) 2014 Marshall A. Greenblatt. Portions copyright (c) 2011 -// Google Inc. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the name Chromium Embedded -// Framework nor the names of its contributors may be used to endorse -// or promote products derived from this software without specific prior -// written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -/// -/// \file -/// base::BindOnce() and base::BindRepeating() are helpers for creating -/// base::OnceCallback and base::RepeatingCallback objects respectively. -/// -/// For a runnable object of n-arity, the base::Bind*() family allows partial -/// application of the first m arguments. The remaining n - m arguments must be -/// passed when invoking the callback with Run(). -/// -///
-///   // The first argument is bound at callback creation; the remaining
-///   // two must be passed when calling Run() on the callback object.
-///   base::OnceCallback cb = base::BindOnce(
-///       [](short x, int y, long z) { return x * y * z; }, 42);
-/// 
-/// -/// When binding to a method, the receiver object must also be specified at -/// callback creation time. When Run() is invoked, the method will be invoked on -/// the specified receiver object. -/// -///
-///   class C : public base::RefCounted { void F(); };
-///   auto instance = base::MakeRefCounted();
-///   auto cb = base::BindOnce(&C::F, instance);
-///   std::move(cb).Run();  // Identical to instance->F()
-/// 
-/// -/// See https://chromium.googlesource.com/chromium/src/+/lkgr/docs/callback.md -/// for the full documentation. -/// - -// Implementation notes -// -// If you're reading the implementation, before proceeding further, you should -// read the top comment of base/internal/cef_bind_internal.h for a definition -// of common terms and concepts. - -#ifndef CEF_INCLUDE_BASE_CEF_BIND_H_ -#define CEF_INCLUDE_BASE_CEF_BIND_H_ -#pragma once - -#if defined(USING_CHROMIUM_INCLUDES) -// When building CEF include the Chromium header directly. -#include "base/functional/bind.h" -#else // !USING_CHROMIUM_INCLUDES -// The following is substantially similar to the Chromium implementation. -// If the Chromium implementation diverges the below implementation should be -// updated to match. - -#include -#include -#include -#include - -#include "include/base/cef_build.h" -#include "include/base/cef_compiler_specific.h" -#include "include/base/internal/cef_bind_internal.h" - -#if defined(OS_APPLE) && !HAS_FEATURE(objc_arc) -#include "include/base/internal/cef_scoped_block_mac.h" -#endif - -namespace base { - -/// -/// Bind as OnceCallback. -/// -template -inline OnceCallback> -BindOnce(Functor&& functor, Args&&... args) { - static_assert(!cef_internal::IsOnceCallback>() || - (std::is_rvalue_reference() && - !std::is_const>()), - "BindOnce requires non-const rvalue for OnceCallback binding." - " I.e.: base::BindOnce(std::move(callback))."); - static_assert( - std::conjunction>...>::value, - "Use std::move() instead of base::Passed() with base::BindOnce()"); - - return cef_internal::BindImpl(std::forward(functor), - std::forward(args)...); -} - -/// -/// Bind as RepeatingCallback. -/// -template -inline RepeatingCallback> -BindRepeating(Functor&& functor, Args&&... args) { - static_assert( - !cef_internal::IsOnceCallback>(), - "BindRepeating cannot bind OnceCallback. Use BindOnce with std::move()."); - - return cef_internal::BindImpl( - std::forward(functor), std::forward(args)...); -} - -/// -/// Special cases for binding to a base::Callback without extra bound arguments. -/// We CHECK() the validity of callback to guard against null pointers -/// accidentally ending up in posted tasks, causing hard-to-debug crashes. -/// -template -OnceCallback BindOnce(OnceCallback callback) { - CHECK(callback); - return callback; -} - -template -OnceCallback BindOnce(RepeatingCallback callback) { - CHECK(callback); - return callback; -} - -template -RepeatingCallback BindRepeating( - RepeatingCallback callback) { - CHECK(callback); - return callback; -} - -/// -/// Unretained() allows binding a non-refcounted class, and to disable -/// refcounting on arguments that are refcounted objects. -/// -/// EXAMPLE OF Unretained(): -/// -///
-///   class Foo {
-///    public:
-///     void func() { cout << "Foo:f" << endl; }
-///   };
-///
-///   // In some function somewhere.
-///   Foo foo;
-///   OnceClosure foo_callback =
-///       BindOnce(&Foo::func, Unretained(&foo));
-///   std::move(foo_callback).Run();  // Prints "Foo:f".
-/// 
-/// -/// Without the Unretained() wrapper on |&foo|, the above call would fail -/// to compile because Foo does not support the AddRef() and Release() methods. -/// -template -inline cef_internal::UnretainedWrapper Unretained(T* o) { - return cef_internal::UnretainedWrapper(o); -} - -/// -/// RetainedRef() accepts a ref counted object and retains a reference to it. -/// When the callback is called, the object is passed as a raw pointer. -/// -/// EXAMPLE OF RetainedRef(): -/// -///
-///    void foo(RefCountedBytes* bytes) {}
-///
-///    scoped_refptr bytes = ...;
-///    OnceClosure callback = BindOnce(&foo, base::RetainedRef(bytes));
-///    std::move(callback).Run();
-/// 
-/// -/// Without RetainedRef, the scoped_refptr would try to implicitly convert to -/// a raw pointer and fail compilation: -/// -///
-///    OnceClosure callback = BindOnce(&foo, bytes); // ERROR!
-/// 
-/// -template -inline cef_internal::RetainedRefWrapper RetainedRef(T* o) { - return cef_internal::RetainedRefWrapper(o); -} -template -inline cef_internal::RetainedRefWrapper RetainedRef(scoped_refptr o) { - return cef_internal::RetainedRefWrapper(std::move(o)); -} - -/// -/// Owned() transfers ownership of an object to the callback resulting from -/// bind; the object will be deleted when the callback is deleted. -/// -/// EXAMPLE OF Owned(): -/// -///
-///   void foo(int* arg) { cout << *arg << endl }
-///
-///   int* pn = new int(1);
-///   RepeatingClosure foo_callback = BindRepeating(&foo, Owned(pn));
-///
-///   foo_callback.Run();  // Prints "1"
-///   foo_callback.Run();  // Prints "1"
-///   *pn = 2;
-///   foo_callback.Run();  // Prints "2"
-///
-///   foo_callback.Reset();  // |pn| is deleted.  Also will happen when
-///                          // |foo_callback| goes out of scope.
-/// 
-/// -/// Without Owned(), someone would have to know to delete |pn| when the last -/// reference to the callback is deleted. -/// -template -inline cef_internal::OwnedWrapper Owned(T* o) { - return cef_internal::OwnedWrapper(o); -} - -template -inline cef_internal::OwnedWrapper Owned( - std::unique_ptr&& ptr) { - return cef_internal::OwnedWrapper(std::move(ptr)); -} - -/// -/// OwnedRef() stores an object in the callback resulting from -/// bind and passes a reference to the object to the bound function. -/// -/// EXAMPLE OF OwnedRef(): -/// -///
-///   void foo(int& arg) { cout << ++arg << endl }
-///
-///   int counter = 0;
-///   RepeatingClosure foo_callback = BindRepeating(&foo, OwnedRef(counter));
-///
-///   foo_callback.Run();  // Prints "1"
-///   foo_callback.Run();  // Prints "2"
-///   foo_callback.Run();  // Prints "3"
-///
-///   cout << counter;     // Prints "0", OwnedRef creates a copy of counter.
-/// 
-/// -/// Supports OnceCallbacks as well, useful to pass placeholder arguments: -/// -///
-///   void bar(int& ignore, const std::string& s) { cout << s << endl }
-///
-///   OnceClosure bar_callback = BindOnce(&bar, OwnedRef(0), "Hello");
-///
-///   std::move(bar_callback).Run(); // Prints "Hello"
-/// 
-/// -/// Without OwnedRef() it would not be possible to pass a mutable reference to -/// an object owned by the callback. -/// -template -cef_internal::OwnedRefWrapper> OwnedRef(T&& t) { - return cef_internal::OwnedRefWrapper>(std::forward(t)); -} - -/// -/// Passed() is for transferring movable-but-not-copyable types (eg. unique_ptr) -/// through a RepeatingCallback. Logically, this signifies a destructive -/// transfer of the state of the argument into the target function. Invoking -/// RepeatingCallback::Run() twice on a callback that was created with a -/// Passed() argument will CHECK() because the first invocation would have -/// already transferred ownership to the target function. -/// -/// Note that Passed() is not necessary with BindOnce(), as std::move() does the -/// same thing. Avoid Passed() in favor of std::move() with BindOnce(). -/// -/// EXAMPLE OF Passed(): -/// -///
-///   void TakesOwnership(std::unique_ptr arg) { }
-///   std::unique_ptr CreateFoo() { return std::make_unique();
-///   }
-///
-///   auto f = std::make_unique();
-///
-///   // |cb| is given ownership of Foo(). |f| is now NULL.
-///   // You can use std::move(f) in place of &f, but it's more verbose.
-///   RepeatingClosure cb = BindRepeating(&TakesOwnership, Passed(&f));
-///
-///   // Run was never called so |cb| still owns Foo() and deletes
-///   // it on Reset().
-///   cb.Reset();
-///
-///   // |cb| is given a new Foo created by CreateFoo().
-///   cb = BindRepeating(&TakesOwnership, Passed(CreateFoo()));
-///
-///   // |arg| in TakesOwnership() is given ownership of Foo(). |cb|
-///   // no longer owns Foo() and, if reset, would not delete Foo().
-///   cb.Run();  // Foo() is now transferred to |arg| and deleted.
-///   cb.Run();  // This CHECK()s since Foo() already been used once.
-/// 
-/// -/// We offer 2 syntaxes for calling Passed(). The first takes an rvalue and is -/// best suited for use with the return value of a function or other temporary -/// rvalues. The second takes a pointer to the scoper and is just syntactic -/// sugar to avoid having to write Passed(std::move(scoper)). -/// -/// Both versions of Passed() prevent T from being an lvalue reference. The -/// first via use of enable_if, and the second takes a T* which will not bind to -/// T&. -/// -template ::value>* = nullptr> -inline cef_internal::PassedWrapper Passed(T&& scoper) { - return cef_internal::PassedWrapper(std::move(scoper)); -} -template -inline cef_internal::PassedWrapper Passed(T* scoper) { - return cef_internal::PassedWrapper(std::move(*scoper)); -} - -/// -/// IgnoreResult() is used to adapt a function or callback with a return type to -/// one with a void return. This is most useful if you have a function with, -/// say, a pesky ignorable bool return that you want to use with PostTask or -/// something else that expect a callback with a void return. -/// -/// EXAMPLE OF IgnoreResult(): -/// -///
-///   int DoSomething(int arg) { cout << arg << endl; }
-///
-///   // Assign to a callback with a void return type.
-///   OnceCallback cb = BindOnce(IgnoreResult(&DoSomething));
-///   std::move(cb).Run(1);  // Prints "1".
-///
-///   // Prints "2" on |ml|.
-///   ml->PostTask(FROM_HERE, BindOnce(IgnoreResult(&DoSomething), 2);
-/// 
-/// -template -inline cef_internal::IgnoreResultHelper IgnoreResult(T data) { - return cef_internal::IgnoreResultHelper(std::move(data)); -} - -#if defined(OS_APPLE) && !HAS_FEATURE(objc_arc) - -/// -/// RetainBlock() is used to adapt an Objective-C block when Automated Reference -/// Counting (ARC) is disabled. This is unnecessary when ARC is enabled, as the -/// BindOnce and BindRepeating already support blocks then. -/// -/// EXAMPLE OF RetainBlock(): -/// -///
-///   // Wrap the block and bind it to a callback.
-///   OnceCallback cb =
-///       BindOnce(RetainBlock(^(int n) { NSLog(@"%d", n); }));
-///   std::move(cb).Run(1);  // Logs "1".
-/// 
-/// -template -base::mac::ScopedBlock RetainBlock(R (^block)(Args...)) { - return base::mac::ScopedBlock(block, - base::scoped_policy::RETAIN); -} - -#endif // defined(OS_APPLE) && !HAS_FEATURE(objc_arc) - -} // namespace base - -#endif // !USING_CHROMIUM_INCLUDES - -#endif // CEF_INCLUDE_BASE_CEF_BIND_H_ diff --git a/vendors/cef/include/base/cef_build.h b/vendors/cef/include/base/cef_build.h deleted file mode 100644 index d32c6170f..000000000 --- a/vendors/cef/include/base/cef_build.h +++ /dev/null @@ -1,263 +0,0 @@ -// Copyright (c) 2011 Marshall A. Greenblatt. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the name Chromium Embedded -// Framework nor the names of its contributors may be used to endorse -// or promote products derived from this software without specific prior -// written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -/// \file -/// This file adds defines about the platform we're currently building on. -/// -///
-///  Operating System:
-///    OS_AIX / OS_ANDROID / OS_ASMJS / OS_FREEBSD / OS_FUCHSIA / OS_IOS /
-///    OS_LINUX / OS_MAC / OS_NACL (SFI or NONSFI) / OS_NETBSD / OS_OPENBSD /
-///    OS_QNX / OS_SOLARIS / OS_WIN
-///  Operating System family:
-///    OS_APPLE: IOS or MAC
-///    OS_BSD: FREEBSD or NETBSD or OPENBSD
-///    OS_POSIX: AIX or ANDROID or ASMJS or CHROMEOS or FREEBSD or IOS or LINUX
-///              or MAC or NACL or NETBSD or OPENBSD or QNX or SOLARIS
-///
-///  /!\ Note: OS_CHROMEOS is set by the build system, not this file
-///
-///  Compiler:
-///    COMPILER_MSVC / COMPILER_GCC
-///
-///  Processor:
-///    ARCH_CPU_ARM64 / ARCH_CPU_ARMEL / ARCH_CPU_MIPS / ARCH_CPU_MIPS64 /
-///    ARCH_CPU_MIPS64EL / ARCH_CPU_MIPSEL / ARCH_CPU_PPC64 / ARCH_CPU_S390 /
-///    ARCH_CPU_S390X / ARCH_CPU_X86 / ARCH_CPU_X86_64
-///  Processor family:
-///    ARCH_CPU_ARM_FAMILY: ARMEL or ARM64
-///    ARCH_CPU_MIPS_FAMILY: MIPS64EL or MIPSEL or MIPS64 or MIPS
-///    ARCH_CPU_PPC64_FAMILY: PPC64
-///    ARCH_CPU_S390_FAMILY: S390 or S390X
-///    ARCH_CPU_X86_FAMILY: X86 or X86_64
-///  Processor features:
-///    ARCH_CPU_31_BITS / ARCH_CPU_32_BITS / ARCH_CPU_64_BITS
-///    ARCH_CPU_BIG_ENDIAN / ARCH_CPU_LITTLE_ENDIAN
-/// 
-/// - -#ifndef CEF_INCLUDE_BASE_CEF_BUILD_H_ -#define CEF_INCLUDE_BASE_CEF_BUILD_H_ -#pragma once - -#if defined(USING_CHROMIUM_INCLUDES) -// When building CEF include the Chromium header directly. -#include "build/build_config.h" -#else // !USING_CHROMIUM_INCLUDES -// The following is substantially similar to the Chromium implementation. -// If the Chromium implementation diverges the below implementation should be -// updated to match. - -// A set of macros to use for platform detection. -#if defined(ANDROID) -#define OS_ANDROID 1 -#elif defined(__APPLE__) -// Only include TargetConditionals after testing ANDROID as some Android builds -// on the Mac have this header available and it's not needed unless the target -// is really an Apple platform. -#include -#if defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE -#define OS_IOS 1 -#else -#define OS_MAC 1 -// For backwards compatibility. -#define OS_MACOSX 1 -#endif // defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE -#elif defined(__linux__) -#if !defined(OS_CHROMEOS) -// Do not define OS_LINUX on Chrome OS build. -// The OS_CHROMEOS macro is defined in GN. -#define OS_LINUX 1 -#endif // !defined(OS_CHROMEOS) -// Include a system header to pull in features.h for glibc/uclibc macros. -#include -#if defined(__GLIBC__) && !defined(__UCLIBC__) -// We really are using glibc, not uClibc pretending to be glibc. -#define LIBC_GLIBC 1 -#endif -#elif defined(_WIN32) -#define OS_WIN 1 -#elif defined(__Fuchsia__) -#define OS_FUCHSIA 1 -#elif defined(__FreeBSD__) -#define OS_FREEBSD 1 -#elif defined(__NetBSD__) -#define OS_NETBSD 1 -#elif defined(__OpenBSD__) -#define OS_OPENBSD 1 -#elif defined(__sun) -#define OS_SOLARIS 1 -#elif defined(__QNXNTO__) -#define OS_QNX 1 -#elif defined(_AIX) -#define OS_AIX 1 -#elif defined(__asmjs__) || defined(__wasm__) -#define OS_ASMJS 1 -#else -#error Please add support for your platform in include/base/cef_build.h -#endif -// NOTE: Adding a new port? Please follow -// https://chromium.googlesource.com/chromium/src/+/master/docs/new_port_policy.md - -#if defined(OS_MAC) || defined(OS_IOS) -#define OS_APPLE 1 -#endif - -// For access to standard BSD features, use OS_BSD instead of a -// more specific macro. -#if defined(OS_FREEBSD) || defined(OS_NETBSD) || defined(OS_OPENBSD) -#define OS_BSD 1 -#endif - -// For access to standard POSIXish features, use OS_POSIX instead of a -// more specific macro. -#if defined(OS_AIX) || defined(OS_ANDROID) || defined(OS_ASMJS) || \ - defined(OS_FREEBSD) || defined(OS_IOS) || defined(OS_LINUX) || \ - defined(OS_CHROMEOS) || defined(OS_MAC) || defined(OS_NACL) || \ - defined(OS_NETBSD) || defined(OS_OPENBSD) || defined(OS_QNX) || \ - defined(OS_SOLARIS) -#define OS_POSIX 1 -#endif - -// Compiler detection. Note: clang masquerades as GCC on POSIX and as MSVC on -// Windows. -#if defined(__GNUC__) -#define COMPILER_GCC 1 -#elif defined(_MSC_VER) -#define COMPILER_MSVC 1 -#else -#error Please add support for your compiler in build/build_config.h -#endif - -// Processor architecture detection. For more info on what's defined, see: -// http://msdn.microsoft.com/en-us/library/b0084kay.aspx -// http://www.agner.org/optimize/calling_conventions.pdf -// or with gcc, run: "echo | gcc -E -dM -" -#if defined(_M_X64) || defined(__x86_64__) -#define ARCH_CPU_X86_FAMILY 1 -#define ARCH_CPU_X86_64 1 -#define ARCH_CPU_64_BITS 1 -#define ARCH_CPU_LITTLE_ENDIAN 1 -#elif defined(_M_IX86) || defined(__i386__) -#define ARCH_CPU_X86_FAMILY 1 -#define ARCH_CPU_X86 1 -#define ARCH_CPU_32_BITS 1 -#define ARCH_CPU_LITTLE_ENDIAN 1 -#elif defined(__s390x__) -#define ARCH_CPU_S390_FAMILY 1 -#define ARCH_CPU_S390X 1 -#define ARCH_CPU_64_BITS 1 -#define ARCH_CPU_BIG_ENDIAN 1 -#elif defined(__s390__) -#define ARCH_CPU_S390_FAMILY 1 -#define ARCH_CPU_S390 1 -#define ARCH_CPU_31_BITS 1 -#define ARCH_CPU_BIG_ENDIAN 1 -#elif (defined(__PPC64__) || defined(__PPC__)) && defined(__BIG_ENDIAN__) -#define ARCH_CPU_PPC64_FAMILY 1 -#define ARCH_CPU_PPC64 1 -#define ARCH_CPU_64_BITS 1 -#define ARCH_CPU_BIG_ENDIAN 1 -#elif defined(__PPC64__) -#define ARCH_CPU_PPC64_FAMILY 1 -#define ARCH_CPU_PPC64 1 -#define ARCH_CPU_64_BITS 1 -#define ARCH_CPU_LITTLE_ENDIAN 1 -#elif defined(__ARMEL__) -#define ARCH_CPU_ARM_FAMILY 1 -#define ARCH_CPU_ARMEL 1 -#define ARCH_CPU_32_BITS 1 -#define ARCH_CPU_LITTLE_ENDIAN 1 -#elif defined(__aarch64__) || defined(_M_ARM64) -#define ARCH_CPU_ARM_FAMILY 1 -#define ARCH_CPU_ARM64 1 -#define ARCH_CPU_64_BITS 1 -#define ARCH_CPU_LITTLE_ENDIAN 1 -#elif defined(__pnacl__) || defined(__asmjs__) || defined(__wasm__) -#define ARCH_CPU_32_BITS 1 -#define ARCH_CPU_LITTLE_ENDIAN 1 -#elif defined(__MIPSEL__) -#if defined(__LP64__) -#define ARCH_CPU_MIPS_FAMILY 1 -#define ARCH_CPU_MIPS64EL 1 -#define ARCH_CPU_64_BITS 1 -#define ARCH_CPU_LITTLE_ENDIAN 1 -#else -#define ARCH_CPU_MIPS_FAMILY 1 -#define ARCH_CPU_MIPSEL 1 -#define ARCH_CPU_32_BITS 1 -#define ARCH_CPU_LITTLE_ENDIAN 1 -#endif -#elif defined(__MIPSEB__) -#if defined(__LP64__) -#define ARCH_CPU_MIPS_FAMILY 1 -#define ARCH_CPU_MIPS64 1 -#define ARCH_CPU_64_BITS 1 -#define ARCH_CPU_BIG_ENDIAN 1 -#else -#define ARCH_CPU_MIPS_FAMILY 1 -#define ARCH_CPU_MIPS 1 -#define ARCH_CPU_32_BITS 1 -#define ARCH_CPU_BIG_ENDIAN 1 -#endif -#else -#error Please add support for your architecture in include/base/cef_build.h -#endif - -// Type detection for wchar_t. -#if defined(OS_WIN) -#define WCHAR_T_IS_UTF16 -#elif defined(OS_FUCHSIA) -#define WCHAR_T_IS_UTF32 -#elif defined(OS_POSIX) && defined(COMPILER_GCC) && defined(__WCHAR_MAX__) && \ - (__WCHAR_MAX__ == 0x7fffffff || __WCHAR_MAX__ == 0xffffffff) -#define WCHAR_T_IS_UTF32 -#elif defined(OS_POSIX) && defined(COMPILER_GCC) && defined(__WCHAR_MAX__) && \ - (__WCHAR_MAX__ == 0x7fff || __WCHAR_MAX__ == 0xffff) -// On Posix, we'll detect short wchar_t, but projects aren't guaranteed to -// compile in this mode (in particular, Chrome doesn't). This is intended for -// other projects using base who manage their own dependencies and make sure -// short wchar works for them. -#define WCHAR_T_IS_UTF16 -#else -#error Please add support for your compiler in include/base/cef_build.h -#endif - -#if defined(OS_ANDROID) -// The compiler thinks std::string::const_iterator and "const char*" are -// equivalent types. -#define STD_STRING_ITERATOR_IS_CHAR_POINTER -// The compiler thinks std::u16string::const_iterator and "char16_t*" are -// equivalent types. -#define BASE_STRING16_ITERATOR_IS_CHAR16_POINTER -#endif - -#endif // !USING_CHROMIUM_INCLUDES - -#endif // CEF_INCLUDE_BASE_CEF_BUILD_H_ diff --git a/vendors/cef/include/base/cef_callback.h b/vendors/cef/include/base/cef_callback.h deleted file mode 100644 index bcfe4992a..000000000 --- a/vendors/cef/include/base/cef_callback.h +++ /dev/null @@ -1,250 +0,0 @@ -// Copyright (c) 2014 Marshall A. Greenblatt. Portions copyright (c) 2012 -// Google Inc. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the name Chromium Embedded -// Framework nor the names of its contributors may be used to endorse -// or promote products derived from this software without specific prior -// written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -/// \file -/// A callback is similar in concept to a function pointer: it wraps a runnable -/// object such as a function, method, lambda, or even another callback, -/// allowing the runnable object to be invoked later via the callback object. -/// -/// Unlike function pointers, callbacks are created with base::BindOnce() or -/// base::BindRepeating() and support partial function application. -/// -/// A base::OnceCallback may be Run() at most once; a base::RepeatingCallback -/// may be Run() any number of times. |is_null()| is guaranteed to return true -/// for a moved-from callback. -/// -///
-///   // The lambda takes two arguments, but the first argument |x| is bound at
-///   // callback creation.
-///   base::OnceCallback cb = base::BindOnce([] (int x, int y) {
-///     return x + y;
-///   }, 1);
-///   // Run() only needs the remaining unbound argument |y|.
-///   printf("1 + 2 = %d\n", std::move(cb).Run(2));  // Prints 3
-///   printf("cb is null? %s\n",
-///          cb.is_null() ? "true" : "false");  // Prints true
-///   std::move(cb).Run(2);  // Crashes since |cb| has already run.
-/// 
-/// -/// Callbacks also support cancellation. A common use is binding the receiver -/// object as a WeakPtr. If that weak pointer is invalidated, calling Run() -/// will be a no-op. Note that |IsCancelled()| and |is_null()| are distinct: -/// simply cancelling a callback will not also make it null. -/// -/// See https://chromium.googlesource.com/chromium/src/+/lkgr/docs/callback.md -/// for the full documentation. - -#ifndef CEF_INCLUDE_BASE_CEF_CALLBACK_H_ -#define CEF_INCLUDE_BASE_CEF_CALLBACK_H_ -#pragma once - -#if defined(USING_CHROMIUM_INCLUDES) -// When building CEF include the Chromium header directly. -#include "base/functional/callback.h" -#else // !USING_CHROMIUM_INCLUDES -// The following is substantially similar to the Chromium implementation. -// If the Chromium implementation diverges the below implementation should be -// updated to match. - -#include - -#include "include/base/cef_bind.h" -#include "include/base/cef_callback_forward.h" -#include "include/base/cef_logging.h" -#include "include/base/internal/cef_callback_internal.h" - -namespace base { - -template -class OnceCallback : public cef_internal::CallbackBase { - public: - using ResultType = R; - using RunType = R(Args...); - using PolymorphicInvoke = R (*)(cef_internal::BindStateBase*, - cef_internal::PassingType...); - - constexpr OnceCallback() = default; - OnceCallback(std::nullptr_t) = delete; - - explicit OnceCallback(cef_internal::BindStateBase* bind_state) - : cef_internal::CallbackBase(bind_state) {} - - OnceCallback(const OnceCallback&) = delete; - OnceCallback& operator=(const OnceCallback&) = delete; - - OnceCallback(OnceCallback&&) noexcept = default; - OnceCallback& operator=(OnceCallback&&) noexcept = default; - - OnceCallback(RepeatingCallback other) - : cef_internal::CallbackBase(std::move(other)) {} - - OnceCallback& operator=(RepeatingCallback other) { - static_cast(*this) = std::move(other); - return *this; - } - - R Run(Args... args) const& { - static_assert(!sizeof(*this), - "OnceCallback::Run() may only be invoked on a non-const " - "rvalue, i.e. std::move(callback).Run()."); - NOTREACHED(); - } - - R Run(Args... args) && { - // Move the callback instance into a local variable before the invocation, - // that ensures the internal state is cleared after the invocation. - // It's not safe to touch |this| after the invocation, since running the - // bound function may destroy |this|. - OnceCallback cb = std::move(*this); - PolymorphicInvoke f = - reinterpret_cast(cb.polymorphic_invoke()); - return f(cb.bind_state_.get(), std::forward(args)...); - } - - // Then() returns a new OnceCallback that receives the same arguments as - // |this|, and with the return type of |then|. The returned callback will: - // 1) Run the functor currently bound to |this| callback. - // 2) Run the |then| callback with the result from step 1 as its single - // argument. - // 3) Return the value from running the |then| callback. - // - // Since this method generates a callback that is a replacement for `this`, - // `this` will be consumed and reset to a null callback to ensure the - // originally-bound functor can be run at most once. - template - OnceCallback Then(OnceCallback then) && { - CHECK(then); - return BindOnce( - cef_internal::ThenHelper< - OnceCallback, OnceCallback>::CreateTrampoline(), - std::move(*this), std::move(then)); - } - - // This overload is required; even though RepeatingCallback is implicitly - // convertible to OnceCallback, that conversion will not used when matching - // for template argument deduction. - template - OnceCallback Then( - RepeatingCallback then) && { - CHECK(then); - return BindOnce( - cef_internal::ThenHelper< - OnceCallback, - RepeatingCallback>::CreateTrampoline(), - std::move(*this), std::move(then)); - } -}; - -template -class RepeatingCallback - : public cef_internal::CallbackBaseCopyable { - public: - using ResultType = R; - using RunType = R(Args...); - using PolymorphicInvoke = R (*)(cef_internal::BindStateBase*, - cef_internal::PassingType...); - - constexpr RepeatingCallback() = default; - RepeatingCallback(std::nullptr_t) = delete; - - explicit RepeatingCallback(cef_internal::BindStateBase* bind_state) - : cef_internal::CallbackBaseCopyable(bind_state) {} - - // Copyable and movable. - RepeatingCallback(const RepeatingCallback&) = default; - RepeatingCallback& operator=(const RepeatingCallback&) = default; - RepeatingCallback(RepeatingCallback&&) noexcept = default; - RepeatingCallback& operator=(RepeatingCallback&&) noexcept = default; - - bool operator==(const RepeatingCallback& other) const { - return EqualsInternal(other); - } - - bool operator!=(const RepeatingCallback& other) const { - return !operator==(other); - } - - R Run(Args... args) const& { - PolymorphicInvoke f = - reinterpret_cast(this->polymorphic_invoke()); - return f(this->bind_state_.get(), std::forward(args)...); - } - - R Run(Args... args) && { - // Move the callback instance into a local variable before the invocation, - // that ensures the internal state is cleared after the invocation. - // It's not safe to touch |this| after the invocation, since running the - // bound function may destroy |this|. - RepeatingCallback cb = std::move(*this); - PolymorphicInvoke f = - reinterpret_cast(cb.polymorphic_invoke()); - return f(std::move(cb).bind_state_.get(), std::forward(args)...); - } - - // Then() returns a new RepeatingCallback that receives the same arguments as - // |this|, and with the return type of |then|. The - // returned callback will: - // 1) Run the functor currently bound to |this| callback. - // 2) Run the |then| callback with the result from step 1 as its single - // argument. - // 3) Return the value from running the |then| callback. - // - // If called on an rvalue (e.g. std::move(cb).Then(...)), this method - // generates a callback that is a replacement for `this`. Therefore, `this` - // will be consumed and reset to a null callback to ensure the - // originally-bound functor will be run at most once. - template - RepeatingCallback Then( - RepeatingCallback then) const& { - CHECK(then); - return BindRepeating( - cef_internal::ThenHelper< - RepeatingCallback, - RepeatingCallback>::CreateTrampoline(), - *this, std::move(then)); - } - - template - RepeatingCallback Then( - RepeatingCallback then) && { - CHECK(then); - return BindRepeating( - cef_internal::ThenHelper< - RepeatingCallback, - RepeatingCallback>::CreateTrampoline(), - std::move(*this), std::move(then)); - } -}; - -} // namespace base - -#endif // !USING_CHROMIUM_INCLUDES - -#endif // CEF_INCLUDE_BASE_CEF_CALLBACK_H_ diff --git a/vendors/cef/include/base/cef_callback_forward.h b/vendors/cef/include/base/cef_callback_forward.h deleted file mode 100644 index 2d2277433..000000000 --- a/vendors/cef/include/base/cef_callback_forward.h +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright (c) 2014 Marshall A. Greenblatt. Portions copyright (c) 2011 -// Google Inc. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the name Chromium Embedded -// Framework nor the names of its contributors may be used to endorse -// or promote products derived from this software without specific prior -// written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -#ifndef INCLUDE_BASE_CEF_CALLBACK_FORWARD_H_ -#define INCLUDE_BASE_CEF_CALLBACK_FORWARD_H_ -#pragma once - -#if defined(USING_CHROMIUM_INCLUDES) -// When building CEF include the Chromium header directly. -#include "base/functional/callback_forward.h" -#else // !USING_CHROMIUM_INCLUDES -// The following is substantially similar to the Chromium implementation. -// If the Chromium implementation diverges the below implementation should be -// updated to match. - -namespace base { - -template -class OnceCallback; - -template -class RepeatingCallback; - -/// -/// Syntactic sugar to make OnceClosure and RepeatingClosure -/// easier to declare since they will be used in a lot of APIs with delayed -/// execution. -/// -using OnceClosure = OnceCallback; -using RepeatingClosure = RepeatingCallback; - -} // namespace base - -#endif // !!USING_CHROMIUM_INCLUDES - -#endif // INCLUDE_BASE_CEF_CALLBACK_FORWARD_H_ diff --git a/vendors/cef/include/base/cef_callback_helpers.h b/vendors/cef/include/base/cef_callback_helpers.h deleted file mode 100644 index 5e3864405..000000000 --- a/vendors/cef/include/base/cef_callback_helpers.h +++ /dev/null @@ -1,261 +0,0 @@ -// Copyright (c) 2014 Marshall A. Greenblatt. Portions copyright (c) 2012 -// Google Inc. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the name Chromium Embedded -// Framework nor the names of its contributors may be used to endorse -// or promote products derived from this software without specific prior -// written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// This defines helpful methods for dealing with Callbacks. Because Callbacks -// are implemented using templates, with a class per callback signature, adding -// methods to Callback<> itself is unattractive (lots of extra code gets -// generated). Instead, consider adding methods here. - -#ifndef CEF_INCLUDE_BASE_CEF_CALLBACK_HELPERS_H_ -#define CEF_INCLUDE_BASE_CEF_CALLBACK_HELPERS_H_ -#pragma once - -#if defined(USING_CHROMIUM_INCLUDES) -// When building CEF include the Chromium header directly. -#include "base/functional/callback_helpers.h" -#else // !USING_CHROMIUM_INCLUDES -// The following is substantially similar to the Chromium implementation. -// If the Chromium implementation diverges the below implementation should be -// updated to match. - -#include -#include -#include -#include - -#include "include/base/cef_bind.h" -#include "include/base/cef_callback.h" -#include "include/base/cef_logging.h" - -namespace base { - -namespace internal { - -template -struct IsBaseCallbackImpl : std::false_type {}; - -template -struct IsBaseCallbackImpl> : std::true_type {}; - -template -struct IsBaseCallbackImpl> : std::true_type {}; - -template -struct IsOnceCallbackImpl : std::false_type {}; - -template -struct IsOnceCallbackImpl> : std::true_type {}; - -} // namespace internal - -/// -/// IsBaseCallback::value is true when T is any of the Closure or Callback -/// family of types. -/// -template -using IsBaseCallback = internal::IsBaseCallbackImpl>; - -/// -/// IsOnceCallback::value is true when T is a OnceClosure or OnceCallback -/// type. -/// -template -using IsOnceCallback = internal::IsOnceCallbackImpl>; - -/// -/// SFINAE friendly enabler allowing to overload methods for both Repeating and -/// OnceCallbacks. -/// -/// Usage: -///
-///   template