diff --git a/BUILD.gn b/BUILD.gn index 3dca86526..dc19646c7 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -1004,6 +1004,10 @@ static_library("libcef_dll_wrapper") { gypi_paths2.libcef_dll_wrapper_sources_common + gypi_paths.autogen_client_side + if (is_mac) { + sources += gypi_paths2.libcef_dll_wrapper_sources_mac + } + defines = [ "WRAPPING_CEF_SHARED" ] configs += [ ":libcef_dll_wrapper_config" ] @@ -1463,14 +1467,9 @@ if (is_mac) { ":libcef_static", ] - # Both the main app executable and helper executables need to link the - # framework. Because they are at different directory depths, using - # @executable_path as the install_name would require using install_name_tool - # on one of the executables. However install_name_tool only operates - # in-place, which is problematic to express in GN. Instead, use rpath-based - # loading. + # We don't link the framework so just use the path from the main executable. ldflags = [ - "-Wl,-install_name,@rpath/Frameworks/$output_name.framework/$output_name", + "-Wl,-install_name,@executable_path/../Frameworks/$output_name.framework/$output_name", "-compatibility_version", cef_dylib_version, "-current_version", @@ -1569,7 +1568,6 @@ if (is_mac) { sources = invoker.helper_sources deps = [ - ":cef_framework+link", ":libcef_dll_wrapper", ] if (defined(invoker.helper_deps)) { @@ -1578,9 +1576,9 @@ if (is_mac) { ldflags = [ # The helper is in $app_name.app/Contents/Frameworks/$app_name Helper.app/Contents/MacOS/ - # so set rpath up to Contents/ so that the loader can find Frameworks/. + # so set rpath up to the base. "-rpath", - "@executable_path/../../../..", + "@executable_path/../../../../../..", ] info_plist_target = ":${app_name}_helper_plist" @@ -1594,7 +1592,7 @@ if (is_mac) { ] public_deps = [ - ":cef_framework+link", + ":cef_framework", ":${app_name}_helper_app", ] @@ -1630,13 +1628,6 @@ if (is_mac) { libs = invoker.libs } - ldflags = [ - # The main app is at $app_name.app/Contents/MacOS/$app_name - # so set rpath up to Contents/ so that the loader can find Frameworks/. - "-rpath", - "@executable_path/../", - ] - info_plist_target = ":${app_name}_plist" } } @@ -1687,6 +1678,7 @@ if (is_mac) { helper_sources = gypi_paths2.includes_mac + gypi_paths2.includes_common + gypi_paths2.includes_wrapper + + gypi_paths2.includes_wrapper_mac + gypi_paths2.shared_sources_common + gypi_paths2.shared_sources_renderer + gypi_paths2.shared_sources_mac_helper + @@ -1700,6 +1692,7 @@ if (is_mac) { sources = gypi_paths2.includes_mac + gypi_paths2.includes_common + gypi_paths2.includes_wrapper + + gypi_paths2.includes_wrapper_mac + gypi_paths2.shared_sources_browser + gypi_paths2.shared_sources_common + gypi_paths2.shared_sources_mac + @@ -1757,6 +1750,7 @@ if (is_mac) { helper_sources = gypi_paths2.includes_mac + gypi_paths2.includes_common + gypi_paths2.includes_wrapper + + gypi_paths2.includes_wrapper_mac + gypi_paths2.cefsimple_sources_mac_helper helper_deps = [ ":libcef_dll_wrapper", @@ -1766,6 +1760,7 @@ if (is_mac) { sources = gypi_paths2.includes_mac + gypi_paths2.includes_common + gypi_paths2.includes_wrapper + + gypi_paths2.includes_wrapper_mac + gypi_paths2.cefsimple_sources_common + gypi_paths2.cefsimple_sources_mac deps = [ @@ -1826,6 +1821,7 @@ if (is_mac) { sources = gypi_paths2.includes_mac + gypi_paths2.includes_common + gypi_paths2.includes_wrapper + + gypi_paths2.includes_wrapper_mac + gypi_paths2.shared_sources_browser + gypi_paths2.shared_sources_common + gypi_paths2.shared_sources_mac + diff --git a/cef_paths2.gypi b/cef_paths2.gypi index 3c71213d0..39dcd42e3 100644 --- a/cef_paths2.gypi +++ b/cef_paths2.gypi @@ -65,6 +65,9 @@ 'include/wrapper/cef_xml_object.h', 'include/wrapper/cef_zip_archive.h', ], + 'includes_wrapper_mac': [ + 'include/wrapper/cef_library_loader.h', + ], 'includes_win': [ 'include/base/internal/cef_atomicops_x86_msvc.h', 'include/base/internal/cef_bind_internal_win.h', @@ -141,6 +144,10 @@ 'libcef_dll/wrapper/libcef_dll_wrapper.cc', 'libcef_dll/wrapper/libcef_dll_wrapper2.cc', ], + 'libcef_dll_wrapper_sources_mac': [ + 'libcef_dll/wrapper/cef_library_loader_mac.mm', + 'libcef_dll/wrapper/libcef_dll_dylib.cc', + ], 'shared_sources_browser': [ 'tests/shared/browser/client_app_browser.cc', 'tests/shared/browser/client_app_browser.h', diff --git a/cmake/cef_macros.cmake.in b/cmake/cef_macros.cmake.in index 8cb25ba53..59a5749fd 100644 --- a/cmake/cef_macros.cmake.in +++ b/cmake/cef_macros.cmake.in @@ -185,22 +185,6 @@ endif(OS_LINUX) if(OS_MACOSX) -# Fix the framework rpath in the helper executable. -macro(FIX_MACOSX_HELPER_FRAMEWORK_RPATH target) - # The helper is in $app_name.app/Contents/Frameworks/$app_name Helper.app/Contents/MacOS/ - # so set rpath up to Contents/ so that the loader can find Frameworks/. - set_target_properties(${target} PROPERTIES INSTALL_RPATH "@executable_path/../../../..") - set_target_properties(${target} PROPERTIES BUILD_WITH_INSTALL_RPATH TRUE) -endmacro() - -# Fix the framework rpath in the main executable. -macro(FIX_MACOSX_MAIN_FRAMEWORK_RPATH target) - # The main app is at $app_name.app/Contents/MacOS/$app_name - # so set rpath up to Contents/ so that the loader can find Frameworks/. - set_target_properties(${target} PROPERTIES INSTALL_RPATH "@executable_path/..") - set_target_properties(${target} PROPERTIES BUILD_WITH_INSTALL_RPATH TRUE) -endmacro() - # Manually process and copy over resource files. macro(COPY_MACOSX_RESOURCES resource_list prefix_list target source_dir app_path) foreach(FILENAME ${resource_list}) diff --git a/cmake/cef_variables.cmake.in b/cmake/cef_variables.cmake.in index 583fa62b7..15894530f 100644 --- a/cmake/cef_variables.cmake.in +++ b/cmake/cef_variables.cmake.in @@ -313,10 +313,6 @@ if(OS_MACOSX) set(CEF_BINARY_DIR "${_CEF_ROOT}/$") set(CEF_BINARY_DIR_DEBUG "${_CEF_ROOT}/Debug") set(CEF_BINARY_DIR_RELEASE "${_CEF_ROOT}/Release") - - # CEF library paths. - set(CEF_LIB_DEBUG "${CEF_BINARY_DIR_DEBUG}/Chromium Embedded Framework.framework/Chromium Embedded Framework") - set(CEF_LIB_RELEASE "${CEF_BINARY_DIR_RELEASE}/Chromium Embedded Framework.framework/Chromium Embedded Framework") endif() diff --git a/include/wrapper/cef_library_loader.h b/include/wrapper/cef_library_loader.h new file mode 100644 index 000000000..6dd6a773d --- /dev/null +++ b/include/wrapper/cef_library_loader.h @@ -0,0 +1,116 @@ +// Copyright (c) 2018 Marshall A. Greenblatt. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the name Chromium Embedded +// Framework nor the names of its contributors may be used to endorse +// or promote products derived from this software without specific prior +// written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#ifndef CEF_INCLUDE_WRAPPER_CEF_LIBRARY_LOADER_H_ +#define CEF_INCLUDE_WRAPPER_CEF_LIBRARY_LOADER_H_ +#pragma once + +#include "include/base/cef_build.h" + +#ifdef __cplusplus +#include + +#include "include/base/cef_macros.h" + +extern "C" { +#endif // __cplusplus + +/// +// Load the CEF library at the specified |path|. Returns true (1) on +// success and false (0) on failure. +/// +int cef_load_library(const char* path); + +/// +// Unload the CEF library that was previously loaded. Returns true (1) +// on success and false (0) on failure. +/// +int cef_unload_library(); + +#ifdef __cplusplus +} + +#if defined(OS_MACOSX) + +/// +// Scoped helper for loading and unloading the CEF framework library at +// runtime from the expected location in the app bundle. Loading at runtime +// instead of linking directly is a requirement of the macOS sandbox +// implementation. +// +// Example usage in the main process: +// +// int main(int argc, char* argv[]) { +// CefScopedLibraryLoader library_loader; +// if (!library_loader.LoadInMain()) +// return 1; +// +// // Rest of the function here... +// } +// +// Example usage in the helper process: +// +// int main(int argc, char* argv[]) { +// CefScopedLibraryLoader library_loader; +// if (!library_loader.LoadInHelper()) +// return 1; +// +// // Rest of the function here... +// } +/// +class CefScopedLibraryLoader { + public: + CefScopedLibraryLoader(); + ~CefScopedLibraryLoader(); + + /// + // Load the CEF framework in the main process from the expected app + // bundle location relative to the executable. Returns true if the + // load succeeds. + /// + bool LoadInMain() { return Load(false); } + + /// + // Load the CEF framework in the helper process from the expected app + // bundle location relative to the executable. Returns true if the + // load succeeds. + /// + bool LoadInHelper() { return Load(true); } + + private: + bool Load(bool helper); + + bool loaded_; + DISALLOW_COPY_AND_ASSIGN(CefScopedLibraryLoader); +}; + +#endif // defined(OS_MACOSX) +#endif // __cplusplus + +#endif // CEF_INCLUDE_WRAPPER_CEF_LIBRARY_LOADER_H_ diff --git a/libcef_dll/CMakeLists.txt.in b/libcef_dll/CMakeLists.txt.in index 045e9a75d..62dc2b761 100644 --- a/libcef_dll/CMakeLists.txt.in +++ b/libcef_dll/CMakeLists.txt.in @@ -27,11 +27,13 @@ set(CEF_TARGET libcef_dll_wrapper) 'includes_capi', 'autogen_capi_includes', 'includes_wrapper', + 'includes_wrapper_mac:MACOSX', 'includes_win:WINDOWS', 'includes_mac:MACOSX', 'includes_linux:LINUX', 'libcef_dll_wrapper_sources_base', 'libcef_dll_wrapper_sources_common', + 'libcef_dll_wrapper_sources_mac:MACOSX', 'autogen_client_side', ], }} diff --git a/libcef_dll/wrapper/cef_library_loader_mac.mm b/libcef_dll/wrapper/cef_library_loader_mac.mm new file mode 100644 index 000000000..046f46b0b --- /dev/null +++ b/libcef_dll/wrapper/cef_library_loader_mac.mm @@ -0,0 +1,77 @@ +// Copyright (c) 2018 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 "include/wrapper/cef_library_loader.h" + +#include +#include +#include + +#include +#include + +namespace { + +const char kFrameworkPath[] = + "Chromium Embedded Framework.framework/Chromium Embedded Framework"; +const char kPathFromHelperExe[] = "../../.."; +const char kPathFromMainExe[] = "../Frameworks"; + +std::string GetFrameworkPath(bool helper) { + uint32_t exec_path_size = 0; + int rv = _NSGetExecutablePath(NULL, &exec_path_size); + if (rv != -1) { + return std::string(); + } + + std::unique_ptr exec_path(new char[exec_path_size]); + rv = _NSGetExecutablePath(exec_path.get(), &exec_path_size); + if (rv != 0) { + return std::string(); + } + + // Get the directory path of the executable. + const char* parent_dir = dirname(exec_path.get()); + if (!parent_dir) { + return std::string(); + } + + // Append the relative path to the framework. + std::stringstream ss; + ss << parent_dir << "/" << (helper ? kPathFromHelperExe : kPathFromMainExe) + << "/" << kFrameworkPath; + return ss.str(); +} + +} // namespace + +CefScopedLibraryLoader::CefScopedLibraryLoader() : loaded_(false) {} + +bool CefScopedLibraryLoader::Load(bool helper) { + if (loaded_) { + return false; + } + + const std::string& framework_path = GetFrameworkPath(helper); + if (framework_path.empty()) { + fprintf(stderr, "App does not have the expected bundle structure.\n"); + return false; + } + + // Load the CEF framework library. + if (!cef_load_library(framework_path.c_str())) { + fprintf(stderr, "Failed to load the CEF framework.\n"); + return false; + } + + loaded_ = true; + return true; +} + +CefScopedLibraryLoader::~CefScopedLibraryLoader() { + if (loaded_) { + // Unload the CEF framework library. + cef_unload_library(); + } +} diff --git a/libcef_dll/wrapper/libcef_dll_dylib.cc b/libcef_dll/wrapper/libcef_dll_dylib.cc new file mode 100644 index 000000000..00977c5ed --- /dev/null +++ b/libcef_dll/wrapper/libcef_dll_dylib.cc @@ -0,0 +1,2190 @@ +// Copyright (c) 2018 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. +// +// $hash=322e6c3e92ce399d47f8ee00070325f523763c64$ +// + +#include +#include + +#include "include/capi/cef_app_capi.h" +#include "include/capi/cef_browser_capi.h" +#include "include/capi/cef_command_line_capi.h" +#include "include/capi/cef_cookie_capi.h" +#include "include/capi/cef_crash_util_capi.h" +#include "include/capi/cef_drag_data_capi.h" +#include "include/capi/cef_file_util_capi.h" +#include "include/capi/cef_image_capi.h" +#include "include/capi/cef_menu_model_capi.h" +#include "include/capi/cef_origin_whitelist_capi.h" +#include "include/capi/cef_parser_capi.h" +#include "include/capi/cef_path_util_capi.h" +#include "include/capi/cef_print_settings_capi.h" +#include "include/capi/cef_process_message_capi.h" +#include "include/capi/cef_process_util_capi.h" +#include "include/capi/cef_request_capi.h" +#include "include/capi/cef_request_context_capi.h" +#include "include/capi/cef_resource_bundle_capi.h" +#include "include/capi/cef_response_capi.h" +#include "include/capi/cef_scheme_capi.h" +#include "include/capi/cef_server_capi.h" +#include "include/capi/cef_ssl_info_capi.h" +#include "include/capi/cef_stream_capi.h" +#include "include/capi/cef_task_capi.h" +#include "include/capi/cef_thread_capi.h" +#include "include/capi/cef_trace_capi.h" +#include "include/capi/cef_urlrequest_capi.h" +#include "include/capi/cef_v8_capi.h" +#include "include/capi/cef_values_capi.h" +#include "include/capi/cef_waitable_event_capi.h" +#include "include/capi/cef_web_plugin_capi.h" +#include "include/capi/cef_xml_reader_capi.h" +#include "include/capi/cef_zip_reader_capi.h" +#include "include/capi/test/cef_test_helpers_capi.h" +#include "include/capi/test/cef_translator_test_capi.h" +#include "include/capi/views/cef_browser_view_capi.h" +#include "include/capi/views/cef_display_capi.h" +#include "include/capi/views/cef_label_button_capi.h" +#include "include/capi/views/cef_menu_button_capi.h" +#include "include/capi/views/cef_panel_capi.h" +#include "include/capi/views/cef_scroll_view_capi.h" +#include "include/capi/views/cef_textfield_capi.h" +#include "include/capi/views/cef_window_capi.h" +#include "include/cef_version.h" +#include "include/internal/cef_logging_internal.h" +#include "include/internal/cef_string_list.h" +#include "include/internal/cef_string_map.h" +#include "include/internal/cef_string_multimap.h" +#include "include/internal/cef_string_types.h" +#include "include/internal/cef_thread_internal.h" +#include "include/internal/cef_time.h" +#include "include/internal/cef_trace_event_internal.h" +#include "include/wrapper/cef_library_loader.h" + +// GLOBAL WRAPPER FUNCTIONS - Do not edit by hand. + +namespace { + +void* g_libcef_handle = NULL; + +void* libcef_get_ptr(const char* path, const char* name) { + void* ptr = dlsym(g_libcef_handle, name); + if (!ptr) { + fprintf(stderr, "dlsym %s: %s\n", path, dlerror()); + } + return ptr; +} + +typedef int (*cef_execute_process_ptr)(const struct _cef_main_args_t*, + struct _cef_app_t*, + void*); +typedef int (*cef_initialize_ptr)(const struct _cef_main_args_t*, + const struct _cef_settings_t*, + struct _cef_app_t*, + void*); +typedef void (*cef_shutdown_ptr)(); +typedef void (*cef_do_message_loop_work_ptr)(); +typedef void (*cef_run_message_loop_ptr)(); +typedef void (*cef_quit_message_loop_ptr)(); +typedef void (*cef_set_osmodal_loop_ptr)(int); +typedef void (*cef_enable_highdpi_support_ptr)(); +typedef int (*cef_crash_reporting_enabled_ptr)(); +typedef void (*cef_set_crash_key_value_ptr)(const cef_string_t*, + const cef_string_t*); +typedef int (*cef_create_directory_ptr)(const cef_string_t*); +typedef int (*cef_get_temp_directory_ptr)(cef_string_t*); +typedef int (*cef_create_new_temp_directory_ptr)(const cef_string_t*, + cef_string_t*); +typedef int (*cef_create_temp_directory_in_directory_ptr)(const cef_string_t*, + const cef_string_t*, + cef_string_t*); +typedef int (*cef_directory_exists_ptr)(const cef_string_t*); +typedef int (*cef_delete_file_ptr)(const cef_string_t*, int); +typedef int (*cef_zip_directory_ptr)(const cef_string_t*, + const cef_string_t*, + int); +typedef void (*cef_load_crlsets_file_ptr)(const cef_string_t*); +typedef int (*cef_add_cross_origin_whitelist_entry_ptr)(const cef_string_t*, + const cef_string_t*, + const cef_string_t*, + int); +typedef int (*cef_remove_cross_origin_whitelist_entry_ptr)(const cef_string_t*, + const cef_string_t*, + const cef_string_t*, + int); +typedef int (*cef_clear_cross_origin_whitelist_ptr)(); +typedef int (*cef_parse_url_ptr)(const cef_string_t*, struct _cef_urlparts_t*); +typedef int (*cef_create_url_ptr)(const struct _cef_urlparts_t*, cef_string_t*); +typedef cef_string_userfree_t (*cef_format_url_for_security_display_ptr)( + const cef_string_t*); +typedef cef_string_userfree_t (*cef_get_mime_type_ptr)(const cef_string_t*); +typedef void (*cef_get_extensions_for_mime_type_ptr)(const cef_string_t*, + cef_string_list_t); +typedef cef_string_userfree_t (*cef_base64encode_ptr)(const void*, size_t); +typedef struct _cef_binary_value_t* (*cef_base64decode_ptr)( + const cef_string_t*); +typedef cef_string_userfree_t (*cef_uriencode_ptr)(const cef_string_t*, int); +typedef cef_string_userfree_t (*cef_uridecode_ptr)(const cef_string_t*, + int, + cef_uri_unescape_rule_t); +typedef struct _cef_value_t* (*cef_parse_json_ptr)(const cef_string_t*, + cef_json_parser_options_t); +typedef struct _cef_value_t* (*cef_parse_jsonand_return_error_ptr)( + const cef_string_t*, + cef_json_parser_options_t, + cef_json_parser_error_t*, + cef_string_t*); +typedef cef_string_userfree_t (*cef_write_json_ptr)(struct _cef_value_t*, + cef_json_writer_options_t); +typedef int (*cef_get_path_ptr)(cef_path_key_t, cef_string_t*); +typedef int (*cef_launch_process_ptr)(struct _cef_command_line_t*); +typedef int (*cef_register_scheme_handler_factory_ptr)( + const cef_string_t*, + const cef_string_t*, + struct _cef_scheme_handler_factory_t*); +typedef int (*cef_clear_scheme_handler_factories_ptr)(); +typedef int (*cef_is_cert_status_error_ptr)(cef_cert_status_t); +typedef int (*cef_is_cert_status_minor_error_ptr)(cef_cert_status_t); +typedef int (*cef_currently_on_ptr)(cef_thread_id_t); +typedef int (*cef_post_task_ptr)(cef_thread_id_t, struct _cef_task_t*); +typedef int (*cef_post_delayed_task_ptr)(cef_thread_id_t, + struct _cef_task_t*, + int64); +typedef int (*cef_begin_tracing_ptr)(const cef_string_t*, + struct _cef_completion_callback_t*); +typedef int (*cef_end_tracing_ptr)(const cef_string_t*, + struct _cef_end_tracing_callback_t*); +typedef int64 (*cef_now_from_system_trace_time_ptr)(); +typedef int (*cef_register_extension_ptr)(const cef_string_t*, + const cef_string_t*, + struct _cef_v8handler_t*); +typedef void (*cef_visit_web_plugin_info_ptr)( + struct _cef_web_plugin_info_visitor_t*); +typedef void (*cef_refresh_web_plugins_ptr)(); +typedef void (*cef_unregister_internal_web_plugin_ptr)(const cef_string_t*); +typedef void (*cef_register_web_plugin_crash_ptr)(const cef_string_t*); +typedef void (*cef_is_web_plugin_unstable_ptr)( + const cef_string_t*, + struct _cef_web_plugin_unstable_callback_t*); +typedef void (*cef_register_widevine_cdm_ptr)( + const cef_string_t*, + struct _cef_register_cdm_callback_t*); +typedef void (*cef_execute_java_script_with_user_gesture_for_tests_ptr)( + struct _cef_frame_t*, + const cef_string_t*); +typedef int (*cef_browser_host_create_browser_ptr)( + const struct _cef_window_info_t*, + struct _cef_client_t*, + const cef_string_t*, + const struct _cef_browser_settings_t*, + struct _cef_request_context_t*); +typedef struct _cef_browser_t* (*cef_browser_host_create_browser_sync_ptr)( + const struct _cef_window_info_t*, + struct _cef_client_t*, + const cef_string_t*, + const struct _cef_browser_settings_t*, + struct _cef_request_context_t*); +typedef struct _cef_command_line_t* (*cef_command_line_create_ptr)(); +typedef struct _cef_command_line_t* (*cef_command_line_get_global_ptr)(); +typedef struct _cef_cookie_manager_t* ( + *cef_cookie_manager_get_global_manager_ptr)( + struct _cef_completion_callback_t*); +typedef struct _cef_cookie_manager_t* ( + *cef_cookie_manager_get_blocking_manager_ptr)(); +typedef struct _cef_cookie_manager_t* (*cef_cookie_manager_create_manager_ptr)( + const cef_string_t*, + int, + struct _cef_completion_callback_t*); +typedef struct _cef_drag_data_t* (*cef_drag_data_create_ptr)(); +typedef struct _cef_image_t* (*cef_image_create_ptr)(); +typedef struct _cef_menu_model_t* (*cef_menu_model_create_ptr)( + struct _cef_menu_model_delegate_t*); +typedef struct _cef_print_settings_t* (*cef_print_settings_create_ptr)(); +typedef struct _cef_process_message_t* (*cef_process_message_create_ptr)( + const cef_string_t*); +typedef struct _cef_request_t* (*cef_request_create_ptr)(); +typedef struct _cef_post_data_t* (*cef_post_data_create_ptr)(); +typedef struct _cef_post_data_element_t* (*cef_post_data_element_create_ptr)(); +typedef struct _cef_request_context_t* ( + *cef_request_context_get_global_context_ptr)(); +typedef struct _cef_request_context_t* ( + *cef_request_context_create_context_ptr)( + const struct _cef_request_context_settings_t*, + struct _cef_request_context_handler_t*); +typedef struct _cef_request_context_t* (*cef_create_context_shared_ptr)( + struct _cef_request_context_t*, + struct _cef_request_context_handler_t*); +typedef struct _cef_resource_bundle_t* (*cef_resource_bundle_get_global_ptr)(); +typedef struct _cef_response_t* (*cef_response_create_ptr)(); +typedef void (*cef_server_create_ptr)(const cef_string_t*, + uint16, + int, + struct _cef_server_handler_t*); +typedef struct _cef_stream_reader_t* (*cef_stream_reader_create_for_file_ptr)( + const cef_string_t*); +typedef struct _cef_stream_reader_t* ( + *cef_stream_reader_create_for_data_ptr)(void*, size_t); +typedef struct _cef_stream_reader_t* ( + *cef_stream_reader_create_for_handler_ptr)(struct _cef_read_handler_t*); +typedef struct _cef_stream_writer_t* (*cef_stream_writer_create_for_file_ptr)( + const cef_string_t*); +typedef struct _cef_stream_writer_t* ( + *cef_stream_writer_create_for_handler_ptr)(struct _cef_write_handler_t*); +typedef struct _cef_task_runner_t* ( + *cef_task_runner_get_for_current_thread_ptr)(); +typedef struct _cef_task_runner_t* (*cef_task_runner_get_for_thread_ptr)( + cef_thread_id_t); +typedef struct _cef_thread_t* (*cef_thread_create_ptr)(const cef_string_t*, + cef_thread_priority_t, + cef_message_loop_type_t, + int, + cef_com_init_mode_t); +typedef struct _cef_urlrequest_t* (*cef_urlrequest_create_ptr)( + struct _cef_request_t*, + struct _cef_urlrequest_client_t*, + struct _cef_request_context_t*); +typedef struct _cef_v8context_t* (*cef_v8context_get_current_context_ptr)(); +typedef struct _cef_v8context_t* (*cef_v8context_get_entered_context_ptr)(); +typedef int (*cef_v8context_in_context_ptr)(); +typedef struct _cef_v8value_t* (*cef_v8value_create_undefined_ptr)(); +typedef struct _cef_v8value_t* (*cef_v8value_create_null_ptr)(); +typedef struct _cef_v8value_t* (*cef_v8value_create_bool_ptr)(int); +typedef struct _cef_v8value_t* (*cef_v8value_create_int_ptr)(int32); +typedef struct _cef_v8value_t* (*cef_v8value_create_uint_ptr)(uint32); +typedef struct _cef_v8value_t* (*cef_v8value_create_double_ptr)(double); +typedef struct _cef_v8value_t* (*cef_v8value_create_date_ptr)( + const cef_time_t*); +typedef struct _cef_v8value_t* (*cef_v8value_create_string_ptr)( + const cef_string_t*); +typedef struct _cef_v8value_t* (*cef_v8value_create_object_ptr)( + struct _cef_v8accessor_t*, + struct _cef_v8interceptor_t*); +typedef struct _cef_v8value_t* (*cef_v8value_create_array_ptr)(int); +typedef struct _cef_v8value_t* (*cef_v8value_create_array_buffer_ptr)( + void*, + size_t, + struct _cef_v8array_buffer_release_callback_t*); +typedef struct _cef_v8value_t* (*cef_v8value_create_function_ptr)( + const cef_string_t*, + struct _cef_v8handler_t*); +typedef struct _cef_v8stack_trace_t* (*cef_v8stack_trace_get_current_ptr)(int); +typedef struct _cef_value_t* (*cef_value_create_ptr)(); +typedef struct _cef_binary_value_t* (*cef_binary_value_create_ptr)(const void*, + size_t); +typedef struct _cef_dictionary_value_t* (*cef_dictionary_value_create_ptr)(); +typedef struct _cef_list_value_t* (*cef_list_value_create_ptr)(); +typedef struct _cef_waitable_event_t* (*cef_waitable_event_create_ptr)(int, + int); +typedef struct _cef_xml_reader_t* (*cef_xml_reader_create_ptr)( + struct _cef_stream_reader_t*, + cef_xml_encoding_type_t, + const cef_string_t*); +typedef struct _cef_zip_reader_t* (*cef_zip_reader_create_ptr)( + struct _cef_stream_reader_t*); +typedef struct _cef_translator_test_t* (*cef_translator_test_create_ptr)(); +typedef struct _cef_translator_test_ref_ptr_library_t* ( + *cef_translator_test_ref_ptr_library_create_ptr)(int); +typedef struct _cef_translator_test_ref_ptr_library_child_t* ( + *cef_translator_test_ref_ptr_library_child_create_ptr)(int, int); +typedef struct _cef_translator_test_ref_ptr_library_child_child_t* ( + *cef_translator_test_ref_ptr_library_child_child_create_ptr)(int, int, int); +typedef struct _cef_translator_test_scoped_library_t* ( + *cef_translator_test_scoped_library_create_ptr)(int); +typedef struct _cef_translator_test_scoped_library_child_t* ( + *cef_translator_test_scoped_library_child_create_ptr)(int, int); +typedef struct _cef_translator_test_scoped_library_child_child_t* ( + *cef_translator_test_scoped_library_child_child_create_ptr)(int, int, int); +typedef struct _cef_browser_view_t* (*cef_browser_view_create_ptr)( + struct _cef_client_t*, + const cef_string_t*, + const struct _cef_browser_settings_t*, + struct _cef_request_context_t*, + struct _cef_browser_view_delegate_t*); +typedef struct _cef_browser_view_t* (*cef_browser_view_get_for_browser_ptr)( + struct _cef_browser_t*); +typedef struct _cef_display_t* (*cef_display_get_primary_ptr)(); +typedef struct _cef_display_t* ( + *cef_display_get_nearest_point_ptr)(const cef_point_t*, int); +typedef struct _cef_display_t* ( + *cef_display_get_matching_bounds_ptr)(const cef_rect_t*, int); +typedef size_t (*cef_display_get_count_ptr)(); +typedef void (*cef_display_get_alls_ptr)(size_t*, struct _cef_display_t**); +typedef struct _cef_label_button_t* (*cef_label_button_create_ptr)( + struct _cef_button_delegate_t*, + const cef_string_t*, + int); +typedef struct _cef_menu_button_t* (*cef_menu_button_create_ptr)( + struct _cef_menu_button_delegate_t*, + const cef_string_t*, + int, + int); +typedef struct _cef_panel_t* (*cef_panel_create_ptr)( + struct _cef_panel_delegate_t*); +typedef struct _cef_scroll_view_t* (*cef_scroll_view_create_ptr)( + struct _cef_view_delegate_t*); +typedef struct _cef_textfield_t* (*cef_textfield_create_ptr)( + struct _cef_textfield_delegate_t*); +typedef struct _cef_window_t* (*cef_window_create_top_level_ptr)( + struct _cef_window_delegate_t*); +typedef int (*cef_version_info_ptr)(int); +typedef const char* (*cef_api_hash_ptr)(int); +typedef int (*cef_get_min_log_level_ptr)(); +typedef int (*cef_get_vlog_level_ptr)(const char*, size_t); +typedef void (*cef_log_ptr)(const char*, int, int, const char*); +typedef cef_string_list_t (*cef_string_list_alloc_ptr)(); +typedef size_t (*cef_string_list_size_ptr)(cef_string_list_t); +typedef int (*cef_string_list_value_ptr)(cef_string_list_t, + size_t, + cef_string_t*); +typedef void (*cef_string_list_append_ptr)(cef_string_list_t, + const cef_string_t*); +typedef void (*cef_string_list_clear_ptr)(cef_string_list_t); +typedef void (*cef_string_list_free_ptr)(cef_string_list_t); +typedef cef_string_list_t (*cef_string_list_copy_ptr)(cef_string_list_t); +typedef cef_string_map_t (*cef_string_map_alloc_ptr)(); +typedef size_t (*cef_string_map_size_ptr)(cef_string_map_t); +typedef int (*cef_string_map_find_ptr)(cef_string_map_t, + const cef_string_t*, + cef_string_t*); +typedef int (*cef_string_map_key_ptr)(cef_string_map_t, size_t, cef_string_t*); +typedef int (*cef_string_map_value_ptr)(cef_string_map_t, + size_t, + cef_string_t*); +typedef int (*cef_string_map_append_ptr)(cef_string_map_t, + const cef_string_t*, + const cef_string_t*); +typedef void (*cef_string_map_clear_ptr)(cef_string_map_t); +typedef void (*cef_string_map_free_ptr)(cef_string_map_t); +typedef cef_string_multimap_t (*cef_string_multimap_alloc_ptr)(); +typedef size_t (*cef_string_multimap_size_ptr)(cef_string_multimap_t); +typedef size_t (*cef_string_multimap_find_count_ptr)(cef_string_multimap_t, + const cef_string_t*); +typedef int (*cef_string_multimap_enumerate_ptr)(cef_string_multimap_t, + const cef_string_t*, + size_t, + cef_string_t*); +typedef int (*cef_string_multimap_key_ptr)(cef_string_multimap_t, + size_t, + cef_string_t*); +typedef int (*cef_string_multimap_value_ptr)(cef_string_multimap_t, + size_t, + cef_string_t*); +typedef int (*cef_string_multimap_append_ptr)(cef_string_multimap_t, + const cef_string_t*, + const cef_string_t*); +typedef void (*cef_string_multimap_clear_ptr)(cef_string_multimap_t); +typedef void (*cef_string_multimap_free_ptr)(cef_string_multimap_t); +typedef int (*cef_string_wide_set_ptr)(const wchar_t*, + size_t, + cef_string_wide_t*, + int); +typedef int (*cef_string_utf8_set_ptr)(const char*, + size_t, + cef_string_utf8_t*, + int); +typedef int (*cef_string_utf16_set_ptr)(const char16*, + size_t, + cef_string_utf16_t*, + int); +typedef void (*cef_string_wide_clear_ptr)(cef_string_wide_t*); +typedef void (*cef_string_utf8_clear_ptr)(cef_string_utf8_t*); +typedef void (*cef_string_utf16_clear_ptr)(cef_string_utf16_t*); +typedef int (*cef_string_wide_cmp_ptr)(const cef_string_wide_t*, + const cef_string_wide_t*); +typedef int (*cef_string_utf8_cmp_ptr)(const cef_string_utf8_t*, + const cef_string_utf8_t*); +typedef int (*cef_string_utf16_cmp_ptr)(const cef_string_utf16_t*, + const cef_string_utf16_t*); +typedef int (*cef_string_wide_to_utf8_ptr)(const wchar_t*, + size_t, + cef_string_utf8_t*); +typedef int (*cef_string_utf8_to_wide_ptr)(const char*, + size_t, + cef_string_wide_t*); +typedef int (*cef_string_wide_to_utf16_ptr)(const wchar_t*, + size_t, + cef_string_utf16_t*); +typedef int (*cef_string_utf16_to_wide_ptr)(const char16*, + size_t, + cef_string_wide_t*); +typedef int (*cef_string_utf8_to_utf16_ptr)(const char*, + size_t, + cef_string_utf16_t*); +typedef int (*cef_string_utf16_to_utf8_ptr)(const char16*, + size_t, + cef_string_utf8_t*); +typedef int (*cef_string_ascii_to_wide_ptr)(const char*, + size_t, + cef_string_wide_t*); +typedef int (*cef_string_ascii_to_utf16_ptr)(const char*, + size_t, + cef_string_utf16_t*); +typedef cef_string_userfree_wide_t (*cef_string_userfree_wide_alloc_ptr)(); +typedef cef_string_userfree_utf8_t (*cef_string_userfree_utf8_alloc_ptr)(); +typedef cef_string_userfree_utf16_t (*cef_string_userfree_utf16_alloc_ptr)(); +typedef void (*cef_string_userfree_wide_free_ptr)(cef_string_userfree_wide_t); +typedef void (*cef_string_userfree_utf8_free_ptr)(cef_string_userfree_utf8_t); +typedef void (*cef_string_userfree_utf16_free_ptr)(cef_string_userfree_utf16_t); +typedef int (*cef_string_utf16_to_lower_ptr)(const char16*, + size_t, + cef_string_utf16_t*); +typedef int (*cef_string_utf16_to_upper_ptr)(const char16*, + size_t, + cef_string_utf16_t*); +typedef cef_platform_thread_id_t (*cef_get_current_platform_thread_id_ptr)(); +typedef cef_platform_thread_handle_t ( + *cef_get_current_platform_thread_handle_ptr)(); +typedef int (*cef_time_to_timet_ptr)(const cef_time_t*, time_t*); +typedef int (*cef_time_from_timet_ptr)(time_t, cef_time_t*); +typedef int (*cef_time_to_doublet_ptr)(const cef_time_t*, double*); +typedef int (*cef_time_from_doublet_ptr)(double, cef_time_t*); +typedef int (*cef_time_now_ptr)(cef_time_t*); +typedef int (*cef_time_delta_ptr)(const cef_time_t*, + const cef_time_t*, + long long*); +typedef void (*cef_trace_event_instant_ptr)(const char*, + const char*, + const char*, + uint64, + const char*, + uint64, + int); +typedef void (*cef_trace_event_begin_ptr)(const char*, + const char*, + const char*, + uint64, + const char*, + uint64, + int); +typedef void (*cef_trace_event_end_ptr)(const char*, + const char*, + const char*, + uint64, + const char*, + uint64, + int); +typedef void (*cef_trace_counter_ptr)(const char*, + const char*, + const char*, + uint64, + const char*, + uint64, + int); +typedef void (*cef_trace_counter_id_ptr)(const char*, + const char*, + uint64, + const char*, + uint64, + const char*, + uint64, + int); +typedef void (*cef_trace_event_async_begin_ptr)(const char*, + const char*, + uint64, + const char*, + uint64, + const char*, + uint64, + int); +typedef void (*cef_trace_event_async_step_into_ptr)(const char*, + const char*, + uint64, + uint64, + const char*, + uint64, + int); +typedef void (*cef_trace_event_async_step_past_ptr)(const char*, + const char*, + uint64, + uint64, + const char*, + uint64, + int); +typedef void (*cef_trace_event_async_end_ptr)(const char*, + const char*, + uint64, + const char*, + uint64, + const char*, + uint64, + int); + +struct libcef_pointers { + cef_execute_process_ptr cef_execute_process; + cef_initialize_ptr cef_initialize; + cef_shutdown_ptr cef_shutdown; + cef_do_message_loop_work_ptr cef_do_message_loop_work; + cef_run_message_loop_ptr cef_run_message_loop; + cef_quit_message_loop_ptr cef_quit_message_loop; + cef_set_osmodal_loop_ptr cef_set_osmodal_loop; + cef_enable_highdpi_support_ptr cef_enable_highdpi_support; + cef_crash_reporting_enabled_ptr cef_crash_reporting_enabled; + cef_set_crash_key_value_ptr cef_set_crash_key_value; + cef_create_directory_ptr cef_create_directory; + cef_get_temp_directory_ptr cef_get_temp_directory; + cef_create_new_temp_directory_ptr cef_create_new_temp_directory; + cef_create_temp_directory_in_directory_ptr + cef_create_temp_directory_in_directory; + cef_directory_exists_ptr cef_directory_exists; + cef_delete_file_ptr cef_delete_file; + cef_zip_directory_ptr cef_zip_directory; + cef_load_crlsets_file_ptr cef_load_crlsets_file; + cef_add_cross_origin_whitelist_entry_ptr cef_add_cross_origin_whitelist_entry; + cef_remove_cross_origin_whitelist_entry_ptr + cef_remove_cross_origin_whitelist_entry; + cef_clear_cross_origin_whitelist_ptr cef_clear_cross_origin_whitelist; + cef_parse_url_ptr cef_parse_url; + cef_create_url_ptr cef_create_url; + cef_format_url_for_security_display_ptr cef_format_url_for_security_display; + cef_get_mime_type_ptr cef_get_mime_type; + cef_get_extensions_for_mime_type_ptr cef_get_extensions_for_mime_type; + cef_base64encode_ptr cef_base64encode; + cef_base64decode_ptr cef_base64decode; + cef_uriencode_ptr cef_uriencode; + cef_uridecode_ptr cef_uridecode; + cef_parse_json_ptr cef_parse_json; + cef_parse_jsonand_return_error_ptr cef_parse_jsonand_return_error; + cef_write_json_ptr cef_write_json; + cef_get_path_ptr cef_get_path; + cef_launch_process_ptr cef_launch_process; + cef_register_scheme_handler_factory_ptr cef_register_scheme_handler_factory; + cef_clear_scheme_handler_factories_ptr cef_clear_scheme_handler_factories; + cef_is_cert_status_error_ptr cef_is_cert_status_error; + cef_is_cert_status_minor_error_ptr cef_is_cert_status_minor_error; + cef_currently_on_ptr cef_currently_on; + cef_post_task_ptr cef_post_task; + cef_post_delayed_task_ptr cef_post_delayed_task; + cef_begin_tracing_ptr cef_begin_tracing; + cef_end_tracing_ptr cef_end_tracing; + cef_now_from_system_trace_time_ptr cef_now_from_system_trace_time; + cef_register_extension_ptr cef_register_extension; + cef_visit_web_plugin_info_ptr cef_visit_web_plugin_info; + cef_refresh_web_plugins_ptr cef_refresh_web_plugins; + cef_unregister_internal_web_plugin_ptr cef_unregister_internal_web_plugin; + cef_register_web_plugin_crash_ptr cef_register_web_plugin_crash; + cef_is_web_plugin_unstable_ptr cef_is_web_plugin_unstable; + cef_register_widevine_cdm_ptr cef_register_widevine_cdm; + cef_execute_java_script_with_user_gesture_for_tests_ptr + cef_execute_java_script_with_user_gesture_for_tests; + cef_browser_host_create_browser_ptr cef_browser_host_create_browser; + cef_browser_host_create_browser_sync_ptr cef_browser_host_create_browser_sync; + cef_command_line_create_ptr cef_command_line_create; + cef_command_line_get_global_ptr cef_command_line_get_global; + cef_cookie_manager_get_global_manager_ptr + cef_cookie_manager_get_global_manager; + cef_cookie_manager_get_blocking_manager_ptr + cef_cookie_manager_get_blocking_manager; + cef_cookie_manager_create_manager_ptr cef_cookie_manager_create_manager; + cef_drag_data_create_ptr cef_drag_data_create; + cef_image_create_ptr cef_image_create; + cef_menu_model_create_ptr cef_menu_model_create; + cef_print_settings_create_ptr cef_print_settings_create; + cef_process_message_create_ptr cef_process_message_create; + cef_request_create_ptr cef_request_create; + cef_post_data_create_ptr cef_post_data_create; + cef_post_data_element_create_ptr cef_post_data_element_create; + cef_request_context_get_global_context_ptr + cef_request_context_get_global_context; + cef_request_context_create_context_ptr cef_request_context_create_context; + cef_create_context_shared_ptr cef_create_context_shared; + cef_resource_bundle_get_global_ptr cef_resource_bundle_get_global; + cef_response_create_ptr cef_response_create; + cef_server_create_ptr cef_server_create; + cef_stream_reader_create_for_file_ptr cef_stream_reader_create_for_file; + cef_stream_reader_create_for_data_ptr cef_stream_reader_create_for_data; + cef_stream_reader_create_for_handler_ptr cef_stream_reader_create_for_handler; + cef_stream_writer_create_for_file_ptr cef_stream_writer_create_for_file; + cef_stream_writer_create_for_handler_ptr cef_stream_writer_create_for_handler; + cef_task_runner_get_for_current_thread_ptr + cef_task_runner_get_for_current_thread; + cef_task_runner_get_for_thread_ptr cef_task_runner_get_for_thread; + cef_thread_create_ptr cef_thread_create; + cef_urlrequest_create_ptr cef_urlrequest_create; + cef_v8context_get_current_context_ptr cef_v8context_get_current_context; + cef_v8context_get_entered_context_ptr cef_v8context_get_entered_context; + cef_v8context_in_context_ptr cef_v8context_in_context; + cef_v8value_create_undefined_ptr cef_v8value_create_undefined; + cef_v8value_create_null_ptr cef_v8value_create_null; + cef_v8value_create_bool_ptr cef_v8value_create_bool; + cef_v8value_create_int_ptr cef_v8value_create_int; + cef_v8value_create_uint_ptr cef_v8value_create_uint; + cef_v8value_create_double_ptr cef_v8value_create_double; + cef_v8value_create_date_ptr cef_v8value_create_date; + cef_v8value_create_string_ptr cef_v8value_create_string; + cef_v8value_create_object_ptr cef_v8value_create_object; + cef_v8value_create_array_ptr cef_v8value_create_array; + cef_v8value_create_array_buffer_ptr cef_v8value_create_array_buffer; + cef_v8value_create_function_ptr cef_v8value_create_function; + cef_v8stack_trace_get_current_ptr cef_v8stack_trace_get_current; + cef_value_create_ptr cef_value_create; + cef_binary_value_create_ptr cef_binary_value_create; + cef_dictionary_value_create_ptr cef_dictionary_value_create; + cef_list_value_create_ptr cef_list_value_create; + cef_waitable_event_create_ptr cef_waitable_event_create; + cef_xml_reader_create_ptr cef_xml_reader_create; + cef_zip_reader_create_ptr cef_zip_reader_create; + cef_translator_test_create_ptr cef_translator_test_create; + cef_translator_test_ref_ptr_library_create_ptr + cef_translator_test_ref_ptr_library_create; + cef_translator_test_ref_ptr_library_child_create_ptr + cef_translator_test_ref_ptr_library_child_create; + cef_translator_test_ref_ptr_library_child_child_create_ptr + cef_translator_test_ref_ptr_library_child_child_create; + cef_translator_test_scoped_library_create_ptr + cef_translator_test_scoped_library_create; + cef_translator_test_scoped_library_child_create_ptr + cef_translator_test_scoped_library_child_create; + cef_translator_test_scoped_library_child_child_create_ptr + cef_translator_test_scoped_library_child_child_create; + cef_browser_view_create_ptr cef_browser_view_create; + cef_browser_view_get_for_browser_ptr cef_browser_view_get_for_browser; + cef_display_get_primary_ptr cef_display_get_primary; + cef_display_get_nearest_point_ptr cef_display_get_nearest_point; + cef_display_get_matching_bounds_ptr cef_display_get_matching_bounds; + cef_display_get_count_ptr cef_display_get_count; + cef_display_get_alls_ptr cef_display_get_alls; + cef_label_button_create_ptr cef_label_button_create; + cef_menu_button_create_ptr cef_menu_button_create; + cef_panel_create_ptr cef_panel_create; + cef_scroll_view_create_ptr cef_scroll_view_create; + cef_textfield_create_ptr cef_textfield_create; + cef_window_create_top_level_ptr cef_window_create_top_level; + cef_version_info_ptr cef_version_info; + cef_api_hash_ptr cef_api_hash; + cef_get_min_log_level_ptr cef_get_min_log_level; + cef_get_vlog_level_ptr cef_get_vlog_level; + cef_log_ptr cef_log; + cef_string_list_alloc_ptr cef_string_list_alloc; + cef_string_list_size_ptr cef_string_list_size; + cef_string_list_value_ptr cef_string_list_value; + cef_string_list_append_ptr cef_string_list_append; + cef_string_list_clear_ptr cef_string_list_clear; + cef_string_list_free_ptr cef_string_list_free; + cef_string_list_copy_ptr cef_string_list_copy; + cef_string_map_alloc_ptr cef_string_map_alloc; + cef_string_map_size_ptr cef_string_map_size; + cef_string_map_find_ptr cef_string_map_find; + cef_string_map_key_ptr cef_string_map_key; + cef_string_map_value_ptr cef_string_map_value; + cef_string_map_append_ptr cef_string_map_append; + cef_string_map_clear_ptr cef_string_map_clear; + cef_string_map_free_ptr cef_string_map_free; + cef_string_multimap_alloc_ptr cef_string_multimap_alloc; + cef_string_multimap_size_ptr cef_string_multimap_size; + cef_string_multimap_find_count_ptr cef_string_multimap_find_count; + cef_string_multimap_enumerate_ptr cef_string_multimap_enumerate; + cef_string_multimap_key_ptr cef_string_multimap_key; + cef_string_multimap_value_ptr cef_string_multimap_value; + cef_string_multimap_append_ptr cef_string_multimap_append; + cef_string_multimap_clear_ptr cef_string_multimap_clear; + cef_string_multimap_free_ptr cef_string_multimap_free; + cef_string_wide_set_ptr cef_string_wide_set; + cef_string_utf8_set_ptr cef_string_utf8_set; + cef_string_utf16_set_ptr cef_string_utf16_set; + cef_string_wide_clear_ptr cef_string_wide_clear; + cef_string_utf8_clear_ptr cef_string_utf8_clear; + cef_string_utf16_clear_ptr cef_string_utf16_clear; + cef_string_wide_cmp_ptr cef_string_wide_cmp; + cef_string_utf8_cmp_ptr cef_string_utf8_cmp; + cef_string_utf16_cmp_ptr cef_string_utf16_cmp; + cef_string_wide_to_utf8_ptr cef_string_wide_to_utf8; + cef_string_utf8_to_wide_ptr cef_string_utf8_to_wide; + cef_string_wide_to_utf16_ptr cef_string_wide_to_utf16; + cef_string_utf16_to_wide_ptr cef_string_utf16_to_wide; + cef_string_utf8_to_utf16_ptr cef_string_utf8_to_utf16; + cef_string_utf16_to_utf8_ptr cef_string_utf16_to_utf8; + cef_string_ascii_to_wide_ptr cef_string_ascii_to_wide; + cef_string_ascii_to_utf16_ptr cef_string_ascii_to_utf16; + cef_string_userfree_wide_alloc_ptr cef_string_userfree_wide_alloc; + cef_string_userfree_utf8_alloc_ptr cef_string_userfree_utf8_alloc; + cef_string_userfree_utf16_alloc_ptr cef_string_userfree_utf16_alloc; + cef_string_userfree_wide_free_ptr cef_string_userfree_wide_free; + cef_string_userfree_utf8_free_ptr cef_string_userfree_utf8_free; + cef_string_userfree_utf16_free_ptr cef_string_userfree_utf16_free; + cef_string_utf16_to_lower_ptr cef_string_utf16_to_lower; + cef_string_utf16_to_upper_ptr cef_string_utf16_to_upper; + cef_get_current_platform_thread_id_ptr cef_get_current_platform_thread_id; + cef_get_current_platform_thread_handle_ptr + cef_get_current_platform_thread_handle; + cef_time_to_timet_ptr cef_time_to_timet; + cef_time_from_timet_ptr cef_time_from_timet; + cef_time_to_doublet_ptr cef_time_to_doublet; + cef_time_from_doublet_ptr cef_time_from_doublet; + cef_time_now_ptr cef_time_now; + cef_time_delta_ptr cef_time_delta; + cef_trace_event_instant_ptr cef_trace_event_instant; + cef_trace_event_begin_ptr cef_trace_event_begin; + cef_trace_event_end_ptr cef_trace_event_end; + cef_trace_counter_ptr cef_trace_counter; + cef_trace_counter_id_ptr cef_trace_counter_id; + cef_trace_event_async_begin_ptr cef_trace_event_async_begin; + cef_trace_event_async_step_into_ptr cef_trace_event_async_step_into; + cef_trace_event_async_step_past_ptr cef_trace_event_async_step_past; + cef_trace_event_async_end_ptr cef_trace_event_async_end; + +} g_libcef_pointers = {0}; + +#define INIT_ENTRY(name) \ + g_libcef_pointers.name = (name##_ptr)libcef_get_ptr(path, #name); \ + if (!g_libcef_pointers.name) { \ + return 0; \ + } + +int libcef_init_pointers(const char* path) { + INIT_ENTRY(cef_execute_process); + INIT_ENTRY(cef_initialize); + INIT_ENTRY(cef_shutdown); + INIT_ENTRY(cef_do_message_loop_work); + INIT_ENTRY(cef_run_message_loop); + INIT_ENTRY(cef_quit_message_loop); + INIT_ENTRY(cef_set_osmodal_loop); + INIT_ENTRY(cef_enable_highdpi_support); + INIT_ENTRY(cef_crash_reporting_enabled); + INIT_ENTRY(cef_set_crash_key_value); + INIT_ENTRY(cef_create_directory); + INIT_ENTRY(cef_get_temp_directory); + INIT_ENTRY(cef_create_new_temp_directory); + INIT_ENTRY(cef_create_temp_directory_in_directory); + INIT_ENTRY(cef_directory_exists); + INIT_ENTRY(cef_delete_file); + INIT_ENTRY(cef_zip_directory); + INIT_ENTRY(cef_load_crlsets_file); + INIT_ENTRY(cef_add_cross_origin_whitelist_entry); + INIT_ENTRY(cef_remove_cross_origin_whitelist_entry); + INIT_ENTRY(cef_clear_cross_origin_whitelist); + INIT_ENTRY(cef_parse_url); + INIT_ENTRY(cef_create_url); + INIT_ENTRY(cef_format_url_for_security_display); + INIT_ENTRY(cef_get_mime_type); + INIT_ENTRY(cef_get_extensions_for_mime_type); + INIT_ENTRY(cef_base64encode); + INIT_ENTRY(cef_base64decode); + INIT_ENTRY(cef_uriencode); + INIT_ENTRY(cef_uridecode); + INIT_ENTRY(cef_parse_json); + INIT_ENTRY(cef_parse_jsonand_return_error); + INIT_ENTRY(cef_write_json); + INIT_ENTRY(cef_get_path); + INIT_ENTRY(cef_launch_process); + INIT_ENTRY(cef_register_scheme_handler_factory); + INIT_ENTRY(cef_clear_scheme_handler_factories); + INIT_ENTRY(cef_is_cert_status_error); + INIT_ENTRY(cef_is_cert_status_minor_error); + INIT_ENTRY(cef_currently_on); + INIT_ENTRY(cef_post_task); + INIT_ENTRY(cef_post_delayed_task); + INIT_ENTRY(cef_begin_tracing); + INIT_ENTRY(cef_end_tracing); + INIT_ENTRY(cef_now_from_system_trace_time); + INIT_ENTRY(cef_register_extension); + INIT_ENTRY(cef_visit_web_plugin_info); + INIT_ENTRY(cef_refresh_web_plugins); + INIT_ENTRY(cef_unregister_internal_web_plugin); + INIT_ENTRY(cef_register_web_plugin_crash); + INIT_ENTRY(cef_is_web_plugin_unstable); + INIT_ENTRY(cef_register_widevine_cdm); + INIT_ENTRY(cef_execute_java_script_with_user_gesture_for_tests); + INIT_ENTRY(cef_browser_host_create_browser); + INIT_ENTRY(cef_browser_host_create_browser_sync); + INIT_ENTRY(cef_command_line_create); + INIT_ENTRY(cef_command_line_get_global); + INIT_ENTRY(cef_cookie_manager_get_global_manager); + INIT_ENTRY(cef_cookie_manager_get_blocking_manager); + INIT_ENTRY(cef_cookie_manager_create_manager); + INIT_ENTRY(cef_drag_data_create); + INIT_ENTRY(cef_image_create); + INIT_ENTRY(cef_menu_model_create); + INIT_ENTRY(cef_print_settings_create); + INIT_ENTRY(cef_process_message_create); + INIT_ENTRY(cef_request_create); + INIT_ENTRY(cef_post_data_create); + INIT_ENTRY(cef_post_data_element_create); + INIT_ENTRY(cef_request_context_get_global_context); + INIT_ENTRY(cef_request_context_create_context); + INIT_ENTRY(cef_create_context_shared); + INIT_ENTRY(cef_resource_bundle_get_global); + INIT_ENTRY(cef_response_create); + INIT_ENTRY(cef_server_create); + INIT_ENTRY(cef_stream_reader_create_for_file); + INIT_ENTRY(cef_stream_reader_create_for_data); + INIT_ENTRY(cef_stream_reader_create_for_handler); + INIT_ENTRY(cef_stream_writer_create_for_file); + INIT_ENTRY(cef_stream_writer_create_for_handler); + INIT_ENTRY(cef_task_runner_get_for_current_thread); + INIT_ENTRY(cef_task_runner_get_for_thread); + INIT_ENTRY(cef_thread_create); + INIT_ENTRY(cef_urlrequest_create); + INIT_ENTRY(cef_v8context_get_current_context); + INIT_ENTRY(cef_v8context_get_entered_context); + INIT_ENTRY(cef_v8context_in_context); + INIT_ENTRY(cef_v8value_create_undefined); + INIT_ENTRY(cef_v8value_create_null); + INIT_ENTRY(cef_v8value_create_bool); + INIT_ENTRY(cef_v8value_create_int); + INIT_ENTRY(cef_v8value_create_uint); + INIT_ENTRY(cef_v8value_create_double); + INIT_ENTRY(cef_v8value_create_date); + INIT_ENTRY(cef_v8value_create_string); + INIT_ENTRY(cef_v8value_create_object); + INIT_ENTRY(cef_v8value_create_array); + INIT_ENTRY(cef_v8value_create_array_buffer); + INIT_ENTRY(cef_v8value_create_function); + INIT_ENTRY(cef_v8stack_trace_get_current); + INIT_ENTRY(cef_value_create); + INIT_ENTRY(cef_binary_value_create); + INIT_ENTRY(cef_dictionary_value_create); + INIT_ENTRY(cef_list_value_create); + INIT_ENTRY(cef_waitable_event_create); + INIT_ENTRY(cef_xml_reader_create); + INIT_ENTRY(cef_zip_reader_create); + INIT_ENTRY(cef_translator_test_create); + INIT_ENTRY(cef_translator_test_ref_ptr_library_create); + INIT_ENTRY(cef_translator_test_ref_ptr_library_child_create); + INIT_ENTRY(cef_translator_test_ref_ptr_library_child_child_create); + INIT_ENTRY(cef_translator_test_scoped_library_create); + INIT_ENTRY(cef_translator_test_scoped_library_child_create); + INIT_ENTRY(cef_translator_test_scoped_library_child_child_create); + INIT_ENTRY(cef_browser_view_create); + INIT_ENTRY(cef_browser_view_get_for_browser); + INIT_ENTRY(cef_display_get_primary); + INIT_ENTRY(cef_display_get_nearest_point); + INIT_ENTRY(cef_display_get_matching_bounds); + INIT_ENTRY(cef_display_get_count); + INIT_ENTRY(cef_display_get_alls); + INIT_ENTRY(cef_label_button_create); + INIT_ENTRY(cef_menu_button_create); + INIT_ENTRY(cef_panel_create); + INIT_ENTRY(cef_scroll_view_create); + INIT_ENTRY(cef_textfield_create); + INIT_ENTRY(cef_window_create_top_level); + INIT_ENTRY(cef_version_info); + INIT_ENTRY(cef_api_hash); + INIT_ENTRY(cef_get_min_log_level); + INIT_ENTRY(cef_get_vlog_level); + INIT_ENTRY(cef_log); + INIT_ENTRY(cef_string_list_alloc); + INIT_ENTRY(cef_string_list_size); + INIT_ENTRY(cef_string_list_value); + INIT_ENTRY(cef_string_list_append); + INIT_ENTRY(cef_string_list_clear); + INIT_ENTRY(cef_string_list_free); + INIT_ENTRY(cef_string_list_copy); + INIT_ENTRY(cef_string_map_alloc); + INIT_ENTRY(cef_string_map_size); + INIT_ENTRY(cef_string_map_find); + INIT_ENTRY(cef_string_map_key); + INIT_ENTRY(cef_string_map_value); + INIT_ENTRY(cef_string_map_append); + INIT_ENTRY(cef_string_map_clear); + INIT_ENTRY(cef_string_map_free); + INIT_ENTRY(cef_string_multimap_alloc); + INIT_ENTRY(cef_string_multimap_size); + INIT_ENTRY(cef_string_multimap_find_count); + INIT_ENTRY(cef_string_multimap_enumerate); + INIT_ENTRY(cef_string_multimap_key); + INIT_ENTRY(cef_string_multimap_value); + INIT_ENTRY(cef_string_multimap_append); + INIT_ENTRY(cef_string_multimap_clear); + INIT_ENTRY(cef_string_multimap_free); + INIT_ENTRY(cef_string_wide_set); + INIT_ENTRY(cef_string_utf8_set); + INIT_ENTRY(cef_string_utf16_set); + INIT_ENTRY(cef_string_wide_clear); + INIT_ENTRY(cef_string_utf8_clear); + INIT_ENTRY(cef_string_utf16_clear); + INIT_ENTRY(cef_string_wide_cmp); + INIT_ENTRY(cef_string_utf8_cmp); + INIT_ENTRY(cef_string_utf16_cmp); + INIT_ENTRY(cef_string_wide_to_utf8); + INIT_ENTRY(cef_string_utf8_to_wide); + INIT_ENTRY(cef_string_wide_to_utf16); + INIT_ENTRY(cef_string_utf16_to_wide); + INIT_ENTRY(cef_string_utf8_to_utf16); + INIT_ENTRY(cef_string_utf16_to_utf8); + INIT_ENTRY(cef_string_ascii_to_wide); + INIT_ENTRY(cef_string_ascii_to_utf16); + INIT_ENTRY(cef_string_userfree_wide_alloc); + INIT_ENTRY(cef_string_userfree_utf8_alloc); + INIT_ENTRY(cef_string_userfree_utf16_alloc); + INIT_ENTRY(cef_string_userfree_wide_free); + INIT_ENTRY(cef_string_userfree_utf8_free); + INIT_ENTRY(cef_string_userfree_utf16_free); + INIT_ENTRY(cef_string_utf16_to_lower); + INIT_ENTRY(cef_string_utf16_to_upper); + INIT_ENTRY(cef_get_current_platform_thread_id); + INIT_ENTRY(cef_get_current_platform_thread_handle); + INIT_ENTRY(cef_time_to_timet); + INIT_ENTRY(cef_time_from_timet); + INIT_ENTRY(cef_time_to_doublet); + INIT_ENTRY(cef_time_from_doublet); + INIT_ENTRY(cef_time_now); + INIT_ENTRY(cef_time_delta); + INIT_ENTRY(cef_trace_event_instant); + INIT_ENTRY(cef_trace_event_begin); + INIT_ENTRY(cef_trace_event_end); + INIT_ENTRY(cef_trace_counter); + INIT_ENTRY(cef_trace_counter_id); + INIT_ENTRY(cef_trace_event_async_begin); + INIT_ENTRY(cef_trace_event_async_step_into); + INIT_ENTRY(cef_trace_event_async_step_past); + INIT_ENTRY(cef_trace_event_async_end); + return 1; +} + +} // namespace + +int cef_load_library(const char* path) { + if (g_libcef_handle) + return 0; + + g_libcef_handle = dlopen(path, RTLD_LAZY | RTLD_LOCAL | RTLD_FIRST); + if (!g_libcef_handle) { + fprintf(stderr, "dlopen %s: %s\n", path, dlerror()); + return 0; + } + + if (!libcef_init_pointers(path)) { + cef_unload_library(); + return 0; + } + + return 1; +} + +int cef_unload_library() { + int result = 0; + if (g_libcef_handle) { + result = !dlclose(g_libcef_handle); + if (!result) { + fprintf(stderr, "dlclose: %s\n", dlerror()); + } + g_libcef_handle = NULL; + } + return result; +} + +NO_SANITIZE("cfi-icall") +int cef_execute_process(const struct _cef_main_args_t* args, + struct _cef_app_t* application, + void* windows_sandbox_info) { + return g_libcef_pointers.cef_execute_process(args, application, + windows_sandbox_info); +} + +NO_SANITIZE("cfi-icall") +int cef_initialize(const struct _cef_main_args_t* args, + const struct _cef_settings_t* settings, + struct _cef_app_t* application, + void* windows_sandbox_info) { + return g_libcef_pointers.cef_initialize(args, settings, application, + windows_sandbox_info); +} + +NO_SANITIZE("cfi-icall") void cef_shutdown() { + g_libcef_pointers.cef_shutdown(); +} + +NO_SANITIZE("cfi-icall") void cef_do_message_loop_work() { + g_libcef_pointers.cef_do_message_loop_work(); +} + +NO_SANITIZE("cfi-icall") void cef_run_message_loop() { + g_libcef_pointers.cef_run_message_loop(); +} + +NO_SANITIZE("cfi-icall") void cef_quit_message_loop() { + g_libcef_pointers.cef_quit_message_loop(); +} + +NO_SANITIZE("cfi-icall") void cef_set_osmodal_loop(int osModalLoop) { + g_libcef_pointers.cef_set_osmodal_loop(osModalLoop); +} + +NO_SANITIZE("cfi-icall") void cef_enable_highdpi_support() { + g_libcef_pointers.cef_enable_highdpi_support(); +} + +NO_SANITIZE("cfi-icall") int cef_crash_reporting_enabled() { + return g_libcef_pointers.cef_crash_reporting_enabled(); +} + +NO_SANITIZE("cfi-icall") +void cef_set_crash_key_value(const cef_string_t* key, + const cef_string_t* value) { + g_libcef_pointers.cef_set_crash_key_value(key, value); +} + +NO_SANITIZE("cfi-icall") +int cef_create_directory(const cef_string_t* full_path) { + return g_libcef_pointers.cef_create_directory(full_path); +} + +NO_SANITIZE("cfi-icall") int cef_get_temp_directory(cef_string_t* temp_dir) { + return g_libcef_pointers.cef_get_temp_directory(temp_dir); +} + +NO_SANITIZE("cfi-icall") +int cef_create_new_temp_directory(const cef_string_t* prefix, + cef_string_t* new_temp_path) { + return g_libcef_pointers.cef_create_new_temp_directory(prefix, new_temp_path); +} + +NO_SANITIZE("cfi-icall") +int cef_create_temp_directory_in_directory(const cef_string_t* base_dir, + const cef_string_t* prefix, + cef_string_t* new_dir) { + return g_libcef_pointers.cef_create_temp_directory_in_directory( + base_dir, prefix, new_dir); +} + +NO_SANITIZE("cfi-icall") int cef_directory_exists(const cef_string_t* path) { + return g_libcef_pointers.cef_directory_exists(path); +} + +NO_SANITIZE("cfi-icall") +int cef_delete_file(const cef_string_t* path, int recursive) { + return g_libcef_pointers.cef_delete_file(path, recursive); +} + +NO_SANITIZE("cfi-icall") +int cef_zip_directory(const cef_string_t* src_dir, + const cef_string_t* dest_file, + int include_hidden_files) { + return g_libcef_pointers.cef_zip_directory(src_dir, dest_file, + include_hidden_files); +} + +NO_SANITIZE("cfi-icall") void cef_load_crlsets_file(const cef_string_t* path) { + g_libcef_pointers.cef_load_crlsets_file(path); +} + +NO_SANITIZE("cfi-icall") +int cef_add_cross_origin_whitelist_entry(const cef_string_t* source_origin, + const cef_string_t* target_protocol, + const cef_string_t* target_domain, + int allow_target_subdomains) { + return g_libcef_pointers.cef_add_cross_origin_whitelist_entry( + source_origin, target_protocol, target_domain, allow_target_subdomains); +} + +NO_SANITIZE("cfi-icall") +int cef_remove_cross_origin_whitelist_entry(const cef_string_t* source_origin, + const cef_string_t* target_protocol, + const cef_string_t* target_domain, + int allow_target_subdomains) { + return g_libcef_pointers.cef_remove_cross_origin_whitelist_entry( + source_origin, target_protocol, target_domain, allow_target_subdomains); +} + +NO_SANITIZE("cfi-icall") int cef_clear_cross_origin_whitelist() { + return g_libcef_pointers.cef_clear_cross_origin_whitelist(); +} + +NO_SANITIZE("cfi-icall") +int cef_parse_url(const cef_string_t* url, struct _cef_urlparts_t* parts) { + return g_libcef_pointers.cef_parse_url(url, parts); +} + +NO_SANITIZE("cfi-icall") +int cef_create_url(const struct _cef_urlparts_t* parts, cef_string_t* url) { + return g_libcef_pointers.cef_create_url(parts, url); +} + +NO_SANITIZE("cfi-icall") +cef_string_userfree_t + cef_format_url_for_security_display(const cef_string_t* origin_url) { + return g_libcef_pointers.cef_format_url_for_security_display(origin_url); +} + +NO_SANITIZE("cfi-icall") +cef_string_userfree_t cef_get_mime_type(const cef_string_t* extension) { + return g_libcef_pointers.cef_get_mime_type(extension); +} + +NO_SANITIZE("cfi-icall") +void cef_get_extensions_for_mime_type(const cef_string_t* mime_type, + cef_string_list_t extensions) { + g_libcef_pointers.cef_get_extensions_for_mime_type(mime_type, extensions); +} + +NO_SANITIZE("cfi-icall") +cef_string_userfree_t cef_base64encode(const void* data, size_t data_size) { + return g_libcef_pointers.cef_base64encode(data, data_size); +} + +NO_SANITIZE("cfi-icall") +struct _cef_binary_value_t* cef_base64decode(const cef_string_t* data) { + return g_libcef_pointers.cef_base64decode(data); +} + +NO_SANITIZE("cfi-icall") +cef_string_userfree_t cef_uriencode(const cef_string_t* text, int use_plus) { + return g_libcef_pointers.cef_uriencode(text, use_plus); +} + +NO_SANITIZE("cfi-icall") +cef_string_userfree_t cef_uridecode(const cef_string_t* text, + int convert_to_utf8, + cef_uri_unescape_rule_t unescape_rule) { + return g_libcef_pointers.cef_uridecode(text, convert_to_utf8, unescape_rule); +} + +NO_SANITIZE("cfi-icall") +struct _cef_value_t* cef_parse_json(const cef_string_t* json_string, + cef_json_parser_options_t options) { + return g_libcef_pointers.cef_parse_json(json_string, options); +} + +NO_SANITIZE("cfi-icall") +struct _cef_value_t* cef_parse_jsonand_return_error( + const cef_string_t* json_string, + cef_json_parser_options_t options, + cef_json_parser_error_t* error_code_out, + cef_string_t* error_msg_out) { + return g_libcef_pointers.cef_parse_jsonand_return_error( + json_string, options, error_code_out, error_msg_out); +} + +NO_SANITIZE("cfi-icall") +cef_string_userfree_t cef_write_json(struct _cef_value_t* node, + cef_json_writer_options_t options) { + return g_libcef_pointers.cef_write_json(node, options); +} + +NO_SANITIZE("cfi-icall") +int cef_get_path(cef_path_key_t key, cef_string_t* path) { + return g_libcef_pointers.cef_get_path(key, path); +} + +NO_SANITIZE("cfi-icall") +int cef_launch_process(struct _cef_command_line_t* command_line) { + return g_libcef_pointers.cef_launch_process(command_line); +} + +NO_SANITIZE("cfi-icall") +int cef_register_scheme_handler_factory( + const cef_string_t* scheme_name, + const cef_string_t* domain_name, + struct _cef_scheme_handler_factory_t* factory) { + return g_libcef_pointers.cef_register_scheme_handler_factory( + scheme_name, domain_name, factory); +} + +NO_SANITIZE("cfi-icall") int cef_clear_scheme_handler_factories() { + return g_libcef_pointers.cef_clear_scheme_handler_factories(); +} + +NO_SANITIZE("cfi-icall") +int cef_is_cert_status_error(cef_cert_status_t status) { + return g_libcef_pointers.cef_is_cert_status_error(status); +} + +NO_SANITIZE("cfi-icall") +int cef_is_cert_status_minor_error(cef_cert_status_t status) { + return g_libcef_pointers.cef_is_cert_status_minor_error(status); +} + +NO_SANITIZE("cfi-icall") int cef_currently_on(cef_thread_id_t threadId) { + return g_libcef_pointers.cef_currently_on(threadId); +} + +NO_SANITIZE("cfi-icall") +int cef_post_task(cef_thread_id_t threadId, struct _cef_task_t* task) { + return g_libcef_pointers.cef_post_task(threadId, task); +} + +NO_SANITIZE("cfi-icall") +int cef_post_delayed_task(cef_thread_id_t threadId, + struct _cef_task_t* task, + int64 delay_ms) { + return g_libcef_pointers.cef_post_delayed_task(threadId, task, delay_ms); +} + +NO_SANITIZE("cfi-icall") +int cef_begin_tracing(const cef_string_t* categories, + struct _cef_completion_callback_t* callback) { + return g_libcef_pointers.cef_begin_tracing(categories, callback); +} + +NO_SANITIZE("cfi-icall") +int cef_end_tracing(const cef_string_t* tracing_file, + struct _cef_end_tracing_callback_t* callback) { + return g_libcef_pointers.cef_end_tracing(tracing_file, callback); +} + +NO_SANITIZE("cfi-icall") int64 cef_now_from_system_trace_time() { + return g_libcef_pointers.cef_now_from_system_trace_time(); +} + +NO_SANITIZE("cfi-icall") +int cef_register_extension(const cef_string_t* extension_name, + const cef_string_t* javascript_code, + struct _cef_v8handler_t* handler) { + return g_libcef_pointers.cef_register_extension(extension_name, + javascript_code, handler); +} + +NO_SANITIZE("cfi-icall") +void cef_visit_web_plugin_info(struct _cef_web_plugin_info_visitor_t* visitor) { + g_libcef_pointers.cef_visit_web_plugin_info(visitor); +} + +NO_SANITIZE("cfi-icall") void cef_refresh_web_plugins() { + g_libcef_pointers.cef_refresh_web_plugins(); +} + +NO_SANITIZE("cfi-icall") +void cef_unregister_internal_web_plugin(const cef_string_t* path) { + g_libcef_pointers.cef_unregister_internal_web_plugin(path); +} + +NO_SANITIZE("cfi-icall") +void cef_register_web_plugin_crash(const cef_string_t* path) { + g_libcef_pointers.cef_register_web_plugin_crash(path); +} + +NO_SANITIZE("cfi-icall") +void cef_is_web_plugin_unstable( + const cef_string_t* path, + struct _cef_web_plugin_unstable_callback_t* callback) { + g_libcef_pointers.cef_is_web_plugin_unstable(path, callback); +} + +NO_SANITIZE("cfi-icall") +void cef_register_widevine_cdm(const cef_string_t* path, + struct _cef_register_cdm_callback_t* callback) { + g_libcef_pointers.cef_register_widevine_cdm(path, callback); +} + +NO_SANITIZE("cfi-icall") +void cef_execute_java_script_with_user_gesture_for_tests( + struct _cef_frame_t* frame, + const cef_string_t* javascript) { + g_libcef_pointers.cef_execute_java_script_with_user_gesture_for_tests( + frame, javascript); +} + +NO_SANITIZE("cfi-icall") +int cef_browser_host_create_browser( + const struct _cef_window_info_t* windowInfo, + struct _cef_client_t* client, + const cef_string_t* url, + const struct _cef_browser_settings_t* settings, + struct _cef_request_context_t* request_context) { + return g_libcef_pointers.cef_browser_host_create_browser( + windowInfo, client, url, settings, request_context); +} + +NO_SANITIZE("cfi-icall") +struct _cef_browser_t* cef_browser_host_create_browser_sync( + const struct _cef_window_info_t* windowInfo, + struct _cef_client_t* client, + const cef_string_t* url, + const struct _cef_browser_settings_t* settings, + struct _cef_request_context_t* request_context) { + return g_libcef_pointers.cef_browser_host_create_browser_sync( + windowInfo, client, url, settings, request_context); +} + +NO_SANITIZE("cfi-icall") struct _cef_command_line_t* cef_command_line_create() { + return g_libcef_pointers.cef_command_line_create(); +} + +NO_SANITIZE("cfi-icall") +struct _cef_command_line_t* cef_command_line_get_global() { + return g_libcef_pointers.cef_command_line_get_global(); +} + +NO_SANITIZE("cfi-icall") +struct _cef_cookie_manager_t* cef_cookie_manager_get_global_manager( + struct _cef_completion_callback_t* callback) { + return g_libcef_pointers.cef_cookie_manager_get_global_manager(callback); +} + +NO_SANITIZE("cfi-icall") +struct _cef_cookie_manager_t* cef_cookie_manager_get_blocking_manager() { + return g_libcef_pointers.cef_cookie_manager_get_blocking_manager(); +} + +NO_SANITIZE("cfi-icall") +struct _cef_cookie_manager_t* cef_cookie_manager_create_manager( + const cef_string_t* path, + int persist_session_cookies, + struct _cef_completion_callback_t* callback) { + return g_libcef_pointers.cef_cookie_manager_create_manager( + path, persist_session_cookies, callback); +} + +NO_SANITIZE("cfi-icall") struct _cef_drag_data_t* cef_drag_data_create() { + return g_libcef_pointers.cef_drag_data_create(); +} + +NO_SANITIZE("cfi-icall") struct _cef_image_t* cef_image_create() { + return g_libcef_pointers.cef_image_create(); +} + +NO_SANITIZE("cfi-icall") +struct _cef_menu_model_t* cef_menu_model_create( + struct _cef_menu_model_delegate_t* delegate) { + return g_libcef_pointers.cef_menu_model_create(delegate); +} + +NO_SANITIZE("cfi-icall") +struct _cef_print_settings_t* cef_print_settings_create() { + return g_libcef_pointers.cef_print_settings_create(); +} + +NO_SANITIZE("cfi-icall") +struct _cef_process_message_t* cef_process_message_create( + const cef_string_t* name) { + return g_libcef_pointers.cef_process_message_create(name); +} + +NO_SANITIZE("cfi-icall") struct _cef_request_t* cef_request_create() { + return g_libcef_pointers.cef_request_create(); +} + +NO_SANITIZE("cfi-icall") struct _cef_post_data_t* cef_post_data_create() { + return g_libcef_pointers.cef_post_data_create(); +} + +NO_SANITIZE("cfi-icall") +struct _cef_post_data_element_t* cef_post_data_element_create() { + return g_libcef_pointers.cef_post_data_element_create(); +} + +NO_SANITIZE("cfi-icall") +struct _cef_request_context_t* cef_request_context_get_global_context() { + return g_libcef_pointers.cef_request_context_get_global_context(); +} + +NO_SANITIZE("cfi-icall") +struct _cef_request_context_t* cef_request_context_create_context( + const struct _cef_request_context_settings_t* settings, + struct _cef_request_context_handler_t* handler) { + return g_libcef_pointers.cef_request_context_create_context(settings, + handler); +} + +NO_SANITIZE("cfi-icall") +struct _cef_request_context_t* cef_create_context_shared( + struct _cef_request_context_t* other, + struct _cef_request_context_handler_t* handler) { + return g_libcef_pointers.cef_create_context_shared(other, handler); +} + +NO_SANITIZE("cfi-icall") +struct _cef_resource_bundle_t* cef_resource_bundle_get_global() { + return g_libcef_pointers.cef_resource_bundle_get_global(); +} + +NO_SANITIZE("cfi-icall") struct _cef_response_t* cef_response_create() { + return g_libcef_pointers.cef_response_create(); +} + +NO_SANITIZE("cfi-icall") +void cef_server_create(const cef_string_t* address, + uint16 port, + int backlog, + struct _cef_server_handler_t* handler) { + g_libcef_pointers.cef_server_create(address, port, backlog, handler); +} + +NO_SANITIZE("cfi-icall") +struct _cef_stream_reader_t* cef_stream_reader_create_for_file( + const cef_string_t* fileName) { + return g_libcef_pointers.cef_stream_reader_create_for_file(fileName); +} + +NO_SANITIZE("cfi-icall") +struct _cef_stream_reader_t* cef_stream_reader_create_for_data(void* data, + size_t size) { + return g_libcef_pointers.cef_stream_reader_create_for_data(data, size); +} + +NO_SANITIZE("cfi-icall") +struct _cef_stream_reader_t* cef_stream_reader_create_for_handler( + struct _cef_read_handler_t* handler) { + return g_libcef_pointers.cef_stream_reader_create_for_handler(handler); +} + +NO_SANITIZE("cfi-icall") +struct _cef_stream_writer_t* cef_stream_writer_create_for_file( + const cef_string_t* fileName) { + return g_libcef_pointers.cef_stream_writer_create_for_file(fileName); +} + +NO_SANITIZE("cfi-icall") +struct _cef_stream_writer_t* cef_stream_writer_create_for_handler( + struct _cef_write_handler_t* handler) { + return g_libcef_pointers.cef_stream_writer_create_for_handler(handler); +} + +NO_SANITIZE("cfi-icall") +struct _cef_task_runner_t* cef_task_runner_get_for_current_thread() { + return g_libcef_pointers.cef_task_runner_get_for_current_thread(); +} + +NO_SANITIZE("cfi-icall") +struct _cef_task_runner_t* cef_task_runner_get_for_thread( + cef_thread_id_t threadId) { + return g_libcef_pointers.cef_task_runner_get_for_thread(threadId); +} + +NO_SANITIZE("cfi-icall") +struct _cef_thread_t* cef_thread_create( + const cef_string_t* display_name, + cef_thread_priority_t priority, + cef_message_loop_type_t message_loop_type, + int stoppable, + cef_com_init_mode_t com_init_mode) { + return g_libcef_pointers.cef_thread_create( + display_name, priority, message_loop_type, stoppable, com_init_mode); +} + +NO_SANITIZE("cfi-icall") +struct _cef_urlrequest_t* cef_urlrequest_create( + struct _cef_request_t* request, + struct _cef_urlrequest_client_t* client, + struct _cef_request_context_t* request_context) { + return g_libcef_pointers.cef_urlrequest_create(request, client, + request_context); +} + +NO_SANITIZE("cfi-icall") +struct _cef_v8context_t* cef_v8context_get_current_context() { + return g_libcef_pointers.cef_v8context_get_current_context(); +} + +NO_SANITIZE("cfi-icall") +struct _cef_v8context_t* cef_v8context_get_entered_context() { + return g_libcef_pointers.cef_v8context_get_entered_context(); +} + +NO_SANITIZE("cfi-icall") int cef_v8context_in_context() { + return g_libcef_pointers.cef_v8context_in_context(); +} + +NO_SANITIZE("cfi-icall") struct _cef_v8value_t* cef_v8value_create_undefined() { + return g_libcef_pointers.cef_v8value_create_undefined(); +} + +NO_SANITIZE("cfi-icall") struct _cef_v8value_t* cef_v8value_create_null() { + return g_libcef_pointers.cef_v8value_create_null(); +} + +NO_SANITIZE("cfi-icall") +struct _cef_v8value_t* cef_v8value_create_bool(int value) { + return g_libcef_pointers.cef_v8value_create_bool(value); +} + +NO_SANITIZE("cfi-icall") +struct _cef_v8value_t* cef_v8value_create_int(int32 value) { + return g_libcef_pointers.cef_v8value_create_int(value); +} + +NO_SANITIZE("cfi-icall") +struct _cef_v8value_t* cef_v8value_create_uint(uint32 value) { + return g_libcef_pointers.cef_v8value_create_uint(value); +} + +NO_SANITIZE("cfi-icall") +struct _cef_v8value_t* cef_v8value_create_double(double value) { + return g_libcef_pointers.cef_v8value_create_double(value); +} + +NO_SANITIZE("cfi-icall") +struct _cef_v8value_t* cef_v8value_create_date(const cef_time_t* date) { + return g_libcef_pointers.cef_v8value_create_date(date); +} + +NO_SANITIZE("cfi-icall") +struct _cef_v8value_t* cef_v8value_create_string(const cef_string_t* value) { + return g_libcef_pointers.cef_v8value_create_string(value); +} + +NO_SANITIZE("cfi-icall") +struct _cef_v8value_t* cef_v8value_create_object( + struct _cef_v8accessor_t* accessor, + struct _cef_v8interceptor_t* interceptor) { + return g_libcef_pointers.cef_v8value_create_object(accessor, interceptor); +} + +NO_SANITIZE("cfi-icall") +struct _cef_v8value_t* cef_v8value_create_array(int length) { + return g_libcef_pointers.cef_v8value_create_array(length); +} + +NO_SANITIZE("cfi-icall") +struct _cef_v8value_t* cef_v8value_create_array_buffer( + void* buffer, + size_t length, + struct _cef_v8array_buffer_release_callback_t* release_callback) { + return g_libcef_pointers.cef_v8value_create_array_buffer(buffer, length, + release_callback); +} + +NO_SANITIZE("cfi-icall") +struct _cef_v8value_t* cef_v8value_create_function( + const cef_string_t* name, + struct _cef_v8handler_t* handler) { + return g_libcef_pointers.cef_v8value_create_function(name, handler); +} + +NO_SANITIZE("cfi-icall") +struct _cef_v8stack_trace_t* cef_v8stack_trace_get_current(int frame_limit) { + return g_libcef_pointers.cef_v8stack_trace_get_current(frame_limit); +} + +NO_SANITIZE("cfi-icall") struct _cef_value_t* cef_value_create() { + return g_libcef_pointers.cef_value_create(); +} + +NO_SANITIZE("cfi-icall") +struct _cef_binary_value_t* cef_binary_value_create(const void* data, + size_t data_size) { + return g_libcef_pointers.cef_binary_value_create(data, data_size); +} + +NO_SANITIZE("cfi-icall") +struct _cef_dictionary_value_t* cef_dictionary_value_create() { + return g_libcef_pointers.cef_dictionary_value_create(); +} + +NO_SANITIZE("cfi-icall") struct _cef_list_value_t* cef_list_value_create() { + return g_libcef_pointers.cef_list_value_create(); +} + +NO_SANITIZE("cfi-icall") +struct _cef_waitable_event_t* cef_waitable_event_create( + int automatic_reset, + int initially_signaled) { + return g_libcef_pointers.cef_waitable_event_create(automatic_reset, + initially_signaled); +} + +NO_SANITIZE("cfi-icall") +struct _cef_xml_reader_t* cef_xml_reader_create( + struct _cef_stream_reader_t* stream, + cef_xml_encoding_type_t encodingType, + const cef_string_t* URI) { + return g_libcef_pointers.cef_xml_reader_create(stream, encodingType, URI); +} + +NO_SANITIZE("cfi-icall") +struct _cef_zip_reader_t* cef_zip_reader_create( + struct _cef_stream_reader_t* stream) { + return g_libcef_pointers.cef_zip_reader_create(stream); +} + +NO_SANITIZE("cfi-icall") +struct _cef_translator_test_t* cef_translator_test_create() { + return g_libcef_pointers.cef_translator_test_create(); +} + +NO_SANITIZE("cfi-icall") +struct + _cef_translator_test_ref_ptr_library_t* cef_translator_test_ref_ptr_library_create( + int value) { + return g_libcef_pointers.cef_translator_test_ref_ptr_library_create(value); +} + +NO_SANITIZE("cfi-icall") +struct + _cef_translator_test_ref_ptr_library_child_t* cef_translator_test_ref_ptr_library_child_create( + int value, + int other_value) { + return g_libcef_pointers.cef_translator_test_ref_ptr_library_child_create( + value, other_value); +} + +NO_SANITIZE("cfi-icall") +struct + _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) { + return g_libcef_pointers + .cef_translator_test_ref_ptr_library_child_child_create( + value, other_value, other_other_value); +} + +NO_SANITIZE("cfi-icall") +struct + _cef_translator_test_scoped_library_t* cef_translator_test_scoped_library_create( + int value) { + return g_libcef_pointers.cef_translator_test_scoped_library_create(value); +} + +NO_SANITIZE("cfi-icall") +struct + _cef_translator_test_scoped_library_child_t* cef_translator_test_scoped_library_child_create( + int value, + int other_value) { + return g_libcef_pointers.cef_translator_test_scoped_library_child_create( + value, other_value); +} + +NO_SANITIZE("cfi-icall") +struct + _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) { + return g_libcef_pointers + .cef_translator_test_scoped_library_child_child_create(value, other_value, + other_other_value); +} + +NO_SANITIZE("cfi-icall") +struct _cef_browser_view_t* cef_browser_view_create( + struct _cef_client_t* client, + const cef_string_t* url, + const struct _cef_browser_settings_t* settings, + struct _cef_request_context_t* request_context, + struct _cef_browser_view_delegate_t* delegate) { + return g_libcef_pointers.cef_browser_view_create(client, url, settings, + request_context, delegate); +} + +NO_SANITIZE("cfi-icall") +struct _cef_browser_view_t* cef_browser_view_get_for_browser( + struct _cef_browser_t* browser) { + return g_libcef_pointers.cef_browser_view_get_for_browser(browser); +} + +NO_SANITIZE("cfi-icall") struct _cef_display_t* cef_display_get_primary() { + return g_libcef_pointers.cef_display_get_primary(); +} + +NO_SANITIZE("cfi-icall") +struct _cef_display_t* cef_display_get_nearest_point(const cef_point_t* point, + int input_pixel_coords) { + return g_libcef_pointers.cef_display_get_nearest_point(point, + input_pixel_coords); +} + +NO_SANITIZE("cfi-icall") +struct _cef_display_t* cef_display_get_matching_bounds(const cef_rect_t* bounds, + int input_pixel_coords) { + return g_libcef_pointers.cef_display_get_matching_bounds(bounds, + input_pixel_coords); +} + +NO_SANITIZE("cfi-icall") size_t cef_display_get_count() { + return g_libcef_pointers.cef_display_get_count(); +} + +NO_SANITIZE("cfi-icall") +void cef_display_get_alls(size_t* displaysCount, + struct _cef_display_t** displays) { + g_libcef_pointers.cef_display_get_alls(displaysCount, displays); +} + +NO_SANITIZE("cfi-icall") +struct _cef_label_button_t* cef_label_button_create( + struct _cef_button_delegate_t* delegate, + const cef_string_t* text, + int with_frame) { + return g_libcef_pointers.cef_label_button_create(delegate, text, with_frame); +} + +NO_SANITIZE("cfi-icall") +struct _cef_menu_button_t* cef_menu_button_create( + struct _cef_menu_button_delegate_t* delegate, + const cef_string_t* text, + int with_frame, + int with_menu_marker) { + return g_libcef_pointers.cef_menu_button_create(delegate, text, with_frame, + with_menu_marker); +} + +NO_SANITIZE("cfi-icall") +struct _cef_panel_t* cef_panel_create(struct _cef_panel_delegate_t* delegate) { + return g_libcef_pointers.cef_panel_create(delegate); +} + +NO_SANITIZE("cfi-icall") +struct _cef_scroll_view_t* cef_scroll_view_create( + struct _cef_view_delegate_t* delegate) { + return g_libcef_pointers.cef_scroll_view_create(delegate); +} + +NO_SANITIZE("cfi-icall") +struct _cef_textfield_t* cef_textfield_create( + struct _cef_textfield_delegate_t* delegate) { + return g_libcef_pointers.cef_textfield_create(delegate); +} + +NO_SANITIZE("cfi-icall") +struct _cef_window_t* cef_window_create_top_level( + struct _cef_window_delegate_t* delegate) { + return g_libcef_pointers.cef_window_create_top_level(delegate); +} + +NO_SANITIZE("cfi-icall") int cef_version_info(int entry) { + return g_libcef_pointers.cef_version_info(entry); +} + +NO_SANITIZE("cfi-icall") const char* cef_api_hash(int entry) { + return g_libcef_pointers.cef_api_hash(entry); +} + +NO_SANITIZE("cfi-icall") int cef_get_min_log_level() { + return g_libcef_pointers.cef_get_min_log_level(); +} + +NO_SANITIZE("cfi-icall") +int cef_get_vlog_level(const char* file_start, size_t N) { + return g_libcef_pointers.cef_get_vlog_level(file_start, N); +} + +NO_SANITIZE("cfi-icall") +void cef_log(const char* file, int line, int severity, const char* message) { + g_libcef_pointers.cef_log(file, line, severity, message); +} + +NO_SANITIZE("cfi-icall") cef_string_list_t cef_string_list_alloc() { + return g_libcef_pointers.cef_string_list_alloc(); +} + +NO_SANITIZE("cfi-icall") size_t cef_string_list_size(cef_string_list_t list) { + return g_libcef_pointers.cef_string_list_size(list); +} + +NO_SANITIZE("cfi-icall") +int cef_string_list_value(cef_string_list_t list, + size_t index, + cef_string_t* value) { + return g_libcef_pointers.cef_string_list_value(list, index, value); +} + +NO_SANITIZE("cfi-icall") +void cef_string_list_append(cef_string_list_t list, const cef_string_t* value) { + g_libcef_pointers.cef_string_list_append(list, value); +} + +NO_SANITIZE("cfi-icall") void cef_string_list_clear(cef_string_list_t list) { + g_libcef_pointers.cef_string_list_clear(list); +} + +NO_SANITIZE("cfi-icall") void cef_string_list_free(cef_string_list_t list) { + g_libcef_pointers.cef_string_list_free(list); +} + +NO_SANITIZE("cfi-icall") +cef_string_list_t cef_string_list_copy(cef_string_list_t list) { + return g_libcef_pointers.cef_string_list_copy(list); +} + +NO_SANITIZE("cfi-icall") cef_string_map_t cef_string_map_alloc() { + return g_libcef_pointers.cef_string_map_alloc(); +} + +NO_SANITIZE("cfi-icall") size_t cef_string_map_size(cef_string_map_t map) { + return g_libcef_pointers.cef_string_map_size(map); +} + +NO_SANITIZE("cfi-icall") +int cef_string_map_find(cef_string_map_t map, + const cef_string_t* key, + cef_string_t* value) { + return g_libcef_pointers.cef_string_map_find(map, key, value); +} + +NO_SANITIZE("cfi-icall") +int cef_string_map_key(cef_string_map_t map, size_t index, cef_string_t* key) { + return g_libcef_pointers.cef_string_map_key(map, index, key); +} + +NO_SANITIZE("cfi-icall") +int cef_string_map_value(cef_string_map_t map, + size_t index, + cef_string_t* value) { + return g_libcef_pointers.cef_string_map_value(map, index, value); +} + +NO_SANITIZE("cfi-icall") +int cef_string_map_append(cef_string_map_t map, + const cef_string_t* key, + const cef_string_t* value) { + return g_libcef_pointers.cef_string_map_append(map, key, value); +} + +NO_SANITIZE("cfi-icall") void cef_string_map_clear(cef_string_map_t map) { + g_libcef_pointers.cef_string_map_clear(map); +} + +NO_SANITIZE("cfi-icall") void cef_string_map_free(cef_string_map_t map) { + g_libcef_pointers.cef_string_map_free(map); +} + +NO_SANITIZE("cfi-icall") cef_string_multimap_t cef_string_multimap_alloc() { + return g_libcef_pointers.cef_string_multimap_alloc(); +} + +NO_SANITIZE("cfi-icall") +size_t cef_string_multimap_size(cef_string_multimap_t map) { + return g_libcef_pointers.cef_string_multimap_size(map); +} + +NO_SANITIZE("cfi-icall") +size_t cef_string_multimap_find_count(cef_string_multimap_t map, + const cef_string_t* key) { + return g_libcef_pointers.cef_string_multimap_find_count(map, key); +} + +NO_SANITIZE("cfi-icall") +int cef_string_multimap_enumerate(cef_string_multimap_t map, + const cef_string_t* key, + size_t value_index, + cef_string_t* value) { + return g_libcef_pointers.cef_string_multimap_enumerate(map, key, value_index, + value); +} + +NO_SANITIZE("cfi-icall") +int cef_string_multimap_key(cef_string_multimap_t map, + size_t index, + cef_string_t* key) { + return g_libcef_pointers.cef_string_multimap_key(map, index, key); +} + +NO_SANITIZE("cfi-icall") +int cef_string_multimap_value(cef_string_multimap_t map, + size_t index, + cef_string_t* value) { + return g_libcef_pointers.cef_string_multimap_value(map, index, value); +} + +NO_SANITIZE("cfi-icall") +int cef_string_multimap_append(cef_string_multimap_t map, + const cef_string_t* key, + const cef_string_t* value) { + return g_libcef_pointers.cef_string_multimap_append(map, key, value); +} + +NO_SANITIZE("cfi-icall") +void cef_string_multimap_clear(cef_string_multimap_t map) { + g_libcef_pointers.cef_string_multimap_clear(map); +} + +NO_SANITIZE("cfi-icall") +void cef_string_multimap_free(cef_string_multimap_t map) { + g_libcef_pointers.cef_string_multimap_free(map); +} + +NO_SANITIZE("cfi-icall") +int cef_string_wide_set(const wchar_t* src, + size_t src_len, + cef_string_wide_t* output, + int copy) { + return g_libcef_pointers.cef_string_wide_set(src, src_len, output, copy); +} + +NO_SANITIZE("cfi-icall") +int cef_string_utf8_set(const char* src, + size_t src_len, + cef_string_utf8_t* output, + int copy) { + return g_libcef_pointers.cef_string_utf8_set(src, src_len, output, copy); +} + +NO_SANITIZE("cfi-icall") +int cef_string_utf16_set(const char16* src, + size_t src_len, + cef_string_utf16_t* output, + int copy) { + return g_libcef_pointers.cef_string_utf16_set(src, src_len, output, copy); +} + +NO_SANITIZE("cfi-icall") void cef_string_wide_clear(cef_string_wide_t* str) { + g_libcef_pointers.cef_string_wide_clear(str); +} + +NO_SANITIZE("cfi-icall") void cef_string_utf8_clear(cef_string_utf8_t* str) { + g_libcef_pointers.cef_string_utf8_clear(str); +} + +NO_SANITIZE("cfi-icall") void cef_string_utf16_clear(cef_string_utf16_t* str) { + g_libcef_pointers.cef_string_utf16_clear(str); +} + +NO_SANITIZE("cfi-icall") +int cef_string_wide_cmp(const cef_string_wide_t* str1, + const cef_string_wide_t* str2) { + return g_libcef_pointers.cef_string_wide_cmp(str1, str2); +} + +NO_SANITIZE("cfi-icall") +int cef_string_utf8_cmp(const cef_string_utf8_t* str1, + const cef_string_utf8_t* str2) { + return g_libcef_pointers.cef_string_utf8_cmp(str1, str2); +} + +NO_SANITIZE("cfi-icall") +int cef_string_utf16_cmp(const cef_string_utf16_t* str1, + const cef_string_utf16_t* str2) { + return g_libcef_pointers.cef_string_utf16_cmp(str1, str2); +} + +NO_SANITIZE("cfi-icall") +int cef_string_wide_to_utf8(const wchar_t* src, + size_t src_len, + cef_string_utf8_t* output) { + return g_libcef_pointers.cef_string_wide_to_utf8(src, src_len, output); +} + +NO_SANITIZE("cfi-icall") +int cef_string_utf8_to_wide(const char* src, + size_t src_len, + cef_string_wide_t* output) { + return g_libcef_pointers.cef_string_utf8_to_wide(src, src_len, output); +} + +NO_SANITIZE("cfi-icall") +int cef_string_wide_to_utf16(const wchar_t* src, + size_t src_len, + cef_string_utf16_t* output) { + return g_libcef_pointers.cef_string_wide_to_utf16(src, src_len, output); +} + +NO_SANITIZE("cfi-icall") +int cef_string_utf16_to_wide(const char16* src, + size_t src_len, + cef_string_wide_t* output) { + return g_libcef_pointers.cef_string_utf16_to_wide(src, src_len, output); +} + +NO_SANITIZE("cfi-icall") +int cef_string_utf8_to_utf16(const char* src, + size_t src_len, + cef_string_utf16_t* output) { + return g_libcef_pointers.cef_string_utf8_to_utf16(src, src_len, output); +} + +NO_SANITIZE("cfi-icall") +int cef_string_utf16_to_utf8(const char16* src, + size_t src_len, + cef_string_utf8_t* output) { + return g_libcef_pointers.cef_string_utf16_to_utf8(src, src_len, output); +} + +NO_SANITIZE("cfi-icall") +int cef_string_ascii_to_wide(const char* src, + size_t src_len, + cef_string_wide_t* output) { + return g_libcef_pointers.cef_string_ascii_to_wide(src, src_len, output); +} + +NO_SANITIZE("cfi-icall") +int cef_string_ascii_to_utf16(const char* src, + size_t src_len, + cef_string_utf16_t* output) { + return g_libcef_pointers.cef_string_ascii_to_utf16(src, src_len, output); +} + +NO_SANITIZE("cfi-icall") +cef_string_userfree_wide_t cef_string_userfree_wide_alloc() { + return g_libcef_pointers.cef_string_userfree_wide_alloc(); +} + +NO_SANITIZE("cfi-icall") +cef_string_userfree_utf8_t cef_string_userfree_utf8_alloc() { + return g_libcef_pointers.cef_string_userfree_utf8_alloc(); +} + +NO_SANITIZE("cfi-icall") +cef_string_userfree_utf16_t cef_string_userfree_utf16_alloc() { + return g_libcef_pointers.cef_string_userfree_utf16_alloc(); +} + +NO_SANITIZE("cfi-icall") +void cef_string_userfree_wide_free(cef_string_userfree_wide_t str) { + g_libcef_pointers.cef_string_userfree_wide_free(str); +} + +NO_SANITIZE("cfi-icall") +void cef_string_userfree_utf8_free(cef_string_userfree_utf8_t str) { + g_libcef_pointers.cef_string_userfree_utf8_free(str); +} + +NO_SANITIZE("cfi-icall") +void cef_string_userfree_utf16_free(cef_string_userfree_utf16_t str) { + g_libcef_pointers.cef_string_userfree_utf16_free(str); +} + +NO_SANITIZE("cfi-icall") +int cef_string_utf16_to_lower(const char16* src, + size_t src_len, + cef_string_utf16_t* output) { + return g_libcef_pointers.cef_string_utf16_to_lower(src, src_len, output); +} + +NO_SANITIZE("cfi-icall") +int cef_string_utf16_to_upper(const char16* src, + size_t src_len, + cef_string_utf16_t* output) { + return g_libcef_pointers.cef_string_utf16_to_upper(src, src_len, output); +} + +NO_SANITIZE("cfi-icall") +cef_platform_thread_id_t cef_get_current_platform_thread_id() { + return g_libcef_pointers.cef_get_current_platform_thread_id(); +} + +NO_SANITIZE("cfi-icall") +cef_platform_thread_handle_t cef_get_current_platform_thread_handle() { + return g_libcef_pointers.cef_get_current_platform_thread_handle(); +} + +NO_SANITIZE("cfi-icall") +int cef_time_to_timet(const cef_time_t* cef_time, time_t* time) { + return g_libcef_pointers.cef_time_to_timet(cef_time, time); +} + +NO_SANITIZE("cfi-icall") +int cef_time_from_timet(time_t time, cef_time_t* cef_time) { + return g_libcef_pointers.cef_time_from_timet(time, cef_time); +} + +NO_SANITIZE("cfi-icall") +int cef_time_to_doublet(const cef_time_t* cef_time, double* time) { + return g_libcef_pointers.cef_time_to_doublet(cef_time, time); +} + +NO_SANITIZE("cfi-icall") +int cef_time_from_doublet(double time, cef_time_t* cef_time) { + return g_libcef_pointers.cef_time_from_doublet(time, cef_time); +} + +NO_SANITIZE("cfi-icall") int cef_time_now(cef_time_t* cef_time) { + return g_libcef_pointers.cef_time_now(cef_time); +} + +NO_SANITIZE("cfi-icall") +int cef_time_delta(const cef_time_t* cef_time1, + const cef_time_t* cef_time2, + long long* delta) { + return g_libcef_pointers.cef_time_delta(cef_time1, cef_time2, delta); +} + +NO_SANITIZE("cfi-icall") +void cef_trace_event_instant(const char* category, + const char* name, + const char* arg1_name, + uint64 arg1_val, + const char* arg2_name, + uint64 arg2_val, + int copy) { + g_libcef_pointers.cef_trace_event_instant(category, name, arg1_name, arg1_val, + arg2_name, arg2_val, copy); +} + +NO_SANITIZE("cfi-icall") +void cef_trace_event_begin(const char* category, + const char* name, + const char* arg1_name, + uint64 arg1_val, + const char* arg2_name, + uint64 arg2_val, + int copy) { + g_libcef_pointers.cef_trace_event_begin(category, name, arg1_name, arg1_val, + arg2_name, arg2_val, copy); +} + +NO_SANITIZE("cfi-icall") +void cef_trace_event_end(const char* category, + const char* name, + const char* arg1_name, + uint64 arg1_val, + const char* arg2_name, + uint64 arg2_val, + int copy) { + g_libcef_pointers.cef_trace_event_end(category, name, arg1_name, arg1_val, + arg2_name, arg2_val, copy); +} + +NO_SANITIZE("cfi-icall") +void cef_trace_counter(const char* category, + const char* name, + const char* value1_name, + uint64 value1_val, + const char* value2_name, + uint64 value2_val, + int copy) { + g_libcef_pointers.cef_trace_counter(category, name, value1_name, value1_val, + value2_name, value2_val, copy); +} + +NO_SANITIZE("cfi-icall") +void cef_trace_counter_id(const char* category, + const char* name, + uint64 id, + const char* value1_name, + uint64 value1_val, + const char* value2_name, + uint64 value2_val, + int copy) { + g_libcef_pointers.cef_trace_counter_id(category, name, id, value1_name, + value1_val, value2_name, value2_val, + copy); +} + +NO_SANITIZE("cfi-icall") +void cef_trace_event_async_begin(const char* category, + const char* name, + uint64 id, + const char* arg1_name, + uint64 arg1_val, + const char* arg2_name, + uint64 arg2_val, + int copy) { + g_libcef_pointers.cef_trace_event_async_begin( + category, name, id, arg1_name, arg1_val, arg2_name, arg2_val, copy); +} + +NO_SANITIZE("cfi-icall") +void cef_trace_event_async_step_into(const char* category, + const char* name, + uint64 id, + uint64 step, + const char* arg1_name, + uint64 arg1_val, + int copy) { + g_libcef_pointers.cef_trace_event_async_step_into(category, name, id, step, + arg1_name, arg1_val, copy); +} + +NO_SANITIZE("cfi-icall") +void cef_trace_event_async_step_past(const char* category, + const char* name, + uint64 id, + uint64 step, + const char* arg1_name, + uint64 arg1_val, + int copy) { + g_libcef_pointers.cef_trace_event_async_step_past(category, name, id, step, + arg1_name, arg1_val, copy); +} + +NO_SANITIZE("cfi-icall") +void cef_trace_event_async_end(const char* category, + const char* name, + uint64 id, + const char* arg1_name, + uint64 arg1_val, + const char* arg2_name, + uint64 arg2_val, + int copy) { + g_libcef_pointers.cef_trace_event_async_end( + category, name, id, arg1_name, arg1_val, arg2_name, arg2_val, copy); +} diff --git a/tests/cefclient/CMakeLists.txt.in b/tests/cefclient/CMakeLists.txt.in index d23d6438e..417e20568 100644 --- a/tests/cefclient/CMakeLists.txt.in +++ b/tests/cefclient/CMakeLists.txt.in @@ -97,11 +97,11 @@ set(CEF_TARGET "cefclient") if(OS_MACOSX) set(CEF_HELPER_TARGET "cefclient_Helper") set(CEF_HELPER_OUTPUT_NAME "cefclient Helper") +else() + # Logical target used to link the libcef library. + ADD_LOGICAL_TARGET("libcef_lib" "${CEF_LIB_DEBUG}" "${CEF_LIB_RELEASE}") endif() -# Logical target used to link the libcef library. -ADD_LOGICAL_TARGET("libcef_lib" "${CEF_LIB_DEBUG}" "${CEF_LIB_RELEASE}") - # Determine the target output directory. SET_CEF_TARGET_OUT_DIR() @@ -180,20 +180,17 @@ if(OS_MACOSX) add_executable(${CEF_HELPER_TARGET} MACOSX_BUNDLE ${CEFCLIENT_HELPER_SRCS}) SET_EXECUTABLE_TARGET_PROPERTIES(${CEF_HELPER_TARGET}) add_dependencies(${CEF_HELPER_TARGET} libcef_dll_wrapper) - target_link_libraries(${CEF_HELPER_TARGET} libcef_lib libcef_dll_wrapper ${CEF_STANDARD_LIBS}) + target_link_libraries(${CEF_HELPER_TARGET} libcef_dll_wrapper ${CEF_STANDARD_LIBS}) set_target_properties(${CEF_HELPER_TARGET} PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/resources/mac/helper-Info.plist OUTPUT_NAME ${CEF_HELPER_OUTPUT_NAME} ) - # Fix the framework rpath in the helper executable. - FIX_MACOSX_HELPER_FRAMEWORK_RPATH(${CEF_HELPER_TARGET}) - # Main executable target. add_executable(${CEF_TARGET} MACOSX_BUNDLE ${CEFCLIENT_RESOURCES_SRCS} ${CEFCLIENT_SRCS}) SET_EXECUTABLE_TARGET_PROPERTIES(${CEF_TARGET}) add_dependencies(${CEF_TARGET} libcef_dll_wrapper "${CEF_HELPER_TARGET}") - target_link_libraries(${CEF_TARGET} libcef_lib libcef_dll_wrapper ${CEF_STANDARD_LIBS} "-framework OpenGL") + target_link_libraries(${CEF_TARGET} libcef_dll_wrapper ${CEF_STANDARD_LIBS} "-framework OpenGL") set_target_properties(${CEF_TARGET} PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/resources/mac/Info.plist ) @@ -213,9 +210,6 @@ if(OS_MACOSX) VERBATIM ) - # Fix the framework rpath in the main executable. - FIX_MACOSX_MAIN_FRAMEWORK_RPATH(${CEF_TARGET}) - # Manually process and copy over resource files. # The Xcode generator can support this via the set_target_properties RESOURCE # directive but that doesn't properly handle nested resource directories. diff --git a/tests/cefclient/browser/root_window_mac.mm b/tests/cefclient/browser/root_window_mac.mm index 34b25ca22..429f13032 100644 --- a/tests/cefclient/browser/root_window_mac.mm +++ b/tests/cefclient/browser/root_window_mac.mm @@ -476,7 +476,13 @@ void RootWindowMac::CreateRootWindow(const CefBrowserSettings& settings, NSRect screen_rect = [[NSScreen mainScreen] visibleFrame]; NSRect window_rect = NSMakeRect(x, screen_rect.size.height - y, width, height); - window_ = [[UnderlayOpenGLHostingWindow alloc] + + // The CEF framework library is loaded at runtime so we need to use this + // mechanism for retrieving the class. + Class window_class = NSClassFromString(@"UnderlayOpenGLHostingWindow"); + CHECK(window_class); + + window_ = [[window_class alloc] initWithContentRect:window_rect styleMask:(NSTitledWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask | NSResizableWindowMask | diff --git a/tests/cefclient/cefclient_mac.mm b/tests/cefclient/cefclient_mac.mm index da72cd6c5..9f829a942 100644 --- a/tests/cefclient/cefclient_mac.mm +++ b/tests/cefclient/cefclient_mac.mm @@ -6,6 +6,7 @@ #import #include "include/cef_app.h" #import "include/cef_application_mac.h" +#import "include/wrapper/cef_library_loader.h" #include "tests/cefclient/browser/main_context_impl.h" #include "tests/cefclient/browser/resource.h" #include "tests/cefclient/browser/root_window.h" @@ -338,6 +339,12 @@ namespace client { namespace { int RunMain(int argc, char* argv[]) { + // Load the CEF framework library at runtime instead of linking directly + // as required by the macOS sandbox implementation. + CefScopedLibraryLoader library_loader; + if (!library_loader.LoadInMain()) + return 1; + CefMainArgs main_args(argc, argv); // Initialize the AutoRelease pool. @@ -403,7 +410,7 @@ int RunMain(int argc, char* argv[]) { } // namespace } // namespace client -// Program entry point function. +// Entry point function for the browser process. int main(int argc, char* argv[]) { return client::RunMain(argc, argv); } diff --git a/tests/cefsimple/CMakeLists.txt.in b/tests/cefsimple/CMakeLists.txt.in index 77692369d..0c415a137 100644 --- a/tests/cefsimple/CMakeLists.txt.in +++ b/tests/cefsimple/CMakeLists.txt.in @@ -45,11 +45,11 @@ set(CEF_TARGET "cefsimple") if(OS_MACOSX) set(CEF_HELPER_TARGET "cefsimple_Helper") set(CEF_HELPER_OUTPUT_NAME "cefsimple Helper") +else() + # Logical target used to link the libcef library. + ADD_LOGICAL_TARGET("libcef_lib" "${CEF_LIB_DEBUG}" "${CEF_LIB_RELEASE}") endif() -# Logical target used to link the libcef library. -ADD_LOGICAL_TARGET("libcef_lib" "${CEF_LIB_DEBUG}" "${CEF_LIB_RELEASE}") - # Determine the target output directory. SET_CEF_TARGET_OUT_DIR() @@ -95,20 +95,17 @@ if(OS_MACOSX) add_executable(${CEF_HELPER_TARGET} MACOSX_BUNDLE ${CEFSIMPLE_HELPER_SRCS}) SET_EXECUTABLE_TARGET_PROPERTIES(${CEF_HELPER_TARGET}) add_dependencies(${CEF_HELPER_TARGET} libcef_dll_wrapper) - target_link_libraries(${CEF_HELPER_TARGET} libcef_lib libcef_dll_wrapper ${CEF_STANDARD_LIBS}) + target_link_libraries(${CEF_HELPER_TARGET} libcef_dll_wrapper ${CEF_STANDARD_LIBS}) set_target_properties(${CEF_HELPER_TARGET} PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/mac/helper-Info.plist OUTPUT_NAME ${CEF_HELPER_OUTPUT_NAME} ) - # Fix the framework rpath in the helper executable. - FIX_MACOSX_HELPER_FRAMEWORK_RPATH(${CEF_HELPER_TARGET}) - # Main executable target. add_executable(${CEF_TARGET} MACOSX_BUNDLE ${CEFSIMPLE_RESOURCES_SRCS} ${CEFSIMPLE_SRCS}) SET_EXECUTABLE_TARGET_PROPERTIES(${CEF_TARGET}) add_dependencies(${CEF_TARGET} libcef_dll_wrapper "${CEF_HELPER_TARGET}") - target_link_libraries(${CEF_TARGET} libcef_lib libcef_dll_wrapper ${CEF_STANDARD_LIBS}) + target_link_libraries(${CEF_TARGET} libcef_dll_wrapper ${CEF_STANDARD_LIBS}) set_target_properties(${CEF_TARGET} PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/mac/Info.plist ) @@ -128,9 +125,6 @@ if(OS_MACOSX) VERBATIM ) - # Fix the framework rpath in the main executable. - FIX_MACOSX_MAIN_FRAMEWORK_RPATH(${CEF_TARGET}) - # Manually process and copy over resource files. # The Xcode generator can support this via the set_target_properties RESOURCE # directive but that doesn't properly handle nested resource directories. diff --git a/tests/cefsimple/cefsimple_mac.mm b/tests/cefsimple/cefsimple_mac.mm index 57d597638..9506dd279 100644 --- a/tests/cefsimple/cefsimple_mac.mm +++ b/tests/cefsimple/cefsimple_mac.mm @@ -7,6 +7,7 @@ #include "include/cef_application_mac.h" #include "include/wrapper/cef_helpers.h" +#include "include/wrapper/cef_library_loader.h" #include "tests/cefsimple/simple_app.h" #include "tests/cefsimple/simple_handler.h" @@ -109,6 +110,12 @@ // Entry point function for the browser process. int main(int argc, char* argv[]) { + // Load the CEF framework library at runtime instead of linking directly + // as required by the macOS sandbox implementation. + CefScopedLibraryLoader library_loader; + if (!library_loader.LoadInMain()) + return 1; + // Provide CEF with command-line arguments. CefMainArgs main_args(argc, argv); diff --git a/tests/cefsimple/process_helper_mac.cc b/tests/cefsimple/process_helper_mac.cc index 2ebbc2ddb..fa1fc6940 100644 --- a/tests/cefsimple/process_helper_mac.cc +++ b/tests/cefsimple/process_helper_mac.cc @@ -3,9 +3,16 @@ // be found in the LICENSE file. #include "include/cef_app.h" +#include "include/wrapper/cef_library_loader.h" // Entry point function for sub-processes. int main(int argc, char* argv[]) { + // Load the CEF framework library at runtime instead of linking directly + // as required by the macOS sandbox implementation. + CefScopedLibraryLoader library_loader; + if (!library_loader.LoadInHelper()) + return 1; + // Provide CEF with command-line arguments. CefMainArgs main_args(argc, argv); diff --git a/tests/ceftests/CMakeLists.txt.in b/tests/ceftests/CMakeLists.txt.in index e118af827..cc89bde40 100644 --- a/tests/ceftests/CMakeLists.txt.in +++ b/tests/ceftests/CMakeLists.txt.in @@ -59,11 +59,11 @@ set(CEF_TARGET "ceftests") if(OS_MACOSX) set(CEF_HELPER_TARGET "ceftests_Helper") set(CEF_HELPER_OUTPUT_NAME "ceftests Helper") +else() + # Logical target used to link the libcef library. + ADD_LOGICAL_TARGET("libcef_lib" "${CEF_LIB_DEBUG}" "${CEF_LIB_RELEASE}") endif() -# Logical target used to link the libcef library. -ADD_LOGICAL_TARGET("libcef_lib" "${CEF_LIB_DEBUG}" "${CEF_LIB_RELEASE}") - # Determine the target output directory. SET_CEF_TARGET_OUT_DIR() @@ -115,20 +115,17 @@ if(OS_MACOSX) add_executable(${CEF_HELPER_TARGET} MACOSX_BUNDLE ${UNITTESTS_HELPER_SRCS}) SET_EXECUTABLE_TARGET_PROPERTIES(${CEF_HELPER_TARGET}) add_dependencies(${CEF_HELPER_TARGET} libcef_dll_wrapper cef_gtest) - target_link_libraries(${CEF_HELPER_TARGET} libcef_lib libcef_dll_wrapper cef_gtest ${CEF_STANDARD_LIBS}) + target_link_libraries(${CEF_HELPER_TARGET} libcef_dll_wrapper cef_gtest ${CEF_STANDARD_LIBS}) set_target_properties(${CEF_HELPER_TARGET} PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/resources/mac/helper-Info.plist OUTPUT_NAME ${CEF_HELPER_OUTPUT_NAME} ) - # Fix the framework rpath in the helper executable. - FIX_MACOSX_HELPER_FRAMEWORK_RPATH(${CEF_HELPER_TARGET}) - # Main executable target. add_executable(${CEF_TARGET} MACOSX_BUNDLE ${UNITTESTS_RESOURCES_SRCS} ${UNITTESTS_SRCS}) SET_EXECUTABLE_TARGET_PROPERTIES(${CEF_TARGET}) add_dependencies(${CEF_TARGET} libcef_dll_wrapper cef_gtest "${CEF_HELPER_TARGET}") - target_link_libraries(${CEF_TARGET} libcef_lib libcef_dll_wrapper cef_gtest ${CEF_STANDARD_LIBS}) + target_link_libraries(${CEF_TARGET} libcef_dll_wrapper cef_gtest ${CEF_STANDARD_LIBS}) set_target_properties(${CEF_TARGET} PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/resources/mac/Info.plist ) @@ -148,9 +145,6 @@ if(OS_MACOSX) VERBATIM ) - # Fix the framework rpath in the main executable. - FIX_MACOSX_MAIN_FRAMEWORK_RPATH(${CEF_TARGET}) - # Manually process and copy over resource files. # The Xcode generator can support this via the set_target_properties RESOURCE # directive but that doesn't properly handle nested resource directories. diff --git a/tests/ceftests/run_all_unittests.cc b/tests/ceftests/run_all_unittests.cc index 826b8a7c1..71b37b14b 100644 --- a/tests/ceftests/run_all_unittests.cc +++ b/tests/ceftests/run_all_unittests.cc @@ -29,6 +29,10 @@ #include "tests/shared/common/client_app_other.h" #include "tests/shared/renderer/client_app_renderer.h" +#if defined(OS_MACOSX) +#include "include/wrapper/cef_library_loader.h" +#endif + #if defined(OS_WIN) #include "include/cef_sandbox_win.h" #endif @@ -93,6 +97,14 @@ int XIOErrorHandlerImpl(Display* display) { } // namespace int main(int argc, char* argv[]) { +#if defined(OS_MACOSX) + // Load the CEF framework library at runtime instead of linking directly + // as required by the macOS sandbox implementation. + CefScopedLibraryLoader library_loader; + if (!library_loader.LoadInMain()) + return 1; +#endif + // Create the singleton test suite object. CefTestSuite test_suite(argc, argv); diff --git a/tests/shared/process_helper_mac.cc b/tests/shared/process_helper_mac.cc index dd49db336..c22b99950 100644 --- a/tests/shared/process_helper_mac.cc +++ b/tests/shared/process_helper_mac.cc @@ -3,6 +3,7 @@ // be found in the LICENSE file. #include "include/cef_app.h" +#import "include/wrapper/cef_library_loader.h" #include "tests/shared/common/client_app_other.h" #include "tests/shared/renderer/client_app_renderer.h" @@ -10,6 +11,12 @@ namespace client { int RunMain(int argc, char* argv[]) { + // Load the CEF framework library at runtime instead of linking directly + // as required by the macOS sandbox implementation. + CefScopedLibraryLoader library_loader; + if (!library_loader.LoadInHelper()) + return 1; + CefMainArgs main_args(argc, argv); // Parse command-line arguments. @@ -30,7 +37,7 @@ int RunMain(int argc, char* argv[]) { } // namespace client -// Process entry point. +// Entry point function for sub-processes. int main(int argc, char* argv[]) { return client::RunMain(argc, argv); } diff --git a/tools/cef_parser.py b/tools/cef_parser.py index c356744cb..c2e21e9a1 100644 --- a/tools/cef_parser.py +++ b/tools/cef_parser.py @@ -386,15 +386,18 @@ _simpletypes = { } -def get_function_impls(content, ident): +def get_function_impls(content, ident, has_impl=True): """ Retrieve the function parts from the specified contents as a set of return value, name, arguments and body. Ident must occur somewhere in the value. """ # extract the functions - p = re.compile( - '\n' + _cre_func + '\((.*?)\)([A-Za-z0-9_\s]{0,})' + '\{(.*?)\n\}', - re.MULTILINE | re.DOTALL) + find_regex = '\n' + _cre_func + '\((.*?)\)([A-Za-z0-9_\s]{0,})' + if has_impl: + find_regex += '\{(.*?)\n\}' + else: + find_regex += '(;)' + p = re.compile(find_regex, re.MULTILINE | re.DOTALL) list = p.findall(content) # build the function map with the function name as the key @@ -405,28 +408,31 @@ def get_function_impls(content, ident): continue # remove the identifier - retval = string.replace(retval, ident, '') - retval = string.strip(retval) + retval = retval.replace(ident, '') + retval = retval.strip() + + # Normalize the delimiter. + retval = retval.replace('\n', ' ') # retrieve the function name - parts = string.split(retval, ' ') + parts = retval.split(' ') name = parts[-1] del parts[-1] - retval = string.join(parts, ' ') + retval = ' '.join(parts) # parse the arguments args = [] - for v in string.split(argval, ','): - v = string.strip(v) + for v in argval.split(','): + v = v.strip() if len(v) > 0: args.append(v) result.append({ - 'retval': string.strip(retval), + 'retval': retval.strip(), 'name': name, 'args': args, - 'vfmod': string.strip(vfmod), - 'body': body + 'vfmod': vfmod.strip(), + 'body': body if has_impl else '', }) return result @@ -477,6 +483,10 @@ class obj_header: """ Set the root directory. """ self.root_directory = root_directory + def get_root_directory(self): + """ Get the root directory. """ + return self.root_directory + def add_directory(self, directory, excluded_files=[]): """ Add all header files from the specified directory. """ files = get_files(os.path.join(directory, '*.h')) diff --git a/tools/make_distrib.py b/tools/make_distrib.py index 7f67b55f8..8c80abb68 100644 --- a/tools/make_distrib.py +++ b/tools/make_distrib.py @@ -920,6 +920,12 @@ elif platform == 'macosx': # transfer include files transfer_gypi_files(cef_dir, cef_paths2['includes_mac'], \ 'include/', include_dir, options.quiet) + transfer_gypi_files(cef_dir, cef_paths2['includes_wrapper_mac'], \ + 'include/', include_dir, options.quiet) + + # transfer libcef_dll_wrapper files + transfer_gypi_files(cef_dir, cef_paths2['libcef_dll_wrapper_sources_mac'], \ + 'libcef_dll/', libcef_dll_dir, options.quiet) # transfer additional files, if any transfer_files(cef_dir, script_dir, os.path.join(script_dir, 'distrib', 'mac'), \ diff --git a/tools/make_libcef_dll_dylib_impl.py b/tools/make_libcef_dll_dylib_impl.py new file mode 100644 index 000000000..9fd0bf03c --- /dev/null +++ b/tools/make_libcef_dll_dylib_impl.py @@ -0,0 +1,214 @@ +# Copyright (c) 2018 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. + +from cef_parser import * +from file_util import * +import os + +# Other headers that export C API functions. +OTHER_HEADERS = [ + 'cef_version.h', + 'internal/cef_logging_internal.h', + 'internal/cef_string_list.h', + 'internal/cef_string_map.h', + 'internal/cef_string_multimap.h', + 'internal/cef_string_types.h', + 'internal/cef_thread_internal.h', + 'internal/cef_time.h', + 'internal/cef_trace_event_internal.h', +] + + +def make_libcef_dll_dylib_impl_parts(name, retval, args): + # Split arguments into types and names. + arg_types = '' + arg_names = '' + for arg in args: + if len(arg_types) > 0: + arg_types += ', ' + arg_names += ', ' + pos = arg.rfind(' ') + arg_types += arg[0:pos] + arg_names += arg[pos + 1:] + + typedef = 'typedef %s (*%s_ptr)(%s);\n' % (retval, name, arg_types) + + declare = '%s_ptr %s;\n' % (name, name) + + init = ' INIT_ENTRY(%s);' % name + + impl = """NO_SANITIZE("cfi-icall") %s %s(%s) { + %sg_libcef_pointers.%s(%s); +} + +""" % (retval, name, ', '.join(args), 'return ' + if retval != 'void' else '', name, arg_names) + + return (typedef, declare, init, impl) + + +def make_libcef_dll_dylib_impl_func(func): + name = func.get_capi_name() + parts = func.get_capi_parts([]) + retval = parts['retval'] + args = parts['args'] + return make_libcef_dll_dylib_impl_parts(name, retval, args) + + +def make_libcef_dll_dylib_impl(header): + filenames = [] + includes = [] + ptr_typedef = '' + ptr_declare = '' + ptr_init = '' + ptr_impl = '' + + # Include required headers for global functions. + for func in header.get_funcs(): + typedef, declare, init, impl = make_libcef_dll_dylib_impl_func(func) + ptr_typedef += typedef + ptr_declare += declare + ptr_init += init + ptr_impl += impl + + filename = func.get_file_name() + if not filename in filenames: + includes.append('#include "include/capi/%s"' % func.get_capi_file_name()) + filenames.append(filename) + + # Include required headers for static class functions. + allclasses = header.get_classes() + for cls in allclasses: + funcs = cls.get_static_funcs() + for func in funcs: + typedef, declare, init, impl = make_libcef_dll_dylib_impl_func(func) + ptr_typedef += typedef + ptr_declare += declare + ptr_init += init + ptr_impl += impl + + if len(funcs) > 0: + filename = cls.get_file_name() + if not filename in filenames: + includes.append('#include "include/capi/%s"' % cls.get_capi_file_name()) + filenames.append(filename) + + # Parse other headers. + root_directory = header.get_root_directory() + for other in OTHER_HEADERS: + path = os.path.join(root_directory, other) + content = read_file(path) + funcs = get_function_impls(content, 'CEF_EXPORT', False) + for func in funcs: + typedef, declare, init, impl = make_libcef_dll_dylib_impl_parts( + func['name'], func['retval'], func['args']) + ptr_typedef += typedef + ptr_declare += declare + ptr_init += init + ptr_impl += impl + + includes.append('#include "include/%s"' % other) + + # Build the final output. + result = get_copyright() + """ + +#include +#include + +""" + "\n".join(sorted(includes)) + """ +#include "include/wrapper/cef_library_loader.h" + +// GLOBAL WRAPPER FUNCTIONS - Do not edit by hand. + +namespace { + +void* g_libcef_handle = NULL; + +void* libcef_get_ptr(const char* path, const char* name) { + void* ptr = dlsym(g_libcef_handle, name); + if (!ptr) { + fprintf(stderr, "dlsym %s: %s\\n", path, dlerror()); + } + return ptr; +} + +""" + ptr_typedef + """ + +struct libcef_pointers { +""" + ptr_declare + """ +} g_libcef_pointers = {0}; + +#define INIT_ENTRY(name) \ + g_libcef_pointers.name = (name##_ptr)libcef_get_ptr(path, #name); \ + if (!g_libcef_pointers.name) { \ + return 0; \ + } + +int libcef_init_pointers(const char* path) { +""" + ptr_init + """ + return 1; +} + +} // namespace + +int cef_load_library(const char* path) { + if (g_libcef_handle) + return 0; + + g_libcef_handle = dlopen(path, RTLD_LAZY | RTLD_LOCAL | RTLD_FIRST); + if (!g_libcef_handle) { + fprintf(stderr, "dlopen %s: %s\\n", path, dlerror()); + return 0; + } + + if (!libcef_init_pointers(path)) { + cef_unload_library(); + return 0; + } + + return 1; +} + +int cef_unload_library() { + int result = 0; + if (g_libcef_handle) { + result = !dlclose(g_libcef_handle); + if (!result) { + fprintf(stderr, "dlclose: %s\\n", dlerror()); + } + g_libcef_handle = NULL; + } + return result; +} + +""" + ptr_impl + return result + + +def write_libcef_dll_dylib_impl(header, file): + newcontents = make_libcef_dll_dylib_impl(header) + return (file, newcontents) + + +# Test the module. +if __name__ == "__main__": + import sys + + # Verify that the correct number of command-line arguments are provided. + if len(sys.argv) < 2: + sys.stderr.write('Usage: ' + sys.argv[0] + ' ') + sys.exit() + + cpp_header_dir = sys.argv[1] + + # Create the header object. Should match the logic in translator.py. + header = obj_header() + header.set_root_directory(cpp_header_dir) + excluded_files = ['cef_application_mac.h', 'cef_version.h'] + header.add_directory(cpp_header_dir, excluded_files) + header.add_directory(os.path.join(cpp_header_dir, 'test')) + header.add_directory(os.path.join(cpp_header_dir, 'views')) + + # Dump the result to stdout. + sys.stdout.write(make_libcef_dll_dylib_impl(header)) diff --git a/tools/translator.py b/tools/translator.py index d8d01312d..9ed2b2d62 100644 --- a/tools/translator.py +++ b/tools/translator.py @@ -13,6 +13,7 @@ from make_cpptoc_impl import * from make_ctocpp_header import * from make_ctocpp_impl import * from make_gypi_file import * +from make_libcef_dll_dylib_impl import * from make_views_stub_impl import * from make_wrapper_types_header import * from optparse import OptionParser @@ -80,6 +81,8 @@ cpptoc_dir = os.path.join(libcef_dll_dir, 'cpptoc') ctocpp_dir = os.path.join(libcef_dll_dir, 'ctocpp') gypi_file = os.path.join(root_dir, 'cef_paths.gypi') views_stub_impl = os.path.join(libcef_dll_dir, 'views_stub.cc') +libcef_dll_dylib_impl = os.path.join(libcef_dll_dir, 'wrapper', + 'libcef_dll_dylib.cc') # make sure the header directory exists if not path_exists(cpp_header_dir): @@ -139,7 +142,7 @@ def update_file(file, newcontents): newcontents = newcontents.replace(hash_token, newhash, 1) # Apply clang-format for C/C++ files. - if os.path.splitext(file)[1][1:] in ('cc', 'cpp', 'h'): + if os.path.splitext(file)[1][1:] in ('c', 'cc', 'cpp', 'h'): result = clang_format(file, newcontents) if result != None: newcontents = result @@ -228,5 +231,10 @@ if not options.quiet: sys.stdout.write('Generating ' + views_stub_impl + ' file...\n') update_file(*write_views_stub_impl(header, views_stub_impl)) +# output the libcef dll dylib file +if not options.quiet: + sys.stdout.write('Generating ' + libcef_dll_dylib_impl + ' file...\n') +update_file(*write_libcef_dll_dylib_impl(header, libcef_dll_dylib_impl)) + if not options.quiet: sys.stdout.write('Done - Wrote ' + str(writect) + ' files.\n')