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.
This commit is contained in:
Marshall Greenblatt 2021-12-06 16:59:14 -05:00
parent 9484d6528c
commit 1eb55cbba8
22 changed files with 112 additions and 90 deletions

View File

@ -38,7 +38,6 @@
#pragma once #pragma once
#include "include/base/cef_lock.h" #include "include/base/cef_lock.h"
#include "include/base/cef_macros.h"
#include "include/cef_base.h" #include "include/cef_base.h"
#include "include/cef_stream.h" #include "include/cef_stream.h"
@ -57,6 +56,9 @@ class CefByteReadHandler : public CefReadHandler {
size_t size, size_t size,
CefRefPtr<CefBaseRefCounted> source); CefRefPtr<CefBaseRefCounted> source);
CefByteReadHandler(const CefByteReadHandler&) = delete;
CefByteReadHandler& operator=(const CefByteReadHandler&) = delete;
// CefReadHandler methods. // CefReadHandler methods.
virtual size_t Read(void* ptr, size_t size, size_t n) override; virtual size_t Read(void* ptr, size_t size, size_t n) override;
virtual int Seek(int64 offset, int whence) override; virtual int Seek(int64 offset, int whence) override;
@ -73,7 +75,6 @@ class CefByteReadHandler : public CefReadHandler {
base::Lock lock_; base::Lock lock_;
IMPLEMENT_REFCOUNTING(CefByteReadHandler); IMPLEMENT_REFCOUNTING(CefByteReadHandler);
DISALLOW_COPY_AND_ASSIGN(CefByteReadHandler);
}; };
#endif // CEF_INCLUDE_WRAPPER_CEF_BYTE_READ_HANDLER_H_ #endif // CEF_INCLUDE_WRAPPER_CEF_BYTE_READ_HANDLER_H_

View File

@ -38,7 +38,6 @@
#pragma once #pragma once
#include "include/base/cef_callback_forward.h" #include "include/base/cef_callback_forward.h"
#include "include/base/cef_macros.h"
#include "include/cef_task.h" #include "include/cef_task.h"
/// ///

View File

@ -43,7 +43,6 @@
#include "include/base/cef_bind.h" #include "include/base/cef_bind.h"
#include "include/base/cef_logging.h" #include "include/base/cef_logging.h"
#include "include/base/cef_macros.h"
#include "include/cef_task.h" #include "include/cef_task.h"
#define CEF_REQUIRE_UI_THREAD() DCHECK(CefCurrentlyOn(TID_UI)); #define CEF_REQUIRE_UI_THREAD() DCHECK(CefCurrentlyOn(TID_UI));
@ -140,6 +139,10 @@ class CefScopedArgArray {
} }
array_[argc] = NULL; array_[argc] = NULL;
} }
CefScopedArgArray(const CefScopedArgArray&) = delete;
CefScopedArgArray& operator=(const CefScopedArgArray&) = delete;
~CefScopedArgArray() { delete[] array_; } ~CefScopedArgArray() { delete[] array_; }
char** array() const { return array_; } char** array() const { return array_; }
@ -150,8 +153,6 @@ class CefScopedArgArray {
// Keep values in a vector separate from |array_| because various users may // Keep values in a vector separate from |array_| because various users may
// modify |array_| and we still want to clean up memory properly. // modify |array_| and we still want to clean up memory properly.
std::vector<std::string> values_; std::vector<std::string> values_;
DISALLOW_COPY_AND_ASSIGN(CefScopedArgArray);
}; };
#endif // CEF_INCLUDE_WRAPPER_CEF_HELPERS_H_ #endif // CEF_INCLUDE_WRAPPER_CEF_HELPERS_H_

View File

@ -36,8 +36,6 @@
#ifdef __cplusplus #ifdef __cplusplus
#include <string> #include <string>
#include "include/base/cef_macros.h"
extern "C" { extern "C" {
#endif // __cplusplus #endif // __cplusplus
@ -99,6 +97,10 @@ int cef_unload_library();
class CefScopedLibraryLoader { class CefScopedLibraryLoader {
public: public:
CefScopedLibraryLoader(); CefScopedLibraryLoader();
CefScopedLibraryLoader(const CefScopedLibraryLoader&) = delete;
CefScopedLibraryLoader& operator=(const CefScopedLibraryLoader&) = delete;
~CefScopedLibraryLoader(); ~CefScopedLibraryLoader();
/// ///
@ -119,7 +121,6 @@ class CefScopedLibraryLoader {
bool Load(bool helper); bool Load(bool helper);
bool loaded_; bool loaded_;
DISALLOW_COPY_AND_ASSIGN(CefScopedLibraryLoader);
}; };
#endif // defined(OS_MAC) #endif // defined(OS_MAC)

View File

@ -245,7 +245,7 @@ class CefMessageRouterBrowserSide
/// ///
class Handler { class Handler {
public: public:
typedef CefMessageRouterBrowserSide::Callback Callback; using Callback = CefMessageRouterBrowserSide::Callback;
/// ///
// Executed when a new query is received. |query_id| uniquely identifies the // Executed when a new query is received. |query_id| uniquely identifies the

View File

@ -41,7 +41,6 @@
#include <memory> #include <memory>
#include "include/base/cef_callback.h" #include "include/base/cef_callback.h"
#include "include/base/cef_macros.h"
#include "include/base/cef_ref_counted.h" #include "include/base/cef_ref_counted.h"
#include "include/base/cef_weak_ptr.h" #include "include/base/cef_weak_ptr.h"
#include "include/cef_request_handler.h" #include "include/cef_request_handler.h"
@ -101,6 +100,9 @@ class CefResourceManager
/// ///
class Request : public base::RefCountedThreadSafe<Request> { class Request : public base::RefCountedThreadSafe<Request> {
public: public:
Request(const Request&) = delete;
Request& operator=(const Request&) = delete;
/// ///
// Returns the URL associated with this request. The returned value will be // Returns the URL associated with this request. The returned value will be
// fully qualified but will not contain query or fragment components. It // 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. // Params that stay with this request object. Safe to access on any thread.
RequestParams params_; RequestParams params_;
DISALLOW_COPY_AND_ASSIGN(Request);
}; };
typedef std::list<scoped_refptr<Request>> RequestList; using RequestList = std::list<scoped_refptr<Request>>;
/// ///
// Interface implemented by resource providers. A provider may be created on // Interface implemented by resource providers. A provider may be created on
@ -210,6 +210,9 @@ class CefResourceManager
CefResourceManager(); CefResourceManager();
CefResourceManager(const CefResourceManager&) = delete;
CefResourceManager& operator=(const CefResourceManager&) = delete;
/// ///
// Add a provider that maps requests for |url| to |content|. |url| should be // Add a provider that maps requests for |url| to |content|. |url| should be
// fully qualified but not include a query or fragment component. If // fully qualified but not include a query or fragment component. If
@ -316,7 +319,7 @@ class CefResourceManager
// Provider and associated information. // Provider and associated information.
struct ProviderEntry; struct ProviderEntry;
typedef std::list<ProviderEntry*> ProviderEntryList; using ProviderEntryList = std::list<ProviderEntry*>;
// Values associated with the pending request only. Ownership will be passed // Values associated with the pending request only. Ownership will be passed
// between requests and the resource manager as request handling proceeds. // between requests and the resource manager as request handling proceeds.
@ -357,7 +360,7 @@ class CefResourceManager
ProviderEntryList providers_; ProviderEntryList providers_;
// Map of response ID to pending CefResourceHandler object. // Map of response ID to pending CefResourceHandler object.
typedef std::map<uint64, CefRefPtr<CefResourceHandler>> PendingHandlersMap; using PendingHandlersMap = std::map<uint64, CefRefPtr<CefResourceHandler>>;
PendingHandlersMap pending_handlers_; PendingHandlersMap pending_handlers_;
UrlFilter url_filter_; UrlFilter url_filter_;
@ -365,8 +368,6 @@ class CefResourceManager
// Must be the last member. Created and accessed on the IO thread. // Must be the last member. Created and accessed on the IO thread.
std::unique_ptr<base::WeakPtrFactory<CefResourceManager>> weak_ptr_factory_; std::unique_ptr<base::WeakPtrFactory<CefResourceManager>> weak_ptr_factory_;
DISALLOW_COPY_AND_ASSIGN(CefResourceManager);
}; };
#endif // CEF_INCLUDE_WRAPPER_CEF_RESOURCE_MANAGER_H_ #endif // CEF_INCLUDE_WRAPPER_CEF_RESOURCE_MANAGER_H_

View File

@ -39,7 +39,6 @@
#pragma once #pragma once
#include "include/base/cef_build.h" #include "include/base/cef_build.h"
#include "include/base/cef_macros.h"
#include "include/cef_base.h" #include "include/cef_base.h"
/// ///
@ -60,6 +59,9 @@ class CefScopedTempDir {
/// ///
CefScopedTempDir(); CefScopedTempDir();
CefScopedTempDir(const CefScopedTempDir&) = delete;
CefScopedTempDir& operator=(const CefScopedTempDir&) = delete;
/// ///
// Recursively delete path. // Recursively delete path.
/// ///
@ -111,8 +113,6 @@ class CefScopedTempDir {
private: private:
CefString path_; CefString path_;
DISALLOW_COPY_AND_ASSIGN(CefScopedTempDir);
}; };
#endif // CEF_INCLUDE_SCOPED_TEMP_DIR_H_ #endif // CEF_INCLUDE_SCOPED_TEMP_DIR_H_

View File

@ -37,7 +37,6 @@
#define CEF_INCLUDE_WRAPPER_CEF_STREAM_RESOURCE_HANDLER_H_ #define CEF_INCLUDE_WRAPPER_CEF_STREAM_RESOURCE_HANDLER_H_
#pragma once #pragma once
#include "include/base/cef_macros.h"
#include "include/cef_resource_handler.h" #include "include/cef_resource_handler.h"
#include "include/cef_response.h" #include "include/cef_response.h"
#include "include/cef_stream.h" #include "include/cef_stream.h"
@ -61,6 +60,9 @@ class CefStreamResourceHandler : public CefResourceHandler {
CefResponse::HeaderMap header_map, CefResponse::HeaderMap header_map,
CefRefPtr<CefStreamReader> stream); CefRefPtr<CefStreamReader> stream);
CefStreamResourceHandler(const CefStreamResourceHandler&) = delete;
CefStreamResourceHandler& operator=(const CefStreamResourceHandler&) = delete;
// CefResourceHandler methods. // CefResourceHandler methods.
bool Open(CefRefPtr<CefRequest> request, bool Open(CefRefPtr<CefRequest> request,
bool& handle_request, bool& handle_request,
@ -82,7 +84,6 @@ class CefStreamResourceHandler : public CefResourceHandler {
const CefRefPtr<CefStreamReader> stream_; const CefRefPtr<CefStreamReader> stream_;
IMPLEMENT_REFCOUNTING(CefStreamResourceHandler); IMPLEMENT_REFCOUNTING(CefStreamResourceHandler);
DISALLOW_COPY_AND_ASSIGN(CefStreamResourceHandler);
}; };
#endif // CEF_INCLUDE_WRAPPER_CEF_STREAM_RESOURCE_HANDLER_H_ #endif // CEF_INCLUDE_WRAPPER_CEF_STREAM_RESOURCE_HANDLER_H_

View File

@ -41,7 +41,6 @@
#include <vector> #include <vector>
#include "include/base/cef_lock.h" #include "include/base/cef_lock.h"
#include "include/base/cef_macros.h"
#include "include/base/cef_ref_counted.h" #include "include/base/cef_ref_counted.h"
#include "include/cef_base.h" #include "include/cef_base.h"
#include "include/cef_xml_reader.h" #include "include/cef_xml_reader.h"
@ -73,8 +72,8 @@ class CefStreamReader;
/// ///
class CefXmlObject : public base::RefCountedThreadSafe<CefXmlObject> { class CefXmlObject : public base::RefCountedThreadSafe<CefXmlObject> {
public: public:
typedef std::vector<CefRefPtr<CefXmlObject>> ObjectVector; using ObjectVector = std::vector<CefRefPtr<CefXmlObject>>;
typedef std::map<CefString, CefString> AttributeMap; using AttributeMap = std::map<CefString, CefString>;
/// ///
// Create a new object with the specified name. An object name must always be // Create a new object with the specified name. An object name must always be
@ -82,6 +81,9 @@ class CefXmlObject : public base::RefCountedThreadSafe<CefXmlObject> {
/// ///
explicit CefXmlObject(const CefString& name); 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 // Load the contents of the specified XML stream into this object. The
// existing children and attributes, if any, will first be cleared. // existing children and attributes, if any, will first be cleared.
@ -190,8 +192,6 @@ class CefXmlObject : public base::RefCountedThreadSafe<CefXmlObject> {
ObjectVector children_; ObjectVector children_;
base::Lock lock_; base::Lock lock_;
DISALLOW_COPY_AND_ASSIGN(CefXmlObject);
}; };
#endif // CEF_INCLUDE_WRAPPER_CEF_XML_OBJECT_H_ #endif // CEF_INCLUDE_WRAPPER_CEF_XML_OBJECT_H_

View File

@ -40,7 +40,6 @@
#include <map> #include <map>
#include "include/base/cef_lock.h" #include "include/base/cef_lock.h"
#include "include/base/cef_macros.h"
#include "include/base/cef_ref_counted.h" #include "include/base/cef_ref_counted.h"
#include "include/cef_base.h" #include "include/cef_base.h"
@ -80,13 +79,16 @@ class CefZipArchive : public base::RefCountedThreadSafe<CefZipArchive> {
virtual CefRefPtr<CefStreamReader> GetStreamReader() const = 0; virtual CefRefPtr<CefStreamReader> GetStreamReader() const = 0;
}; };
typedef std::map<CefString, CefRefPtr<File>> FileMap; using FileMap = std::map<CefString, CefRefPtr<File>>;
/// ///
// Create a new object. // Create a new object.
/// ///
CefZipArchive(); CefZipArchive();
CefZipArchive(const CefZipArchive&) = delete;
CefZipArchive& operator=(const CefZipArchive&) = delete;
/// ///
// Load the contents of the specified zip archive stream into this object. // Load the contents of the specified zip archive stream into this object.
// If the zip archive requires a password then provide it via |password|. // If the zip archive requires a password then provide it via |password|.
@ -136,8 +138,6 @@ class CefZipArchive : public base::RefCountedThreadSafe<CefZipArchive> {
FileMap contents_; FileMap contents_;
mutable base::Lock lock_; mutable base::Lock lock_;
DISALLOW_COPY_AND_ASSIGN(CefZipArchive);
}; };
#endif // CEF_INCLUDE_WRAPPER_CEF_ZIP_ARCHIVE_H_ #endif // CEF_INCLUDE_WRAPPER_CEF_ZIP_ARCHIVE_H_

View File

@ -191,7 +191,7 @@ LogMessage::~LogMessage() {
// This has already been defined in the header, but defining it again as DWORD // 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, // ensures that the type used in the header is equivalent to DWORD. If not,
// the redefinition is a compile error. // the redefinition is a compile error.
typedef DWORD SystemErrorCode; using SystemErrorCode = DWORD;
#endif #endif
SystemErrorCode GetLastSystemErrorCode() { SystemErrorCode GetLastSystemErrorCode() {

View File

@ -7,7 +7,6 @@
#pragma once #pragma once
#include "include/base/cef_logging.h" #include "include/base/cef_logging.h"
#include "include/base/cef_macros.h"
#include "include/capi/cef_base_capi.h" #include "include/capi/cef_base_capi.h"
#include "include/cef_base.h" #include "include/cef_base.h"
#include "libcef_dll/wrapper_types.h" #include "libcef_dll/wrapper_types.h"
@ -18,6 +17,9 @@
template <class ClassName, class BaseName, class StructName> template <class ClassName, class BaseName, class StructName>
class CefCppToCRefCounted : public CefBaseRefCounted { class CefCppToCRefCounted : public CefBaseRefCounted {
public: public:
CefCppToCRefCounted(const CefCppToCRefCounted&) = delete;
CefCppToCRefCounted& operator=(const CefCppToCRefCounted&) = delete;
// Create a new wrapper instance and associated structure reference for // Create a new wrapper instance and associated structure reference for
// passing an object instance the other side. // passing an object instance the other side.
static StructName* Wrap(CefRefPtr<BaseName> c) { static StructName* Wrap(CefRefPtr<BaseName> c) {
@ -105,7 +107,7 @@ class CefCppToCRefCounted : public CefBaseRefCounted {
base->has_at_least_one_ref = struct_has_at_least_one_ref; base->has_at_least_one_ref = struct_has_at_least_one_ref;
} }
virtual ~CefCppToCRefCounted() {} virtual ~CefCppToCRefCounted() = default;
private: private:
// Used to associate this wrapper object, the underlying object instance and // Used to associate this wrapper object, the underlying object instance and
@ -196,8 +198,6 @@ class CefCppToCRefCounted : public CefBaseRefCounted {
CefRefCount ref_count_; CefRefCount ref_count_;
static CefWrapperType kWrapperType; static CefWrapperType kWrapperType;
DISALLOW_COPY_AND_ASSIGN(CefCppToCRefCounted);
}; };
#endif // CEF_LIBCEF_DLL_CPPTOC_CPPTOC_REF_COUNTED_H_ #endif // CEF_LIBCEF_DLL_CPPTOC_CPPTOC_REF_COUNTED_H_

View File

@ -7,7 +7,6 @@
#pragma once #pragma once
#include "include/base/cef_logging.h" #include "include/base/cef_logging.h"
#include "include/base/cef_macros.h"
#include "include/capi/cef_base_capi.h" #include "include/capi/cef_base_capi.h"
#include "include/cef_base.h" #include "include/cef_base.h"
#include "libcef_dll/wrapper_types.h" #include "libcef_dll/wrapper_types.h"
@ -18,6 +17,9 @@
template <class ClassName, class BaseName, class StructName> template <class ClassName, class BaseName, class StructName>
class CefCppToCScoped : public CefBaseScoped { class CefCppToCScoped : public CefBaseScoped {
public: public:
CefCppToCScoped(const CefCppToCScoped&) = delete;
CefCppToCScoped& operator=(const CefCppToCScoped&) = delete;
// Create a new wrapper instance and associated structure reference for // Create a new wrapper instance and associated structure reference for
// passing an object instance the other side. The wrapper object will be // passing an object instance the other side. The wrapper object will be
// deleted when |del| is called on the associated structure. The wrapped // deleted when |del| is called on the associated structure. The wrapped
@ -220,8 +222,6 @@ class CefCppToCScoped : public CefBaseScoped {
bool owned_; bool owned_;
static CefWrapperType kWrapperType; static CefWrapperType kWrapperType;
DISALLOW_COPY_AND_ASSIGN(CefCppToCScoped);
}; };
#endif // CEF_LIBCEF_DLL_CPPTOC_CPPTOC_SCOPED_H_ #endif // CEF_LIBCEF_DLL_CPPTOC_CPPTOC_SCOPED_H_

View File

@ -7,7 +7,6 @@
#pragma once #pragma once
#include "include/base/cef_logging.h" #include "include/base/cef_logging.h"
#include "include/base/cef_macros.h"
#include "include/capi/cef_base_capi.h" #include "include/capi/cef_base_capi.h"
#include "include/cef_base.h" #include "include/cef_base.h"
#include "libcef_dll/wrapper_types.h" #include "libcef_dll/wrapper_types.h"
@ -18,6 +17,9 @@
template <class ClassName, class BaseName, class StructName> template <class ClassName, class BaseName, class StructName>
class CefCToCppRefCounted : public BaseName { class CefCToCppRefCounted : public BaseName {
public: public:
CefCToCppRefCounted(const CefCToCppRefCounted&) = delete;
CefCToCppRefCounted& operator=(const CefCToCppRefCounted&) = delete;
// Create a new wrapper instance for a structure reference received from the // Create a new wrapper instance for a structure reference received from the
// other side. // other side.
static CefRefPtr<BaseName> Wrap(StructName* s); static CefRefPtr<BaseName> Wrap(StructName* s);
@ -37,8 +39,8 @@ class CefCToCppRefCounted : public BaseName {
bool HasAtLeastOneRef() const { return UnderlyingHasAtLeastOneRef(); } bool HasAtLeastOneRef() const { return UnderlyingHasAtLeastOneRef(); }
protected: protected:
CefCToCppRefCounted() {} CefCToCppRefCounted() = default;
virtual ~CefCToCppRefCounted() {} virtual ~CefCToCppRefCounted() = default;
// If returning the structure across the DLL boundary use Unwrap() instead. // If returning the structure across the DLL boundary use Unwrap() instead.
StructName* GetStruct() const { StructName* GetStruct() const {
@ -97,8 +99,6 @@ class CefCToCppRefCounted : public BaseName {
CefRefCount ref_count_; CefRefCount ref_count_;
static CefWrapperType kWrapperType; static CefWrapperType kWrapperType;
DISALLOW_COPY_AND_ASSIGN(CefCToCppRefCounted);
}; };
template <class ClassName, class BaseName, class StructName> template <class ClassName, class BaseName, class StructName>

View File

@ -7,7 +7,6 @@
#pragma once #pragma once
#include "include/base/cef_logging.h" #include "include/base/cef_logging.h"
#include "include/base/cef_macros.h"
#include "include/capi/cef_base_capi.h" #include "include/capi/cef_base_capi.h"
#include "include/cef_base.h" #include "include/cef_base.h"
#include "libcef_dll/wrapper_types.h" #include "libcef_dll/wrapper_types.h"
@ -18,6 +17,9 @@
template <class ClassName, class BaseName, class StructName> template <class ClassName, class BaseName, class StructName>
class CefCToCppScoped : public BaseName { class CefCToCppScoped : public BaseName {
public: public:
CefCToCppScoped(const CefCToCppScoped&) = delete;
CefCToCppScoped& operator=(const CefCToCppScoped&) = delete;
// Create a new wrapper instance for a structure reference received from the // Create a new wrapper instance for a structure reference received from the
// other side. The caller owns the CToCpp wrapper instance but not necessarily // 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). // 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); static void operator delete(void* ptr);
protected: protected:
CefCToCppScoped() {} CefCToCppScoped() = default;
virtual ~CefCToCppScoped() {} virtual ~CefCToCppScoped() = default;
// If returning the structure across the DLL boundary use Unwrap() instead. // If returning the structure across the DLL boundary use Unwrap() instead.
StructName* GetStruct() const { StructName* GetStruct() const {
@ -92,8 +94,6 @@ class CefCToCppScoped : public BaseName {
CefRawPtr<BaseName> c); CefRawPtr<BaseName> c);
static CefWrapperType kWrapperType; static CefWrapperType kWrapperType;
DISALLOW_COPY_AND_ASSIGN(CefCToCppScoped);
}; };
template <class ClassName, class BaseName, class StructName> template <class ClassName, class BaseName, class StructName>

View File

@ -14,20 +14,20 @@
#include "include/internal/cef_string_multimap.h" #include "include/internal/cef_string_multimap.h"
// Copy contents from one list type to another. // Copy contents from one list type to another.
typedef std::vector<CefString> StringList; using StringList = std::vector<CefString>;
void transfer_string_list_contents(cef_string_list_t fromList, void transfer_string_list_contents(cef_string_list_t fromList,
StringList& toList); StringList& toList);
void transfer_string_list_contents(const StringList& fromList, void transfer_string_list_contents(const StringList& fromList,
cef_string_list_t toList); cef_string_list_t toList);
// Copy contents from one map type to another. // Copy contents from one map type to another.
typedef std::map<CefString, CefString> StringMap; using StringMap = std::map<CefString, CefString>;
void transfer_string_map_contents(cef_string_map_t fromMap, StringMap& toMap); void transfer_string_map_contents(cef_string_map_t fromMap, StringMap& toMap);
void transfer_string_map_contents(const StringMap& fromMap, void transfer_string_map_contents(const StringMap& fromMap,
cef_string_map_t toMap); cef_string_map_t toMap);
// Copy contents from one map type to another. // Copy contents from one map type to another.
typedef std::multimap<CefString, CefString> StringMultimap; using StringMultimap = std::multimap<CefString, CefString>;
void transfer_string_multimap_contents(cef_string_multimap_t fromMap, void transfer_string_multimap_contents(cef_string_multimap_t fromMap,
StringMultimap& toMap); StringMultimap& toMap);
void transfer_string_multimap_contents(const StringMultimap& fromMap, void transfer_string_multimap_contents(const StringMultimap& fromMap,

View File

@ -9,7 +9,6 @@
#include <map> #include <map>
#include "include/base/cef_logging.h" #include "include/base/cef_logging.h"
#include "include/base/cef_macros.h"
// Default traits for CefBrowserInfoMap. Override to provide different object // Default traits for CefBrowserInfoMap. Override to provide different object
// destruction behavior. // destruction behavior.
@ -27,8 +26,8 @@ class CefBrowserInfoMap {
// Implement this interface to visit and optionally delete objects in the map. // Implement this interface to visit and optionally delete objects in the map.
class Visitor { class Visitor {
public: public:
typedef IdType InfoIdType; using InfoIdType = IdType;
typedef ObjectType InfoObjectType; using InfoObjectType = ObjectType;
// Called once for each info object. Set |remove| to true to remove the // 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 // object from the map. It is safe to destruct removed objects in this
@ -42,7 +41,10 @@ class CefBrowserInfoMap {
virtual ~Visitor() {} virtual ~Visitor() {}
}; };
CefBrowserInfoMap() {} CefBrowserInfoMap() = default;
CefBrowserInfoMap(const CefBrowserInfoMap&) = delete;
CefBrowserInfoMap& operator=(const CefBrowserInfoMap&) = delete;
~CefBrowserInfoMap() { clear(); } ~CefBrowserInfoMap() { clear(); }
@ -248,13 +250,11 @@ class CefBrowserInfoMap {
private: private:
// Map IdType to ObjectType instance. // Map IdType to ObjectType instance.
typedef std::map<IdType, ObjectType> InfoMap; using InfoMap = std::map<IdType, ObjectType>;
// Map browser ID to InfoMap instance. // Map browser ID to InfoMap instance.
typedef std::map<int, InfoMap*> BrowserInfoMap; using BrowserInfoMap = std::map<int, InfoMap*>;
BrowserInfoMap browser_info_map_; BrowserInfoMap browser_info_map_;
DISALLOW_COPY_AND_ASSIGN(CefBrowserInfoMap);
}; };
#endif // CEF_LIBCEF_DLL_WRAPPER_CEF_BROWSER_INFO_MAP_H_ #endif // CEF_LIBCEF_DLL_WRAPPER_CEF_BROWSER_INFO_MAP_H_

View File

@ -15,6 +15,9 @@ class CefOnceClosureTask : public CefTask {
explicit CefOnceClosureTask(base::OnceClosure closure) explicit CefOnceClosureTask(base::OnceClosure closure)
: closure_(std::move(closure)) {} : closure_(std::move(closure)) {}
CefOnceClosureTask(const CefOnceClosureTask&) = delete;
CefOnceClosureTask& operator=(const CefOnceClosureTask&) = delete;
// CefTask method // CefTask method
void Execute() override { std::move(closure_).Run(); } void Execute() override { std::move(closure_).Run(); }
@ -22,7 +25,6 @@ class CefOnceClosureTask : public CefTask {
base::OnceClosure closure_; base::OnceClosure closure_;
IMPLEMENT_REFCOUNTING(CefOnceClosureTask); IMPLEMENT_REFCOUNTING(CefOnceClosureTask);
DISALLOW_COPY_AND_ASSIGN(CefOnceClosureTask);
}; };
class CefRepeatingClosureTask : public CefTask { class CefRepeatingClosureTask : public CefTask {
@ -30,6 +32,9 @@ class CefRepeatingClosureTask : public CefTask {
explicit CefRepeatingClosureTask(const base::RepeatingClosure& closure) explicit CefRepeatingClosureTask(const base::RepeatingClosure& closure)
: closure_(closure) {} : closure_(closure) {}
CefRepeatingClosureTask(const CefRepeatingClosureTask&) = delete;
CefRepeatingClosureTask& operator=(const CefRepeatingClosureTask&) = delete;
// CefTask method // CefTask method
void Execute() override { void Execute() override {
closure_.Run(); closure_.Run();
@ -40,7 +45,6 @@ class CefRepeatingClosureTask : public CefTask {
base::RepeatingClosure closure_; base::RepeatingClosure closure_;
IMPLEMENT_REFCOUNTING(CefRepeatingClosureTask); IMPLEMENT_REFCOUNTING(CefRepeatingClosureTask);
DISALLOW_COPY_AND_ASSIGN(CefRepeatingClosureTask);
}; };
} // namespace } // namespace

View File

@ -8,7 +8,6 @@
#include <set> #include <set>
#include "include/base/cef_callback.h" #include "include/base/cef_callback.h"
#include "include/base/cef_macros.h"
#include "include/cef_task.h" #include "include/cef_task.h"
#include "include/wrapper/cef_closure_task.h" #include "include/wrapper/cef_closure_task.h"
#include "include/wrapper/cef_helpers.h" #include "include/wrapper/cef_helpers.h"
@ -48,6 +47,9 @@ class IdGenerator {
public: public:
IdGenerator() : next_id_(kReservedId) {} IdGenerator() : next_id_(kReservedId) {}
IdGenerator(const IdGenerator&) = delete;
IdGenerator& operator=(const IdGenerator&) = delete;
T GetNextId() { T GetNextId() {
T id = ++next_id_; T id = ++next_id_;
if (id == kReservedId) // In case the integer value wraps. if (id == kReservedId) // In case the integer value wraps.
@ -57,8 +59,6 @@ class IdGenerator {
private: private:
T next_id_; T next_id_;
DISALLOW_COPY_AND_ASSIGN(IdGenerator);
}; };
// Browser-side router implementation. // Browser-side router implementation.
@ -75,6 +75,10 @@ class CefMessageRouterBrowserSideImpl : public CefMessageRouterBrowserSide {
browser_id_(browser_id), browser_id_(browser_id),
query_id_(query_id), query_id_(query_id),
persistent_(persistent) {} persistent_(persistent) {}
CallbackImpl(const CallbackImpl&) = delete;
CallbackImpl& operator=(const CallbackImpl&) = delete;
virtual ~CallbackImpl() { virtual ~CallbackImpl() {
// Hitting this DCHECK means that you didn't call Success or Failure // Hitting this DCHECK means that you didn't call Success or Failure
// on the Callback after returning true from Handler::OnQuery. You must // 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() + cancel_message_name_(config.js_cancel_function.ToString() +
kMessageSuffix) {} kMessageSuffix) {}
CefMessageRouterBrowserSideImpl(const CefMessageRouterBrowserSideImpl&) =
delete;
CefMessageRouterBrowserSideImpl& operator=(
const CefMessageRouterBrowserSideImpl&) = delete;
virtual ~CefMessageRouterBrowserSideImpl() { virtual ~CefMessageRouterBrowserSideImpl() {
// There should be no pending queries when the router is deleted. // There should be no pending queries when the router is deleted.
DCHECK(browser_query_info_map_.empty()); 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 // Set of currently registered handlers. An entry is added when a handler is
// registered and removed when a handler is unregistered. // registered and removed when a handler is unregistered.
typedef std::set<Handler*> HandlerSet; using HandlerSet = std::set<Handler*>;
HandlerSet handler_set_; HandlerSet handler_set_;
// Map of query ID to QueryInfo instance. An entry is added when a Handler // 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 // 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 // is completed via the Callback, the query is explicitly canceled from the
// renderer process, or the associated context is (or will be) released. // renderer process, or the associated context is (or will be) released.
typedef CefBrowserInfoMap<int64, QueryInfo*> BrowserQueryInfoMap; using BrowserQueryInfoMap = CefBrowserInfoMap<int64, QueryInfo*>;
BrowserQueryInfoMap browser_query_info_map_; BrowserQueryInfoMap browser_query_info_map_;
DISALLOW_COPY_AND_ASSIGN(CefMessageRouterBrowserSideImpl);
}; };
// Renderer-side router implementation. // Renderer-side router implementation.
@ -595,6 +602,9 @@ class CefMessageRouterRendererSideImpl : public CefMessageRouterRendererSide {
const CefMessageRouterConfig& config) const CefMessageRouterConfig& config)
: router_(router), config_(config), context_id_(kReservedId) {} : router_(router), config_(config), context_id_(kReservedId) {}
V8HandlerImpl(const V8HandlerImpl&) = delete;
V8HandlerImpl& operator=(const V8HandlerImpl&) = delete;
bool Execute(const CefString& name, bool Execute(const CefString& name,
CefRefPtr<CefV8Value> object, CefRefPtr<CefV8Value> object,
const CefV8ValueList& arguments, const CefV8ValueList& arguments,
@ -704,7 +714,10 @@ class CefMessageRouterRendererSideImpl : public CefMessageRouterRendererSide {
cancel_message_name_(config.js_cancel_function.ToString() + cancel_message_name_(config.js_cancel_function.ToString() +
kMessageSuffix) {} kMessageSuffix) {}
virtual ~CefMessageRouterRendererSideImpl() {} CefMessageRouterRendererSideImpl(const CefMessageRouterRendererSideImpl&) =
delete;
CefMessageRouterRendererSideImpl& operator=(
const CefMessageRouterRendererSideImpl&) = delete;
int GetPendingCount(CefRefPtr<CefBrowser> browser, int GetPendingCount(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefV8Context> context) override { CefRefPtr<CefV8Context> context) override {
@ -1090,17 +1103,15 @@ class CefMessageRouterRendererSideImpl : public CefMessageRouterRendererSide {
// entry is added when a request is initiated via the bound function and // entry is added when a request is initiated via the bound function and
// removed when either the request completes, is canceled via the bound // removed when either the request completes, is canceled via the bound
// function, or the associated context is released. // function, or the associated context is released.
typedef CefBrowserInfoMap<std::pair<int, int>, RequestInfo*> using BrowserRequestInfoMap =
BrowserRequestInfoMap; CefBrowserInfoMap<std::pair<int, int>, RequestInfo*>;
BrowserRequestInfoMap browser_request_info_map_; BrowserRequestInfoMap browser_request_info_map_;
// Map of context ID to CefV8Context for existing contexts. An entry is added // 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 // when a bound function is executed for the first time in the context and
// removed when the context is released. // removed when the context is released.
typedef std::map<int, CefRefPtr<CefV8Context>> ContextMap; using ContextMap = std::map<int, CefRefPtr<CefV8Context>>;
ContextMap context_map_; ContextMap context_map_;
DISALLOW_COPY_AND_ASSIGN(CefMessageRouterRendererSideImpl);
}; };
} // namespace } // namespace

View File

@ -8,7 +8,6 @@
#include <vector> #include <vector>
#include "include/base/cef_callback.h" #include "include/base/cef_callback.h"
#include "include/base/cef_macros.h"
#include "include/base/cef_weak_ptr.h" #include "include/base/cef_weak_ptr.h"
#include "include/cef_parser.h" #include "include/cef_parser.h"
#include "include/wrapper/cef_stream_resource_handler.h" #include "include/wrapper/cef_stream_resource_handler.h"
@ -61,6 +60,9 @@ class ContentProvider : public CefResourceManager::Provider {
DCHECK(!content.empty()); DCHECK(!content.empty());
} }
ContentProvider(const ContentProvider&) = delete;
ContentProvider& operator=(const ContentProvider&) = delete;
bool OnRequest(scoped_refptr<CefResourceManager::Request> request) override { bool OnRequest(scoped_refptr<CefResourceManager::Request> request) override {
CEF_REQUIRE_IO_THREAD(); CEF_REQUIRE_IO_THREAD();
@ -86,8 +88,6 @@ class ContentProvider : public CefResourceManager::Provider {
std::string url_; std::string url_;
std::string content_; std::string content_;
std::string mime_type_; std::string mime_type_;
DISALLOW_COPY_AND_ASSIGN(ContentProvider);
}; };
// Provider of contents loaded from a directory on the file system. // Provider of contents loaded from a directory on the file system.
@ -106,6 +106,9 @@ class DirectoryProvider : public CefResourceManager::Provider {
directory_path_ += PATH_SEP; directory_path_ += PATH_SEP;
} }
DirectoryProvider(const DirectoryProvider&) = delete;
DirectoryProvider& operator=(const DirectoryProvider&) = delete;
bool OnRequest(scoped_refptr<CefResourceManager::Request> request) override { bool OnRequest(scoped_refptr<CefResourceManager::Request> request) override {
CEF_REQUIRE_IO_THREAD(); CEF_REQUIRE_IO_THREAD();
@ -162,8 +165,6 @@ class DirectoryProvider : public CefResourceManager::Provider {
std::string url_path_; std::string url_path_;
std::string directory_path_; std::string directory_path_;
DISALLOW_COPY_AND_ASSIGN(DirectoryProvider);
}; };
// Provider of contents loaded from an archive file. // Provider of contents loaded from an archive file.
@ -186,6 +187,9 @@ class ArchiveProvider : public CefResourceManager::Provider {
url_path_ += '/'; url_path_ += '/';
} }
ArchiveProvider(const ArchiveProvider&) = delete;
ArchiveProvider& operator=(const ArchiveProvider&) = delete;
bool OnRequest(scoped_refptr<CefResourceManager::Request> request) override { bool OnRequest(scoped_refptr<CefResourceManager::Request> request) override {
CEF_REQUIRE_IO_THREAD(); CEF_REQUIRE_IO_THREAD();
@ -287,14 +291,12 @@ class ArchiveProvider : public CefResourceManager::Provider {
CefRefPtr<CefZipArchive> archive_; CefRefPtr<CefZipArchive> archive_;
// List of requests that are pending while the archive is being loaded. // List of requests that are pending while the archive is being loaded.
typedef std::vector<scoped_refptr<CefResourceManager::Request>> using PendingRequests =
PendingRequests; std::vector<scoped_refptr<CefResourceManager::Request>>;
PendingRequests pending_requests_; PendingRequests pending_requests_;
// Must be the last member. // Must be the last member.
base::WeakPtrFactory<ArchiveProvider> weak_ptr_factory_; base::WeakPtrFactory<ArchiveProvider> weak_ptr_factory_;
DISALLOW_COPY_AND_ASSIGN(ArchiveProvider);
}; };
} // namespace } // namespace

View File

@ -7,7 +7,6 @@
#include <sstream> #include <sstream>
#include "include/base/cef_logging.h" #include "include/base/cef_logging.h"
#include "include/base/cef_macros.h"
#include "include/cef_stream.h" #include "include/cef_stream.h"
namespace { namespace {
@ -17,6 +16,9 @@ class CefXmlObjectLoader {
explicit CefXmlObjectLoader(CefRefPtr<CefXmlObject> root_object) explicit CefXmlObjectLoader(CefRefPtr<CefXmlObject> root_object)
: root_object_(root_object) {} : root_object_(root_object) {}
CefXmlObjectLoader(const CefXmlObjectLoader&) = delete;
CefXmlObjectLoader& operator=(const CefXmlObjectLoader&) = delete;
bool Load(CefRefPtr<CefStreamReader> stream, bool Load(CefRefPtr<CefStreamReader> stream,
CefXmlReader::EncodingType encodingType, CefXmlReader::EncodingType encodingType,
const CefString& URI) { const CefString& URI) {
@ -151,8 +153,6 @@ class CefXmlObjectLoader {
private: private:
CefString load_error_; CefString load_error_;
CefRefPtr<CefXmlObject> root_object_; CefRefPtr<CefXmlObject> root_object_;
DISALLOW_COPY_AND_ASSIGN(CefXmlObjectLoader);
}; };
} // namespace } // namespace

View File

@ -8,7 +8,6 @@
#include <memory> #include <memory>
#include "include/base/cef_logging.h" #include "include/base/cef_logging.h"
#include "include/base/cef_macros.h"
#include "include/cef_stream.h" #include "include/cef_stream.h"
#include "include/cef_zip_reader.h" #include "include/cef_zip_reader.h"
#include "include/wrapper/cef_byte_read_handler.h" #include "include/wrapper/cef_byte_read_handler.h"
@ -30,6 +29,9 @@ class CefZipFile : public CefZipArchive::File {
public: public:
CefZipFile() : data_size_(0) {} CefZipFile() : data_size_(0) {}
CefZipFile(const CefZipFile&) = delete;
CefZipFile& operator=(const CefZipFile&) = delete;
bool Initialize(size_t data_size) { bool Initialize(size_t data_size) {
data_.reset(new unsigned char[data_size]); data_.reset(new unsigned char[data_size]);
if (data_) { if (data_) {
@ -59,7 +61,6 @@ class CefZipFile : public CefZipArchive::File {
std::unique_ptr<unsigned char[]> data_; std::unique_ptr<unsigned char[]> data_;
IMPLEMENT_REFCOUNTING(CefZipFile); IMPLEMENT_REFCOUNTING(CefZipFile);
DISALLOW_COPY_AND_ASSIGN(CefZipFile);
}; };
} // namespace } // namespace