From 1eb55cbba8cb0274e98046ac1d8df53f50fa9912 Mon Sep 17 00:00:00 2001 From: Marshall Greenblatt Date: Mon, 6 Dec 2021 16:59:14 -0500 Subject: [PATCH] Remove DISALLOW_ macro from libcef_dll/ (see issue #3234) Also perform related C++ cleanup: - Use =default instead of {} for default implementations of constructors/destructors. - Replace typedef with using. --- include/wrapper/cef_byte_read_handler.h | 5 ++- include/wrapper/cef_closure_task.h | 1 - include/wrapper/cef_helpers.h | 7 ++-- include/wrapper/cef_library_loader.h | 7 ++-- include/wrapper/cef_message_router.h | 2 +- include/wrapper/cef_resource_manager.h | 17 +++++---- include/wrapper/cef_scoped_temp_dir.h | 6 +-- include/wrapper/cef_stream_resource_handler.h | 5 ++- include/wrapper/cef_xml_object.h | 10 ++--- include/wrapper/cef_zip_archive.h | 8 ++-- libcef_dll/base/cef_logging.cc | 2 +- libcef_dll/cpptoc/cpptoc_ref_counted.h | 8 ++-- libcef_dll/cpptoc/cpptoc_scoped.h | 6 +-- libcef_dll/ctocpp/ctocpp_ref_counted.h | 10 ++--- libcef_dll/ctocpp/ctocpp_scoped.h | 10 ++--- libcef_dll/transfer_util.h | 6 +-- libcef_dll/wrapper/cef_browser_info_map.h | 16 ++++---- libcef_dll/wrapper/cef_closure_task.cc | 8 +++- libcef_dll/wrapper/cef_message_router.cc | 37 ++++++++++++------- libcef_dll/wrapper/cef_resource_manager.cc | 20 +++++----- libcef_dll/wrapper/cef_xml_object.cc | 6 +-- libcef_dll/wrapper/cef_zip_archive.cc | 5 ++- 22 files changed, 112 insertions(+), 90 deletions(-) diff --git a/include/wrapper/cef_byte_read_handler.h b/include/wrapper/cef_byte_read_handler.h index 9f9d610f8..1fc561474 100644 --- a/include/wrapper/cef_byte_read_handler.h +++ b/include/wrapper/cef_byte_read_handler.h @@ -38,7 +38,6 @@ #pragma once #include "include/base/cef_lock.h" -#include "include/base/cef_macros.h" #include "include/cef_base.h" #include "include/cef_stream.h" @@ -57,6 +56,9 @@ class CefByteReadHandler : public CefReadHandler { size_t size, CefRefPtr source); + CefByteReadHandler(const CefByteReadHandler&) = delete; + CefByteReadHandler& operator=(const CefByteReadHandler&) = delete; + // CefReadHandler methods. virtual size_t Read(void* ptr, size_t size, size_t n) override; virtual int Seek(int64 offset, int whence) override; @@ -73,7 +75,6 @@ class CefByteReadHandler : public CefReadHandler { base::Lock lock_; IMPLEMENT_REFCOUNTING(CefByteReadHandler); - DISALLOW_COPY_AND_ASSIGN(CefByteReadHandler); }; #endif // CEF_INCLUDE_WRAPPER_CEF_BYTE_READ_HANDLER_H_ diff --git a/include/wrapper/cef_closure_task.h b/include/wrapper/cef_closure_task.h index ef933a354..d773778e8 100644 --- a/include/wrapper/cef_closure_task.h +++ b/include/wrapper/cef_closure_task.h @@ -38,7 +38,6 @@ #pragma once #include "include/base/cef_callback_forward.h" -#include "include/base/cef_macros.h" #include "include/cef_task.h" /// diff --git a/include/wrapper/cef_helpers.h b/include/wrapper/cef_helpers.h index 0f41ac489..84ce4b477 100644 --- a/include/wrapper/cef_helpers.h +++ b/include/wrapper/cef_helpers.h @@ -43,7 +43,6 @@ #include "include/base/cef_bind.h" #include "include/base/cef_logging.h" -#include "include/base/cef_macros.h" #include "include/cef_task.h" #define CEF_REQUIRE_UI_THREAD() DCHECK(CefCurrentlyOn(TID_UI)); @@ -140,6 +139,10 @@ class CefScopedArgArray { } array_[argc] = NULL; } + + CefScopedArgArray(const CefScopedArgArray&) = delete; + CefScopedArgArray& operator=(const CefScopedArgArray&) = delete; + ~CefScopedArgArray() { delete[] array_; } char** array() const { return array_; } @@ -150,8 +153,6 @@ class CefScopedArgArray { // Keep values in a vector separate from |array_| because various users may // modify |array_| and we still want to clean up memory properly. std::vector values_; - - DISALLOW_COPY_AND_ASSIGN(CefScopedArgArray); }; #endif // CEF_INCLUDE_WRAPPER_CEF_HELPERS_H_ diff --git a/include/wrapper/cef_library_loader.h b/include/wrapper/cef_library_loader.h index 8477f45fb..23e6c35e4 100644 --- a/include/wrapper/cef_library_loader.h +++ b/include/wrapper/cef_library_loader.h @@ -36,8 +36,6 @@ #ifdef __cplusplus #include -#include "include/base/cef_macros.h" - extern "C" { #endif // __cplusplus @@ -99,6 +97,10 @@ int cef_unload_library(); class CefScopedLibraryLoader { public: CefScopedLibraryLoader(); + + CefScopedLibraryLoader(const CefScopedLibraryLoader&) = delete; + CefScopedLibraryLoader& operator=(const CefScopedLibraryLoader&) = delete; + ~CefScopedLibraryLoader(); /// @@ -119,7 +121,6 @@ class CefScopedLibraryLoader { bool Load(bool helper); bool loaded_; - DISALLOW_COPY_AND_ASSIGN(CefScopedLibraryLoader); }; #endif // defined(OS_MAC) diff --git a/include/wrapper/cef_message_router.h b/include/wrapper/cef_message_router.h index 2d0cb0487..03839bbf0 100644 --- a/include/wrapper/cef_message_router.h +++ b/include/wrapper/cef_message_router.h @@ -245,7 +245,7 @@ class CefMessageRouterBrowserSide /// class Handler { public: - typedef CefMessageRouterBrowserSide::Callback Callback; + using Callback = CefMessageRouterBrowserSide::Callback; /// // Executed when a new query is received. |query_id| uniquely identifies the diff --git a/include/wrapper/cef_resource_manager.h b/include/wrapper/cef_resource_manager.h index 716f48c46..09da79ce9 100644 --- a/include/wrapper/cef_resource_manager.h +++ b/include/wrapper/cef_resource_manager.h @@ -41,7 +41,6 @@ #include #include "include/base/cef_callback.h" -#include "include/base/cef_macros.h" #include "include/base/cef_ref_counted.h" #include "include/base/cef_weak_ptr.h" #include "include/cef_request_handler.h" @@ -101,6 +100,9 @@ class CefResourceManager /// class Request : public base::RefCountedThreadSafe { public: + Request(const Request&) = delete; + Request& operator=(const Request&) = delete; + /// // Returns the URL associated with this request. The returned value will be // fully qualified but will not contain query or fragment components. It @@ -176,11 +178,9 @@ class CefResourceManager // Params that stay with this request object. Safe to access on any thread. RequestParams params_; - - DISALLOW_COPY_AND_ASSIGN(Request); }; - typedef std::list> RequestList; + using RequestList = std::list>; /// // Interface implemented by resource providers. A provider may be created on @@ -210,6 +210,9 @@ class CefResourceManager CefResourceManager(); + CefResourceManager(const CefResourceManager&) = delete; + CefResourceManager& operator=(const CefResourceManager&) = delete; + /// // Add a provider that maps requests for |url| to |content|. |url| should be // fully qualified but not include a query or fragment component. If @@ -316,7 +319,7 @@ class CefResourceManager // Provider and associated information. struct ProviderEntry; - typedef std::list ProviderEntryList; + using ProviderEntryList = std::list; // Values associated with the pending request only. Ownership will be passed // between requests and the resource manager as request handling proceeds. @@ -357,7 +360,7 @@ class CefResourceManager ProviderEntryList providers_; // Map of response ID to pending CefResourceHandler object. - typedef std::map> PendingHandlersMap; + using PendingHandlersMap = std::map>; PendingHandlersMap pending_handlers_; UrlFilter url_filter_; @@ -365,8 +368,6 @@ class CefResourceManager // Must be the last member. Created and accessed on the IO thread. std::unique_ptr> weak_ptr_factory_; - - DISALLOW_COPY_AND_ASSIGN(CefResourceManager); }; #endif // CEF_INCLUDE_WRAPPER_CEF_RESOURCE_MANAGER_H_ diff --git a/include/wrapper/cef_scoped_temp_dir.h b/include/wrapper/cef_scoped_temp_dir.h index f40fa7d67..533016cf0 100644 --- a/include/wrapper/cef_scoped_temp_dir.h +++ b/include/wrapper/cef_scoped_temp_dir.h @@ -39,7 +39,6 @@ #pragma once #include "include/base/cef_build.h" -#include "include/base/cef_macros.h" #include "include/cef_base.h" /// @@ -60,6 +59,9 @@ class CefScopedTempDir { /// CefScopedTempDir(); + CefScopedTempDir(const CefScopedTempDir&) = delete; + CefScopedTempDir& operator=(const CefScopedTempDir&) = delete; + /// // Recursively delete path. /// @@ -111,8 +113,6 @@ class CefScopedTempDir { private: CefString path_; - - DISALLOW_COPY_AND_ASSIGN(CefScopedTempDir); }; #endif // CEF_INCLUDE_SCOPED_TEMP_DIR_H_ diff --git a/include/wrapper/cef_stream_resource_handler.h b/include/wrapper/cef_stream_resource_handler.h index fec8a9f80..2eb55d728 100644 --- a/include/wrapper/cef_stream_resource_handler.h +++ b/include/wrapper/cef_stream_resource_handler.h @@ -37,7 +37,6 @@ #define CEF_INCLUDE_WRAPPER_CEF_STREAM_RESOURCE_HANDLER_H_ #pragma once -#include "include/base/cef_macros.h" #include "include/cef_resource_handler.h" #include "include/cef_response.h" #include "include/cef_stream.h" @@ -61,6 +60,9 @@ class CefStreamResourceHandler : public CefResourceHandler { CefResponse::HeaderMap header_map, CefRefPtr stream); + CefStreamResourceHandler(const CefStreamResourceHandler&) = delete; + CefStreamResourceHandler& operator=(const CefStreamResourceHandler&) = delete; + // CefResourceHandler methods. bool Open(CefRefPtr request, bool& handle_request, @@ -82,7 +84,6 @@ class CefStreamResourceHandler : public CefResourceHandler { const CefRefPtr stream_; IMPLEMENT_REFCOUNTING(CefStreamResourceHandler); - DISALLOW_COPY_AND_ASSIGN(CefStreamResourceHandler); }; #endif // CEF_INCLUDE_WRAPPER_CEF_STREAM_RESOURCE_HANDLER_H_ diff --git a/include/wrapper/cef_xml_object.h b/include/wrapper/cef_xml_object.h index 9315adcba..782833a0d 100644 --- a/include/wrapper/cef_xml_object.h +++ b/include/wrapper/cef_xml_object.h @@ -41,7 +41,6 @@ #include #include "include/base/cef_lock.h" -#include "include/base/cef_macros.h" #include "include/base/cef_ref_counted.h" #include "include/cef_base.h" #include "include/cef_xml_reader.h" @@ -73,8 +72,8 @@ class CefStreamReader; /// class CefXmlObject : public base::RefCountedThreadSafe { public: - typedef std::vector> ObjectVector; - typedef std::map AttributeMap; + using ObjectVector = std::vector>; + using AttributeMap = std::map; /// // Create a new object with the specified name. An object name must always be @@ -82,6 +81,9 @@ class CefXmlObject : public base::RefCountedThreadSafe { /// explicit CefXmlObject(const CefString& name); + CefXmlObject(const CefXmlObject&) = delete; + CefXmlObject& operator=(const CefXmlObject&) = delete; + /// // Load the contents of the specified XML stream into this object. The // existing children and attributes, if any, will first be cleared. @@ -190,8 +192,6 @@ class CefXmlObject : public base::RefCountedThreadSafe { ObjectVector children_; base::Lock lock_; - - DISALLOW_COPY_AND_ASSIGN(CefXmlObject); }; #endif // CEF_INCLUDE_WRAPPER_CEF_XML_OBJECT_H_ diff --git a/include/wrapper/cef_zip_archive.h b/include/wrapper/cef_zip_archive.h index 9eb28125f..f8c3b1339 100644 --- a/include/wrapper/cef_zip_archive.h +++ b/include/wrapper/cef_zip_archive.h @@ -40,7 +40,6 @@ #include #include "include/base/cef_lock.h" -#include "include/base/cef_macros.h" #include "include/base/cef_ref_counted.h" #include "include/cef_base.h" @@ -80,13 +79,16 @@ class CefZipArchive : public base::RefCountedThreadSafe { virtual CefRefPtr GetStreamReader() const = 0; }; - typedef std::map> FileMap; + using FileMap = std::map>; /// // Create a new object. /// CefZipArchive(); + CefZipArchive(const CefZipArchive&) = delete; + CefZipArchive& operator=(const CefZipArchive&) = delete; + /// // Load the contents of the specified zip archive stream into this object. // If the zip archive requires a password then provide it via |password|. @@ -136,8 +138,6 @@ class CefZipArchive : public base::RefCountedThreadSafe { FileMap contents_; mutable base::Lock lock_; - - DISALLOW_COPY_AND_ASSIGN(CefZipArchive); }; #endif // CEF_INCLUDE_WRAPPER_CEF_ZIP_ARCHIVE_H_ diff --git a/libcef_dll/base/cef_logging.cc b/libcef_dll/base/cef_logging.cc index 715cf17e6..808ccd9f4 100644 --- a/libcef_dll/base/cef_logging.cc +++ b/libcef_dll/base/cef_logging.cc @@ -191,7 +191,7 @@ LogMessage::~LogMessage() { // This has already been defined in the header, but defining it again as DWORD // ensures that the type used in the header is equivalent to DWORD. If not, // the redefinition is a compile error. -typedef DWORD SystemErrorCode; +using SystemErrorCode = DWORD; #endif SystemErrorCode GetLastSystemErrorCode() { diff --git a/libcef_dll/cpptoc/cpptoc_ref_counted.h b/libcef_dll/cpptoc/cpptoc_ref_counted.h index dd90a797a..cbd9c648e 100644 --- a/libcef_dll/cpptoc/cpptoc_ref_counted.h +++ b/libcef_dll/cpptoc/cpptoc_ref_counted.h @@ -7,7 +7,6 @@ #pragma once #include "include/base/cef_logging.h" -#include "include/base/cef_macros.h" #include "include/capi/cef_base_capi.h" #include "include/cef_base.h" #include "libcef_dll/wrapper_types.h" @@ -18,6 +17,9 @@ template class CefCppToCRefCounted : public CefBaseRefCounted { public: + CefCppToCRefCounted(const CefCppToCRefCounted&) = delete; + CefCppToCRefCounted& operator=(const CefCppToCRefCounted&) = delete; + // Create a new wrapper instance and associated structure reference for // passing an object instance the other side. static StructName* Wrap(CefRefPtr c) { @@ -105,7 +107,7 @@ class CefCppToCRefCounted : public CefBaseRefCounted { base->has_at_least_one_ref = struct_has_at_least_one_ref; } - virtual ~CefCppToCRefCounted() {} + virtual ~CefCppToCRefCounted() = default; private: // Used to associate this wrapper object, the underlying object instance and @@ -196,8 +198,6 @@ class CefCppToCRefCounted : public CefBaseRefCounted { CefRefCount ref_count_; static CefWrapperType kWrapperType; - - DISALLOW_COPY_AND_ASSIGN(CefCppToCRefCounted); }; #endif // CEF_LIBCEF_DLL_CPPTOC_CPPTOC_REF_COUNTED_H_ diff --git a/libcef_dll/cpptoc/cpptoc_scoped.h b/libcef_dll/cpptoc/cpptoc_scoped.h index 7b0dc24be..50ce2a8cf 100644 --- a/libcef_dll/cpptoc/cpptoc_scoped.h +++ b/libcef_dll/cpptoc/cpptoc_scoped.h @@ -7,7 +7,6 @@ #pragma once #include "include/base/cef_logging.h" -#include "include/base/cef_macros.h" #include "include/capi/cef_base_capi.h" #include "include/cef_base.h" #include "libcef_dll/wrapper_types.h" @@ -18,6 +17,9 @@ template class CefCppToCScoped : public CefBaseScoped { public: + CefCppToCScoped(const CefCppToCScoped&) = delete; + CefCppToCScoped& operator=(const CefCppToCScoped&) = delete; + // Create a new wrapper instance and associated structure reference for // passing an object instance the other side. The wrapper object will be // deleted when |del| is called on the associated structure. The wrapped @@ -220,8 +222,6 @@ class CefCppToCScoped : public CefBaseScoped { bool owned_; static CefWrapperType kWrapperType; - - DISALLOW_COPY_AND_ASSIGN(CefCppToCScoped); }; #endif // CEF_LIBCEF_DLL_CPPTOC_CPPTOC_SCOPED_H_ diff --git a/libcef_dll/ctocpp/ctocpp_ref_counted.h b/libcef_dll/ctocpp/ctocpp_ref_counted.h index 61703bc76..0b0a4bc6a 100644 --- a/libcef_dll/ctocpp/ctocpp_ref_counted.h +++ b/libcef_dll/ctocpp/ctocpp_ref_counted.h @@ -7,7 +7,6 @@ #pragma once #include "include/base/cef_logging.h" -#include "include/base/cef_macros.h" #include "include/capi/cef_base_capi.h" #include "include/cef_base.h" #include "libcef_dll/wrapper_types.h" @@ -18,6 +17,9 @@ template class CefCToCppRefCounted : public BaseName { public: + CefCToCppRefCounted(const CefCToCppRefCounted&) = delete; + CefCToCppRefCounted& operator=(const CefCToCppRefCounted&) = delete; + // Create a new wrapper instance for a structure reference received from the // other side. static CefRefPtr Wrap(StructName* s); @@ -37,8 +39,8 @@ class CefCToCppRefCounted : public BaseName { bool HasAtLeastOneRef() const { return UnderlyingHasAtLeastOneRef(); } protected: - CefCToCppRefCounted() {} - virtual ~CefCToCppRefCounted() {} + CefCToCppRefCounted() = default; + virtual ~CefCToCppRefCounted() = default; // If returning the structure across the DLL boundary use Unwrap() instead. StructName* GetStruct() const { @@ -97,8 +99,6 @@ class CefCToCppRefCounted : public BaseName { CefRefCount ref_count_; static CefWrapperType kWrapperType; - - DISALLOW_COPY_AND_ASSIGN(CefCToCppRefCounted); }; template diff --git a/libcef_dll/ctocpp/ctocpp_scoped.h b/libcef_dll/ctocpp/ctocpp_scoped.h index ed3e17a49..da6c27eac 100644 --- a/libcef_dll/ctocpp/ctocpp_scoped.h +++ b/libcef_dll/ctocpp/ctocpp_scoped.h @@ -7,7 +7,6 @@ #pragma once #include "include/base/cef_logging.h" -#include "include/base/cef_macros.h" #include "include/capi/cef_base_capi.h" #include "include/cef_base.h" #include "libcef_dll/wrapper_types.h" @@ -18,6 +17,9 @@ template class CefCToCppScoped : public BaseName { public: + CefCToCppScoped(const CefCToCppScoped&) = delete; + CefCToCppScoped& operator=(const CefCToCppScoped&) = delete; + // Create a new wrapper instance for a structure reference received from the // other side. The caller owns the CToCpp wrapper instance but not necessarily // the underling object on the CppToC side (depends if s->del is non-NULL). @@ -67,8 +69,8 @@ class CefCToCppScoped : public BaseName { static void operator delete(void* ptr); protected: - CefCToCppScoped() {} - virtual ~CefCToCppScoped() {} + CefCToCppScoped() = default; + virtual ~CefCToCppScoped() = default; // If returning the structure across the DLL boundary use Unwrap() instead. StructName* GetStruct() const { @@ -92,8 +94,6 @@ class CefCToCppScoped : public BaseName { CefRawPtr c); static CefWrapperType kWrapperType; - - DISALLOW_COPY_AND_ASSIGN(CefCToCppScoped); }; template diff --git a/libcef_dll/transfer_util.h b/libcef_dll/transfer_util.h index f2c3e8159..6da9ae153 100644 --- a/libcef_dll/transfer_util.h +++ b/libcef_dll/transfer_util.h @@ -14,20 +14,20 @@ #include "include/internal/cef_string_multimap.h" // Copy contents from one list type to another. -typedef std::vector StringList; +using StringList = std::vector; void transfer_string_list_contents(cef_string_list_t fromList, StringList& toList); void transfer_string_list_contents(const StringList& fromList, cef_string_list_t toList); // Copy contents from one map type to another. -typedef std::map StringMap; +using StringMap = std::map; void transfer_string_map_contents(cef_string_map_t fromMap, StringMap& toMap); void transfer_string_map_contents(const StringMap& fromMap, cef_string_map_t toMap); // Copy contents from one map type to another. -typedef std::multimap StringMultimap; +using StringMultimap = std::multimap; void transfer_string_multimap_contents(cef_string_multimap_t fromMap, StringMultimap& toMap); void transfer_string_multimap_contents(const StringMultimap& fromMap, diff --git a/libcef_dll/wrapper/cef_browser_info_map.h b/libcef_dll/wrapper/cef_browser_info_map.h index f62c30727..ef638798f 100644 --- a/libcef_dll/wrapper/cef_browser_info_map.h +++ b/libcef_dll/wrapper/cef_browser_info_map.h @@ -9,7 +9,6 @@ #include #include "include/base/cef_logging.h" -#include "include/base/cef_macros.h" // Default traits for CefBrowserInfoMap. Override to provide different object // destruction behavior. @@ -27,8 +26,8 @@ class CefBrowserInfoMap { // Implement this interface to visit and optionally delete objects in the map. class Visitor { public: - typedef IdType InfoIdType; - typedef ObjectType InfoObjectType; + using InfoIdType = IdType; + using InfoObjectType = ObjectType; // Called once for each info object. Set |remove| to true to remove the // object from the map. It is safe to destruct removed objects in this @@ -42,7 +41,10 @@ class CefBrowserInfoMap { virtual ~Visitor() {} }; - CefBrowserInfoMap() {} + CefBrowserInfoMap() = default; + + CefBrowserInfoMap(const CefBrowserInfoMap&) = delete; + CefBrowserInfoMap& operator=(const CefBrowserInfoMap&) = delete; ~CefBrowserInfoMap() { clear(); } @@ -248,13 +250,11 @@ class CefBrowserInfoMap { private: // Map IdType to ObjectType instance. - typedef std::map InfoMap; + using InfoMap = std::map; // Map browser ID to InfoMap instance. - typedef std::map BrowserInfoMap; + using BrowserInfoMap = std::map; BrowserInfoMap browser_info_map_; - - DISALLOW_COPY_AND_ASSIGN(CefBrowserInfoMap); }; #endif // CEF_LIBCEF_DLL_WRAPPER_CEF_BROWSER_INFO_MAP_H_ diff --git a/libcef_dll/wrapper/cef_closure_task.cc b/libcef_dll/wrapper/cef_closure_task.cc index f6dcdb1db..aa8c6482b 100644 --- a/libcef_dll/wrapper/cef_closure_task.cc +++ b/libcef_dll/wrapper/cef_closure_task.cc @@ -15,6 +15,9 @@ class CefOnceClosureTask : public CefTask { explicit CefOnceClosureTask(base::OnceClosure closure) : closure_(std::move(closure)) {} + CefOnceClosureTask(const CefOnceClosureTask&) = delete; + CefOnceClosureTask& operator=(const CefOnceClosureTask&) = delete; + // CefTask method void Execute() override { std::move(closure_).Run(); } @@ -22,7 +25,6 @@ class CefOnceClosureTask : public CefTask { base::OnceClosure closure_; IMPLEMENT_REFCOUNTING(CefOnceClosureTask); - DISALLOW_COPY_AND_ASSIGN(CefOnceClosureTask); }; class CefRepeatingClosureTask : public CefTask { @@ -30,6 +32,9 @@ class CefRepeatingClosureTask : public CefTask { explicit CefRepeatingClosureTask(const base::RepeatingClosure& closure) : closure_(closure) {} + CefRepeatingClosureTask(const CefRepeatingClosureTask&) = delete; + CefRepeatingClosureTask& operator=(const CefRepeatingClosureTask&) = delete; + // CefTask method void Execute() override { closure_.Run(); @@ -40,7 +45,6 @@ class CefRepeatingClosureTask : public CefTask { base::RepeatingClosure closure_; IMPLEMENT_REFCOUNTING(CefRepeatingClosureTask); - DISALLOW_COPY_AND_ASSIGN(CefRepeatingClosureTask); }; } // namespace diff --git a/libcef_dll/wrapper/cef_message_router.cc b/libcef_dll/wrapper/cef_message_router.cc index 3623365a6..df0bb16d8 100644 --- a/libcef_dll/wrapper/cef_message_router.cc +++ b/libcef_dll/wrapper/cef_message_router.cc @@ -8,7 +8,6 @@ #include #include "include/base/cef_callback.h" -#include "include/base/cef_macros.h" #include "include/cef_task.h" #include "include/wrapper/cef_closure_task.h" #include "include/wrapper/cef_helpers.h" @@ -48,6 +47,9 @@ class IdGenerator { public: IdGenerator() : next_id_(kReservedId) {} + IdGenerator(const IdGenerator&) = delete; + IdGenerator& operator=(const IdGenerator&) = delete; + T GetNextId() { T id = ++next_id_; if (id == kReservedId) // In case the integer value wraps. @@ -57,8 +59,6 @@ class IdGenerator { private: T next_id_; - - DISALLOW_COPY_AND_ASSIGN(IdGenerator); }; // Browser-side router implementation. @@ -75,6 +75,10 @@ class CefMessageRouterBrowserSideImpl : public CefMessageRouterBrowserSide { browser_id_(browser_id), query_id_(query_id), persistent_(persistent) {} + + CallbackImpl(const CallbackImpl&) = delete; + CallbackImpl& operator=(const CallbackImpl&) = delete; + virtual ~CallbackImpl() { // Hitting this DCHECK means that you didn't call Success or Failure // on the Callback after returning true from Handler::OnQuery. You must @@ -144,6 +148,11 @@ class CefMessageRouterBrowserSideImpl : public CefMessageRouterBrowserSide { cancel_message_name_(config.js_cancel_function.ToString() + kMessageSuffix) {} + CefMessageRouterBrowserSideImpl(const CefMessageRouterBrowserSideImpl&) = + delete; + CefMessageRouterBrowserSideImpl& operator=( + const CefMessageRouterBrowserSideImpl&) = delete; + virtual ~CefMessageRouterBrowserSideImpl() { // There should be no pending queries when the router is deleted. DCHECK(browser_query_info_map_.empty()); @@ -573,17 +582,15 @@ class CefMessageRouterBrowserSideImpl : public CefMessageRouterBrowserSide { // Set of currently registered handlers. An entry is added when a handler is // registered and removed when a handler is unregistered. - typedef std::set HandlerSet; + using HandlerSet = std::set; HandlerSet handler_set_; // Map of query ID to QueryInfo instance. An entry is added when a Handler // indicates that it will handle the query and removed when either the query // is completed via the Callback, the query is explicitly canceled from the // renderer process, or the associated context is (or will be) released. - typedef CefBrowserInfoMap BrowserQueryInfoMap; + using BrowserQueryInfoMap = CefBrowserInfoMap; BrowserQueryInfoMap browser_query_info_map_; - - DISALLOW_COPY_AND_ASSIGN(CefMessageRouterBrowserSideImpl); }; // Renderer-side router implementation. @@ -595,6 +602,9 @@ class CefMessageRouterRendererSideImpl : public CefMessageRouterRendererSide { const CefMessageRouterConfig& config) : router_(router), config_(config), context_id_(kReservedId) {} + V8HandlerImpl(const V8HandlerImpl&) = delete; + V8HandlerImpl& operator=(const V8HandlerImpl&) = delete; + bool Execute(const CefString& name, CefRefPtr object, const CefV8ValueList& arguments, @@ -704,7 +714,10 @@ class CefMessageRouterRendererSideImpl : public CefMessageRouterRendererSide { cancel_message_name_(config.js_cancel_function.ToString() + kMessageSuffix) {} - virtual ~CefMessageRouterRendererSideImpl() {} + CefMessageRouterRendererSideImpl(const CefMessageRouterRendererSideImpl&) = + delete; + CefMessageRouterRendererSideImpl& operator=( + const CefMessageRouterRendererSideImpl&) = delete; int GetPendingCount(CefRefPtr browser, CefRefPtr context) override { @@ -1090,17 +1103,15 @@ class CefMessageRouterRendererSideImpl : public CefMessageRouterRendererSide { // entry is added when a request is initiated via the bound function and // removed when either the request completes, is canceled via the bound // function, or the associated context is released. - typedef CefBrowserInfoMap, RequestInfo*> - BrowserRequestInfoMap; + using BrowserRequestInfoMap = + CefBrowserInfoMap, RequestInfo*>; BrowserRequestInfoMap browser_request_info_map_; // Map of context ID to CefV8Context for existing contexts. An entry is added // when a bound function is executed for the first time in the context and // removed when the context is released. - typedef std::map> ContextMap; + using ContextMap = std::map>; ContextMap context_map_; - - DISALLOW_COPY_AND_ASSIGN(CefMessageRouterRendererSideImpl); }; } // namespace diff --git a/libcef_dll/wrapper/cef_resource_manager.cc b/libcef_dll/wrapper/cef_resource_manager.cc index 639568bef..3c4f70ce8 100644 --- a/libcef_dll/wrapper/cef_resource_manager.cc +++ b/libcef_dll/wrapper/cef_resource_manager.cc @@ -8,7 +8,6 @@ #include #include "include/base/cef_callback.h" -#include "include/base/cef_macros.h" #include "include/base/cef_weak_ptr.h" #include "include/cef_parser.h" #include "include/wrapper/cef_stream_resource_handler.h" @@ -61,6 +60,9 @@ class ContentProvider : public CefResourceManager::Provider { DCHECK(!content.empty()); } + ContentProvider(const ContentProvider&) = delete; + ContentProvider& operator=(const ContentProvider&) = delete; + bool OnRequest(scoped_refptr request) override { CEF_REQUIRE_IO_THREAD(); @@ -86,8 +88,6 @@ class ContentProvider : public CefResourceManager::Provider { std::string url_; std::string content_; std::string mime_type_; - - DISALLOW_COPY_AND_ASSIGN(ContentProvider); }; // Provider of contents loaded from a directory on the file system. @@ -106,6 +106,9 @@ class DirectoryProvider : public CefResourceManager::Provider { directory_path_ += PATH_SEP; } + DirectoryProvider(const DirectoryProvider&) = delete; + DirectoryProvider& operator=(const DirectoryProvider&) = delete; + bool OnRequest(scoped_refptr request) override { CEF_REQUIRE_IO_THREAD(); @@ -162,8 +165,6 @@ class DirectoryProvider : public CefResourceManager::Provider { std::string url_path_; std::string directory_path_; - - DISALLOW_COPY_AND_ASSIGN(DirectoryProvider); }; // Provider of contents loaded from an archive file. @@ -186,6 +187,9 @@ class ArchiveProvider : public CefResourceManager::Provider { url_path_ += '/'; } + ArchiveProvider(const ArchiveProvider&) = delete; + ArchiveProvider& operator=(const ArchiveProvider&) = delete; + bool OnRequest(scoped_refptr request) override { CEF_REQUIRE_IO_THREAD(); @@ -287,14 +291,12 @@ class ArchiveProvider : public CefResourceManager::Provider { CefRefPtr archive_; // List of requests that are pending while the archive is being loaded. - typedef std::vector> - PendingRequests; + using PendingRequests = + std::vector>; PendingRequests pending_requests_; // Must be the last member. base::WeakPtrFactory weak_ptr_factory_; - - DISALLOW_COPY_AND_ASSIGN(ArchiveProvider); }; } // namespace diff --git a/libcef_dll/wrapper/cef_xml_object.cc b/libcef_dll/wrapper/cef_xml_object.cc index d6fc43917..c31006e26 100644 --- a/libcef_dll/wrapper/cef_xml_object.cc +++ b/libcef_dll/wrapper/cef_xml_object.cc @@ -7,7 +7,6 @@ #include #include "include/base/cef_logging.h" -#include "include/base/cef_macros.h" #include "include/cef_stream.h" namespace { @@ -17,6 +16,9 @@ class CefXmlObjectLoader { explicit CefXmlObjectLoader(CefRefPtr root_object) : root_object_(root_object) {} + CefXmlObjectLoader(const CefXmlObjectLoader&) = delete; + CefXmlObjectLoader& operator=(const CefXmlObjectLoader&) = delete; + bool Load(CefRefPtr stream, CefXmlReader::EncodingType encodingType, const CefString& URI) { @@ -151,8 +153,6 @@ class CefXmlObjectLoader { private: CefString load_error_; CefRefPtr root_object_; - - DISALLOW_COPY_AND_ASSIGN(CefXmlObjectLoader); }; } // namespace diff --git a/libcef_dll/wrapper/cef_zip_archive.cc b/libcef_dll/wrapper/cef_zip_archive.cc index 8dfdcfb1c..f87446629 100644 --- a/libcef_dll/wrapper/cef_zip_archive.cc +++ b/libcef_dll/wrapper/cef_zip_archive.cc @@ -8,7 +8,6 @@ #include #include "include/base/cef_logging.h" -#include "include/base/cef_macros.h" #include "include/cef_stream.h" #include "include/cef_zip_reader.h" #include "include/wrapper/cef_byte_read_handler.h" @@ -30,6 +29,9 @@ class CefZipFile : public CefZipArchive::File { public: CefZipFile() : data_size_(0) {} + CefZipFile(const CefZipFile&) = delete; + CefZipFile& operator=(const CefZipFile&) = delete; + bool Initialize(size_t data_size) { data_.reset(new unsigned char[data_size]); if (data_) { @@ -59,7 +61,6 @@ class CefZipFile : public CefZipArchive::File { std::unique_ptr data_; IMPLEMENT_REFCOUNTING(CefZipFile); - DISALLOW_COPY_AND_ASSIGN(CefZipFile); }; } // namespace