Add support for non-ref-counted interface classes (issue #2090)

This commit is contained in:
Marshall Greenblatt
2017-02-07 16:25:11 -05:00
parent 9dd0ca2661
commit 07ba48b082
98 changed files with 6369 additions and 1825 deletions

View File

@ -390,16 +390,26 @@
'libcef_dll/cpptoc/thread_cpptoc.h',
'libcef_dll/cpptoc/test/translator_test_cpptoc.cc',
'libcef_dll/cpptoc/test/translator_test_cpptoc.h',
'libcef_dll/ctocpp/test/translator_test_handler_ctocpp.cc',
'libcef_dll/ctocpp/test/translator_test_handler_ctocpp.h',
'libcef_dll/ctocpp/test/translator_test_handler_child_ctocpp.cc',
'libcef_dll/ctocpp/test/translator_test_handler_child_ctocpp.h',
'libcef_dll/cpptoc/test/translator_test_object_cpptoc.cc',
'libcef_dll/cpptoc/test/translator_test_object_cpptoc.h',
'libcef_dll/cpptoc/test/translator_test_object_child_cpptoc.cc',
'libcef_dll/cpptoc/test/translator_test_object_child_cpptoc.h',
'libcef_dll/cpptoc/test/translator_test_object_child_child_cpptoc.cc',
'libcef_dll/cpptoc/test/translator_test_object_child_child_cpptoc.h',
'libcef_dll/ctocpp/test/translator_test_ref_ptr_client_ctocpp.cc',
'libcef_dll/ctocpp/test/translator_test_ref_ptr_client_ctocpp.h',
'libcef_dll/ctocpp/test/translator_test_ref_ptr_client_child_ctocpp.cc',
'libcef_dll/ctocpp/test/translator_test_ref_ptr_client_child_ctocpp.h',
'libcef_dll/cpptoc/test/translator_test_ref_ptr_library_cpptoc.cc',
'libcef_dll/cpptoc/test/translator_test_ref_ptr_library_cpptoc.h',
'libcef_dll/cpptoc/test/translator_test_ref_ptr_library_child_cpptoc.cc',
'libcef_dll/cpptoc/test/translator_test_ref_ptr_library_child_cpptoc.h',
'libcef_dll/cpptoc/test/translator_test_ref_ptr_library_child_child_cpptoc.cc',
'libcef_dll/cpptoc/test/translator_test_ref_ptr_library_child_child_cpptoc.h',
'libcef_dll/ctocpp/test/translator_test_scoped_client_ctocpp.cc',
'libcef_dll/ctocpp/test/translator_test_scoped_client_ctocpp.h',
'libcef_dll/ctocpp/test/translator_test_scoped_client_child_ctocpp.cc',
'libcef_dll/ctocpp/test/translator_test_scoped_client_child_ctocpp.h',
'libcef_dll/cpptoc/test/translator_test_scoped_library_cpptoc.cc',
'libcef_dll/cpptoc/test/translator_test_scoped_library_cpptoc.h',
'libcef_dll/cpptoc/test/translator_test_scoped_library_child_cpptoc.cc',
'libcef_dll/cpptoc/test/translator_test_scoped_library_child_cpptoc.h',
'libcef_dll/cpptoc/test/translator_test_scoped_library_child_child_cpptoc.cc',
'libcef_dll/cpptoc/test/translator_test_scoped_library_child_child_cpptoc.h',
'libcef_dll/cpptoc/urlrequest_cpptoc.cc',
'libcef_dll/cpptoc/urlrequest_cpptoc.h',
'libcef_dll/ctocpp/urlrequest_client_ctocpp.cc',
@ -652,16 +662,26 @@
'libcef_dll/ctocpp/thread_ctocpp.h',
'libcef_dll/ctocpp/test/translator_test_ctocpp.cc',
'libcef_dll/ctocpp/test/translator_test_ctocpp.h',
'libcef_dll/cpptoc/test/translator_test_handler_cpptoc.cc',
'libcef_dll/cpptoc/test/translator_test_handler_cpptoc.h',
'libcef_dll/cpptoc/test/translator_test_handler_child_cpptoc.cc',
'libcef_dll/cpptoc/test/translator_test_handler_child_cpptoc.h',
'libcef_dll/ctocpp/test/translator_test_object_ctocpp.cc',
'libcef_dll/ctocpp/test/translator_test_object_ctocpp.h',
'libcef_dll/ctocpp/test/translator_test_object_child_ctocpp.cc',
'libcef_dll/ctocpp/test/translator_test_object_child_ctocpp.h',
'libcef_dll/ctocpp/test/translator_test_object_child_child_ctocpp.cc',
'libcef_dll/ctocpp/test/translator_test_object_child_child_ctocpp.h',
'libcef_dll/cpptoc/test/translator_test_ref_ptr_client_cpptoc.cc',
'libcef_dll/cpptoc/test/translator_test_ref_ptr_client_cpptoc.h',
'libcef_dll/cpptoc/test/translator_test_ref_ptr_client_child_cpptoc.cc',
'libcef_dll/cpptoc/test/translator_test_ref_ptr_client_child_cpptoc.h',
'libcef_dll/ctocpp/test/translator_test_ref_ptr_library_ctocpp.cc',
'libcef_dll/ctocpp/test/translator_test_ref_ptr_library_ctocpp.h',
'libcef_dll/ctocpp/test/translator_test_ref_ptr_library_child_ctocpp.cc',
'libcef_dll/ctocpp/test/translator_test_ref_ptr_library_child_ctocpp.h',
'libcef_dll/ctocpp/test/translator_test_ref_ptr_library_child_child_ctocpp.cc',
'libcef_dll/ctocpp/test/translator_test_ref_ptr_library_child_child_ctocpp.h',
'libcef_dll/cpptoc/test/translator_test_scoped_client_cpptoc.cc',
'libcef_dll/cpptoc/test/translator_test_scoped_client_cpptoc.h',
'libcef_dll/cpptoc/test/translator_test_scoped_client_child_cpptoc.cc',
'libcef_dll/cpptoc/test/translator_test_scoped_client_child_cpptoc.h',
'libcef_dll/ctocpp/test/translator_test_scoped_library_ctocpp.cc',
'libcef_dll/ctocpp/test/translator_test_scoped_library_ctocpp.h',
'libcef_dll/ctocpp/test/translator_test_scoped_library_child_ctocpp.cc',
'libcef_dll/ctocpp/test/translator_test_scoped_library_child_ctocpp.h',
'libcef_dll/ctocpp/test/translator_test_scoped_library_child_child_ctocpp.cc',
'libcef_dll/ctocpp/test/translator_test_scoped_library_child_child_ctocpp.h',
'libcef_dll/ctocpp/urlrequest_ctocpp.cc',
'libcef_dll/ctocpp/urlrequest_ctocpp.h',
'libcef_dll/cpptoc/urlrequest_client_cpptoc.cc',

View File

@ -89,11 +89,16 @@
],
'libcef_sources_common': [
'libcef_dll/cpptoc/cpptoc.h',
'libcef_dll/cpptoc/cpptoc_scoped.h',
'libcef_dll/ctocpp/base_ctocpp.cc',
'libcef_dll/ctocpp/base_ctocpp.h',
'libcef_dll/ctocpp/base_scoped_ctocpp.cc',
'libcef_dll/ctocpp/base_scoped_ctocpp.h',
'libcef_dll/ctocpp/ctocpp.h',
'libcef_dll/ctocpp/ctocpp_scoped.h',
'libcef_dll/libcef_dll.cc',
'libcef_dll/libcef_dll2.cc',
'libcef_dll/ptr_util.h',
'libcef_dll/resource.h',
'libcef_dll/transfer_util.cc',
'libcef_dll/transfer_util.h',
@ -116,8 +121,13 @@
'libcef_dll_wrapper_sources_common': [
'libcef_dll/cpptoc/base_cpptoc.cc',
'libcef_dll/cpptoc/base_cpptoc.h',
'libcef_dll/cpptoc/base_scoped_cpptoc.cc',
'libcef_dll/cpptoc/base_scoped_cpptoc.h',
'libcef_dll/cpptoc/cpptoc.h',
'libcef_dll/cpptoc/cpptoc_scoped.h',
'libcef_dll/ctocpp/ctocpp.h',
'libcef_dll/ctocpp/ctocpp_scoped.h',
'libcef_dll/ptr_util.h',
'libcef_dll/transfer_util.cc',
'libcef_dll/transfer_util.h',
'libcef_dll/wrapper_types.h',

View File

@ -189,4 +189,13 @@
#endif
#endif // OVERRIDE
// Check for C++11 template alias support which was added in VS2013 and GCC4.7.
// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2258.pdf
#if __cplusplus > 199711L || \
(defined(_MSC_VER) && _MSC_VER >= 1800) || \
(defined(__GNUC__) && \
(__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__ >= 40700))
#define HAS_CPP11_TEMPLATE_ALIAS_SUPPORT
#endif
#endif // CEF_INCLUDE_BASE_CEF_BUILD_H_

View File

@ -45,8 +45,7 @@ extern "C" {
#endif
///
// Structure defining the reference count implementation functions. All
// framework structures must include the cef_base_t structure first.
// All ref-counted framework structures must include this structure first.
///
typedef struct _cef_base_t {
///
@ -74,6 +73,23 @@ typedef struct _cef_base_t {
} cef_base_t;
///
// All scoped framework structures must include this structure first.
///
typedef struct _cef_base_scoped_t {
///
// Size of the data structure.
///
size_t size;
///
// Called to delete this object. May be NULL if the object is not owned.
///
void (CEF_CALLBACK *del)(struct _cef_base_scoped_t* self);
} cef_base_scoped_t;
// Check that the structure |s|, which is defined with a cef_base_t member named
// |base|, is large enough to contain the specified member |f|.
#define CEF_MEMBER_EXISTS(s, f) \

View File

@ -58,7 +58,7 @@ typedef struct _cef_scheme_registrar_t {
///
// Base structure.
///
cef_base_t base;
cef_base_scoped_t base;
///
// Register a custom scheme. This function should not be called for the built-

View File

@ -49,10 +49,14 @@
extern "C" {
#endif
struct _cef_translator_test_handler_child_t;
struct _cef_translator_test_handler_t;
struct _cef_translator_test_object_child_t;
struct _cef_translator_test_object_t;
struct _cef_translator_test_ref_ptr_client_child_t;
struct _cef_translator_test_ref_ptr_client_t;
struct _cef_translator_test_ref_ptr_library_child_t;
struct _cef_translator_test_ref_ptr_library_t;
struct _cef_translator_test_scoped_client_child_t;
struct _cef_translator_test_scoped_client_t;
struct _cef_translator_test_scoped_library_child_t;
struct _cef_translator_test_scoped_library_t;
///
// Structure for testing all of the possible data transfer types.
@ -242,124 +246,271 @@ typedef struct _cef_translator_test_t {
struct _cef_translator_test_t* self);
// LIBRARY-SIDE OBJECT VALUES
// LIBRARY-SIDE REFPTR VALUES
///
// Return an new library-side object.
///
struct _cef_translator_test_object_t* (CEF_CALLBACK *get_object)(
struct _cef_translator_test_t* self, int val);
struct _cef_translator_test_ref_ptr_library_t* (
CEF_CALLBACK *get_ref_ptr_library)(struct _cef_translator_test_t* self,
int val);
///
// Set an object. Returns the value from
// cef_translator_test_object_t::get_value(). This tests input and execution
// of a library-side object type.
// cef_translator_test_ref_ptr_library_t::get_value(). This tests input and
// execution of a library-side object type.
///
int (CEF_CALLBACK *set_object)(struct _cef_translator_test_t* self,
struct _cef_translator_test_object_t* val);
int (CEF_CALLBACK *set_ref_ptr_library)(struct _cef_translator_test_t* self,
struct _cef_translator_test_ref_ptr_library_t* val);
///
// Set an object. Returns the object passed in. This tests input and output of
// a library-side object type.
///
struct _cef_translator_test_object_t* (CEF_CALLBACK *set_object_and_return)(
struct _cef_translator_test_ref_ptr_library_t* (
CEF_CALLBACK *set_ref_ptr_library_and_return)(
struct _cef_translator_test_t* self,
struct _cef_translator_test_object_t* val);
struct _cef_translator_test_ref_ptr_library_t* val);
///
// Set a child object. Returns the value from
// cef_translator_test_object_t::get_value(). This tests input of a library-
// side child object type and execution as the parent type.
// cef_translator_test_ref_ptr_library_t::get_value(). This tests input of a
// library- side child object type and execution as the parent type.
///
int (CEF_CALLBACK *set_child_object)(struct _cef_translator_test_t* self,
struct _cef_translator_test_object_child_t* val);
int (CEF_CALLBACK *set_child_ref_ptr_library)(
struct _cef_translator_test_t* self,
struct _cef_translator_test_ref_ptr_library_child_t* val);
///
// Set a child object. Returns the object as the parent type. This tests input
// of a library-side child object type and return as the parent type.
///
struct _cef_translator_test_object_t* (
CEF_CALLBACK *set_child_object_and_return_parent)(
struct _cef_translator_test_ref_ptr_library_t* (
CEF_CALLBACK *set_child_ref_ptr_library_and_return_parent)(
struct _cef_translator_test_t* self,
struct _cef_translator_test_object_child_t* val);
struct _cef_translator_test_ref_ptr_library_child_t* val);
///
// Set an object list vlaue.
///
int (CEF_CALLBACK *set_object_list)(struct _cef_translator_test_t* self,
size_t valCount, struct _cef_translator_test_object_t* const* val,
int val1, int val2);
int (CEF_CALLBACK *set_ref_ptr_library_list)(
struct _cef_translator_test_t* self, size_t valCount,
struct _cef_translator_test_ref_ptr_library_t* const* val, int val1,
int val2);
///
// Return an object list value by out-param.
///
int (CEF_CALLBACK *get_object_list_by_ref)(
int (CEF_CALLBACK *get_ref_ptr_library_list_by_ref)(
struct _cef_translator_test_t* self, size_t* valCount,
struct _cef_translator_test_object_t** val, int val1, int val2);
struct _cef_translator_test_ref_ptr_library_t** val, int val1,
int val2);
///
// Return the number of object that will be output above.
///
size_t (CEF_CALLBACK *get_object_list_size)(
size_t (CEF_CALLBACK *get_ref_ptr_library_list_size)(
struct _cef_translator_test_t* self);
// CLIENT-SIDE OBJECT VALUES
// CLIENT-SIDE REFPTR VALUES
///
// Set an object. Returns the value from
// cef_translator_test_handler_t::get_value(). This tests input and execution
// of a client-side object type.
// cef_translator_test_ref_ptr_client_t::get_value(). This tests input and
// execution of a client-side object type.
///
int (CEF_CALLBACK *set_handler)(struct _cef_translator_test_t* self,
struct _cef_translator_test_handler_t* val);
int (CEF_CALLBACK *set_ref_ptr_client)(struct _cef_translator_test_t* self,
struct _cef_translator_test_ref_ptr_client_t* val);
///
// Set an object. Returns the handler passed in. This tests input and output
// of a client-side object type.
///
struct _cef_translator_test_handler_t* (CEF_CALLBACK *set_handler_and_return)(
struct _cef_translator_test_ref_ptr_client_t* (
CEF_CALLBACK *set_ref_ptr_client_and_return)(
struct _cef_translator_test_t* self,
struct _cef_translator_test_handler_t* val);
struct _cef_translator_test_ref_ptr_client_t* val);
///
// Set a child object. Returns the value from
// cef_translator_test_handler_t::get_value(). This tests input of a client-
// side child object type and execution as the parent type.
// cef_translator_test_ref_ptr_client_t::get_value(). This tests input of a
// client- side child object type and execution as the parent type.
///
int (CEF_CALLBACK *set_child_handler)(struct _cef_translator_test_t* self,
struct _cef_translator_test_handler_child_t* val);
int (CEF_CALLBACK *set_child_ref_ptr_client)(
struct _cef_translator_test_t* self,
struct _cef_translator_test_ref_ptr_client_child_t* val);
///
// Set a child object. Returns the object as the parent type. This tests input
// of a client-side child object type and return as the parent type.
///
struct _cef_translator_test_handler_t* (
CEF_CALLBACK *set_child_handler_and_return_parent)(
struct _cef_translator_test_ref_ptr_client_t* (
CEF_CALLBACK *set_child_ref_ptr_client_and_return_parent)(
struct _cef_translator_test_t* self,
struct _cef_translator_test_handler_child_t* val);
struct _cef_translator_test_ref_ptr_client_child_t* val);
///
// Set an object list vlaue.
///
int (CEF_CALLBACK *set_handler_list)(struct _cef_translator_test_t* self,
size_t valCount, struct _cef_translator_test_handler_t* const* val,
int val1, int val2);
int (CEF_CALLBACK *set_ref_ptr_client_list)(
struct _cef_translator_test_t* self, size_t valCount,
struct _cef_translator_test_ref_ptr_client_t* const* val, int val1,
int val2);
///
// Return an object list value by out-param.
///
int (CEF_CALLBACK *get_handler_list_by_ref)(
int (CEF_CALLBACK *get_ref_ptr_client_list_by_ref)(
struct _cef_translator_test_t* self, size_t* valCount,
struct _cef_translator_test_handler_t** val,
struct _cef_translator_test_handler_t* val1,
struct _cef_translator_test_handler_t* val2);
struct _cef_translator_test_ref_ptr_client_t** val,
struct _cef_translator_test_ref_ptr_client_t* val1,
struct _cef_translator_test_ref_ptr_client_t* val2);
///
// Return the number of object that will be output above.
///
size_t (CEF_CALLBACK *get_handler_list_size)(
size_t (CEF_CALLBACK *get_ref_ptr_client_list_size)(
struct _cef_translator_test_t* self);
// LIBRARY-SIDE OWNPTR VALUES
///
// Return an new library-side object.
///
struct _cef_translator_test_scoped_library_t* (
CEF_CALLBACK *get_own_ptr_library)(struct _cef_translator_test_t* self,
int val);
///
// Set an object. Returns the value from
// cef_translator_test_scoped_library_t::get_value(). This tests input and
// execution of a library-side object type.
///
int (CEF_CALLBACK *set_own_ptr_library)(struct _cef_translator_test_t* self,
struct _cef_translator_test_scoped_library_t* val);
///
// Set an object. Returns the object passed in. This tests input and output of
// a library-side object type.
///
struct _cef_translator_test_scoped_library_t* (
CEF_CALLBACK *set_own_ptr_library_and_return)(
struct _cef_translator_test_t* self,
struct _cef_translator_test_scoped_library_t* val);
///
// Set a child object. Returns the value from
// cef_translator_test_scoped_library_t::get_value(). This tests input of a
// library- side child object type and execution as the parent type.
///
int (CEF_CALLBACK *set_child_own_ptr_library)(
struct _cef_translator_test_t* self,
struct _cef_translator_test_scoped_library_child_t* val);
///
// Set a child object. Returns the object as the parent type. This tests input
// of a library-side child object type and return as the parent type.
///
struct _cef_translator_test_scoped_library_t* (
CEF_CALLBACK *set_child_own_ptr_library_and_return_parent)(
struct _cef_translator_test_t* self,
struct _cef_translator_test_scoped_library_child_t* val);
// CLIENT-SIDE OWNPTR VALUES
///
// Set an object. Returns the value from
// cef_translator_test_scoped_client_t::get_value(). This tests input and
// execution of a client-side object type.
///
int (CEF_CALLBACK *set_own_ptr_client)(struct _cef_translator_test_t* self,
struct _cef_translator_test_scoped_client_t* val);
///
// Set an object. Returns the handler passed in. This tests input and output
// of a client-side object type.
///
struct _cef_translator_test_scoped_client_t* (
CEF_CALLBACK *set_own_ptr_client_and_return)(
struct _cef_translator_test_t* self,
struct _cef_translator_test_scoped_client_t* val);
///
// Set a child object. Returns the value from
// cef_translator_test_scoped_client_t::get_value(). This tests input of a
// client- side child object type and execution as the parent type.
///
int (CEF_CALLBACK *set_child_own_ptr_client)(
struct _cef_translator_test_t* self,
struct _cef_translator_test_scoped_client_child_t* val);
///
// Set a child object. Returns the object as the parent type. This tests input
// of a client-side child object type and return as the parent type.
///
struct _cef_translator_test_scoped_client_t* (
CEF_CALLBACK *set_child_own_ptr_client_and_return_parent)(
struct _cef_translator_test_t* self,
struct _cef_translator_test_scoped_client_child_t* val);
// LIBRARY-SIDE RAWPTR VALUES
///
// Set an object. Returns the value from
// cef_translator_test_scoped_library_t::get_value(). This tests input and
// execution of a library-side object type.
///
int (CEF_CALLBACK *set_raw_ptr_library)(struct _cef_translator_test_t* self,
struct _cef_translator_test_scoped_library_t* val);
///
// Set a child object. Returns the value from
// cef_translator_test_scoped_library_t::get_value(). This tests input of a
// library- side child object type and execution as the parent type.
///
int (CEF_CALLBACK *set_child_raw_ptr_library)(
struct _cef_translator_test_t* self,
struct _cef_translator_test_scoped_library_child_t* val);
///
// Set an object list vlaue.
///
int (CEF_CALLBACK *set_raw_ptr_library_list)(
struct _cef_translator_test_t* self, size_t valCount,
struct _cef_translator_test_scoped_library_t* const* val, int val1,
int val2);
// CLIENT-SIDE RAWPTR VALUES
///
// Set an object. Returns the value from
// cef_translator_test_scoped_client_t::get_value(). This tests input and
// execution of a client-side object type.
///
int (CEF_CALLBACK *set_raw_ptr_client)(struct _cef_translator_test_t* self,
struct _cef_translator_test_scoped_client_t* val);
///
// Set a child object. Returns the value from
// cef_translator_test_scoped_client_t::get_value(). This tests input of a
// client- side child object type and execution as the parent type.
///
int (CEF_CALLBACK *set_child_raw_ptr_client)(
struct _cef_translator_test_t* self,
struct _cef_translator_test_scoped_client_child_t* val);
///
// Set an object list vlaue.
///
int (CEF_CALLBACK *set_raw_ptr_client_list)(
struct _cef_translator_test_t* self, size_t valCount,
struct _cef_translator_test_scoped_client_t* const* val, int val1,
int val2);
} cef_translator_test_t;
@ -370,9 +521,9 @@ CEF_EXPORT cef_translator_test_t* cef_translator_test_create();
///
// Library-side test object.
// Library-side test object for RefPtr.
///
typedef struct _cef_translator_test_object_t {
typedef struct _cef_translator_test_ref_ptr_library_t {
///
// Base structure.
///
@ -381,87 +532,89 @@ typedef struct _cef_translator_test_object_t {
///
// Return a value.
///
int (CEF_CALLBACK *get_value)(struct _cef_translator_test_object_t* self);
int (CEF_CALLBACK *get_value)(
struct _cef_translator_test_ref_ptr_library_t* self);
///
// Set a value.
///
void (CEF_CALLBACK *set_value)(struct _cef_translator_test_object_t* self,
int value);
} cef_translator_test_object_t;
void (CEF_CALLBACK *set_value)(
struct _cef_translator_test_ref_ptr_library_t* self, int value);
} cef_translator_test_ref_ptr_library_t;
///
// Create the test object.
///
CEF_EXPORT cef_translator_test_object_t* cef_translator_test_object_create(
CEF_EXPORT cef_translator_test_ref_ptr_library_t* cef_translator_test_ref_ptr_library_create(
int value);
///
// Library-side child test object.
// Library-side child test object for RefPtr.
///
typedef struct _cef_translator_test_object_child_t {
typedef struct _cef_translator_test_ref_ptr_library_child_t {
///
// Base structure.
///
cef_translator_test_object_t base;
cef_translator_test_ref_ptr_library_t base;
///
// Return a value.
///
int (CEF_CALLBACK *get_other_value)(
struct _cef_translator_test_object_child_t* self);
struct _cef_translator_test_ref_ptr_library_child_t* self);
///
// Set a value.
///
void (CEF_CALLBACK *set_other_value)(
struct _cef_translator_test_object_child_t* self, int value);
} cef_translator_test_object_child_t;
struct _cef_translator_test_ref_ptr_library_child_t* self, int value);
} cef_translator_test_ref_ptr_library_child_t;
///
// Create the test object.
///
CEF_EXPORT cef_translator_test_object_child_t* cef_translator_test_object_child_create(
CEF_EXPORT cef_translator_test_ref_ptr_library_child_t* cef_translator_test_ref_ptr_library_child_create(
int value, int other_value);
///
// Another library-side child test object.
// Another library-side child test object for RefPtr.
///
typedef struct _cef_translator_test_object_child_child_t {
typedef struct _cef_translator_test_ref_ptr_library_child_child_t {
///
// Base structure.
///
cef_translator_test_object_child_t base;
cef_translator_test_ref_ptr_library_child_t base;
///
// Return a value.
///
int (CEF_CALLBACK *get_other_other_value)(
struct _cef_translator_test_object_child_child_t* self);
struct _cef_translator_test_ref_ptr_library_child_child_t* self);
///
// Set a value.
///
void (CEF_CALLBACK *set_other_other_value)(
struct _cef_translator_test_object_child_child_t* self, int value);
} cef_translator_test_object_child_child_t;
struct _cef_translator_test_ref_ptr_library_child_child_t* self,
int value);
} cef_translator_test_ref_ptr_library_child_child_t;
///
// Create the test object.
///
CEF_EXPORT cef_translator_test_object_child_child_t* cef_translator_test_object_child_child_create(
CEF_EXPORT cef_translator_test_ref_ptr_library_child_child_t* cef_translator_test_ref_ptr_library_child_child_create(
int value, int other_value, int other_other_value);
///
// Client-side test object.
// Client-side test object for RefPtr.
///
typedef struct _cef_translator_test_handler_t {
typedef struct _cef_translator_test_ref_ptr_client_t {
///
// Base structure.
///
@ -470,25 +623,151 @@ typedef struct _cef_translator_test_handler_t {
///
// Return a value.
///
int (CEF_CALLBACK *get_value)(struct _cef_translator_test_handler_t* self);
} cef_translator_test_handler_t;
int (CEF_CALLBACK *get_value)(
struct _cef_translator_test_ref_ptr_client_t* self);
} cef_translator_test_ref_ptr_client_t;
///
// Client-side child test object.
// Client-side child test object for RefPtr.
///
typedef struct _cef_translator_test_handler_child_t {
typedef struct _cef_translator_test_ref_ptr_client_child_t {
///
// Base structure.
///
cef_translator_test_handler_t base;
cef_translator_test_ref_ptr_client_t base;
///
// Return a value.
///
int (CEF_CALLBACK *get_other_value)(
struct _cef_translator_test_handler_child_t* self);
} cef_translator_test_handler_child_t;
struct _cef_translator_test_ref_ptr_client_child_t* self);
} cef_translator_test_ref_ptr_client_child_t;
///
// Library-side test object for OwnPtr/RawPtr.
///
typedef struct _cef_translator_test_scoped_library_t {
///
// Base structure.
///
cef_base_scoped_t base;
///
// Return a value.
///
int (CEF_CALLBACK *get_value)(
struct _cef_translator_test_scoped_library_t* self);
///
// Set a value.
///
void (CEF_CALLBACK *set_value)(
struct _cef_translator_test_scoped_library_t* self, int value);
} cef_translator_test_scoped_library_t;
///
// Create the test object.
///
CEF_EXPORT cef_translator_test_scoped_library_t* cef_translator_test_scoped_library_create(
int value);
///
// Library-side child test object for OwnPtr/RawPtr.
///
typedef struct _cef_translator_test_scoped_library_child_t {
///
// Base structure.
///
cef_translator_test_scoped_library_t base;
///
// Return a value.
///
int (CEF_CALLBACK *get_other_value)(
struct _cef_translator_test_scoped_library_child_t* self);
///
// Set a value.
///
void (CEF_CALLBACK *set_other_value)(
struct _cef_translator_test_scoped_library_child_t* self, int value);
} cef_translator_test_scoped_library_child_t;
///
// Create the test object.
///
CEF_EXPORT cef_translator_test_scoped_library_child_t* cef_translator_test_scoped_library_child_create(
int value, int other_value);
///
// Another library-side child test object for OwnPtr/RawPtr.
///
typedef struct _cef_translator_test_scoped_library_child_child_t {
///
// Base structure.
///
cef_translator_test_scoped_library_child_t base;
///
// Return a value.
///
int (CEF_CALLBACK *get_other_other_value)(
struct _cef_translator_test_scoped_library_child_child_t* self);
///
// Set a value.
///
void (CEF_CALLBACK *set_other_other_value)(
struct _cef_translator_test_scoped_library_child_child_t* self,
int value);
} cef_translator_test_scoped_library_child_child_t;
///
// Create the test object.
///
CEF_EXPORT cef_translator_test_scoped_library_child_child_t* cef_translator_test_scoped_library_child_child_create(
int value, int other_value, int other_other_value);
///
// Client-side test object for OwnPtr/RawPtr.
///
typedef struct _cef_translator_test_scoped_client_t {
///
// Base structure.
///
cef_base_scoped_t base;
///
// Return a value.
///
int (CEF_CALLBACK *get_value)(
struct _cef_translator_test_scoped_client_t* self);
} cef_translator_test_scoped_client_t;
///
// Client-side child test object for OwnPtr/RawPtr.
///
typedef struct _cef_translator_test_scoped_client_child_t {
///
// Base structure.
///
cef_translator_test_scoped_client_t base;
///
// Return a value.
///
int (CEF_CALLBACK *get_other_value)(
struct _cef_translator_test_scoped_client_child_t* self);
} cef_translator_test_scoped_client_child_t;
#ifdef __cplusplus

View File

@ -170,7 +170,7 @@ class CefApp : public virtual CefBase {
///
/*--cef()--*/
virtual void OnRegisterCustomSchemes(
CefRefPtr<CefSchemeRegistrar> registrar) {
CefRawPtr<CefSchemeRegistrar> registrar) {
}
///

View File

@ -48,8 +48,7 @@
#endif
///
// Interface defining the reference count implementation methods. All framework
// classes must extend the CefBase class.
// All ref-counted framework classes must extend this class.
///
class CefBase {
public:
@ -74,6 +73,14 @@ class CefBase {
virtual ~CefBase() {}
};
///
// All scoped framework classes must extend this class.
///
class CefBaseScoped {
public:
virtual ~CefBaseScoped() {}
};
///
// Class that implements atomic reference counting.
///

View File

@ -82,7 +82,7 @@ bool CefClearSchemeHandlerFactories();
// Class that manages custom scheme registrations.
///
/*--cef(source=library)--*/
class CefSchemeRegistrar : public virtual CefBase {
class CefSchemeRegistrar : public CefBaseScoped {
public:
///
// Register a custom scheme. This method should not be called for the built-in

View File

@ -32,8 +32,15 @@
#define CEF_INCLUDE_INTERNAL_CEF_PTR_H_
#pragma once
#include "include/base/cef_build.h"
#include "include/base/cef_ref_counted.h"
#if defined(USING_CHROMIUM_INCLUDES)
#include <memory> // For std::unique_ptr.
#else
#include "include/base/cef_scoped_ptr.h"
#endif
///
// Smart pointer implementation that is an alias of scoped_refptr from
// include/base/cef_ref_counted.h.
@ -143,19 +150,83 @@
// </pre>
// </p>
///
#if defined(HAS_CPP11_TEMPLATE_ALIAS_SUPPORT)
template <class T>
class CefRefPtr : public scoped_refptr<T> {
using CefRefPtr = scoped_refptr<T>;
#else
// When template aliases are not supported use a define instead of subclassing
// because it's otherwise hard to get the constructors to behave correctly.
#define CefRefPtr scoped_refptr
#endif
///
// A CefOwnPtr<T> is like a T*, except that the destructor of CefOwnPtr<T>
// automatically deletes the pointer it holds (if any). That is, CefOwnPtr<T>
// owns the T object that it points to. Like a T*, a CefOwnPtr<T> may hold
// either NULL or a pointer to a T object. Also like T*, CefOwnPtr<T> is
// thread-compatible, and once you dereference it, you get the thread safety
// guarantees of T.
///
#if defined(USING_CHROMIUM_INCLUDES)
// Implementation-side code uses std::unique_ptr instead of scoped_ptr.
template <class T, class D = std::default_delete<T>>
using CefOwnPtr = std::unique_ptr<T, D>;
#elif defined(HAS_CPP11_TEMPLATE_ALIAS_SUPPORT)
template <class T, class D = base::DefaultDeleter<T>>
using CefOwnPtr = scoped_ptr<T, D>;
#else
// When template aliases are not supported use a define instead of subclassing
// because it's otherwise hard to get the constructors to behave correctly.
#define CefOwnPtr scoped_ptr
#endif
///
// A CefRawPtr<T> is the same as T*
///
#if defined(HAS_CPP11_TEMPLATE_ALIAS_SUPPORT)
template <class T>
using CefRawPtr = T*;
#else
// Simple wrapper implementation that behaves as much like T* as possible.
template <class T>
class CefRawPtr {
public:
typedef scoped_refptr<T> parent;
CefRefPtr() : parent() {}
CefRefPtr(T* p) : parent(p) {}
CefRefPtr(const scoped_refptr<T>& r) : parent(r) {}
CefRawPtr() : ptr_(nullptr) {}
CefRawPtr(T* p) : ptr_(p) {}
CefRawPtr(const CefRawPtr& r) : ptr_(r.ptr_) {}
template <typename U>
CefRefPtr(const scoped_refptr<U>& r) : parent(r) {}
CefRawPtr(const CefRawPtr<U>& r) : ptr_(r.get()) {}
T* get() const { return ptr_; }
// Allow CefRawPtr to be used in boolean expression and comparison operations.
operator T*() const { return ptr_; }
T* operator->() const {
assert(ptr_ != NULL);
return ptr_;
}
CefRawPtr<T>& operator=(T* p) {
ptr_ = p;
return *this;
}
CefRawPtr<T>& operator=(const CefRawPtr<T>& r) {
return *this = r.ptr_;
}
template <typename U>
CefRawPtr<T>& operator=(const CefRawPtr<U>& r) {
return *this = r.get();
}
private:
T* ptr_;
};
#endif
#endif // CEF_INCLUDE_INTERNAL_CEF_PTR_H_

View File

@ -53,10 +53,14 @@
#include "include/cef_base.h"
class CefTranslatorTestHandler;
class CefTranslatorTestHandlerChild;
class CefTranslatorTestObject;
class CefTranslatorTestObjectChild;
class CefTranslatorTestRefPtrClient;
class CefTranslatorTestRefPtrClientChild;
class CefTranslatorTestRefPtrLibrary;
class CefTranslatorTestRefPtrLibraryChild;
class CefTranslatorTestScopedClient;
class CefTranslatorTestScopedClientChild;
class CefTranslatorTestScopedLibrary;
class CefTranslatorTestScopedLibraryChild;
// Test values.
#define TEST_INT_VAL 5
@ -309,146 +313,311 @@ class CefTranslatorTest : public CefBase {
virtual size_t GetPointListSize() = 0;
// LIBRARY-SIDE OBJECT VALUES
// LIBRARY-SIDE REFPTR VALUES
///
// Return an new library-side object.
///
/*--cef()--*/
virtual CefRefPtr<CefTranslatorTestObject> GetObject(int val) =0;
virtual CefRefPtr<CefTranslatorTestRefPtrLibrary> GetRefPtrLibrary(
int val) =0;
///
// Set an object. Returns the value from CefTranslatorTestObject::GetValue().
// Set an object. Returns the value from
// CefTranslatorTestRefPtrLibrary::GetValue().
// This tests input and execution of a library-side object type.
///
/*--cef()--*/
virtual int SetObject(CefRefPtr<CefTranslatorTestObject> val) =0;
virtual int SetRefPtrLibrary(
CefRefPtr<CefTranslatorTestRefPtrLibrary> val) =0;
///
// Set an object. Returns the object passed in. This tests input and output
// of a library-side object type.
///
/*--cef()--*/
virtual CefRefPtr<CefTranslatorTestObject> SetObjectAndReturn(
CefRefPtr<CefTranslatorTestObject> val) =0;
virtual CefRefPtr<CefTranslatorTestRefPtrLibrary> SetRefPtrLibraryAndReturn(
CefRefPtr<CefTranslatorTestRefPtrLibrary> val) =0;
///
// Set a child object. Returns the value from
// CefTranslatorTestObject::GetValue(). This tests input of a library-side
// child object type and execution as the parent type.
// CefTranslatorTestRefPtrLibrary::GetValue(). This tests input of a library-
// side child object type and execution as the parent type.
///
/*--cef()--*/
virtual int SetChildObject(CefRefPtr<CefTranslatorTestObjectChild> val) =0;
virtual int SetChildRefPtrLibrary(
CefRefPtr<CefTranslatorTestRefPtrLibraryChild> val) =0;
///
// Set a child object. Returns the object as the parent type. This tests input
// of a library-side child object type and return as the parent type.
///
/*--cef()--*/
virtual CefRefPtr<CefTranslatorTestObject> SetChildObjectAndReturnParent(
CefRefPtr<CefTranslatorTestObjectChild> val) =0;
virtual CefRefPtr<CefTranslatorTestRefPtrLibrary>
SetChildRefPtrLibraryAndReturnParent(
CefRefPtr<CefTranslatorTestRefPtrLibraryChild> val) =0;
// LIBRARY-SIDE OBJECT LIST VALUES
// LIBRARY-SIDE REFPTR LIST VALUES
// Test both with and without a typedef.
typedef std::vector<CefRefPtr<CefTranslatorTestObject> > ObjectList;
typedef std::vector<CefRefPtr<CefTranslatorTestRefPtrLibrary> >
RefPtrLibraryList;
///
// Set an object list vlaue.
///
/*--cef()--*/
virtual bool SetObjectList(
const std::vector<CefRefPtr<CefTranslatorTestObject> >& val,
virtual bool SetRefPtrLibraryList(
const std::vector<CefRefPtr<CefTranslatorTestRefPtrLibrary> >& val,
int val1, int val2) =0;
///
// Return an object list value by out-param.
///
/*--cef(count_func=val:GetObjectListSize)--*/
virtual bool GetObjectListByRef(ObjectList& val, int val1, int val2) =0;
/*--cef(count_func=val:GetRefPtrLibraryListSize)--*/
virtual bool GetRefPtrLibraryListByRef(RefPtrLibraryList& val, int val1,
int val2) =0;
///
// Return the number of object that will be output above.
///
/*--cef()--*/
virtual size_t GetObjectListSize() = 0;
virtual size_t GetRefPtrLibraryListSize() = 0;
// CLIENT-SIDE OBJECT VALUES
// CLIENT-SIDE REFPTR VALUES
///
// Set an object. Returns the value from CefTranslatorTestHandler::GetValue().
// Set an object. Returns the value from
// CefTranslatorTestRefPtrClient::GetValue().
// This tests input and execution of a client-side object type.
///
/*--cef()--*/
virtual int SetHandler(CefRefPtr<CefTranslatorTestHandler> val) =0;
virtual int SetRefPtrClient(CefRefPtr<CefTranslatorTestRefPtrClient> val) =0;
///
// Set an object. Returns the handler passed in. This tests input and output
// of a client-side object type.
///
/*--cef()--*/
virtual CefRefPtr<CefTranslatorTestHandler> SetHandlerAndReturn(
CefRefPtr<CefTranslatorTestHandler> val) =0;
virtual CefRefPtr<CefTranslatorTestRefPtrClient> SetRefPtrClientAndReturn(
CefRefPtr<CefTranslatorTestRefPtrClient> val) =0;
///
// Set a child object. Returns the value from
// CefTranslatorTestHandler::GetValue(). This tests input of a client-side
// child object type and execution as the parent type.
// CefTranslatorTestRefPtrClient::GetValue(). This tests input of a client-
// side child object type and execution as the parent type.
///
/*--cef()--*/
virtual int SetChildHandler(CefRefPtr<CefTranslatorTestHandlerChild> val) =0;
virtual int SetChildRefPtrClient(
CefRefPtr<CefTranslatorTestRefPtrClientChild> val) =0;
///
// Set a child object. Returns the object as the parent type. This tests
// input of a client-side child object type and return as the parent type.
///
/*--cef()--*/
virtual CefRefPtr<CefTranslatorTestHandler> SetChildHandlerAndReturnParent(
CefRefPtr<CefTranslatorTestHandlerChild> val) =0;
virtual CefRefPtr<CefTranslatorTestRefPtrClient>
SetChildRefPtrClientAndReturnParent(
CefRefPtr<CefTranslatorTestRefPtrClientChild> val) =0;
// CLIENT-SIDE OBJECT LIST VALUES
// CLIENT-SIDE REFPTR LIST VALUES
// Test both with and without a typedef.
typedef std::vector<CefRefPtr<CefTranslatorTestHandler> > HandlerList;
typedef std::vector<CefRefPtr<CefTranslatorTestRefPtrClient> >
RefPtrClientList;
///
// Set an object list vlaue.
///
/*--cef()--*/
virtual bool SetHandlerList(
const std::vector<CefRefPtr<CefTranslatorTestHandler> >& val,
virtual bool SetRefPtrClientList(
const std::vector<CefRefPtr<CefTranslatorTestRefPtrClient> >& val,
int val1, int val2) =0;
///
// Return an object list value by out-param.
///
/*--cef(count_func=val:GetObjectListSize)--*/
virtual bool GetHandlerListByRef(
HandlerList& val,
CefRefPtr<CefTranslatorTestHandler> val1,
CefRefPtr<CefTranslatorTestHandler> val2) =0;
/*--cef(count_func=val:GetRefPtrLibraryListSize)--*/
virtual bool GetRefPtrClientListByRef(
RefPtrClientList& val,
CefRefPtr<CefTranslatorTestRefPtrClient> val1,
CefRefPtr<CefTranslatorTestRefPtrClient> val2) =0;
///
// Return the number of object that will be output above.
///
/*--cef()--*/
virtual size_t GetHandlerListSize() = 0;
};
virtual size_t GetRefPtrClientListSize() = 0;
// LIBRARY-SIDE OWNPTR VALUES
///
// Library-side test object.
// Return an new library-side object.
///
/*--cef()--*/
virtual CefOwnPtr<CefTranslatorTestScopedLibrary> GetOwnPtrLibrary(
int val) =0;
///
// Set an object. Returns the value from
// CefTranslatorTestScopedLibrary::GetValue().
// This tests input and execution of a library-side object type.
///
/*--cef()--*/
virtual int SetOwnPtrLibrary(
CefOwnPtr<CefTranslatorTestScopedLibrary> val) =0;
///
// Set an object. Returns the object passed in. This tests input and output
// of a library-side object type.
///
/*--cef()--*/
virtual CefOwnPtr<CefTranslatorTestScopedLibrary> SetOwnPtrLibraryAndReturn(
CefOwnPtr<CefTranslatorTestScopedLibrary> val) =0;
///
// Set a child object. Returns the value from
// CefTranslatorTestScopedLibrary::GetValue(). This tests input of a library-
// side child object type and execution as the parent type.
///
/*--cef()--*/
virtual int SetChildOwnPtrLibrary(
CefOwnPtr<CefTranslatorTestScopedLibraryChild> val) =0;
///
// Set a child object. Returns the object as the parent type. This tests input
// of a library-side child object type and return as the parent type.
///
/*--cef()--*/
virtual CefOwnPtr<CefTranslatorTestScopedLibrary>
SetChildOwnPtrLibraryAndReturnParent(
CefOwnPtr<CefTranslatorTestScopedLibraryChild> val) =0;
// CLIENT-SIDE OWNPTR VALUES
///
// Set an object. Returns the value from
// CefTranslatorTestScopedClient::GetValue().
// This tests input and execution of a client-side object type.
///
/*--cef()--*/
virtual int SetOwnPtrClient(CefOwnPtr<CefTranslatorTestScopedClient> val) =0;
///
// Set an object. Returns the handler passed in. This tests input and output
// of a client-side object type.
///
/*--cef()--*/
virtual CefOwnPtr<CefTranslatorTestScopedClient> SetOwnPtrClientAndReturn(
CefOwnPtr<CefTranslatorTestScopedClient> val) =0;
///
// Set a child object. Returns the value from
// CefTranslatorTestScopedClient::GetValue(). This tests input of a client-
// side child object type and execution as the parent type.
///
/*--cef()--*/
virtual int SetChildOwnPtrClient(
CefOwnPtr<CefTranslatorTestScopedClientChild> val) =0;
///
// Set a child object. Returns the object as the parent type. This tests
// input of a client-side child object type and return as the parent type.
///
/*--cef()--*/
virtual CefOwnPtr<CefTranslatorTestScopedClient>
SetChildOwnPtrClientAndReturnParent(
CefOwnPtr<CefTranslatorTestScopedClientChild> val) =0;
// LIBRARY-SIDE RAWPTR VALUES
///
// Set an object. Returns the value from
// CefTranslatorTestScopedLibrary::GetValue().
// This tests input and execution of a library-side object type.
///
/*--cef()--*/
virtual int SetRawPtrLibrary(
CefRawPtr<CefTranslatorTestScopedLibrary> val) =0;
///
// Set a child object. Returns the value from
// CefTranslatorTestScopedLibrary::GetValue(). This tests input of a library-
// side child object type and execution as the parent type.
///
/*--cef()--*/
virtual int SetChildRawPtrLibrary(
CefRawPtr<CefTranslatorTestScopedLibraryChild> val) =0;
// LIBRARY-SIDE RAWPTR LIST VALUES
// Test both with and without a typedef.
typedef std::vector<CefRawPtr<CefTranslatorTestScopedLibrary> >
RawPtrLibraryList;
///
// Set an object list vlaue.
///
/*--cef()--*/
virtual bool SetRawPtrLibraryList(
const std::vector<CefRawPtr<CefTranslatorTestScopedLibrary> >& val,
int val1, int val2) =0;
// CLIENT-SIDE RAWPTR VALUES
///
// Set an object. Returns the value from
// CefTranslatorTestScopedClient::GetValue().
// This tests input and execution of a client-side object type.
///
/*--cef()--*/
virtual int SetRawPtrClient(CefRawPtr<CefTranslatorTestScopedClient> val) =0;
///
// Set a child object. Returns the value from
// CefTranslatorTestScopedClient::GetValue(). This tests input of a client-
// side child object type and execution as the parent type.
///
/*--cef()--*/
virtual int SetChildRawPtrClient(
CefRawPtr<CefTranslatorTestScopedClientChild> val) =0;
// CLIENT-SIDE RAWPTR LIST VALUES
// Test both with and without a typedef.
typedef std::vector<CefRawPtr<CefTranslatorTestScopedClient> >
RawPtrClientList;
///
// Set an object list vlaue.
///
/*--cef()--*/
virtual bool SetRawPtrClientList(
const std::vector<CefRawPtr<CefTranslatorTestScopedClient> >& val,
int val1, int val2) =0;
};
///
// Library-side test object for RefPtr.
///
/*--cef(source=library,no_debugct_check)--*/
class CefTranslatorTestObject : public CefBase {
class CefTranslatorTestRefPtrLibrary : public CefBase {
public:
///
// Create the test object.
///
/*--cef()--*/
static CefRefPtr<CefTranslatorTestObject> Create(int value);
static CefRefPtr<CefTranslatorTestRefPtrLibrary> Create(int value);
///
// Return a value.
@ -464,16 +633,18 @@ class CefTranslatorTestObject : public CefBase {
};
///
// Library-side child test object.
// Library-side child test object for RefPtr.
///
/*--cef(source=library,no_debugct_check)--*/
class CefTranslatorTestObjectChild : public CefTranslatorTestObject {
class CefTranslatorTestRefPtrLibraryChild :
public CefTranslatorTestRefPtrLibrary {
public:
///
// Create the test object.
///
/*--cef()--*/
static CefRefPtr<CefTranslatorTestObjectChild> Create(int value,
static CefRefPtr<CefTranslatorTestRefPtrLibraryChild> Create(
int value,
int other_value);
///
@ -490,16 +661,17 @@ class CefTranslatorTestObjectChild : public CefTranslatorTestObject {
};
///
// Another library-side child test object.
// Another library-side child test object for RefPtr.
///
/*--cef(source=library,no_debugct_check)--*/
class CefTranslatorTestObjectChildChild : public CefTranslatorTestObjectChild {
class CefTranslatorTestRefPtrLibraryChildChild :
public CefTranslatorTestRefPtrLibraryChild {
public:
///
// Create the test object.
///
/*--cef()--*/
static CefRefPtr<CefTranslatorTestObjectChildChild> Create(
static CefRefPtr<CefTranslatorTestRefPtrLibraryChildChild> Create(
int value,
int other_value,
int other_other_value);
@ -518,10 +690,10 @@ class CefTranslatorTestObjectChildChild : public CefTranslatorTestObjectChild {
};
///
// Client-side test object.
// Client-side test object for RefPtr.
///
/*--cef(source=client,no_debugct_check)--*/
class CefTranslatorTestHandler : public virtual CefBase {
class CefTranslatorTestRefPtrClient : public virtual CefBase {
public:
///
// Return a value.
@ -531,10 +703,121 @@ class CefTranslatorTestHandler : public virtual CefBase {
};
///
// Client-side child test object.
// Client-side child test object for RefPtr.
///
/*--cef(source=client,no_debugct_check)--*/
class CefTranslatorTestHandlerChild : public CefTranslatorTestHandler {
class CefTranslatorTestRefPtrClientChild :
public CefTranslatorTestRefPtrClient {
public:
///
// Return a value.
///
/*--cef()--*/
virtual int GetOtherValue() =0;
};
///
// Library-side test object for OwnPtr/RawPtr.
///
/*--cef(source=library,no_debugct_check)--*/
class CefTranslatorTestScopedLibrary : public CefBaseScoped {
public:
///
// Create the test object.
///
/*--cef()--*/
static CefOwnPtr<CefTranslatorTestScopedLibrary> Create(int value);
///
// Return a value.
///
/*--cef()--*/
virtual int GetValue() =0;
///
// Set a value.
///
/*--cef()--*/
virtual void SetValue(int value) =0;
};
///
// Library-side child test object for OwnPtr/RawPtr.
///
/*--cef(source=library,no_debugct_check)--*/
class CefTranslatorTestScopedLibraryChild :
public CefTranslatorTestScopedLibrary {
public:
///
// Create the test object.
///
/*--cef()--*/
static CefOwnPtr<CefTranslatorTestScopedLibraryChild> Create(
int value,
int other_value);
///
// Return a value.
///
/*--cef()--*/
virtual int GetOtherValue() =0;
///
// Set a value.
///
/*--cef()--*/
virtual void SetOtherValue(int value) =0;
};
///
// Another library-side child test object for OwnPtr/RawPtr.
///
/*--cef(source=library,no_debugct_check)--*/
class CefTranslatorTestScopedLibraryChildChild :
public CefTranslatorTestScopedLibraryChild {
public:
///
// Create the test object.
///
/*--cef()--*/
static CefOwnPtr<CefTranslatorTestScopedLibraryChildChild> Create(
int value,
int other_value,
int other_other_value);
///
// Return a value.
///
/*--cef()--*/
virtual int GetOtherOtherValue() =0;
///
// Set a value.
///
/*--cef()--*/
virtual void SetOtherOtherValue(int value) =0;
};
///
// Client-side test object for OwnPtr/RawPtr.
///
/*--cef(source=client,no_debugct_check)--*/
class CefTranslatorTestScopedClient : public virtual CefBaseScoped {
public:
///
// Return a value.
///
/*--cef()--*/
virtual int GetValue() =0;
};
///
// Client-side child test object for OwnPtr/RawPtr.
///
/*--cef(source=client,no_debugct_check)--*/
class CefTranslatorTestScopedClientChild :
public CefTranslatorTestScopedClient {
public:
///
// Return a value.

View File

@ -220,14 +220,9 @@ void CefContentClient::AddAdditionalSchemes(Schemes* schemes) {
DCHECK(!scheme_info_list_locked_);
if (application_.get()) {
CefRefPtr<CefSchemeRegistrarImpl> schemeRegistrar(
new CefSchemeRegistrarImpl());
application_->OnRegisterCustomSchemes(schemeRegistrar.get());
schemeRegistrar->GetSchemes(schemes);
// No references to the registar should be kept.
schemeRegistrar->Detach();
DCHECK(schemeRegistrar->VerifyRefCount());
CefSchemeRegistrarImpl schemeRegistrar;
application_->OnRegisterCustomSchemes(&schemeRegistrar);
schemeRegistrar.GetSchemes(schemes);
}
scheme::AddInternalSchemes(schemes);

View File

@ -24,8 +24,7 @@ void AppendArray(const std::vector<std::string>& source,
}
CefSchemeRegistrarImpl::CefSchemeRegistrarImpl()
: supported_thread_id_(base::PlatformThread::CurrentId()) {
CefSchemeRegistrarImpl::CefSchemeRegistrarImpl() {
}
bool CefSchemeRegistrarImpl::AddCustomScheme(
@ -35,9 +34,6 @@ bool CefSchemeRegistrarImpl::AddCustomScheme(
bool is_display_isolated,
bool is_secure,
bool is_cors_enabled) {
if (!VerifyContext())
return false;
const std::string& scheme = base::ToLowerASCII(scheme_name.ToString());
if (scheme::IsInternalHandledScheme(scheme) ||
registered_schemes_.find(scheme) != registered_schemes_.end()) {
@ -68,30 +64,8 @@ bool CefSchemeRegistrarImpl::AddCustomScheme(
void CefSchemeRegistrarImpl::GetSchemes(
content::ContentClient::Schemes* schemes) {
if (!VerifyContext())
return;
AppendArray(schemes_.standard_schemes, &schemes->standard_schemes);
AppendArray(schemes_.local_schemes, &schemes->local_schemes);
AppendArray(schemes_.secure_schemes, &schemes->secure_schemes);
AppendArray(schemes_.cors_enabled_schemes, &schemes->cors_enabled_schemes);
}
bool CefSchemeRegistrarImpl::VerifyRefCount() {
return HasOneRef();
}
void CefSchemeRegistrarImpl::Detach() {
if (VerifyContext())
supported_thread_id_ = base::kInvalidThreadId;
}
bool CefSchemeRegistrarImpl::VerifyContext() {
if (base::PlatformThread::CurrentId() != supported_thread_id_) {
// This object should only be accessed from the thread that created it.
NOTREACHED();
return false;
}
return true;
}

View File

@ -11,7 +11,6 @@
#include "include/cef_scheme.h"
#include "base/threading/platform_thread.h"
#include "content/public/common/content_client.h"
class CefSchemeRegistrarImpl : public CefSchemeRegistrar {
@ -28,22 +27,13 @@ class CefSchemeRegistrarImpl : public CefSchemeRegistrar {
void GetSchemes(content::ContentClient::Schemes* schemes);
// Verify that only a single reference exists to all CefSchemeRegistrarImpl
// objects.
bool VerifyRefCount();
void Detach();
private:
// Verify that the object is being accessed from the correct thread.
bool VerifyContext();
base::PlatformThreadId supported_thread_id_;
content::ContentClient::Schemes schemes_;
std::set<std::string> registered_schemes_;
IMPLEMENT_REFCOUNTING(CefSchemeRegistrarImpl);
DISALLOW_COPY_AND_ASSIGN(CefSchemeRegistrarImpl);
};

View File

@ -4,9 +4,10 @@
#include "include/test/cef_translator_test.h"
class CefTranslatorTestObjectImpl : public CefTranslatorTestObject {
class CefTranslatorTestRefPtrLibraryImpl :
public CefTranslatorTestRefPtrLibrary {
public:
explicit CefTranslatorTestObjectImpl(int value)
explicit CefTranslatorTestRefPtrLibraryImpl(int value)
: value_(value) {
}
@ -22,18 +23,20 @@ class CefTranslatorTestObjectImpl : public CefTranslatorTestObject {
int value_;
private:
DISALLOW_COPY_AND_ASSIGN(CefTranslatorTestObjectImpl);
IMPLEMENT_REFCOUNTING(CefTranslatorTestObjectImpl);
DISALLOW_COPY_AND_ASSIGN(CefTranslatorTestRefPtrLibraryImpl);
IMPLEMENT_REFCOUNTING(CefTranslatorTestRefPtrLibraryImpl);
};
// static
CefRefPtr<CefTranslatorTestObject> CefTranslatorTestObject::Create(int value) {
return new CefTranslatorTestObjectImpl(value);
CefRefPtr<CefTranslatorTestRefPtrLibrary>
CefTranslatorTestRefPtrLibrary::Create(int value) {
return new CefTranslatorTestRefPtrLibraryImpl(value);
}
class CefTranslatorTestObjectChildImpl : public CefTranslatorTestObjectChild {
class CefTranslatorTestRefPtrLibraryChildImpl :
public CefTranslatorTestRefPtrLibraryChild {
public:
CefTranslatorTestObjectChildImpl(int value, int other_value)
CefTranslatorTestRefPtrLibraryChildImpl(int value, int other_value)
: value_(value),
other_value_(other_value) {
}
@ -59,21 +62,22 @@ class CefTranslatorTestObjectChildImpl : public CefTranslatorTestObjectChild {
int other_value_;
private:
DISALLOW_COPY_AND_ASSIGN(CefTranslatorTestObjectChildImpl);
IMPLEMENT_REFCOUNTING(CefTranslatorTestObjectChildImpl);
DISALLOW_COPY_AND_ASSIGN(CefTranslatorTestRefPtrLibraryChildImpl);
IMPLEMENT_REFCOUNTING(CefTranslatorTestRefPtrLibraryChildImpl);
};
// static
CefRefPtr<CefTranslatorTestObjectChild> CefTranslatorTestObjectChild::Create(
CefRefPtr<CefTranslatorTestRefPtrLibraryChild>
CefTranslatorTestRefPtrLibraryChild::Create(
int value,
int other_value) {
return new CefTranslatorTestObjectChildImpl(value, other_value);
return new CefTranslatorTestRefPtrLibraryChildImpl(value, other_value);
}
class CefTranslatorTestObjectChildChildImpl :
public CefTranslatorTestObjectChildChild {
class CefTranslatorTestRefPtrLibraryChildChildImpl :
public CefTranslatorTestRefPtrLibraryChildChild {
public:
CefTranslatorTestObjectChildChildImpl(int value,
CefTranslatorTestRefPtrLibraryChildChildImpl(int value,
int other_value,
int other_other_value)
: value_(value),
@ -111,20 +115,147 @@ class CefTranslatorTestObjectChildChildImpl :
int other_other_value_;
private:
DISALLOW_COPY_AND_ASSIGN(CefTranslatorTestObjectChildChildImpl);
IMPLEMENT_REFCOUNTING(CefTranslatorTestObjectChildChildImpl);
DISALLOW_COPY_AND_ASSIGN(CefTranslatorTestRefPtrLibraryChildChildImpl);
IMPLEMENT_REFCOUNTING(CefTranslatorTestRefPtrLibraryChildChildImpl);
};
// static
CefRefPtr<CefTranslatorTestObjectChildChild>
CefTranslatorTestObjectChildChild::Create(
CefRefPtr<CefTranslatorTestRefPtrLibraryChildChild>
CefTranslatorTestRefPtrLibraryChildChild::Create(
int value,
int other_value,
int other_other_value) {
return new CefTranslatorTestObjectChildChildImpl(value, other_value,
return new CefTranslatorTestRefPtrLibraryChildChildImpl(value, other_value,
other_other_value);
}
class CefTranslatorTestScopedLibraryImpl :
public CefTranslatorTestScopedLibrary {
public:
explicit CefTranslatorTestScopedLibraryImpl(int value)
: value_(value) {
}
int GetValue() override {
return value_;
}
void SetValue(int value) override {
value_ = value;
}
protected:
int value_;
private:
DISALLOW_COPY_AND_ASSIGN(CefTranslatorTestScopedLibraryImpl);
};
// static
CefOwnPtr<CefTranslatorTestScopedLibrary>
CefTranslatorTestScopedLibrary::Create(int value) {
return CefOwnPtr<CefTranslatorTestScopedLibrary>(
new CefTranslatorTestScopedLibraryImpl(value));
}
class CefTranslatorTestScopedLibraryChildImpl :
public CefTranslatorTestScopedLibraryChild {
public:
CefTranslatorTestScopedLibraryChildImpl(int value, int other_value)
: value_(value),
other_value_(other_value) {
}
int GetValue() override {
return value_;
}
void SetValue(int value) override {
value_ = value;
}
int GetOtherValue() override {
return other_value_;
}
void SetOtherValue(int value) override {
other_value_ = value;
}
protected:
int value_;
int other_value_;
private:
DISALLOW_COPY_AND_ASSIGN(CefTranslatorTestScopedLibraryChildImpl);
};
// static
CefOwnPtr<CefTranslatorTestScopedLibraryChild>
CefTranslatorTestScopedLibraryChild::Create(
int value,
int other_value) {
return CefOwnPtr<CefTranslatorTestScopedLibraryChild>(
new CefTranslatorTestScopedLibraryChildImpl(value, other_value));
}
class CefTranslatorTestScopedLibraryChildChildImpl :
public CefTranslatorTestScopedLibraryChildChild {
public:
CefTranslatorTestScopedLibraryChildChildImpl(int value,
int other_value,
int other_other_value)
: value_(value),
other_value_(other_value),
other_other_value_(other_other_value) {
}
int GetValue() override {
return value_;
}
void SetValue(int value) override {
value_ = value;
}
int GetOtherValue() override {
return other_value_;
}
void SetOtherValue(int value) override {
other_value_ = value;
}
int GetOtherOtherValue() override {
return other_other_value_;
}
void SetOtherOtherValue(int value) override {
other_other_value_ = value;
}
protected:
int value_;
int other_value_;
int other_other_value_;
private:
DISALLOW_COPY_AND_ASSIGN(CefTranslatorTestScopedLibraryChildChildImpl);
};
// static
CefOwnPtr<CefTranslatorTestScopedLibraryChildChild>
CefTranslatorTestScopedLibraryChildChild::Create(
int value,
int other_value,
int other_other_value) {
return CefOwnPtr<CefTranslatorTestScopedLibraryChildChild>(
new CefTranslatorTestScopedLibraryChildChildImpl(value, other_value,
other_other_value));
}
class CefTranslatorTestImpl : public CefTranslatorTest {
public:
CefTranslatorTestImpl() {
@ -338,91 +469,95 @@ class CefTranslatorTestImpl : public CefTranslatorTest {
}
// LIBRARY-SIDE OBJECT VALUES
// LIBRARY-SIDE REFPTR VALUES
CefRefPtr<CefTranslatorTestObject> GetObject(int val) override {
return new CefTranslatorTestObjectChildImpl(val, 0);
CefRefPtr<CefTranslatorTestRefPtrLibrary> GetRefPtrLibrary(int val) override {
return new CefTranslatorTestRefPtrLibraryChildImpl(val, 0);
}
int SetObject(CefRefPtr<CefTranslatorTestObject> val) override {
int SetRefPtrLibrary(CefRefPtr<CefTranslatorTestRefPtrLibrary> val) override {
return val->GetValue();
}
CefRefPtr<CefTranslatorTestObject> SetObjectAndReturn(
CefRefPtr<CefTranslatorTestObject> val) override {
CefRefPtr<CefTranslatorTestRefPtrLibrary> SetRefPtrLibraryAndReturn(
CefRefPtr<CefTranslatorTestRefPtrLibrary> val) override {
return val;
}
int SetChildObject(CefRefPtr<CefTranslatorTestObjectChild> val) override {
int SetChildRefPtrLibrary(
CefRefPtr<CefTranslatorTestRefPtrLibraryChild> val) override {
return val->GetValue();
}
CefRefPtr<CefTranslatorTestObject> SetChildObjectAndReturnParent(
CefRefPtr<CefTranslatorTestObjectChild> val) override {
CefRefPtr<CefTranslatorTestRefPtrLibrary>
SetChildRefPtrLibraryAndReturnParent(
CefRefPtr<CefTranslatorTestRefPtrLibraryChild> val) override {
return val;
}
// LIBRARY-SIDE OBJECT LIST VALUES
// LIBRARY-SIDE REFPTR LIST VALUES
bool SetObjectList(
const std::vector<CefRefPtr<CefTranslatorTestObject> >& val,
bool SetRefPtrLibraryList(
const std::vector<CefRefPtr<CefTranslatorTestRefPtrLibrary> >& val,
int val1, int val2) override {
if (val.size() != 2U)
return false;
return val[0]->GetValue() == val1 && val[1]->GetValue() == val2;
}
bool GetObjectListByRef(ObjectList& val, int val1, int val2) override {
if (val.size() != GetObjectListSize())
bool GetRefPtrLibraryListByRef(RefPtrLibraryList& val, int val1,
int val2) override {
if (val.size() != GetRefPtrLibraryListSize())
return false;
val.clear();
val.push_back(new CefTranslatorTestObjectChildImpl(val1, 0));
val.push_back(new CefTranslatorTestObjectImpl(val2));
val.push_back(new CefTranslatorTestRefPtrLibraryChildImpl(val1, 0));
val.push_back(new CefTranslatorTestRefPtrLibraryImpl(val2));
return true;
}
size_t GetObjectListSize() override {
size_t GetRefPtrLibraryListSize() override {
return 2U;
}
// CLIENT-SIDE OBJECT VALUES
// CLIENT-SIDE REFPTR VALUES
int SetHandler(CefRefPtr<CefTranslatorTestHandler> val) override {
int SetRefPtrClient(CefRefPtr<CefTranslatorTestRefPtrClient> val) override {
return val->GetValue();
}
CefRefPtr<CefTranslatorTestHandler> SetHandlerAndReturn(
CefRefPtr<CefTranslatorTestHandler> val) override {
CefRefPtr<CefTranslatorTestRefPtrClient> SetRefPtrClientAndReturn(
CefRefPtr<CefTranslatorTestRefPtrClient> val) override {
return val;
}
int SetChildHandler(CefRefPtr<CefTranslatorTestHandlerChild> val) override {
int SetChildRefPtrClient(
CefRefPtr<CefTranslatorTestRefPtrClientChild> val) override {
return val->GetValue();
}
CefRefPtr<CefTranslatorTestHandler> SetChildHandlerAndReturnParent(
CefRefPtr<CefTranslatorTestHandlerChild> val) override {
CefRefPtr<CefTranslatorTestRefPtrClient> SetChildRefPtrClientAndReturnParent(
CefRefPtr<CefTranslatorTestRefPtrClientChild> val) override {
return val;
}
// CLIENT-SIDE OBJECT LIST VALUES
// CLIENT-SIDE REFPTR LIST VALUES
bool SetHandlerList(
const std::vector<CefRefPtr<CefTranslatorTestHandler> >& val,
bool SetRefPtrClientList(
const std::vector<CefRefPtr<CefTranslatorTestRefPtrClient> >& val,
int val1, int val2) override {
if (val.size() != 2U)
return false;
return val[0]->GetValue() == val1 && val[1]->GetValue() == val2;
}
bool GetHandlerListByRef(
HandlerList& val,
CefRefPtr<CefTranslatorTestHandler> val1,
CefRefPtr<CefTranslatorTestHandler> val2) override {
if (val.size() != GetHandlerListSize())
bool GetRefPtrClientListByRef(
RefPtrClientList& val,
CefRefPtr<CefTranslatorTestRefPtrClient> val1,
CefRefPtr<CefTranslatorTestRefPtrClient> val2) override {
if (val.size() != GetRefPtrClientListSize())
return false;
val.clear();
val.push_back(val1);
@ -430,10 +565,106 @@ class CefTranslatorTestImpl : public CefTranslatorTest {
return true;
}
size_t GetHandlerListSize() override {
size_t GetRefPtrClientListSize() override {
return 2U;
}
// LIBRARY-SIDE OWNPTR VALUES
CefOwnPtr<CefTranslatorTestScopedLibrary> GetOwnPtrLibrary(int val) override {
return CefOwnPtr<CefTranslatorTestScopedLibrary>(
new CefTranslatorTestScopedLibraryChildImpl(val, 0));
}
int SetOwnPtrLibrary(CefOwnPtr<CefTranslatorTestScopedLibrary> val) override {
return val->GetValue();
}
CefOwnPtr<CefTranslatorTestScopedLibrary> SetOwnPtrLibraryAndReturn(
CefOwnPtr<CefTranslatorTestScopedLibrary> val) override {
return val;
}
int SetChildOwnPtrLibrary(
CefOwnPtr<CefTranslatorTestScopedLibraryChild> val) override {
return val->GetValue();
}
CefOwnPtr<CefTranslatorTestScopedLibrary>
SetChildOwnPtrLibraryAndReturnParent(
CefOwnPtr<CefTranslatorTestScopedLibraryChild> val) override {
return CefOwnPtr<CefTranslatorTestScopedLibrary>(val.release());
}
// CLIENT-SIDE OWNPTR VALUES
int SetOwnPtrClient(CefOwnPtr<CefTranslatorTestScopedClient> val) override {
return val->GetValue();
}
CefOwnPtr<CefTranslatorTestScopedClient> SetOwnPtrClientAndReturn(
CefOwnPtr<CefTranslatorTestScopedClient> val) override {
return val;
}
int SetChildOwnPtrClient(
CefOwnPtr<CefTranslatorTestScopedClientChild> val) override {
return val->GetValue();
}
CefOwnPtr<CefTranslatorTestScopedClient> SetChildOwnPtrClientAndReturnParent(
CefOwnPtr<CefTranslatorTestScopedClientChild> val) override {
return CefOwnPtr<CefTranslatorTestScopedClient>(val.release());
}
// LIBRARY-SIDE RAWPTR VALUES
int SetRawPtrLibrary(CefRawPtr<CefTranslatorTestScopedLibrary> val) override {
return val->GetValue();
}
int SetChildRawPtrLibrary(
CefRawPtr<CefTranslatorTestScopedLibraryChild> val) override {
return val->GetValue();
}
// LIBRARY-SIDE RAWPTR LIST VALUES
bool SetRawPtrLibraryList(
const std::vector<CefRawPtr<CefTranslatorTestScopedLibrary> >& val,
int val1, int val2) override {
if (val.size() != 2U)
return false;
return val[0]->GetValue() == val1 && val[1]->GetValue() == val2;
}
// CLIENT-SIDE RAWPTR VALUES
int SetRawPtrClient(CefRawPtr<CefTranslatorTestScopedClient> val) override {
return val->GetValue();
}
int SetChildRawPtrClient(
CefRawPtr<CefTranslatorTestScopedClientChild> val) override {
return val->GetValue();
}
// CLIENT-SIDE RAWPTR LIST VALUES
bool SetRawPtrClientList(
const std::vector<CefRawPtr<CefTranslatorTestScopedClient> >& val,
int val1, int val2) override {
if (val.size() != 2U)
return false;
return val[0]->GetValue() == val1 && val[1]->GetValue() == val2;
}
private:
IMPLEMENT_REFCOUNTING(CefTranslatorTestImpl);
DISALLOW_COPY_AND_ASSIGN(CefTranslatorTestImpl);

View File

@ -49,14 +49,18 @@ void CEF_CALLBACK app_on_register_custom_schemes(struct _cef_app_t* self,
DCHECK(self);
if (!self)
return;
// Verify param: registrar; type: refptr_diff
// Verify param: registrar; type: rawptr_diff
DCHECK(registrar);
if (!registrar)
return;
// Translate param: registrar; type: rawptr_diff
CefOwnPtr<CefSchemeRegistrar> registrarPtr(CefSchemeRegistrarCToCpp::Wrap(
registrar));
// Execute
CefAppCppToC::Get(self)->OnRegisterCustomSchemes(
CefSchemeRegistrarCToCpp::Wrap(registrar));
registrarPtr.get());
}
struct _cef_resource_bundle_handler_t* CEF_CALLBACK app_get_resource_bundle_handler(

View File

@ -0,0 +1,30 @@
// Copyright (c) 2017 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
#include "libcef_dll/cpptoc/base_scoped_cpptoc.h"
CefBaseScopedCppToC::CefBaseScopedCppToC() {
}
template<> CefOwnPtr<CefBaseScoped>
CefCppToCScoped<CefBaseScopedCppToC, CefBaseScoped, cef_base_scoped_t>::
UnwrapDerivedOwn(CefWrapperType type, cef_base_scoped_t* s) {
NOTREACHED();
return CefOwnPtr<CefBaseScoped>();
}
template<> CefRawPtr<CefBaseScoped>
CefCppToCScoped<CefBaseScopedCppToC, CefBaseScoped, cef_base_scoped_t>::
UnwrapDerivedRaw(CefWrapperType type, cef_base_scoped_t* s) {
NOTREACHED();
return NULL;
}
#if DCHECK_IS_ON()
template<> base::AtomicRefCount CefCppToCScoped<CefBaseScopedCppToC,
CefBaseScoped, cef_base_scoped_t>::DebugObjCt = 0;
#endif
template<> CefWrapperType CefCppToCScoped<CefBaseScopedCppToC, CefBaseScoped,
cef_base_scoped_t>::kWrapperType = WT_BASE;

View File

@ -0,0 +1,25 @@
// Copyright (c) 2009 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
#ifndef CEF_LIBCEF_DLL_CPPTOC_BASE_CPPTOC_H_
#define CEF_LIBCEF_DLL_CPPTOC_BASE_CPPTOC_H_
#pragma once
#include "include/cef_base.h"
#include "include/capi/cef_base_capi.h"
#include "libcef_dll/cpptoc/cpptoc_scoped.h"
#if !defined(WRAPPING_CEF_SHARED)
#error This file can be included wrapper-side only
#endif
// Wrap a C++ class with a C structure.
class CefBaseScopedCppToC
: public CefCppToCScoped<CefBaseScopedCppToC, CefBaseScoped,
cef_base_scoped_t> {
public:
CefBaseScopedCppToC();
};
#endif // CEF_LIBCEF_DLL_CPPTOC_BASE_CPPTOC_H_

View File

@ -0,0 +1,241 @@
// Copyright (c) 2017 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
#ifndef CEF_LIBCEF_DLL_CPPTOC_CPPTOC_SCOPED_H_
#define CEF_LIBCEF_DLL_CPPTOC_CPPTOC_SCOPED_H_
#pragma once
#include "include/base/cef_logging.h"
#include "include/base/cef_macros.h"
#include "include/cef_base.h"
#include "include/capi/cef_base_capi.h"
#include "libcef_dll/ptr_util.h"
#include "libcef_dll/wrapper_types.h"
// Wrap a C++ class with a C structure. This is used when the class
// implementation exists on this side of the DLL boundary but will have methods
// called from the other side of the DLL boundary.
template <class ClassName, class BaseName, class StructName>
class CefCppToCScoped : public CefBaseScoped {
public:
// 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
// object will be deleted when the wrapper object is deleted. For example:
//
// void MyMethod(CefOwnPtr<MyType> obj) {
// my_method(MyTypeCppToC::WrapOwn(obj));
// }
//
// void my_method(my_type_t* struct) {
// // Delete the MyTypeCppToC wrapper and the owned MyType object.
// struct->del(struct);
// }
static StructName* WrapOwn(CefOwnPtr<BaseName> c) {
if (!c)
return NULL;
// Wrap our object with the CefCppToC class.
ClassName* wrapper = new ClassName();
wrapper->Initialize(c.release(), true);
// Return the structure pointer that can now be passed to the other side.
return wrapper->GetStruct();
}
// Create a new wrapper instance and associated structure reference for
// passing an object instance to the other side. The wrapper object is owned
// by the caller. The wrapped object is unowned and must outlive the wrapper.
// For example:
//
// void MyMethod(MyType* obj) {
// CefOwnPtr<MyTypeCppToC> MyTypeWrapper = MyTypeCppToC::WrapRaw(obj);
// my_method(MyTypeWrapper->GetStruct());
// // MyTypeWrapper is deleted when MyMethod() goes out of scope.
// }
//
// void my_method(my_type_t* struct) {
// // Access |struct| here but you can't delete it.
// }
static CefOwnPtr<ClassName> WrapRaw(CefRawPtr<BaseName> c) {
if (!c)
return CefOwnPtr<ClassName>();
// Wrap our object with the CefCppToC class.
ClassName* wrapper = new ClassName();
wrapper->Initialize(c, false);
// Return the owned wrapper object.
return CefOwnPtr<ClassName>(wrapper);
}
// Retrieve the underlying object instance for a structure reference passed
// back from the other side. The caller takes ownership of the object. For
// example:
//
// void my_method(my_type_t* struct) {
// CefOwnPtr<MyType> MyTypePtr = MyTypeCppToC::UnwrapOwn(struct);
// // |struct| has been deleted and should no longer be accessed.
// }
static CefOwnPtr<BaseName> UnwrapOwn(StructName* s) {
if (!s)
return CefOwnPtr<BaseName>();
// Cast our structure to the wrapper structure type.
WrapperStruct* wrapperStruct = GetWrapperStruct(s);
// 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_, s);
// We should own the underlying object currently.
DCHECK(wrapperStruct->wrapper_->owned_);
DCHECK(wrapperStruct->object_);
// We're giving up ownership of the underlying object. Clear the pointer so
// it doesn't get deleted.
BaseName* object = wrapperStruct->object_;
wrapperStruct->object_ = NULL;
delete wrapperStruct->wrapper_;
// Return the underlying object instance.
return CefOwnPtr<BaseName>(object);
}
// Retrieve the underlying object instance for a structure reference passed
// back from the other side. Ownership does not change. For example:
//
// void my_method(my_type_t* struct) {
// CefRawPtr<MyType> MyTypePtr = MyTypeCppToC::UnwrapRaw(struct);
// // |struct| is still valid.
// }
static CefRawPtr<BaseName> UnwrapRaw(StructName* s) {
if (!s)
return NULL;
// Cast our structure to the wrapper structure type.
WrapperStruct* wrapperStruct = GetWrapperStruct(s);
// If the type does not match this object then we need to unwrap as the
// derived type.
if (wrapperStruct->type_ != kWrapperType)
return UnwrapDerivedRaw(wrapperStruct->type_, s);
// Return the underlying object instance.
return wrapperStruct->object_;
}
// Retrieve the same side wrapper associated with the structure. Ownership
// does not change.
static ClassName* GetWrapper(StructName* s) {
DCHECK(s);
WrapperStruct* wrapperStruct = GetWrapperStruct(s);
// Verify that the wrapper offset was calculated correctly.
DCHECK_EQ(kWrapperType, wrapperStruct->type_);
return static_cast<ClassName*>(wrapperStruct->wrapper_);
}
// Retrieve the underlying object instance from our own structure reference
// when the reference is passed as the required first parameter of a C API
// function call. Ownership of the object does not change.
static BaseName* Get(StructName* s) {
DCHECK(s);
WrapperStruct* wrapperStruct = GetWrapperStruct(s);
// Verify that the wrapper offset was calculated correctly.
DCHECK_EQ(kWrapperType, wrapperStruct->type_);
return wrapperStruct->object_;
}
// If returning the structure across the DLL boundary you should call
// AddRef() on this CefCppToC object. On the other side of the DLL boundary,
// call UnderlyingRelease() on the wrapping CefCToCpp object.
StructName* GetStruct() { return &wrapper_struct_.struct_; }
#if DCHECK_IS_ON()
// Simple tracking of allocated objects.
static base::AtomicRefCount DebugObjCt; // NOLINT(runtime/int)
#endif
protected:
CefCppToCScoped() {
wrapper_struct_.type_ = kWrapperType;
wrapper_struct_.wrapper_ = this;
memset(GetStruct(), 0, sizeof(StructName));
#if DCHECK_IS_ON()
base::AtomicRefCountInc(&DebugObjCt);
#endif
}
virtual ~CefCppToCScoped() {
// Only delete the underlying object if we own it.
if (owned_ && wrapper_struct_.object_)
delete wrapper_struct_.object_;
#if DCHECK_IS_ON()
base::AtomicRefCountDec(&DebugObjCt);
#endif
}
private:
// Used to associate this wrapper object, the underlying object instance and
// the structure that will be passed to the other side.
struct WrapperStruct {
CefWrapperType type_;
BaseName* object_;
CefCppToCScoped<ClassName, BaseName, StructName>* wrapper_;
StructName struct_;
};
void Initialize(BaseName* obj, bool owned) {
wrapper_struct_.object_ = obj;
owned_ = owned;
cef_base_scoped_t* base = reinterpret_cast<cef_base_scoped_t*>(GetStruct());
base->size = sizeof(StructName);
if (owned)
base->del = struct_del;
}
static WrapperStruct* GetWrapperStruct(StructName* s) {
// Offset using the WrapperStruct size instead of individual member sizes
// to avoid problems due to platform/compiler differences in structure
// padding.
return reinterpret_cast<WrapperStruct*>(
reinterpret_cast<char*>(s) -
(sizeof(WrapperStruct) - sizeof(StructName)));
}
// Unwrap as the derived type.
static CefOwnPtr<BaseName> UnwrapDerivedOwn(CefWrapperType type,
StructName* s);
static CefRawPtr<BaseName> UnwrapDerivedRaw(CefWrapperType type,
StructName* s);
static void CEF_CALLBACK struct_del(cef_base_scoped_t* base) {
DCHECK(base);
if (!base)
return;
WrapperStruct* wrapperStruct =
GetWrapperStruct(reinterpret_cast<StructName*>(base));
// Verify that the wrapper offset was calculated correctly.
DCHECK_EQ(kWrapperType, wrapperStruct->type_);
// Should only be deleting wrappers that own the underlying object.
DCHECK(wrapperStruct->wrapper_->owned_);
delete wrapperStruct->wrapper_;
}
WrapperStruct wrapper_struct_;
bool owned_;
static CefWrapperType kWrapperType;
DISALLOW_COPY_AND_ASSIGN(CefCppToCScoped);
};
#endif // CEF_LIBCEF_DLL_CPPTOC_CPPTOC_SCOPED_H_

View File

@ -53,18 +53,25 @@ CefSchemeRegistrarCppToC::CefSchemeRegistrarCppToC() {
GetStruct()->add_custom_scheme = scheme_registrar_add_custom_scheme;
}
template<> CefRefPtr<CefSchemeRegistrar> CefCppToC<CefSchemeRegistrarCppToC,
CefSchemeRegistrar, cef_scheme_registrar_t>::UnwrapDerived(
template<> CefOwnPtr<CefSchemeRegistrar> CefCppToCScoped<CefSchemeRegistrarCppToC,
CefSchemeRegistrar, cef_scheme_registrar_t>::UnwrapDerivedOwn(
CefWrapperType type, cef_scheme_registrar_t* s) {
NOTREACHED() << "Unexpected class type: " << type;
return CefOwnPtr<CefSchemeRegistrar>();
}
template<> CefRawPtr<CefSchemeRegistrar> CefCppToCScoped<CefSchemeRegistrarCppToC,
CefSchemeRegistrar, cef_scheme_registrar_t>::UnwrapDerivedRaw(
CefWrapperType type, cef_scheme_registrar_t* s) {
NOTREACHED() << "Unexpected class type: " << type;
return NULL;
}
#if DCHECK_IS_ON()
template<> base::AtomicRefCount CefCppToC<CefSchemeRegistrarCppToC,
template<> base::AtomicRefCount CefCppToCScoped<CefSchemeRegistrarCppToC,
CefSchemeRegistrar, cef_scheme_registrar_t>::DebugObjCt = 0;
#endif
template<> CefWrapperType CefCppToC<CefSchemeRegistrarCppToC,
template<> CefWrapperType CefCppToCScoped<CefSchemeRegistrarCppToC,
CefSchemeRegistrar, cef_scheme_registrar_t>::kWrapperType =
WT_SCHEME_REGISTRAR;

View File

@ -20,12 +20,12 @@
#include "include/cef_scheme.h"
#include "include/capi/cef_scheme_capi.h"
#include "libcef_dll/cpptoc/cpptoc.h"
#include "libcef_dll/cpptoc/cpptoc_scoped.h"
// Wrap a C++ class with a C structure.
// This class may be instantiated and accessed DLL-side only.
class CefSchemeRegistrarCppToC
: public CefCppToC<CefSchemeRegistrarCppToC, CefSchemeRegistrar,
: public CefCppToCScoped<CefSchemeRegistrarCppToC, CefSchemeRegistrar,
cef_scheme_registrar_t> {
public:
CefSchemeRegistrarCppToC();

View File

@ -12,10 +12,14 @@
#include <algorithm>
#include "libcef_dll/cpptoc/test/translator_test_cpptoc.h"
#include "libcef_dll/cpptoc/test/translator_test_object_cpptoc.h"
#include "libcef_dll/cpptoc/test/translator_test_object_child_cpptoc.h"
#include "libcef_dll/ctocpp/test/translator_test_handler_ctocpp.h"
#include "libcef_dll/ctocpp/test/translator_test_handler_child_ctocpp.h"
#include "libcef_dll/cpptoc/test/translator_test_ref_ptr_library_cpptoc.h"
#include "libcef_dll/cpptoc/test/translator_test_ref_ptr_library_child_cpptoc.h"
#include "libcef_dll/cpptoc/test/translator_test_scoped_library_cpptoc.h"
#include "libcef_dll/cpptoc/test/translator_test_scoped_library_child_cpptoc.h"
#include "libcef_dll/ctocpp/test/translator_test_ref_ptr_client_ctocpp.h"
#include "libcef_dll/ctocpp/test/translator_test_ref_ptr_client_child_ctocpp.h"
#include "libcef_dll/ctocpp/test/translator_test_scoped_client_ctocpp.h"
#include "libcef_dll/ctocpp/test/translator_test_scoped_client_child_ctocpp.h"
#include "libcef_dll/transfer_util.h"
@ -653,7 +657,7 @@ size_t CEF_CALLBACK translator_test_get_point_list_size(
return _retval;
}
struct _cef_translator_test_object_t* CEF_CALLBACK translator_test_get_object(
struct _cef_translator_test_ref_ptr_library_t* CEF_CALLBACK translator_test_get_ref_ptr_library(
struct _cef_translator_test_t* self, int val) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
@ -662,16 +666,17 @@ struct _cef_translator_test_object_t* CEF_CALLBACK translator_test_get_object(
return NULL;
// Execute
CefRefPtr<CefTranslatorTestObject> _retval = CefTranslatorTestCppToC::Get(
self)->GetObject(
CefRefPtr<CefTranslatorTestRefPtrLibrary> _retval =
CefTranslatorTestCppToC::Get(self)->GetRefPtrLibrary(
val);
// Return type: refptr_same
return CefTranslatorTestObjectCppToC::Wrap(_retval);
return CefTranslatorTestRefPtrLibraryCppToC::Wrap(_retval);
}
int CEF_CALLBACK translator_test_set_object(struct _cef_translator_test_t* self,
struct _cef_translator_test_object_t* val) {
int CEF_CALLBACK translator_test_set_ref_ptr_library(
struct _cef_translator_test_t* self,
struct _cef_translator_test_ref_ptr_library_t* val) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
@ -683,16 +688,16 @@ int CEF_CALLBACK translator_test_set_object(struct _cef_translator_test_t* self,
return 0;
// Execute
int _retval = CefTranslatorTestCppToC::Get(self)->SetObject(
CefTranslatorTestObjectCppToC::Unwrap(val));
int _retval = CefTranslatorTestCppToC::Get(self)->SetRefPtrLibrary(
CefTranslatorTestRefPtrLibraryCppToC::Unwrap(val));
// Return type: simple
return _retval;
}
struct _cef_translator_test_object_t* CEF_CALLBACK translator_test_set_object_and_return(
struct _cef_translator_test_ref_ptr_library_t* CEF_CALLBACK translator_test_set_ref_ptr_library_and_return(
struct _cef_translator_test_t* self,
struct _cef_translator_test_object_t* val) {
struct _cef_translator_test_ref_ptr_library_t* val) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
@ -704,17 +709,17 @@ struct _cef_translator_test_object_t* CEF_CALLBACK translator_test_set_object_an
return NULL;
// Execute
CefRefPtr<CefTranslatorTestObject> _retval = CefTranslatorTestCppToC::Get(
self)->SetObjectAndReturn(
CefTranslatorTestObjectCppToC::Unwrap(val));
CefRefPtr<CefTranslatorTestRefPtrLibrary> _retval =
CefTranslatorTestCppToC::Get(self)->SetRefPtrLibraryAndReturn(
CefTranslatorTestRefPtrLibraryCppToC::Unwrap(val));
// Return type: refptr_same
return CefTranslatorTestObjectCppToC::Wrap(_retval);
return CefTranslatorTestRefPtrLibraryCppToC::Wrap(_retval);
}
int CEF_CALLBACK translator_test_set_child_object(
int CEF_CALLBACK translator_test_set_child_ref_ptr_library(
struct _cef_translator_test_t* self,
struct _cef_translator_test_object_child_t* val) {
struct _cef_translator_test_ref_ptr_library_child_t* val) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
@ -726,16 +731,16 @@ int CEF_CALLBACK translator_test_set_child_object(
return 0;
// Execute
int _retval = CefTranslatorTestCppToC::Get(self)->SetChildObject(
CefTranslatorTestObjectChildCppToC::Unwrap(val));
int _retval = CefTranslatorTestCppToC::Get(self)->SetChildRefPtrLibrary(
CefTranslatorTestRefPtrLibraryChildCppToC::Unwrap(val));
// Return type: simple
return _retval;
}
struct _cef_translator_test_object_t* CEF_CALLBACK translator_test_set_child_object_and_return_parent(
struct _cef_translator_test_ref_ptr_library_t* CEF_CALLBACK translator_test_set_child_ref_ptr_library_and_return_parent(
struct _cef_translator_test_t* self,
struct _cef_translator_test_object_child_t* val) {
struct _cef_translator_test_ref_ptr_library_child_t* val) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
@ -747,17 +752,18 @@ struct _cef_translator_test_object_t* CEF_CALLBACK translator_test_set_child_obj
return NULL;
// Execute
CefRefPtr<CefTranslatorTestObject> _retval = CefTranslatorTestCppToC::Get(
self)->SetChildObjectAndReturnParent(
CefTranslatorTestObjectChildCppToC::Unwrap(val));
CefRefPtr<CefTranslatorTestRefPtrLibrary> _retval =
CefTranslatorTestCppToC::Get(self)->SetChildRefPtrLibraryAndReturnParent(
CefTranslatorTestRefPtrLibraryChildCppToC::Unwrap(val));
// Return type: refptr_same
return CefTranslatorTestObjectCppToC::Wrap(_retval);
return CefTranslatorTestRefPtrLibraryCppToC::Wrap(_retval);
}
int CEF_CALLBACK translator_test_set_object_list(
int CEF_CALLBACK translator_test_set_ref_ptr_library_list(
struct _cef_translator_test_t* self, size_t valCount,
struct _cef_translator_test_object_t* const* val, int val1, int val2) {
struct _cef_translator_test_ref_ptr_library_t* const* val, int val1,
int val2) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
@ -769,17 +775,17 @@ int CEF_CALLBACK translator_test_set_object_list(
return 0;
// Translate param: val; type: refptr_vec_same_byref_const
std::vector<CefRefPtr<CefTranslatorTestObject> > valList;
std::vector<CefRefPtr<CefTranslatorTestRefPtrLibrary> > valList;
if (valCount > 0) {
for (size_t i = 0; i < valCount; ++i) {
CefRefPtr<CefTranslatorTestObject> valVal =
CefTranslatorTestObjectCppToC::Unwrap(val[i]);
CefRefPtr<CefTranslatorTestRefPtrLibrary> valVal =
CefTranslatorTestRefPtrLibraryCppToC::Unwrap(val[i]);
valList.push_back(valVal);
}
}
// Execute
bool _retval = CefTranslatorTestCppToC::Get(self)->SetObjectList(
bool _retval = CefTranslatorTestCppToC::Get(self)->SetRefPtrLibraryList(
valList,
val1,
val2);
@ -788,9 +794,9 @@ int CEF_CALLBACK translator_test_set_object_list(
return _retval;
}
int CEF_CALLBACK translator_test_get_object_list_by_ref(
int CEF_CALLBACK translator_test_get_ref_ptr_library_list_by_ref(
struct _cef_translator_test_t* self, size_t* valCount,
struct _cef_translator_test_object_t** val, int val1, int val2) {
struct _cef_translator_test_ref_ptr_library_t** val, int val1, int val2) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
@ -802,15 +808,15 @@ int CEF_CALLBACK translator_test_get_object_list_by_ref(
return 0;
// Translate param: val; type: refptr_vec_same_byref
std::vector<CefRefPtr<CefTranslatorTestObject> > valList;
std::vector<CefRefPtr<CefTranslatorTestRefPtrLibrary> > valList;
if (valCount && *valCount > 0 && val) {
for (size_t i = 0; i < *valCount; ++i) {
valList.push_back(CefTranslatorTestObjectCppToC::Unwrap(val[i]));
valList.push_back(CefTranslatorTestRefPtrLibraryCppToC::Unwrap(val[i]));
}
}
// Execute
bool _retval = CefTranslatorTestCppToC::Get(self)->GetObjectListByRef(
bool _retval = CefTranslatorTestCppToC::Get(self)->GetRefPtrLibraryListByRef(
valList,
val1,
val2);
@ -820,7 +826,7 @@ int CEF_CALLBACK translator_test_get_object_list_by_ref(
*valCount = std::min(valList.size(), *valCount);
if (*valCount > 0) {
for (size_t i = 0; i < *valCount; ++i) {
val[i] = CefTranslatorTestObjectCppToC::Wrap(valList[i]);
val[i] = CefTranslatorTestRefPtrLibraryCppToC::Wrap(valList[i]);
}
}
}
@ -829,7 +835,7 @@ int CEF_CALLBACK translator_test_get_object_list_by_ref(
return _retval;
}
size_t CEF_CALLBACK translator_test_get_object_list_size(
size_t CEF_CALLBACK translator_test_get_ref_ptr_library_list_size(
struct _cef_translator_test_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
@ -838,15 +844,16 @@ size_t CEF_CALLBACK translator_test_get_object_list_size(
return 0;
// Execute
size_t _retval = CefTranslatorTestCppToC::Get(self)->GetObjectListSize();
size_t _retval = CefTranslatorTestCppToC::Get(self)->GetRefPtrLibraryListSize(
);
// Return type: simple
return _retval;
}
int CEF_CALLBACK translator_test_set_handler(
int CEF_CALLBACK translator_test_set_ref_ptr_client(
struct _cef_translator_test_t* self,
struct _cef_translator_test_handler_t* val) {
struct _cef_translator_test_ref_ptr_client_t* val) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
@ -858,16 +865,16 @@ int CEF_CALLBACK translator_test_set_handler(
return 0;
// Execute
int _retval = CefTranslatorTestCppToC::Get(self)->SetHandler(
CefTranslatorTestHandlerCToCpp::Wrap(val));
int _retval = CefTranslatorTestCppToC::Get(self)->SetRefPtrClient(
CefTranslatorTestRefPtrClientCToCpp::Wrap(val));
// Return type: simple
return _retval;
}
struct _cef_translator_test_handler_t* CEF_CALLBACK translator_test_set_handler_and_return(
struct _cef_translator_test_ref_ptr_client_t* CEF_CALLBACK translator_test_set_ref_ptr_client_and_return(
struct _cef_translator_test_t* self,
struct _cef_translator_test_handler_t* val) {
struct _cef_translator_test_ref_ptr_client_t* val) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
@ -879,17 +886,17 @@ struct _cef_translator_test_handler_t* CEF_CALLBACK translator_test_set_handler_
return NULL;
// Execute
CefRefPtr<CefTranslatorTestHandler> _retval = CefTranslatorTestCppToC::Get(
self)->SetHandlerAndReturn(
CefTranslatorTestHandlerCToCpp::Wrap(val));
CefRefPtr<CefTranslatorTestRefPtrClient> _retval =
CefTranslatorTestCppToC::Get(self)->SetRefPtrClientAndReturn(
CefTranslatorTestRefPtrClientCToCpp::Wrap(val));
// Return type: refptr_diff
return CefTranslatorTestHandlerCToCpp::Unwrap(_retval);
return CefTranslatorTestRefPtrClientCToCpp::Unwrap(_retval);
}
int CEF_CALLBACK translator_test_set_child_handler(
int CEF_CALLBACK translator_test_set_child_ref_ptr_client(
struct _cef_translator_test_t* self,
struct _cef_translator_test_handler_child_t* val) {
struct _cef_translator_test_ref_ptr_client_child_t* val) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
@ -901,16 +908,16 @@ int CEF_CALLBACK translator_test_set_child_handler(
return 0;
// Execute
int _retval = CefTranslatorTestCppToC::Get(self)->SetChildHandler(
CefTranslatorTestHandlerChildCToCpp::Wrap(val));
int _retval = CefTranslatorTestCppToC::Get(self)->SetChildRefPtrClient(
CefTranslatorTestRefPtrClientChildCToCpp::Wrap(val));
// Return type: simple
return _retval;
}
struct _cef_translator_test_handler_t* CEF_CALLBACK translator_test_set_child_handler_and_return_parent(
struct _cef_translator_test_ref_ptr_client_t* CEF_CALLBACK translator_test_set_child_ref_ptr_client_and_return_parent(
struct _cef_translator_test_t* self,
struct _cef_translator_test_handler_child_t* val) {
struct _cef_translator_test_ref_ptr_client_child_t* val) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
@ -922,17 +929,18 @@ struct _cef_translator_test_handler_t* CEF_CALLBACK translator_test_set_child_ha
return NULL;
// Execute
CefRefPtr<CefTranslatorTestHandler> _retval = CefTranslatorTestCppToC::Get(
self)->SetChildHandlerAndReturnParent(
CefTranslatorTestHandlerChildCToCpp::Wrap(val));
CefRefPtr<CefTranslatorTestRefPtrClient> _retval =
CefTranslatorTestCppToC::Get(self)->SetChildRefPtrClientAndReturnParent(
CefTranslatorTestRefPtrClientChildCToCpp::Wrap(val));
// Return type: refptr_diff
return CefTranslatorTestHandlerCToCpp::Unwrap(_retval);
return CefTranslatorTestRefPtrClientCToCpp::Unwrap(_retval);
}
int CEF_CALLBACK translator_test_set_handler_list(
int CEF_CALLBACK translator_test_set_ref_ptr_client_list(
struct _cef_translator_test_t* self, size_t valCount,
struct _cef_translator_test_handler_t* const* val, int val1, int val2) {
struct _cef_translator_test_ref_ptr_client_t* const* val, int val1,
int val2) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
@ -944,17 +952,17 @@ int CEF_CALLBACK translator_test_set_handler_list(
return 0;
// Translate param: val; type: refptr_vec_diff_byref_const
std::vector<CefRefPtr<CefTranslatorTestHandler> > valList;
std::vector<CefRefPtr<CefTranslatorTestRefPtrClient> > valList;
if (valCount > 0) {
for (size_t i = 0; i < valCount; ++i) {
CefRefPtr<CefTranslatorTestHandler> valVal =
CefTranslatorTestHandlerCToCpp::Wrap(val[i]);
CefRefPtr<CefTranslatorTestRefPtrClient> valVal =
CefTranslatorTestRefPtrClientCToCpp::Wrap(val[i]);
valList.push_back(valVal);
}
}
// Execute
bool _retval = CefTranslatorTestCppToC::Get(self)->SetHandlerList(
bool _retval = CefTranslatorTestCppToC::Get(self)->SetRefPtrClientList(
valList,
val1,
val2);
@ -963,11 +971,11 @@ int CEF_CALLBACK translator_test_set_handler_list(
return _retval;
}
int CEF_CALLBACK translator_test_get_handler_list_by_ref(
int CEF_CALLBACK translator_test_get_ref_ptr_client_list_by_ref(
struct _cef_translator_test_t* self, size_t* valCount,
struct _cef_translator_test_handler_t** val,
struct _cef_translator_test_handler_t* val1,
struct _cef_translator_test_handler_t* val2) {
struct _cef_translator_test_ref_ptr_client_t** val,
struct _cef_translator_test_ref_ptr_client_t* val1,
struct _cef_translator_test_ref_ptr_client_t* val2) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
@ -987,25 +995,25 @@ int CEF_CALLBACK translator_test_get_handler_list_by_ref(
return 0;
// Translate param: val; type: refptr_vec_diff_byref
std::vector<CefRefPtr<CefTranslatorTestHandler> > valList;
std::vector<CefRefPtr<CefTranslatorTestRefPtrClient> > valList;
if (valCount && *valCount > 0 && val) {
for (size_t i = 0; i < *valCount; ++i) {
valList.push_back(CefTranslatorTestHandlerCToCpp::Wrap(val[i]));
valList.push_back(CefTranslatorTestRefPtrClientCToCpp::Wrap(val[i]));
}
}
// Execute
bool _retval = CefTranslatorTestCppToC::Get(self)->GetHandlerListByRef(
bool _retval = CefTranslatorTestCppToC::Get(self)->GetRefPtrClientListByRef(
valList,
CefTranslatorTestHandlerCToCpp::Wrap(val1),
CefTranslatorTestHandlerCToCpp::Wrap(val2));
CefTranslatorTestRefPtrClientCToCpp::Wrap(val1),
CefTranslatorTestRefPtrClientCToCpp::Wrap(val2));
// Restore param: val; type: refptr_vec_diff_byref
if (valCount && val) {
*valCount = std::min(valList.size(), *valCount);
if (*valCount > 0) {
for (size_t i = 0; i < *valCount; ++i) {
val[i] = CefTranslatorTestHandlerCToCpp::Unwrap(valList[i]);
val[i] = CefTranslatorTestRefPtrClientCToCpp::Unwrap(valList[i]);
}
}
}
@ -1014,7 +1022,7 @@ int CEF_CALLBACK translator_test_get_handler_list_by_ref(
return _retval;
}
size_t CEF_CALLBACK translator_test_get_handler_list_size(
size_t CEF_CALLBACK translator_test_get_ref_ptr_client_list_size(
struct _cef_translator_test_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
@ -1023,12 +1031,385 @@ size_t CEF_CALLBACK translator_test_get_handler_list_size(
return 0;
// Execute
size_t _retval = CefTranslatorTestCppToC::Get(self)->GetHandlerListSize();
size_t _retval = CefTranslatorTestCppToC::Get(self)->GetRefPtrClientListSize(
);
// Return type: simple
return _retval;
}
struct _cef_translator_test_scoped_library_t* CEF_CALLBACK translator_test_get_own_ptr_library(
struct _cef_translator_test_t* self, int val) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return NULL;
// Execute
CefOwnPtr<CefTranslatorTestScopedLibrary> _retval =
CefTranslatorTestCppToC::Get(self)->GetOwnPtrLibrary(
val);
// Return type: ownptr_same
return CefTranslatorTestScopedLibraryCppToC::WrapOwn(OWN_PASS(_retval));
}
int CEF_CALLBACK translator_test_set_own_ptr_library(
struct _cef_translator_test_t* self,
struct _cef_translator_test_scoped_library_t* val) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return 0;
// Verify param: val; type: ownptr_same
DCHECK(val);
if (!val)
return 0;
// Execute
int _retval = CefTranslatorTestCppToC::Get(self)->SetOwnPtrLibrary(
CefTranslatorTestScopedLibraryCppToC::UnwrapOwn(val));
// Return type: simple
return _retval;
}
struct _cef_translator_test_scoped_library_t* CEF_CALLBACK translator_test_set_own_ptr_library_and_return(
struct _cef_translator_test_t* self,
struct _cef_translator_test_scoped_library_t* val) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return NULL;
// Verify param: val; type: ownptr_same
DCHECK(val);
if (!val)
return NULL;
// Execute
CefOwnPtr<CefTranslatorTestScopedLibrary> _retval =
CefTranslatorTestCppToC::Get(self)->SetOwnPtrLibraryAndReturn(
CefTranslatorTestScopedLibraryCppToC::UnwrapOwn(val));
// Return type: ownptr_same
return CefTranslatorTestScopedLibraryCppToC::WrapOwn(OWN_PASS(_retval));
}
int CEF_CALLBACK translator_test_set_child_own_ptr_library(
struct _cef_translator_test_t* self,
struct _cef_translator_test_scoped_library_child_t* val) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return 0;
// Verify param: val; type: ownptr_same
DCHECK(val);
if (!val)
return 0;
// Execute
int _retval = CefTranslatorTestCppToC::Get(self)->SetChildOwnPtrLibrary(
CefTranslatorTestScopedLibraryChildCppToC::UnwrapOwn(val));
// Return type: simple
return _retval;
}
struct _cef_translator_test_scoped_library_t* CEF_CALLBACK translator_test_set_child_own_ptr_library_and_return_parent(
struct _cef_translator_test_t* self,
struct _cef_translator_test_scoped_library_child_t* val) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return NULL;
// Verify param: val; type: ownptr_same
DCHECK(val);
if (!val)
return NULL;
// Execute
CefOwnPtr<CefTranslatorTestScopedLibrary> _retval =
CefTranslatorTestCppToC::Get(self)->SetChildOwnPtrLibraryAndReturnParent(
CefTranslatorTestScopedLibraryChildCppToC::UnwrapOwn(val));
// Return type: ownptr_same
return CefTranslatorTestScopedLibraryCppToC::WrapOwn(OWN_PASS(_retval));
}
int CEF_CALLBACK translator_test_set_own_ptr_client(
struct _cef_translator_test_t* self,
struct _cef_translator_test_scoped_client_t* val) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return 0;
// Verify param: val; type: ownptr_diff
DCHECK(val);
if (!val)
return 0;
// Translate param: val; type: ownptr_diff
CefOwnPtr<CefTranslatorTestScopedClient> valPtr(
CefTranslatorTestScopedClientCToCpp::Wrap(val));
// Execute
int _retval = CefTranslatorTestCppToC::Get(self)->SetOwnPtrClient(
OWN_PASS(valPtr));
// Return type: simple
return _retval;
}
struct _cef_translator_test_scoped_client_t* CEF_CALLBACK translator_test_set_own_ptr_client_and_return(
struct _cef_translator_test_t* self,
struct _cef_translator_test_scoped_client_t* val) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return NULL;
// Verify param: val; type: ownptr_diff
DCHECK(val);
if (!val)
return NULL;
// Translate param: val; type: ownptr_diff
CefOwnPtr<CefTranslatorTestScopedClient> valPtr(
CefTranslatorTestScopedClientCToCpp::Wrap(val));
// Execute
CefOwnPtr<CefTranslatorTestScopedClient> _retval =
CefTranslatorTestCppToC::Get(self)->SetOwnPtrClientAndReturn(
OWN_PASS(valPtr));
// Return type: ownptr_diff
return CefTranslatorTestScopedClientCToCpp::UnwrapOwn(OWN_PASS(_retval));
}
int CEF_CALLBACK translator_test_set_child_own_ptr_client(
struct _cef_translator_test_t* self,
struct _cef_translator_test_scoped_client_child_t* val) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return 0;
// Verify param: val; type: ownptr_diff
DCHECK(val);
if (!val)
return 0;
// Translate param: val; type: ownptr_diff
CefOwnPtr<CefTranslatorTestScopedClientChild> valPtr(
CefTranslatorTestScopedClientChildCToCpp::Wrap(val));
// Execute
int _retval = CefTranslatorTestCppToC::Get(self)->SetChildOwnPtrClient(
OWN_PASS(valPtr));
// Return type: simple
return _retval;
}
struct _cef_translator_test_scoped_client_t* CEF_CALLBACK translator_test_set_child_own_ptr_client_and_return_parent(
struct _cef_translator_test_t* self,
struct _cef_translator_test_scoped_client_child_t* val) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return NULL;
// Verify param: val; type: ownptr_diff
DCHECK(val);
if (!val)
return NULL;
// Translate param: val; type: ownptr_diff
CefOwnPtr<CefTranslatorTestScopedClientChild> valPtr(
CefTranslatorTestScopedClientChildCToCpp::Wrap(val));
// Execute
CefOwnPtr<CefTranslatorTestScopedClient> _retval =
CefTranslatorTestCppToC::Get(self)->SetChildOwnPtrClientAndReturnParent(
OWN_PASS(valPtr));
// Return type: ownptr_diff
return CefTranslatorTestScopedClientCToCpp::UnwrapOwn(OWN_PASS(_retval));
}
int CEF_CALLBACK translator_test_set_raw_ptr_library(
struct _cef_translator_test_t* self,
struct _cef_translator_test_scoped_library_t* val) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return 0;
// Verify param: val; type: rawptr_same
DCHECK(val);
if (!val)
return 0;
// Execute
int _retval = CefTranslatorTestCppToC::Get(self)->SetRawPtrLibrary(
CefTranslatorTestScopedLibraryCppToC::UnwrapRaw(val));
// Return type: simple
return _retval;
}
int CEF_CALLBACK translator_test_set_child_raw_ptr_library(
struct _cef_translator_test_t* self,
struct _cef_translator_test_scoped_library_child_t* val) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return 0;
// Verify param: val; type: rawptr_same
DCHECK(val);
if (!val)
return 0;
// Execute
int _retval = CefTranslatorTestCppToC::Get(self)->SetChildRawPtrLibrary(
CefTranslatorTestScopedLibraryChildCppToC::UnwrapRaw(val));
// Return type: simple
return _retval;
}
int CEF_CALLBACK translator_test_set_raw_ptr_library_list(
struct _cef_translator_test_t* self, size_t valCount,
struct _cef_translator_test_scoped_library_t* const* val, int val1,
int val2) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return 0;
// Verify param: val; type: rawptr_vec_same_byref_const
DCHECK(valCount == 0 || val);
if (valCount > 0 && !val)
return 0;
// Translate param: val; type: rawptr_vec_same_byref_const
std::vector<CefRawPtr<CefTranslatorTestScopedLibrary> > valList;
if (valCount > 0) {
for (size_t i = 0; i < valCount; ++i) {
CefRawPtr<CefTranslatorTestScopedLibrary> valVal =
CefTranslatorTestScopedLibraryCppToC::UnwrapRaw(val[i]);
valList.push_back(valVal);
}
}
// Execute
bool _retval = CefTranslatorTestCppToC::Get(self)->SetRawPtrLibraryList(
valList,
val1,
val2);
// Return type: bool
return _retval;
}
int CEF_CALLBACK translator_test_set_raw_ptr_client(
struct _cef_translator_test_t* self,
struct _cef_translator_test_scoped_client_t* val) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return 0;
// Verify param: val; type: rawptr_diff
DCHECK(val);
if (!val)
return 0;
// Translate param: val; type: rawptr_diff
CefOwnPtr<CefTranslatorTestScopedClient> valPtr(
CefTranslatorTestScopedClientCToCpp::Wrap(val));
// Execute
int _retval = CefTranslatorTestCppToC::Get(self)->SetRawPtrClient(
valPtr.get());
// Return type: simple
return _retval;
}
int CEF_CALLBACK translator_test_set_child_raw_ptr_client(
struct _cef_translator_test_t* self,
struct _cef_translator_test_scoped_client_child_t* val) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return 0;
// Verify param: val; type: rawptr_diff
DCHECK(val);
if (!val)
return 0;
// Translate param: val; type: rawptr_diff
CefOwnPtr<CefTranslatorTestScopedClientChild> valPtr(
CefTranslatorTestScopedClientChildCToCpp::Wrap(val));
// Execute
int _retval = CefTranslatorTestCppToC::Get(self)->SetChildRawPtrClient(
valPtr.get());
// Return type: simple
return _retval;
}
int CEF_CALLBACK translator_test_set_raw_ptr_client_list(
struct _cef_translator_test_t* self, size_t valCount,
struct _cef_translator_test_scoped_client_t* const* val, int val1,
int val2) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return 0;
// Verify param: val; type: rawptr_vec_diff_byref_const
DCHECK(valCount == 0 || val);
if (valCount > 0 && !val)
return 0;
// Translate param: val; type: rawptr_vec_diff_byref_const
std::vector<CefRawPtr<CefTranslatorTestScopedClient> > valList;
if (valCount > 0) {
for (size_t i = 0; i < valCount; ++i) {
CefRawPtr<CefTranslatorTestScopedClient> valVal =
CefTranslatorTestScopedClientCToCpp::Wrap(val[i]).release();
valList.push_back(valVal);
}
}
// Execute
bool _retval = CefTranslatorTestCppToC::Get(self)->SetRawPtrClientList(
valList,
val1,
val2);
// Restore param: val; type: rawptr_vec_diff_byref_const
if (valCount > 0) {
for (size_t i = 0; i < valCount; ++i) {
delete valList[i];
}
}
// Return type: bool
return _retval;
}
} // namespace
@ -1066,24 +1447,58 @@ CefTranslatorTestCppToC::CefTranslatorTestCppToC() {
GetStruct()->set_point_list = translator_test_set_point_list;
GetStruct()->get_point_list_by_ref = translator_test_get_point_list_by_ref;
GetStruct()->get_point_list_size = translator_test_get_point_list_size;
GetStruct()->get_object = translator_test_get_object;
GetStruct()->set_object = translator_test_set_object;
GetStruct()->set_object_and_return = translator_test_set_object_and_return;
GetStruct()->set_child_object = translator_test_set_child_object;
GetStruct()->set_child_object_and_return_parent =
translator_test_set_child_object_and_return_parent;
GetStruct()->set_object_list = translator_test_set_object_list;
GetStruct()->get_object_list_by_ref = translator_test_get_object_list_by_ref;
GetStruct()->get_object_list_size = translator_test_get_object_list_size;
GetStruct()->set_handler = translator_test_set_handler;
GetStruct()->set_handler_and_return = translator_test_set_handler_and_return;
GetStruct()->set_child_handler = translator_test_set_child_handler;
GetStruct()->set_child_handler_and_return_parent =
translator_test_set_child_handler_and_return_parent;
GetStruct()->set_handler_list = translator_test_set_handler_list;
GetStruct()->get_handler_list_by_ref =
translator_test_get_handler_list_by_ref;
GetStruct()->get_handler_list_size = translator_test_get_handler_list_size;
GetStruct()->get_ref_ptr_library = translator_test_get_ref_ptr_library;
GetStruct()->set_ref_ptr_library = translator_test_set_ref_ptr_library;
GetStruct()->set_ref_ptr_library_and_return =
translator_test_set_ref_ptr_library_and_return;
GetStruct()->set_child_ref_ptr_library =
translator_test_set_child_ref_ptr_library;
GetStruct()->set_child_ref_ptr_library_and_return_parent =
translator_test_set_child_ref_ptr_library_and_return_parent;
GetStruct()->set_ref_ptr_library_list =
translator_test_set_ref_ptr_library_list;
GetStruct()->get_ref_ptr_library_list_by_ref =
translator_test_get_ref_ptr_library_list_by_ref;
GetStruct()->get_ref_ptr_library_list_size =
translator_test_get_ref_ptr_library_list_size;
GetStruct()->set_ref_ptr_client = translator_test_set_ref_ptr_client;
GetStruct()->set_ref_ptr_client_and_return =
translator_test_set_ref_ptr_client_and_return;
GetStruct()->set_child_ref_ptr_client =
translator_test_set_child_ref_ptr_client;
GetStruct()->set_child_ref_ptr_client_and_return_parent =
translator_test_set_child_ref_ptr_client_and_return_parent;
GetStruct()->set_ref_ptr_client_list =
translator_test_set_ref_ptr_client_list;
GetStruct()->get_ref_ptr_client_list_by_ref =
translator_test_get_ref_ptr_client_list_by_ref;
GetStruct()->get_ref_ptr_client_list_size =
translator_test_get_ref_ptr_client_list_size;
GetStruct()->get_own_ptr_library = translator_test_get_own_ptr_library;
GetStruct()->set_own_ptr_library = translator_test_set_own_ptr_library;
GetStruct()->set_own_ptr_library_and_return =
translator_test_set_own_ptr_library_and_return;
GetStruct()->set_child_own_ptr_library =
translator_test_set_child_own_ptr_library;
GetStruct()->set_child_own_ptr_library_and_return_parent =
translator_test_set_child_own_ptr_library_and_return_parent;
GetStruct()->set_own_ptr_client = translator_test_set_own_ptr_client;
GetStruct()->set_own_ptr_client_and_return =
translator_test_set_own_ptr_client_and_return;
GetStruct()->set_child_own_ptr_client =
translator_test_set_child_own_ptr_client;
GetStruct()->set_child_own_ptr_client_and_return_parent =
translator_test_set_child_own_ptr_client_and_return_parent;
GetStruct()->set_raw_ptr_library = translator_test_set_raw_ptr_library;
GetStruct()->set_child_raw_ptr_library =
translator_test_set_child_raw_ptr_library;
GetStruct()->set_raw_ptr_library_list =
translator_test_set_raw_ptr_library_list;
GetStruct()->set_raw_ptr_client = translator_test_set_raw_ptr_client;
GetStruct()->set_child_raw_ptr_client =
translator_test_set_child_raw_ptr_client;
GetStruct()->set_raw_ptr_client_list =
translator_test_set_raw_ptr_client_list;
}
template<> CefRefPtr<CefTranslatorTest> CefCppToC<CefTranslatorTestCppToC,

View File

@ -1,79 +0,0 @@
// Copyright (c) 2017 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool. If making changes by
// hand only do so within the body of existing method and function
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
#include "libcef_dll/cpptoc/test/translator_test_handler_child_cpptoc.h"
namespace {
// MEMBER FUNCTIONS - Body may be edited by hand.
int CEF_CALLBACK translator_test_handler_child_get_other_value(
struct _cef_translator_test_handler_child_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return 0;
// Execute
int _retval = CefTranslatorTestHandlerChildCppToC::Get(self)->GetOtherValue();
// Return type: simple
return _retval;
}
int CEF_CALLBACK translator_test_handler_child_get_value(
struct _cef_translator_test_handler_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return 0;
// Execute
int _retval = CefTranslatorTestHandlerChildCppToC::Get(
reinterpret_cast<cef_translator_test_handler_child_t*>(self))->GetValue(
);
// Return type: simple
return _retval;
}
} // namespace
// CONSTRUCTOR - Do not edit by hand.
CefTranslatorTestHandlerChildCppToC::CefTranslatorTestHandlerChildCppToC() {
GetStruct()->get_other_value = translator_test_handler_child_get_other_value;
GetStruct()->base.get_value = translator_test_handler_child_get_value;
}
template<> CefRefPtr<CefTranslatorTestHandlerChild> CefCppToC<CefTranslatorTestHandlerChildCppToC,
CefTranslatorTestHandlerChild,
cef_translator_test_handler_child_t>::UnwrapDerived(CefWrapperType type,
cef_translator_test_handler_child_t* s) {
NOTREACHED() << "Unexpected class type: " << type;
return NULL;
}
#if DCHECK_IS_ON()
template<> base::AtomicRefCount CefCppToC<CefTranslatorTestHandlerChildCppToC,
CefTranslatorTestHandlerChild,
cef_translator_test_handler_child_t>::DebugObjCt = 0;
#endif
template<> CefWrapperType CefCppToC<CefTranslatorTestHandlerChildCppToC,
CefTranslatorTestHandlerChild,
cef_translator_test_handler_child_t>::kWrapperType =
WT_TRANSLATOR_TEST_HANDLER_CHILD;

View File

@ -1,63 +0,0 @@
// Copyright (c) 2017 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool. If making changes by
// hand only do so within the body of existing method and function
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
#include "libcef_dll/cpptoc/test/translator_test_handler_cpptoc.h"
#include "libcef_dll/cpptoc/test/translator_test_handler_child_cpptoc.h"
namespace {
// MEMBER FUNCTIONS - Body may be edited by hand.
int CEF_CALLBACK translator_test_handler_get_value(
struct _cef_translator_test_handler_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return 0;
// Execute
int _retval = CefTranslatorTestHandlerCppToC::Get(self)->GetValue();
// Return type: simple
return _retval;
}
} // namespace
// CONSTRUCTOR - Do not edit by hand.
CefTranslatorTestHandlerCppToC::CefTranslatorTestHandlerCppToC() {
GetStruct()->get_value = translator_test_handler_get_value;
}
template<> CefRefPtr<CefTranslatorTestHandler> CefCppToC<CefTranslatorTestHandlerCppToC,
CefTranslatorTestHandler, cef_translator_test_handler_t>::UnwrapDerived(
CefWrapperType type, cef_translator_test_handler_t* s) {
if (type == WT_TRANSLATOR_TEST_HANDLER_CHILD) {
return CefTranslatorTestHandlerChildCppToC::Unwrap(
reinterpret_cast<cef_translator_test_handler_child_t*>(s));
}
NOTREACHED() << "Unexpected class type: " << type;
return NULL;
}
#if DCHECK_IS_ON()
template<> base::AtomicRefCount CefCppToC<CefTranslatorTestHandlerCppToC,
CefTranslatorTestHandler, cef_translator_test_handler_t>::DebugObjCt = 0;
#endif
template<> CefWrapperType CefCppToC<CefTranslatorTestHandlerCppToC,
CefTranslatorTestHandler, cef_translator_test_handler_t>::kWrapperType =
WT_TRANSLATOR_TEST_HANDLER;

View File

@ -1,169 +0,0 @@
// Copyright (c) 2017 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool. If making changes by
// hand only do so within the body of existing method and function
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
#include "libcef_dll/cpptoc/test/translator_test_object_child_child_cpptoc.h"
// GLOBAL FUNCTIONS - Body may be edited by hand.
CEF_EXPORT cef_translator_test_object_child_child_t* cef_translator_test_object_child_child_create(
int value, int other_value, int other_other_value) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
CefRefPtr<CefTranslatorTestObjectChildChild> _retval =
CefTranslatorTestObjectChildChild::Create(
value,
other_value,
other_other_value);
// Return type: refptr_same
return CefTranslatorTestObjectChildChildCppToC::Wrap(_retval);
}
namespace {
// MEMBER FUNCTIONS - Body may be edited by hand.
int CEF_CALLBACK translator_test_object_child_child_get_other_other_value(
struct _cef_translator_test_object_child_child_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return 0;
// Execute
int _retval = CefTranslatorTestObjectChildChildCppToC::Get(
self)->GetOtherOtherValue();
// Return type: simple
return _retval;
}
void CEF_CALLBACK translator_test_object_child_child_set_other_other_value(
struct _cef_translator_test_object_child_child_t* self, int value) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return;
// Execute
CefTranslatorTestObjectChildChildCppToC::Get(self)->SetOtherOtherValue(
value);
}
int CEF_CALLBACK translator_test_object_child_child_get_other_value(
struct _cef_translator_test_object_child_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return 0;
// Execute
int _retval = CefTranslatorTestObjectChildChildCppToC::Get(
reinterpret_cast<cef_translator_test_object_child_child_t*>(
self))->GetOtherValue();
// Return type: simple
return _retval;
}
void CEF_CALLBACK translator_test_object_child_child_set_other_value(
struct _cef_translator_test_object_child_t* self, int value) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return;
// Execute
CefTranslatorTestObjectChildChildCppToC::Get(
reinterpret_cast<cef_translator_test_object_child_child_t*>(
self))->SetOtherValue(
value);
}
int CEF_CALLBACK translator_test_object_child_child_get_value(
struct _cef_translator_test_object_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return 0;
// Execute
int _retval = CefTranslatorTestObjectChildChildCppToC::Get(
reinterpret_cast<cef_translator_test_object_child_child_t*>(
self))->GetValue();
// Return type: simple
return _retval;
}
void CEF_CALLBACK translator_test_object_child_child_set_value(
struct _cef_translator_test_object_t* self, int value) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return;
// Execute
CefTranslatorTestObjectChildChildCppToC::Get(
reinterpret_cast<cef_translator_test_object_child_child_t*>(
self))->SetValue(
value);
}
} // namespace
// CONSTRUCTOR - Do not edit by hand.
CefTranslatorTestObjectChildChildCppToC::CefTranslatorTestObjectChildChildCppToC(
) {
GetStruct()->get_other_other_value =
translator_test_object_child_child_get_other_other_value;
GetStruct()->set_other_other_value =
translator_test_object_child_child_set_other_other_value;
GetStruct()->base.get_other_value =
translator_test_object_child_child_get_other_value;
GetStruct()->base.set_other_value =
translator_test_object_child_child_set_other_value;
GetStruct()->base.base.get_value =
translator_test_object_child_child_get_value;
GetStruct()->base.base.set_value =
translator_test_object_child_child_set_value;
}
template<> CefRefPtr<CefTranslatorTestObjectChildChild> CefCppToC<CefTranslatorTestObjectChildChildCppToC,
CefTranslatorTestObjectChildChild,
cef_translator_test_object_child_child_t>::UnwrapDerived(
CefWrapperType type, cef_translator_test_object_child_child_t* s) {
NOTREACHED() << "Unexpected class type: " << type;
return NULL;
}
#if DCHECK_IS_ON()
template<> base::AtomicRefCount CefCppToC<CefTranslatorTestObjectChildChildCppToC,
CefTranslatorTestObjectChildChild,
cef_translator_test_object_child_child_t>::DebugObjCt = 0;
#endif
template<> CefWrapperType CefCppToC<CefTranslatorTestObjectChildChildCppToC,
CefTranslatorTestObjectChildChild,
cef_translator_test_object_child_child_t>::kWrapperType =
WT_TRANSLATOR_TEST_OBJECT_CHILD_CHILD;

View File

@ -1,129 +0,0 @@
// Copyright (c) 2017 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool. If making changes by
// hand only do so within the body of existing method and function
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
#include "libcef_dll/cpptoc/test/translator_test_object_child_cpptoc.h"
#include "libcef_dll/cpptoc/test/translator_test_object_child_child_cpptoc.h"
// GLOBAL FUNCTIONS - Body may be edited by hand.
CEF_EXPORT cef_translator_test_object_child_t* cef_translator_test_object_child_create(
int value, int other_value) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
CefRefPtr<CefTranslatorTestObjectChild> _retval =
CefTranslatorTestObjectChild::Create(
value,
other_value);
// Return type: refptr_same
return CefTranslatorTestObjectChildCppToC::Wrap(_retval);
}
namespace {
// MEMBER FUNCTIONS - Body may be edited by hand.
int CEF_CALLBACK translator_test_object_child_get_other_value(
struct _cef_translator_test_object_child_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return 0;
// Execute
int _retval = CefTranslatorTestObjectChildCppToC::Get(self)->GetOtherValue();
// Return type: simple
return _retval;
}
void CEF_CALLBACK translator_test_object_child_set_other_value(
struct _cef_translator_test_object_child_t* self, int value) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return;
// Execute
CefTranslatorTestObjectChildCppToC::Get(self)->SetOtherValue(
value);
}
int CEF_CALLBACK translator_test_object_child_get_value(
struct _cef_translator_test_object_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return 0;
// Execute
int _retval = CefTranslatorTestObjectChildCppToC::Get(
reinterpret_cast<cef_translator_test_object_child_t*>(self))->GetValue();
// Return type: simple
return _retval;
}
void CEF_CALLBACK translator_test_object_child_set_value(
struct _cef_translator_test_object_t* self, int value) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return;
// Execute
CefTranslatorTestObjectChildCppToC::Get(
reinterpret_cast<cef_translator_test_object_child_t*>(self))->SetValue(
value);
}
} // namespace
// CONSTRUCTOR - Do not edit by hand.
CefTranslatorTestObjectChildCppToC::CefTranslatorTestObjectChildCppToC() {
GetStruct()->get_other_value = translator_test_object_child_get_other_value;
GetStruct()->set_other_value = translator_test_object_child_set_other_value;
GetStruct()->base.get_value = translator_test_object_child_get_value;
GetStruct()->base.set_value = translator_test_object_child_set_value;
}
template<> CefRefPtr<CefTranslatorTestObjectChild> CefCppToC<CefTranslatorTestObjectChildCppToC,
CefTranslatorTestObjectChild,
cef_translator_test_object_child_t>::UnwrapDerived(CefWrapperType type,
cef_translator_test_object_child_t* s) {
if (type == WT_TRANSLATOR_TEST_OBJECT_CHILD_CHILD) {
return CefTranslatorTestObjectChildChildCppToC::Unwrap(
reinterpret_cast<cef_translator_test_object_child_child_t*>(s));
}
NOTREACHED() << "Unexpected class type: " << type;
return NULL;
}
#if DCHECK_IS_ON()
template<> base::AtomicRefCount CefCppToC<CefTranslatorTestObjectChildCppToC,
CefTranslatorTestObjectChild,
cef_translator_test_object_child_t>::DebugObjCt = 0;
#endif
template<> CefWrapperType CefCppToC<CefTranslatorTestObjectChildCppToC,
CefTranslatorTestObjectChild,
cef_translator_test_object_child_t>::kWrapperType =
WT_TRANSLATOR_TEST_OBJECT_CHILD;

View File

@ -1,97 +0,0 @@
// Copyright (c) 2017 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool. If making changes by
// hand only do so within the body of existing method and function
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
#include "libcef_dll/cpptoc/test/translator_test_object_cpptoc.h"
#include "libcef_dll/cpptoc/test/translator_test_object_child_cpptoc.h"
#include "libcef_dll/cpptoc/test/translator_test_object_child_child_cpptoc.h"
// GLOBAL FUNCTIONS - Body may be edited by hand.
CEF_EXPORT cef_translator_test_object_t* cef_translator_test_object_create(
int value) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
CefRefPtr<CefTranslatorTestObject> _retval = CefTranslatorTestObject::Create(
value);
// Return type: refptr_same
return CefTranslatorTestObjectCppToC::Wrap(_retval);
}
namespace {
// MEMBER FUNCTIONS - Body may be edited by hand.
int CEF_CALLBACK translator_test_object_get_value(
struct _cef_translator_test_object_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return 0;
// Execute
int _retval = CefTranslatorTestObjectCppToC::Get(self)->GetValue();
// Return type: simple
return _retval;
}
void CEF_CALLBACK translator_test_object_set_value(
struct _cef_translator_test_object_t* self, int value) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return;
// Execute
CefTranslatorTestObjectCppToC::Get(self)->SetValue(
value);
}
} // namespace
// CONSTRUCTOR - Do not edit by hand.
CefTranslatorTestObjectCppToC::CefTranslatorTestObjectCppToC() {
GetStruct()->get_value = translator_test_object_get_value;
GetStruct()->set_value = translator_test_object_set_value;
}
template<> CefRefPtr<CefTranslatorTestObject> CefCppToC<CefTranslatorTestObjectCppToC,
CefTranslatorTestObject, cef_translator_test_object_t>::UnwrapDerived(
CefWrapperType type, cef_translator_test_object_t* s) {
if (type == WT_TRANSLATOR_TEST_OBJECT_CHILD) {
return CefTranslatorTestObjectChildCppToC::Unwrap(
reinterpret_cast<cef_translator_test_object_child_t*>(s));
}
if (type == WT_TRANSLATOR_TEST_OBJECT_CHILD_CHILD) {
return CefTranslatorTestObjectChildChildCppToC::Unwrap(
reinterpret_cast<cef_translator_test_object_child_child_t*>(s));
}
NOTREACHED() << "Unexpected class type: " << type;
return NULL;
}
#if DCHECK_IS_ON()
template<> base::AtomicRefCount CefCppToC<CefTranslatorTestObjectCppToC,
CefTranslatorTestObject, cef_translator_test_object_t>::DebugObjCt = 0;
#endif
template<> CefWrapperType CefCppToC<CefTranslatorTestObjectCppToC,
CefTranslatorTestObject, cef_translator_test_object_t>::kWrapperType =
WT_TRANSLATOR_TEST_OBJECT;

View File

@ -0,0 +1,82 @@
// Copyright (c) 2017 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool. If making changes by
// hand only do so within the body of existing method and function
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
#include "libcef_dll/cpptoc/test/translator_test_ref_ptr_client_child_cpptoc.h"
namespace {
// MEMBER FUNCTIONS - Body may be edited by hand.
int CEF_CALLBACK translator_test_ref_ptr_client_child_get_other_value(
struct _cef_translator_test_ref_ptr_client_child_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return 0;
// Execute
int _retval = CefTranslatorTestRefPtrClientChildCppToC::Get(
self)->GetOtherValue();
// Return type: simple
return _retval;
}
int CEF_CALLBACK translator_test_ref_ptr_client_child_get_value(
struct _cef_translator_test_ref_ptr_client_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return 0;
// Execute
int _retval = CefTranslatorTestRefPtrClientChildCppToC::Get(
reinterpret_cast<cef_translator_test_ref_ptr_client_child_t*>(
self))->GetValue();
// Return type: simple
return _retval;
}
} // namespace
// CONSTRUCTOR - Do not edit by hand.
CefTranslatorTestRefPtrClientChildCppToC::CefTranslatorTestRefPtrClientChildCppToC(
) {
GetStruct()->get_other_value =
translator_test_ref_ptr_client_child_get_other_value;
GetStruct()->base.get_value = translator_test_ref_ptr_client_child_get_value;
}
template<> CefRefPtr<CefTranslatorTestRefPtrClientChild> CefCppToC<CefTranslatorTestRefPtrClientChildCppToC,
CefTranslatorTestRefPtrClientChild,
cef_translator_test_ref_ptr_client_child_t>::UnwrapDerived(
CefWrapperType type, cef_translator_test_ref_ptr_client_child_t* s) {
NOTREACHED() << "Unexpected class type: " << type;
return NULL;
}
#if DCHECK_IS_ON()
template<> base::AtomicRefCount CefCppToC<CefTranslatorTestRefPtrClientChildCppToC,
CefTranslatorTestRefPtrClientChild,
cef_translator_test_ref_ptr_client_child_t>::DebugObjCt = 0;
#endif
template<> CefWrapperType CefCppToC<CefTranslatorTestRefPtrClientChildCppToC,
CefTranslatorTestRefPtrClientChild,
cef_translator_test_ref_ptr_client_child_t>::kWrapperType =
WT_TRANSLATOR_TEST_REF_PTR_CLIENT_CHILD;

View File

@ -10,8 +10,8 @@
// for more information.
//
#ifndef CEF_LIBCEF_DLL_CPPTOC_TEST_TRANSLATOR_TEST_HANDLER_CPPTOC_H_
#define CEF_LIBCEF_DLL_CPPTOC_TEST_TRANSLATOR_TEST_HANDLER_CPPTOC_H_
#ifndef CEF_LIBCEF_DLL_CPPTOC_TEST_TRANSLATOR_TEST_REF_PTR_CLIENT_CHILD_CPPTOC_H_
#define CEF_LIBCEF_DLL_CPPTOC_TEST_TRANSLATOR_TEST_REF_PTR_CLIENT_CHILD_CPPTOC_H_
#pragma once
#if !defined(WRAPPING_CEF_SHARED)
@ -24,11 +24,12 @@
// Wrap a C++ class with a C structure.
// This class may be instantiated and accessed wrapper-side only.
class CefTranslatorTestHandlerCppToC
: public CefCppToC<CefTranslatorTestHandlerCppToC, CefTranslatorTestHandler,
cef_translator_test_handler_t> {
class CefTranslatorTestRefPtrClientChildCppToC
: public CefCppToC<CefTranslatorTestRefPtrClientChildCppToC,
CefTranslatorTestRefPtrClientChild,
cef_translator_test_ref_ptr_client_child_t> {
public:
CefTranslatorTestHandlerCppToC();
CefTranslatorTestRefPtrClientChildCppToC();
};
#endif // CEF_LIBCEF_DLL_CPPTOC_TEST_TRANSLATOR_TEST_HANDLER_CPPTOC_H_
#endif // CEF_LIBCEF_DLL_CPPTOC_TEST_TRANSLATOR_TEST_REF_PTR_CLIENT_CHILD_CPPTOC_H_

View File

@ -0,0 +1,66 @@
// Copyright (c) 2017 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool. If making changes by
// hand only do so within the body of existing method and function
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
#include "libcef_dll/cpptoc/test/translator_test_ref_ptr_client_cpptoc.h"
#include "libcef_dll/cpptoc/test/translator_test_ref_ptr_client_child_cpptoc.h"
namespace {
// MEMBER FUNCTIONS - Body may be edited by hand.
int CEF_CALLBACK translator_test_ref_ptr_client_get_value(
struct _cef_translator_test_ref_ptr_client_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return 0;
// Execute
int _retval = CefTranslatorTestRefPtrClientCppToC::Get(self)->GetValue();
// Return type: simple
return _retval;
}
} // namespace
// CONSTRUCTOR - Do not edit by hand.
CefTranslatorTestRefPtrClientCppToC::CefTranslatorTestRefPtrClientCppToC() {
GetStruct()->get_value = translator_test_ref_ptr_client_get_value;
}
template<> CefRefPtr<CefTranslatorTestRefPtrClient> CefCppToC<CefTranslatorTestRefPtrClientCppToC,
CefTranslatorTestRefPtrClient,
cef_translator_test_ref_ptr_client_t>::UnwrapDerived(CefWrapperType type,
cef_translator_test_ref_ptr_client_t* s) {
if (type == WT_TRANSLATOR_TEST_REF_PTR_CLIENT_CHILD) {
return CefTranslatorTestRefPtrClientChildCppToC::Unwrap(
reinterpret_cast<cef_translator_test_ref_ptr_client_child_t*>(s));
}
NOTREACHED() << "Unexpected class type: " << type;
return NULL;
}
#if DCHECK_IS_ON()
template<> base::AtomicRefCount CefCppToC<CefTranslatorTestRefPtrClientCppToC,
CefTranslatorTestRefPtrClient,
cef_translator_test_ref_ptr_client_t>::DebugObjCt = 0;
#endif
template<> CefWrapperType CefCppToC<CefTranslatorTestRefPtrClientCppToC,
CefTranslatorTestRefPtrClient,
cef_translator_test_ref_ptr_client_t>::kWrapperType =
WT_TRANSLATOR_TEST_REF_PTR_CLIENT;

View File

@ -10,8 +10,8 @@
// for more information.
//
#ifndef CEF_LIBCEF_DLL_CPPTOC_TEST_TRANSLATOR_TEST_HANDLER_CHILD_CPPTOC_H_
#define CEF_LIBCEF_DLL_CPPTOC_TEST_TRANSLATOR_TEST_HANDLER_CHILD_CPPTOC_H_
#ifndef CEF_LIBCEF_DLL_CPPTOC_TEST_TRANSLATOR_TEST_REF_PTR_CLIENT_CPPTOC_H_
#define CEF_LIBCEF_DLL_CPPTOC_TEST_TRANSLATOR_TEST_REF_PTR_CLIENT_CPPTOC_H_
#pragma once
#if !defined(WRAPPING_CEF_SHARED)
@ -24,11 +24,11 @@
// Wrap a C++ class with a C structure.
// This class may be instantiated and accessed wrapper-side only.
class CefTranslatorTestHandlerChildCppToC
: public CefCppToC<CefTranslatorTestHandlerChildCppToC,
CefTranslatorTestHandlerChild, cef_translator_test_handler_child_t> {
class CefTranslatorTestRefPtrClientCppToC
: public CefCppToC<CefTranslatorTestRefPtrClientCppToC,
CefTranslatorTestRefPtrClient, cef_translator_test_ref_ptr_client_t> {
public:
CefTranslatorTestHandlerChildCppToC();
CefTranslatorTestRefPtrClientCppToC();
};
#endif // CEF_LIBCEF_DLL_CPPTOC_TEST_TRANSLATOR_TEST_HANDLER_CHILD_CPPTOC_H_
#endif // CEF_LIBCEF_DLL_CPPTOC_TEST_TRANSLATOR_TEST_REF_PTR_CLIENT_CPPTOC_H_

View File

@ -0,0 +1,171 @@
// Copyright (c) 2017 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool. If making changes by
// hand only do so within the body of existing method and function
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
#include "libcef_dll/cpptoc/test/translator_test_ref_ptr_library_child_child_cpptoc.h"
// GLOBAL FUNCTIONS - Body may be edited by hand.
CEF_EXPORT cef_translator_test_ref_ptr_library_child_child_t* cef_translator_test_ref_ptr_library_child_child_create(
int value, int other_value, int other_other_value) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
CefRefPtr<CefTranslatorTestRefPtrLibraryChildChild> _retval =
CefTranslatorTestRefPtrLibraryChildChild::Create(
value,
other_value,
other_other_value);
// Return type: refptr_same
return CefTranslatorTestRefPtrLibraryChildChildCppToC::Wrap(_retval);
}
namespace {
// MEMBER FUNCTIONS - Body may be edited by hand.
int CEF_CALLBACK translator_test_ref_ptr_library_child_child_get_other_other_value(
struct _cef_translator_test_ref_ptr_library_child_child_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return 0;
// Execute
int _retval = CefTranslatorTestRefPtrLibraryChildChildCppToC::Get(
self)->GetOtherOtherValue();
// Return type: simple
return _retval;
}
void CEF_CALLBACK translator_test_ref_ptr_library_child_child_set_other_other_value(
struct _cef_translator_test_ref_ptr_library_child_child_t* self,
int value) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return;
// Execute
CefTranslatorTestRefPtrLibraryChildChildCppToC::Get(self)->SetOtherOtherValue(
value);
}
int CEF_CALLBACK translator_test_ref_ptr_library_child_child_get_other_value(
struct _cef_translator_test_ref_ptr_library_child_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return 0;
// Execute
int _retval = CefTranslatorTestRefPtrLibraryChildChildCppToC::Get(
reinterpret_cast<cef_translator_test_ref_ptr_library_child_child_t*>(
self))->GetOtherValue();
// Return type: simple
return _retval;
}
void CEF_CALLBACK translator_test_ref_ptr_library_child_child_set_other_value(
struct _cef_translator_test_ref_ptr_library_child_t* self, int value) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return;
// Execute
CefTranslatorTestRefPtrLibraryChildChildCppToC::Get(
reinterpret_cast<cef_translator_test_ref_ptr_library_child_child_t*>(
self))->SetOtherValue(
value);
}
int CEF_CALLBACK translator_test_ref_ptr_library_child_child_get_value(
struct _cef_translator_test_ref_ptr_library_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return 0;
// Execute
int _retval = CefTranslatorTestRefPtrLibraryChildChildCppToC::Get(
reinterpret_cast<cef_translator_test_ref_ptr_library_child_child_t*>(
self))->GetValue();
// Return type: simple
return _retval;
}
void CEF_CALLBACK translator_test_ref_ptr_library_child_child_set_value(
struct _cef_translator_test_ref_ptr_library_t* self, int value) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return;
// Execute
CefTranslatorTestRefPtrLibraryChildChildCppToC::Get(
reinterpret_cast<cef_translator_test_ref_ptr_library_child_child_t*>(
self))->SetValue(
value);
}
} // namespace
// CONSTRUCTOR - Do not edit by hand.
CefTranslatorTestRefPtrLibraryChildChildCppToC::CefTranslatorTestRefPtrLibraryChildChildCppToC(
) {
GetStruct()->get_other_other_value =
translator_test_ref_ptr_library_child_child_get_other_other_value;
GetStruct()->set_other_other_value =
translator_test_ref_ptr_library_child_child_set_other_other_value;
GetStruct()->base.get_other_value =
translator_test_ref_ptr_library_child_child_get_other_value;
GetStruct()->base.set_other_value =
translator_test_ref_ptr_library_child_child_set_other_value;
GetStruct()->base.base.get_value =
translator_test_ref_ptr_library_child_child_get_value;
GetStruct()->base.base.set_value =
translator_test_ref_ptr_library_child_child_set_value;
}
template<> CefRefPtr<CefTranslatorTestRefPtrLibraryChildChild> CefCppToC<CefTranslatorTestRefPtrLibraryChildChildCppToC,
CefTranslatorTestRefPtrLibraryChildChild,
cef_translator_test_ref_ptr_library_child_child_t>::UnwrapDerived(
CefWrapperType type,
cef_translator_test_ref_ptr_library_child_child_t* s) {
NOTREACHED() << "Unexpected class type: " << type;
return NULL;
}
#if DCHECK_IS_ON()
template<> base::AtomicRefCount CefCppToC<CefTranslatorTestRefPtrLibraryChildChildCppToC,
CefTranslatorTestRefPtrLibraryChildChild,
cef_translator_test_ref_ptr_library_child_child_t>::DebugObjCt = 0;
#endif
template<> CefWrapperType CefCppToC<CefTranslatorTestRefPtrLibraryChildChildCppToC,
CefTranslatorTestRefPtrLibraryChildChild,
cef_translator_test_ref_ptr_library_child_child_t>::kWrapperType =
WT_TRANSLATOR_TEST_REF_PTR_LIBRARY_CHILD_CHILD;

View File

@ -0,0 +1,35 @@
// Copyright (c) 2017 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool. If making changes by
// hand only do so within the body of existing method and function
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
#ifndef CEF_LIBCEF_DLL_CPPTOC_TEST_TRANSLATOR_TEST_REF_PTR_LIBRARY_CHILD_CHILD_CPPTOC_H_
#define CEF_LIBCEF_DLL_CPPTOC_TEST_TRANSLATOR_TEST_REF_PTR_LIBRARY_CHILD_CHILD_CPPTOC_H_
#pragma once
#if !defined(BUILDING_CEF_SHARED)
#error This file can be included DLL-side only
#endif
#include "include/test/cef_translator_test.h"
#include "include/capi/test/cef_translator_test_capi.h"
#include "libcef_dll/cpptoc/cpptoc.h"
// Wrap a C++ class with a C structure.
// This class may be instantiated and accessed DLL-side only.
class CefTranslatorTestRefPtrLibraryChildChildCppToC
: public CefCppToC<CefTranslatorTestRefPtrLibraryChildChildCppToC,
CefTranslatorTestRefPtrLibraryChildChild,
cef_translator_test_ref_ptr_library_child_child_t> {
public:
CefTranslatorTestRefPtrLibraryChildChildCppToC();
};
#endif // CEF_LIBCEF_DLL_CPPTOC_TEST_TRANSLATOR_TEST_REF_PTR_LIBRARY_CHILD_CHILD_CPPTOC_H_

View File

@ -0,0 +1,136 @@
// Copyright (c) 2017 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool. If making changes by
// hand only do so within the body of existing method and function
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
#include "libcef_dll/cpptoc/test/translator_test_ref_ptr_library_child_cpptoc.h"
#include "libcef_dll/cpptoc/test/translator_test_ref_ptr_library_child_child_cpptoc.h"
// GLOBAL FUNCTIONS - Body may be edited by hand.
CEF_EXPORT cef_translator_test_ref_ptr_library_child_t* cef_translator_test_ref_ptr_library_child_create(
int value, int other_value) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
CefRefPtr<CefTranslatorTestRefPtrLibraryChild> _retval =
CefTranslatorTestRefPtrLibraryChild::Create(
value,
other_value);
// Return type: refptr_same
return CefTranslatorTestRefPtrLibraryChildCppToC::Wrap(_retval);
}
namespace {
// MEMBER FUNCTIONS - Body may be edited by hand.
int CEF_CALLBACK translator_test_ref_ptr_library_child_get_other_value(
struct _cef_translator_test_ref_ptr_library_child_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return 0;
// Execute
int _retval = CefTranslatorTestRefPtrLibraryChildCppToC::Get(
self)->GetOtherValue();
// Return type: simple
return _retval;
}
void CEF_CALLBACK translator_test_ref_ptr_library_child_set_other_value(
struct _cef_translator_test_ref_ptr_library_child_t* self, int value) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return;
// Execute
CefTranslatorTestRefPtrLibraryChildCppToC::Get(self)->SetOtherValue(
value);
}
int CEF_CALLBACK translator_test_ref_ptr_library_child_get_value(
struct _cef_translator_test_ref_ptr_library_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return 0;
// Execute
int _retval = CefTranslatorTestRefPtrLibraryChildCppToC::Get(
reinterpret_cast<cef_translator_test_ref_ptr_library_child_t*>(
self))->GetValue();
// Return type: simple
return _retval;
}
void CEF_CALLBACK translator_test_ref_ptr_library_child_set_value(
struct _cef_translator_test_ref_ptr_library_t* self, int value) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return;
// Execute
CefTranslatorTestRefPtrLibraryChildCppToC::Get(
reinterpret_cast<cef_translator_test_ref_ptr_library_child_t*>(
self))->SetValue(
value);
}
} // namespace
// CONSTRUCTOR - Do not edit by hand.
CefTranslatorTestRefPtrLibraryChildCppToC::CefTranslatorTestRefPtrLibraryChildCppToC(
) {
GetStruct()->get_other_value =
translator_test_ref_ptr_library_child_get_other_value;
GetStruct()->set_other_value =
translator_test_ref_ptr_library_child_set_other_value;
GetStruct()->base.get_value = translator_test_ref_ptr_library_child_get_value;
GetStruct()->base.set_value = translator_test_ref_ptr_library_child_set_value;
}
template<> CefRefPtr<CefTranslatorTestRefPtrLibraryChild> CefCppToC<CefTranslatorTestRefPtrLibraryChildCppToC,
CefTranslatorTestRefPtrLibraryChild,
cef_translator_test_ref_ptr_library_child_t>::UnwrapDerived(
CefWrapperType type, cef_translator_test_ref_ptr_library_child_t* s) {
if (type == WT_TRANSLATOR_TEST_REF_PTR_LIBRARY_CHILD_CHILD) {
return CefTranslatorTestRefPtrLibraryChildChildCppToC::Unwrap(
reinterpret_cast<cef_translator_test_ref_ptr_library_child_child_t*>(
s));
}
NOTREACHED() << "Unexpected class type: " << type;
return NULL;
}
#if DCHECK_IS_ON()
template<> base::AtomicRefCount CefCppToC<CefTranslatorTestRefPtrLibraryChildCppToC,
CefTranslatorTestRefPtrLibraryChild,
cef_translator_test_ref_ptr_library_child_t>::DebugObjCt = 0;
#endif
template<> CefWrapperType CefCppToC<CefTranslatorTestRefPtrLibraryChildCppToC,
CefTranslatorTestRefPtrLibraryChild,
cef_translator_test_ref_ptr_library_child_t>::kWrapperType =
WT_TRANSLATOR_TEST_REF_PTR_LIBRARY_CHILD;

View File

@ -10,8 +10,8 @@
// for more information.
//
#ifndef CEF_LIBCEF_DLL_CPPTOC_TEST_TRANSLATOR_TEST_OBJECT_CHILD_CHILD_CPPTOC_H_
#define CEF_LIBCEF_DLL_CPPTOC_TEST_TRANSLATOR_TEST_OBJECT_CHILD_CHILD_CPPTOC_H_
#ifndef CEF_LIBCEF_DLL_CPPTOC_TEST_TRANSLATOR_TEST_REF_PTR_LIBRARY_CHILD_CPPTOC_H_
#define CEF_LIBCEF_DLL_CPPTOC_TEST_TRANSLATOR_TEST_REF_PTR_LIBRARY_CHILD_CPPTOC_H_
#pragma once
#if !defined(BUILDING_CEF_SHARED)
@ -24,12 +24,12 @@
// Wrap a C++ class with a C structure.
// This class may be instantiated and accessed DLL-side only.
class CefTranslatorTestObjectChildChildCppToC
: public CefCppToC<CefTranslatorTestObjectChildChildCppToC,
CefTranslatorTestObjectChildChild,
cef_translator_test_object_child_child_t> {
class CefTranslatorTestRefPtrLibraryChildCppToC
: public CefCppToC<CefTranslatorTestRefPtrLibraryChildCppToC,
CefTranslatorTestRefPtrLibraryChild,
cef_translator_test_ref_ptr_library_child_t> {
public:
CefTranslatorTestObjectChildChildCppToC();
CefTranslatorTestRefPtrLibraryChildCppToC();
};
#endif // CEF_LIBCEF_DLL_CPPTOC_TEST_TRANSLATOR_TEST_OBJECT_CHILD_CHILD_CPPTOC_H_
#endif // CEF_LIBCEF_DLL_CPPTOC_TEST_TRANSLATOR_TEST_REF_PTR_LIBRARY_CHILD_CPPTOC_H_

View File

@ -0,0 +1,102 @@
// Copyright (c) 2017 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool. If making changes by
// hand only do so within the body of existing method and function
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
#include "libcef_dll/cpptoc/test/translator_test_ref_ptr_library_cpptoc.h"
#include "libcef_dll/cpptoc/test/translator_test_ref_ptr_library_child_cpptoc.h"
#include "libcef_dll/cpptoc/test/translator_test_ref_ptr_library_child_child_cpptoc.h"
// GLOBAL FUNCTIONS - Body may be edited by hand.
CEF_EXPORT cef_translator_test_ref_ptr_library_t* cef_translator_test_ref_ptr_library_create(
int value) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
CefRefPtr<CefTranslatorTestRefPtrLibrary> _retval =
CefTranslatorTestRefPtrLibrary::Create(
value);
// Return type: refptr_same
return CefTranslatorTestRefPtrLibraryCppToC::Wrap(_retval);
}
namespace {
// MEMBER FUNCTIONS - Body may be edited by hand.
int CEF_CALLBACK translator_test_ref_ptr_library_get_value(
struct _cef_translator_test_ref_ptr_library_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return 0;
// Execute
int _retval = CefTranslatorTestRefPtrLibraryCppToC::Get(self)->GetValue();
// Return type: simple
return _retval;
}
void CEF_CALLBACK translator_test_ref_ptr_library_set_value(
struct _cef_translator_test_ref_ptr_library_t* self, int value) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return;
// Execute
CefTranslatorTestRefPtrLibraryCppToC::Get(self)->SetValue(
value);
}
} // namespace
// CONSTRUCTOR - Do not edit by hand.
CefTranslatorTestRefPtrLibraryCppToC::CefTranslatorTestRefPtrLibraryCppToC() {
GetStruct()->get_value = translator_test_ref_ptr_library_get_value;
GetStruct()->set_value = translator_test_ref_ptr_library_set_value;
}
template<> CefRefPtr<CefTranslatorTestRefPtrLibrary> CefCppToC<CefTranslatorTestRefPtrLibraryCppToC,
CefTranslatorTestRefPtrLibrary,
cef_translator_test_ref_ptr_library_t>::UnwrapDerived(CefWrapperType type,
cef_translator_test_ref_ptr_library_t* s) {
if (type == WT_TRANSLATOR_TEST_REF_PTR_LIBRARY_CHILD) {
return CefTranslatorTestRefPtrLibraryChildCppToC::Unwrap(
reinterpret_cast<cef_translator_test_ref_ptr_library_child_t*>(s));
}
if (type == WT_TRANSLATOR_TEST_REF_PTR_LIBRARY_CHILD_CHILD) {
return CefTranslatorTestRefPtrLibraryChildChildCppToC::Unwrap(
reinterpret_cast<cef_translator_test_ref_ptr_library_child_child_t*>(
s));
}
NOTREACHED() << "Unexpected class type: " << type;
return NULL;
}
#if DCHECK_IS_ON()
template<> base::AtomicRefCount CefCppToC<CefTranslatorTestRefPtrLibraryCppToC,
CefTranslatorTestRefPtrLibrary,
cef_translator_test_ref_ptr_library_t>::DebugObjCt = 0;
#endif
template<> CefWrapperType CefCppToC<CefTranslatorTestRefPtrLibraryCppToC,
CefTranslatorTestRefPtrLibrary,
cef_translator_test_ref_ptr_library_t>::kWrapperType =
WT_TRANSLATOR_TEST_REF_PTR_LIBRARY;

View File

@ -10,8 +10,8 @@
// for more information.
//
#ifndef CEF_LIBCEF_DLL_CPPTOC_TEST_TRANSLATOR_TEST_OBJECT_CPPTOC_H_
#define CEF_LIBCEF_DLL_CPPTOC_TEST_TRANSLATOR_TEST_OBJECT_CPPTOC_H_
#ifndef CEF_LIBCEF_DLL_CPPTOC_TEST_TRANSLATOR_TEST_REF_PTR_LIBRARY_CPPTOC_H_
#define CEF_LIBCEF_DLL_CPPTOC_TEST_TRANSLATOR_TEST_REF_PTR_LIBRARY_CPPTOC_H_
#pragma once
#if !defined(BUILDING_CEF_SHARED)
@ -24,11 +24,12 @@
// Wrap a C++ class with a C structure.
// This class may be instantiated and accessed DLL-side only.
class CefTranslatorTestObjectCppToC
: public CefCppToC<CefTranslatorTestObjectCppToC, CefTranslatorTestObject,
cef_translator_test_object_t> {
class CefTranslatorTestRefPtrLibraryCppToC
: public CefCppToC<CefTranslatorTestRefPtrLibraryCppToC,
CefTranslatorTestRefPtrLibrary,
cef_translator_test_ref_ptr_library_t> {
public:
CefTranslatorTestObjectCppToC();
CefTranslatorTestRefPtrLibraryCppToC();
};
#endif // CEF_LIBCEF_DLL_CPPTOC_TEST_TRANSLATOR_TEST_OBJECT_CPPTOC_H_
#endif // CEF_LIBCEF_DLL_CPPTOC_TEST_TRANSLATOR_TEST_REF_PTR_LIBRARY_CPPTOC_H_

View File

@ -0,0 +1,90 @@
// Copyright (c) 2017 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool. If making changes by
// hand only do so within the body of existing method and function
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
#include "libcef_dll/cpptoc/test/translator_test_scoped_client_child_cpptoc.h"
namespace {
// MEMBER FUNCTIONS - Body may be edited by hand.
int CEF_CALLBACK translator_test_scoped_client_child_get_other_value(
struct _cef_translator_test_scoped_client_child_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return 0;
// Execute
int _retval = CefTranslatorTestScopedClientChildCppToC::Get(
self)->GetOtherValue();
// Return type: simple
return _retval;
}
int CEF_CALLBACK translator_test_scoped_client_child_get_value(
struct _cef_translator_test_scoped_client_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return 0;
// Execute
int _retval = CefTranslatorTestScopedClientChildCppToC::Get(
reinterpret_cast<cef_translator_test_scoped_client_child_t*>(
self))->GetValue();
// Return type: simple
return _retval;
}
} // namespace
// CONSTRUCTOR - Do not edit by hand.
CefTranslatorTestScopedClientChildCppToC::CefTranslatorTestScopedClientChildCppToC(
) {
GetStruct()->get_other_value =
translator_test_scoped_client_child_get_other_value;
GetStruct()->base.get_value = translator_test_scoped_client_child_get_value;
}
template<> CefOwnPtr<CefTranslatorTestScopedClientChild> CefCppToCScoped<CefTranslatorTestScopedClientChildCppToC,
CefTranslatorTestScopedClientChild,
cef_translator_test_scoped_client_child_t>::UnwrapDerivedOwn(
CefWrapperType type, cef_translator_test_scoped_client_child_t* s) {
NOTREACHED() << "Unexpected class type: " << type;
return CefOwnPtr<CefTranslatorTestScopedClientChild>();
}
template<> CefRawPtr<CefTranslatorTestScopedClientChild> CefCppToCScoped<CefTranslatorTestScopedClientChildCppToC,
CefTranslatorTestScopedClientChild,
cef_translator_test_scoped_client_child_t>::UnwrapDerivedRaw(
CefWrapperType type, cef_translator_test_scoped_client_child_t* s) {
NOTREACHED() << "Unexpected class type: " << type;
return NULL;
}
#if DCHECK_IS_ON()
template<> base::AtomicRefCount CefCppToCScoped<CefTranslatorTestScopedClientChildCppToC,
CefTranslatorTestScopedClientChild,
cef_translator_test_scoped_client_child_t>::DebugObjCt = 0;
#endif
template<> CefWrapperType CefCppToCScoped<CefTranslatorTestScopedClientChildCppToC,
CefTranslatorTestScopedClientChild,
cef_translator_test_scoped_client_child_t>::kWrapperType =
WT_TRANSLATOR_TEST_SCOPED_CLIENT_CHILD;

View File

@ -0,0 +1,35 @@
// Copyright (c) 2017 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool. If making changes by
// hand only do so within the body of existing method and function
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
#ifndef CEF_LIBCEF_DLL_CPPTOC_TEST_TRANSLATOR_TEST_SCOPED_CLIENT_CHILD_CPPTOC_H_
#define CEF_LIBCEF_DLL_CPPTOC_TEST_TRANSLATOR_TEST_SCOPED_CLIENT_CHILD_CPPTOC_H_
#pragma once
#if !defined(WRAPPING_CEF_SHARED)
#error This file can be included wrapper-side only
#endif
#include "include/test/cef_translator_test.h"
#include "include/capi/test/cef_translator_test_capi.h"
#include "libcef_dll/cpptoc/cpptoc_scoped.h"
// Wrap a C++ class with a C structure.
// This class may be instantiated and accessed wrapper-side only.
class CefTranslatorTestScopedClientChildCppToC
: public CefCppToCScoped<CefTranslatorTestScopedClientChildCppToC,
CefTranslatorTestScopedClientChild,
cef_translator_test_scoped_client_child_t> {
public:
CefTranslatorTestScopedClientChildCppToC();
};
#endif // CEF_LIBCEF_DLL_CPPTOC_TEST_TRANSLATOR_TEST_SCOPED_CLIENT_CHILD_CPPTOC_H_

View File

@ -0,0 +1,79 @@
// Copyright (c) 2017 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool. If making changes by
// hand only do so within the body of existing method and function
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
#include "libcef_dll/cpptoc/test/translator_test_scoped_client_cpptoc.h"
#include "libcef_dll/cpptoc/test/translator_test_scoped_client_child_cpptoc.h"
namespace {
// MEMBER FUNCTIONS - Body may be edited by hand.
int CEF_CALLBACK translator_test_scoped_client_get_value(
struct _cef_translator_test_scoped_client_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return 0;
// Execute
int _retval = CefTranslatorTestScopedClientCppToC::Get(self)->GetValue();
// Return type: simple
return _retval;
}
} // namespace
// CONSTRUCTOR - Do not edit by hand.
CefTranslatorTestScopedClientCppToC::CefTranslatorTestScopedClientCppToC() {
GetStruct()->get_value = translator_test_scoped_client_get_value;
}
template<> CefOwnPtr<CefTranslatorTestScopedClient> CefCppToCScoped<CefTranslatorTestScopedClientCppToC,
CefTranslatorTestScopedClient,
cef_translator_test_scoped_client_t>::UnwrapDerivedOwn(CefWrapperType type,
cef_translator_test_scoped_client_t* s) {
if (type == WT_TRANSLATOR_TEST_SCOPED_CLIENT_CHILD) {
return OWN_RETURN_AS(CefTranslatorTestScopedClientChildCppToC::UnwrapOwn(
reinterpret_cast<cef_translator_test_scoped_client_child_t*>(s)),
CefTranslatorTestScopedClient);
}
NOTREACHED() << "Unexpected class type: " << type;
return CefOwnPtr<CefTranslatorTestScopedClient>();
}
template<> CefRawPtr<CefTranslatorTestScopedClient> CefCppToCScoped<CefTranslatorTestScopedClientCppToC,
CefTranslatorTestScopedClient,
cef_translator_test_scoped_client_t>::UnwrapDerivedRaw(CefWrapperType type,
cef_translator_test_scoped_client_t* s) {
if (type == WT_TRANSLATOR_TEST_SCOPED_CLIENT_CHILD) {
return CefTranslatorTestScopedClientChildCppToC::UnwrapRaw(
reinterpret_cast<cef_translator_test_scoped_client_child_t*>(s));
}
NOTREACHED() << "Unexpected class type: " << type;
return NULL;
}
#if DCHECK_IS_ON()
template<> base::AtomicRefCount CefCppToCScoped<CefTranslatorTestScopedClientCppToC,
CefTranslatorTestScopedClient,
cef_translator_test_scoped_client_t>::DebugObjCt = 0;
#endif
template<> CefWrapperType CefCppToCScoped<CefTranslatorTestScopedClientCppToC,
CefTranslatorTestScopedClient,
cef_translator_test_scoped_client_t>::kWrapperType =
WT_TRANSLATOR_TEST_SCOPED_CLIENT;

View File

@ -0,0 +1,34 @@
// Copyright (c) 2017 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool. If making changes by
// hand only do so within the body of existing method and function
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
#ifndef CEF_LIBCEF_DLL_CPPTOC_TEST_TRANSLATOR_TEST_SCOPED_CLIENT_CPPTOC_H_
#define CEF_LIBCEF_DLL_CPPTOC_TEST_TRANSLATOR_TEST_SCOPED_CLIENT_CPPTOC_H_
#pragma once
#if !defined(WRAPPING_CEF_SHARED)
#error This file can be included wrapper-side only
#endif
#include "include/test/cef_translator_test.h"
#include "include/capi/test/cef_translator_test_capi.h"
#include "libcef_dll/cpptoc/cpptoc_scoped.h"
// Wrap a C++ class with a C structure.
// This class may be instantiated and accessed wrapper-side only.
class CefTranslatorTestScopedClientCppToC
: public CefCppToCScoped<CefTranslatorTestScopedClientCppToC,
CefTranslatorTestScopedClient, cef_translator_test_scoped_client_t> {
public:
CefTranslatorTestScopedClientCppToC();
};
#endif // CEF_LIBCEF_DLL_CPPTOC_TEST_TRANSLATOR_TEST_SCOPED_CLIENT_CPPTOC_H_

View File

@ -0,0 +1,179 @@
// Copyright (c) 2017 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool. If making changes by
// hand only do so within the body of existing method and function
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
#include "libcef_dll/cpptoc/test/translator_test_scoped_library_child_child_cpptoc.h"
// GLOBAL FUNCTIONS - Body may be edited by hand.
CEF_EXPORT cef_translator_test_scoped_library_child_child_t* cef_translator_test_scoped_library_child_child_create(
int value, int other_value, int other_other_value) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
CefOwnPtr<CefTranslatorTestScopedLibraryChildChild> _retval =
CefTranslatorTestScopedLibraryChildChild::Create(
value,
other_value,
other_other_value);
// Return type: ownptr_same
return CefTranslatorTestScopedLibraryChildChildCppToC::WrapOwn(OWN_PASS(
_retval));
}
namespace {
// MEMBER FUNCTIONS - Body may be edited by hand.
int CEF_CALLBACK translator_test_scoped_library_child_child_get_other_other_value(
struct _cef_translator_test_scoped_library_child_child_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return 0;
// Execute
int _retval = CefTranslatorTestScopedLibraryChildChildCppToC::Get(
self)->GetOtherOtherValue();
// Return type: simple
return _retval;
}
void CEF_CALLBACK translator_test_scoped_library_child_child_set_other_other_value(
struct _cef_translator_test_scoped_library_child_child_t* self,
int value) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return;
// Execute
CefTranslatorTestScopedLibraryChildChildCppToC::Get(self)->SetOtherOtherValue(
value);
}
int CEF_CALLBACK translator_test_scoped_library_child_child_get_other_value(
struct _cef_translator_test_scoped_library_child_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return 0;
// Execute
int _retval = CefTranslatorTestScopedLibraryChildChildCppToC::Get(
reinterpret_cast<cef_translator_test_scoped_library_child_child_t*>(
self))->GetOtherValue();
// Return type: simple
return _retval;
}
void CEF_CALLBACK translator_test_scoped_library_child_child_set_other_value(
struct _cef_translator_test_scoped_library_child_t* self, int value) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return;
// Execute
CefTranslatorTestScopedLibraryChildChildCppToC::Get(
reinterpret_cast<cef_translator_test_scoped_library_child_child_t*>(
self))->SetOtherValue(
value);
}
int CEF_CALLBACK translator_test_scoped_library_child_child_get_value(
struct _cef_translator_test_scoped_library_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return 0;
// Execute
int _retval = CefTranslatorTestScopedLibraryChildChildCppToC::Get(
reinterpret_cast<cef_translator_test_scoped_library_child_child_t*>(
self))->GetValue();
// Return type: simple
return _retval;
}
void CEF_CALLBACK translator_test_scoped_library_child_child_set_value(
struct _cef_translator_test_scoped_library_t* self, int value) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return;
// Execute
CefTranslatorTestScopedLibraryChildChildCppToC::Get(
reinterpret_cast<cef_translator_test_scoped_library_child_child_t*>(
self))->SetValue(
value);
}
} // namespace
// CONSTRUCTOR - Do not edit by hand.
CefTranslatorTestScopedLibraryChildChildCppToC::CefTranslatorTestScopedLibraryChildChildCppToC(
) {
GetStruct()->get_other_other_value =
translator_test_scoped_library_child_child_get_other_other_value;
GetStruct()->set_other_other_value =
translator_test_scoped_library_child_child_set_other_other_value;
GetStruct()->base.get_other_value =
translator_test_scoped_library_child_child_get_other_value;
GetStruct()->base.set_other_value =
translator_test_scoped_library_child_child_set_other_value;
GetStruct()->base.base.get_value =
translator_test_scoped_library_child_child_get_value;
GetStruct()->base.base.set_value =
translator_test_scoped_library_child_child_set_value;
}
template<> CefOwnPtr<CefTranslatorTestScopedLibraryChildChild> CefCppToCScoped<CefTranslatorTestScopedLibraryChildChildCppToC,
CefTranslatorTestScopedLibraryChildChild,
cef_translator_test_scoped_library_child_child_t>::UnwrapDerivedOwn(
CefWrapperType type, cef_translator_test_scoped_library_child_child_t* s) {
NOTREACHED() << "Unexpected class type: " << type;
return CefOwnPtr<CefTranslatorTestScopedLibraryChildChild>();
}
template<> CefRawPtr<CefTranslatorTestScopedLibraryChildChild> CefCppToCScoped<CefTranslatorTestScopedLibraryChildChildCppToC,
CefTranslatorTestScopedLibraryChildChild,
cef_translator_test_scoped_library_child_child_t>::UnwrapDerivedRaw(
CefWrapperType type, cef_translator_test_scoped_library_child_child_t* s) {
NOTREACHED() << "Unexpected class type: " << type;
return NULL;
}
#if DCHECK_IS_ON()
template<> base::AtomicRefCount CefCppToCScoped<CefTranslatorTestScopedLibraryChildChildCppToC,
CefTranslatorTestScopedLibraryChildChild,
cef_translator_test_scoped_library_child_child_t>::DebugObjCt = 0;
#endif
template<> CefWrapperType CefCppToCScoped<CefTranslatorTestScopedLibraryChildChildCppToC,
CefTranslatorTestScopedLibraryChildChild,
cef_translator_test_scoped_library_child_child_t>::kWrapperType =
WT_TRANSLATOR_TEST_SCOPED_LIBRARY_CHILD_CHILD;

View File

@ -0,0 +1,35 @@
// Copyright (c) 2017 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool. If making changes by
// hand only do so within the body of existing method and function
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
#ifndef CEF_LIBCEF_DLL_CPPTOC_TEST_TRANSLATOR_TEST_SCOPED_LIBRARY_CHILD_CHILD_CPPTOC_H_
#define CEF_LIBCEF_DLL_CPPTOC_TEST_TRANSLATOR_TEST_SCOPED_LIBRARY_CHILD_CHILD_CPPTOC_H_
#pragma once
#if !defined(BUILDING_CEF_SHARED)
#error This file can be included DLL-side only
#endif
#include "include/test/cef_translator_test.h"
#include "include/capi/test/cef_translator_test_capi.h"
#include "libcef_dll/cpptoc/cpptoc_scoped.h"
// Wrap a C++ class with a C structure.
// This class may be instantiated and accessed DLL-side only.
class CefTranslatorTestScopedLibraryChildChildCppToC
: public CefCppToCScoped<CefTranslatorTestScopedLibraryChildChildCppToC,
CefTranslatorTestScopedLibraryChildChild,
cef_translator_test_scoped_library_child_child_t> {
public:
CefTranslatorTestScopedLibraryChildChildCppToC();
};
#endif // CEF_LIBCEF_DLL_CPPTOC_TEST_TRANSLATOR_TEST_SCOPED_LIBRARY_CHILD_CHILD_CPPTOC_H_

View File

@ -0,0 +1,150 @@
// Copyright (c) 2017 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool. If making changes by
// hand only do so within the body of existing method and function
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
#include "libcef_dll/cpptoc/test/translator_test_scoped_library_child_cpptoc.h"
#include "libcef_dll/cpptoc/test/translator_test_scoped_library_child_child_cpptoc.h"
// GLOBAL FUNCTIONS - Body may be edited by hand.
CEF_EXPORT cef_translator_test_scoped_library_child_t* cef_translator_test_scoped_library_child_create(
int value, int other_value) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
CefOwnPtr<CefTranslatorTestScopedLibraryChild> _retval =
CefTranslatorTestScopedLibraryChild::Create(
value,
other_value);
// Return type: ownptr_same
return CefTranslatorTestScopedLibraryChildCppToC::WrapOwn(OWN_PASS(_retval));
}
namespace {
// MEMBER FUNCTIONS - Body may be edited by hand.
int CEF_CALLBACK translator_test_scoped_library_child_get_other_value(
struct _cef_translator_test_scoped_library_child_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return 0;
// Execute
int _retval = CefTranslatorTestScopedLibraryChildCppToC::Get(
self)->GetOtherValue();
// Return type: simple
return _retval;
}
void CEF_CALLBACK translator_test_scoped_library_child_set_other_value(
struct _cef_translator_test_scoped_library_child_t* self, int value) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return;
// Execute
CefTranslatorTestScopedLibraryChildCppToC::Get(self)->SetOtherValue(
value);
}
int CEF_CALLBACK translator_test_scoped_library_child_get_value(
struct _cef_translator_test_scoped_library_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return 0;
// Execute
int _retval = CefTranslatorTestScopedLibraryChildCppToC::Get(
reinterpret_cast<cef_translator_test_scoped_library_child_t*>(
self))->GetValue();
// Return type: simple
return _retval;
}
void CEF_CALLBACK translator_test_scoped_library_child_set_value(
struct _cef_translator_test_scoped_library_t* self, int value) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return;
// Execute
CefTranslatorTestScopedLibraryChildCppToC::Get(
reinterpret_cast<cef_translator_test_scoped_library_child_t*>(
self))->SetValue(
value);
}
} // namespace
// CONSTRUCTOR - Do not edit by hand.
CefTranslatorTestScopedLibraryChildCppToC::CefTranslatorTestScopedLibraryChildCppToC(
) {
GetStruct()->get_other_value =
translator_test_scoped_library_child_get_other_value;
GetStruct()->set_other_value =
translator_test_scoped_library_child_set_other_value;
GetStruct()->base.get_value = translator_test_scoped_library_child_get_value;
GetStruct()->base.set_value = translator_test_scoped_library_child_set_value;
}
template<> CefOwnPtr<CefTranslatorTestScopedLibraryChild> CefCppToCScoped<CefTranslatorTestScopedLibraryChildCppToC,
CefTranslatorTestScopedLibraryChild,
cef_translator_test_scoped_library_child_t>::UnwrapDerivedOwn(
CefWrapperType type, cef_translator_test_scoped_library_child_t* s) {
if (type == WT_TRANSLATOR_TEST_SCOPED_LIBRARY_CHILD_CHILD) {
return OWN_RETURN_AS(
CefTranslatorTestScopedLibraryChildChildCppToC::UnwrapOwn(
reinterpret_cast<cef_translator_test_scoped_library_child_child_t*>(s)),
CefTranslatorTestScopedLibraryChild);
}
NOTREACHED() << "Unexpected class type: " << type;
return CefOwnPtr<CefTranslatorTestScopedLibraryChild>();
}
template<> CefRawPtr<CefTranslatorTestScopedLibraryChild> CefCppToCScoped<CefTranslatorTestScopedLibraryChildCppToC,
CefTranslatorTestScopedLibraryChild,
cef_translator_test_scoped_library_child_t>::UnwrapDerivedRaw(
CefWrapperType type, cef_translator_test_scoped_library_child_t* s) {
if (type == WT_TRANSLATOR_TEST_SCOPED_LIBRARY_CHILD_CHILD) {
return CefTranslatorTestScopedLibraryChildChildCppToC::UnwrapRaw(
reinterpret_cast<cef_translator_test_scoped_library_child_child_t*>(
s));
}
NOTREACHED() << "Unexpected class type: " << type;
return NULL;
}
#if DCHECK_IS_ON()
template<> base::AtomicRefCount CefCppToCScoped<CefTranslatorTestScopedLibraryChildCppToC,
CefTranslatorTestScopedLibraryChild,
cef_translator_test_scoped_library_child_t>::DebugObjCt = 0;
#endif
template<> CefWrapperType CefCppToCScoped<CefTranslatorTestScopedLibraryChildCppToC,
CefTranslatorTestScopedLibraryChild,
cef_translator_test_scoped_library_child_t>::kWrapperType =
WT_TRANSLATOR_TEST_SCOPED_LIBRARY_CHILD;

View File

@ -0,0 +1,35 @@
// Copyright (c) 2017 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool. If making changes by
// hand only do so within the body of existing method and function
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
#ifndef CEF_LIBCEF_DLL_CPPTOC_TEST_TRANSLATOR_TEST_SCOPED_LIBRARY_CHILD_CPPTOC_H_
#define CEF_LIBCEF_DLL_CPPTOC_TEST_TRANSLATOR_TEST_SCOPED_LIBRARY_CHILD_CPPTOC_H_
#pragma once
#if !defined(BUILDING_CEF_SHARED)
#error This file can be included DLL-side only
#endif
#include "include/test/cef_translator_test.h"
#include "include/capi/test/cef_translator_test_capi.h"
#include "libcef_dll/cpptoc/cpptoc_scoped.h"
// Wrap a C++ class with a C structure.
// This class may be instantiated and accessed DLL-side only.
class CefTranslatorTestScopedLibraryChildCppToC
: public CefCppToCScoped<CefTranslatorTestScopedLibraryChildCppToC,
CefTranslatorTestScopedLibraryChild,
cef_translator_test_scoped_library_child_t> {
public:
CefTranslatorTestScopedLibraryChildCppToC();
};
#endif // CEF_LIBCEF_DLL_CPPTOC_TEST_TRANSLATOR_TEST_SCOPED_LIBRARY_CHILD_CPPTOC_H_

View File

@ -0,0 +1,121 @@
// Copyright (c) 2017 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool. If making changes by
// hand only do so within the body of existing method and function
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
#include "libcef_dll/cpptoc/test/translator_test_scoped_library_cpptoc.h"
#include "libcef_dll/cpptoc/test/translator_test_scoped_library_child_cpptoc.h"
#include "libcef_dll/cpptoc/test/translator_test_scoped_library_child_child_cpptoc.h"
// GLOBAL FUNCTIONS - Body may be edited by hand.
CEF_EXPORT cef_translator_test_scoped_library_t* cef_translator_test_scoped_library_create(
int value) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
CefOwnPtr<CefTranslatorTestScopedLibrary> _retval =
CefTranslatorTestScopedLibrary::Create(
value);
// Return type: ownptr_same
return CefTranslatorTestScopedLibraryCppToC::WrapOwn(OWN_PASS(_retval));
}
namespace {
// MEMBER FUNCTIONS - Body may be edited by hand.
int CEF_CALLBACK translator_test_scoped_library_get_value(
struct _cef_translator_test_scoped_library_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return 0;
// Execute
int _retval = CefTranslatorTestScopedLibraryCppToC::Get(self)->GetValue();
// Return type: simple
return _retval;
}
void CEF_CALLBACK translator_test_scoped_library_set_value(
struct _cef_translator_test_scoped_library_t* self, int value) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return;
// Execute
CefTranslatorTestScopedLibraryCppToC::Get(self)->SetValue(
value);
}
} // namespace
// CONSTRUCTOR - Do not edit by hand.
CefTranslatorTestScopedLibraryCppToC::CefTranslatorTestScopedLibraryCppToC() {
GetStruct()->get_value = translator_test_scoped_library_get_value;
GetStruct()->set_value = translator_test_scoped_library_set_value;
}
template<> CefOwnPtr<CefTranslatorTestScopedLibrary> CefCppToCScoped<CefTranslatorTestScopedLibraryCppToC,
CefTranslatorTestScopedLibrary,
cef_translator_test_scoped_library_t>::UnwrapDerivedOwn(
CefWrapperType type, cef_translator_test_scoped_library_t* s) {
if (type == WT_TRANSLATOR_TEST_SCOPED_LIBRARY_CHILD) {
return OWN_RETURN_AS(CefTranslatorTestScopedLibraryChildCppToC::UnwrapOwn(
reinterpret_cast<cef_translator_test_scoped_library_child_t*>(s)),
CefTranslatorTestScopedLibrary);
}
if (type == WT_TRANSLATOR_TEST_SCOPED_LIBRARY_CHILD_CHILD) {
return OWN_RETURN_AS(
CefTranslatorTestScopedLibraryChildChildCppToC::UnwrapOwn(
reinterpret_cast<cef_translator_test_scoped_library_child_child_t*>(s)),
CefTranslatorTestScopedLibrary);
}
NOTREACHED() << "Unexpected class type: " << type;
return CefOwnPtr<CefTranslatorTestScopedLibrary>();
}
template<> CefRawPtr<CefTranslatorTestScopedLibrary> CefCppToCScoped<CefTranslatorTestScopedLibraryCppToC,
CefTranslatorTestScopedLibrary,
cef_translator_test_scoped_library_t>::UnwrapDerivedRaw(
CefWrapperType type, cef_translator_test_scoped_library_t* s) {
if (type == WT_TRANSLATOR_TEST_SCOPED_LIBRARY_CHILD) {
return CefTranslatorTestScopedLibraryChildCppToC::UnwrapRaw(
reinterpret_cast<cef_translator_test_scoped_library_child_t*>(s));
}
if (type == WT_TRANSLATOR_TEST_SCOPED_LIBRARY_CHILD_CHILD) {
return CefTranslatorTestScopedLibraryChildChildCppToC::UnwrapRaw(
reinterpret_cast<cef_translator_test_scoped_library_child_child_t*>(
s));
}
NOTREACHED() << "Unexpected class type: " << type;
return NULL;
}
#if DCHECK_IS_ON()
template<> base::AtomicRefCount CefCppToCScoped<CefTranslatorTestScopedLibraryCppToC,
CefTranslatorTestScopedLibrary,
cef_translator_test_scoped_library_t>::DebugObjCt = 0;
#endif
template<> CefWrapperType CefCppToCScoped<CefTranslatorTestScopedLibraryCppToC,
CefTranslatorTestScopedLibrary,
cef_translator_test_scoped_library_t>::kWrapperType =
WT_TRANSLATOR_TEST_SCOPED_LIBRARY;

View File

@ -10,8 +10,8 @@
// for more information.
//
#ifndef CEF_LIBCEF_DLL_CPPTOC_TEST_TRANSLATOR_TEST_OBJECT_CHILD_CPPTOC_H_
#define CEF_LIBCEF_DLL_CPPTOC_TEST_TRANSLATOR_TEST_OBJECT_CHILD_CPPTOC_H_
#ifndef CEF_LIBCEF_DLL_CPPTOC_TEST_TRANSLATOR_TEST_SCOPED_LIBRARY_CPPTOC_H_
#define CEF_LIBCEF_DLL_CPPTOC_TEST_TRANSLATOR_TEST_SCOPED_LIBRARY_CPPTOC_H_
#pragma once
#if !defined(BUILDING_CEF_SHARED)
@ -20,15 +20,16 @@
#include "include/test/cef_translator_test.h"
#include "include/capi/test/cef_translator_test_capi.h"
#include "libcef_dll/cpptoc/cpptoc.h"
#include "libcef_dll/cpptoc/cpptoc_scoped.h"
// Wrap a C++ class with a C structure.
// This class may be instantiated and accessed DLL-side only.
class CefTranslatorTestObjectChildCppToC
: public CefCppToC<CefTranslatorTestObjectChildCppToC,
CefTranslatorTestObjectChild, cef_translator_test_object_child_t> {
class CefTranslatorTestScopedLibraryCppToC
: public CefCppToCScoped<CefTranslatorTestScopedLibraryCppToC,
CefTranslatorTestScopedLibrary,
cef_translator_test_scoped_library_t> {
public:
CefTranslatorTestObjectChildCppToC();
CefTranslatorTestScopedLibraryCppToC();
};
#endif // CEF_LIBCEF_DLL_CPPTOC_TEST_TRANSLATOR_TEST_OBJECT_CHILD_CPPTOC_H_
#endif // CEF_LIBCEF_DLL_CPPTOC_TEST_TRANSLATOR_TEST_SCOPED_LIBRARY_CPPTOC_H_

View File

@ -41,21 +41,25 @@ void CefAppCToCpp::OnBeforeCommandLineProcessing(const CefString& process_type,
}
void CefAppCToCpp::OnRegisterCustomSchemes(
CefRefPtr<CefSchemeRegistrar> registrar) {
CefRawPtr<CefSchemeRegistrar> registrar) {
cef_app_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, on_register_custom_schemes))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Verify param: registrar; type: refptr_diff
DCHECK(registrar.get());
if (!registrar.get())
// Verify param: registrar; type: rawptr_diff
DCHECK(registrar);
if (!registrar)
return;
// Translate param: registrar; type: rawptr_diff
CefOwnPtr<CefSchemeRegistrarCppToC> registrarPtr(
CefSchemeRegistrarCppToC::WrapRaw(registrar));
// Execute
_struct->on_register_custom_schemes(_struct,
CefSchemeRegistrarCppToC::Wrap(registrar));
registrarPtr->GetStruct());
}
CefRefPtr<CefResourceBundleHandler> CefAppCToCpp::GetResourceBundleHandler() {

View File

@ -33,7 +33,7 @@ class CefAppCToCpp
void OnBeforeCommandLineProcessing(const CefString& process_type,
CefRefPtr<CefCommandLine> command_line) override;
void OnRegisterCustomSchemes(
CefRefPtr<CefSchemeRegistrar> registrar) override;
CefRawPtr<CefSchemeRegistrar> registrar) override;
CefRefPtr<CefResourceBundleHandler> GetResourceBundleHandler() override;
CefRefPtr<CefBrowserProcessHandler> GetBrowserProcessHandler() override;
CefRefPtr<CefRenderProcessHandler> GetRenderProcessHandler() override;

View File

@ -0,0 +1,30 @@
// Copyright (c) 2017 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
#include "libcef_dll/ctocpp/base_scoped_ctocpp.h"
CefBaseScopedCToCpp::CefBaseScopedCToCpp() {
}
template<> cef_base_scoped_t*
CefCToCppScoped<CefBaseScopedCToCpp, CefBaseScoped, cef_base_scoped_t>::
UnwrapDerivedOwn(CefWrapperType type, CefOwnPtr<CefBaseScoped> c) {
NOTREACHED();
return NULL;
}
template<> cef_base_scoped_t*
CefCToCppScoped<CefBaseScopedCToCpp, CefBaseScoped, cef_base_scoped_t>::
UnwrapDerivedRaw(CefWrapperType type, CefRawPtr<CefBaseScoped> c) {
NOTREACHED();
return NULL;
}
#if DCHECK_IS_ON()
template<> base::AtomicRefCount CefCToCppScoped<CefBaseScopedCToCpp,
CefBaseScoped, cef_base_scoped_t>::DebugObjCt = 0;
#endif
template<> CefWrapperType CefCToCppScoped<CefBaseScopedCToCpp,
CefBaseScoped, cef_base_scoped_t>::kWrapperType = WT_BASE;

View File

@ -0,0 +1,25 @@
// Copyright (c) 2017 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
#ifndef CEF_LIBCEF_DLL_CTOCPP_BASE_SCOPED_CTOCPP_H_
#define CEF_LIBCEF_DLL_CTOCPP_BASE_SCOPED_CTOCPP_H_
#pragma once
#include "include/cef_base.h"
#include "include/capi/cef_base_capi.h"
#include "libcef_dll/ctocpp/ctocpp_scoped.h"
#if !defined(BUILDING_CEF_SHARED)
#error This file can be included DLL-side only
#endif
// Wrap a C structure with a C++ class.
class CefBaseScopedCToCpp
: public CefCToCppScoped<CefBaseScopedCToCpp, CefBaseScoped,
cef_base_scoped_t> {
public:
CefBaseScopedCToCpp();
};
#endif // CEF_LIBCEF_DLL_CTOCPP_BASE_SCOPED_CTOCPP_H_

View File

@ -26,16 +26,6 @@ class CefCToCpp : public BaseName {
// return back to the other side.
static StructName* Unwrap(CefRefPtr<BaseName> c);
// If returning the structure across the DLL boundary you should call
// UnderlyingAddRef() on this wrapping CefCToCpp object. On the other side of
// the DLL boundary, call Release() on the CefCppToC object.
StructName* GetStruct() const {
WrapperStruct* wrapperStruct = GetWrapperStruct(this);
// Verify that the wrapper offset was calculated correctly.
DCHECK_EQ(kWrapperType, wrapperStruct->type_);
return wrapperStruct->struct_;
}
// CefBase methods increment/decrement reference counts on both this object
// and the underlying wrapped structure.
void AddRef() const {
@ -63,6 +53,14 @@ class CefCToCpp : public BaseName {
#endif
}
// If returning the structure across the DLL boundary use Unwrap() instead.
StructName* GetStruct() const {
WrapperStruct* wrapperStruct = GetWrapperStruct(this);
// Verify that the wrapper offset was calculated correctly.
DCHECK_EQ(kWrapperType, wrapperStruct->type_);
return wrapperStruct->struct_;
}
private:
// Used to associate this wrapper object and the structure reference received
// from the other side.

View File

@ -0,0 +1,211 @@
// Copyright (c) 2017 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
#ifndef CEF_LIBCEF_DLL_CTOCPP_CTOCPP_SCOPED_H_
#define CEF_LIBCEF_DLL_CTOCPP_CTOCPP_SCOPED_H_
#pragma once
#include "include/base/cef_logging.h"
#include "include/base/cef_macros.h"
#include "include/cef_base.h"
#include "include/capi/cef_base_capi.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
// exists on the other side of the DLL boundary but will have methods called on
// this side of the DLL boundary.
template <class ClassName, class BaseName, class StructName>
class CefCToCppScoped : public BaseName {
public:
// 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).
// The returned wrapper object can be used as either a scoped argument or to
// pass ownership. For example:
//
// void my_method(my_type1_t* struct1, my_type2_t* struct2) {
// // Passes ownership to MyMethod1().
// MyMethod1(MyType1CToCpp::Wrap(struct1));
//
// // Passes reference to MyMethod2().
// CefOwnPtr<MyType1> obj2 = MyType2CToCpp::Wrap(struct2);
// MyMethod2(obj2.get());
// // |obj2| is deleted when my_method() goes out of scope.
// }
//
// void MyMethod1(CefOwnPtr<MyType1> obj1) {
// // |obj1| is deleted when MyMethod1() goes out of scope.
// }
//
// void MyMethod2(CefRawPtr<MyType2> obj2) {
// }
static CefOwnPtr<BaseName> Wrap(StructName* s);
// Retrieve the underlying structure reference from a wrapper instance for
// return back to the other side. Ownership will be passed back to the other
// side and the wrapper will be deleted. For example:
//
// void MyMethod(CefOwnPtr<MyType> obj) {
// // Ownership of the underlying MyType object is passed to my_method().
// my_method(MyTypeCToCpp::UnwrapOwn(obj.Pass()));
// // |obj| is now NULL.
// }
static StructName* UnwrapOwn(CefOwnPtr<BaseName> c);
// Retrieve the underlying structure reference from a wrapper instance for
// return back to the other side. Ownership does not change. For example:
//
// void MyMethod(CefRawPtr<MyType> obj) {
// // A reference is passed to my_method(). Ownership does not change.
// my_method2(MyTypeCToCpp::UnwrapRaw(obj));
// }
static StructName* UnwrapRaw(CefRawPtr<BaseName> c);
// Override delete operator to properly delete the WrapperStruct.
// ~CefCToCppScoped will be called first followed by this method.
static void operator delete(void* ptr);
#if DCHECK_IS_ON()
// Simple tracking of allocated objects.
static base::AtomicRefCount DebugObjCt; // NOLINT(runtime/int)
#endif
protected:
CefCToCppScoped() {
#if DCHECK_IS_ON()
base::AtomicRefCountInc(&DebugObjCt);
#endif
}
virtual ~CefCToCppScoped() {
#if DCHECK_IS_ON()
base::AtomicRefCountDec(&DebugObjCt);
#endif
}
// If returning the structure across the DLL boundary use Unwrap() instead.
StructName* GetStruct() const {
WrapperStruct* wrapperStruct = GetWrapperStruct(this);
// Verify that the wrapper offset was calculated correctly.
DCHECK_EQ(kWrapperType, wrapperStruct->type_);
return wrapperStruct->struct_;
}
private:
// Used to associate this wrapper object and the structure reference received
// from the other side.
struct WrapperStruct;
static WrapperStruct* GetWrapperStruct(const BaseName* obj);
// Unwrap as the derived type.
static StructName* UnwrapDerivedOwn(CefWrapperType type,
CefOwnPtr<BaseName> c);
static StructName* UnwrapDerivedRaw(CefWrapperType type,
CefRawPtr<BaseName> c);
static CefWrapperType kWrapperType;
DISALLOW_COPY_AND_ASSIGN(CefCToCppScoped);
};
template <class ClassName, class BaseName, class StructName>
struct CefCToCppScoped<ClassName,BaseName,StructName>::WrapperStruct {
CefWrapperType type_;
StructName* struct_;
ClassName wrapper_;
};
template <class ClassName, class BaseName, class StructName>
CefOwnPtr<BaseName> CefCToCppScoped<ClassName, BaseName, StructName>::Wrap(
StructName* s) {
if (!s)
return CefOwnPtr<BaseName>();
// Wrap their structure with the CefCToCpp object.
WrapperStruct* wrapperStruct = new WrapperStruct;
wrapperStruct->type_ = kWrapperType;
wrapperStruct->struct_ = s;
return CefOwnPtr<BaseName>(&wrapperStruct->wrapper_);
}
template <class ClassName, class BaseName, class StructName>
StructName* CefCToCppScoped<ClassName, BaseName, StructName>::UnwrapOwn(
CefOwnPtr<BaseName> c) {
if (!c.get())
return NULL;
WrapperStruct* wrapperStruct = GetWrapperStruct(c.get());
// 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));
StructName* orig_struct = wrapperStruct->struct_;
// We should own the object currently.
cef_base_scoped_t* base = reinterpret_cast<cef_base_scoped_t*>(orig_struct);
DCHECK(base && base->del);
// Don't delete the original object when the wrapper is deleted.
wrapperStruct->struct_ = NULL;
// Return the original structure.
return orig_struct;
// The wrapper |c| is deleted when this method goes out of scope.
}
template <class ClassName, class BaseName, class StructName>
StructName* CefCToCppScoped<ClassName, BaseName, StructName>::UnwrapRaw(
CefRawPtr<BaseName> c) {
if (!c)
return NULL;
WrapperStruct* wrapperStruct = GetWrapperStruct(c);
// If the type does not match this object then we need to unwrap as the
// derived type.
if (wrapperStruct->type_ != kWrapperType)
return UnwrapDerivedRaw(wrapperStruct->type_, c);
// Return the original structure.
return wrapperStruct->struct_;
}
template <class ClassName, class BaseName, class StructName>
void CefCToCppScoped<ClassName, BaseName, StructName>::operator delete(
void* ptr) {
WrapperStruct* wrapperStruct = GetWrapperStruct(static_cast<BaseName*>(ptr));
// Verify that the wrapper offset was calculated correctly.
DCHECK_EQ(kWrapperType, wrapperStruct->type_);
// May be NULL if UnwrapOwn() was called.
cef_base_scoped_t* base =
reinterpret_cast<cef_base_scoped_t*>(wrapperStruct->struct_);
// If we own the object (base->del != NULL) then notify the other side that
// the object has been deleted.
if (base && base->del)
base->del(base);
// Delete the wrapper structure without executing ~CefCToCppScoped() an
// additional time.
::operator delete(wrapperStruct);
}
template <class ClassName, class BaseName, class StructName>
typename CefCToCppScoped<ClassName, BaseName, StructName>::WrapperStruct*
CefCToCppScoped<ClassName, BaseName, StructName>::GetWrapperStruct(
const BaseName* obj) {
// Offset using the WrapperStruct size instead of individual member sizes to
// avoid problems due to platform/compiler differences in structure padding.
return reinterpret_cast<WrapperStruct*>(
reinterpret_cast<char*>(const_cast<BaseName*>(obj)) -
(sizeof(WrapperStruct) - sizeof(ClassName)));
}
#endif // CEF_LIBCEF_DLL_CTOCPP_CTOCPP_SCOPED_H_

View File

@ -48,18 +48,25 @@ bool CefSchemeRegistrarCToCpp::AddCustomScheme(const CefString& scheme_name,
CefSchemeRegistrarCToCpp::CefSchemeRegistrarCToCpp() {
}
template<> cef_scheme_registrar_t* CefCToCpp<CefSchemeRegistrarCToCpp,
CefSchemeRegistrar, cef_scheme_registrar_t>::UnwrapDerived(
CefWrapperType type, CefSchemeRegistrar* c) {
template<> cef_scheme_registrar_t* CefCToCppScoped<CefSchemeRegistrarCToCpp,
CefSchemeRegistrar, cef_scheme_registrar_t>::UnwrapDerivedOwn(
CefWrapperType type, CefOwnPtr<CefSchemeRegistrar> c) {
NOTREACHED() << "Unexpected class type: " << type;
return NULL;
}
template<> cef_scheme_registrar_t* CefCToCppScoped<CefSchemeRegistrarCToCpp,
CefSchemeRegistrar, cef_scheme_registrar_t>::UnwrapDerivedRaw(
CefWrapperType type, CefRawPtr<CefSchemeRegistrar> c) {
NOTREACHED() << "Unexpected class type: " << type;
return NULL;
}
#if DCHECK_IS_ON()
template<> base::AtomicRefCount CefCToCpp<CefSchemeRegistrarCToCpp,
template<> base::AtomicRefCount CefCToCppScoped<CefSchemeRegistrarCToCpp,
CefSchemeRegistrar, cef_scheme_registrar_t>::DebugObjCt = 0;
#endif
template<> CefWrapperType CefCToCpp<CefSchemeRegistrarCToCpp,
template<> CefWrapperType CefCToCppScoped<CefSchemeRegistrarCToCpp,
CefSchemeRegistrar, cef_scheme_registrar_t>::kWrapperType =
WT_SCHEME_REGISTRAR;

View File

@ -20,12 +20,12 @@
#include "include/cef_scheme.h"
#include "include/capi/cef_scheme_capi.h"
#include "libcef_dll/ctocpp/ctocpp.h"
#include "libcef_dll/ctocpp/ctocpp_scoped.h"
// Wrap a C structure with a C++ class.
// This class may be instantiated and accessed wrapper-side only.
class CefSchemeRegistrarCToCpp
: public CefCToCpp<CefSchemeRegistrarCToCpp, CefSchemeRegistrar,
: public CefCToCppScoped<CefSchemeRegistrarCToCpp, CefSchemeRegistrar,
cef_scheme_registrar_t> {
public:
CefSchemeRegistrarCToCpp();

View File

@ -11,11 +11,15 @@
//
#include <algorithm>
#include "libcef_dll/cpptoc/test/translator_test_handler_cpptoc.h"
#include "libcef_dll/cpptoc/test/translator_test_handler_child_cpptoc.h"
#include "libcef_dll/cpptoc/test/translator_test_ref_ptr_client_cpptoc.h"
#include "libcef_dll/cpptoc/test/translator_test_ref_ptr_client_child_cpptoc.h"
#include "libcef_dll/cpptoc/test/translator_test_scoped_client_cpptoc.h"
#include "libcef_dll/cpptoc/test/translator_test_scoped_client_child_cpptoc.h"
#include "libcef_dll/ctocpp/test/translator_test_ctocpp.h"
#include "libcef_dll/ctocpp/test/translator_test_object_ctocpp.h"
#include "libcef_dll/ctocpp/test/translator_test_object_child_ctocpp.h"
#include "libcef_dll/ctocpp/test/translator_test_ref_ptr_library_ctocpp.h"
#include "libcef_dll/ctocpp/test/translator_test_ref_ptr_library_child_ctocpp.h"
#include "libcef_dll/ctocpp/test/translator_test_scoped_library_ctocpp.h"
#include "libcef_dll/ctocpp/test/translator_test_scoped_library_child_ctocpp.h"
#include "libcef_dll/transfer_util.h"
@ -632,24 +636,27 @@ size_t CefTranslatorTestCToCpp::GetPointListSize() {
return _retval;
}
CefRefPtr<CefTranslatorTestObject> CefTranslatorTestCToCpp::GetObject(int val) {
CefRefPtr<CefTranslatorTestRefPtrLibrary> CefTranslatorTestCToCpp::GetRefPtrLibrary(
int val) {
cef_translator_test_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_object))
if (CEF_MEMBER_MISSING(_struct, get_ref_ptr_library))
return NULL;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_translator_test_object_t* _retval = _struct->get_object(_struct,
cef_translator_test_ref_ptr_library_t* _retval = _struct->get_ref_ptr_library(
_struct,
val);
// Return type: refptr_same
return CefTranslatorTestObjectCToCpp::Wrap(_retval);
return CefTranslatorTestRefPtrLibraryCToCpp::Wrap(_retval);
}
int CefTranslatorTestCToCpp::SetObject(CefRefPtr<CefTranslatorTestObject> val) {
int CefTranslatorTestCToCpp::SetRefPtrLibrary(
CefRefPtr<CefTranslatorTestRefPtrLibrary> val) {
cef_translator_test_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, set_object))
if (CEF_MEMBER_MISSING(_struct, set_ref_ptr_library))
return 0;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
@ -660,17 +667,17 @@ int CefTranslatorTestCToCpp::SetObject(CefRefPtr<CefTranslatorTestObject> val) {
return 0;
// Execute
int _retval = _struct->set_object(_struct,
CefTranslatorTestObjectCToCpp::Unwrap(val));
int _retval = _struct->set_ref_ptr_library(_struct,
CefTranslatorTestRefPtrLibraryCToCpp::Unwrap(val));
// Return type: simple
return _retval;
}
CefRefPtr<CefTranslatorTestObject> CefTranslatorTestCToCpp::SetObjectAndReturn(
CefRefPtr<CefTranslatorTestObject> val) {
CefRefPtr<CefTranslatorTestRefPtrLibrary> CefTranslatorTestCToCpp::SetRefPtrLibraryAndReturn(
CefRefPtr<CefTranslatorTestRefPtrLibrary> val) {
cef_translator_test_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, set_object_and_return))
if (CEF_MEMBER_MISSING(_struct, set_ref_ptr_library_and_return))
return NULL;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
@ -681,18 +688,18 @@ CefRefPtr<CefTranslatorTestObject> CefTranslatorTestCToCpp::SetObjectAndReturn(
return NULL;
// Execute
cef_translator_test_object_t* _retval = _struct->set_object_and_return(
_struct,
CefTranslatorTestObjectCToCpp::Unwrap(val));
cef_translator_test_ref_ptr_library_t* _retval =
_struct->set_ref_ptr_library_and_return(_struct,
CefTranslatorTestRefPtrLibraryCToCpp::Unwrap(val));
// Return type: refptr_same
return CefTranslatorTestObjectCToCpp::Wrap(_retval);
return CefTranslatorTestRefPtrLibraryCToCpp::Wrap(_retval);
}
int CefTranslatorTestCToCpp::SetChildObject(
CefRefPtr<CefTranslatorTestObjectChild> val) {
int CefTranslatorTestCToCpp::SetChildRefPtrLibrary(
CefRefPtr<CefTranslatorTestRefPtrLibraryChild> val) {
cef_translator_test_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, set_child_object))
if (CEF_MEMBER_MISSING(_struct, set_child_ref_ptr_library))
return 0;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
@ -703,17 +710,17 @@ int CefTranslatorTestCToCpp::SetChildObject(
return 0;
// Execute
int _retval = _struct->set_child_object(_struct,
CefTranslatorTestObjectChildCToCpp::Unwrap(val));
int _retval = _struct->set_child_ref_ptr_library(_struct,
CefTranslatorTestRefPtrLibraryChildCToCpp::Unwrap(val));
// Return type: simple
return _retval;
}
CefRefPtr<CefTranslatorTestObject> CefTranslatorTestCToCpp::SetChildObjectAndReturnParent(
CefRefPtr<CefTranslatorTestObjectChild> val) {
CefRefPtr<CefTranslatorTestRefPtrLibrary> CefTranslatorTestCToCpp::SetChildRefPtrLibraryAndReturnParent(
CefRefPtr<CefTranslatorTestRefPtrLibraryChild> val) {
cef_translator_test_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, set_child_object_and_return_parent))
if (CEF_MEMBER_MISSING(_struct, set_child_ref_ptr_library_and_return_parent))
return NULL;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
@ -724,38 +731,38 @@ CefRefPtr<CefTranslatorTestObject> CefTranslatorTestCToCpp::SetChildObjectAndRet
return NULL;
// Execute
cef_translator_test_object_t* _retval =
_struct->set_child_object_and_return_parent(_struct,
CefTranslatorTestObjectChildCToCpp::Unwrap(val));
cef_translator_test_ref_ptr_library_t* _retval =
_struct->set_child_ref_ptr_library_and_return_parent(_struct,
CefTranslatorTestRefPtrLibraryChildCToCpp::Unwrap(val));
// Return type: refptr_same
return CefTranslatorTestObjectCToCpp::Wrap(_retval);
return CefTranslatorTestRefPtrLibraryCToCpp::Wrap(_retval);
}
bool CefTranslatorTestCToCpp::SetObjectList(
const std::vector<CefRefPtr<CefTranslatorTestObject>>& val, int val1,
bool CefTranslatorTestCToCpp::SetRefPtrLibraryList(
const std::vector<CefRefPtr<CefTranslatorTestRefPtrLibrary>>& val, int val1,
int val2) {
cef_translator_test_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, set_object_list))
if (CEF_MEMBER_MISSING(_struct, set_ref_ptr_library_list))
return false;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Translate param: val; type: refptr_vec_same_byref_const
const size_t valCount = val.size();
cef_translator_test_object_t** valList = NULL;
cef_translator_test_ref_ptr_library_t** valList = NULL;
if (valCount > 0) {
valList = new cef_translator_test_object_t*[valCount];
valList = new cef_translator_test_ref_ptr_library_t*[valCount];
DCHECK(valList);
if (valList) {
for (size_t i = 0; i < valCount; ++i) {
valList[i] = CefTranslatorTestObjectCToCpp::Unwrap(val[i]);
valList[i] = CefTranslatorTestRefPtrLibraryCToCpp::Unwrap(val[i]);
}
}
}
// Execute
int _retval = _struct->set_object_list(_struct,
int _retval = _struct->set_ref_ptr_library_list(_struct,
valCount,
valList,
val1,
@ -769,33 +776,34 @@ bool CefTranslatorTestCToCpp::SetObjectList(
return _retval?true:false;
}
bool CefTranslatorTestCToCpp::GetObjectListByRef(ObjectList& val, int val1,
int val2) {
bool CefTranslatorTestCToCpp::GetRefPtrLibraryListByRef(RefPtrLibraryList& val,
int val1, int val2) {
cef_translator_test_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_object_list_by_ref))
if (CEF_MEMBER_MISSING(_struct, get_ref_ptr_library_list_by_ref))
return false;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Translate param: val; type: refptr_vec_same_byref
size_t valSize = val.size();
size_t valCount = std::max(GetObjectListSize(), valSize);
cef_translator_test_object_t** valList = NULL;
size_t valCount = std::max(GetRefPtrLibraryListSize(), valSize);
cef_translator_test_ref_ptr_library_t** valList = NULL;
if (valCount > 0) {
valList = new cef_translator_test_object_t*[valCount];
valList = new cef_translator_test_ref_ptr_library_t*[valCount];
DCHECK(valList);
if (valList) {
memset(valList, 0, sizeof(cef_translator_test_object_t*)*valCount);
memset(valList, 0, sizeof(
cef_translator_test_ref_ptr_library_t*)*valCount);
}
if (valList && valSize > 0) {
for (size_t i = 0; i < valSize; ++i) {
valList[i] = CefTranslatorTestObjectCToCpp::Unwrap(val[i]);
valList[i] = CefTranslatorTestRefPtrLibraryCToCpp::Unwrap(val[i]);
}
}
}
// Execute
int _retval = _struct->get_object_list_by_ref(_struct,
int _retval = _struct->get_ref_ptr_library_list_by_ref(_struct,
&valCount,
valList,
val1,
@ -805,7 +813,7 @@ bool CefTranslatorTestCToCpp::GetObjectListByRef(ObjectList& val, int val1,
val.clear();
if (valCount > 0 && valList) {
for (size_t i = 0; i < valCount; ++i) {
val.push_back(CefTranslatorTestObjectCToCpp::Wrap(valList[i]));
val.push_back(CefTranslatorTestRefPtrLibraryCToCpp::Wrap(valList[i]));
}
delete [] valList;
}
@ -814,24 +822,24 @@ bool CefTranslatorTestCToCpp::GetObjectListByRef(ObjectList& val, int val1,
return _retval?true:false;
}
size_t CefTranslatorTestCToCpp::GetObjectListSize() {
size_t CefTranslatorTestCToCpp::GetRefPtrLibraryListSize() {
cef_translator_test_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_object_list_size))
if (CEF_MEMBER_MISSING(_struct, get_ref_ptr_library_list_size))
return 0;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
size_t _retval = _struct->get_object_list_size(_struct);
size_t _retval = _struct->get_ref_ptr_library_list_size(_struct);
// Return type: simple
return _retval;
}
int CefTranslatorTestCToCpp::SetHandler(
CefRefPtr<CefTranslatorTestHandler> val) {
int CefTranslatorTestCToCpp::SetRefPtrClient(
CefRefPtr<CefTranslatorTestRefPtrClient> val) {
cef_translator_test_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, set_handler))
if (CEF_MEMBER_MISSING(_struct, set_ref_ptr_client))
return 0;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
@ -842,17 +850,17 @@ int CefTranslatorTestCToCpp::SetHandler(
return 0;
// Execute
int _retval = _struct->set_handler(_struct,
CefTranslatorTestHandlerCppToC::Wrap(val));
int _retval = _struct->set_ref_ptr_client(_struct,
CefTranslatorTestRefPtrClientCppToC::Wrap(val));
// Return type: simple
return _retval;
}
CefRefPtr<CefTranslatorTestHandler> CefTranslatorTestCToCpp::SetHandlerAndReturn(
CefRefPtr<CefTranslatorTestHandler> val) {
CefRefPtr<CefTranslatorTestRefPtrClient> CefTranslatorTestCToCpp::SetRefPtrClientAndReturn(
CefRefPtr<CefTranslatorTestRefPtrClient> val) {
cef_translator_test_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, set_handler_and_return))
if (CEF_MEMBER_MISSING(_struct, set_ref_ptr_client_and_return))
return NULL;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
@ -863,18 +871,18 @@ CefRefPtr<CefTranslatorTestHandler> CefTranslatorTestCToCpp::SetHandlerAndReturn
return NULL;
// Execute
cef_translator_test_handler_t* _retval = _struct->set_handler_and_return(
_struct,
CefTranslatorTestHandlerCppToC::Wrap(val));
cef_translator_test_ref_ptr_client_t* _retval =
_struct->set_ref_ptr_client_and_return(_struct,
CefTranslatorTestRefPtrClientCppToC::Wrap(val));
// Return type: refptr_diff
return CefTranslatorTestHandlerCppToC::Unwrap(_retval);
return CefTranslatorTestRefPtrClientCppToC::Unwrap(_retval);
}
int CefTranslatorTestCToCpp::SetChildHandler(
CefRefPtr<CefTranslatorTestHandlerChild> val) {
int CefTranslatorTestCToCpp::SetChildRefPtrClient(
CefRefPtr<CefTranslatorTestRefPtrClientChild> val) {
cef_translator_test_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, set_child_handler))
if (CEF_MEMBER_MISSING(_struct, set_child_ref_ptr_client))
return 0;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
@ -885,17 +893,17 @@ int CefTranslatorTestCToCpp::SetChildHandler(
return 0;
// Execute
int _retval = _struct->set_child_handler(_struct,
CefTranslatorTestHandlerChildCppToC::Wrap(val));
int _retval = _struct->set_child_ref_ptr_client(_struct,
CefTranslatorTestRefPtrClientChildCppToC::Wrap(val));
// Return type: simple
return _retval;
}
CefRefPtr<CefTranslatorTestHandler> CefTranslatorTestCToCpp::SetChildHandlerAndReturnParent(
CefRefPtr<CefTranslatorTestHandlerChild> val) {
CefRefPtr<CefTranslatorTestRefPtrClient> CefTranslatorTestCToCpp::SetChildRefPtrClientAndReturnParent(
CefRefPtr<CefTranslatorTestRefPtrClientChild> val) {
cef_translator_test_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, set_child_handler_and_return_parent))
if (CEF_MEMBER_MISSING(_struct, set_child_ref_ptr_client_and_return_parent))
return NULL;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
@ -906,38 +914,38 @@ CefRefPtr<CefTranslatorTestHandler> CefTranslatorTestCToCpp::SetChildHandlerAndR
return NULL;
// Execute
cef_translator_test_handler_t* _retval =
_struct->set_child_handler_and_return_parent(_struct,
CefTranslatorTestHandlerChildCppToC::Wrap(val));
cef_translator_test_ref_ptr_client_t* _retval =
_struct->set_child_ref_ptr_client_and_return_parent(_struct,
CefTranslatorTestRefPtrClientChildCppToC::Wrap(val));
// Return type: refptr_diff
return CefTranslatorTestHandlerCppToC::Unwrap(_retval);
return CefTranslatorTestRefPtrClientCppToC::Unwrap(_retval);
}
bool CefTranslatorTestCToCpp::SetHandlerList(
const std::vector<CefRefPtr<CefTranslatorTestHandler>>& val, int val1,
bool CefTranslatorTestCToCpp::SetRefPtrClientList(
const std::vector<CefRefPtr<CefTranslatorTestRefPtrClient>>& val, int val1,
int val2) {
cef_translator_test_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, set_handler_list))
if (CEF_MEMBER_MISSING(_struct, set_ref_ptr_client_list))
return false;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Translate param: val; type: refptr_vec_diff_byref_const
const size_t valCount = val.size();
cef_translator_test_handler_t** valList = NULL;
cef_translator_test_ref_ptr_client_t** valList = NULL;
if (valCount > 0) {
valList = new cef_translator_test_handler_t*[valCount];
valList = new cef_translator_test_ref_ptr_client_t*[valCount];
DCHECK(valList);
if (valList) {
for (size_t i = 0; i < valCount; ++i) {
valList[i] = CefTranslatorTestHandlerCppToC::Wrap(val[i]);
valList[i] = CefTranslatorTestRefPtrClientCppToC::Wrap(val[i]);
}
}
}
// Execute
int _retval = _struct->set_handler_list(_struct,
int _retval = _struct->set_ref_ptr_client_list(_struct,
valCount,
valList,
val1,
@ -951,11 +959,11 @@ bool CefTranslatorTestCToCpp::SetHandlerList(
return _retval?true:false;
}
bool CefTranslatorTestCToCpp::GetHandlerListByRef(HandlerList& val,
CefRefPtr<CefTranslatorTestHandler> val1,
CefRefPtr<CefTranslatorTestHandler> val2) {
bool CefTranslatorTestCToCpp::GetRefPtrClientListByRef(RefPtrClientList& val,
CefRefPtr<CefTranslatorTestRefPtrClient> val1,
CefRefPtr<CefTranslatorTestRefPtrClient> val2) {
cef_translator_test_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_handler_list_by_ref))
if (CEF_MEMBER_MISSING(_struct, get_ref_ptr_client_list_by_ref))
return false;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
@ -971,33 +979,34 @@ bool CefTranslatorTestCToCpp::GetHandlerListByRef(HandlerList& val,
// Translate param: val; type: refptr_vec_diff_byref
size_t valSize = val.size();
size_t valCount = std::max(GetObjectListSize(), valSize);
cef_translator_test_handler_t** valList = NULL;
size_t valCount = std::max(GetRefPtrLibraryListSize(), valSize);
cef_translator_test_ref_ptr_client_t** valList = NULL;
if (valCount > 0) {
valList = new cef_translator_test_handler_t*[valCount];
valList = new cef_translator_test_ref_ptr_client_t*[valCount];
DCHECK(valList);
if (valList) {
memset(valList, 0, sizeof(cef_translator_test_handler_t*)*valCount);
memset(valList, 0, sizeof(
cef_translator_test_ref_ptr_client_t*)*valCount);
}
if (valList && valSize > 0) {
for (size_t i = 0; i < valSize; ++i) {
valList[i] = CefTranslatorTestHandlerCppToC::Wrap(val[i]);
valList[i] = CefTranslatorTestRefPtrClientCppToC::Wrap(val[i]);
}
}
}
// Execute
int _retval = _struct->get_handler_list_by_ref(_struct,
int _retval = _struct->get_ref_ptr_client_list_by_ref(_struct,
&valCount,
valList,
CefTranslatorTestHandlerCppToC::Wrap(val1),
CefTranslatorTestHandlerCppToC::Wrap(val2));
CefTranslatorTestRefPtrClientCppToC::Wrap(val1),
CefTranslatorTestRefPtrClientCppToC::Wrap(val2));
// Restore param:val; type: refptr_vec_diff_byref
val.clear();
if (valCount > 0 && valList) {
for (size_t i = 0; i < valCount; ++i) {
val.push_back(CefTranslatorTestHandlerCppToC::Unwrap(valList[i]));
val.push_back(CefTranslatorTestRefPtrClientCppToC::Unwrap(valList[i]));
}
delete [] valList;
}
@ -1006,20 +1015,381 @@ bool CefTranslatorTestCToCpp::GetHandlerListByRef(HandlerList& val,
return _retval?true:false;
}
size_t CefTranslatorTestCToCpp::GetHandlerListSize() {
size_t CefTranslatorTestCToCpp::GetRefPtrClientListSize() {
cef_translator_test_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_handler_list_size))
if (CEF_MEMBER_MISSING(_struct, get_ref_ptr_client_list_size))
return 0;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
size_t _retval = _struct->get_handler_list_size(_struct);
size_t _retval = _struct->get_ref_ptr_client_list_size(_struct);
// Return type: simple
return _retval;
}
CefOwnPtr<CefTranslatorTestScopedLibrary> CefTranslatorTestCToCpp::GetOwnPtrLibrary(
int val) {
cef_translator_test_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_own_ptr_library))
return CefOwnPtr<CefTranslatorTestScopedLibrary>();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_translator_test_scoped_library_t* _retval = _struct->get_own_ptr_library(
_struct,
val);
// Return type: ownptr_same
return CefTranslatorTestScopedLibraryCToCpp::Wrap(_retval);
}
int CefTranslatorTestCToCpp::SetOwnPtrLibrary(
CefOwnPtr<CefTranslatorTestScopedLibrary> val) {
cef_translator_test_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, set_own_ptr_library))
return 0;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Verify param: val; type: ownptr_same
DCHECK(val.get());
if (!val.get())
return 0;
// Execute
int _retval = _struct->set_own_ptr_library(_struct,
CefTranslatorTestScopedLibraryCToCpp::UnwrapOwn(OWN_PASS(val)));
// Return type: simple
return _retval;
}
CefOwnPtr<CefTranslatorTestScopedLibrary> CefTranslatorTestCToCpp::SetOwnPtrLibraryAndReturn(
CefOwnPtr<CefTranslatorTestScopedLibrary> val) {
cef_translator_test_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, set_own_ptr_library_and_return))
return CefOwnPtr<CefTranslatorTestScopedLibrary>();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Verify param: val; type: ownptr_same
DCHECK(val.get());
if (!val.get())
return CefOwnPtr<CefTranslatorTestScopedLibrary>();
// Execute
cef_translator_test_scoped_library_t* _retval =
_struct->set_own_ptr_library_and_return(_struct,
CefTranslatorTestScopedLibraryCToCpp::UnwrapOwn(OWN_PASS(val)));
// Return type: ownptr_same
return CefTranslatorTestScopedLibraryCToCpp::Wrap(_retval);
}
int CefTranslatorTestCToCpp::SetChildOwnPtrLibrary(
CefOwnPtr<CefTranslatorTestScopedLibraryChild> val) {
cef_translator_test_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, set_child_own_ptr_library))
return 0;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Verify param: val; type: ownptr_same
DCHECK(val.get());
if (!val.get())
return 0;
// Execute
int _retval = _struct->set_child_own_ptr_library(_struct,
CefTranslatorTestScopedLibraryChildCToCpp::UnwrapOwn(OWN_PASS(val)));
// Return type: simple
return _retval;
}
CefOwnPtr<CefTranslatorTestScopedLibrary> CefTranslatorTestCToCpp::SetChildOwnPtrLibraryAndReturnParent(
CefOwnPtr<CefTranslatorTestScopedLibraryChild> val) {
cef_translator_test_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, set_child_own_ptr_library_and_return_parent))
return CefOwnPtr<CefTranslatorTestScopedLibrary>();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Verify param: val; type: ownptr_same
DCHECK(val.get());
if (!val.get())
return CefOwnPtr<CefTranslatorTestScopedLibrary>();
// Execute
cef_translator_test_scoped_library_t* _retval =
_struct->set_child_own_ptr_library_and_return_parent(_struct,
CefTranslatorTestScopedLibraryChildCToCpp::UnwrapOwn(OWN_PASS(val)));
// Return type: ownptr_same
return CefTranslatorTestScopedLibraryCToCpp::Wrap(_retval);
}
int CefTranslatorTestCToCpp::SetOwnPtrClient(
CefOwnPtr<CefTranslatorTestScopedClient> val) {
cef_translator_test_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, set_own_ptr_client))
return 0;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Verify param: val; type: ownptr_diff
DCHECK(val.get());
if (!val.get())
return 0;
// Execute
int _retval = _struct->set_own_ptr_client(_struct,
CefTranslatorTestScopedClientCppToC::WrapOwn(OWN_PASS(val)));
// Return type: simple
return _retval;
}
CefOwnPtr<CefTranslatorTestScopedClient> CefTranslatorTestCToCpp::SetOwnPtrClientAndReturn(
CefOwnPtr<CefTranslatorTestScopedClient> val) {
cef_translator_test_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, set_own_ptr_client_and_return))
return CefOwnPtr<CefTranslatorTestScopedClient>();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Verify param: val; type: ownptr_diff
DCHECK(val.get());
if (!val.get())
return CefOwnPtr<CefTranslatorTestScopedClient>();
// Execute
cef_translator_test_scoped_client_t* _retval =
_struct->set_own_ptr_client_and_return(_struct,
CefTranslatorTestScopedClientCppToC::WrapOwn(OWN_PASS(val)));
// Return type: ownptr_diff
return CefTranslatorTestScopedClientCppToC::UnwrapOwn(_retval);
}
int CefTranslatorTestCToCpp::SetChildOwnPtrClient(
CefOwnPtr<CefTranslatorTestScopedClientChild> val) {
cef_translator_test_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, set_child_own_ptr_client))
return 0;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Verify param: val; type: ownptr_diff
DCHECK(val.get());
if (!val.get())
return 0;
// Execute
int _retval = _struct->set_child_own_ptr_client(_struct,
CefTranslatorTestScopedClientChildCppToC::WrapOwn(OWN_PASS(val)));
// Return type: simple
return _retval;
}
CefOwnPtr<CefTranslatorTestScopedClient> CefTranslatorTestCToCpp::SetChildOwnPtrClientAndReturnParent(
CefOwnPtr<CefTranslatorTestScopedClientChild> val) {
cef_translator_test_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, set_child_own_ptr_client_and_return_parent))
return CefOwnPtr<CefTranslatorTestScopedClient>();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Verify param: val; type: ownptr_diff
DCHECK(val.get());
if (!val.get())
return CefOwnPtr<CefTranslatorTestScopedClient>();
// Execute
cef_translator_test_scoped_client_t* _retval =
_struct->set_child_own_ptr_client_and_return_parent(_struct,
CefTranslatorTestScopedClientChildCppToC::WrapOwn(OWN_PASS(val)));
// Return type: ownptr_diff
return CefTranslatorTestScopedClientCppToC::UnwrapOwn(_retval);
}
int CefTranslatorTestCToCpp::SetRawPtrLibrary(
CefRawPtr<CefTranslatorTestScopedLibrary> val) {
cef_translator_test_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, set_raw_ptr_library))
return 0;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Verify param: val; type: rawptr_same
DCHECK(val);
if (!val)
return 0;
// Execute
int _retval = _struct->set_raw_ptr_library(_struct,
CefTranslatorTestScopedLibraryCToCpp::UnwrapRaw(val));
// Return type: simple
return _retval;
}
int CefTranslatorTestCToCpp::SetChildRawPtrLibrary(
CefRawPtr<CefTranslatorTestScopedLibraryChild> val) {
cef_translator_test_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, set_child_raw_ptr_library))
return 0;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Verify param: val; type: rawptr_same
DCHECK(val);
if (!val)
return 0;
// Execute
int _retval = _struct->set_child_raw_ptr_library(_struct,
CefTranslatorTestScopedLibraryChildCToCpp::UnwrapRaw(val));
// Return type: simple
return _retval;
}
bool CefTranslatorTestCToCpp::SetRawPtrLibraryList(
const std::vector<CefRawPtr<CefTranslatorTestScopedLibrary>>& val, int val1,
int val2) {
cef_translator_test_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, set_raw_ptr_library_list))
return false;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Translate param: val; type: rawptr_vec_same_byref_const
const size_t valCount = val.size();
cef_translator_test_scoped_library_t** valList = NULL;
if (valCount > 0) {
valList = new cef_translator_test_scoped_library_t*[valCount];
DCHECK(valList);
if (valList) {
for (size_t i = 0; i < valCount; ++i) {
valList[i] = CefTranslatorTestScopedLibraryCToCpp::UnwrapRaw(val[i]);
}
}
}
// Execute
int _retval = _struct->set_raw_ptr_library_list(_struct,
valCount,
valList,
val1,
val2);
// Restore param:val; type: rawptr_vec_same_byref_const
if (valList)
delete [] valList;
// Return type: bool
return _retval?true:false;
}
int CefTranslatorTestCToCpp::SetRawPtrClient(
CefRawPtr<CefTranslatorTestScopedClient> val) {
cef_translator_test_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, set_raw_ptr_client))
return 0;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Verify param: val; type: rawptr_diff
DCHECK(val);
if (!val)
return 0;
// Translate param: val; type: rawptr_diff
CefOwnPtr<CefTranslatorTestScopedClientCppToC> valPtr(
CefTranslatorTestScopedClientCppToC::WrapRaw(val));
// Execute
int _retval = _struct->set_raw_ptr_client(_struct,
valPtr->GetStruct());
// Return type: simple
return _retval;
}
int CefTranslatorTestCToCpp::SetChildRawPtrClient(
CefRawPtr<CefTranslatorTestScopedClientChild> val) {
cef_translator_test_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, set_child_raw_ptr_client))
return 0;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Verify param: val; type: rawptr_diff
DCHECK(val);
if (!val)
return 0;
// Translate param: val; type: rawptr_diff
CefOwnPtr<CefTranslatorTestScopedClientChildCppToC> valPtr(
CefTranslatorTestScopedClientChildCppToC::WrapRaw(val));
// Execute
int _retval = _struct->set_child_raw_ptr_client(_struct,
valPtr->GetStruct());
// Return type: simple
return _retval;
}
bool CefTranslatorTestCToCpp::SetRawPtrClientList(
const std::vector<CefRawPtr<CefTranslatorTestScopedClient>>& val, int val1,
int val2) {
cef_translator_test_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, set_raw_ptr_client_list))
return false;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Translate param: val; type: rawptr_vec_diff_byref_const
const size_t valCount = val.size();
cef_translator_test_scoped_client_t** valList = NULL;
if (valCount > 0) {
valList = new cef_translator_test_scoped_client_t*[valCount];
DCHECK(valList);
if (valList) {
for (size_t i = 0; i < valCount; ++i) {
valList[i] = CefTranslatorTestScopedClientCppToC::WrapRaw(
val[i]).release()->GetStruct();
}
}
}
// Execute
int _retval = _struct->set_raw_ptr_client_list(_struct,
valCount,
valList,
val1,
val2);
// Restore param:val; type: rawptr_vec_diff_byref_const
if (valCount > 0) {
for (size_t i = 0; i < valCount; ++i) {
delete CefTranslatorTestScopedClientCppToC::GetWrapper(valList[i]);
}
}
if (valList)
delete [] valList;
// Return type: bool
return _retval?true:false;
}
// CONSTRUCTOR - Do not edit by hand.

View File

@ -64,30 +64,61 @@ class CefTranslatorTestCToCpp
bool SetPointList(const std::vector<CefPoint>& val) OVERRIDE;
bool GetPointListByRef(PointList& val) OVERRIDE;
size_t GetPointListSize() OVERRIDE;
CefRefPtr<CefTranslatorTestObject> GetObject(int val) OVERRIDE;
int SetObject(CefRefPtr<CefTranslatorTestObject> val) OVERRIDE;
CefRefPtr<CefTranslatorTestObject> SetObjectAndReturn(
CefRefPtr<CefTranslatorTestObject> val) OVERRIDE;
int SetChildObject(CefRefPtr<CefTranslatorTestObjectChild> val) OVERRIDE;
CefRefPtr<CefTranslatorTestObject> SetChildObjectAndReturnParent(
CefRefPtr<CefTranslatorTestObjectChild> val) OVERRIDE;
bool SetObjectList(const std::vector<CefRefPtr<CefTranslatorTestObject>>& val,
CefRefPtr<CefTranslatorTestRefPtrLibrary> GetRefPtrLibrary(int val) OVERRIDE;
int SetRefPtrLibrary(CefRefPtr<CefTranslatorTestRefPtrLibrary> val) OVERRIDE;
CefRefPtr<CefTranslatorTestRefPtrLibrary> SetRefPtrLibraryAndReturn(
CefRefPtr<CefTranslatorTestRefPtrLibrary> val) OVERRIDE;
int SetChildRefPtrLibrary(
CefRefPtr<CefTranslatorTestRefPtrLibraryChild> val) OVERRIDE;
CefRefPtr<CefTranslatorTestRefPtrLibrary> SetChildRefPtrLibraryAndReturnParent(
CefRefPtr<CefTranslatorTestRefPtrLibraryChild> val) OVERRIDE;
bool SetRefPtrLibraryList(
const std::vector<CefRefPtr<CefTranslatorTestRefPtrLibrary>>& val,
int val1, int val2) OVERRIDE;
bool GetObjectListByRef(ObjectList& val, int val1, int val2) OVERRIDE;
size_t GetObjectListSize() OVERRIDE;
int SetHandler(CefRefPtr<CefTranslatorTestHandler> val) OVERRIDE;
CefRefPtr<CefTranslatorTestHandler> SetHandlerAndReturn(
CefRefPtr<CefTranslatorTestHandler> val) OVERRIDE;
int SetChildHandler(CefRefPtr<CefTranslatorTestHandlerChild> val) OVERRIDE;
CefRefPtr<CefTranslatorTestHandler> SetChildHandlerAndReturnParent(
CefRefPtr<CefTranslatorTestHandlerChild> val) OVERRIDE;
bool SetHandlerList(
const std::vector<CefRefPtr<CefTranslatorTestHandler>>& val, int val1,
bool GetRefPtrLibraryListByRef(RefPtrLibraryList& val, int val1,
int val2) OVERRIDE;
bool GetHandlerListByRef(HandlerList& val,
CefRefPtr<CefTranslatorTestHandler> val1,
CefRefPtr<CefTranslatorTestHandler> val2) OVERRIDE;
size_t GetHandlerListSize() OVERRIDE;
size_t GetRefPtrLibraryListSize() OVERRIDE;
int SetRefPtrClient(CefRefPtr<CefTranslatorTestRefPtrClient> val) OVERRIDE;
CefRefPtr<CefTranslatorTestRefPtrClient> SetRefPtrClientAndReturn(
CefRefPtr<CefTranslatorTestRefPtrClient> val) OVERRIDE;
int SetChildRefPtrClient(
CefRefPtr<CefTranslatorTestRefPtrClientChild> val) OVERRIDE;
CefRefPtr<CefTranslatorTestRefPtrClient> SetChildRefPtrClientAndReturnParent(
CefRefPtr<CefTranslatorTestRefPtrClientChild> val) OVERRIDE;
bool SetRefPtrClientList(
const std::vector<CefRefPtr<CefTranslatorTestRefPtrClient>>& val,
int val1, int val2) OVERRIDE;
bool GetRefPtrClientListByRef(RefPtrClientList& val,
CefRefPtr<CefTranslatorTestRefPtrClient> val1,
CefRefPtr<CefTranslatorTestRefPtrClient> val2) OVERRIDE;
size_t GetRefPtrClientListSize() OVERRIDE;
CefOwnPtr<CefTranslatorTestScopedLibrary> GetOwnPtrLibrary(int val) OVERRIDE;
int SetOwnPtrLibrary(CefOwnPtr<CefTranslatorTestScopedLibrary> val) OVERRIDE;
CefOwnPtr<CefTranslatorTestScopedLibrary> SetOwnPtrLibraryAndReturn(
CefOwnPtr<CefTranslatorTestScopedLibrary> val) OVERRIDE;
int SetChildOwnPtrLibrary(
CefOwnPtr<CefTranslatorTestScopedLibraryChild> val) OVERRIDE;
CefOwnPtr<CefTranslatorTestScopedLibrary> SetChildOwnPtrLibraryAndReturnParent(
CefOwnPtr<CefTranslatorTestScopedLibraryChild> val) OVERRIDE;
int SetOwnPtrClient(CefOwnPtr<CefTranslatorTestScopedClient> val) OVERRIDE;
CefOwnPtr<CefTranslatorTestScopedClient> SetOwnPtrClientAndReturn(
CefOwnPtr<CefTranslatorTestScopedClient> val) OVERRIDE;
int SetChildOwnPtrClient(
CefOwnPtr<CefTranslatorTestScopedClientChild> val) OVERRIDE;
CefOwnPtr<CefTranslatorTestScopedClient> SetChildOwnPtrClientAndReturnParent(
CefOwnPtr<CefTranslatorTestScopedClientChild> val) OVERRIDE;
int SetRawPtrLibrary(CefRawPtr<CefTranslatorTestScopedLibrary> val) OVERRIDE;
int SetChildRawPtrLibrary(
CefRawPtr<CefTranslatorTestScopedLibraryChild> val) OVERRIDE;
bool SetRawPtrLibraryList(
const std::vector<CefRawPtr<CefTranslatorTestScopedLibrary>>& val,
int val1, int val2) OVERRIDE;
int SetRawPtrClient(CefRawPtr<CefTranslatorTestScopedClient> val) OVERRIDE;
int SetChildRawPtrClient(
CefRawPtr<CefTranslatorTestScopedClientChild> val) OVERRIDE;
bool SetRawPtrClientList(
const std::vector<CefRawPtr<CefTranslatorTestScopedClient>>& val,
int val1, int val2) OVERRIDE;
};
#endif // CEF_LIBCEF_DLL_CTOCPP_TEST_TRANSLATOR_TEST_CTOCPP_H_

View File

@ -1,58 +0,0 @@
// Copyright (c) 2017 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool. If making changes by
// hand only do so within the body of existing method and function
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
#include "libcef_dll/ctocpp/test/translator_test_handler_ctocpp.h"
#include "libcef_dll/ctocpp/test/translator_test_handler_child_ctocpp.h"
// VIRTUAL METHODS - Body may be edited by hand.
int CefTranslatorTestHandlerCToCpp::GetValue() {
cef_translator_test_handler_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_value))
return 0;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
int _retval = _struct->get_value(_struct);
// Return type: simple
return _retval;
}
// CONSTRUCTOR - Do not edit by hand.
CefTranslatorTestHandlerCToCpp::CefTranslatorTestHandlerCToCpp() {
}
template<> cef_translator_test_handler_t* CefCToCpp<CefTranslatorTestHandlerCToCpp,
CefTranslatorTestHandler, cef_translator_test_handler_t>::UnwrapDerived(
CefWrapperType type, CefTranslatorTestHandler* c) {
if (type == WT_TRANSLATOR_TEST_HANDLER_CHILD) {
return reinterpret_cast<cef_translator_test_handler_t*>(
CefTranslatorTestHandlerChildCToCpp::Unwrap(
reinterpret_cast<CefTranslatorTestHandlerChild*>(c)));
}
NOTREACHED() << "Unexpected class type: " << type;
return NULL;
}
#if DCHECK_IS_ON()
template<> base::AtomicRefCount CefCToCpp<CefTranslatorTestHandlerCToCpp,
CefTranslatorTestHandler, cef_translator_test_handler_t>::DebugObjCt = 0;
#endif
template<> CefWrapperType CefCToCpp<CefTranslatorTestHandlerCToCpp,
CefTranslatorTestHandler, cef_translator_test_handler_t>::kWrapperType =
WT_TRANSLATOR_TEST_HANDLER;

View File

@ -1,142 +0,0 @@
// Copyright (c) 2017 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool. If making changes by
// hand only do so within the body of existing method and function
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
#include "libcef_dll/ctocpp/test/translator_test_object_child_child_ctocpp.h"
// STATIC METHODS - Body may be edited by hand.
CefRefPtr<CefTranslatorTestObjectChildChild> CefTranslatorTestObjectChildChild::Create(
int value, int other_value, int other_other_value) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_translator_test_object_child_child_t* _retval =
cef_translator_test_object_child_child_create(
value,
other_value,
other_other_value);
// Return type: refptr_same
return CefTranslatorTestObjectChildChildCToCpp::Wrap(_retval);
}
// VIRTUAL METHODS - Body may be edited by hand.
int CefTranslatorTestObjectChildChildCToCpp::GetOtherOtherValue() {
cef_translator_test_object_child_child_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_other_other_value))
return 0;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
int _retval = _struct->get_other_other_value(_struct);
// Return type: simple
return _retval;
}
void CefTranslatorTestObjectChildChildCToCpp::SetOtherOtherValue(int value) {
cef_translator_test_object_child_child_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, set_other_other_value))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
_struct->set_other_other_value(_struct,
value);
}
int CefTranslatorTestObjectChildChildCToCpp::GetOtherValue() {
cef_translator_test_object_child_t* _struct =
reinterpret_cast<cef_translator_test_object_child_t*>(GetStruct());
if (CEF_MEMBER_MISSING(_struct, get_other_value))
return 0;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
int _retval = _struct->get_other_value(_struct);
// Return type: simple
return _retval;
}
void CefTranslatorTestObjectChildChildCToCpp::SetOtherValue(int value) {
cef_translator_test_object_child_t* _struct =
reinterpret_cast<cef_translator_test_object_child_t*>(GetStruct());
if (CEF_MEMBER_MISSING(_struct, set_other_value))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
_struct->set_other_value(_struct,
value);
}
int CefTranslatorTestObjectChildChildCToCpp::GetValue() {
cef_translator_test_object_t* _struct =
reinterpret_cast<cef_translator_test_object_t*>(GetStruct());
if (CEF_MEMBER_MISSING(_struct, get_value))
return 0;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
int _retval = _struct->get_value(_struct);
// Return type: simple
return _retval;
}
void CefTranslatorTestObjectChildChildCToCpp::SetValue(int value) {
cef_translator_test_object_t* _struct =
reinterpret_cast<cef_translator_test_object_t*>(GetStruct());
if (CEF_MEMBER_MISSING(_struct, set_value))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
_struct->set_value(_struct,
value);
}
// CONSTRUCTOR - Do not edit by hand.
CefTranslatorTestObjectChildChildCToCpp::CefTranslatorTestObjectChildChildCToCpp(
) {
}
template<> cef_translator_test_object_child_child_t* CefCToCpp<CefTranslatorTestObjectChildChildCToCpp,
CefTranslatorTestObjectChildChild,
cef_translator_test_object_child_child_t>::UnwrapDerived(
CefWrapperType type, CefTranslatorTestObjectChildChild* c) {
NOTREACHED() << "Unexpected class type: " << type;
return NULL;
}
#if DCHECK_IS_ON()
template<> base::AtomicRefCount CefCToCpp<CefTranslatorTestObjectChildChildCToCpp,
CefTranslatorTestObjectChildChild,
cef_translator_test_object_child_child_t>::DebugObjCt = 0;
#endif
template<> CefWrapperType CefCToCpp<CefTranslatorTestObjectChildChildCToCpp,
CefTranslatorTestObjectChildChild,
cef_translator_test_object_child_child_t>::kWrapperType =
WT_TRANSLATOR_TEST_OBJECT_CHILD_CHILD;

View File

@ -1,118 +0,0 @@
// Copyright (c) 2017 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool. If making changes by
// hand only do so within the body of existing method and function
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
#include "libcef_dll/ctocpp/test/translator_test_object_child_ctocpp.h"
#include "libcef_dll/ctocpp/test/translator_test_object_child_child_ctocpp.h"
// STATIC METHODS - Body may be edited by hand.
CefRefPtr<CefTranslatorTestObjectChild> CefTranslatorTestObjectChild::Create(
int value, int other_value) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_translator_test_object_child_t* _retval =
cef_translator_test_object_child_create(
value,
other_value);
// Return type: refptr_same
return CefTranslatorTestObjectChildCToCpp::Wrap(_retval);
}
// VIRTUAL METHODS - Body may be edited by hand.
int CefTranslatorTestObjectChildCToCpp::GetOtherValue() {
cef_translator_test_object_child_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_other_value))
return 0;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
int _retval = _struct->get_other_value(_struct);
// Return type: simple
return _retval;
}
void CefTranslatorTestObjectChildCToCpp::SetOtherValue(int value) {
cef_translator_test_object_child_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, set_other_value))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
_struct->set_other_value(_struct,
value);
}
int CefTranslatorTestObjectChildCToCpp::GetValue() {
cef_translator_test_object_t* _struct =
reinterpret_cast<cef_translator_test_object_t*>(GetStruct());
if (CEF_MEMBER_MISSING(_struct, get_value))
return 0;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
int _retval = _struct->get_value(_struct);
// Return type: simple
return _retval;
}
void CefTranslatorTestObjectChildCToCpp::SetValue(int value) {
cef_translator_test_object_t* _struct =
reinterpret_cast<cef_translator_test_object_t*>(GetStruct());
if (CEF_MEMBER_MISSING(_struct, set_value))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
_struct->set_value(_struct,
value);
}
// CONSTRUCTOR - Do not edit by hand.
CefTranslatorTestObjectChildCToCpp::CefTranslatorTestObjectChildCToCpp() {
}
template<> cef_translator_test_object_child_t* CefCToCpp<CefTranslatorTestObjectChildCToCpp,
CefTranslatorTestObjectChild,
cef_translator_test_object_child_t>::UnwrapDerived(CefWrapperType type,
CefTranslatorTestObjectChild* c) {
if (type == WT_TRANSLATOR_TEST_OBJECT_CHILD_CHILD) {
return reinterpret_cast<cef_translator_test_object_child_t*>(
CefTranslatorTestObjectChildChildCToCpp::Unwrap(
reinterpret_cast<CefTranslatorTestObjectChildChild*>(c)));
}
NOTREACHED() << "Unexpected class type: " << type;
return NULL;
}
#if DCHECK_IS_ON()
template<> base::AtomicRefCount CefCToCpp<CefTranslatorTestObjectChildCToCpp,
CefTranslatorTestObjectChild,
cef_translator_test_object_child_t>::DebugObjCt = 0;
#endif
template<> CefWrapperType CefCToCpp<CefTranslatorTestObjectChildCToCpp,
CefTranslatorTestObjectChild,
cef_translator_test_object_child_t>::kWrapperType =
WT_TRANSLATOR_TEST_OBJECT_CHILD;

View File

@ -1,90 +0,0 @@
// Copyright (c) 2017 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool. If making changes by
// hand only do so within the body of existing method and function
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
#include "libcef_dll/ctocpp/test/translator_test_object_ctocpp.h"
#include "libcef_dll/ctocpp/test/translator_test_object_child_ctocpp.h"
#include "libcef_dll/ctocpp/test/translator_test_object_child_child_ctocpp.h"
// STATIC METHODS - Body may be edited by hand.
CefRefPtr<CefTranslatorTestObject> CefTranslatorTestObject::Create(int value) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_translator_test_object_t* _retval = cef_translator_test_object_create(
value);
// Return type: refptr_same
return CefTranslatorTestObjectCToCpp::Wrap(_retval);
}
// VIRTUAL METHODS - Body may be edited by hand.
int CefTranslatorTestObjectCToCpp::GetValue() {
cef_translator_test_object_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_value))
return 0;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
int _retval = _struct->get_value(_struct);
// Return type: simple
return _retval;
}
void CefTranslatorTestObjectCToCpp::SetValue(int value) {
cef_translator_test_object_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, set_value))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
_struct->set_value(_struct,
value);
}
// CONSTRUCTOR - Do not edit by hand.
CefTranslatorTestObjectCToCpp::CefTranslatorTestObjectCToCpp() {
}
template<> cef_translator_test_object_t* CefCToCpp<CefTranslatorTestObjectCToCpp,
CefTranslatorTestObject, cef_translator_test_object_t>::UnwrapDerived(
CefWrapperType type, CefTranslatorTestObject* c) {
if (type == WT_TRANSLATOR_TEST_OBJECT_CHILD) {
return reinterpret_cast<cef_translator_test_object_t*>(
CefTranslatorTestObjectChildCToCpp::Unwrap(
reinterpret_cast<CefTranslatorTestObjectChild*>(c)));
}
if (type == WT_TRANSLATOR_TEST_OBJECT_CHILD_CHILD) {
return reinterpret_cast<cef_translator_test_object_t*>(
CefTranslatorTestObjectChildChildCToCpp::Unwrap(
reinterpret_cast<CefTranslatorTestObjectChildChild*>(c)));
}
NOTREACHED() << "Unexpected class type: " << type;
return NULL;
}
#if DCHECK_IS_ON()
template<> base::AtomicRefCount CefCToCpp<CefTranslatorTestObjectCToCpp,
CefTranslatorTestObject, cef_translator_test_object_t>::DebugObjCt = 0;
#endif
template<> CefWrapperType CefCToCpp<CefTranslatorTestObjectCToCpp,
CefTranslatorTestObject, cef_translator_test_object_t>::kWrapperType =
WT_TRANSLATOR_TEST_OBJECT;

View File

@ -10,13 +10,13 @@
// for more information.
//
#include "libcef_dll/ctocpp/test/translator_test_handler_child_ctocpp.h"
#include "libcef_dll/ctocpp/test/translator_test_ref_ptr_client_child_ctocpp.h"
// VIRTUAL METHODS - Body may be edited by hand.
int CefTranslatorTestHandlerChildCToCpp::GetOtherValue() {
cef_translator_test_handler_child_t* _struct = GetStruct();
int CefTranslatorTestRefPtrClientChildCToCpp::GetOtherValue() {
cef_translator_test_ref_ptr_client_child_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_other_value))
return 0;
@ -29,9 +29,9 @@ int CefTranslatorTestHandlerChildCToCpp::GetOtherValue() {
return _retval;
}
int CefTranslatorTestHandlerChildCToCpp::GetValue() {
cef_translator_test_handler_t* _struct =
reinterpret_cast<cef_translator_test_handler_t*>(GetStruct());
int CefTranslatorTestRefPtrClientChildCToCpp::GetValue() {
cef_translator_test_ref_ptr_client_t* _struct =
reinterpret_cast<cef_translator_test_ref_ptr_client_t*>(GetStruct());
if (CEF_MEMBER_MISSING(_struct, get_value))
return 0;
@ -47,24 +47,25 @@ int CefTranslatorTestHandlerChildCToCpp::GetValue() {
// CONSTRUCTOR - Do not edit by hand.
CefTranslatorTestHandlerChildCToCpp::CefTranslatorTestHandlerChildCToCpp() {
CefTranslatorTestRefPtrClientChildCToCpp::CefTranslatorTestRefPtrClientChildCToCpp(
) {
}
template<> cef_translator_test_handler_child_t* CefCToCpp<CefTranslatorTestHandlerChildCToCpp,
CefTranslatorTestHandlerChild,
cef_translator_test_handler_child_t>::UnwrapDerived(CefWrapperType type,
CefTranslatorTestHandlerChild* c) {
template<> cef_translator_test_ref_ptr_client_child_t* CefCToCpp<CefTranslatorTestRefPtrClientChildCToCpp,
CefTranslatorTestRefPtrClientChild,
cef_translator_test_ref_ptr_client_child_t>::UnwrapDerived(
CefWrapperType type, CefTranslatorTestRefPtrClientChild* c) {
NOTREACHED() << "Unexpected class type: " << type;
return NULL;
}
#if DCHECK_IS_ON()
template<> base::AtomicRefCount CefCToCpp<CefTranslatorTestHandlerChildCToCpp,
CefTranslatorTestHandlerChild,
cef_translator_test_handler_child_t>::DebugObjCt = 0;
template<> base::AtomicRefCount CefCToCpp<CefTranslatorTestRefPtrClientChildCToCpp,
CefTranslatorTestRefPtrClientChild,
cef_translator_test_ref_ptr_client_child_t>::DebugObjCt = 0;
#endif
template<> CefWrapperType CefCToCpp<CefTranslatorTestHandlerChildCToCpp,
CefTranslatorTestHandlerChild,
cef_translator_test_handler_child_t>::kWrapperType =
WT_TRANSLATOR_TEST_HANDLER_CHILD;
template<> CefWrapperType CefCToCpp<CefTranslatorTestRefPtrClientChildCToCpp,
CefTranslatorTestRefPtrClientChild,
cef_translator_test_ref_ptr_client_child_t>::kWrapperType =
WT_TRANSLATOR_TEST_REF_PTR_CLIENT_CHILD;

View File

@ -10,8 +10,8 @@
// for more information.
//
#ifndef CEF_LIBCEF_DLL_CTOCPP_TEST_TRANSLATOR_TEST_HANDLER_CHILD_CTOCPP_H_
#define CEF_LIBCEF_DLL_CTOCPP_TEST_TRANSLATOR_TEST_HANDLER_CHILD_CTOCPP_H_
#ifndef CEF_LIBCEF_DLL_CTOCPP_TEST_TRANSLATOR_TEST_REF_PTR_CLIENT_CHILD_CTOCPP_H_
#define CEF_LIBCEF_DLL_CTOCPP_TEST_TRANSLATOR_TEST_REF_PTR_CLIENT_CHILD_CTOCPP_H_
#pragma once
#if !defined(BUILDING_CEF_SHARED)
@ -24,17 +24,18 @@
// Wrap a C structure with a C++ class.
// This class may be instantiated and accessed DLL-side only.
class CefTranslatorTestHandlerChildCToCpp
: public CefCToCpp<CefTranslatorTestHandlerChildCToCpp,
CefTranslatorTestHandlerChild, cef_translator_test_handler_child_t> {
class CefTranslatorTestRefPtrClientChildCToCpp
: public CefCToCpp<CefTranslatorTestRefPtrClientChildCToCpp,
CefTranslatorTestRefPtrClientChild,
cef_translator_test_ref_ptr_client_child_t> {
public:
CefTranslatorTestHandlerChildCToCpp();
CefTranslatorTestRefPtrClientChildCToCpp();
// CefTranslatorTestHandlerChild methods.
// CefTranslatorTestRefPtrClientChild methods.
int GetOtherValue() override;
// CefTranslatorTestHandler methods.
// CefTranslatorTestRefPtrClient methods.
int GetValue() override;
};
#endif // CEF_LIBCEF_DLL_CTOCPP_TEST_TRANSLATOR_TEST_HANDLER_CHILD_CTOCPP_H_
#endif // CEF_LIBCEF_DLL_CTOCPP_TEST_TRANSLATOR_TEST_REF_PTR_CLIENT_CHILD_CTOCPP_H_

View File

@ -0,0 +1,61 @@
// Copyright (c) 2017 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool. If making changes by
// hand only do so within the body of existing method and function
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
#include "libcef_dll/ctocpp/test/translator_test_ref_ptr_client_ctocpp.h"
#include "libcef_dll/ctocpp/test/translator_test_ref_ptr_client_child_ctocpp.h"
// VIRTUAL METHODS - Body may be edited by hand.
int CefTranslatorTestRefPtrClientCToCpp::GetValue() {
cef_translator_test_ref_ptr_client_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_value))
return 0;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
int _retval = _struct->get_value(_struct);
// Return type: simple
return _retval;
}
// CONSTRUCTOR - Do not edit by hand.
CefTranslatorTestRefPtrClientCToCpp::CefTranslatorTestRefPtrClientCToCpp() {
}
template<> cef_translator_test_ref_ptr_client_t* CefCToCpp<CefTranslatorTestRefPtrClientCToCpp,
CefTranslatorTestRefPtrClient,
cef_translator_test_ref_ptr_client_t>::UnwrapDerived(CefWrapperType type,
CefTranslatorTestRefPtrClient* c) {
if (type == WT_TRANSLATOR_TEST_REF_PTR_CLIENT_CHILD) {
return reinterpret_cast<cef_translator_test_ref_ptr_client_t*>(
CefTranslatorTestRefPtrClientChildCToCpp::Unwrap(
reinterpret_cast<CefTranslatorTestRefPtrClientChild*>(c)));
}
NOTREACHED() << "Unexpected class type: " << type;
return NULL;
}
#if DCHECK_IS_ON()
template<> base::AtomicRefCount CefCToCpp<CefTranslatorTestRefPtrClientCToCpp,
CefTranslatorTestRefPtrClient,
cef_translator_test_ref_ptr_client_t>::DebugObjCt = 0;
#endif
template<> CefWrapperType CefCToCpp<CefTranslatorTestRefPtrClientCToCpp,
CefTranslatorTestRefPtrClient,
cef_translator_test_ref_ptr_client_t>::kWrapperType =
WT_TRANSLATOR_TEST_REF_PTR_CLIENT;

View File

@ -10,8 +10,8 @@
// for more information.
//
#ifndef CEF_LIBCEF_DLL_CTOCPP_TEST_TRANSLATOR_TEST_HANDLER_CTOCPP_H_
#define CEF_LIBCEF_DLL_CTOCPP_TEST_TRANSLATOR_TEST_HANDLER_CTOCPP_H_
#ifndef CEF_LIBCEF_DLL_CTOCPP_TEST_TRANSLATOR_TEST_REF_PTR_CLIENT_CTOCPP_H_
#define CEF_LIBCEF_DLL_CTOCPP_TEST_TRANSLATOR_TEST_REF_PTR_CLIENT_CTOCPP_H_
#pragma once
#if !defined(BUILDING_CEF_SHARED)
@ -24,14 +24,14 @@
// Wrap a C structure with a C++ class.
// This class may be instantiated and accessed DLL-side only.
class CefTranslatorTestHandlerCToCpp
: public CefCToCpp<CefTranslatorTestHandlerCToCpp, CefTranslatorTestHandler,
cef_translator_test_handler_t> {
class CefTranslatorTestRefPtrClientCToCpp
: public CefCToCpp<CefTranslatorTestRefPtrClientCToCpp,
CefTranslatorTestRefPtrClient, cef_translator_test_ref_ptr_client_t> {
public:
CefTranslatorTestHandlerCToCpp();
CefTranslatorTestRefPtrClientCToCpp();
// CefTranslatorTestHandler methods.
// CefTranslatorTestRefPtrClient methods.
int GetValue() override;
};
#endif // CEF_LIBCEF_DLL_CTOCPP_TEST_TRANSLATOR_TEST_HANDLER_CTOCPP_H_
#endif // CEF_LIBCEF_DLL_CTOCPP_TEST_TRANSLATOR_TEST_REF_PTR_CLIENT_CTOCPP_H_

View File

@ -0,0 +1,145 @@
// Copyright (c) 2017 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool. If making changes by
// hand only do so within the body of existing method and function
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
#include "libcef_dll/ctocpp/test/translator_test_ref_ptr_library_child_child_ctocpp.h"
// STATIC METHODS - Body may be edited by hand.
CefRefPtr<CefTranslatorTestRefPtrLibraryChildChild> CefTranslatorTestRefPtrLibraryChildChild::Create(
int value, int other_value, int other_other_value) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_translator_test_ref_ptr_library_child_child_t* _retval =
cef_translator_test_ref_ptr_library_child_child_create(
value,
other_value,
other_other_value);
// Return type: refptr_same
return CefTranslatorTestRefPtrLibraryChildChildCToCpp::Wrap(_retval);
}
// VIRTUAL METHODS - Body may be edited by hand.
int CefTranslatorTestRefPtrLibraryChildChildCToCpp::GetOtherOtherValue() {
cef_translator_test_ref_ptr_library_child_child_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_other_other_value))
return 0;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
int _retval = _struct->get_other_other_value(_struct);
// Return type: simple
return _retval;
}
void CefTranslatorTestRefPtrLibraryChildChildCToCpp::SetOtherOtherValue(
int value) {
cef_translator_test_ref_ptr_library_child_child_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, set_other_other_value))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
_struct->set_other_other_value(_struct,
value);
}
int CefTranslatorTestRefPtrLibraryChildChildCToCpp::GetOtherValue() {
cef_translator_test_ref_ptr_library_child_t* _struct =
reinterpret_cast<cef_translator_test_ref_ptr_library_child_t*>(GetStruct(
));
if (CEF_MEMBER_MISSING(_struct, get_other_value))
return 0;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
int _retval = _struct->get_other_value(_struct);
// Return type: simple
return _retval;
}
void CefTranslatorTestRefPtrLibraryChildChildCToCpp::SetOtherValue(int value) {
cef_translator_test_ref_ptr_library_child_t* _struct =
reinterpret_cast<cef_translator_test_ref_ptr_library_child_t*>(GetStruct(
));
if (CEF_MEMBER_MISSING(_struct, set_other_value))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
_struct->set_other_value(_struct,
value);
}
int CefTranslatorTestRefPtrLibraryChildChildCToCpp::GetValue() {
cef_translator_test_ref_ptr_library_t* _struct =
reinterpret_cast<cef_translator_test_ref_ptr_library_t*>(GetStruct());
if (CEF_MEMBER_MISSING(_struct, get_value))
return 0;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
int _retval = _struct->get_value(_struct);
// Return type: simple
return _retval;
}
void CefTranslatorTestRefPtrLibraryChildChildCToCpp::SetValue(int value) {
cef_translator_test_ref_ptr_library_t* _struct =
reinterpret_cast<cef_translator_test_ref_ptr_library_t*>(GetStruct());
if (CEF_MEMBER_MISSING(_struct, set_value))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
_struct->set_value(_struct,
value);
}
// CONSTRUCTOR - Do not edit by hand.
CefTranslatorTestRefPtrLibraryChildChildCToCpp::CefTranslatorTestRefPtrLibraryChildChildCToCpp(
) {
}
template<> cef_translator_test_ref_ptr_library_child_child_t* CefCToCpp<CefTranslatorTestRefPtrLibraryChildChildCToCpp,
CefTranslatorTestRefPtrLibraryChildChild,
cef_translator_test_ref_ptr_library_child_child_t>::UnwrapDerived(
CefWrapperType type, CefTranslatorTestRefPtrLibraryChildChild* c) {
NOTREACHED() << "Unexpected class type: " << type;
return NULL;
}
#if DCHECK_IS_ON()
template<> base::AtomicRefCount CefCToCpp<CefTranslatorTestRefPtrLibraryChildChildCToCpp,
CefTranslatorTestRefPtrLibraryChildChild,
cef_translator_test_ref_ptr_library_child_child_t>::DebugObjCt = 0;
#endif
template<> CefWrapperType CefCToCpp<CefTranslatorTestRefPtrLibraryChildChildCToCpp,
CefTranslatorTestRefPtrLibraryChildChild,
cef_translator_test_ref_ptr_library_child_child_t>::kWrapperType =
WT_TRANSLATOR_TEST_REF_PTR_LIBRARY_CHILD_CHILD;

View File

@ -10,8 +10,8 @@
// for more information.
//
#ifndef CEF_LIBCEF_DLL_CTOCPP_TEST_TRANSLATOR_TEST_OBJECT_CHILD_CHILD_CTOCPP_H_
#define CEF_LIBCEF_DLL_CTOCPP_TEST_TRANSLATOR_TEST_OBJECT_CHILD_CHILD_CTOCPP_H_
#ifndef CEF_LIBCEF_DLL_CTOCPP_TEST_TRANSLATOR_TEST_REF_PTR_LIBRARY_CHILD_CHILD_CTOCPP_H_
#define CEF_LIBCEF_DLL_CTOCPP_TEST_TRANSLATOR_TEST_REF_PTR_LIBRARY_CHILD_CHILD_CTOCPP_H_
#pragma once
#if !defined(WRAPPING_CEF_SHARED)
@ -24,24 +24,24 @@
// Wrap a C structure with a C++ class.
// This class may be instantiated and accessed wrapper-side only.
class CefTranslatorTestObjectChildChildCToCpp
: public CefCToCpp<CefTranslatorTestObjectChildChildCToCpp,
CefTranslatorTestObjectChildChild,
cef_translator_test_object_child_child_t> {
class CefTranslatorTestRefPtrLibraryChildChildCToCpp
: public CefCToCpp<CefTranslatorTestRefPtrLibraryChildChildCToCpp,
CefTranslatorTestRefPtrLibraryChildChild,
cef_translator_test_ref_ptr_library_child_child_t> {
public:
CefTranslatorTestObjectChildChildCToCpp();
CefTranslatorTestRefPtrLibraryChildChildCToCpp();
// CefTranslatorTestObjectChildChild methods.
// CefTranslatorTestRefPtrLibraryChildChild methods.
int GetOtherOtherValue() OVERRIDE;
void SetOtherOtherValue(int value) OVERRIDE;
// CefTranslatorTestObjectChild methods.
// CefTranslatorTestRefPtrLibraryChild methods.
int GetOtherValue() OVERRIDE;
void SetOtherValue(int value) OVERRIDE;
// CefTranslatorTestObject methods.
// CefTranslatorTestRefPtrLibrary methods.
int GetValue() OVERRIDE;
void SetValue(int value) OVERRIDE;
};
#endif // CEF_LIBCEF_DLL_CTOCPP_TEST_TRANSLATOR_TEST_OBJECT_CHILD_CHILD_CTOCPP_H_
#endif // CEF_LIBCEF_DLL_CTOCPP_TEST_TRANSLATOR_TEST_REF_PTR_LIBRARY_CHILD_CHILD_CTOCPP_H_

View File

@ -0,0 +1,119 @@
// Copyright (c) 2017 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool. If making changes by
// hand only do so within the body of existing method and function
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
#include "libcef_dll/ctocpp/test/translator_test_ref_ptr_library_child_ctocpp.h"
#include "libcef_dll/ctocpp/test/translator_test_ref_ptr_library_child_child_ctocpp.h"
// STATIC METHODS - Body may be edited by hand.
CefRefPtr<CefTranslatorTestRefPtrLibraryChild> CefTranslatorTestRefPtrLibraryChild::Create(
int value, int other_value) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_translator_test_ref_ptr_library_child_t* _retval =
cef_translator_test_ref_ptr_library_child_create(
value,
other_value);
// Return type: refptr_same
return CefTranslatorTestRefPtrLibraryChildCToCpp::Wrap(_retval);
}
// VIRTUAL METHODS - Body may be edited by hand.
int CefTranslatorTestRefPtrLibraryChildCToCpp::GetOtherValue() {
cef_translator_test_ref_ptr_library_child_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_other_value))
return 0;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
int _retval = _struct->get_other_value(_struct);
// Return type: simple
return _retval;
}
void CefTranslatorTestRefPtrLibraryChildCToCpp::SetOtherValue(int value) {
cef_translator_test_ref_ptr_library_child_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, set_other_value))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
_struct->set_other_value(_struct,
value);
}
int CefTranslatorTestRefPtrLibraryChildCToCpp::GetValue() {
cef_translator_test_ref_ptr_library_t* _struct =
reinterpret_cast<cef_translator_test_ref_ptr_library_t*>(GetStruct());
if (CEF_MEMBER_MISSING(_struct, get_value))
return 0;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
int _retval = _struct->get_value(_struct);
// Return type: simple
return _retval;
}
void CefTranslatorTestRefPtrLibraryChildCToCpp::SetValue(int value) {
cef_translator_test_ref_ptr_library_t* _struct =
reinterpret_cast<cef_translator_test_ref_ptr_library_t*>(GetStruct());
if (CEF_MEMBER_MISSING(_struct, set_value))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
_struct->set_value(_struct,
value);
}
// CONSTRUCTOR - Do not edit by hand.
CefTranslatorTestRefPtrLibraryChildCToCpp::CefTranslatorTestRefPtrLibraryChildCToCpp(
) {
}
template<> cef_translator_test_ref_ptr_library_child_t* CefCToCpp<CefTranslatorTestRefPtrLibraryChildCToCpp,
CefTranslatorTestRefPtrLibraryChild,
cef_translator_test_ref_ptr_library_child_t>::UnwrapDerived(
CefWrapperType type, CefTranslatorTestRefPtrLibraryChild* c) {
if (type == WT_TRANSLATOR_TEST_REF_PTR_LIBRARY_CHILD_CHILD) {
return reinterpret_cast<cef_translator_test_ref_ptr_library_child_t*>(
CefTranslatorTestRefPtrLibraryChildChildCToCpp::Unwrap(
reinterpret_cast<CefTranslatorTestRefPtrLibraryChildChild*>(c)));
}
NOTREACHED() << "Unexpected class type: " << type;
return NULL;
}
#if DCHECK_IS_ON()
template<> base::AtomicRefCount CefCToCpp<CefTranslatorTestRefPtrLibraryChildCToCpp,
CefTranslatorTestRefPtrLibraryChild,
cef_translator_test_ref_ptr_library_child_t>::DebugObjCt = 0;
#endif
template<> CefWrapperType CefCToCpp<CefTranslatorTestRefPtrLibraryChildCToCpp,
CefTranslatorTestRefPtrLibraryChild,
cef_translator_test_ref_ptr_library_child_t>::kWrapperType =
WT_TRANSLATOR_TEST_REF_PTR_LIBRARY_CHILD;

View File

@ -10,8 +10,8 @@
// for more information.
//
#ifndef CEF_LIBCEF_DLL_CTOCPP_TEST_TRANSLATOR_TEST_OBJECT_CHILD_CTOCPP_H_
#define CEF_LIBCEF_DLL_CTOCPP_TEST_TRANSLATOR_TEST_OBJECT_CHILD_CTOCPP_H_
#ifndef CEF_LIBCEF_DLL_CTOCPP_TEST_TRANSLATOR_TEST_REF_PTR_LIBRARY_CHILD_CTOCPP_H_
#define CEF_LIBCEF_DLL_CTOCPP_TEST_TRANSLATOR_TEST_REF_PTR_LIBRARY_CHILD_CTOCPP_H_
#pragma once
#if !defined(WRAPPING_CEF_SHARED)
@ -24,19 +24,20 @@
// Wrap a C structure with a C++ class.
// This class may be instantiated and accessed wrapper-side only.
class CefTranslatorTestObjectChildCToCpp
: public CefCToCpp<CefTranslatorTestObjectChildCToCpp,
CefTranslatorTestObjectChild, cef_translator_test_object_child_t> {
class CefTranslatorTestRefPtrLibraryChildCToCpp
: public CefCToCpp<CefTranslatorTestRefPtrLibraryChildCToCpp,
CefTranslatorTestRefPtrLibraryChild,
cef_translator_test_ref_ptr_library_child_t> {
public:
CefTranslatorTestObjectChildCToCpp();
CefTranslatorTestRefPtrLibraryChildCToCpp();
// CefTranslatorTestObjectChild methods.
// CefTranslatorTestRefPtrLibraryChild methods.
int GetOtherValue() OVERRIDE;
void SetOtherValue(int value) OVERRIDE;
// CefTranslatorTestObject methods.
// CefTranslatorTestRefPtrLibrary methods.
int GetValue() OVERRIDE;
void SetValue(int value) OVERRIDE;
};
#endif // CEF_LIBCEF_DLL_CTOCPP_TEST_TRANSLATOR_TEST_OBJECT_CHILD_CTOCPP_H_
#endif // CEF_LIBCEF_DLL_CTOCPP_TEST_TRANSLATOR_TEST_REF_PTR_LIBRARY_CHILD_CTOCPP_H_

View File

@ -0,0 +1,95 @@
// Copyright (c) 2017 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool. If making changes by
// hand only do so within the body of existing method and function
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
#include "libcef_dll/ctocpp/test/translator_test_ref_ptr_library_ctocpp.h"
#include "libcef_dll/ctocpp/test/translator_test_ref_ptr_library_child_ctocpp.h"
#include "libcef_dll/ctocpp/test/translator_test_ref_ptr_library_child_child_ctocpp.h"
// STATIC METHODS - Body may be edited by hand.
CefRefPtr<CefTranslatorTestRefPtrLibrary> CefTranslatorTestRefPtrLibrary::Create(
int value) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_translator_test_ref_ptr_library_t* _retval =
cef_translator_test_ref_ptr_library_create(
value);
// Return type: refptr_same
return CefTranslatorTestRefPtrLibraryCToCpp::Wrap(_retval);
}
// VIRTUAL METHODS - Body may be edited by hand.
int CefTranslatorTestRefPtrLibraryCToCpp::GetValue() {
cef_translator_test_ref_ptr_library_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_value))
return 0;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
int _retval = _struct->get_value(_struct);
// Return type: simple
return _retval;
}
void CefTranslatorTestRefPtrLibraryCToCpp::SetValue(int value) {
cef_translator_test_ref_ptr_library_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, set_value))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
_struct->set_value(_struct,
value);
}
// CONSTRUCTOR - Do not edit by hand.
CefTranslatorTestRefPtrLibraryCToCpp::CefTranslatorTestRefPtrLibraryCToCpp() {
}
template<> cef_translator_test_ref_ptr_library_t* CefCToCpp<CefTranslatorTestRefPtrLibraryCToCpp,
CefTranslatorTestRefPtrLibrary,
cef_translator_test_ref_ptr_library_t>::UnwrapDerived(CefWrapperType type,
CefTranslatorTestRefPtrLibrary* c) {
if (type == WT_TRANSLATOR_TEST_REF_PTR_LIBRARY_CHILD) {
return reinterpret_cast<cef_translator_test_ref_ptr_library_t*>(
CefTranslatorTestRefPtrLibraryChildCToCpp::Unwrap(
reinterpret_cast<CefTranslatorTestRefPtrLibraryChild*>(c)));
}
if (type == WT_TRANSLATOR_TEST_REF_PTR_LIBRARY_CHILD_CHILD) {
return reinterpret_cast<cef_translator_test_ref_ptr_library_t*>(
CefTranslatorTestRefPtrLibraryChildChildCToCpp::Unwrap(
reinterpret_cast<CefTranslatorTestRefPtrLibraryChildChild*>(c)));
}
NOTREACHED() << "Unexpected class type: " << type;
return NULL;
}
#if DCHECK_IS_ON()
template<> base::AtomicRefCount CefCToCpp<CefTranslatorTestRefPtrLibraryCToCpp,
CefTranslatorTestRefPtrLibrary,
cef_translator_test_ref_ptr_library_t>::DebugObjCt = 0;
#endif
template<> CefWrapperType CefCToCpp<CefTranslatorTestRefPtrLibraryCToCpp,
CefTranslatorTestRefPtrLibrary,
cef_translator_test_ref_ptr_library_t>::kWrapperType =
WT_TRANSLATOR_TEST_REF_PTR_LIBRARY;

View File

@ -10,8 +10,8 @@
// for more information.
//
#ifndef CEF_LIBCEF_DLL_CTOCPP_TEST_TRANSLATOR_TEST_OBJECT_CTOCPP_H_
#define CEF_LIBCEF_DLL_CTOCPP_TEST_TRANSLATOR_TEST_OBJECT_CTOCPP_H_
#ifndef CEF_LIBCEF_DLL_CTOCPP_TEST_TRANSLATOR_TEST_REF_PTR_LIBRARY_CTOCPP_H_
#define CEF_LIBCEF_DLL_CTOCPP_TEST_TRANSLATOR_TEST_REF_PTR_LIBRARY_CTOCPP_H_
#pragma once
#if !defined(WRAPPING_CEF_SHARED)
@ -24,15 +24,16 @@
// Wrap a C structure with a C++ class.
// This class may be instantiated and accessed wrapper-side only.
class CefTranslatorTestObjectCToCpp
: public CefCToCpp<CefTranslatorTestObjectCToCpp, CefTranslatorTestObject,
cef_translator_test_object_t> {
class CefTranslatorTestRefPtrLibraryCToCpp
: public CefCToCpp<CefTranslatorTestRefPtrLibraryCToCpp,
CefTranslatorTestRefPtrLibrary,
cef_translator_test_ref_ptr_library_t> {
public:
CefTranslatorTestObjectCToCpp();
CefTranslatorTestRefPtrLibraryCToCpp();
// CefTranslatorTestObject methods.
// CefTranslatorTestRefPtrLibrary methods.
int GetValue() OVERRIDE;
void SetValue(int value) OVERRIDE;
};
#endif // CEF_LIBCEF_DLL_CTOCPP_TEST_TRANSLATOR_TEST_OBJECT_CTOCPP_H_
#endif // CEF_LIBCEF_DLL_CTOCPP_TEST_TRANSLATOR_TEST_REF_PTR_LIBRARY_CTOCPP_H_

View File

@ -0,0 +1,79 @@
// Copyright (c) 2017 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool. If making changes by
// hand only do so within the body of existing method and function
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
#include "libcef_dll/ctocpp/test/translator_test_scoped_client_child_ctocpp.h"
// VIRTUAL METHODS - Body may be edited by hand.
int CefTranslatorTestScopedClientChildCToCpp::GetOtherValue() {
cef_translator_test_scoped_client_child_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_other_value))
return 0;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
int _retval = _struct->get_other_value(_struct);
// Return type: simple
return _retval;
}
int CefTranslatorTestScopedClientChildCToCpp::GetValue() {
cef_translator_test_scoped_client_t* _struct =
reinterpret_cast<cef_translator_test_scoped_client_t*>(GetStruct());
if (CEF_MEMBER_MISSING(_struct, get_value))
return 0;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
int _retval = _struct->get_value(_struct);
// Return type: simple
return _retval;
}
// CONSTRUCTOR - Do not edit by hand.
CefTranslatorTestScopedClientChildCToCpp::CefTranslatorTestScopedClientChildCToCpp(
) {
}
template<> cef_translator_test_scoped_client_child_t* CefCToCppScoped<CefTranslatorTestScopedClientChildCToCpp,
CefTranslatorTestScopedClientChild,
cef_translator_test_scoped_client_child_t>::UnwrapDerivedOwn(
CefWrapperType type, CefOwnPtr<CefTranslatorTestScopedClientChild> c) {
NOTREACHED() << "Unexpected class type: " << type;
return NULL;
}
template<> cef_translator_test_scoped_client_child_t* CefCToCppScoped<CefTranslatorTestScopedClientChildCToCpp,
CefTranslatorTestScopedClientChild,
cef_translator_test_scoped_client_child_t>::UnwrapDerivedRaw(
CefWrapperType type, CefRawPtr<CefTranslatorTestScopedClientChild> c) {
NOTREACHED() << "Unexpected class type: " << type;
return NULL;
}
#if DCHECK_IS_ON()
template<> base::AtomicRefCount CefCToCppScoped<CefTranslatorTestScopedClientChildCToCpp,
CefTranslatorTestScopedClientChild,
cef_translator_test_scoped_client_child_t>::DebugObjCt = 0;
#endif
template<> CefWrapperType CefCToCppScoped<CefTranslatorTestScopedClientChildCToCpp,
CefTranslatorTestScopedClientChild,
cef_translator_test_scoped_client_child_t>::kWrapperType =
WT_TRANSLATOR_TEST_SCOPED_CLIENT_CHILD;

View File

@ -0,0 +1,41 @@
// Copyright (c) 2017 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool. If making changes by
// hand only do so within the body of existing method and function
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
#ifndef CEF_LIBCEF_DLL_CTOCPP_TEST_TRANSLATOR_TEST_SCOPED_CLIENT_CHILD_CTOCPP_H_
#define CEF_LIBCEF_DLL_CTOCPP_TEST_TRANSLATOR_TEST_SCOPED_CLIENT_CHILD_CTOCPP_H_
#pragma once
#if !defined(BUILDING_CEF_SHARED)
#error This file can be included DLL-side only
#endif
#include "include/test/cef_translator_test.h"
#include "include/capi/test/cef_translator_test_capi.h"
#include "libcef_dll/ctocpp/ctocpp_scoped.h"
// Wrap a C structure with a C++ class.
// This class may be instantiated and accessed DLL-side only.
class CefTranslatorTestScopedClientChildCToCpp
: public CefCToCppScoped<CefTranslatorTestScopedClientChildCToCpp,
CefTranslatorTestScopedClientChild,
cef_translator_test_scoped_client_child_t> {
public:
CefTranslatorTestScopedClientChildCToCpp();
// CefTranslatorTestScopedClientChild methods.
int GetOtherValue() override;
// CefTranslatorTestScopedClient methods.
int GetValue() override;
};
#endif // CEF_LIBCEF_DLL_CTOCPP_TEST_TRANSLATOR_TEST_SCOPED_CLIENT_CHILD_CTOCPP_H_

View File

@ -0,0 +1,76 @@
// Copyright (c) 2017 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool. If making changes by
// hand only do so within the body of existing method and function
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
#include "libcef_dll/ctocpp/test/translator_test_scoped_client_ctocpp.h"
#include "libcef_dll/ctocpp/test/translator_test_scoped_client_child_ctocpp.h"
// VIRTUAL METHODS - Body may be edited by hand.
int CefTranslatorTestScopedClientCToCpp::GetValue() {
cef_translator_test_scoped_client_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_value))
return 0;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
int _retval = _struct->get_value(_struct);
// Return type: simple
return _retval;
}
// CONSTRUCTOR - Do not edit by hand.
CefTranslatorTestScopedClientCToCpp::CefTranslatorTestScopedClientCToCpp() {
}
template<> cef_translator_test_scoped_client_t* CefCToCppScoped<CefTranslatorTestScopedClientCToCpp,
CefTranslatorTestScopedClient,
cef_translator_test_scoped_client_t>::UnwrapDerivedOwn(CefWrapperType type,
CefOwnPtr<CefTranslatorTestScopedClient> c) {
if (type == WT_TRANSLATOR_TEST_SCOPED_CLIENT_CHILD) {
return reinterpret_cast<cef_translator_test_scoped_client_t*>(
CefTranslatorTestScopedClientChildCToCpp::UnwrapOwn(
CefOwnPtr<CefTranslatorTestScopedClientChild>(
reinterpret_cast<CefTranslatorTestScopedClientChild*>(c.release()))));
}
NOTREACHED() << "Unexpected class type: " << type;
return NULL;
}
template<> cef_translator_test_scoped_client_t* CefCToCppScoped<CefTranslatorTestScopedClientCToCpp,
CefTranslatorTestScopedClient,
cef_translator_test_scoped_client_t>::UnwrapDerivedRaw(CefWrapperType type,
CefRawPtr<CefTranslatorTestScopedClient> c) {
if (type == WT_TRANSLATOR_TEST_SCOPED_CLIENT_CHILD) {
return reinterpret_cast<cef_translator_test_scoped_client_t*>(
CefTranslatorTestScopedClientChildCToCpp::UnwrapRaw(
CefRawPtr<CefTranslatorTestScopedClientChild>(
reinterpret_cast<CefTranslatorTestScopedClientChild*>(c))));
}
NOTREACHED() << "Unexpected class type: " << type;
return NULL;
}
#if DCHECK_IS_ON()
template<> base::AtomicRefCount CefCToCppScoped<CefTranslatorTestScopedClientCToCpp,
CefTranslatorTestScopedClient,
cef_translator_test_scoped_client_t>::DebugObjCt = 0;
#endif
template<> CefWrapperType CefCToCppScoped<CefTranslatorTestScopedClientCToCpp,
CefTranslatorTestScopedClient,
cef_translator_test_scoped_client_t>::kWrapperType =
WT_TRANSLATOR_TEST_SCOPED_CLIENT;

View File

@ -0,0 +1,37 @@
// Copyright (c) 2017 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool. If making changes by
// hand only do so within the body of existing method and function
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
#ifndef CEF_LIBCEF_DLL_CTOCPP_TEST_TRANSLATOR_TEST_SCOPED_CLIENT_CTOCPP_H_
#define CEF_LIBCEF_DLL_CTOCPP_TEST_TRANSLATOR_TEST_SCOPED_CLIENT_CTOCPP_H_
#pragma once
#if !defined(BUILDING_CEF_SHARED)
#error This file can be included DLL-side only
#endif
#include "include/test/cef_translator_test.h"
#include "include/capi/test/cef_translator_test_capi.h"
#include "libcef_dll/ctocpp/ctocpp_scoped.h"
// Wrap a C structure with a C++ class.
// This class may be instantiated and accessed DLL-side only.
class CefTranslatorTestScopedClientCToCpp
: public CefCToCppScoped<CefTranslatorTestScopedClientCToCpp,
CefTranslatorTestScopedClient, cef_translator_test_scoped_client_t> {
public:
CefTranslatorTestScopedClientCToCpp();
// CefTranslatorTestScopedClient methods.
int GetValue() override;
};
#endif // CEF_LIBCEF_DLL_CTOCPP_TEST_TRANSLATOR_TEST_SCOPED_CLIENT_CTOCPP_H_

View File

@ -0,0 +1,155 @@
// Copyright (c) 2017 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool. If making changes by
// hand only do so within the body of existing method and function
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
#include "libcef_dll/ctocpp/test/translator_test_scoped_library_child_child_ctocpp.h"
// STATIC METHODS - Body may be edited by hand.
CefOwnPtr<CefTranslatorTestScopedLibraryChildChild> CefTranslatorTestScopedLibraryChildChild::Create(
int value, int other_value, int other_other_value) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_translator_test_scoped_library_child_child_t* _retval =
cef_translator_test_scoped_library_child_child_create(
value,
other_value,
other_other_value);
// Return type: ownptr_same
return CefTranslatorTestScopedLibraryChildChildCToCpp::Wrap(_retval);
}
// VIRTUAL METHODS - Body may be edited by hand.
int CefTranslatorTestScopedLibraryChildChildCToCpp::GetOtherOtherValue() {
cef_translator_test_scoped_library_child_child_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_other_other_value))
return 0;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
int _retval = _struct->get_other_other_value(_struct);
// Return type: simple
return _retval;
}
void CefTranslatorTestScopedLibraryChildChildCToCpp::SetOtherOtherValue(
int value) {
cef_translator_test_scoped_library_child_child_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, set_other_other_value))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
_struct->set_other_other_value(_struct,
value);
}
int CefTranslatorTestScopedLibraryChildChildCToCpp::GetOtherValue() {
cef_translator_test_scoped_library_child_t* _struct =
reinterpret_cast<cef_translator_test_scoped_library_child_t*>(GetStruct(
));
if (CEF_MEMBER_MISSING(_struct, get_other_value))
return 0;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
int _retval = _struct->get_other_value(_struct);
// Return type: simple
return _retval;
}
void CefTranslatorTestScopedLibraryChildChildCToCpp::SetOtherValue(int value) {
cef_translator_test_scoped_library_child_t* _struct =
reinterpret_cast<cef_translator_test_scoped_library_child_t*>(GetStruct(
));
if (CEF_MEMBER_MISSING(_struct, set_other_value))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
_struct->set_other_value(_struct,
value);
}
int CefTranslatorTestScopedLibraryChildChildCToCpp::GetValue() {
cef_translator_test_scoped_library_t* _struct =
reinterpret_cast<cef_translator_test_scoped_library_t*>(GetStruct());
if (CEF_MEMBER_MISSING(_struct, get_value))
return 0;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
int _retval = _struct->get_value(_struct);
// Return type: simple
return _retval;
}
void CefTranslatorTestScopedLibraryChildChildCToCpp::SetValue(int value) {
cef_translator_test_scoped_library_t* _struct =
reinterpret_cast<cef_translator_test_scoped_library_t*>(GetStruct());
if (CEF_MEMBER_MISSING(_struct, set_value))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
_struct->set_value(_struct,
value);
}
// CONSTRUCTOR - Do not edit by hand.
CefTranslatorTestScopedLibraryChildChildCToCpp::CefTranslatorTestScopedLibraryChildChildCToCpp(
) {
}
template<> cef_translator_test_scoped_library_child_child_t* CefCToCppScoped<CefTranslatorTestScopedLibraryChildChildCToCpp,
CefTranslatorTestScopedLibraryChildChild,
cef_translator_test_scoped_library_child_child_t>::UnwrapDerivedOwn(
CefWrapperType type,
CefOwnPtr<CefTranslatorTestScopedLibraryChildChild> c) {
NOTREACHED() << "Unexpected class type: " << type;
return NULL;
}
template<> cef_translator_test_scoped_library_child_child_t* CefCToCppScoped<CefTranslatorTestScopedLibraryChildChildCToCpp,
CefTranslatorTestScopedLibraryChildChild,
cef_translator_test_scoped_library_child_child_t>::UnwrapDerivedRaw(
CefWrapperType type,
CefRawPtr<CefTranslatorTestScopedLibraryChildChild> c) {
NOTREACHED() << "Unexpected class type: " << type;
return NULL;
}
#if DCHECK_IS_ON()
template<> base::AtomicRefCount CefCToCppScoped<CefTranslatorTestScopedLibraryChildChildCToCpp,
CefTranslatorTestScopedLibraryChildChild,
cef_translator_test_scoped_library_child_child_t>::DebugObjCt = 0;
#endif
template<> CefWrapperType CefCToCppScoped<CefTranslatorTestScopedLibraryChildChildCToCpp,
CefTranslatorTestScopedLibraryChildChild,
cef_translator_test_scoped_library_child_child_t>::kWrapperType =
WT_TRANSLATOR_TEST_SCOPED_LIBRARY_CHILD_CHILD;

View File

@ -0,0 +1,47 @@
// Copyright (c) 2017 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool. If making changes by
// hand only do so within the body of existing method and function
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
#ifndef CEF_LIBCEF_DLL_CTOCPP_TEST_TRANSLATOR_TEST_SCOPED_LIBRARY_CHILD_CHILD_CTOCPP_H_
#define CEF_LIBCEF_DLL_CTOCPP_TEST_TRANSLATOR_TEST_SCOPED_LIBRARY_CHILD_CHILD_CTOCPP_H_
#pragma once
#if !defined(WRAPPING_CEF_SHARED)
#error This file can be included wrapper-side only
#endif
#include "include/test/cef_translator_test.h"
#include "include/capi/test/cef_translator_test_capi.h"
#include "libcef_dll/ctocpp/ctocpp_scoped.h"
// Wrap a C structure with a C++ class.
// This class may be instantiated and accessed wrapper-side only.
class CefTranslatorTestScopedLibraryChildChildCToCpp
: public CefCToCppScoped<CefTranslatorTestScopedLibraryChildChildCToCpp,
CefTranslatorTestScopedLibraryChildChild,
cef_translator_test_scoped_library_child_child_t> {
public:
CefTranslatorTestScopedLibraryChildChildCToCpp();
// CefTranslatorTestScopedLibraryChildChild methods.
int GetOtherOtherValue() OVERRIDE;
void SetOtherOtherValue(int value) OVERRIDE;
// CefTranslatorTestScopedLibraryChild methods.
int GetOtherValue() OVERRIDE;
void SetOtherValue(int value) OVERRIDE;
// CefTranslatorTestScopedLibrary methods.
int GetValue() OVERRIDE;
void SetValue(int value) OVERRIDE;
};
#endif // CEF_LIBCEF_DLL_CTOCPP_TEST_TRANSLATOR_TEST_SCOPED_LIBRARY_CHILD_CHILD_CTOCPP_H_

View File

@ -0,0 +1,135 @@
// Copyright (c) 2017 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool. If making changes by
// hand only do so within the body of existing method and function
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
#include "libcef_dll/ctocpp/test/translator_test_scoped_library_child_ctocpp.h"
#include "libcef_dll/ctocpp/test/translator_test_scoped_library_child_child_ctocpp.h"
// STATIC METHODS - Body may be edited by hand.
CefOwnPtr<CefTranslatorTestScopedLibraryChild> CefTranslatorTestScopedLibraryChild::Create(
int value, int other_value) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_translator_test_scoped_library_child_t* _retval =
cef_translator_test_scoped_library_child_create(
value,
other_value);
// Return type: ownptr_same
return CefTranslatorTestScopedLibraryChildCToCpp::Wrap(_retval);
}
// VIRTUAL METHODS - Body may be edited by hand.
int CefTranslatorTestScopedLibraryChildCToCpp::GetOtherValue() {
cef_translator_test_scoped_library_child_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_other_value))
return 0;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
int _retval = _struct->get_other_value(_struct);
// Return type: simple
return _retval;
}
void CefTranslatorTestScopedLibraryChildCToCpp::SetOtherValue(int value) {
cef_translator_test_scoped_library_child_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, set_other_value))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
_struct->set_other_value(_struct,
value);
}
int CefTranslatorTestScopedLibraryChildCToCpp::GetValue() {
cef_translator_test_scoped_library_t* _struct =
reinterpret_cast<cef_translator_test_scoped_library_t*>(GetStruct());
if (CEF_MEMBER_MISSING(_struct, get_value))
return 0;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
int _retval = _struct->get_value(_struct);
// Return type: simple
return _retval;
}
void CefTranslatorTestScopedLibraryChildCToCpp::SetValue(int value) {
cef_translator_test_scoped_library_t* _struct =
reinterpret_cast<cef_translator_test_scoped_library_t*>(GetStruct());
if (CEF_MEMBER_MISSING(_struct, set_value))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
_struct->set_value(_struct,
value);
}
// CONSTRUCTOR - Do not edit by hand.
CefTranslatorTestScopedLibraryChildCToCpp::CefTranslatorTestScopedLibraryChildCToCpp(
) {
}
template<> cef_translator_test_scoped_library_child_t* CefCToCppScoped<CefTranslatorTestScopedLibraryChildCToCpp,
CefTranslatorTestScopedLibraryChild,
cef_translator_test_scoped_library_child_t>::UnwrapDerivedOwn(
CefWrapperType type, CefOwnPtr<CefTranslatorTestScopedLibraryChild> c) {
if (type == WT_TRANSLATOR_TEST_SCOPED_LIBRARY_CHILD_CHILD) {
return reinterpret_cast<cef_translator_test_scoped_library_child_t*>(
CefTranslatorTestScopedLibraryChildChildCToCpp::UnwrapOwn(
CefOwnPtr<CefTranslatorTestScopedLibraryChildChild>(
reinterpret_cast<CefTranslatorTestScopedLibraryChildChild*>(c.release(
)))));
}
NOTREACHED() << "Unexpected class type: " << type;
return NULL;
}
template<> cef_translator_test_scoped_library_child_t* CefCToCppScoped<CefTranslatorTestScopedLibraryChildCToCpp,
CefTranslatorTestScopedLibraryChild,
cef_translator_test_scoped_library_child_t>::UnwrapDerivedRaw(
CefWrapperType type, CefRawPtr<CefTranslatorTestScopedLibraryChild> c) {
if (type == WT_TRANSLATOR_TEST_SCOPED_LIBRARY_CHILD_CHILD) {
return reinterpret_cast<cef_translator_test_scoped_library_child_t*>(
CefTranslatorTestScopedLibraryChildChildCToCpp::UnwrapRaw(
CefRawPtr<CefTranslatorTestScopedLibraryChildChild>(
reinterpret_cast<CefTranslatorTestScopedLibraryChildChild*>(c))));
}
NOTREACHED() << "Unexpected class type: " << type;
return NULL;
}
#if DCHECK_IS_ON()
template<> base::AtomicRefCount CefCToCppScoped<CefTranslatorTestScopedLibraryChildCToCpp,
CefTranslatorTestScopedLibraryChild,
cef_translator_test_scoped_library_child_t>::DebugObjCt = 0;
#endif
template<> CefWrapperType CefCToCppScoped<CefTranslatorTestScopedLibraryChildCToCpp,
CefTranslatorTestScopedLibraryChild,
cef_translator_test_scoped_library_child_t>::kWrapperType =
WT_TRANSLATOR_TEST_SCOPED_LIBRARY_CHILD;

View File

@ -0,0 +1,43 @@
// Copyright (c) 2017 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool. If making changes by
// hand only do so within the body of existing method and function
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
#ifndef CEF_LIBCEF_DLL_CTOCPP_TEST_TRANSLATOR_TEST_SCOPED_LIBRARY_CHILD_CTOCPP_H_
#define CEF_LIBCEF_DLL_CTOCPP_TEST_TRANSLATOR_TEST_SCOPED_LIBRARY_CHILD_CTOCPP_H_
#pragma once
#if !defined(WRAPPING_CEF_SHARED)
#error This file can be included wrapper-side only
#endif
#include "include/test/cef_translator_test.h"
#include "include/capi/test/cef_translator_test_capi.h"
#include "libcef_dll/ctocpp/ctocpp_scoped.h"
// Wrap a C structure with a C++ class.
// This class may be instantiated and accessed wrapper-side only.
class CefTranslatorTestScopedLibraryChildCToCpp
: public CefCToCppScoped<CefTranslatorTestScopedLibraryChildCToCpp,
CefTranslatorTestScopedLibraryChild,
cef_translator_test_scoped_library_child_t> {
public:
CefTranslatorTestScopedLibraryChildCToCpp();
// CefTranslatorTestScopedLibraryChild methods.
int GetOtherValue() OVERRIDE;
void SetOtherValue(int value) OVERRIDE;
// CefTranslatorTestScopedLibrary methods.
int GetValue() OVERRIDE;
void SetValue(int value) OVERRIDE;
};
#endif // CEF_LIBCEF_DLL_CTOCPP_TEST_TRANSLATOR_TEST_SCOPED_LIBRARY_CHILD_CTOCPP_H_

View File

@ -0,0 +1,118 @@
// Copyright (c) 2017 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool. If making changes by
// hand only do so within the body of existing method and function
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
#include "libcef_dll/ctocpp/test/translator_test_scoped_library_ctocpp.h"
#include "libcef_dll/ctocpp/test/translator_test_scoped_library_child_ctocpp.h"
#include "libcef_dll/ctocpp/test/translator_test_scoped_library_child_child_ctocpp.h"
// STATIC METHODS - Body may be edited by hand.
CefOwnPtr<CefTranslatorTestScopedLibrary> CefTranslatorTestScopedLibrary::Create(
int value) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_translator_test_scoped_library_t* _retval =
cef_translator_test_scoped_library_create(
value);
// Return type: ownptr_same
return CefTranslatorTestScopedLibraryCToCpp::Wrap(_retval);
}
// VIRTUAL METHODS - Body may be edited by hand.
int CefTranslatorTestScopedLibraryCToCpp::GetValue() {
cef_translator_test_scoped_library_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_value))
return 0;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
int _retval = _struct->get_value(_struct);
// Return type: simple
return _retval;
}
void CefTranslatorTestScopedLibraryCToCpp::SetValue(int value) {
cef_translator_test_scoped_library_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, set_value))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
_struct->set_value(_struct,
value);
}
// CONSTRUCTOR - Do not edit by hand.
CefTranslatorTestScopedLibraryCToCpp::CefTranslatorTestScopedLibraryCToCpp() {
}
template<> cef_translator_test_scoped_library_t* CefCToCppScoped<CefTranslatorTestScopedLibraryCToCpp,
CefTranslatorTestScopedLibrary,
cef_translator_test_scoped_library_t>::UnwrapDerivedOwn(
CefWrapperType type, CefOwnPtr<CefTranslatorTestScopedLibrary> c) {
if (type == WT_TRANSLATOR_TEST_SCOPED_LIBRARY_CHILD) {
return reinterpret_cast<cef_translator_test_scoped_library_t*>(
CefTranslatorTestScopedLibraryChildCToCpp::UnwrapOwn(
CefOwnPtr<CefTranslatorTestScopedLibraryChild>(
reinterpret_cast<CefTranslatorTestScopedLibraryChild*>(c.release()))));
}
if (type == WT_TRANSLATOR_TEST_SCOPED_LIBRARY_CHILD_CHILD) {
return reinterpret_cast<cef_translator_test_scoped_library_t*>(
CefTranslatorTestScopedLibraryChildChildCToCpp::UnwrapOwn(
CefOwnPtr<CefTranslatorTestScopedLibraryChildChild>(
reinterpret_cast<CefTranslatorTestScopedLibraryChildChild*>(c.release(
)))));
}
NOTREACHED() << "Unexpected class type: " << type;
return NULL;
}
template<> cef_translator_test_scoped_library_t* CefCToCppScoped<CefTranslatorTestScopedLibraryCToCpp,
CefTranslatorTestScopedLibrary,
cef_translator_test_scoped_library_t>::UnwrapDerivedRaw(
CefWrapperType type, CefRawPtr<CefTranslatorTestScopedLibrary> c) {
if (type == WT_TRANSLATOR_TEST_SCOPED_LIBRARY_CHILD) {
return reinterpret_cast<cef_translator_test_scoped_library_t*>(
CefTranslatorTestScopedLibraryChildCToCpp::UnwrapRaw(
CefRawPtr<CefTranslatorTestScopedLibraryChild>(
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*>(c))));
}
NOTREACHED() << "Unexpected class type: " << type;
return NULL;
}
#if DCHECK_IS_ON()
template<> base::AtomicRefCount CefCToCppScoped<CefTranslatorTestScopedLibraryCToCpp,
CefTranslatorTestScopedLibrary,
cef_translator_test_scoped_library_t>::DebugObjCt = 0;
#endif
template<> CefWrapperType CefCToCppScoped<CefTranslatorTestScopedLibraryCToCpp,
CefTranslatorTestScopedLibrary,
cef_translator_test_scoped_library_t>::kWrapperType =
WT_TRANSLATOR_TEST_SCOPED_LIBRARY;

View File

@ -0,0 +1,39 @@
// Copyright (c) 2017 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool. If making changes by
// hand only do so within the body of existing method and function
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
#ifndef CEF_LIBCEF_DLL_CTOCPP_TEST_TRANSLATOR_TEST_SCOPED_LIBRARY_CTOCPP_H_
#define CEF_LIBCEF_DLL_CTOCPP_TEST_TRANSLATOR_TEST_SCOPED_LIBRARY_CTOCPP_H_
#pragma once
#if !defined(WRAPPING_CEF_SHARED)
#error This file can be included wrapper-side only
#endif
#include "include/test/cef_translator_test.h"
#include "include/capi/test/cef_translator_test_capi.h"
#include "libcef_dll/ctocpp/ctocpp_scoped.h"
// Wrap a C structure with a C++ class.
// This class may be instantiated and accessed wrapper-side only.
class CefTranslatorTestScopedLibraryCToCpp
: public CefCToCppScoped<CefTranslatorTestScopedLibraryCToCpp,
CefTranslatorTestScopedLibrary,
cef_translator_test_scoped_library_t> {
public:
CefTranslatorTestScopedLibraryCToCpp();
// CefTranslatorTestScopedLibrary methods.
int GetValue() OVERRIDE;
void SetValue(int value) OVERRIDE;
};
#endif // CEF_LIBCEF_DLL_CTOCPP_TEST_TRANSLATOR_TEST_SCOPED_LIBRARY_CTOCPP_H_

19
libcef_dll/ptr_util.h Normal file
View File

@ -0,0 +1,19 @@
// Copyright (c) 2017 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
#ifndef CEF_LIBCEF_DLL_PTR_UTIL_H_
#define CEF_LIBCEF_DLL_PTR_UTIL_H_
#pragma once
// Helpers for CefOwnPtr<>.
#if defined(USING_CHROMIUM_INCLUDES)
#define OWN_PASS(p) std::move(p)
#define OWN_RETURN_AS(p,t) (p)
#else
#define OWN_PASS(p) (p).Pass()
#define OWN_RETURN_AS(p,t) (p).PassAs<t>()
#endif
#endif // CEF_LIBCEF_DLL_PTR_UTIL_H_

View File

@ -117,11 +117,16 @@ enum CefWrapperType {
WT_TEXTFIELD_DELEGATE,
WT_THREAD,
WT_TRANSLATOR_TEST,
WT_TRANSLATOR_TEST_HANDLER,
WT_TRANSLATOR_TEST_HANDLER_CHILD,
WT_TRANSLATOR_TEST_OBJECT,
WT_TRANSLATOR_TEST_OBJECT_CHILD,
WT_TRANSLATOR_TEST_OBJECT_CHILD_CHILD,
WT_TRANSLATOR_TEST_REF_PTR_CLIENT,
WT_TRANSLATOR_TEST_REF_PTR_CLIENT_CHILD,
WT_TRANSLATOR_TEST_REF_PTR_LIBRARY,
WT_TRANSLATOR_TEST_REF_PTR_LIBRARY_CHILD,
WT_TRANSLATOR_TEST_REF_PTR_LIBRARY_CHILD_CHILD,
WT_TRANSLATOR_TEST_SCOPED_CLIENT,
WT_TRANSLATOR_TEST_SCOPED_CLIENT_CHILD,
WT_TRANSLATOR_TEST_SCOPED_LIBRARY,
WT_TRANSLATOR_TEST_SCOPED_LIBRARY_CHILD,
WT_TRANSLATOR_TEST_SCOPED_LIBRARY_CHILD_CHILD,
WT_URLREQUEST,
WT_URLREQUEST_CLIENT,
WT_V8ACCESSOR,

View File

@ -9,7 +9,7 @@ namespace client {
// static
void ClientApp::RegisterCustomSchemes(
CefRefPtr<CefSchemeRegistrar> registrar,
CefRawPtr<CefSchemeRegistrar> registrar,
std::vector<CefString>& cookiable_schemes) {
scheme_test::RegisterCustomSchemes(registrar, cookiable_schemes);
}

View File

@ -9,7 +9,7 @@
namespace client {
namespace scheme_test {
void RegisterCustomSchemes(CefRefPtr<CefSchemeRegistrar> registrar,
void RegisterCustomSchemes(CefRawPtr<CefSchemeRegistrar> registrar,
std::vector<CefString>& cookiable_schemes) {
registrar->AddCustomScheme("client", true, false, false, false, true);
}

View File

@ -17,7 +17,7 @@ namespace scheme_test {
// See browser/scheme_test.h for creation/registration of the custom scheme
// handler which only occurs in the browser process. Called from
// client_app_delegates_common.cc.
void RegisterCustomSchemes(CefRefPtr<CefSchemeRegistrar> registrar,
void RegisterCustomSchemes(CefRawPtr<CefSchemeRegistrar> registrar,
std::vector<CefString>& cookiable_schemes);
} // namespace scheme_test

View File

@ -98,23 +98,23 @@ void CreateRenderDelegates(ClientAppRenderer::DelegateSet& delegates) {
}
void RegisterCustomSchemes(
CefRefPtr<CefSchemeRegistrar> registrar,
CefRawPtr<CefSchemeRegistrar> registrar,
std::vector<CefString>& cookiable_schemes) {
// Bring in the scheme handler tests.
extern void RegisterSchemeHandlerCustomSchemes(
CefRefPtr<CefSchemeRegistrar> registrar,
CefRawPtr<CefSchemeRegistrar> registrar,
std::vector<CefString>& cookiable_schemes);
RegisterSchemeHandlerCustomSchemes(registrar, cookiable_schemes);
// Bring in the cookie tests.
extern void RegisterCookieCustomSchemes(
CefRefPtr<CefSchemeRegistrar> registrar,
CefRawPtr<CefSchemeRegistrar> registrar,
std::vector<CefString>& cookiable_schemes);
RegisterCookieCustomSchemes(registrar, cookiable_schemes);
// Bring in the URLRequest tests.
extern void RegisterURLRequestCustomSchemes(
CefRefPtr<CefSchemeRegistrar> registrar,
CefRawPtr<CefSchemeRegistrar> registrar,
std::vector<CefString>& cookiable_schemes);
RegisterURLRequestCustomSchemes(registrar, cookiable_schemes);
}
@ -139,7 +139,7 @@ void ClientAppRenderer::CreateDelegates(DelegateSet& delegates) {
// static
void ClientApp::RegisterCustomSchemes(
CefRefPtr<CefSchemeRegistrar> registrar,
CefRawPtr<CefSchemeRegistrar> registrar,
std::vector<CefString>& cookiable_schemes) {
::RegisterCustomSchemes(registrar, cookiable_schemes);
}

View File

@ -1336,7 +1336,7 @@ TEST(CookieTest, GetCookieManagerCustom) {
// Entry point for registering custom schemes.
// Called from client_app_delegates.cc.
void RegisterCookieCustomSchemes(
CefRefPtr<CefSchemeRegistrar> registrar,
CefRawPtr<CefSchemeRegistrar> registrar,
std::vector<CefString>& cookiable_schemes) {
// Used by GetCookieManagerCustom test.
registrar->AddCustomScheme("ccustom", true, false, false, false, true);

View File

@ -1667,7 +1667,7 @@ TEST(SchemeHandlerTest, AcceptLanguage) {
// Entry point for registering custom schemes.
// Called from client_app_delegates.cc.
void RegisterSchemeHandlerCustomSchemes(
CefRefPtr<CefSchemeRegistrar> registrar,
CefRawPtr<CefSchemeRegistrar> registrar,
std::vector<CefString>& cookiable_schemes) {
// Add a custom standard scheme.
registrar->AddCustomScheme("customstd", true, false, false, false, true);

View File

@ -3,6 +3,7 @@
// can be found in the LICENSE file.
#include "include/test/cef_translator_test.h"
#include "tests/ceftests/test_handler.h"
#include "tests/gtest/include/gtest/gtest.h"
// Test getting/setting primitive types.
@ -168,22 +169,23 @@ TEST(TranslatorTest, StructList) {
EXPECT_TRUE(obj->HasOneRef());
}
// Test getting/setting library-side object types.
TEST(TranslatorTest, Object) {
// Test getting/setting library-side RefPtr types.
TEST(TranslatorTest, RefPtrLibrary) {
CefRefPtr<CefTranslatorTest> obj = CefTranslatorTest::Create();
const int kTestVal = 12;
CefRefPtr<CefTranslatorTestObject> test_obj =
CefTranslatorTestObject::Create(kTestVal);
CefRefPtr<CefTranslatorTestRefPtrLibrary> test_obj =
CefTranslatorTestRefPtrLibrary::Create(kTestVal);
EXPECT_EQ(kTestVal, test_obj->GetValue());
int retval = obj->SetObject(test_obj);
int retval = obj->SetRefPtrLibrary(test_obj);
EXPECT_EQ(kTestVal, retval);
EXPECT_EQ(kTestVal, test_obj->GetValue());
const int kTestVal2 = 30;
CefRefPtr<CefTranslatorTestObject> test_obj2 = obj->GetObject(kTestVal2);
CefRefPtr<CefTranslatorTestRefPtrLibrary> test_obj2 =
obj->GetRefPtrLibrary(kTestVal2);
EXPECT_EQ(kTestVal2, test_obj2->GetValue());
int retval2 = obj->SetObject(test_obj2);
int retval2 = obj->SetRefPtrLibrary(test_obj2);
EXPECT_EQ(kTestVal2, retval2);
EXPECT_EQ(kTestVal2, test_obj2->GetValue());
@ -193,39 +195,41 @@ TEST(TranslatorTest, Object) {
EXPECT_TRUE(test_obj2->HasOneRef());
}
// Test getting/setting inherited library-side object types.
TEST(TranslatorTest, ObjectInherit) {
// Test getting/setting inherited library-side RefPtr types.
TEST(TranslatorTest, RefPtrLibraryInherit) {
CefRefPtr<CefTranslatorTest> obj = CefTranslatorTest::Create();
const int kTestVal = 12;
const int kTestVal2 = 40;
CefRefPtr<CefTranslatorTestObjectChild> test_obj =
CefTranslatorTestObjectChild::Create(kTestVal, kTestVal2);
CefRefPtr<CefTranslatorTestRefPtrLibraryChild> test_obj =
CefTranslatorTestRefPtrLibraryChild::Create(kTestVal, kTestVal2);
EXPECT_EQ(kTestVal, test_obj->GetValue());
EXPECT_EQ(kTestVal2, test_obj->GetOtherValue());
int retval = obj->SetObject(test_obj);
int retval = obj->SetRefPtrLibrary(test_obj);
EXPECT_EQ(kTestVal, retval);
EXPECT_EQ(kTestVal, test_obj->GetValue());
EXPECT_EQ(kTestVal2, test_obj->GetOtherValue());
EXPECT_EQ(kTestVal, obj->SetChildObject(test_obj));
EXPECT_EQ(kTestVal, obj->SetChildObjectAndReturnParent(test_obj)->GetValue());
EXPECT_EQ(kTestVal, obj->SetChildRefPtrLibrary(test_obj));
EXPECT_EQ(kTestVal,
obj->SetChildRefPtrLibraryAndReturnParent(test_obj)->GetValue());
const int kTestVal3 = 100;
CefRefPtr<CefTranslatorTestObjectChildChild> test_obj2 =
CefTranslatorTestObjectChildChild::Create(kTestVal, kTestVal2, kTestVal3);
CefRefPtr<CefTranslatorTestRefPtrLibraryChildChild> test_obj2 =
CefTranslatorTestRefPtrLibraryChildChild::Create(kTestVal, kTestVal2,
kTestVal3);
EXPECT_EQ(kTestVal, test_obj2->GetValue());
EXPECT_EQ(kTestVal2, test_obj2->GetOtherValue());
EXPECT_EQ(kTestVal3, test_obj2->GetOtherOtherValue());
int retval2 = obj->SetObject(test_obj2);
int retval2 = obj->SetRefPtrLibrary(test_obj2);
EXPECT_EQ(kTestVal, retval2);
EXPECT_EQ(kTestVal, test_obj2->GetValue());
EXPECT_EQ(kTestVal2, test_obj2->GetOtherValue());
EXPECT_EQ(kTestVal3, test_obj2->GetOtherOtherValue());
EXPECT_EQ(kTestVal, obj->SetChildObject(test_obj2));
EXPECT_EQ(kTestVal, obj->SetChildRefPtrLibrary(test_obj2));
EXPECT_EQ(kTestVal,
obj->SetChildObjectAndReturnParent(test_obj2)->GetValue());
obj->SetChildRefPtrLibraryAndReturnParent(test_obj2)->GetValue());
// Only one reference to the object should exist.
EXPECT_TRUE(obj->HasOneRef());
@ -233,25 +237,25 @@ TEST(TranslatorTest, ObjectInherit) {
EXPECT_TRUE(test_obj2->HasOneRef());
}
// Test getting/setting library-side object list types.
TEST(TranslatorTest, ObjectList) {
// Test getting/setting library-side RefPtr list types.
TEST(TranslatorTest, RefPtrLibraryList) {
CefRefPtr<CefTranslatorTest> obj = CefTranslatorTest::Create();
const int kVal1 = 34;
const int kVal2 = 10;
CefRefPtr<CefTranslatorTestObject> val1 =
CefTranslatorTestObject::Create(kVal1);
CefRefPtr<CefTranslatorTestObject> val2 =
CefTranslatorTestObjectChild::Create(kVal2, 0);
CefRefPtr<CefTranslatorTestRefPtrLibrary> val1 =
CefTranslatorTestRefPtrLibrary::Create(kVal1);
CefRefPtr<CefTranslatorTestRefPtrLibrary> val2 =
CefTranslatorTestRefPtrLibraryChild::Create(kVal2, 0);
std::vector<CefRefPtr<CefTranslatorTestObject> > list;
std::vector<CefRefPtr<CefTranslatorTestRefPtrLibrary> > list;
list.push_back(val1);
list.push_back(val2);
EXPECT_TRUE(obj->SetObjectList(list, kVal1, kVal2));
EXPECT_TRUE(obj->SetRefPtrLibraryList(list, kVal1, kVal2));
list.clear();
EXPECT_TRUE(obj->GetObjectListByRef(list, kVal1, kVal2));
EXPECT_TRUE(obj->GetRefPtrLibraryListByRef(list, kVal1, kVal2));
EXPECT_EQ(2U, list.size());
EXPECT_EQ(kVal1, list[0]->GetValue());
EXPECT_EQ(kVal2, list[1]->GetValue());
@ -266,9 +270,9 @@ TEST(TranslatorTest, ObjectList) {
namespace {
class TranslatorTestHandler : public CefTranslatorTestHandler {
class TranslatorTestRefPtrClient : public CefTranslatorTestRefPtrClient {
public:
explicit TranslatorTestHandler(const int val)
explicit TranslatorTestRefPtrClient(const int val)
: val_(val) {
}
@ -279,13 +283,14 @@ class TranslatorTestHandler : public CefTranslatorTestHandler {
private:
const int val_;
IMPLEMENT_REFCOUNTING(TranslatorTestHandler);
DISALLOW_COPY_AND_ASSIGN(TranslatorTestHandler);
IMPLEMENT_REFCOUNTING(TranslatorTestRefPtrClient);
DISALLOW_COPY_AND_ASSIGN(TranslatorTestRefPtrClient);
};
class TranslatorTestHandlerChild : public CefTranslatorTestHandlerChild {
class TranslatorTestRefPtrClientChild :
public CefTranslatorTestRefPtrClientChild {
public:
TranslatorTestHandlerChild(const int val,
TranslatorTestRefPtrClientChild(const int val,
const int other_val)
: val_(val),
other_val_(other_val) {
@ -303,24 +308,24 @@ class TranslatorTestHandlerChild : public CefTranslatorTestHandlerChild {
const int val_;
const int other_val_;
IMPLEMENT_REFCOUNTING(TranslatorTestHandlerChild);
DISALLOW_COPY_AND_ASSIGN(TranslatorTestHandlerChild);
IMPLEMENT_REFCOUNTING(TranslatorTestRefPtrClientChild);
DISALLOW_COPY_AND_ASSIGN(TranslatorTestRefPtrClientChild);
};
} // namespace
// Test getting/setting client-side handler types.
TEST(TranslatorTest, Handler) {
// Test getting/setting client-side RefPtr types.
TEST(TranslatorTest, RefPtrClient) {
CefRefPtr<CefTranslatorTest> obj = CefTranslatorTest::Create();
const int kTestVal = 12;
CefRefPtr<TranslatorTestHandler> test_obj =
new TranslatorTestHandler(kTestVal);
CefRefPtr<TranslatorTestRefPtrClient> test_obj =
new TranslatorTestRefPtrClient(kTestVal);
EXPECT_EQ(kTestVal, test_obj->GetValue());
EXPECT_EQ(kTestVal, obj->SetHandler(test_obj.get()));
CefRefPtr<CefTranslatorTestHandler> handler =
obj->SetHandlerAndReturn(test_obj.get());
EXPECT_EQ(kTestVal, obj->SetRefPtrClient(test_obj.get()));
CefRefPtr<CefTranslatorTestRefPtrClient> handler =
obj->SetRefPtrClientAndReturn(test_obj.get());
EXPECT_EQ(test_obj.get(), handler.get());
EXPECT_EQ(kTestVal, handler->GetValue());
handler = NULL;
@ -330,25 +335,25 @@ TEST(TranslatorTest, Handler) {
EXPECT_TRUE(test_obj->HasOneRef());
}
// Test getting/setting inherited client-side handler types.
TEST(TranslatorTest, HandlerInherit) {
// Test getting/setting inherited client-side RefPtr types.
TEST(TranslatorTest, RefPtrClientInherit) {
CefRefPtr<CefTranslatorTest> obj = CefTranslatorTest::Create();
const int kTestVal = 12;
const int kTestVal2 = 86;
CefRefPtr<TranslatorTestHandlerChild> test_obj =
new TranslatorTestHandlerChild(kTestVal, kTestVal2);
CefRefPtr<TranslatorTestRefPtrClientChild> test_obj =
new TranslatorTestRefPtrClientChild(kTestVal, kTestVal2);
EXPECT_EQ(kTestVal, test_obj->GetValue());
EXPECT_EQ(kTestVal2, test_obj->GetOtherValue());
int retval = obj->SetHandler(test_obj);
int retval = obj->SetRefPtrClient(test_obj);
EXPECT_EQ(kTestVal, retval);
EXPECT_EQ(kTestVal, test_obj->GetValue());
EXPECT_EQ(kTestVal2, test_obj->GetOtherValue());
EXPECT_EQ(kTestVal, obj->SetChildHandler(test_obj));
CefRefPtr<CefTranslatorTestHandler> handler =
obj->SetChildHandlerAndReturnParent(test_obj);
EXPECT_EQ(kTestVal, obj->SetChildRefPtrClient(test_obj));
CefRefPtr<CefTranslatorTestRefPtrClient> handler =
obj->SetChildRefPtrClientAndReturnParent(test_obj);
EXPECT_EQ(kTestVal, handler->GetValue());
EXPECT_EQ(test_obj.get(), handler.get());
handler = NULL;
@ -358,24 +363,25 @@ TEST(TranslatorTest, HandlerInherit) {
EXPECT_TRUE(test_obj->HasOneRef());
}
// Test getting/setting client-side object list types.
TEST(TranslatorTest, HandlerList) {
// Test getting/setting client-side RefPtr list types.
TEST(TranslatorTest, RefPtrClientList) {
CefRefPtr<CefTranslatorTest> obj = CefTranslatorTest::Create();
const int kVal1 = 34;
const int kVal2 = 10;
CefRefPtr<CefTranslatorTestHandler> val1 = new TranslatorTestHandler(kVal1);
CefRefPtr<CefTranslatorTestHandler> val2 =
new TranslatorTestHandlerChild(kVal2, 0);
CefRefPtr<CefTranslatorTestRefPtrClient> val1 =
new TranslatorTestRefPtrClient(kVal1);
CefRefPtr<CefTranslatorTestRefPtrClient> val2 =
new TranslatorTestRefPtrClientChild(kVal2, 0);
std::vector<CefRefPtr<CefTranslatorTestHandler> > list;
std::vector<CefRefPtr<CefTranslatorTestRefPtrClient> > list;
list.push_back(val1);
list.push_back(val2);
EXPECT_TRUE(obj->SetHandlerList(list, kVal1, kVal2));
EXPECT_TRUE(obj->SetRefPtrClientList(list, kVal1, kVal2));
list.clear();
EXPECT_TRUE(obj->GetHandlerListByRef(list, val1, val2));
EXPECT_TRUE(obj->GetRefPtrClientListByRef(list, val1, val2));
EXPECT_EQ(2U, list.size());
EXPECT_EQ(kVal1, list[0]->GetValue());
EXPECT_EQ(val1.get(), list[0].get());
@ -389,3 +395,374 @@ TEST(TranslatorTest, HandlerList) {
EXPECT_TRUE(val1->HasOneRef());
EXPECT_TRUE(val2->HasOneRef());
}
// Test getting/setting library-side OwnPtr types.
TEST(TranslatorTest, OwnPtrLibrary) {
CefRefPtr<CefTranslatorTest> obj = CefTranslatorTest::Create();
const int kTestVal = 12;
CefOwnPtr<CefTranslatorTestScopedLibrary> test_obj =
CefTranslatorTestScopedLibrary::Create(kTestVal);
EXPECT_TRUE(test_obj.get());
EXPECT_EQ(kTestVal, test_obj->GetValue());
int retval = obj->SetOwnPtrLibrary(test_obj.Pass());
EXPECT_EQ(kTestVal, retval);
EXPECT_FALSE(test_obj.get());
const int kTestVal2 = 30;
CefOwnPtr<CefTranslatorTestScopedLibrary> test_obj2 =
obj->GetOwnPtrLibrary(kTestVal2);
EXPECT_TRUE(test_obj2.get());
EXPECT_EQ(kTestVal2, test_obj2->GetValue());
int retval2 = obj->SetOwnPtrLibrary(test_obj2.Pass());
EXPECT_EQ(kTestVal2, retval2);
EXPECT_FALSE(test_obj2.get());
// Only one reference to the object should exist.
EXPECT_TRUE(obj->HasOneRef());
}
// Test getting/setting inherited library-side OwnPtr types.
TEST(TranslatorTest, OwnPtrLibraryInherit) {
CefRefPtr<CefTranslatorTest> obj = CefTranslatorTest::Create();
const int kTestVal = 12;
const int kTestVal2 = 40;
CefOwnPtr<CefTranslatorTestScopedLibraryChild> test_obj =
CefTranslatorTestScopedLibraryChild::Create(kTestVal, kTestVal2);
EXPECT_TRUE(test_obj.get());
EXPECT_EQ(kTestVal, test_obj->GetValue());
EXPECT_EQ(kTestVal2, test_obj->GetOtherValue());
int retval = obj->SetOwnPtrLibrary(
test_obj.PassAs<CefTranslatorTestScopedLibrary>());
EXPECT_EQ(kTestVal, retval);
EXPECT_FALSE(test_obj.get());
test_obj = CefTranslatorTestScopedLibraryChild::Create(kTestVal, kTestVal2);
EXPECT_TRUE(test_obj.get());
EXPECT_EQ(kTestVal, obj->SetChildOwnPtrLibrary(test_obj.Pass()));
EXPECT_FALSE(test_obj.get());
test_obj = CefTranslatorTestScopedLibraryChild::Create(kTestVal, kTestVal2);
EXPECT_TRUE(test_obj.get());
CefOwnPtr<CefTranslatorTestScopedLibrary> test_obj_parent =
obj->SetChildOwnPtrLibraryAndReturnParent(test_obj.Pass());
EXPECT_FALSE(test_obj.get());
EXPECT_TRUE(test_obj_parent.get());
EXPECT_EQ(kTestVal, test_obj_parent->GetValue());
test_obj_parent.reset(NULL);
const int kTestVal3 = 100;
CefOwnPtr<CefTranslatorTestScopedLibraryChildChild> test_obj2 =
CefTranslatorTestScopedLibraryChildChild::Create(kTestVal, kTestVal2,
kTestVal3);
EXPECT_EQ(kTestVal, test_obj2->GetValue());
EXPECT_EQ(kTestVal2, test_obj2->GetOtherValue());
EXPECT_EQ(kTestVal3, test_obj2->GetOtherOtherValue());
int retval2 = obj->SetOwnPtrLibrary(
test_obj2.PassAs<CefTranslatorTestScopedLibrary>());
EXPECT_EQ(kTestVal, retval2);
EXPECT_FALSE(test_obj2.get());
test_obj2 = CefTranslatorTestScopedLibraryChildChild::Create(
kTestVal, kTestVal2, kTestVal3);
EXPECT_EQ(kTestVal, obj->SetChildOwnPtrLibrary(
test_obj2.PassAs<CefTranslatorTestScopedLibraryChild>()));
EXPECT_FALSE(test_obj2.get());
test_obj2 = CefTranslatorTestScopedLibraryChildChild::Create(
kTestVal, kTestVal2, kTestVal3);
test_obj_parent = obj->SetChildOwnPtrLibraryAndReturnParent(
test_obj2.PassAs<CefTranslatorTestScopedLibraryChild>());
EXPECT_FALSE(test_obj2.get());
EXPECT_TRUE(test_obj_parent.get());
EXPECT_EQ(kTestVal, test_obj_parent->GetValue());
test_obj_parent.reset(NULL);
// Only one reference to the object should exist.
EXPECT_TRUE(obj->HasOneRef());
}
namespace {
class TranslatorTestScopedClient : public CefTranslatorTestScopedClient {
public:
TranslatorTestScopedClient(const int val,
TrackCallback* got_delete)
: val_(val),
got_delete_(got_delete) {
}
~TranslatorTestScopedClient() override {
got_delete_->yes();
}
virtual int GetValue() override {
return val_;
}
private:
const int val_;
TrackCallback* got_delete_;
DISALLOW_COPY_AND_ASSIGN(TranslatorTestScopedClient);
};
class TranslatorTestScopedClientChild :
public CefTranslatorTestScopedClientChild {
public:
TranslatorTestScopedClientChild(const int val,
const int other_val,
TrackCallback* got_delete)
: val_(val),
other_val_(other_val),
got_delete_(got_delete) {
}
~TranslatorTestScopedClientChild() override {
got_delete_->yes();
}
virtual int GetValue() override {
return val_;
}
virtual int GetOtherValue() override {
return other_val_;
}
private:
const int val_;
const int other_val_;
TrackCallback* got_delete_;
DISALLOW_COPY_AND_ASSIGN(TranslatorTestScopedClientChild);
};
} // namespace
// Test getting/setting client-side OwnPtr types.
TEST(TranslatorTest, OwnPtrClient) {
CefRefPtr<CefTranslatorTest> obj = CefTranslatorTest::Create();
const int kTestVal = 12;
TrackCallback got_delete;
CefOwnPtr<CefTranslatorTestScopedClient> test_obj(
new TranslatorTestScopedClient(kTestVal, &got_delete));
EXPECT_EQ(kTestVal, test_obj->GetValue());
EXPECT_EQ(kTestVal, obj->SetOwnPtrClient(test_obj.Pass()));
EXPECT_FALSE(test_obj.get());
EXPECT_TRUE(got_delete);
got_delete.reset();
test_obj.reset(new TranslatorTestScopedClient(kTestVal, &got_delete));
CefOwnPtr<CefTranslatorTestScopedClient> handler =
obj->SetOwnPtrClientAndReturn(test_obj.Pass());
EXPECT_FALSE(test_obj.get());
EXPECT_TRUE(handler.get());
EXPECT_FALSE(got_delete);
EXPECT_EQ(kTestVal, handler->GetValue());
handler.reset(NULL);
EXPECT_TRUE(got_delete);
// Only one reference to the object should exist.
EXPECT_TRUE(obj->HasOneRef());
}
// Test getting/setting inherited client-side OwnPtr types.
TEST(TranslatorTest, OwnPtrClientInherit) {
CefRefPtr<CefTranslatorTest> obj = CefTranslatorTest::Create();
const int kTestVal = 12;
const int kTestVal2 = 86;
TrackCallback got_delete;
CefOwnPtr<CefTranslatorTestScopedClientChild> test_obj(
new TranslatorTestScopedClientChild(kTestVal, kTestVal2, &got_delete));
EXPECT_EQ(kTestVal, test_obj->GetValue());
EXPECT_EQ(kTestVal2, test_obj->GetOtherValue());
EXPECT_EQ(kTestVal, obj->SetOwnPtrClient(
test_obj.PassAs<CefTranslatorTestScopedClient>()));
EXPECT_FALSE(test_obj.get());
EXPECT_TRUE(got_delete);
got_delete.reset();
test_obj.reset(
new TranslatorTestScopedClientChild(kTestVal, kTestVal2, &got_delete));
EXPECT_EQ(kTestVal, obj->SetChildOwnPtrClient(test_obj.Pass()));
EXPECT_FALSE(test_obj.get());
EXPECT_TRUE(got_delete);
got_delete.reset();
test_obj.reset(
new TranslatorTestScopedClientChild(kTestVal, kTestVal2, &got_delete));
CefOwnPtr<CefTranslatorTestScopedClient> handler(
obj->SetChildOwnPtrClientAndReturnParent(test_obj.Pass()));
EXPECT_EQ(kTestVal, handler->GetValue());
EXPECT_FALSE(test_obj.get());
EXPECT_FALSE(got_delete);
handler.reset(NULL);
EXPECT_TRUE(got_delete);
// Only one reference to the object should exist.
EXPECT_TRUE(obj->HasOneRef());
}
// Test getting/setting library-side RawPtr types.
TEST(TranslatorTest, RawPtrLibrary) {
CefRefPtr<CefTranslatorTest> obj = CefTranslatorTest::Create();
const int kTestVal = 12;
CefOwnPtr<CefTranslatorTestScopedLibrary> test_obj(
CefTranslatorTestScopedLibrary::Create(kTestVal));
EXPECT_EQ(kTestVal, test_obj->GetValue());
int retval = obj->SetRawPtrLibrary(test_obj.get());
EXPECT_EQ(kTestVal, retval);
EXPECT_EQ(kTestVal, test_obj->GetValue());
const int kTestVal2 = 30;
CefOwnPtr<CefTranslatorTestScopedLibrary> test_obj2(
obj->GetOwnPtrLibrary(kTestVal2));
EXPECT_EQ(kTestVal2, test_obj2->GetValue());
int retval2 = obj->SetRawPtrLibrary(test_obj2.get());
EXPECT_EQ(kTestVal2, retval2);
EXPECT_EQ(kTestVal2, test_obj2->GetValue());
// Only one reference to the object should exist.
EXPECT_TRUE(obj->HasOneRef());
}
// Test getting/setting inherited library-side RawPtr types.
TEST(TranslatorTest, RawPtrLibraryInherit) {
CefRefPtr<CefTranslatorTest> obj = CefTranslatorTest::Create();
const int kTestVal = 12;
const int kTestVal2 = 40;
CefOwnPtr<CefTranslatorTestScopedLibraryChild> test_obj(
CefTranslatorTestScopedLibraryChild::Create(kTestVal, kTestVal2));
EXPECT_EQ(kTestVal, test_obj->GetValue());
EXPECT_EQ(kTestVal2, test_obj->GetOtherValue());
int retval = obj->SetRawPtrLibrary(test_obj.get());
EXPECT_EQ(kTestVal, retval);
EXPECT_EQ(kTestVal, test_obj->GetValue());
EXPECT_EQ(kTestVal2, test_obj->GetOtherValue());
EXPECT_EQ(kTestVal, obj->SetChildRawPtrLibrary(test_obj.get()));
const int kTestVal3 = 100;
CefOwnPtr<CefTranslatorTestScopedLibraryChildChild> test_obj2(
CefTranslatorTestScopedLibraryChildChild::Create(kTestVal, kTestVal2,
kTestVal3));
EXPECT_EQ(kTestVal, test_obj2->GetValue());
EXPECT_EQ(kTestVal2, test_obj2->GetOtherValue());
EXPECT_EQ(kTestVal3, test_obj2->GetOtherOtherValue());
int retval2 = obj->SetRawPtrLibrary(test_obj2.get());
EXPECT_EQ(kTestVal, retval2);
EXPECT_EQ(kTestVal, test_obj2->GetValue());
EXPECT_EQ(kTestVal2, test_obj2->GetOtherValue());
EXPECT_EQ(kTestVal3, test_obj2->GetOtherOtherValue());
EXPECT_EQ(kTestVal, obj->SetChildRawPtrLibrary(test_obj2.get()));
// Only one reference to the object should exist.
EXPECT_TRUE(obj->HasOneRef());
}
// Test getting/setting library-side RawPtr list types.
TEST(TranslatorTest, RawPtrLibraryList) {
CefRefPtr<CefTranslatorTest> obj = CefTranslatorTest::Create();
const int kVal1 = 34;
const int kVal2 = 10;
CefOwnPtr<CefTranslatorTestScopedLibrary> val1(
CefTranslatorTestScopedLibrary::Create(kVal1));
CefOwnPtr<CefTranslatorTestScopedLibraryChild> val2(
CefTranslatorTestScopedLibraryChild::Create(kVal2, 0));
std::vector<CefRawPtr<CefTranslatorTestScopedLibrary> > list;
list.push_back(val1.get());
list.push_back(val2.get());
EXPECT_TRUE(obj->SetRawPtrLibraryList(list, kVal1, kVal2));
list.clear();
// Only one reference to the object should exist.
EXPECT_TRUE(obj->HasOneRef());
}
// Test getting/setting client-side RawPtr types.
TEST(TranslatorTest, RawPtrClient) {
CefRefPtr<CefTranslatorTest> obj = CefTranslatorTest::Create();
const int kTestVal = 12;
TrackCallback got_delete;
CefOwnPtr<TranslatorTestScopedClient> test_obj(
new TranslatorTestScopedClient(kTestVal, &got_delete));
EXPECT_EQ(kTestVal, test_obj->GetValue());
EXPECT_EQ(kTestVal, obj->SetRawPtrClient(test_obj.get()));
EXPECT_FALSE(got_delete);
test_obj.reset(NULL);
EXPECT_TRUE(got_delete);
// Only one reference to the object should exist.
EXPECT_TRUE(obj->HasOneRef());
}
// Test getting/setting inherited client-side RawPtr types.
TEST(TranslatorTest, RawPtrClientInherit) {
CefRefPtr<CefTranslatorTest> obj = CefTranslatorTest::Create();
const int kTestVal = 12;
const int kTestVal2 = 86;
TrackCallback got_delete;
CefOwnPtr<TranslatorTestScopedClientChild> test_obj(
new TranslatorTestScopedClientChild(kTestVal, kTestVal2, &got_delete));
EXPECT_EQ(kTestVal, test_obj->GetValue());
EXPECT_EQ(kTestVal2, test_obj->GetOtherValue());
int retval = obj->SetRawPtrClient(test_obj.get());
EXPECT_EQ(kTestVal, retval);
EXPECT_EQ(kTestVal, test_obj->GetValue());
EXPECT_EQ(kTestVal2, test_obj->GetOtherValue());
EXPECT_FALSE(got_delete);
EXPECT_EQ(kTestVal, obj->SetChildRawPtrClient(test_obj.get()));
EXPECT_FALSE(got_delete);
test_obj.reset(NULL);
EXPECT_TRUE(got_delete);
// Only one reference to the object should exist.
EXPECT_TRUE(obj->HasOneRef());
}
// Test getting/setting client-side RawPtr list types.
TEST(TranslatorTest, RawPtrClientList) {
CefRefPtr<CefTranslatorTest> obj = CefTranslatorTest::Create();
const int kVal1 = 34;
const int kVal2 = 10;
TrackCallback got_delete1, got_delete2;
CefOwnPtr<CefTranslatorTestScopedClient> val1(
new TranslatorTestScopedClient(kVal1, &got_delete1));
CefOwnPtr<CefTranslatorTestScopedClient> val2(
new TranslatorTestScopedClientChild(kVal2, 0, &got_delete2));
std::vector<CefRawPtr<CefTranslatorTestScopedClient> > list;
list.push_back(val1.get());
list.push_back(val2.get());
EXPECT_TRUE(obj->SetRawPtrClientList(list, kVal1, kVal2));
list.clear();
EXPECT_FALSE(got_delete1);
val1.reset(NULL);
EXPECT_TRUE(got_delete1);
EXPECT_FALSE(got_delete2);
val2.reset(NULL);
EXPECT_TRUE(got_delete2);
// Only one reference to the object should exist.
EXPECT_TRUE(obj->HasOneRef());
}

View File

@ -1422,7 +1422,7 @@ void CreateURLRequestRendererTests(ClientAppRenderer::DelegateSet& delegates) {
// Entry point for registering custom schemes.
// Called from client_app_delegates.cc.
void RegisterURLRequestCustomSchemes(
CefRefPtr<CefSchemeRegistrar> registrar,
CefRawPtr<CefSchemeRegistrar> registrar,
std::vector<CefString>& cookiable_schemes) {
registrar->AddCustomScheme(kRequestScheme, true, false, false, false, true);
cookiable_schemes.push_back(kRequestScheme);

View File

@ -42,7 +42,7 @@ ClientApp::ProcessType ClientApp::GetProcessType(
}
void ClientApp::OnRegisterCustomSchemes(
CefRefPtr<CefSchemeRegistrar> registrar) {
CefRawPtr<CefSchemeRegistrar> registrar) {
RegisterCustomSchemes(registrar, cookieable_schemes_);
}

View File

@ -34,12 +34,12 @@ class ClientApp : public CefApp {
private:
// Registers custom schemes. Implemented by cefclient in
// client_app_delegates_common.cc
static void RegisterCustomSchemes(CefRefPtr<CefSchemeRegistrar> registrar,
static void RegisterCustomSchemes(CefRawPtr<CefSchemeRegistrar> registrar,
std::vector<CefString>& cookiable_schemes);
// CefApp methods.
void OnRegisterCustomSchemes(
CefRefPtr<CefSchemeRegistrar> registrar) OVERRIDE;
CefRawPtr<CefSchemeRegistrar> registrar) OVERRIDE;
DISALLOW_COPY_AND_ASSIGN(ClientApp);
};

View File

@ -94,6 +94,12 @@ def wrap_code(code, indent = ' ', maxchars = 80, splitchars = '(=,'):
return output
def is_base_class(clsname):
""" Returns true if |clsname| is a known base (root) class in the object
hierarchy.
"""
return clsname == 'CefBase' or clsname == 'CefBaseScoped'
def get_capi_file_name(cppname):
""" Convert a C++ header file name to a C API header file name. """
return cppname[:-2]+'_capi.h'
@ -302,7 +308,7 @@ def format_translation_includes(header, body):
list = sorted(set(p.findall(body)))
for item in list:
directory = ''
if item != 'CefBase':
if not is_base_class(item):
cls = header.get_class(item)
dir = cls.get_file_directory()
if not dir is None:
@ -315,7 +321,7 @@ def format_translation_includes(header, body):
list = sorted(set(p.findall(body)))
for item in list:
directory = ''
if item != 'CefBase':
if not is_base_class(item):
cls = header.get_class(item)
dir = cls.get_file_directory()
if not dir is None:
@ -383,9 +389,9 @@ _cre_cfnameorpath = '([A-Za-z0-9_\/]{1,})'
# regex for matching function return values
_cre_retval = '([A-Za-z0-9_<>:,\*\&]{1,})'
# regex for matching typedef value and name combination
_cre_typedef = '([A-Za-z0-9_<>:,\*\& ]{1,})'
_cre_typedef = '([A-Za-z0-9_<>:,\*\&\s]{1,})'
# regex for matching function return value and name combination
_cre_func = '([A-Za-z][A-Za-z0-9_<>:,\*\& ]{1,})'
_cre_func = '([A-Za-z][A-Za-z0-9_<>:,\*\&\s]{1,})'
# regex for matching virtual function modifiers
_cre_vfmod = '([A-Za-z0-9_]{0,})'
# regex for matching arbitrary whitespace
@ -554,8 +560,8 @@ class obj_header:
pos = value.rfind(' ')
if pos < 0:
raise Exception('Invalid typedef: '+value)
alias = value[pos+1:]
value = value[:pos]
alias = value[pos+1:].strip()
value = value[:pos].strip()
self.typedefs.append(obj_typedef(self, filename, value, alias))
# extract global functions
@ -592,7 +598,7 @@ class obj_header:
# build the class objects
for attrib, name, parent_name, body in list:
comment = get_comment(data, name+' : public')
comment = get_comment(data, name+' :')
validate_comment(filename, name, comment)
self.classes.append(
obj_class(self, filename, attrib, name, parent_name, body,
@ -673,6 +679,20 @@ class obj_header:
result.append(cls.get_name())
return result
def get_base_class_name(self, classname):
""" Returns the base (root) class name for |classname|. """
cur_cls = self.get_class(classname)
while True:
parent_name = cur_cls.get_parent_name()
if is_base_class(parent_name):
return parent_name
else:
parent_cls = self.get_class(parent_name)
if parent_cls is None:
break
cur_cls = self.get_class(parent_name)
return None
def get_types(self, list):
""" Return a dictionary mapping data types to analyzed values. """
for cls in self.typedefs:
@ -695,7 +715,7 @@ class obj_header:
def get_defined_structs(self):
""" Return a list of already defined structure names. """
return ['cef_print_info_t', 'cef_window_info_t', 'cef_base_t']
return ['cef_print_info_t', 'cef_window_info_t', 'cef_base_t', 'cef_base_scoped_t']
def get_capi_translations(self):
""" Return a dictionary that maps C++ terminology to C API terminology.
@ -760,8 +780,8 @@ class obj_class:
pos = value.rfind(' ')
if pos < 0:
raise Exception('Invalid typedef: '+value)
alias = value[pos+1:]
value = value[:pos]
alias = value[pos+1:].strip()
value = value[:pos].strip()
self.typedefs.append(obj_typedef(self, filename, value, alias))
# extract static functions
@ -856,16 +876,16 @@ class obj_class:
def has_parent(self, parent_name):
""" Returns true if this class has the specified class anywhere in its
inheritance hierarchy. """
# Every class has CefBase as the top-most parent.
if parent_name == 'CefBase' or parent_name == self.parent_name:
# Every class has a known base class as the top-most parent.
if is_base_class(parent_name) or parent_name == self.parent_name:
return True
if self.parent_name == 'CefBase':
if is_base_class(self.parent_name):
return False
cur_cls = self.parent.get_class(self.parent_name)
while True:
cur_parent_name = cur_cls.get_parent_name()
if cur_parent_name == 'CefBase':
if is_base_class(cur_parent_name):
break
elif cur_parent_name == parent_name:
return True
@ -1214,7 +1234,7 @@ class obj_function:
this_is_library_side = True
header = self.parent
if other_class_name == 'CefBase':
if is_base_class(other_class_name):
other_is_library_side = False
else:
other_class = header.get_class(other_class_name)
@ -1386,17 +1406,17 @@ class obj_argument:
return 'string_byref_const'
return 'string_byref'
# refptr type
if self.type.is_result_refptr():
same_side = self.parent.is_same_side(self.type.get_refptr_type())
# *ptr type
if self.type.is_result_ptr():
prefix = self.type.get_result_ptr_type_prefix()
same_side = self.parent.is_same_side(self.type.get_ptr_type())
if self.type.is_byref():
if same_side:
return 'refptr_same_byref'
return 'refptr_diff_byref'
return prefix + 'ptr_same_byref'
return prefix + 'ptr_diff_byref'
if same_side:
return 'refptr_same'
return 'refptr_diff'
return prefix + 'ptr_same'
return prefix + 'ptr_diff'
if self.type.is_result_vector():
# all vector types must be passed by reference
@ -1421,17 +1441,17 @@ class obj_argument:
return 'bool_vec_byref_const'
return 'bool_vec_byref'
if self.type.is_result_vector_refptr():
# refptr vector types
same_side = self.parent.is_same_side(self.type.get_refptr_type())
if self.type.is_result_vector_ptr():
# *ptr vector types
prefix = self.type.get_result_vector_ptr_type_prefix()
same_side = self.parent.is_same_side(self.type.get_ptr_type())
if self.type.is_const():
if same_side:
return 'refptr_vec_same_byref_const'
return 'refptr_vec_diff_byref_const'
return prefix + 'ptr_vec_same_byref_const'
return prefix + 'ptr_vec_diff_byref_const'
if same_side:
return 'refptr_vec_same_byref'
return 'refptr_vec_diff_byref'
return prefix + 'ptr_vec_same_byref'
return prefix + 'ptr_vec_diff_byref'
# string single map type
if self.type.is_result_map_single():
@ -1476,11 +1496,12 @@ class obj_argument:
if self.type.is_result_string():
return 'string'
if self.type.is_result_refptr():
if self.parent.is_same_side(self.type.get_refptr_type()):
return 'refptr_same'
if self.type.is_result_ptr():
prefix = self.type.get_result_ptr_type_prefix()
if self.parent.is_same_side(self.type.get_ptr_type()):
return prefix + 'ptr_same'
else:
return 'refptr_diff'
return prefix + 'ptr_diff'
return 'invalid'
@ -1509,8 +1530,14 @@ class obj_argument:
if for_capi:
return 'NULL'
return 'CefString()'
elif type == 'refptr_same' or type == 'refptr_diff':
elif type == 'refptr_same' or type == 'refptr_diff' or \
type == 'rawptr_same' or type == 'rawptr_diff':
return 'NULL'
elif type == 'ownptr_same' or type == 'ownptr_diff':
if for_capi:
return 'NULL'
else:
return 'CefOwnPtr<'+self.type.get_ptr_type()+'>()'
return ''
@ -1522,7 +1549,7 @@ class obj_analysis:
self.result_type = 'unknown'
self.result_value = None
self.result_default = None
self.refptr_type = None
self.ptr_type = None
# parse the argument string
partlist = string.split(string.strip(value))
@ -1626,8 +1653,8 @@ class obj_analysis:
if not basic is None:
self.result_type = basic['result_type']
self.result_value = basic['result_value']
if 'refptr_type' in basic:
self.refptr_type = basic['refptr_type']
if 'ptr_type' in basic:
self.ptr_type = basic['ptr_type']
if 'result_default' in basic:
self.result_default = basic['result_default']
return True
@ -1664,7 +1691,27 @@ class obj_analysis:
return {
'result_type' : 'refptr',
'result_value' : get_capi_name(list[0], True)+'*',
'refptr_type' : list[0]
'ptr_type' : list[0]
}
# check for CEF owned pointers
p = re.compile('^CefOwnPtr<(.*?)>$', re.DOTALL)
list = p.findall(value)
if len(list) == 1:
return {
'result_type' : 'ownptr',
'result_value' : get_capi_name(list[0], True)+'*',
'ptr_type' : list[0]
}
# check for CEF raw pointers
p = re.compile('^CefRawPtr<(.*?)>$', re.DOTALL)
list = p.findall(value)
if len(list) == 1:
return {
'result_type' : 'rawptr',
'result_value' : get_capi_name(list[0], True)+'*',
'ptr_type' : list[0]
}
# check for CEF structure types
@ -1695,13 +1742,13 @@ class obj_analysis:
""" Return the C++ type. """
return self.type
def get_refptr_type(self):
def get_ptr_type(self):
""" Return the C++ class type referenced by a CefRefPtr. """
if self.is_result_vector() and self.is_result_vector_refptr():
if self.is_result_vector() and self.is_result_vector_ptr():
# return the vector RefPtr type
return self.result_value[0]['refptr_type']
return self.result_value[0]['ptr_type']
# return the basic RefPtr type
return self.refptr_type
return self.ptr_type
def get_vector_type(self):
""" Return the C++ class type referenced by a std::vector. """
@ -1743,16 +1790,17 @@ class obj_analysis:
""" Return the default value fo the basic type. """
return self.result_default
def is_result_refptr(self):
""" Returns true if this is a reference pointer type. """
return (self.result_type == 'refptr')
def is_result_ptr(self):
""" Returns true if this is a *Ptr type. """
return self.is_result_refptr() or self.is_result_ownptr() or \
self.is_result_rawptr()
def get_result_refptr_type_root(self):
""" Return the refptr type structure name. """
def get_result_ptr_type_root(self):
""" Return the *Ptr type structure name. """
return self.result_value[:-1]
def get_result_refptr_type(self, defined_structs = []):
""" Return the refptr type. """
def get_result_ptr_type(self, defined_structs = []):
""" Return the *Ptr type. """
result = ''
if not self.result_value[:-1] in defined_structs:
result += 'struct _'
@ -1761,6 +1809,28 @@ class obj_analysis:
result += '*'
return result
def get_result_ptr_type_prefix(self):
""" Returns the *Ptr type prefix. """
if self.is_result_refptr():
return 'ref'
if self.is_result_ownptr():
return 'own'
if self.is_result_rawptr():
return 'raw'
raise Exception('Not a pointer type')
def is_result_refptr(self):
""" Returns true if this is a RefPtr type. """
return (self.result_type == 'refptr')
def is_result_ownptr(self):
""" Returns true if this is a OwnPtr type. """
return (self.result_type == 'ownptr')
def is_result_rawptr(self):
""" Returns true if this is a RawPtr type. """
return (self.result_type == 'rawptr')
def is_result_struct(self):
""" Returns true if this is a structure type. """
return (self.result_type == 'structure')
@ -1816,10 +1886,34 @@ class obj_analysis:
""" Returns true if this is a string vector. """
return self.result_value[0]['result_type'] == 'simple'
def is_result_vector_ptr(self):
""" Returns true if this is a *Ptr vector. """
return self.is_result_vector_refptr() or \
self.is_result_vector_ownptr() or \
self.is_result_vector_rawptr()
def get_result_vector_ptr_type_prefix(self):
""" Returns the *Ptr type prefix. """
if self.is_result_vector_refptr():
return 'ref'
if self.is_result_vector_ownptr():
return 'own'
if self.is_result_vector_rawptr():
return 'raw'
raise Exception('Not a pointer type')
def is_result_vector_refptr(self):
""" Returns true if this is a string vector. """
""" Returns true if this is a RefPtr vector. """
return self.result_value[0]['result_type'] == 'refptr'
def is_result_vector_ownptr(self):
""" Returns true if this is a OwnPtr vector. """
return self.result_value[0]['result_type'] == 'ownptr'
def is_result_vector_rawptr(self):
""" Returns true if this is a RawPtr vector. """
return self.result_value[0]['result_type'] == 'rawptr'
def get_result_vector_type_root(self):
""" Return the vector structure or basic type name. """
return self.result_value[0]['result_value']
@ -1844,7 +1938,7 @@ class obj_analysis:
str += ' const'
str += '*'
result['value'] = str
elif type == 'refptr':
elif type == 'refptr' or type == 'ownptr' or type == 'rawptr':
str = ''
if not value[:-1] in defined_structs:
str += 'struct _'
@ -1897,8 +1991,8 @@ class obj_analysis:
format = 'single'
if self.is_result_simple():
result += self.get_result_simple_type()
elif self.is_result_refptr():
result += self.get_result_refptr_type(defined_structs)
elif self.is_result_ptr():
result += self.get_result_ptr_type(defined_structs)
elif self.is_result_struct():
result += self.get_result_struct_type(defined_structs)
elif self.is_result_string():

View File

@ -51,10 +51,17 @@ def make_cpptoc_header(header, clsname):
result += '#include "include/'+dcls.get_file_name()+'"\n' \
'#include "include/capi/'+dcls.get_capi_file_name()+'"\n'
result += """#include "libcef_dll/cpptoc/cpptoc.h"
base_class_name = header.get_base_class_name(clsname)
base_scoped = True if base_class_name == 'CefBaseScoped' else False
if base_scoped:
template_file = 'cpptoc_scoped.h'
template_class = 'CefCppToCScoped'
else:
template_file = 'cpptoc.h'
template_class = 'CefCppToC'
// Wrap a C++ class with a C structure.
"""
result += '#include "libcef_dll/cpptoc/' + template_file + '"'
result += '\n\n// Wrap a C++ class with a C structure.\n'
if dllside:
result += '// This class may be instantiated and accessed DLL-side only.\n'
@ -62,7 +69,7 @@ def make_cpptoc_header(header, clsname):
result += '// This class may be instantiated and accessed wrapper-side only.\n'
result += 'class '+clsname+'CppToC\n'+ \
' : public CefCppToC<'+clsname+'CppToC, '+clsname+', '+capiname+'> {\n'+ \
' : public ' + template_class + '<'+clsname+'CppToC, '+clsname+', '+capiname+'> {\n'+ \
' public:\n'+ \
' '+clsname+'CppToC();\n'+ \
'};\n\n'

View File

@ -94,6 +94,10 @@ def make_cpptoc_function_impl_new(cls, name, func, defined_names):
arg_type == 'string_byref_const' or arg_type == 'string_byref' or \
arg_type == 'refptr_same' or arg_type == 'refptr_same_byref' or \
arg_type == 'refptr_diff' or arg_type == 'refptr_diff_byref' or \
arg_type == 'ownptr_same' or arg_type == 'ownptr_same_byref' or \
arg_type == 'ownptr_diff' or arg_type == 'ownptr_diff_byref' or \
arg_type == 'rawptr_same' or arg_type == 'rawptr_same_byref' or \
arg_type == 'rawptr_diff' or arg_type == 'rawptr_diff_byref' or \
arg_type == 'string_vec_byref' or arg_type == 'string_vec_byref_const' or \
arg_type == 'string_map_single_byref' or arg_type == 'string_map_single_byref_const' or \
arg_type == 'string_map_multi_byref' or arg_type == 'string_map_multi_byref_const':
@ -102,13 +106,17 @@ def make_cpptoc_function_impl_new(cls, name, func, defined_names):
'\n if (!'+arg_name+')'\
'\n return'+retval_default+';'
elif arg_type == 'simple_vec_byref' or arg_type == 'bool_vec_byref' or \
arg_type == 'refptr_vec_same_byref' or arg_type == 'refptr_vec_diff_byref':
arg_type == 'refptr_vec_same_byref' or arg_type == 'refptr_vec_diff_byref' or \
arg_type == 'ownptr_vec_same_byref' or arg_type == 'ownptr_vec_diff_byref' or \
arg_type == 'rawptr_vec_same_byref' or arg_type == 'rawptr_vec_diff_byref':
result += comment+\
'\n DCHECK('+arg_name+'Count && (*'+arg_name+'Count == 0 || '+arg_name+'));'\
'\n if (!'+arg_name+'Count || (*'+arg_name+'Count > 0 && !'+arg_name+'))'\
'\n return'+retval_default+';'
elif arg_type == 'simple_vec_byref_const' or arg_type == 'bool_vec_byref_const' or \
arg_type == 'refptr_vec_same_byref_const' or arg_type == 'refptr_vec_diff_byref_const':
arg_type == 'refptr_vec_same_byref_const' or arg_type == 'refptr_vec_diff_byref_const' or \
arg_type == 'ownptr_vec_same_byref_const' or arg_type == 'ownptr_vec_diff_byref_const' or \
arg_type == 'rawptr_vec_same_byref_const' or arg_type == 'rawptr_vec_diff_byref_const':
result += comment+\
'\n DCHECK('+arg_name+'Count == 0 || '+arg_name+');'\
'\n if ('+arg_name+'Count > 0 && !'+arg_name+')'\
@ -184,22 +192,36 @@ def make_cpptoc_function_impl_new(cls, name, func, defined_names):
'\n CefString '+arg_name+'Str('+arg_name+');'
params.append(arg_name+'Str')
elif arg_type == 'refptr_same' or arg_type == 'refptr_diff':
refptr_class = arg.get_type().get_refptr_type()
ptr_class = arg.get_type().get_ptr_type()
if arg_type == 'refptr_same':
params.append(refptr_class+'CppToC::Unwrap('+arg_name+')')
params.append(ptr_class+'CppToC::Unwrap('+arg_name+')')
else:
params.append(refptr_class+'CToCpp::Wrap('+arg_name+')')
elif arg_type == 'refptr_same_byref' or arg_type == 'refptr_diff_byref':
refptr_class = arg.get_type().get_refptr_type()
if arg_type == 'refptr_same_byref':
assign = refptr_class+'CppToC::Unwrap(*'+arg_name+')'
params.append(ptr_class+'CToCpp::Wrap('+arg_name+')')
elif arg_type == 'ownptr_same' or arg_type == 'rawptr_same':
ptr_class = arg.get_type().get_ptr_type()
if arg_type == 'ownptr_same':
params.append(ptr_class+'CppToC::UnwrapOwn('+arg_name+')')
else:
assign = refptr_class+'CToCpp::Wrap(*'+arg_name+')'
params.append(ptr_class+'CppToC::UnwrapRaw('+arg_name+')')
elif arg_type == 'ownptr_diff' or arg_type == 'rawptr_diff':
ptr_class = arg.get_type().get_ptr_type()
result += comment+\
'\n CefRefPtr<'+refptr_class+'> '+arg_name+'Ptr;'\
'\n CefOwnPtr<'+ptr_class+'> '+arg_name+'Ptr('+ptr_class+'CToCpp::Wrap('+arg_name+'));'
if arg_type == 'ownptr_diff':
params.append('OWN_PASS('+arg_name+'Ptr)')
else:
params.append(arg_name+'Ptr.get()')
elif arg_type == 'refptr_same_byref' or arg_type == 'refptr_diff_byref':
ptr_class = arg.get_type().get_ptr_type()
if arg_type == 'refptr_same_byref':
assign = ptr_class+'CppToC::Unwrap(*'+arg_name+')'
else:
assign = ptr_class+'CToCpp::Wrap(*'+arg_name+')'
result += comment+\
'\n CefRefPtr<'+ptr_class+'> '+arg_name+'Ptr;'\
'\n if ('+arg_name+' && *'+arg_name+')'\
'\n '+arg_name+'Ptr = '+assign+';'\
'\n '+refptr_class+'* '+arg_name+'Orig = '+arg_name+'Ptr.get();'
'\n '+ptr_class+'* '+arg_name+'Orig = '+arg_name+'Ptr.get();'
params.append(arg_name+'Ptr')
elif arg_type == 'string_vec_byref' or arg_type == 'string_vec_byref_const':
result += comment+\
@ -224,11 +246,11 @@ def make_cpptoc_function_impl_new(cls, name, func, defined_names):
elif arg_type == 'bool_vec_byref':
assign = arg_name+'[i]?true:false'
elif arg_type == 'refptr_vec_same_byref':
refptr_class = arg.get_type().get_refptr_type()
assign = refptr_class+'CppToC::Unwrap('+arg_name+'[i])'
ptr_class = arg.get_type().get_ptr_type()
assign = ptr_class+'CppToC::Unwrap('+arg_name+'[i])'
elif arg_type == 'refptr_vec_diff_byref':
refptr_class = arg.get_type().get_refptr_type()
assign = refptr_class+'CToCpp::Wrap('+arg_name+'[i])'
ptr_class = arg.get_type().get_ptr_type()
assign = ptr_class+'CToCpp::Wrap('+arg_name+'[i])'
result += comment+\
'\n std::vector<'+vec_type+' > '+arg_name+'List;'\
'\n if ('+arg_name+'Count && *'+arg_name+'Count > 0 && '+arg_name+') {'\
@ -238,18 +260,23 @@ def make_cpptoc_function_impl_new(cls, name, func, defined_names):
'\n }'
params.append(arg_name+'List')
elif arg_type == 'simple_vec_byref_const' or arg_type == 'bool_vec_byref_const' or \
arg_type == 'refptr_vec_same_byref_const' or arg_type == 'refptr_vec_diff_byref_const':
arg_type == 'refptr_vec_same_byref_const' or arg_type == 'refptr_vec_diff_byref_const' or \
arg_type == 'rawptr_vec_same_byref_const' or arg_type == 'rawptr_vec_diff_byref_const':
vec_type = arg.get_type().get_vector_type()
if arg_type == 'simple_vec_byref_const':
assign = arg_name+'[i]'
elif arg_type == 'bool_vec_byref_const':
assign = arg_name+'[i]?true:false'
elif arg_type == 'refptr_vec_same_byref_const':
refptr_class = arg.get_type().get_refptr_type()
assign = refptr_class+'CppToC::Unwrap('+arg_name+'[i])'
else:
ptr_class = arg.get_type().get_ptr_type()
if arg_type == 'refptr_vec_same_byref_const':
assign = ptr_class+'CppToC::Unwrap('+arg_name+'[i])'
elif arg_type == 'refptr_vec_diff_byref_const':
refptr_class = arg.get_type().get_refptr_type()
assign = refptr_class+'CToCpp::Wrap('+arg_name+'[i])'
assign = ptr_class+'CToCpp::Wrap('+arg_name+'[i])'
elif arg_type == 'rawptr_vec_same_byref_const':
assign = ptr_class+'CppToC::UnwrapRaw('+arg_name+'[i])'
elif arg_type == 'rawptr_vec_diff_byref_const':
assign = ptr_class+'CToCpp::Wrap('+arg_name+'[i]).release()'
result += comment+\
'\n std::vector<'+vec_type+' > '+arg_name+'List;'\
'\n if ('+arg_name+'Count > 0) {'\
@ -259,6 +286,8 @@ def make_cpptoc_function_impl_new(cls, name, func, defined_names):
'\n }'\
'\n }'
params.append(arg_name+'List')
else:
raise Exception('Unsupported argument type %s for parameter %s in %s' % (arg_type, arg_name, name))
if len(result) != result_len:
result += '\n'
@ -315,11 +344,11 @@ def make_cpptoc_function_impl_new(cls, name, func, defined_names):
'\n if ('+arg_name+')'\
'\n '+arg_name+'Obj.DetachTo(*'+arg_name+');'
elif arg_type == 'refptr_same_byref' or arg_type == 'refptr_diff_byref':
refptr_class = arg.get_type().get_refptr_type()
ptr_class = arg.get_type().get_ptr_type()
if arg_type == 'refptr_same_byref':
assign = refptr_class+'CppToC::Wrap('+arg_name+'Ptr)'
assign = ptr_class+'CppToC::Wrap('+arg_name+'Ptr)'
else:
assign = refptr_class+'CToCpp::Unwrap('+arg_name+'Ptr)'
assign = ptr_class+'CToCpp::Unwrap('+arg_name+'Ptr)'
result += comment+\
'\n if ('+arg_name+') {'\
'\n if ('+arg_name+'Ptr.get()) {'\
@ -347,11 +376,11 @@ def make_cpptoc_function_impl_new(cls, name, func, defined_names):
if arg_type == 'simple_vec_byref' or arg_type == 'bool_vec_byref':
assign = arg_name+'List[i]'
elif arg_type == 'refptr_vec_same_byref':
refptr_class = arg.get_type().get_refptr_type()
assign = refptr_class+'CppToC::Wrap('+arg_name+'List[i])'
ptr_class = arg.get_type().get_ptr_type()
assign = ptr_class+'CppToC::Wrap('+arg_name+'List[i])'
elif arg_type == 'refptr_vec_diff_byref':
refptr_class = arg.get_type().get_refptr_type()
assign = refptr_class+'CToCpp::Unwrap('+arg_name+'List[i])'
ptr_class = arg.get_type().get_ptr_type()
assign = ptr_class+'CToCpp::Unwrap('+arg_name+'List[i])'
result += comment+\
'\n if ('+arg_name+'Count && '+arg_name+') {'\
'\n *'+arg_name+'Count = std::min('+arg_name+'List.size(), *'+arg_name+'Count);'\
@ -361,6 +390,13 @@ def make_cpptoc_function_impl_new(cls, name, func, defined_names):
'\n }'\
'\n }'\
'\n }'
elif arg_type == 'rawptr_vec_diff_byref_const':
result += comment+\
'\n if ('+arg_name+'Count > 0) {'\
'\n for (size_t i = 0; i < '+arg_name+'Count; ++i) {'\
'\n delete '+arg_name+'List[i];'\
'\n }'\
'\n }'
if len(result) != result_len:
result += '\n'
@ -401,11 +437,19 @@ def make_cpptoc_function_impl_new(cls, name, func, defined_names):
elif retval_type == 'string':
result += '\n return _retval.DetachToUserFree();'
elif retval_type == 'refptr_same':
refptr_class = retval.get_type().get_refptr_type()
result += '\n return '+refptr_class+'CppToC::Wrap(_retval);'
ptr_class = retval.get_type().get_ptr_type()
result += '\n return '+ptr_class+'CppToC::Wrap(_retval);'
elif retval_type == 'refptr_diff':
refptr_class = retval.get_type().get_refptr_type()
result += '\n return '+refptr_class+'CToCpp::Unwrap(_retval);'
ptr_class = retval.get_type().get_ptr_type()
result += '\n return '+ptr_class+'CToCpp::Unwrap(_retval);'
elif retval_type == 'ownptr_same':
ptr_class = retval.get_type().get_ptr_type()
result += '\n return '+ptr_class+'CppToC::WrapOwn(OWN_PASS(_retval));'
elif retval_type == 'ownptr_diff':
ptr_class = retval.get_type().get_ptr_type()
result += '\n return '+ptr_class+'CToCpp::UnwrapOwn(OWN_PASS(_retval));'
else:
raise Exception('Unsupported return type %s in %s' % (retval_type, name))
if len(result) != result_len:
result += '\n'
@ -437,7 +481,7 @@ def make_cpptoc_virtual_function_impl(header, cls, existing, prefixname, defined
cur_cls = cls
while True:
parent_name = cur_cls.get_parent_name()
if parent_name == 'CefBase':
if is_base_class(parent_name):
break
else:
parent_cls = header.get_class(parent_name, defined_names)
@ -463,7 +507,7 @@ def make_cpptoc_virtual_function_assignment(header, cls, prefixname, defined_nam
while True:
parent_name = cur_cls.get_parent_name()
offset += 'base.'
if parent_name == 'CefBase':
if is_base_class(parent_name):
break
else:
parent_cls = header.get_class(parent_name, defined_names)
@ -474,19 +518,31 @@ def make_cpptoc_virtual_function_assignment(header, cls, prefixname, defined_nam
return impl
def make_cpptoc_unwrap_derived(header, cls):
def make_cpptoc_unwrap_derived(header, cls, base_scoped):
# identify all classes that derive from cls
derived_classes = []
clsname = cls.get_name()
cur_clsname = cls.get_name()
allclasses = header.get_classes()
for cur_cls in allclasses:
if cur_cls.get_name() == clsname:
if cur_cls.get_name() == cur_clsname:
continue
if cur_cls.has_parent(clsname):
if cur_cls.has_parent(cur_clsname):
derived_classes.append(cur_cls.get_name())
derived_classes = sorted(derived_classes)
if base_scoped:
impl = ['', '']
for clsname in derived_classes:
impl[0] += ' if (type == '+get_wrapper_type_enum(clsname)+') {\n'+\
' return OWN_RETURN_AS('+clsname+'CppToC::UnwrapOwn(reinterpret_cast<'+\
get_capi_name(clsname, True)+'*>(s)), '+cur_clsname+');\n'+\
' }\n'
impl[1] += ' if (type == '+get_wrapper_type_enum(clsname)+') {\n'+\
' return '+clsname+'CppToC::UnwrapRaw(reinterpret_cast<'+\
get_capi_name(clsname, True)+'*>(s));\n'+\
' }\n'
else:
impl = ''
for clsname in derived_classes:
impl += ' if (type == '+get_wrapper_type_enum(clsname)+') {\n'+\
@ -510,6 +566,13 @@ def make_cpptoc_class_impl(header, clsname, impl):
# retrieve the existing virtual function implementations
existing = get_function_impls(impl, 'CEF_CALLBACK')
base_class_name = header.get_base_class_name(clsname)
base_scoped = True if base_class_name == 'CefBaseScoped' else False
if base_scoped:
template_class = 'CefCppToCScoped'
else:
template_class = 'CefCppToC'
# generate virtual functions
virtualimpl = make_cpptoc_virtual_function_impl(header, cls, existing, prefixname, defined_names)
if len(virtualimpl) > 0:
@ -529,31 +592,43 @@ def make_cpptoc_class_impl(header, clsname, impl):
resultingimpl = staticimpl + virtualimpl
# any derived classes can be unwrapped
unwrapderived = make_cpptoc_unwrap_derived(header, cls)
unwrapderived = make_cpptoc_unwrap_derived(header, cls, base_scoped)
# determine what includes are required by identifying what translation
# classes are being used
includes = format_translation_includes(header, resultingimpl + unwrapderived)
includes = format_translation_includes(header, resultingimpl + (unwrapderived[0] if base_scoped else unwrapderived))
# build the final output
result = get_copyright()
result += includes+'\n'+resultingimpl+'\n'
parent_sig = 'CefCppToC<'+clsname+'CppToC, '+clsname+', '+capiname+'>'
parent_sig = template_class+'<'+clsname+'CppToC, '+clsname+', '+capiname+'>'
const = '// CONSTRUCTOR - Do not edit by hand.\n\n'+ \
clsname+'CppToC::'+clsname+'CppToC() {\n'
const += make_cpptoc_virtual_function_assignment(header, cls, prefixname, defined_names)
const += '}\n\n'
const += '}\n\n'+ \
'template<> CefRefPtr<'+clsname+'> '+parent_sig+'::UnwrapDerived(CefWrapperType type, '+capiname+'* s) {\n' + \
if base_scoped:
const += 'template<> CefOwnPtr<'+clsname+'> '+parent_sig+'::UnwrapDerivedOwn(CefWrapperType type, '+capiname+'* s) {\n' + \
unwrapderived[0] + \
' NOTREACHED() << "Unexpected class type: " << type;\n'+ \
' return CefOwnPtr<'+clsname+'>();\n'+ \
'}\n\n' + \
'template<> CefRawPtr<'+clsname+'> '+parent_sig+'::UnwrapDerivedRaw(CefWrapperType type, '+capiname+'* s) {\n' + \
unwrapderived[1] + \
' NOTREACHED() << "Unexpected class type: " << type;\n'+ \
' return NULL;\n'+ \
'}\n\n'
else:
const += 'template<> CefRefPtr<'+clsname+'> '+parent_sig+'::UnwrapDerived(CefWrapperType type, '+capiname+'* s) {\n' + \
unwrapderived + \
' NOTREACHED() << "Unexpected class type: " << type;\n'+ \
' return NULL;\n'+ \
'}\n\n'+ \
'#if DCHECK_IS_ON()\n'+ \
'}\n\n'
const += '#if DCHECK_IS_ON()\n'+ \
'template<> base::AtomicRefCount '+parent_sig+'::DebugObjCt = 0;\n'+ \
'#endif\n\n'+ \
'template<> CefWrapperType '+parent_sig+'::kWrapperType = '+get_wrapper_type_enum(clsname)+';'

View File

@ -23,7 +23,7 @@ def make_function_body(header, cls):
cur_cls = cls
while True:
parent_name = cur_cls.get_parent_name()
if parent_name == 'CefBase':
if is_base_class(parent_name):
break
else:
parent_cls = header.get_class(parent_name)
@ -92,10 +92,17 @@ def make_ctocpp_header(header, clsname):
result += '#include "include/'+dcls.get_file_name()+'"\n' \
'#include "include/capi/'+dcls.get_capi_file_name()+'"\n'
result += """#include "libcef_dll/ctocpp/ctocpp.h"
base_class_name = header.get_base_class_name(clsname)
base_scoped = True if base_class_name == 'CefBaseScoped' else False
if base_scoped:
template_file = 'ctocpp_scoped.h'
template_class = 'CefCToCppScoped'
else:
template_file = 'ctocpp.h'
template_class = 'CefCToCpp'
// Wrap a C structure with a C++ class.
"""
result += '#include "libcef_dll/ctocpp/' + template_file + '"'
result += '\n\n// Wrap a C structure with a C++ class.\n'
if clientside:
result += '// This class may be instantiated and accessed DLL-side only.\n'
@ -103,7 +110,7 @@ def make_ctocpp_header(header, clsname):
result += '// This class may be instantiated and accessed wrapper-side only.\n'
result += 'class '+clsname+'CToCpp\n'+ \
' : public CefCToCpp<'+clsname+'CToCpp, '+clsname+', '+capiname+'> {\n'+ \
' : public ' + template_class + '<'+clsname+'CToCpp, '+clsname+', '+capiname+'> {\n'+ \
' public:\n'+ \
' '+clsname+'CToCpp();\n\n'

View File

@ -117,11 +117,17 @@ def make_ctocpp_function_impl_new(clsname, name, func):
'\n DCHECK('+arg_name+');'\
'\n if (!'+arg_name+')'\
'\n return'+retval_default+';'
elif arg_type == 'refptr_same' or arg_type == 'refptr_diff':
elif arg_type == 'refptr_same' or arg_type == 'refptr_diff' or \
arg_type == 'ownptr_same' or arg_type == 'ownptr_diff':
result += comment+\
'\n DCHECK('+arg_name+'.get());'\
'\n if (!'+arg_name+'.get())'\
'\n return'+retval_default+';'
elif arg_type == 'rawptr_same' or arg_type == 'rawptr_diff':
result += comment+\
'\n DCHECK('+arg_name+');'\
'\n if (!'+arg_name+')'\
'\n return'+retval_default+';'
elif arg_type == 'string_byref_const':
result += comment+\
'\n DCHECK(!'+arg_name+'.empty());'\
@ -181,23 +187,37 @@ def make_ctocpp_function_impl_new(clsname, name, func):
elif arg_type == 'string_byref':
params.append(arg_name+'.GetWritableStruct()')
elif arg_type == 'refptr_same':
refptr_class = arg.get_type().get_refptr_type()
params.append(refptr_class+'CToCpp::Unwrap('+arg_name+')')
ptr_class = arg.get_type().get_ptr_type()
params.append(ptr_class+'CToCpp::Unwrap('+arg_name+')')
elif arg_type == 'ownptr_same':
ptr_class = arg.get_type().get_ptr_type()
params.append(ptr_class+'CToCpp::UnwrapOwn(OWN_PASS('+arg_name+'))')
elif arg_type == 'rawptr_same':
ptr_class = arg.get_type().get_ptr_type()
params.append(ptr_class+'CToCpp::UnwrapRaw('+arg_name+')')
elif arg_type == 'refptr_diff':
refptr_class = arg.get_type().get_refptr_type()
params.append(refptr_class+'CppToC::Wrap('+arg_name+')')
elif arg_type == 'refptr_same_byref' or arg_type == 'refptr_diff_byref':
refptr_class = arg.get_type().get_refptr_type()
refptr_struct = arg.get_type().get_result_refptr_type_root()
if arg_type == 'refptr_same_byref':
assign = refptr_class+'CToCpp::Unwrap('+arg_name+')'
else:
assign = refptr_class+'CppToC::Wrap('+arg_name+')'
ptr_class = arg.get_type().get_ptr_type()
params.append(ptr_class+'CppToC::Wrap('+arg_name+')')
elif arg_type == 'ownptr_diff':
ptr_class = arg.get_type().get_ptr_type()
params.append(ptr_class+'CppToC::WrapOwn(OWN_PASS('+arg_name+'))')
elif arg_type == 'rawptr_diff':
ptr_class = arg.get_type().get_ptr_type()
result += comment+\
'\n '+refptr_struct+'* '+arg_name+'Struct = NULL;'\
'\n CefOwnPtr<'+ptr_class+'CppToC> '+arg_name+'Ptr('+ptr_class+'CppToC::WrapRaw('+arg_name+'));'
params.append(arg_name+'Ptr->GetStruct()')
elif arg_type == 'refptr_same_byref' or arg_type == 'refptr_diff_byref':
ptr_class = arg.get_type().get_ptr_type()
ptr_struct = arg.get_type().get_result_ptr_type_root()
if arg_type == 'refptr_same_byref':
assign = ptr_class+'CToCpp::Unwrap('+arg_name+')'
else:
assign = ptr_class+'CppToC::Wrap('+arg_name+')'
result += comment+\
'\n '+ptr_struct+'* '+arg_name+'Struct = NULL;'\
'\n if ('+arg_name+'.get())'\
'\n '+arg_name+'Struct = '+assign+';'\
'\n '+refptr_struct+'* '+arg_name+'Orig = '+arg_name+'Struct;'
'\n '+ptr_struct+'* '+arg_name+'Orig = '+arg_name+'Struct;'
params.append('&'+arg_name+'Struct')
elif arg_type == 'string_vec_byref' or arg_type == 'string_vec_byref_const':
result += comment+\
@ -225,11 +245,11 @@ def make_ctocpp_function_impl_new(clsname, name, func):
count_func = arg.get_attrib_count_func()
vec_type = arg.get_type().get_result_vector_type_root()
if arg_type == 'refptr_vec_same_byref':
refptr_class = arg.get_type().get_refptr_type()
assign = refptr_class+'CToCpp::Unwrap('+arg_name+'[i])'
ptr_class = arg.get_type().get_ptr_type()
assign = ptr_class+'CToCpp::Unwrap('+arg_name+'[i])'
elif arg_type == 'refptr_vec_diff_byref':
refptr_class = arg.get_type().get_refptr_type()
assign = refptr_class+'CppToC::Wrap('+arg_name+'[i])'
ptr_class = arg.get_type().get_ptr_type()
assign = ptr_class+'CppToC::Wrap('+arg_name+'[i])'
else:
assign = arg_name+'[i]'
result += comment+\
@ -251,17 +271,22 @@ def make_ctocpp_function_impl_new(clsname, name, func):
params.append('&'+arg_name+'Count')
params.append(arg_name+'List')
elif arg_type == 'simple_vec_byref_const' or arg_type == 'bool_vec_byref_const' or \
arg_type == 'refptr_vec_same_byref_const' or arg_type == 'refptr_vec_diff_byref_const':
arg_type == 'refptr_vec_same_byref_const' or arg_type == 'refptr_vec_diff_byref_const' or \
arg_type == 'rawptr_vec_same_byref_const' or arg_type == 'rawptr_vec_diff_byref_const':
count_func = arg.get_attrib_count_func()
vec_type = arg.get_type().get_result_vector_type_root()
if arg_type == 'refptr_vec_same_byref_const':
refptr_class = arg.get_type().get_refptr_type()
assign = refptr_class+'CToCpp::Unwrap('+arg_name+'[i])'
elif arg_type == 'refptr_vec_diff_byref_const':
refptr_class = arg.get_type().get_refptr_type()
assign = refptr_class+'CppToC::Wrap('+arg_name+'[i])'
else:
if arg_type == 'simple_vec_byref_const' or arg_type == 'bool_vec_byref_const':
assign = arg_name+'[i]'
else:
ptr_class = arg.get_type().get_ptr_type()
if arg_type == 'refptr_vec_same_byref_const':
assign = ptr_class+'CToCpp::Unwrap('+arg_name+'[i])'
elif arg_type == 'refptr_vec_diff_byref_const':
assign = ptr_class+'CppToC::Wrap('+arg_name+'[i])'
elif arg_type == 'rawptr_vec_same_byref_const':
assign = ptr_class+'CToCpp::UnwrapRaw('+arg_name+'[i])'
elif arg_type == 'rawptr_vec_diff_byref_const':
assign = ptr_class+'CppToC::WrapRaw('+arg_name+'[i]).release()->GetStruct()'
result += comment+\
'\n const size_t '+arg_name+'Count = '+arg_name+'.size();'\
'\n '+vec_type+'* '+arg_name+'List = NULL;'\
@ -276,6 +301,8 @@ def make_ctocpp_function_impl_new(clsname, name, func):
'\n }'
params.append(arg_name+'Count')
params.append(arg_name+'List')
else:
raise Exception('Unsupported argument type %s for parameter %s in %s' % (arg_type, arg_name, name))
if len(result) != result_len:
result += '\n'
@ -290,9 +317,12 @@ def make_ctocpp_function_impl_new(clsname, name, func):
result += retval.get_type().get_result_simple_type_root()
elif retval_type == 'string':
result += 'cef_string_userfree_t'
elif retval_type == 'refptr_same' or retval_type == 'refptr_diff':
refptr_struct = retval.get_type().get_result_refptr_type_root()
result += refptr_struct+'*'
elif retval_type == 'refptr_same' or retval_type == 'refptr_diff' or \
retval_type == 'ownptr_same' or retval_type == 'ownptr_diff':
ptr_struct = retval.get_type().get_result_ptr_type_root()
result += ptr_struct+'*'
else:
raise Exception('Unsupported return type %s in %s' % (retval_type, name))
result += ' _retval = '
@ -324,12 +354,12 @@ def make_ctocpp_function_impl_new(clsname, name, func):
'\n if ('+arg_name+')'\
'\n *'+arg_name+' = '+arg_name+'Int?true:false;'
elif arg_type == 'refptr_same_byref' or arg_type == 'refptr_diff_byref':
refptr_class = arg.get_type().get_refptr_type()
refptr_struct = arg.get_type().get_result_refptr_type_root()
ptr_class = arg.get_type().get_ptr_type()
ptr_struct = arg.get_type().get_result_ptr_type_root()
if arg_type == 'refptr_same_byref':
assign = refptr_class+'CToCpp::Wrap('+arg_name+'Struct)'
assign = ptr_class+'CToCpp::Wrap('+arg_name+'Struct)'
else:
assign = refptr_class+'CppToC::Unwrap('+arg_name+'Struct)'
assign = ptr_class+'CppToC::Unwrap('+arg_name+'Struct)'
result += comment+\
'\n if ('+arg_name+'Struct) {'\
'\n if ('+arg_name+'Struct != '+arg_name+'Orig) {'\
@ -376,11 +406,11 @@ def make_ctocpp_function_impl_new(clsname, name, func):
count_func = arg.get_attrib_count_func()
vec_type = arg.get_type().get_result_vector_type_root()
if arg_type == 'refptr_vec_same_byref':
refptr_class = arg.get_type().get_refptr_type()
assign = refptr_class+'CToCpp::Wrap('+arg_name+'List[i])'
ptr_class = arg.get_type().get_ptr_type()
assign = ptr_class+'CToCpp::Wrap('+arg_name+'List[i])'
elif arg_type == 'refptr_vec_diff_byref':
refptr_class = arg.get_type().get_refptr_type()
assign = refptr_class+'CppToC::Unwrap('+arg_name+'List[i])'
ptr_class = arg.get_type().get_ptr_type()
assign = ptr_class+'CppToC::Unwrap('+arg_name+'List[i])'
elif arg_type == 'bool_vec_byref':
assign = arg_name+'List[i]?true:false'
else:
@ -394,9 +424,16 @@ def make_ctocpp_function_impl_new(clsname, name, func):
'\n delete [] '+arg_name+'List;'\
'\n }'
elif arg_type == 'simple_vec_byref_const' or arg_type == 'bool_vec_byref_const' or \
arg_type == 'refptr_vec_same_byref_const' or arg_type == 'refptr_vec_diff_byref_const':
result += comment+\
'\n if ('+arg_name+'List)'\
arg_type == 'refptr_vec_same_byref_const' or arg_type == 'refptr_vec_diff_byref_const' or \
arg_type == 'rawptr_vec_same_byref_const' or arg_type == 'rawptr_vec_diff_byref_const':
result += comment
if arg_type == 'rawptr_vec_diff_byref_const':
result += '\n if ('+arg_name+'Count > 0) {'\
'\n for (size_t i = 0; i < '+arg_name+'Count; ++i) {'\
'\n delete '+ptr_class+'CppToC::GetWrapper('+arg_name+'List[i]);'\
'\n }'\
'\n }'
result += '\n if ('+arg_name+'List)'\
'\n delete [] '+arg_name+'List;'
if len(result) != result_len:
@ -441,12 +478,17 @@ def make_ctocpp_function_impl_new(clsname, name, func):
result += '\n CefString _retvalStr;'\
'\n _retvalStr.AttachToUserFree(_retval);'\
'\n return _retvalStr;'
elif retval_type == 'refptr_same':
refptr_class = retval.get_type().get_refptr_type()
result += '\n return '+refptr_class+'CToCpp::Wrap(_retval);'
elif retval_type == 'refptr_same' or retval_type == 'ownptr_same':
ptr_class = retval.get_type().get_ptr_type()
result += '\n return '+ptr_class+'CToCpp::Wrap(_retval);'
elif retval_type == 'refptr_diff':
refptr_class = retval.get_type().get_refptr_type()
result += '\n return '+refptr_class+'CppToC::Unwrap(_retval);'
ptr_class = retval.get_type().get_ptr_type()
result += '\n return '+ptr_class+'CppToC::Unwrap(_retval);'
elif retval_type == 'ownptr_diff':
ptr_class = retval.get_type().get_ptr_type()
result += '\n return '+ptr_class+'CppToC::UnwrapOwn(_retval);'
else:
raise Exception('Unsupported return type %s in %s' % (retval_type, name))
if len(result) != result_len:
result += '\n'
@ -475,7 +517,7 @@ def make_ctocpp_virtual_function_impl(header, cls, existing):
cur_cls = cls
while True:
parent_name = cur_cls.get_parent_name()
if parent_name == 'CefBase':
if is_base_class(parent_name):
break
else:
parent_cls = header.get_class(parent_name)
@ -486,7 +528,7 @@ def make_ctocpp_virtual_function_impl(header, cls, existing):
return impl
def make_ctocpp_unwrap_derived(header, cls):
def make_ctocpp_unwrap_derived(header, cls, base_scoped):
# identify all classes that derive from cls
derived_classes = []
clsname = cls.get_name()
@ -499,6 +541,18 @@ def make_ctocpp_unwrap_derived(header, cls):
derived_classes = sorted(derived_classes)
if base_scoped:
impl = ['', '']
for clsname in derived_classes:
impl[0] += ' if (type == '+get_wrapper_type_enum(clsname)+') {\n'+\
' return reinterpret_cast<'+get_capi_name(cls.get_name(), True)+'*>('+\
clsname+'CToCpp::UnwrapOwn(CefOwnPtr<'+clsname+'>(reinterpret_cast<'+clsname+'*>(c.release()))));\n'+\
' }\n'
impl[1] += ' if (type == '+get_wrapper_type_enum(clsname)+') {\n'+\
' return reinterpret_cast<'+get_capi_name(cls.get_name(), True)+'*>('+\
clsname+'CToCpp::UnwrapRaw(CefRawPtr<'+clsname+'>(reinterpret_cast<'+clsname+'*>(c))));\n'+\
' }\n'
else:
impl = ''
for clsname in derived_classes:
impl += ' if (type == '+get_wrapper_type_enum(clsname)+') {\n'+\
@ -517,6 +571,13 @@ def make_ctocpp_class_impl(header, clsname, impl):
# retrieve the existing virtual function implementations
existing = get_function_impls(impl, clsname+'CToCpp::')
base_class_name = header.get_base_class_name(clsname)
base_scoped = True if base_class_name == 'CefBaseScoped' else False
if base_scoped:
template_class = 'CefCToCppScoped'
else:
template_class = 'CefCToCpp'
# generate virtual functions
virtualimpl = make_ctocpp_virtual_function_impl(header, cls, existing)
if len(virtualimpl) > 0:
@ -533,28 +594,42 @@ def make_ctocpp_class_impl(header, clsname, impl):
resultingimpl = staticimpl + virtualimpl
# any derived classes can be unwrapped
unwrapderived = make_ctocpp_unwrap_derived(header, cls)
unwrapderived = make_ctocpp_unwrap_derived(header, cls, base_scoped)
# determine what includes are required by identifying what translation
# classes are being used
includes = format_translation_includes(header, resultingimpl + unwrapderived)
includes = format_translation_includes(header, resultingimpl + (unwrapderived[0] if base_scoped else unwrapderived))
# build the final output
result = get_copyright()
result += includes+'\n'+resultingimpl+'\n'
parent_sig = 'CefCToCpp<'+clsname+'CToCpp, '+clsname+', '+capiname+'>'
parent_sig = template_class+'<'+clsname+'CToCpp, '+clsname+', '+capiname+'>'
const = '// CONSTRUCTOR - Do not edit by hand.\n\n'+ \
clsname+'CToCpp::'+clsname+'CToCpp() {\n'+ \
'}\n\n'+ \
'template<> '+capiname+'* '+parent_sig+'::UnwrapDerived(CefWrapperType type, '+clsname+'* c) {\n'+ \
unwrapderived + \
'}\n\n'
if base_scoped:
const += 'template<> '+capiname+'* '+parent_sig+'::UnwrapDerivedOwn(CefWrapperType type, CefOwnPtr<'+clsname+'> c) {\n'+ \
unwrapderived[0] + \
' NOTREACHED() << "Unexpected class type: " << type;\n'+ \
' return NULL;\n'+ \
'}\n\n' + \
'#if DCHECK_IS_ON()\n'+ \
'template<> '+capiname+'* '+parent_sig+'::UnwrapDerivedRaw(CefWrapperType type, CefRawPtr<'+clsname+'> c) {\n'+ \
unwrapderived[1] + \
' NOTREACHED() << "Unexpected class type: " << type;\n'+ \
' return NULL;\n'+ \
'}\n\n'
else:
const += 'template<> '+capiname+'* '+parent_sig+'::UnwrapDerived(CefWrapperType type, '+clsname+'* c) {\n'+ \
unwrapderived + \
' NOTREACHED() << "Unexpected class type: " << type;\n'+ \
' return NULL;\n'+ \
'}\n\n'
const += '#if DCHECK_IS_ON()\n'+ \
'template<> base::AtomicRefCount '+parent_sig+'::DebugObjCt = 0;\n'+ \
'#endif\n\n'+ \
'template<> CefWrapperType '+parent_sig+'::kWrapperType = '+get_wrapper_type_enum(clsname)+';'