Various fixes related to the C++11/14 update (see issue #3140)

- Convert scoped_ptr to std::unique_ptr from <memory>
- Convert arraysize to base::size from include/base/cef_cxx17_backports.h
- Convert NULL to nullptr
- Include include/base/cef_callback.h instead of include/base/cef_bind.h
- Implicit conversion of CefRefPtr<T> or scoped_refptr<T> to T* is gone;
  use .get() instead

See the issue for additional details.
This commit is contained in:
Marshall Greenblatt
2021-06-17 16:08:01 -04:00
parent 5d438ced79
commit 17fc2b3e3b
141 changed files with 580 additions and 627 deletions

View File

@@ -10,7 +10,6 @@
#include "include/base/cef_macros.h"
#include "include/capi/cef_base_capi.h"
#include "include/cef_base.h"
#include "libcef_dll/ptr_util.h"
#include "libcef_dll/wrapper_types.h"
// Wrap a C structure with a C++ class. This is used when the implementation
@@ -49,7 +48,7 @@ class CefCToCppScoped : public BaseName {
//
// void MyMethod(CefOwnPtr<MyType> obj) {
// // Ownership of the underlying MyType object is passed to my_method().
// my_method(MyTypeCToCpp::UnwrapOwn(obj.Pass()));
// my_method(MyTypeCToCpp::UnwrapOwn(std::move(obj)));
// // |obj| is now NULL.
// }
static StructName* UnwrapOwn(CefOwnPtr<BaseName> c);
@@ -129,7 +128,7 @@ StructName* CefCToCppScoped<ClassName, BaseName, StructName>::UnwrapOwn(
// If the type does not match this object then we need to unwrap as the
// derived type.
if (wrapperStruct->type_ != kWrapperType)
return UnwrapDerivedOwn(wrapperStruct->type_, OWN_PASS(c));
return UnwrapDerivedOwn(wrapperStruct->type_, std::move(c));
StructName* orig_struct = wrapperStruct->struct_;

View File

@@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=ff27c226ced0b2651b858eadea688d164dfa777e$
// $hash=210590ae794f6690729538f2e6ca59d264cb1dc9$
//
#include "libcef_dll/ctocpp/test/translator_test_ctocpp.h"
@@ -1161,7 +1161,7 @@ int CefTranslatorTestCToCpp::SetOwnPtrLibrary(
// Execute
int _retval = _struct->set_own_ptr_library(
_struct, CefTranslatorTestScopedLibraryCToCpp::UnwrapOwn(OWN_PASS(val)));
_struct, CefTranslatorTestScopedLibraryCToCpp::UnwrapOwn(std::move(val)));
// Return type: simple
return _retval;
@@ -1187,7 +1187,7 @@ CefOwnPtr<CefTranslatorTestScopedLibrary> CefTranslatorTestCToCpp::
cef_translator_test_scoped_library_t* _retval =
_struct->set_own_ptr_library_and_return(
_struct,
CefTranslatorTestScopedLibraryCToCpp::UnwrapOwn(OWN_PASS(val)));
CefTranslatorTestScopedLibraryCToCpp::UnwrapOwn(std::move(val)));
// Return type: ownptr_same
return CefTranslatorTestScopedLibraryCToCpp::Wrap(_retval);
@@ -1212,7 +1212,7 @@ int CefTranslatorTestCToCpp::SetChildOwnPtrLibrary(
// Execute
int _retval = _struct->set_child_own_ptr_library(
_struct,
CefTranslatorTestScopedLibraryChildCToCpp::UnwrapOwn(OWN_PASS(val)));
CefTranslatorTestScopedLibraryChildCToCpp::UnwrapOwn(std::move(val)));
// Return type: simple
return _retval;
@@ -1239,7 +1239,7 @@ CefOwnPtr<CefTranslatorTestScopedLibrary> CefTranslatorTestCToCpp::
cef_translator_test_scoped_library_t* _retval =
_struct->set_child_own_ptr_library_and_return_parent(
_struct,
CefTranslatorTestScopedLibraryChildCToCpp::UnwrapOwn(OWN_PASS(val)));
CefTranslatorTestScopedLibraryChildCToCpp::UnwrapOwn(std::move(val)));
// Return type: ownptr_same
return CefTranslatorTestScopedLibraryCToCpp::Wrap(_retval);
@@ -1263,7 +1263,7 @@ int CefTranslatorTestCToCpp::SetOwnPtrClient(
// Execute
int _retval = _struct->set_own_ptr_client(
_struct, CefTranslatorTestScopedClientCppToC::WrapOwn(OWN_PASS(val)));
_struct, CefTranslatorTestScopedClientCppToC::WrapOwn(std::move(val)));
// Return type: simple
return _retval;
@@ -1288,7 +1288,8 @@ CefOwnPtr<CefTranslatorTestScopedClient> CefTranslatorTestCToCpp::
// Execute
cef_translator_test_scoped_client_t* _retval =
_struct->set_own_ptr_client_and_return(
_struct, CefTranslatorTestScopedClientCppToC::WrapOwn(OWN_PASS(val)));
_struct,
CefTranslatorTestScopedClientCppToC::WrapOwn(std::move(val)));
// Return type: ownptr_diff
return CefTranslatorTestScopedClientCppToC::UnwrapOwn(_retval);
@@ -1313,7 +1314,7 @@ int CefTranslatorTestCToCpp::SetChildOwnPtrClient(
// Execute
int _retval = _struct->set_child_own_ptr_client(
_struct,
CefTranslatorTestScopedClientChildCppToC::WrapOwn(OWN_PASS(val)));
CefTranslatorTestScopedClientChildCppToC::WrapOwn(std::move(val)));
// Return type: simple
return _retval;
@@ -1340,7 +1341,7 @@ CefOwnPtr<CefTranslatorTestScopedClient> CefTranslatorTestCToCpp::
cef_translator_test_scoped_client_t* _retval =
_struct->set_child_own_ptr_client_and_return_parent(
_struct,
CefTranslatorTestScopedClientChildCppToC::WrapOwn(OWN_PASS(val)));
CefTranslatorTestScopedClientChildCppToC::WrapOwn(std::move(val)));
// Return type: ownptr_diff
return CefTranslatorTestScopedClientCppToC::UnwrapOwn(_retval);

View File

@@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=bfa7d52202c1d09dfa86e05df4f60f3b9264e19c$
// $hash=3768f0baca452bd0aa50e298dcc2166efd11f3db$
//
#include "libcef_dll/ctocpp/test/translator_test_scoped_client_ctocpp.h"
@@ -68,8 +68,7 @@ CefCToCppScoped<CefTranslatorTestScopedClientCToCpp,
return reinterpret_cast<cef_translator_test_scoped_client_t*>(
CefTranslatorTestScopedClientChildCToCpp::UnwrapRaw(
CefRawPtr<CefTranslatorTestScopedClientChild>(
reinterpret_cast<CefTranslatorTestScopedClientChild*>(
CEF_RAW_PTR_GET(c)))));
reinterpret_cast<CefTranslatorTestScopedClientChild*>(c))));
}
NOTREACHED() << "Unexpected class type: " << type;
return nullptr;

View File

@@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=3218861c702d3419a97a3a49b87898e1afc3d55e$
// $hash=e259f697e1edef88f12eae86d7161a4807438ef7$
//
#include "libcef_dll/ctocpp/test/translator_test_scoped_library_child_ctocpp.h"
@@ -18,9 +18,8 @@
// STATIC METHODS - Body may be edited by hand.
NO_SANITIZE("cfi-icall")
CefOwnPtr<
CefTranslatorTestScopedLibraryChild> CefTranslatorTestScopedLibraryChild::
Create(int value, int other_value) {
CefOwnPtr<CefTranslatorTestScopedLibraryChild>
CefTranslatorTestScopedLibraryChild::Create(int value, int other_value) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
@@ -129,7 +128,7 @@ CefCToCppScoped<CefTranslatorTestScopedLibraryChildCToCpp,
CefTranslatorTestScopedLibraryChildChildCToCpp::UnwrapRaw(
CefRawPtr<CefTranslatorTestScopedLibraryChildChild>(
reinterpret_cast<CefTranslatorTestScopedLibraryChildChild*>(
CEF_RAW_PTR_GET(c)))));
c))));
}
NOTREACHED() << "Unexpected class type: " << type;
return nullptr;

View File

@@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=93bec9c1c78c75b71ca887b790977d027f197a79$
// $hash=589f29aab564ddcd4eaf69e116e2854a46b8048d$
//
#include "libcef_dll/ctocpp/test/translator_test_scoped_library_ctocpp.h"
@@ -19,8 +19,8 @@
// STATIC METHODS - Body may be edited by hand.
NO_SANITIZE("cfi-icall")
CefOwnPtr<CefTranslatorTestScopedLibrary> CefTranslatorTestScopedLibrary::
Create(int value) {
CefOwnPtr<CefTranslatorTestScopedLibrary>
CefTranslatorTestScopedLibrary::Create(int value) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
@@ -103,15 +103,14 @@ CefCToCppScoped<CefTranslatorTestScopedLibraryCToCpp,
return reinterpret_cast<cef_translator_test_scoped_library_t*>(
CefTranslatorTestScopedLibraryChildCToCpp::UnwrapRaw(
CefRawPtr<CefTranslatorTestScopedLibraryChild>(
reinterpret_cast<CefTranslatorTestScopedLibraryChild*>(
CEF_RAW_PTR_GET(c)))));
reinterpret_cast<CefTranslatorTestScopedLibraryChild*>(c))));
}
if (type == WT_TRANSLATOR_TEST_SCOPED_LIBRARY_CHILD_CHILD) {
return reinterpret_cast<cef_translator_test_scoped_library_t*>(
CefTranslatorTestScopedLibraryChildChildCToCpp::UnwrapRaw(
CefRawPtr<CefTranslatorTestScopedLibraryChildChild>(
reinterpret_cast<CefTranslatorTestScopedLibraryChildChild*>(
CEF_RAW_PTR_GET(c)))));
c))));
}
NOTREACHED() << "Unexpected class type: " << type;
return nullptr;