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
#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<CefBaseRefCounted> 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_

View File

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

View File

@ -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<std::string> values_;
DISALLOW_COPY_AND_ASSIGN(CefScopedArgArray);
};
#endif // CEF_INCLUDE_WRAPPER_CEF_HELPERS_H_

View File

@ -36,8 +36,6 @@
#ifdef __cplusplus
#include <string>
#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)

View File

@ -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

View File

@ -41,7 +41,6 @@
#include <memory>
#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<Request> {
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<scoped_refptr<Request>> RequestList;
using RequestList = std::list<scoped_refptr<Request>>;
///
// 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<ProviderEntry*> ProviderEntryList;
using ProviderEntryList = std::list<ProviderEntry*>;
// 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<uint64, CefRefPtr<CefResourceHandler>> PendingHandlersMap;
using PendingHandlersMap = std::map<uint64, CefRefPtr<CefResourceHandler>>;
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<base::WeakPtrFactory<CefResourceManager>> weak_ptr_factory_;
DISALLOW_COPY_AND_ASSIGN(CefResourceManager);
};
#endif // CEF_INCLUDE_WRAPPER_CEF_RESOURCE_MANAGER_H_

View File

@ -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_

View File

@ -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<CefStreamReader> stream);
CefStreamResourceHandler(const CefStreamResourceHandler&) = delete;
CefStreamResourceHandler& operator=(const CefStreamResourceHandler&) = delete;
// CefResourceHandler methods.
bool Open(CefRefPtr<CefRequest> request,
bool& handle_request,
@ -82,7 +84,6 @@ class CefStreamResourceHandler : public CefResourceHandler {
const CefRefPtr<CefStreamReader> stream_;
IMPLEMENT_REFCOUNTING(CefStreamResourceHandler);
DISALLOW_COPY_AND_ASSIGN(CefStreamResourceHandler);
};
#endif // CEF_INCLUDE_WRAPPER_CEF_STREAM_RESOURCE_HANDLER_H_

View File

@ -41,7 +41,6 @@
#include <vector>
#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<CefXmlObject> {
public:
typedef std::vector<CefRefPtr<CefXmlObject>> ObjectVector;
typedef std::map<CefString, CefString> AttributeMap;
using ObjectVector = std::vector<CefRefPtr<CefXmlObject>>;
using AttributeMap = std::map<CefString, CefString>;
///
// 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);
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<CefXmlObject> {
ObjectVector children_;
base::Lock lock_;
DISALLOW_COPY_AND_ASSIGN(CefXmlObject);
};
#endif // CEF_INCLUDE_WRAPPER_CEF_XML_OBJECT_H_

View File

@ -40,7 +40,6 @@
#include <map>
#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<CefZipArchive> {
virtual CefRefPtr<CefStreamReader> GetStreamReader() const = 0;
};
typedef std::map<CefString, CefRefPtr<File>> FileMap;
using FileMap = std::map<CefString, CefRefPtr<File>>;
///
// 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<CefZipArchive> {
FileMap contents_;
mutable base::Lock lock_;
DISALLOW_COPY_AND_ASSIGN(CefZipArchive);
};
#endif // CEF_INCLUDE_WRAPPER_CEF_ZIP_ARCHIVE_H_