From b2b829855ac2058e4f7cc0f7f7106e1b44c4ed4e Mon Sep 17 00:00:00 2001 From: wuliubao Date: Thu, 17 Nov 2022 10:55:00 +0800 Subject: [PATCH] =?UTF-8?q?IssueNo:#I61MC8=20Description:=E5=8D=87?= =?UTF-8?q?=E7=BA=A7CEF=204844=E7=89=88=E6=9C=AC=20Sig:=20SIG=5FApplicatio?= =?UTF-8?q?nFramework=20Feature=20or=20Bugfix:=20Feature=20Binary=20Source?= =?UTF-8?q?:=20No?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wuliubao --- BUILD.gn | 1498 +- CHROMIUM_BUILD_COMPATIBILITY.txt | 4 +- CMakeLists.txt.in | 31 +- README.OpenSource | 4 +- README.md | 10 +- cef_paths.gypi | 28 +- cef_paths2.gypi | 40 +- cmake/cef_variables.cmake.in | 12 +- include/base/cef_atomic_flag.h | 88 + include/base/cef_atomic_ref_count.h | 144 +- include/base/cef_atomicops.h | 203 - include/base/cef_auto_reset.h | 89 + include/base/cef_bind.h | 791 +- include/base/cef_bind_helpers.h | 579 - include/base/cef_build.h | 246 +- include/base/cef_callback.h | 896 +- include/base/cef_callback_forward.h | 20 +- include/base/cef_callback_helpers.h | 241 + include/base/cef_callback_list.h | 668 +- include/base/cef_cancelable_callback.h | 244 +- include/base/cef_compiler_specific.h | 423 + include/base/cef_cxx17_backports.h | 133 + include/base/cef_lock.h | 24 +- include/base/cef_logging.h | 46 +- include/base/cef_macros.h | 183 +- include/base/cef_move.h | 261 - include/base/cef_platform_thread.h | 7 +- include/base/cef_ptr_util.h | 58 + include/base/cef_ref_counted.h | 478 +- include/base/cef_scoped_ptr.h | 625 - include/base/cef_scoped_refptr.h | 411 + include/base/cef_scoped_typeref_mac.h | 180 + include/base/cef_template_util.h | 502 +- include/base/cef_thread_checker.h | 7 +- include/base/cef_trace_event.h | 7 +- include/base/cef_tuple.h | 1585 +- include/base/cef_weak_ptr.h | 249 +- .../base/internal/cef_atomicops_arm64_gcc.h | 335 - .../base/internal/cef_atomicops_arm64_msvc.h | 197 - include/base/internal/cef_atomicops_arm_gcc.h | 325 - .../cef_atomicops_atomicword_compat.h | 124 - include/base/internal/cef_atomicops_mac.h | 223 - include/base/internal/cef_atomicops_x86_gcc.h | 268 - .../base/internal/cef_atomicops_x86_msvc.h | 221 - include/base/internal/cef_bind_internal.h | 4312 ++---- include/base/internal/cef_bind_internal_win.h | 398 - include/base/internal/cef_callback_internal.h | 329 +- include/base/internal/cef_lock_impl.h | 8 +- .../cef_raw_scoped_refptr_mismatch_checker.h | 150 +- include/base/internal/cef_scoped_block_mac.h | 66 + include/base/internal/cef_scoped_policy.h | 53 + include/capi/cef_accessibility_handler_capi.h | 4 +- include/capi/cef_app_capi.h | 4 +- include/capi/cef_audio_handler_capi.h | 4 +- include/capi/cef_auth_callback_capi.h | 4 +- include/capi/cef_browser_capi.h | 103 +- .../capi/cef_browser_process_handler_capi.h | 4 +- include/capi/cef_callback_capi.h | 4 +- include/capi/cef_client_capi.h | 17 +- include/capi/cef_command_line_capi.h | 9 +- include/capi/cef_context_menu_handler_capi.h | 4 +- include/capi/cef_cookie_capi.h | 4 +- include/capi/cef_crash_util_capi.h | 4 +- .../capi/cef_devtools_message_observer_capi.h | 4 +- include/capi/cef_dialog_handler_capi.h | 4 +- include/capi/cef_display_handler_capi.h | 4 +- include/capi/cef_dom_capi.h | 4 +- include/capi/cef_download_handler_capi.h | 4 +- include/capi/cef_download_item_capi.h | 4 +- include/capi/cef_drag_data_capi.h | 4 +- include/capi/cef_drag_handler_capi.h | 4 +- include/capi/cef_extension_capi.h | 4 +- include/capi/cef_extension_handler_capi.h | 4 +- include/capi/cef_file_util_capi.h | 4 +- include/capi/cef_find_handler_capi.h | 15 +- include/capi/cef_focus_handler_capi.h | 4 +- include/capi/cef_frame_capi.h | 14 +- include/capi/cef_frame_handler_capi.h | 194 + ...t_callback_capi.h => cef_i18n_util_capi.h} | 30 +- include/capi/cef_image_capi.h | 4 +- include/capi/cef_jsdialog_handler_capi.h | 4 +- include/capi/cef_keyboard_handler_capi.h | 4 +- include/capi/cef_life_span_handler_capi.h | 23 +- include/capi/cef_load_handler_capi.h | 4 +- include/capi/cef_media_router_capi.h | 4 +- include/capi/cef_menu_model_capi.h | 4 +- include/capi/cef_menu_model_delegate_capi.h | 4 +- include/capi/cef_navigation_entry_capi.h | 4 +- include/capi/cef_origin_whitelist_capi.h | 4 +- include/capi/cef_parser_capi.h | 4 +- include/capi/cef_path_util_capi.h | 4 +- include/capi/cef_print_handler_capi.h | 4 +- include/capi/cef_print_settings_capi.h | 4 +- include/capi/cef_process_message_capi.h | 4 +- include/capi/cef_process_util_capi.h | 4 +- include/capi/cef_registration_capi.h | 4 +- include/capi/cef_render_handler_capi.h | 4 +- .../capi/cef_render_process_handler_capi.h | 10 +- include/capi/cef_request_capi.h | 4 +- include/capi/cef_request_context_capi.h | 15 +- .../capi/cef_request_context_handler_capi.h | 32 +- include/capi/cef_request_handler_capi.h | 31 +- include/capi/cef_resource_bundle_capi.h | 4 +- .../capi/cef_resource_bundle_handler_capi.h | 4 +- include/capi/cef_resource_handler_capi.h | 4 +- .../capi/cef_resource_request_handler_capi.h | 12 +- include/capi/cef_response_capi.h | 4 +- include/capi/cef_response_filter_capi.h | 4 +- include/capi/cef_scheme_capi.h | 4 +- include/capi/cef_server_capi.h | 4 +- include/capi/cef_ssl_info_capi.h | 4 +- include/capi/cef_ssl_status_capi.h | 4 +- include/capi/cef_stream_capi.h | 4 +- include/capi/cef_string_visitor_capi.h | 4 +- include/capi/cef_task_capi.h | 4 +- include/capi/cef_thread_capi.h | 4 +- include/capi/cef_trace_capi.h | 4 +- include/capi/cef_urlrequest_capi.h | 4 +- include/capi/cef_v8_capi.h | 4 +- include/capi/cef_values_capi.h | 4 +- include/capi/cef_waitable_event_capi.h | 4 +- include/capi/cef_web_plugin_capi.h | 73 +- include/capi/cef_x509_certificate_capi.h | 4 +- include/capi/cef_xml_reader_capi.h | 4 +- include/capi/cef_zip_reader_capi.h | 4 +- include/capi/test/cef_test_helpers_capi.h | 4 +- include/capi/test/cef_translator_test_capi.h | 4 +- include/capi/views/cef_box_layout_capi.h | 4 +- include/capi/views/cef_browser_view_capi.h | 4 +- .../views/cef_browser_view_delegate_capi.h | 4 +- include/capi/views/cef_button_capi.h | 4 +- include/capi/views/cef_button_delegate_capi.h | 4 +- include/capi/views/cef_display_capi.h | 4 +- include/capi/views/cef_fill_layout_capi.h | 4 +- include/capi/views/cef_label_button_capi.h | 4 +- include/capi/views/cef_layout_capi.h | 4 +- include/capi/views/cef_menu_button_capi.h | 4 +- .../views/cef_menu_button_delegate_capi.h | 4 +- .../capi/views/cef_overlay_controller_capi.h | 216 + include/capi/views/cef_panel_capi.h | 4 +- include/capi/views/cef_panel_delegate_capi.h | 4 +- include/capi/views/cef_scroll_view_capi.h | 4 +- include/capi/views/cef_textfield_capi.h | 4 +- .../capi/views/cef_textfield_delegate_capi.h | 4 +- include/capi/views/cef_view_capi.h | 17 +- include/capi/views/cef_view_delegate_capi.h | 11 +- include/capi/views/cef_window_capi.h | 39 +- include/capi/views/cef_window_delegate_capi.h | 11 +- include/cef_api_hash.h | 10 +- include/cef_base.h | 76 +- include/cef_browser.h | 109 +- include/cef_client.h | 13 +- include/cef_command_line.h | 5 +- include/cef_find_handler.h | 10 +- include/cef_frame.h | 10 +- include/cef_frame_handler.h | 175 + ...cef_request_callback.h => cef_i18n_util.h} | 28 +- include/cef_life_span_handler.h | 17 +- include/cef_render_process_handler.h | 8 +- include/cef_request_context.h | 9 - include/cef_request_context_handler.h | 28 - include/cef_request_handler.h | 22 +- include/cef_resource_request_handler.h | 17 +- include/cef_sandbox_win.h | 4 +- include/cef_web_plugin.h | 64 - include/internal/cef_linux.h | 12 +- include/internal/cef_mac.h | 12 +- include/internal/cef_ptr.h | 66 +- include/internal/cef_string_wrappers.h | 179 +- include/internal/cef_types.h | 206 +- include/internal/cef_types_geometry.h | 78 + include/internal/cef_types_linux.h | 9 +- include/internal/cef_types_mac.h | 10 +- include/internal/cef_types_win.h | 11 +- include/internal/cef_types_wrappers.h | 6 - include/internal/cef_win.h | 20 +- include/views/cef_overlay_controller.h | 209 + include/views/cef_view.h | 14 + include/views/cef_view_delegate.h | 9 +- include/views/cef_window.h | 35 + include/views/cef_window_delegate.h | 8 + include/wrapper/cef_byte_read_handler.h | 15 +- include/wrapper/cef_closure_task.h | 39 +- include/wrapper/cef_helpers.h | 33 +- include/wrapper/cef_library_loader.h | 7 +- include/wrapper/cef_message_router.h | 6 +- include/wrapper/cef_resource_manager.h | 56 +- include/wrapper/cef_scoped_temp_dir.h | 6 +- include/wrapper/cef_stream_resource_handler.h | 13 +- include/wrapper/cef_xml_object.h | 10 +- include/wrapper/cef_zip_archive.h | 8 +- libcef/browser/alloy/alloy_browser_context.cc | 35 +- libcef/browser/alloy/alloy_browser_context.h | 10 +- .../browser/alloy/alloy_browser_host_impl.cc | 151 +- .../browser/alloy/alloy_browser_host_impl.h | 27 +- libcef/browser/alloy/alloy_browser_main.cc | 122 +- libcef/browser/alloy/alloy_browser_main.h | 44 +- .../alloy/alloy_content_browser_client.cc | 496 +- .../alloy/alloy_content_browser_client.h | 48 +- libcef/browser/alloy/alloy_dialog_util.cc | 49 + libcef/browser/alloy/alloy_dialog_util.h | 37 + libcef/browser/alloy/alloy_download_util.cc | 16 + libcef/browser/alloy/alloy_download_util.h | 23 + .../alloy/browser_platform_delegate_alloy.cc | 126 +- .../alloy/browser_platform_delegate_alloy.h | 38 +- .../alloy/chrome_browser_process_alloy.cc | 62 +- .../alloy/chrome_browser_process_alloy.h | 29 +- libcef/browser/alloy/chrome_profile_alloy.cc | 30 +- libcef/browser/alloy/chrome_profile_alloy.h | 12 +- .../alloy/chrome_profile_manager_alloy.cc | 7 - .../alloy/chrome_profile_manager_alloy.h | 9 +- libcef/browser/audio_capturer.cc | 4 +- libcef/browser/audio_capturer.h | 3 +- .../browser/audio_loopback_stream_creator.cc | 8 +- .../browser/audio_loopback_stream_creator.h | 8 +- libcef/browser/browser_contents_delegate.cc | 96 +- libcef/browser/browser_contents_delegate.h | 22 +- libcef/browser/browser_context.cc | 186 +- libcef/browser/browser_context.h | 76 +- libcef/browser/browser_frame.cc | 79 + libcef/browser/browser_frame.h | 54 + libcef/browser/browser_host_base.cc | 70 +- libcef/browser/browser_host_base.h | 22 +- libcef/browser/browser_info.cc | 486 +- libcef/browser/browser_info.h | 141 +- libcef/browser/browser_info_manager.cc | 219 +- libcef/browser/browser_info_manager.h | 105 +- libcef/browser/browser_manager.cc | 58 + libcef/browser/browser_manager.h | 56 + libcef/browser/browser_message_filter.cc | 55 - libcef/browser/browser_message_filter.h | 40 - libcef/browser/browser_message_loop.cc | 6 +- libcef/browser/browser_platform_delegate.cc | 28 +- libcef/browser/browser_platform_delegate.h | 20 +- .../browser_platform_delegate_create.cc | 18 +- libcef/browser/browser_util.cc | 8 + .../browser/chrome/chrome_browser_context.cc | 47 +- .../browser/chrome/chrome_browser_context.h | 16 +- .../browser/chrome/chrome_browser_delegate.cc | 24 +- .../browser/chrome/chrome_browser_delegate.h | 12 +- .../chrome/chrome_browser_host_impl.cc | 37 +- .../browser/chrome/chrome_browser_host_impl.h | 14 +- .../chrome_browser_main_extra_parts_cef.cc | 6 +- .../chrome_browser_main_extra_parts_cef.h | 13 +- .../chrome_content_browser_client_cef.cc | 107 +- .../chrome_content_browser_client_cef.h | 30 +- .../chrome/chrome_context_menu_handler.cc | 9 +- ...me_mime_handler_view_guest_delegate_cef.cc | 47 + ...ome_mime_handler_view_guest_delegate_cef.h | 37 + .../browser_platform_delegate_chrome_views.cc | 4 +- .../chrome/views/chrome_browser_view.cc | 2 +- .../chrome/views/chrome_browser_view.h | 5 +- .../browser/chrome/views/chrome_views_util.cc | 15 + .../browser/chrome/views/chrome_views_util.h | 20 + .../browser/chrome/views/toolbar_view_impl.cc | 4 +- .../browser/chrome/views/toolbar_view_impl.h | 12 +- .../browser/chrome/views/toolbar_view_view.cc | 2 +- .../browser/chrome/views/toolbar_view_view.h | 8 +- .../chrome_crash_reporter_client_stub.cc | 4 +- libcef/browser/context.cc | 33 +- libcef/browser/context_menu_params_impl.h | 5 +- libcef/browser/devtools/devtools_controller.h | 6 +- .../browser/devtools/devtools_file_manager.cc | 55 +- .../browser/devtools/devtools_file_manager.h | 26 +- libcef/browser/devtools/devtools_frontend.cc | 293 +- libcef/browser/devtools/devtools_frontend.h | 21 +- libcef/browser/devtools/devtools_manager.cc | 7 +- libcef/browser/devtools/devtools_manager.h | 6 +- .../devtools/devtools_manager_delegate.cc | 6 +- .../devtools/devtools_manager_delegate.h | 9 +- .../devtools/devtools_util_unittest.cc | 18 +- libcef/browser/download_item_impl.h | 6 +- libcef/browser/download_manager_delegate.cc | 28 +- libcef/browser/download_manager_delegate.h | 11 +- libcef/browser/extension_impl.h | 4 +- .../file_system/cef_file_system_delegate.cc | 134 + .../file_system/cef_file_system_delegate.h | 68 + .../api/storage/sync_value_store_cache.cc | 43 +- .../api/storage/sync_value_store_cache.h | 23 +- .../browser/extensions/api/tabs/tabs_api.cc | 44 +- .../extensions/browser_extensions_util.cc | 37 +- .../extensions/browser_extensions_util.h | 14 +- .../browser_platform_delegate_background.cc | 6 +- .../browser_platform_delegate_background.h | 2 +- .../component_extension_resource_manager.cc | 1 + .../component_extension_resource_manager.h | 9 +- .../extensions/extension_background_host.cc | 5 +- .../extensions/extension_background_host.h | 11 +- .../extensions/extension_function_details.cc | 8 +- .../extensions/extension_function_details.h | 8 +- .../extensions/extension_host_delegate.h | 8 +- libcef/browser/extensions/extension_system.cc | 82 +- libcef/browser/extensions/extension_system.h | 13 +- .../extensions/extension_system_factory.h | 6 +- .../browser/extensions/extension_view_host.cc | 42 +- .../browser/extensions/extension_view_host.h | 28 +- .../extension_web_contents_observer.cc | 7 +- .../extension_web_contents_observer.h | 6 +- .../extensions/extensions_api_client.cc | 16 +- .../extensions/extensions_api_client.h | 7 +- .../extensions_browser_api_provider.cc | 8 +- .../extensions_browser_api_provider.h | 10 +- .../extensions/extensions_browser_client.cc | 7 +- .../extensions/extensions_browser_client.h | 12 +- .../mime_handler_view_guest_delegate.cc | 5 +- .../mime_handler_view_guest_delegate.h | 10 +- .../browser/extensions/pdf_extension_util.cc | 46 - .../browser/extensions/pdf_extension_util.h | 27 - .../pdf_web_contents_helper_client.cc | 33 - .../pdf_web_contents_helper_client.h | 31 - .../extensions/value_store/cef_value_store.cc | 51 +- .../extensions/value_store/cef_value_store.h | 33 +- .../value_store/cef_value_store_factory.cc | 187 +- .../value_store/cef_value_store_factory.h | 82 +- libcef/browser/file_dialog_manager.cc | 7 +- libcef/browser/file_dialog_manager.h | 6 +- libcef/browser/file_dialog_runner.h | 16 +- libcef/browser/frame_host_impl.cc | 603 +- libcef/browser/frame_host_impl.h | 97 +- libcef/browser/frame_service_base.h | 125 + .../browser/gpu/external_texture_manager.cc | 22 +- libcef/browser/gpu/external_texture_manager.h | 2 +- libcef/browser/image_impl.cc | 8 +- libcef/browser/image_impl.h | 12 +- libcef/browser/iothread_state.cc | 30 +- libcef/browser/iothread_state.h | 26 +- libcef/browser/javascript_dialog_manager.h | 7 +- libcef/browser/javascript_dialog_runner.h | 19 +- libcef/browser/main_runner.cc | 88 +- libcef/browser/main_runner.h | 14 +- .../browser/media_router/media_route_impl.cc | 8 +- .../browser/media_router/media_route_impl.h | 4 +- .../browser/media_router/media_router_impl.cc | 10 +- .../browser/media_router/media_router_impl.h | 4 +- .../media_router/media_router_manager.cc | 23 +- .../media_router/media_router_manager.h | 6 +- .../browser/media_router/media_sink_impl.cc | 16 +- libcef/browser/media_router/media_sink_impl.h | 7 +- .../browser/media_router/media_source_impl.h | 4 +- libcef/browser/menu_manager.cc | 40 +- libcef/browser/menu_manager.h | 6 +- libcef/browser/menu_model_impl.cc | 15 +- libcef/browser/menu_model_impl.h | 7 +- libcef/browser/menu_runner.h | 13 +- .../browser_platform_delegate_native_aura.cc | 12 +- .../browser_platform_delegate_native_linux.cc | 53 +- .../browser_platform_delegate_native_linux.h | 8 +- .../browser_platform_delegate_native_mac.h | 2 +- .../browser_platform_delegate_native_mac.mm | 19 +- .../browser_platform_delegate_native_win.cc | 64 +- .../browser_platform_delegate_native_win.h | 2 +- libcef/browser/native/cursor_util.cc | 8 +- libcef/browser/native/cursor_util.h | 6 +- libcef/browser/native/cursor_util_linux.cc | 16 +- libcef/browser/native/cursor_util_win.cc | 6 +- libcef/browser/native/menu_2.h | 7 +- libcef/browser/native/menu_runner_mac.mm | 2 +- libcef/browser/native/native_menu_win.cc | 29 +- libcef/browser/native/native_menu_win.h | 9 +- libcef/browser/native/window_delegate_view.cc | 4 +- libcef/browser/native/window_delegate_view.h | 6 +- libcef/browser/native/window_x11.cc | 13 +- libcef/browser/native/window_x11.h | 6 +- libcef/browser/navigate_params.cc | 12 - libcef/browser/navigate_params.h | 81 - libcef/browser/navigation_entry_impl.h | 6 +- libcef/browser/net/chrome_scheme_handler.cc | 58 +- libcef/browser/net/internal_scheme_handler.cc | 16 +- libcef/browser/net/throttle_handler.cc | 35 +- .../net_service/browser_urlrequest_impl.cc | 66 +- .../net_service/browser_urlrequest_impl.h | 6 +- libcef/browser/net_service/cookie_helper.cc | 76 +- libcef/browser/net_service/cookie_helper.h | 15 +- .../net_service/cookie_manager_impl.cc | 41 +- .../browser/net_service/cookie_manager_impl.h | 4 +- libcef/browser/net_service/login_delegate.cc | 8 +- .../net_service/proxy_url_loader_factory.cc | 72 +- .../net_service/proxy_url_loader_factory.h | 18 +- .../net_service/resource_handler_wrapper.cc | 27 +- .../resource_request_handler_wrapper.cc | 312 +- .../resource_request_handler_wrapper.h | 4 +- .../net_service/response_filter_wrapper.cc | 5 +- .../net_service/stream_reader_url_loader.cc | 27 +- .../net_service/stream_reader_url_loader.h | 16 +- .../net_service/url_loader_factory_getter.cc | 7 +- .../net_service/url_loader_factory_getter.h | 10 +- libcef/browser/origin_whitelist_impl.cc | 178 +- libcef/browser/origin_whitelist_impl.h | 10 +- .../osr/browser_platform_delegate_osr.cc | 4 +- .../osr/browser_platform_delegate_osr.h | 2 +- libcef/browser/osr/host_display_client_osr.cc | 11 +- libcef/browser/osr/host_display_client_osr.h | 8 +- libcef/browser/osr/motion_event_osr.h | 6 +- libcef/browser/osr/osr_accessibility_util.cc | 2 +- .../osr/render_widget_host_view_osr.cc | 228 +- .../browser/osr/render_widget_host_view_osr.h | 69 +- .../osr/software_output_device_proxy.cc | 4 +- .../osr/software_output_device_proxy.h | 7 +- .../osr/synthetic_gesture_target_osr.h | 8 +- libcef/browser/osr/video_consumer_osr.cc | 28 +- libcef/browser/osr/video_consumer_osr.h | 16 +- libcef/browser/osr/web_contents_view_osr.cc | 6 +- libcef/browser/osr/web_contents_view_osr.h | 9 +- libcef/browser/path_util_impl.cc | 2 +- .../browser/plugins/plugin_service_filter.cc | 162 - .../browser/plugins/plugin_service_filter.h | 53 - libcef/browser/prefs/browser_prefs.cc | 22 +- libcef/browser/prefs/pref_store.cc | 18 +- libcef/browser/prefs/pref_store.h | 6 +- libcef/browser/prefs/renderer_prefs.cc | 34 +- libcef/browser/prefs/renderer_prefs.h | 5 +- libcef/browser/print_settings_impl.cc | 15 +- libcef/browser/print_settings_impl.h | 8 +- .../constrained_window_views_client.cc | 10 +- libcef/browser/printing/print_dialog_linux.cc | 44 +- libcef/browser/printing/print_dialog_linux.h | 7 +- libcef/browser/printing/print_view_manager.cc | 45 +- libcef/browser/printing/print_view_manager.h | 21 +- libcef/browser/request_context_handler_map.cc | 49 +- libcef/browser/request_context_handler_map.h | 45 +- libcef/browser/request_context_impl.cc | 99 +- libcef/browser/request_context_impl.h | 20 +- libcef/browser/server_impl.cc | 6 +- libcef/browser/server_impl.h | 6 +- libcef/browser/simple_menu_model_impl.cc | 2 +- libcef/browser/simple_menu_model_impl.h | 7 +- .../speech_recognition_manager_delegate.h | 8 +- libcef/browser/ssl_host_state_delegate.cc | 14 + libcef/browser/ssl_host_state_delegate.h | 10 +- libcef/browser/ssl_info_impl.h | 4 +- libcef/browser/ssl_status_impl.h | 4 +- libcef/browser/stream_impl.cc | 4 +- libcef/browser/thread_util.h | 11 +- libcef/browser/trace_subscriber.cc | 27 +- .../browser/views/basic_label_button_impl.h | 10 +- .../browser/views/basic_label_button_view.h | 6 +- libcef/browser/views/basic_panel_impl.h | 6 +- libcef/browser/views/basic_panel_view.h | 6 +- libcef/browser/views/box_layout_impl.h | 6 +- .../views/browser_platform_delegate_views.cc | 16 +- .../views/browser_platform_delegate_views.h | 2 +- libcef/browser/views/browser_view_impl.h | 8 +- libcef/browser/views/browser_view_view.h | 7 +- libcef/browser/views/button_impl.h | 20 +- libcef/browser/views/button_view.h | 10 +- libcef/browser/views/display_impl.cc | 2 +- libcef/browser/views/display_impl.h | 5 +- libcef/browser/views/fill_layout_impl.h | 4 +- libcef/browser/views/label_button_impl.h | 2 +- libcef/browser/views/label_button_view.h | 2 +- libcef/browser/views/menu_button_impl.h | 11 +- libcef/browser/views/menu_button_view.cc | 4 +- libcef/browser/views/menu_button_view.h | 8 +- libcef/browser/views/overlay_view_host.cc | 333 + libcef/browser/views/overlay_view_host.h | 79 + libcef/browser/views/panel_impl.h | 2 +- libcef/browser/views/panel_view.h | 2 +- libcef/browser/views/scroll_view_impl.h | 8 +- libcef/browser/views/scroll_view_view.h | 6 +- libcef/browser/views/textfield_impl.h | 8 +- libcef/browser/views/textfield_view.h | 8 +- libcef/browser/views/view_impl.h | 19 +- libcef/browser/views/view_util.cc | 23 +- libcef/browser/views/view_view.h | 24 +- libcef/browser/views/window_impl.cc | 60 +- libcef/browser/views/window_impl.h | 11 +- libcef/browser/views/window_view.cc | 134 +- libcef/browser/views/window_view.h | 41 +- libcef/browser/web_plugin_impl.cc | 48 +- libcef/browser/x509_cert_principal_impl.h | 4 +- libcef/browser/x509_certificate_impl.h | 4 +- libcef/common/alloy/alloy_content_client.cc | 31 +- libcef/common/alloy/alloy_content_client.h | 7 +- libcef/common/alloy/alloy_main_delegate.cc | 135 +- libcef/common/alloy/alloy_main_delegate.h | 14 +- .../alloy/alloy_main_runner_delegate.cc | 5 - .../common/alloy/alloy_main_runner_delegate.h | 6 +- libcef/common/app_manager.cc | 6 +- libcef/common/app_manager.h | 8 +- libcef/common/base_impl.cc | 6 +- .../common/cef_crash_report_upload_thread.h | 7 +- libcef/common/cef_message_generator.cc | 33 - libcef/common/cef_message_generator.h | 7 - libcef/common/cef_messages.cc | 119 - libcef/common/cef_messages.h | 209 - libcef/common/cef_switches.cc | 5 +- libcef/common/cef_switches.h | 3 +- .../common/chrome/chrome_main_delegate_cef.cc | 49 +- .../common/chrome/chrome_main_delegate_cef.h | 15 +- .../chrome/chrome_main_runner_delegate.cc | 2 +- .../chrome/chrome_main_runner_delegate.h | 6 +- libcef/common/command_line_impl.cc | 30 +- libcef/common/command_line_impl.h | 5 +- libcef/common/crash_reporter_client.cc | 60 +- libcef/common/crash_reporter_client.h | 29 +- libcef/common/crash_reporting.cc | 32 +- libcef/common/crash_reporting.h | 4 +- libcef/common/drag_data_impl.cc | 8 +- .../extensions/chrome_generated_schemas.cc | 1 - .../extensions/extensions_api_provider.h | 7 +- libcef/common/extensions/extensions_client.cc | 4 +- libcef/common/extensions/extensions_client.h | 9 +- libcef/common/extensions/extensions_util.cc | 2 +- libcef/common/frame_util.cc | 31 +- libcef/common/frame_util.h | 72 +- libcef/common/i18n_util_impl.cc | 11 + libcef/common/json_impl.cc | 2 +- libcef/common/main_runner_handler.h | 4 +- libcef/common/mojom/BUILD.gn | 29 + libcef/common/mojom/cef.mojom | 133 + libcef/common/net/http_header_utils.h | 2 +- libcef/common/net/scheme_registration.cc | 33 +- libcef/common/net/upload_data.cc | 35 - libcef/common/net/upload_data.h | 83 - libcef/common/net/upload_element.cc | 21 - libcef/common/net/upload_element.h | 113 - libcef/common/parser_impl.cc | 4 +- libcef/common/process_message_impl.cc | 78 +- libcef/common/process_message_impl.h | 38 +- libcef/common/request_impl.cc | 285 +- libcef/common/request_impl.h | 22 +- libcef/common/resource_bundle_delegate.cc | 12 +- libcef/common/resource_bundle_delegate.h | 11 +- libcef/common/resource_bundle_impl.cc | 2 +- libcef/common/resource_bundle_impl.h | 4 +- libcef/common/resource_util.cc | 40 +- libcef/common/resource_util.h | 6 +- libcef/common/response_manager.cc | 59 - libcef/common/response_manager.h | 66 - libcef/common/scheme_registrar_impl.h | 5 +- libcef/common/string_list_impl.cc | 4 +- libcef/common/string_map_impl.cc | 4 +- libcef/common/string_multimap_impl.cc | 4 +- libcef/common/string_util.cc | 72 + libcef/common/string_util.h | 44 + libcef/common/task_impl.cc | 6 +- libcef/common/task_runner_impl.cc | 6 +- libcef/common/task_runner_impl.h | 6 +- libcef/common/task_runner_manager.h | 2 +- libcef/common/test/translator_test_impl.cc | 48 +- libcef/common/thread_impl.cc | 6 +- libcef/common/thread_impl.h | 5 +- libcef/common/time_impl.cc | 10 +- libcef/common/value_base.h | 45 +- libcef/common/values_impl.cc | 216 +- libcef/common/values_impl.h | 39 +- libcef/common/waitable_event_impl.cc | 2 +- libcef/common/waitable_event_impl.h | 4 +- libcef/common/widevine_loader.cc | 508 - libcef/common/widevine_loader.h | 70 - libcef/features/BUILD.gn | 7 +- .../alloy/alloy_content_renderer_client.cc | 114 +- .../alloy/alloy_content_renderer_client.h | 28 +- .../alloy/alloy_render_frame_observer.cc | 23 - .../alloy/alloy_render_frame_observer.h | 38 - .../alloy/alloy_render_thread_observer.cc | 6 +- .../alloy/alloy_render_thread_observer.h | 16 +- .../alloy/url_loader_throttle_provider_impl.h | 5 +- libcef/renderer/blink_glue.cc | 34 +- libcef/renderer/blink_glue.h | 13 +- libcef/renderer/browser_impl.cc | 14 +- libcef/renderer/browser_impl.h | 10 +- .../chrome_content_renderer_client_cef.cc | 38 +- .../chrome_content_renderer_client_cef.h | 20 +- libcef/renderer/dom_document_impl.h | 2 +- .../extensions_dispatcher_delegate.h | 10 +- .../extensions/extensions_renderer_client.cc | 30 +- .../extensions/extensions_renderer_client.h | 17 +- .../print_render_frame_helper_delegate.cc | 23 +- libcef/renderer/frame_impl.cc | 583 +- libcef/renderer/frame_impl.h | 107 +- libcef/renderer/render_frame_observer.cc | 46 +- libcef/renderer/render_frame_observer.h | 27 +- .../{browser_manager.cc => render_manager.cc} | 208 +- .../{browser_manager.h => render_manager.h} | 75 +- libcef/renderer/render_thread_observer.cc | 52 - libcef/renderer/render_thread_observer.h | 35 - libcef/renderer/render_urlrequest_impl.cc | 7 +- libcef/renderer/thread_util.h | 6 +- libcef/renderer/v8_impl.cc | 8 +- libcef/renderer/v8_impl.h | 42 +- libcef/resources/framework-Info.plist | 2 +- libcef_dll/base/cef_atomic_flag.cc | 31 + libcef_dll/base/cef_atomicops_x86_gcc.cc | 99 - libcef_dll/base/cef_bind_helpers.cc | 13 - libcef_dll/base/cef_callback_helpers.cc | 43 + libcef_dll/base/cef_callback_internal.cc | 92 +- libcef_dll/base/cef_logging.cc | 5 +- libcef_dll/base/cef_ref_counted.cc | 95 +- libcef_dll/base/cef_weak_ptr.cc | 91 +- .../cpptoc/accessibility_handler_cpptoc.cc | 4 +- .../cpptoc/accessibility_handler_cpptoc.h | 4 +- libcef_dll/cpptoc/app_cpptoc.cc | 4 +- libcef_dll/cpptoc/app_cpptoc.h | 4 +- libcef_dll/cpptoc/audio_handler_cpptoc.cc | 4 +- libcef_dll/cpptoc/audio_handler_cpptoc.h | 4 +- libcef_dll/cpptoc/auth_callback_cpptoc.cc | 4 +- libcef_dll/cpptoc/auth_callback_cpptoc.h | 4 +- .../cpptoc/before_download_callback_cpptoc.cc | 4 +- .../cpptoc/before_download_callback_cpptoc.h | 4 +- libcef_dll/cpptoc/binary_value_cpptoc.cc | 4 +- libcef_dll/cpptoc/binary_value_cpptoc.h | 4 +- libcef_dll/cpptoc/browser_cpptoc.cc | 21 +- libcef_dll/cpptoc/browser_cpptoc.h | 4 +- libcef_dll/cpptoc/browser_host_cpptoc.cc | 24 +- libcef_dll/cpptoc/browser_host_cpptoc.h | 4 +- .../cpptoc/browser_process_handler_cpptoc.cc | 4 +- .../cpptoc/browser_process_handler_cpptoc.h | 4 +- libcef_dll/cpptoc/callback_cpptoc.cc | 4 +- libcef_dll/cpptoc/callback_cpptoc.h | 4 +- libcef_dll/cpptoc/client_cpptoc.cc | 22 +- libcef_dll/cpptoc/client_cpptoc.h | 4 +- libcef_dll/cpptoc/command_line_cpptoc.cc | 4 +- libcef_dll/cpptoc/command_line_cpptoc.h | 4 +- .../cpptoc/completion_callback_cpptoc.cc | 4 +- .../cpptoc/completion_callback_cpptoc.h | 4 +- .../cpptoc/context_menu_handler_cpptoc.cc | 4 +- .../cpptoc/context_menu_handler_cpptoc.h | 4 +- .../cpptoc/context_menu_params_cpptoc.cc | 4 +- .../cpptoc/context_menu_params_cpptoc.h | 4 +- .../cpptoc/cookie_access_filter_cpptoc.cc | 4 +- .../cpptoc/cookie_access_filter_cpptoc.h | 4 +- libcef_dll/cpptoc/cookie_manager_cpptoc.cc | 4 +- libcef_dll/cpptoc/cookie_manager_cpptoc.h | 4 +- libcef_dll/cpptoc/cookie_visitor_cpptoc.cc | 4 +- libcef_dll/cpptoc/cookie_visitor_cpptoc.h | 4 +- libcef_dll/cpptoc/cpptoc_ref_counted.h | 8 +- libcef_dll/cpptoc/cpptoc_scoped.h | 7 +- .../cpptoc/delete_cookies_callback_cpptoc.cc | 4 +- .../cpptoc/delete_cookies_callback_cpptoc.h | 4 +- .../dev_tools_message_observer_cpptoc.cc | 4 +- .../dev_tools_message_observer_cpptoc.h | 4 +- libcef_dll/cpptoc/dialog_handler_cpptoc.cc | 4 +- libcef_dll/cpptoc/dialog_handler_cpptoc.h | 4 +- libcef_dll/cpptoc/dictionary_value_cpptoc.cc | 4 +- libcef_dll/cpptoc/dictionary_value_cpptoc.h | 4 +- libcef_dll/cpptoc/display_handler_cpptoc.cc | 4 +- libcef_dll/cpptoc/display_handler_cpptoc.h | 4 +- libcef_dll/cpptoc/domdocument_cpptoc.cc | 4 +- libcef_dll/cpptoc/domdocument_cpptoc.h | 4 +- libcef_dll/cpptoc/domnode_cpptoc.cc | 4 +- libcef_dll/cpptoc/domnode_cpptoc.h | 4 +- libcef_dll/cpptoc/domvisitor_cpptoc.cc | 4 +- libcef_dll/cpptoc/domvisitor_cpptoc.h | 4 +- libcef_dll/cpptoc/download_handler_cpptoc.cc | 4 +- libcef_dll/cpptoc/download_handler_cpptoc.h | 4 +- .../cpptoc/download_image_callback_cpptoc.cc | 4 +- .../cpptoc/download_image_callback_cpptoc.h | 4 +- .../cpptoc/download_item_callback_cpptoc.cc | 4 +- .../cpptoc/download_item_callback_cpptoc.h | 4 +- libcef_dll/cpptoc/download_item_cpptoc.cc | 4 +- libcef_dll/cpptoc/download_item_cpptoc.h | 4 +- libcef_dll/cpptoc/drag_data_cpptoc.cc | 4 +- libcef_dll/cpptoc/drag_data_cpptoc.h | 4 +- libcef_dll/cpptoc/drag_handler_cpptoc.cc | 4 +- libcef_dll/cpptoc/drag_handler_cpptoc.h | 4 +- .../cpptoc/end_tracing_callback_cpptoc.cc | 4 +- .../cpptoc/end_tracing_callback_cpptoc.h | 4 +- libcef_dll/cpptoc/extension_cpptoc.cc | 4 +- libcef_dll/cpptoc/extension_cpptoc.h | 4 +- libcef_dll/cpptoc/extension_handler_cpptoc.cc | 4 +- libcef_dll/cpptoc/extension_handler_cpptoc.h | 4 +- .../cpptoc/file_dialog_callback_cpptoc.cc | 4 +- .../cpptoc/file_dialog_callback_cpptoc.h | 4 +- libcef_dll/cpptoc/find_handler_cpptoc.cc | 4 +- libcef_dll/cpptoc/find_handler_cpptoc.h | 4 +- libcef_dll/cpptoc/focus_handler_cpptoc.cc | 4 +- libcef_dll/cpptoc/focus_handler_cpptoc.h | 4 +- libcef_dll/cpptoc/frame_cpptoc.cc | 4 +- libcef_dll/cpptoc/frame_cpptoc.h | 4 +- libcef_dll/cpptoc/frame_handler_cpptoc.cc | 156 + libcef_dll/cpptoc/frame_handler_cpptoc.h | 37 + .../get_extension_resource_callback_cpptoc.cc | 4 +- .../get_extension_resource_callback_cpptoc.h | 4 +- libcef_dll/cpptoc/image_cpptoc.cc | 4 +- libcef_dll/cpptoc/image_cpptoc.h | 4 +- libcef_dll/cpptoc/jsdialog_callback_cpptoc.cc | 4 +- libcef_dll/cpptoc/jsdialog_callback_cpptoc.h | 4 +- libcef_dll/cpptoc/jsdialog_handler_cpptoc.cc | 4 +- libcef_dll/cpptoc/jsdialog_handler_cpptoc.h | 4 +- libcef_dll/cpptoc/keyboard_handler_cpptoc.cc | 4 +- libcef_dll/cpptoc/keyboard_handler_cpptoc.h | 4 +- libcef_dll/cpptoc/life_span_handler_cpptoc.cc | 4 +- libcef_dll/cpptoc/life_span_handler_cpptoc.h | 4 +- libcef_dll/cpptoc/list_value_cpptoc.cc | 4 +- libcef_dll/cpptoc/list_value_cpptoc.h | 4 +- libcef_dll/cpptoc/load_handler_cpptoc.cc | 4 +- libcef_dll/cpptoc/load_handler_cpptoc.h | 4 +- libcef_dll/cpptoc/media_observer_cpptoc.cc | 4 +- libcef_dll/cpptoc/media_observer_cpptoc.h | 4 +- libcef_dll/cpptoc/media_route_cpptoc.cc | 4 +- libcef_dll/cpptoc/media_route_cpptoc.h | 4 +- .../media_route_create_callback_cpptoc.cc | 4 +- .../media_route_create_callback_cpptoc.h | 4 +- libcef_dll/cpptoc/media_router_cpptoc.cc | 4 +- libcef_dll/cpptoc/media_router_cpptoc.h | 4 +- libcef_dll/cpptoc/media_sink_cpptoc.cc | 4 +- libcef_dll/cpptoc/media_sink_cpptoc.h | 4 +- .../media_sink_device_info_callback_cpptoc.cc | 4 +- .../media_sink_device_info_callback_cpptoc.h | 4 +- libcef_dll/cpptoc/media_source_cpptoc.cc | 4 +- libcef_dll/cpptoc/media_source_cpptoc.h | 4 +- libcef_dll/cpptoc/menu_model_cpptoc.cc | 4 +- libcef_dll/cpptoc/menu_model_cpptoc.h | 4 +- .../cpptoc/menu_model_delegate_cpptoc.cc | 4 +- .../cpptoc/menu_model_delegate_cpptoc.h | 4 +- libcef_dll/cpptoc/navigation_entry_cpptoc.cc | 4 +- libcef_dll/cpptoc/navigation_entry_cpptoc.h | 4 +- .../cpptoc/navigation_entry_visitor_cpptoc.cc | 4 +- .../cpptoc/navigation_entry_visitor_cpptoc.h | 4 +- .../cpptoc/pdf_print_callback_cpptoc.cc | 4 +- libcef_dll/cpptoc/pdf_print_callback_cpptoc.h | 4 +- libcef_dll/cpptoc/post_data_cpptoc.cc | 4 +- libcef_dll/cpptoc/post_data_cpptoc.h | 4 +- libcef_dll/cpptoc/post_data_element_cpptoc.cc | 4 +- libcef_dll/cpptoc/post_data_element_cpptoc.h | 4 +- .../cpptoc/print_dialog_callback_cpptoc.cc | 4 +- .../cpptoc/print_dialog_callback_cpptoc.h | 4 +- libcef_dll/cpptoc/print_handler_cpptoc.cc | 4 +- libcef_dll/cpptoc/print_handler_cpptoc.h | 4 +- .../cpptoc/print_job_callback_cpptoc.cc | 4 +- libcef_dll/cpptoc/print_job_callback_cpptoc.h | 4 +- libcef_dll/cpptoc/print_settings_cpptoc.cc | 4 +- libcef_dll/cpptoc/print_settings_cpptoc.h | 4 +- libcef_dll/cpptoc/process_message_cpptoc.cc | 4 +- libcef_dll/cpptoc/process_message_cpptoc.h | 4 +- libcef_dll/cpptoc/read_handler_cpptoc.cc | 4 +- libcef_dll/cpptoc/read_handler_cpptoc.h | 4 +- .../cpptoc/register_cdm_callback_cpptoc.cc | 70 - .../cpptoc/register_cdm_callback_cpptoc.h | 40 - libcef_dll/cpptoc/registration_cpptoc.cc | 4 +- libcef_dll/cpptoc/registration_cpptoc.h | 4 +- libcef_dll/cpptoc/render_handler_cpptoc.cc | 4 +- libcef_dll/cpptoc/render_handler_cpptoc.h | 4 +- .../cpptoc/render_process_handler_cpptoc.cc | 9 +- .../cpptoc/render_process_handler_cpptoc.h | 4 +- libcef_dll/cpptoc/request_callback_cpptoc.cc | 79 - libcef_dll/cpptoc/request_callback_cpptoc.h | 38 - libcef_dll/cpptoc/request_context_cpptoc.cc | 20 +- libcef_dll/cpptoc/request_context_cpptoc.h | 4 +- .../cpptoc/request_context_handler_cpptoc.cc | 44 +- .../cpptoc/request_context_handler_cpptoc.h | 4 +- libcef_dll/cpptoc/request_cpptoc.cc | 4 +- libcef_dll/cpptoc/request_cpptoc.h | 4 +- libcef_dll/cpptoc/request_handler_cpptoc.cc | 15 +- libcef_dll/cpptoc/request_handler_cpptoc.h | 4 +- libcef_dll/cpptoc/resolve_callback_cpptoc.cc | 4 +- libcef_dll/cpptoc/resolve_callback_cpptoc.h | 4 +- libcef_dll/cpptoc/resource_bundle_cpptoc.cc | 4 +- libcef_dll/cpptoc/resource_bundle_cpptoc.h | 4 +- .../cpptoc/resource_bundle_handler_cpptoc.cc | 4 +- .../cpptoc/resource_bundle_handler_cpptoc.h | 4 +- libcef_dll/cpptoc/resource_handler_cpptoc.cc | 4 +- libcef_dll/cpptoc/resource_handler_cpptoc.h | 4 +- .../cpptoc/resource_read_callback_cpptoc.cc | 4 +- .../cpptoc/resource_read_callback_cpptoc.h | 4 +- .../cpptoc/resource_request_handler_cpptoc.cc | 11 +- .../cpptoc/resource_request_handler_cpptoc.h | 4 +- .../cpptoc/resource_skip_callback_cpptoc.cc | 4 +- .../cpptoc/resource_skip_callback_cpptoc.h | 4 +- libcef_dll/cpptoc/response_cpptoc.cc | 4 +- libcef_dll/cpptoc/response_cpptoc.h | 4 +- libcef_dll/cpptoc/response_filter_cpptoc.cc | 4 +- libcef_dll/cpptoc/response_filter_cpptoc.h | 4 +- .../run_context_menu_callback_cpptoc.cc | 4 +- .../cpptoc/run_context_menu_callback_cpptoc.h | 4 +- .../cpptoc/run_file_dialog_callback_cpptoc.cc | 4 +- .../cpptoc/run_file_dialog_callback_cpptoc.h | 4 +- .../cpptoc/scheme_handler_factory_cpptoc.cc | 4 +- .../cpptoc/scheme_handler_factory_cpptoc.h | 4 +- libcef_dll/cpptoc/scheme_registrar_cpptoc.cc | 4 +- libcef_dll/cpptoc/scheme_registrar_cpptoc.h | 4 +- ...lect_client_certificate_callback_cpptoc.cc | 4 +- ...elect_client_certificate_callback_cpptoc.h | 4 +- libcef_dll/cpptoc/server_cpptoc.cc | 4 +- libcef_dll/cpptoc/server_cpptoc.h | 4 +- libcef_dll/cpptoc/server_handler_cpptoc.cc | 4 +- libcef_dll/cpptoc/server_handler_cpptoc.h | 4 +- .../cpptoc/set_cookie_callback_cpptoc.cc | 4 +- .../cpptoc/set_cookie_callback_cpptoc.h | 4 +- libcef_dll/cpptoc/sslinfo_cpptoc.cc | 4 +- libcef_dll/cpptoc/sslinfo_cpptoc.h | 4 +- libcef_dll/cpptoc/sslstatus_cpptoc.cc | 4 +- libcef_dll/cpptoc/sslstatus_cpptoc.h | 4 +- libcef_dll/cpptoc/stream_reader_cpptoc.cc | 4 +- libcef_dll/cpptoc/stream_reader_cpptoc.h | 4 +- libcef_dll/cpptoc/stream_writer_cpptoc.cc | 4 +- libcef_dll/cpptoc/stream_writer_cpptoc.h | 4 +- libcef_dll/cpptoc/string_visitor_cpptoc.cc | 4 +- libcef_dll/cpptoc/string_visitor_cpptoc.h | 4 +- libcef_dll/cpptoc/task_cpptoc.cc | 4 +- libcef_dll/cpptoc/task_cpptoc.h | 4 +- libcef_dll/cpptoc/task_runner_cpptoc.cc | 4 +- libcef_dll/cpptoc/task_runner_cpptoc.h | 4 +- .../cpptoc/test/translator_test_cpptoc.cc | 22 +- .../cpptoc/test/translator_test_cpptoc.h | 4 +- ...slator_test_ref_ptr_client_child_cpptoc.cc | 4 +- ...nslator_test_ref_ptr_client_child_cpptoc.h | 4 +- .../translator_test_ref_ptr_client_cpptoc.cc | 4 +- .../translator_test_ref_ptr_client_cpptoc.h | 4 +- ...test_ref_ptr_library_child_child_cpptoc.cc | 4 +- ..._test_ref_ptr_library_child_child_cpptoc.h | 4 +- ...lator_test_ref_ptr_library_child_cpptoc.cc | 4 +- ...slator_test_ref_ptr_library_child_cpptoc.h | 4 +- .../translator_test_ref_ptr_library_cpptoc.cc | 4 +- .../translator_test_ref_ptr_library_cpptoc.h | 4 +- ...nslator_test_scoped_client_child_cpptoc.cc | 4 +- ...anslator_test_scoped_client_child_cpptoc.h | 4 +- .../translator_test_scoped_client_cpptoc.cc | 10 +- .../translator_test_scoped_client_cpptoc.h | 4 +- ..._test_scoped_library_child_child_cpptoc.cc | 6 +- ...r_test_scoped_library_child_child_cpptoc.h | 4 +- ...slator_test_scoped_library_child_cpptoc.cc | 13 +- ...nslator_test_scoped_library_child_cpptoc.h | 4 +- .../translator_test_scoped_library_cpptoc.cc | 19 +- .../translator_test_scoped_library_cpptoc.h | 4 +- libcef_dll/cpptoc/thread_cpptoc.cc | 4 +- libcef_dll/cpptoc/thread_cpptoc.h | 4 +- libcef_dll/cpptoc/urlrequest_client_cpptoc.cc | 4 +- libcef_dll/cpptoc/urlrequest_client_cpptoc.h | 4 +- libcef_dll/cpptoc/urlrequest_cpptoc.cc | 4 +- libcef_dll/cpptoc/urlrequest_cpptoc.h | 4 +- libcef_dll/cpptoc/v8accessor_cpptoc.cc | 4 +- libcef_dll/cpptoc/v8accessor_cpptoc.h | 4 +- .../v8array_buffer_release_callback_cpptoc.cc | 4 +- .../v8array_buffer_release_callback_cpptoc.h | 4 +- libcef_dll/cpptoc/v8context_cpptoc.cc | 4 +- libcef_dll/cpptoc/v8context_cpptoc.h | 4 +- libcef_dll/cpptoc/v8exception_cpptoc.cc | 4 +- libcef_dll/cpptoc/v8exception_cpptoc.h | 4 +- libcef_dll/cpptoc/v8handler_cpptoc.cc | 4 +- libcef_dll/cpptoc/v8handler_cpptoc.h | 4 +- libcef_dll/cpptoc/v8interceptor_cpptoc.cc | 4 +- libcef_dll/cpptoc/v8interceptor_cpptoc.h | 4 +- libcef_dll/cpptoc/v8stack_frame_cpptoc.cc | 4 +- libcef_dll/cpptoc/v8stack_frame_cpptoc.h | 4 +- libcef_dll/cpptoc/v8stack_trace_cpptoc.cc | 4 +- libcef_dll/cpptoc/v8stack_trace_cpptoc.h | 4 +- libcef_dll/cpptoc/v8value_cpptoc.cc | 4 +- libcef_dll/cpptoc/v8value_cpptoc.h | 4 +- libcef_dll/cpptoc/value_cpptoc.cc | 4 +- libcef_dll/cpptoc/value_cpptoc.h | 4 +- libcef_dll/cpptoc/views/box_layout_cpptoc.cc | 4 +- libcef_dll/cpptoc/views/box_layout_cpptoc.h | 4 +- .../cpptoc/views/browser_view_cpptoc.cc | 46 +- libcef_dll/cpptoc/views/browser_view_cpptoc.h | 4 +- .../views/browser_view_delegate_cpptoc.cc | 34 +- .../views/browser_view_delegate_cpptoc.h | 4 +- libcef_dll/cpptoc/views/button_cpptoc.cc | 45 +- libcef_dll/cpptoc/views/button_cpptoc.h | 4 +- .../cpptoc/views/button_delegate_cpptoc.cc | 33 +- .../cpptoc/views/button_delegate_cpptoc.h | 4 +- libcef_dll/cpptoc/views/display_cpptoc.cc | 4 +- libcef_dll/cpptoc/views/display_cpptoc.h | 4 +- libcef_dll/cpptoc/views/fill_layout_cpptoc.cc | 4 +- libcef_dll/cpptoc/views/fill_layout_cpptoc.h | 4 +- .../cpptoc/views/label_button_cpptoc.cc | 46 +- libcef_dll/cpptoc/views/label_button_cpptoc.h | 4 +- libcef_dll/cpptoc/views/layout_cpptoc.cc | 4 +- libcef_dll/cpptoc/views/layout_cpptoc.h | 4 +- libcef_dll/cpptoc/views/menu_button_cpptoc.cc | 46 +- libcef_dll/cpptoc/views/menu_button_cpptoc.h | 4 +- .../views/menu_button_delegate_cpptoc.cc | 35 +- .../views/menu_button_delegate_cpptoc.h | 4 +- .../views/menu_button_pressed_lock_cpptoc.cc | 4 +- .../views/menu_button_pressed_lock_cpptoc.h | 4 +- .../cpptoc/views/overlay_controller_cpptoc.cc | 416 + .../cpptoc/views/overlay_controller_cpptoc.h | 42 + libcef_dll/cpptoc/views/panel_cpptoc.cc | 45 +- libcef_dll/cpptoc/views/panel_cpptoc.h | 4 +- .../cpptoc/views/panel_delegate_cpptoc.cc | 33 +- .../cpptoc/views/panel_delegate_cpptoc.h | 4 +- libcef_dll/cpptoc/views/scroll_view_cpptoc.cc | 46 +- libcef_dll/cpptoc/views/scroll_view_cpptoc.h | 4 +- libcef_dll/cpptoc/views/textfield_cpptoc.cc | 46 +- libcef_dll/cpptoc/views/textfield_cpptoc.h | 4 +- .../cpptoc/views/textfield_delegate_cpptoc.cc | 34 +- .../cpptoc/views/textfield_delegate_cpptoc.h | 4 +- libcef_dll/cpptoc/views/view_cpptoc.cc | 43 +- libcef_dll/cpptoc/views/view_cpptoc.h | 4 +- .../cpptoc/views/view_delegate_cpptoc.cc | 33 +- .../cpptoc/views/view_delegate_cpptoc.h | 4 +- libcef_dll/cpptoc/views/window_cpptoc.cc | 72 +- libcef_dll/cpptoc/views/window_cpptoc.h | 4 +- .../cpptoc/views/window_delegate_cpptoc.cc | 58 +- .../cpptoc/views/window_delegate_cpptoc.h | 4 +- libcef_dll/cpptoc/waitable_event_cpptoc.cc | 4 +- libcef_dll/cpptoc/waitable_event_cpptoc.h | 4 +- libcef_dll/cpptoc/web_plugin_info_cpptoc.cc | 4 +- libcef_dll/cpptoc/web_plugin_info_cpptoc.h | 4 +- .../cpptoc/web_plugin_info_visitor_cpptoc.cc | 4 +- .../cpptoc/web_plugin_info_visitor_cpptoc.h | 4 +- .../web_plugin_unstable_callback_cpptoc.cc | 4 +- .../web_plugin_unstable_callback_cpptoc.h | 4 +- libcef_dll/cpptoc/write_handler_cpptoc.cc | 4 +- libcef_dll/cpptoc/write_handler_cpptoc.h | 4 +- .../cpptoc/x509cert_principal_cpptoc.cc | 4 +- libcef_dll/cpptoc/x509cert_principal_cpptoc.h | 4 +- libcef_dll/cpptoc/x509certificate_cpptoc.cc | 4 +- libcef_dll/cpptoc/x509certificate_cpptoc.h | 4 +- libcef_dll/cpptoc/xml_reader_cpptoc.cc | 4 +- libcef_dll/cpptoc/xml_reader_cpptoc.h | 4 +- libcef_dll/cpptoc/zip_reader_cpptoc.cc | 4 +- libcef_dll/cpptoc/zip_reader_cpptoc.h | 4 +- .../ctocpp/accessibility_handler_ctocpp.cc | 4 +- .../ctocpp/accessibility_handler_ctocpp.h | 4 +- libcef_dll/ctocpp/app_ctocpp.cc | 4 +- libcef_dll/ctocpp/app_ctocpp.h | 4 +- libcef_dll/ctocpp/audio_handler_ctocpp.cc | 4 +- libcef_dll/ctocpp/audio_handler_ctocpp.h | 4 +- libcef_dll/ctocpp/auth_callback_ctocpp.cc | 4 +- libcef_dll/ctocpp/auth_callback_ctocpp.h | 8 +- .../ctocpp/before_download_callback_ctocpp.cc | 4 +- .../ctocpp/before_download_callback_ctocpp.h | 6 +- libcef_dll/ctocpp/binary_value_ctocpp.cc | 4 +- libcef_dll/ctocpp/binary_value_ctocpp.h | 18 +- libcef_dll/ctocpp/browser_ctocpp.cc | 20 +- libcef_dll/ctocpp/browser_ctocpp.h | 45 +- libcef_dll/ctocpp/browser_host_ctocpp.cc | 28 +- libcef_dll/ctocpp/browser_host_ctocpp.h | 126 +- .../ctocpp/browser_process_handler_ctocpp.cc | 4 +- .../ctocpp/browser_process_handler_ctocpp.h | 4 +- libcef_dll/ctocpp/callback_ctocpp.cc | 4 +- libcef_dll/ctocpp/callback_ctocpp.h | 8 +- libcef_dll/ctocpp/client_ctocpp.cc | 20 +- libcef_dll/ctocpp/client_ctocpp.h | 5 +- libcef_dll/ctocpp/command_line_ctocpp.cc | 4 +- libcef_dll/ctocpp/command_line_ctocpp.h | 44 +- .../ctocpp/completion_callback_ctocpp.cc | 4 +- .../ctocpp/completion_callback_ctocpp.h | 4 +- .../ctocpp/context_menu_handler_ctocpp.cc | 4 +- .../ctocpp/context_menu_handler_ctocpp.h | 4 +- .../ctocpp/context_menu_params_ctocpp.cc | 4 +- .../ctocpp/context_menu_params_ctocpp.h | 44 +- .../ctocpp/cookie_access_filter_ctocpp.cc | 4 +- .../ctocpp/cookie_access_filter_ctocpp.h | 4 +- libcef_dll/ctocpp/cookie_manager_ctocpp.cc | 4 +- libcef_dll/ctocpp/cookie_manager_ctocpp.h | 14 +- libcef_dll/ctocpp/cookie_visitor_ctocpp.cc | 4 +- libcef_dll/ctocpp/cookie_visitor_ctocpp.h | 4 +- libcef_dll/ctocpp/ctocpp_ref_counted.h | 12 +- libcef_dll/ctocpp/ctocpp_scoped.h | 15 +- .../ctocpp/delete_cookies_callback_ctocpp.cc | 4 +- .../ctocpp/delete_cookies_callback_ctocpp.h | 4 +- .../dev_tools_message_observer_ctocpp.cc | 4 +- .../dev_tools_message_observer_ctocpp.h | 4 +- libcef_dll/ctocpp/dialog_handler_ctocpp.cc | 4 +- libcef_dll/ctocpp/dialog_handler_ctocpp.h | 4 +- libcef_dll/ctocpp/dictionary_value_ctocpp.cc | 4 +- libcef_dll/ctocpp/dictionary_value_ctocpp.h | 62 +- libcef_dll/ctocpp/display_handler_ctocpp.cc | 4 +- libcef_dll/ctocpp/display_handler_ctocpp.h | 4 +- libcef_dll/ctocpp/domdocument_ctocpp.cc | 4 +- libcef_dll/ctocpp/domdocument_ctocpp.h | 32 +- libcef_dll/ctocpp/domnode_ctocpp.cc | 4 +- libcef_dll/ctocpp/domnode_ctocpp.h | 56 +- libcef_dll/ctocpp/domvisitor_ctocpp.cc | 4 +- libcef_dll/ctocpp/domvisitor_ctocpp.h | 4 +- libcef_dll/ctocpp/download_handler_ctocpp.cc | 4 +- libcef_dll/ctocpp/download_handler_ctocpp.h | 4 +- .../ctocpp/download_image_callback_ctocpp.cc | 4 +- .../ctocpp/download_image_callback_ctocpp.h | 4 +- .../ctocpp/download_item_callback_ctocpp.cc | 4 +- .../ctocpp/download_item_callback_ctocpp.h | 10 +- libcef_dll/ctocpp/download_item_ctocpp.cc | 4 +- libcef_dll/ctocpp/download_item_ctocpp.h | 38 +- libcef_dll/ctocpp/drag_data_ctocpp.cc | 4 +- libcef_dll/ctocpp/drag_data_ctocpp.h | 54 +- libcef_dll/ctocpp/drag_handler_ctocpp.cc | 4 +- libcef_dll/ctocpp/drag_handler_ctocpp.h | 4 +- .../ctocpp/end_tracing_callback_ctocpp.cc | 4 +- .../ctocpp/end_tracing_callback_ctocpp.h | 4 +- libcef_dll/ctocpp/extension_ctocpp.cc | 4 +- libcef_dll/ctocpp/extension_ctocpp.h | 20 +- libcef_dll/ctocpp/extension_handler_ctocpp.cc | 4 +- libcef_dll/ctocpp/extension_handler_ctocpp.h | 4 +- .../ctocpp/file_dialog_callback_ctocpp.cc | 4 +- .../ctocpp/file_dialog_callback_ctocpp.h | 8 +- libcef_dll/ctocpp/find_handler_ctocpp.cc | 4 +- libcef_dll/ctocpp/find_handler_ctocpp.h | 4 +- libcef_dll/ctocpp/focus_handler_ctocpp.cc | 4 +- libcef_dll/ctocpp/focus_handler_ctocpp.h | 4 +- libcef_dll/ctocpp/frame_ctocpp.cc | 4 +- libcef_dll/ctocpp/frame_ctocpp.h | 54 +- libcef_dll/ctocpp/frame_handler_ctocpp.cc | 146 + libcef_dll/ctocpp/frame_handler_ctocpp.h | 49 + .../get_extension_resource_callback_ctocpp.cc | 4 +- .../get_extension_resource_callback_ctocpp.h | 8 +- libcef_dll/ctocpp/image_ctocpp.cc | 4 +- libcef_dll/ctocpp/image_ctocpp.h | 30 +- libcef_dll/ctocpp/jsdialog_callback_ctocpp.cc | 4 +- libcef_dll/ctocpp/jsdialog_callback_ctocpp.h | 6 +- libcef_dll/ctocpp/jsdialog_handler_ctocpp.cc | 4 +- libcef_dll/ctocpp/jsdialog_handler_ctocpp.h | 4 +- libcef_dll/ctocpp/keyboard_handler_ctocpp.cc | 4 +- libcef_dll/ctocpp/keyboard_handler_ctocpp.h | 4 +- libcef_dll/ctocpp/life_span_handler_ctocpp.cc | 4 +- libcef_dll/ctocpp/life_span_handler_ctocpp.h | 4 +- libcef_dll/ctocpp/list_value_ctocpp.cc | 4 +- libcef_dll/ctocpp/list_value_ctocpp.h | 60 +- libcef_dll/ctocpp/load_handler_ctocpp.cc | 4 +- libcef_dll/ctocpp/load_handler_ctocpp.h | 4 +- libcef_dll/ctocpp/media_observer_ctocpp.cc | 4 +- libcef_dll/ctocpp/media_observer_ctocpp.h | 4 +- .../media_route_create_callback_ctocpp.cc | 4 +- .../media_route_create_callback_ctocpp.h | 4 +- libcef_dll/ctocpp/media_route_ctocpp.cc | 4 +- libcef_dll/ctocpp/media_route_ctocpp.h | 14 +- libcef_dll/ctocpp/media_router_ctocpp.cc | 4 +- libcef_dll/ctocpp/media_router_ctocpp.h | 14 +- libcef_dll/ctocpp/media_sink_ctocpp.cc | 4 +- libcef_dll/ctocpp/media_sink_ctocpp.h | 20 +- .../media_sink_device_info_callback_ctocpp.cc | 4 +- .../media_sink_device_info_callback_ctocpp.h | 4 +- libcef_dll/ctocpp/media_source_ctocpp.cc | 4 +- libcef_dll/ctocpp/media_source_ctocpp.h | 10 +- libcef_dll/ctocpp/menu_model_ctocpp.cc | 4 +- libcef_dll/ctocpp/menu_model_ctocpp.h | 116 +- .../ctocpp/menu_model_delegate_ctocpp.cc | 4 +- .../ctocpp/menu_model_delegate_ctocpp.h | 4 +- libcef_dll/ctocpp/navigation_entry_ctocpp.cc | 6 +- libcef_dll/ctocpp/navigation_entry_ctocpp.h | 24 +- .../ctocpp/navigation_entry_visitor_ctocpp.cc | 4 +- .../ctocpp/navigation_entry_visitor_ctocpp.h | 4 +- .../ctocpp/pdf_print_callback_ctocpp.cc | 4 +- libcef_dll/ctocpp/pdf_print_callback_ctocpp.h | 4 +- libcef_dll/ctocpp/post_data_ctocpp.cc | 4 +- libcef_dll/ctocpp/post_data_ctocpp.h | 18 +- libcef_dll/ctocpp/post_data_element_ctocpp.cc | 4 +- libcef_dll/ctocpp/post_data_element_ctocpp.h | 20 +- .../ctocpp/print_dialog_callback_ctocpp.cc | 4 +- .../ctocpp/print_dialog_callback_ctocpp.h | 8 +- libcef_dll/ctocpp/print_handler_ctocpp.cc | 4 +- libcef_dll/ctocpp/print_handler_ctocpp.h | 4 +- .../ctocpp/print_job_callback_ctocpp.cc | 4 +- libcef_dll/ctocpp/print_job_callback_ctocpp.h | 6 +- libcef_dll/ctocpp/print_settings_ctocpp.cc | 4 +- libcef_dll/ctocpp/print_settings_ctocpp.h | 48 +- libcef_dll/ctocpp/process_message_ctocpp.cc | 4 +- libcef_dll/ctocpp/process_message_ctocpp.h | 14 +- libcef_dll/ctocpp/read_handler_ctocpp.cc | 4 +- libcef_dll/ctocpp/read_handler_ctocpp.h | 4 +- .../ctocpp/register_cdm_callback_ctocpp.cc | 63 - .../ctocpp/register_cdm_callback_ctocpp.h | 44 - libcef_dll/ctocpp/registration_ctocpp.cc | 4 +- libcef_dll/ctocpp/registration_ctocpp.h | 4 +- libcef_dll/ctocpp/render_handler_ctocpp.cc | 8 +- libcef_dll/ctocpp/render_handler_ctocpp.h | 4 +- .../ctocpp/render_process_handler_ctocpp.cc | 9 +- .../ctocpp/render_process_handler_ctocpp.h | 4 +- libcef_dll/ctocpp/request_callback_ctocpp.cc | 70 - libcef_dll/ctocpp/request_callback_ctocpp.h | 42 - libcef_dll/ctocpp/request_context_ctocpp.cc | 16 +- libcef_dll/ctocpp/request_context_ctocpp.h | 51 +- .../ctocpp/request_context_handler_ctocpp.cc | 60 +- .../ctocpp/request_context_handler_ctocpp.h | 10 +- libcef_dll/ctocpp/request_ctocpp.cc | 4 +- libcef_dll/ctocpp/request_ctocpp.h | 48 +- libcef_dll/ctocpp/request_handler_ctocpp.cc | 38 +- libcef_dll/ctocpp/request_handler_ctocpp.h | 8 +- libcef_dll/ctocpp/resolve_callback_ctocpp.cc | 4 +- libcef_dll/ctocpp/resolve_callback_ctocpp.h | 4 +- libcef_dll/ctocpp/resource_bundle_ctocpp.cc | 4 +- libcef_dll/ctocpp/resource_bundle_ctocpp.h | 10 +- .../ctocpp/resource_bundle_handler_ctocpp.cc | 4 +- .../ctocpp/resource_bundle_handler_ctocpp.h | 4 +- libcef_dll/ctocpp/resource_handler_ctocpp.cc | 4 +- libcef_dll/ctocpp/resource_handler_ctocpp.h | 4 +- .../ctocpp/resource_read_callback_ctocpp.cc | 4 +- .../ctocpp/resource_read_callback_ctocpp.h | 6 +- .../ctocpp/resource_request_handler_ctocpp.cc | 48 +- .../ctocpp/resource_request_handler_ctocpp.h | 13 +- .../ctocpp/resource_skip_callback_ctocpp.cc | 4 +- .../ctocpp/resource_skip_callback_ctocpp.h | 6 +- libcef_dll/ctocpp/response_ctocpp.cc | 4 +- libcef_dll/ctocpp/response_ctocpp.h | 38 +- libcef_dll/ctocpp/response_filter_ctocpp.cc | 18 +- libcef_dll/ctocpp/response_filter_ctocpp.h | 4 +- .../run_context_menu_callback_ctocpp.cc | 4 +- .../ctocpp/run_context_menu_callback_ctocpp.h | 8 +- .../ctocpp/run_file_dialog_callback_ctocpp.cc | 4 +- .../ctocpp/run_file_dialog_callback_ctocpp.h | 4 +- .../ctocpp/scheme_handler_factory_ctocpp.cc | 4 +- .../ctocpp/scheme_handler_factory_ctocpp.h | 4 +- libcef_dll/ctocpp/scheme_registrar_ctocpp.cc | 4 +- libcef_dll/ctocpp/scheme_registrar_ctocpp.h | 6 +- ...lect_client_certificate_callback_ctocpp.cc | 4 +- ...elect_client_certificate_callback_ctocpp.h | 6 +- libcef_dll/ctocpp/server_ctocpp.cc | 4 +- libcef_dll/ctocpp/server_ctocpp.h | 30 +- libcef_dll/ctocpp/server_handler_ctocpp.cc | 4 +- libcef_dll/ctocpp/server_handler_ctocpp.h | 4 +- .../ctocpp/set_cookie_callback_ctocpp.cc | 4 +- .../ctocpp/set_cookie_callback_ctocpp.h | 4 +- libcef_dll/ctocpp/sslinfo_ctocpp.cc | 4 +- libcef_dll/ctocpp/sslinfo_ctocpp.h | 8 +- libcef_dll/ctocpp/sslstatus_ctocpp.cc | 4 +- libcef_dll/ctocpp/sslstatus_ctocpp.h | 14 +- libcef_dll/ctocpp/stream_reader_ctocpp.cc | 4 +- libcef_dll/ctocpp/stream_reader_ctocpp.h | 14 +- libcef_dll/ctocpp/stream_writer_ctocpp.cc | 4 +- libcef_dll/ctocpp/stream_writer_ctocpp.h | 14 +- libcef_dll/ctocpp/string_visitor_ctocpp.cc | 4 +- libcef_dll/ctocpp/string_visitor_ctocpp.h | 4 +- libcef_dll/ctocpp/task_ctocpp.cc | 4 +- libcef_dll/ctocpp/task_ctocpp.h | 4 +- libcef_dll/ctocpp/task_runner_ctocpp.cc | 4 +- libcef_dll/ctocpp/task_runner_ctocpp.h | 14 +- .../ctocpp/test/translator_test_ctocpp.cc | 73 +- .../ctocpp/test/translator_test_ctocpp.h | 124 +- ...slator_test_ref_ptr_client_child_ctocpp.cc | 4 +- ...nslator_test_ref_ptr_client_child_ctocpp.h | 4 +- .../translator_test_ref_ptr_client_ctocpp.cc | 4 +- .../translator_test_ref_ptr_client_ctocpp.h | 4 +- ...test_ref_ptr_library_child_child_ctocpp.cc | 11 +- ..._test_ref_ptr_library_child_child_ctocpp.h | 16 +- ...lator_test_ref_ptr_library_child_ctocpp.cc | 9 +- ...slator_test_ref_ptr_library_child_ctocpp.h | 12 +- .../translator_test_ref_ptr_library_ctocpp.cc | 8 +- .../translator_test_ref_ptr_library_ctocpp.h | 8 +- ...nslator_test_scoped_client_child_ctocpp.cc | 4 +- ...anslator_test_scoped_client_child_ctocpp.h | 4 +- .../translator_test_scoped_client_ctocpp.cc | 7 +- .../translator_test_scoped_client_ctocpp.h | 4 +- ..._test_scoped_library_child_child_ctocpp.cc | 11 +- ...r_test_scoped_library_child_child_ctocpp.h | 16 +- ...slator_test_scoped_library_child_ctocpp.cc | 11 +- ...nslator_test_scoped_library_child_ctocpp.h | 12 +- .../translator_test_scoped_library_ctocpp.cc | 13 +- .../translator_test_scoped_library_ctocpp.h | 8 +- libcef_dll/ctocpp/thread_ctocpp.cc | 4 +- libcef_dll/ctocpp/thread_ctocpp.h | 12 +- libcef_dll/ctocpp/urlrequest_client_ctocpp.cc | 4 +- libcef_dll/ctocpp/urlrequest_client_ctocpp.h | 4 +- libcef_dll/ctocpp/urlrequest_ctocpp.cc | 4 +- libcef_dll/ctocpp/urlrequest_ctocpp.h | 18 +- libcef_dll/ctocpp/v8accessor_ctocpp.cc | 4 +- libcef_dll/ctocpp/v8accessor_ctocpp.h | 4 +- .../v8array_buffer_release_callback_ctocpp.cc | 4 +- .../v8array_buffer_release_callback_ctocpp.h | 4 +- libcef_dll/ctocpp/v8context_ctocpp.cc | 4 +- libcef_dll/ctocpp/v8context_ctocpp.h | 22 +- libcef_dll/ctocpp/v8exception_ctocpp.cc | 4 +- libcef_dll/ctocpp/v8exception_ctocpp.h | 20 +- libcef_dll/ctocpp/v8handler_ctocpp.cc | 4 +- libcef_dll/ctocpp/v8handler_ctocpp.h | 4 +- libcef_dll/ctocpp/v8interceptor_ctocpp.cc | 4 +- libcef_dll/ctocpp/v8interceptor_ctocpp.h | 4 +- libcef_dll/ctocpp/v8stack_frame_ctocpp.cc | 4 +- libcef_dll/ctocpp/v8stack_frame_ctocpp.h | 20 +- libcef_dll/ctocpp/v8stack_trace_ctocpp.cc | 4 +- libcef_dll/ctocpp/v8stack_trace_ctocpp.h | 10 +- libcef_dll/ctocpp/v8value_ctocpp.cc | 8 +- libcef_dll/ctocpp/v8value_ctocpp.h | 98 +- libcef_dll/ctocpp/value_ctocpp.cc | 4 +- libcef_dll/ctocpp/value_ctocpp.h | 48 +- libcef_dll/ctocpp/views/box_layout_ctocpp.cc | 4 +- libcef_dll/ctocpp/views/box_layout_ctocpp.h | 14 +- .../ctocpp/views/browser_view_ctocpp.cc | 34 +- libcef_dll/ctocpp/views/browser_view_ctocpp.h | 108 +- .../views/browser_view_delegate_ctocpp.cc | 25 +- .../views/browser_view_delegate_ctocpp.h | 6 +- libcef_dll/ctocpp/views/button_ctocpp.cc | 34 +- libcef_dll/ctocpp/views/button_ctocpp.h | 114 +- .../ctocpp/views/button_delegate_ctocpp.cc | 25 +- .../ctocpp/views/button_delegate_ctocpp.h | 6 +- libcef_dll/ctocpp/views/display_ctocpp.cc | 4 +- libcef_dll/ctocpp/views/display_ctocpp.h | 18 +- libcef_dll/ctocpp/views/fill_layout_ctocpp.cc | 4 +- libcef_dll/ctocpp/views/fill_layout_ctocpp.h | 10 +- .../ctocpp/views/label_button_ctocpp.cc | 34 +- libcef_dll/ctocpp/views/label_button_ctocpp.h | 136 +- libcef_dll/ctocpp/views/layout_ctocpp.cc | 4 +- libcef_dll/ctocpp/views/layout_ctocpp.h | 10 +- libcef_dll/ctocpp/views/menu_button_ctocpp.cc | 34 +- libcef_dll/ctocpp/views/menu_button_ctocpp.h | 140 +- .../views/menu_button_delegate_ctocpp.cc | 25 +- .../views/menu_button_delegate_ctocpp.h | 6 +- .../views/menu_button_pressed_lock_ctocpp.cc | 4 +- .../views/menu_button_pressed_lock_ctocpp.h | 4 +- .../ctocpp/views/overlay_controller_ctocpp.cc | 346 + .../ctocpp/views/overlay_controller_ctocpp.h | 63 + libcef_dll/ctocpp/views/panel_ctocpp.cc | 34 +- libcef_dll/ctocpp/views/panel_ctocpp.h | 126 +- .../ctocpp/views/panel_delegate_ctocpp.cc | 25 +- .../ctocpp/views/panel_delegate_ctocpp.h | 6 +- libcef_dll/ctocpp/views/scroll_view_ctocpp.cc | 34 +- libcef_dll/ctocpp/views/scroll_view_ctocpp.h | 116 +- libcef_dll/ctocpp/views/textfield_ctocpp.cc | 34 +- libcef_dll/ctocpp/views/textfield_ctocpp.h | 164 +- .../ctocpp/views/textfield_delegate_ctocpp.cc | 25 +- .../ctocpp/views/textfield_delegate_ctocpp.h | 6 +- libcef_dll/ctocpp/views/view_ctocpp.cc | 34 +- libcef_dll/ctocpp/views/view_ctocpp.h | 102 +- .../ctocpp/views/view_delegate_ctocpp.cc | 24 +- .../ctocpp/views/view_delegate_ctocpp.h | 6 +- libcef_dll/ctocpp/views/window_ctocpp.cc | 60 +- libcef_dll/ctocpp/views/window_ctocpp.h | 201 +- .../ctocpp/views/window_delegate_ctocpp.cc | 49 +- .../ctocpp/views/window_delegate_ctocpp.h | 7 +- libcef_dll/ctocpp/waitable_event_ctocpp.cc | 4 +- libcef_dll/ctocpp/waitable_event_ctocpp.h | 14 +- libcef_dll/ctocpp/web_plugin_info_ctocpp.cc | 4 +- libcef_dll/ctocpp/web_plugin_info_ctocpp.h | 12 +- .../ctocpp/web_plugin_info_visitor_ctocpp.cc | 4 +- .../ctocpp/web_plugin_info_visitor_ctocpp.h | 4 +- .../web_plugin_unstable_callback_ctocpp.cc | 4 +- .../web_plugin_unstable_callback_ctocpp.h | 4 +- libcef_dll/ctocpp/write_handler_ctocpp.cc | 4 +- libcef_dll/ctocpp/write_handler_ctocpp.h | 4 +- .../ctocpp/x509cert_principal_ctocpp.cc | 4 +- libcef_dll/ctocpp/x509cert_principal_ctocpp.h | 22 +- libcef_dll/ctocpp/x509certificate_ctocpp.cc | 4 +- libcef_dll/ctocpp/x509certificate_ctocpp.h | 24 +- libcef_dll/ctocpp/xml_reader_ctocpp.cc | 4 +- libcef_dll/ctocpp/xml_reader_ctocpp.h | 62 +- libcef_dll/ctocpp/zip_reader_ctocpp.cc | 4 +- libcef_dll/ctocpp/zip_reader_ctocpp.h | 28 +- libcef_dll/libcef_dll.cc | 33 +- libcef_dll/ptr_util.h | 18 - libcef_dll/sandbox/sandbox_win.cc | 12 - libcef_dll/shutdown_checker.cc | 22 - libcef_dll/transfer_util.h | 6 +- libcef_dll/views_stub.cc | 4 +- libcef_dll/wrapper/cef_browser_info_map.h | 16 +- libcef_dll/wrapper/cef_closure_task.cc | 63 +- libcef_dll/wrapper/cef_message_router.cc | 119 +- libcef_dll/wrapper/cef_resource_manager.cc | 142 +- libcef_dll/wrapper/cef_xml_object.cc | 6 +- libcef_dll/wrapper/cef_zip_archive.cc | 15 +- libcef_dll/wrapper/libcef_dll_dylib.cc | 24 +- libcef_dll/wrapper/libcef_dll_wrapper.cc | 64 +- libcef_dll/wrapper_types.h | 8 +- patch/patch.cfg | 125 +- patch/patches/base_command_line_1872.patch | 17 + patch/patches/base_sandbox_2743.patch | 52 +- patch/patches/base_string_piece_1049498.patch | 12 - .../blink_security_policy_1289230.patch | 13 + patch/patches/browser_scheduler.patch | 4 +- .../browser_security_policy_1081397.patch | 26 +- .../browser_web_ui_controller_factory.patch | 14 + patch/patches/build.patch | 8 +- patch/patches/chrome_browser.patch | 10 +- ...rome_browser_background_mode_1100085.patch | 99 +- patch/patches/chrome_browser_browser.patch | 76 +- .../chrome_browser_content_settings.patch | 34 +- .../chrome_browser_context_menus.patch | 60 +- patch/patches/chrome_browser_extensions.patch | 33 + patch/patches/chrome_browser_net_export.patch | 64 +- .../chrome_browser_privacy_1119417.patch | 59 + .../patches/chrome_browser_profile_menu.patch | 14 +- patch/patches/chrome_browser_profiles.patch | 69 +- .../chrome_browser_safe_browsing.patch | 4 +- .../chrome_browser_sharesheet_1123388.patch | 86 - patch/patches/chrome_browser_themes.patch | 16 +- patch/patches/chrome_plugins.patch | 122 +- patch/patches/chrome_pref_watcher.patch | 4 +- patch/patches/chrome_renderer.patch | 6 +- patch/patches/chrome_runtime.patch | 170 +- patch/patches/chrome_runtime_views.patch | 169 +- .../patches/chrome_untrusted_webui_3047.patch | 34 + patch/patches/chrome_widevine.patch | 12 - patch/patches/component_build.patch | 61 +- patch/patches/content_2015.patch | 386 +- patch/patches/content_main_654986.patch | 144 +- patch/patches/crashpad_1995.patch | 130 +- patch/patches/crashpad_tp_1995.patch | 64 +- patch/patches/embedder_product_override.patch | 24 +- patch/patches/extensions_1947.patch | 33 +- patch/patches/font_family_cache_1501.patch | 2 +- patch/patches/gn_config.patch | 56 +- patch/patches/gritsettings.patch | 12 +- patch/patches/ime_1610.patch | 15 - patch/patches/libxml_visibility.patch | 16 +- patch/patches/linux_assets_path_1936.patch | 28 +- patch/patches/linux_atk_1123214.patch | 8 +- patch/patches/linux_blink_thread_local.patch | 13 + .../linux_chrome_page_info_1099927.patch | 14 - .../patches/linux_chrome_widevine_3149.patch | 58 + patch/patches/linux_poll_2466.patch | 47 - patch/patches/linux_ui_ozone.patch | 13 + patch/patches/mac_event_observer_2539.patch | 2 +- patch/patches/mac_fling_scheduler_2540.patch | 2 +- patch/patches/mac_gpu.patch | 2 +- patch/patches/message_loop.patch | 24 +- patch/patches/message_pump_mac_2495.patch | 6 +- .../mime_handler_view_guest_1565_2727.patch | 38 +- patch/patches/net_cookie_flags.patch | 10 +- patch/patches/osr_fling_2745.patch | 12 +- patch/patches/print_preview_123.patch | 269 +- patch/patches/printing_context_2196.patch | 22 +- patch/patches/printing_pdf_3047.patch | 37 + patch/patches/renderer_host_1070713.patch | 4 +- .../renderer_preferences_util_545103.patch | 24 - patch/patches/resource_bundle_2512.patch | 16 +- patch/patches/runhooks.patch | 16 +- patch/patches/rwh_background_color_1984.patch | 18 +- patch/patches/services_network_2622.patch | 78 +- patch/patches/services_network_2718.patch | 37 +- .../patches/set_resize_background_color.patch | 50 +- patch/patches/storage_incognito_2289.patch | 22 +- patch/patches/trace_event.patch | 4 +- patch/patches/ui_dragdrop_355390.patch | 4 +- patch/patches/underlay_1051.patch | 2 +- patch/patches/views_1749_2102.patch | 131 +- patch/patches/views_widget.patch | 178 +- patch/patches/viz_osr_2575.patch | 76 +- patch/patches/web_contents_1257_1565.patch | 56 +- .../web_url_loader_cancel_1617042.patch | 6 +- patch/patches/webkit_plugin_info_2015.patch | 197 +- patch/patches/webkit_popups.patch | 76 + .../webkit_popups_and_background.patch | 151 - .../webkit_runtime_enabled_features.patch | 6 +- patch/patches/webui_2037.patch | 30 +- patch/patches/webview_plugin_2020.patch | 4 +- .../patches/win_cpp17_msvc_sandbox_2819.patch | 4 +- patch/patches/win_sandbox_3210.patch | 18 + tests/cefclient/browser/binding_test.cc | 2 +- tests/cefclient/browser/browser_window.cc | 2 +- tests/cefclient/browser/browser_window.h | 25 +- .../browser/browser_window_osr_gtk.cc | 31 +- .../browser/browser_window_osr_gtk.h | 50 +- .../browser/browser_window_osr_mac.h | 52 +- .../browser/browser_window_osr_mac.mm | 33 +- .../browser/browser_window_osr_win.cc | 2 +- .../browser/browser_window_osr_win.h | 24 +- .../browser/browser_window_std_gtk.cc | 6 +- .../browser/browser_window_std_gtk.h | 16 +- .../browser/browser_window_std_mac.h | 16 +- .../browser/browser_window_std_mac.mm | 7 +- .../browser/browser_window_std_win.cc | 13 +- .../browser/browser_window_std_win.h | 16 +- tests/cefclient/browser/bytes_write_handler.h | 10 +- tests/cefclient/browser/client_browser.cc | 4 +- tests/cefclient/browser/client_handler.cc | 77 +- tests/cefclient/browser/client_handler.h | 96 +- tests/cefclient/browser/client_handler_osr.cc | 5 +- tests/cefclient/browser/client_handler_osr.h | 36 +- tests/cefclient/browser/dialog_handler_gtk.cc | 30 +- tests/cefclient/browser/dialog_handler_gtk.h | 10 +- tests/cefclient/browser/dialog_test.cc | 4 +- tests/cefclient/browser/drm_test.cc | 120 - tests/cefclient/browser/drm_test.h | 20 - tests/cefclient/browser/image_cache.cc | 30 +- tests/cefclient/browser/image_cache.h | 22 +- tests/cefclient/browser/main_context.h | 1 + tests/cefclient/browser/main_context_impl.cc | 13 +- tests/cefclient/browser/main_context_impl.h | 35 +- .../browser/main_context_impl_win.cc | 4 +- .../main_message_loop_multithreaded_gtk.cc | 4 +- .../main_message_loop_multithreaded_gtk.h | 8 +- .../main_message_loop_multithreaded_win.cc | 16 +- .../main_message_loop_multithreaded_win.h | 10 +- tests/cefclient/browser/media_router_test.cc | 48 +- .../browser/osr_accessibility_node.cc | 2 +- tests/cefclient/browser/osr_dragdrop_win.cc | 12 +- .../cefclient/browser/osr_ime_handler_win.cc | 26 +- .../browser/osr_render_handler_win.cc | 6 +- .../browser/osr_render_handler_win_d3d11.cc | 2 +- .../browser/osr_render_handler_win_d3d11.h | 22 +- .../browser/osr_render_handler_win_gl.cc | 12 +- .../browser/osr_render_handler_win_gl.h | 20 +- tests/cefclient/browser/osr_window_win.cc | 54 +- tests/cefclient/browser/osr_window_win.h | 48 +- tests/cefclient/browser/preferences_test.cc | 2 +- tests/cefclient/browser/print_handler_gtk.cc | 48 +- tests/cefclient/browser/print_handler_gtk.h | 12 +- tests/cefclient/browser/resource.h | 43 +- .../browser/resource_util_win_idmap.cc | 1 - .../cefclient/browser/response_filter_test.cc | 8 +- tests/cefclient/browser/root_window.cc | 4 +- tests/cefclient/browser/root_window.h | 17 +- tests/cefclient/browser/root_window_create.cc | 4 +- tests/cefclient/browser/root_window_gtk.cc | 66 +- tests/cefclient/browser/root_window_gtk.h | 48 +- tests/cefclient/browser/root_window_mac.h | 44 +- tests/cefclient/browser/root_window_mac.mm | 34 +- .../cefclient/browser/root_window_manager.cc | 97 +- tests/cefclient/browser/root_window_manager.h | 39 +- tests/cefclient/browser/root_window_views.cc | 143 +- tests/cefclient/browser/root_window_views.h | 97 +- tests/cefclient/browser/root_window_win.cc | 108 +- tests/cefclient/browser/root_window_win.h | 46 +- tests/cefclient/browser/scheme_test.cc | 10 +- tests/cefclient/browser/server_test.cc | 32 +- tests/cefclient/browser/temp_window_mac.h | 6 +- tests/cefclient/browser/temp_window_mac.mm | 4 +- tests/cefclient/browser/temp_window_win.cc | 6 +- tests/cefclient/browser/temp_window_win.h | 4 +- tests/cefclient/browser/temp_window_x11.h | 4 +- tests/cefclient/browser/test_runner.cc | 56 +- .../browser/text_input_client_osr_mac.mm | 22 +- tests/cefclient/browser/urlrequest_test.cc | 31 +- tests/cefclient/browser/views_menu_bar.cc | 14 +- tests/cefclient/browser/views_menu_bar.h | 20 +- .../browser/views_overlay_controls.cc | 195 + .../browser/views_overlay_controls.h | 71 + tests/cefclient/browser/views_style.cc | 7 + tests/cefclient/browser/views_style.h | 1 + tests/cefclient/browser/views_window.cc | 411 +- tests/cefclient/browser/views_window.h | 65 +- tests/cefclient/browser/window_test.cc | 16 +- .../browser/window_test_runner_gtk.cc | 8 +- .../browser/window_test_runner_gtk.h | 8 +- .../browser/window_test_runner_mac.h | 8 +- .../browser/window_test_runner_views.h | 8 +- .../browser/window_test_runner_win.cc | 10 +- .../browser/window_test_runner_win.h | 8 +- tests/cefclient/cefclient_gtk.cc | 20 +- tests/cefclient/cefclient_mac.mm | 14 +- tests/cefclient/cefclient_win.cc | 19 +- tests/cefclient/renderer/client_renderer.cc | 10 +- tests/cefclient/renderer/performance_test.cc | 4 +- .../renderer/performance_test_tests.cc | 26 +- tests/cefclient/resources/draggable.html | 23 +- tests/cefclient/resources/drm.html | 141 - tests/cefclient/resources/other_tests.html | 2 +- tests/cefclient/resources/win/cefclient.rc | 1 - tests/cefsimple/cefsimple_mac.mm | 2 +- tests/cefsimple/simple_app.cc | 12 +- tests/cefsimple/simple_app.h | 6 +- tests/cefsimple/simple_handler.cc | 6 +- tests/cefsimple/simple_handler.h | 16 +- tests/ceftests/audio_output_unittest.cc | 2 +- tests/ceftests/client_app_delegates.cc | 8 +- tests/ceftests/command_line_unittest.cc | 33 +- tests/ceftests/cookie_unittest.cc | 203 +- tests/ceftests/cors_unittest.cc | 73 +- tests/ceftests/devtools_message_unittest.cc | 30 +- tests/ceftests/dialog_unittest.cc | 6 +- tests/ceftests/display_unittest.cc | 4 +- tests/ceftests/download_unittest.cc | 82 +- tests/ceftests/draggable_regions_unittest.cc | 182 +- .../extensions/background_unittest.cc | 8 +- .../extensions/chrome_alarms_unittest.cc | 6 +- .../extensions/chrome_storage_unittest.cc | 6 +- .../extensions/chrome_tabs_unittest.cc | 6 +- tests/ceftests/extensions/view_unittest.cc | 7 +- tests/ceftests/frame_handler_unittest.cc | 1699 +++ tests/ceftests/frame_unittest.cc | 143 +- tests/ceftests/jsdialog_unittest.cc | 10 +- tests/ceftests/life_span_unittest.cc | 6 +- tests/ceftests/message_router_unittest.cc | 17 +- tests/ceftests/navigation_unittest.cc | 26 +- tests/ceftests/os_rendering_unittest.cc | 29 +- tests/ceftests/osr_accessibility_unittest.cc | 30 +- tests/ceftests/osr_display_unittest.cc | 26 +- tests/ceftests/pdf_viewer_unittest.cc | 252 + tests/ceftests/plugin_unittest.cc | 613 - tests/ceftests/preference_unittest.cc | 9 +- tests/ceftests/process_message_unittest.cc | 30 +- tests/ceftests/request_context_unittest.cc | 26 +- tests/ceftests/request_handler_unittest.cc | 14 +- tests/ceftests/request_unittest.cc | 8 +- tests/ceftests/resource_manager_unittest.cc | 98 +- .../resource_request_handler_unittest.cc | 134 +- tests/ceftests/routing_test_handler.cc | 3 +- tests/ceftests/routing_test_handler.h | 2 +- tests/ceftests/run_all_unittests.cc | 12 +- tests/ceftests/scheme_handler_unittest.cc | 43 +- tests/ceftests/server_unittest.cc | 133 +- .../stream_resource_handler_unittest.cc | 2 +- tests/ceftests/task_unittest.cc | 175 +- tests/ceftests/test_handler.cc | 50 +- tests/ceftests/test_handler.h | 19 +- tests/ceftests/test_request.cc | 33 +- tests/ceftests/test_request.h | 15 +- tests/ceftests/test_server.cc | 84 +- tests/ceftests/test_server.h | 19 +- tests/ceftests/test_server_unittest.cc | 38 +- tests/ceftests/test_suite.cc | 7 + tests/ceftests/test_util.cc | 3 + tests/ceftests/thread_helper.cc | 22 +- tests/ceftests/thread_helper.h | 30 +- tests/ceftests/thread_unittest.cc | 65 +- tests/ceftests/tracing_unittest.cc | 15 +- tests/ceftests/translator_unittest.cc | 33 +- tests/ceftests/urlrequest_unittest.cc | 581 +- tests/ceftests/v8_unittest.cc | 54 +- tests/ceftests/views/button_unittest.cc | 78 +- tests/ceftests/views/scroll_view_unittest.cc | 13 +- tests/ceftests/views/test_window_delegate.cc | 61 +- tests/ceftests/views/test_window_delegate.h | 22 +- tests/ceftests/views/textfield_unittest.cc | 44 +- tests/ceftests/views/window_unittest.cc | 148 +- tests/ceftests/waitable_event_unittest.cc | 4 +- tests/ceftests/webui_unittest.cc | 16 +- tests/gtest/CMakeLists.txt.in | 4 + tests/gtest/teamcity/README.cef | 14 + tests/gtest/teamcity/include/teamcity_gtest.h | 54 + tests/gtest/teamcity/src/teamcity_gtest.cpp | 86 + .../gtest/teamcity/src/teamcity_messages.cpp | 189 + tests/gtest/teamcity/src/teamcity_messages.h | 61 + tests/shared/browser/client_app_browser.h | 10 +- tests/shared/browser/extension_util.cc | 50 +- tests/shared/browser/extension_util.h | 6 +- tests/shared/browser/file_util.cc | 9 +- tests/shared/browser/file_util.h | 8 +- tests/shared/browser/main_message_loop.cc | 6 +- tests/shared/browser/main_message_loop.h | 16 +- .../browser/main_message_loop_external_pump.h | 6 +- .../main_message_loop_external_pump_linux.cc | 28 +- .../main_message_loop_external_pump_mac.mm | 20 +- .../main_message_loop_external_pump_win.cc | 34 +- tests/shared/browser/main_message_loop_std.h | 10 +- tests/shared/browser/resource_util_mac.mm | 2 +- tests/shared/browser/resource_util_win.cc | 4 +- tests/shared/browser/util_win.cc | 8 +- tests/shared/common/client_app.h | 2 +- tests/shared/common/client_switches.cc | 3 +- tests/shared/common/client_switches.h | 3 +- tests/shared/renderer/client_app_renderer.h | 20 +- tools/automate/automate-git.py | 30 +- tools/cef_parser.py | 1 + tools/compile_ib_files.py | 4 +- tools/distrib/gtest/LICENSE | 28 + .../distrib/gtest/README.cef | 7 +- tools/distrib/gtest/gtest-all.cc | 12501 ++++++++++++++++ tools/distrib/gtest/gtest.h | 12380 +++++++++++++++ tools/distrib/linux/README.redistrib.txt | 22 +- tools/distrib/mac/README.redistrib.txt | 27 +- tools/distrib/win/README.redistrib.txt | 31 +- tools/distrib/win/x64/d3dcompiler_47.dll | Bin 4346120 -> 4891080 bytes tools/distrib/win/x86/d3dcompiler_47.dll | Bin 3657992 -> 4108752 bytes tools/file_util.py | 24 +- tools/gclient_hook.py | 11 - tools/gn_args.py | 31 +- tools/make_config_header.py | 150 +- tools/make_cpptoc_impl.py | 10 +- tools/make_ctocpp_header.py | 2 +- tools/make_ctocpp_impl.py | 7 +- tools/make_distrib.py | 52 +- tools/make_libcef_dll_dylib_impl.py | 6 +- 1533 files changed, 54391 insertions(+), 30289 deletions(-) create mode 100644 include/base/cef_atomic_flag.h delete mode 100644 include/base/cef_atomicops.h create mode 100644 include/base/cef_auto_reset.h delete mode 100644 include/base/cef_bind_helpers.h create mode 100644 include/base/cef_callback_helpers.h create mode 100644 include/base/cef_compiler_specific.h create mode 100644 include/base/cef_cxx17_backports.h delete mode 100644 include/base/cef_move.h create mode 100644 include/base/cef_ptr_util.h delete mode 100644 include/base/cef_scoped_ptr.h create mode 100644 include/base/cef_scoped_refptr.h create mode 100644 include/base/cef_scoped_typeref_mac.h delete mode 100644 include/base/internal/cef_atomicops_arm64_gcc.h delete mode 100644 include/base/internal/cef_atomicops_arm64_msvc.h delete mode 100644 include/base/internal/cef_atomicops_arm_gcc.h delete mode 100644 include/base/internal/cef_atomicops_atomicword_compat.h delete mode 100644 include/base/internal/cef_atomicops_mac.h delete mode 100644 include/base/internal/cef_atomicops_x86_gcc.h delete mode 100644 include/base/internal/cef_atomicops_x86_msvc.h delete mode 100644 include/base/internal/cef_bind_internal_win.h create mode 100644 include/base/internal/cef_scoped_block_mac.h create mode 100644 include/base/internal/cef_scoped_policy.h create mode 100644 include/capi/cef_frame_handler_capi.h rename include/capi/{cef_request_callback_capi.h => cef_i18n_util_capi.h} (70%) create mode 100644 include/capi/views/cef_overlay_controller_capi.h create mode 100644 include/cef_frame_handler.h rename include/{cef_request_callback.h => cef_i18n_util.h} (73%) create mode 100644 include/internal/cef_types_geometry.h create mode 100644 include/views/cef_overlay_controller.h create mode 100644 libcef/browser/alloy/alloy_dialog_util.cc create mode 100644 libcef/browser/alloy/alloy_dialog_util.h create mode 100644 libcef/browser/alloy/alloy_download_util.cc create mode 100644 libcef/browser/alloy/alloy_download_util.h create mode 100644 libcef/browser/browser_frame.cc create mode 100644 libcef/browser/browser_frame.h create mode 100644 libcef/browser/browser_manager.cc create mode 100644 libcef/browser/browser_manager.h delete mode 100644 libcef/browser/browser_message_filter.cc delete mode 100644 libcef/browser/browser_message_filter.h create mode 100644 libcef/browser/chrome/extensions/chrome_mime_handler_view_guest_delegate_cef.cc create mode 100644 libcef/browser/chrome/extensions/chrome_mime_handler_view_guest_delegate_cef.h create mode 100644 libcef/browser/chrome/views/chrome_views_util.cc create mode 100644 libcef/browser/chrome/views/chrome_views_util.h create mode 100644 libcef/browser/extensions/api/file_system/cef_file_system_delegate.cc create mode 100644 libcef/browser/extensions/api/file_system/cef_file_system_delegate.h delete mode 100644 libcef/browser/extensions/pdf_extension_util.cc delete mode 100644 libcef/browser/extensions/pdf_extension_util.h delete mode 100644 libcef/browser/extensions/pdf_web_contents_helper_client.cc delete mode 100644 libcef/browser/extensions/pdf_web_contents_helper_client.h create mode 100644 libcef/browser/frame_service_base.h delete mode 100644 libcef/browser/navigate_params.cc delete mode 100644 libcef/browser/navigate_params.h delete mode 100644 libcef/browser/plugins/plugin_service_filter.cc delete mode 100644 libcef/browser/plugins/plugin_service_filter.h create mode 100644 libcef/browser/views/overlay_view_host.cc create mode 100644 libcef/browser/views/overlay_view_host.h delete mode 100644 libcef/common/cef_message_generator.cc delete mode 100644 libcef/common/cef_message_generator.h delete mode 100644 libcef/common/cef_messages.cc delete mode 100644 libcef/common/cef_messages.h create mode 100644 libcef/common/i18n_util_impl.cc create mode 100644 libcef/common/mojom/BUILD.gn create mode 100644 libcef/common/mojom/cef.mojom delete mode 100644 libcef/common/net/upload_data.cc delete mode 100644 libcef/common/net/upload_data.h delete mode 100644 libcef/common/net/upload_element.cc delete mode 100644 libcef/common/net/upload_element.h delete mode 100644 libcef/common/response_manager.cc delete mode 100644 libcef/common/response_manager.h create mode 100644 libcef/common/string_util.cc create mode 100644 libcef/common/string_util.h delete mode 100644 libcef/common/widevine_loader.cc delete mode 100644 libcef/common/widevine_loader.h delete mode 100644 libcef/renderer/alloy/alloy_render_frame_observer.cc delete mode 100644 libcef/renderer/alloy/alloy_render_frame_observer.h rename libcef/renderer/{browser_manager.cc => render_manager.cc} (56%) rename libcef/renderer/{browser_manager.h => render_manager.h} (52%) delete mode 100644 libcef/renderer/render_thread_observer.cc delete mode 100644 libcef/renderer/render_thread_observer.h create mode 100644 libcef_dll/base/cef_atomic_flag.cc delete mode 100644 libcef_dll/base/cef_atomicops_x86_gcc.cc delete mode 100644 libcef_dll/base/cef_bind_helpers.cc create mode 100644 libcef_dll/base/cef_callback_helpers.cc create mode 100644 libcef_dll/cpptoc/frame_handler_cpptoc.cc create mode 100644 libcef_dll/cpptoc/frame_handler_cpptoc.h delete mode 100644 libcef_dll/cpptoc/register_cdm_callback_cpptoc.cc delete mode 100644 libcef_dll/cpptoc/register_cdm_callback_cpptoc.h delete mode 100644 libcef_dll/cpptoc/request_callback_cpptoc.cc delete mode 100644 libcef_dll/cpptoc/request_callback_cpptoc.h create mode 100644 libcef_dll/cpptoc/views/overlay_controller_cpptoc.cc create mode 100644 libcef_dll/cpptoc/views/overlay_controller_cpptoc.h create mode 100644 libcef_dll/ctocpp/frame_handler_ctocpp.cc create mode 100644 libcef_dll/ctocpp/frame_handler_ctocpp.h delete mode 100644 libcef_dll/ctocpp/register_cdm_callback_ctocpp.cc delete mode 100644 libcef_dll/ctocpp/register_cdm_callback_ctocpp.h delete mode 100644 libcef_dll/ctocpp/request_callback_ctocpp.cc delete mode 100644 libcef_dll/ctocpp/request_callback_ctocpp.h create mode 100644 libcef_dll/ctocpp/views/overlay_controller_ctocpp.cc create mode 100644 libcef_dll/ctocpp/views/overlay_controller_ctocpp.h delete mode 100644 libcef_dll/ptr_util.h create mode 100644 patch/patches/base_command_line_1872.patch delete mode 100644 patch/patches/base_string_piece_1049498.patch create mode 100644 patch/patches/blink_security_policy_1289230.patch create mode 100644 patch/patches/browser_web_ui_controller_factory.patch create mode 100644 patch/patches/chrome_browser_extensions.patch create mode 100644 patch/patches/chrome_browser_privacy_1119417.patch delete mode 100644 patch/patches/chrome_browser_sharesheet_1123388.patch create mode 100644 patch/patches/chrome_untrusted_webui_3047.patch delete mode 100644 patch/patches/chrome_widevine.patch delete mode 100644 patch/patches/ime_1610.patch create mode 100644 patch/patches/linux_blink_thread_local.patch delete mode 100644 patch/patches/linux_chrome_page_info_1099927.patch create mode 100644 patch/patches/linux_chrome_widevine_3149.patch delete mode 100644 patch/patches/linux_poll_2466.patch create mode 100644 patch/patches/linux_ui_ozone.patch create mode 100644 patch/patches/printing_pdf_3047.patch delete mode 100644 patch/patches/renderer_preferences_util_545103.patch create mode 100644 patch/patches/webkit_popups.patch delete mode 100644 patch/patches/webkit_popups_and_background.patch create mode 100644 patch/patches/win_sandbox_3210.patch delete mode 100644 tests/cefclient/browser/drm_test.cc delete mode 100644 tests/cefclient/browser/drm_test.h create mode 100644 tests/cefclient/browser/views_overlay_controls.cc create mode 100644 tests/cefclient/browser/views_overlay_controls.h delete mode 100644 tests/cefclient/resources/drm.html create mode 100644 tests/ceftests/frame_handler_unittest.cc create mode 100644 tests/ceftests/pdf_viewer_unittest.cc delete mode 100644 tests/ceftests/plugin_unittest.cc create mode 100644 tests/gtest/teamcity/README.cef create mode 100644 tests/gtest/teamcity/include/teamcity_gtest.h create mode 100644 tests/gtest/teamcity/src/teamcity_gtest.cpp create mode 100644 tests/gtest/teamcity/src/teamcity_messages.cpp create mode 100644 tests/gtest/teamcity/src/teamcity_messages.h create mode 100644 tools/distrib/gtest/LICENSE rename tests/gtest/README.cef.in => tools/distrib/gtest/README.cef (65%) create mode 100644 tools/distrib/gtest/gtest-all.cc create mode 100644 tools/distrib/gtest/gtest.h diff --git a/BUILD.gn b/BUILD.gn index 1a5a0a93..5fbf23d2 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -96,6 +96,7 @@ import("//base/allocator/allocator.gni") import("//build/config/features.gni") import("//build/config/locales.gni") +import("//build/config/ozone.gni") import("//build/config/sanitizers/sanitizers.gni") import("//build/config/ui.gni") import("//chrome/common/features.gni") @@ -108,8 +109,8 @@ import("//printing/buildflags/buildflags.gni") import("//testing/test.gni") import("//third_party/icu/config.gni") import("//third_party/widevine/cdm/widevine.gni") -import("//tools/grit/repack.gni") import("//tools/grit/grit_rule.gni") +import("//tools/grit/repack.gni") import("//tools/v8_context_snapshot/v8_context_snapshot.gni") import("//ui/gl/features.gni") import("//v8/gni/v8.gni") @@ -138,14 +139,14 @@ if (is_mac) { template("compile_ib_files") { action_foreach(target_name) { forward_variables_from(invoker, - [ - "testonly", - "visibility", - ]) + [ + "testonly", + "visibility", + ]) assert(defined(invoker.sources), - "sources must be specified for $target_name") + "sources must be specified for $target_name") assert(defined(invoker.output_extension), - "output_extension must be specified for $target_name") + "output_extension must be specified for $target_name") ibtool_flags = [] if (defined(invoker.ibtool_flags)) { @@ -208,14 +209,12 @@ if (is_mac) { bundle_data(_target_name) { forward_variables_from(invoker, - [ - "testonly", - "visibility", - ]) + [ + "testonly", + "visibility", + ]) - public_deps = [ - ":$_compile_target_name", - ] + public_deps = [ ":$_compile_target_name" ] sources = get_target_outputs(":$_compile_target_name") _output_path = "{{bundle_resources_dir}}" @@ -223,9 +222,7 @@ if (is_mac) { _output_path = invoker.output_path } - outputs = [ - "$_output_path/{{source_file_part}}", - ] + outputs = [ "$_output_path/{{source_file_part}}" ] } } } @@ -261,7 +258,6 @@ if (is_clang) { assert(!clang_use_chrome_plugins) } - # # Local variables. # @@ -269,12 +265,12 @@ if (is_clang) { if (is_mac) { # The tweak_info_plist.py script requires a version number with 4 parts. CEF # uses a version number with 3 parts so just set the last part to 0. - cef_plist_version = exec_script( - "//cef/tools/cef_version.py", [ "plist" ], "trim string", []) + cef_plist_version = + exec_script("//cef/tools/cef_version.py", [ "plist" ], "trim string", []) # Need to be creative to match dylib version formatting requirements. - cef_dylib_version = exec_script( - "//cef/tools/cef_version.py", [ "dylib" ], "trim string", []) + cef_dylib_version = + exec_script("//cef/tools/cef_version.py", [ "dylib" ], "trim string", []) } # Read file lists from gypi files. The gypi_to_gn.py script does not support @@ -306,12 +302,11 @@ group("cef") { ":libcef_static_unittests", ] - if (!is_linux || use_x11) { + if (!is_linux || ozone_platform_x11) { deps += [ ":cefclient" ] } } - # # libcef static target. # @@ -329,8 +324,8 @@ if (is_win) { # Required for crash_keys::GetChromeCrashKeys. # Otherwise we need to copy this array into CEF, which would be difficult # to maintain. - "//chrome/common/crash_keys.cc", "//chrome/common/chrome_switches.cc", + "//chrome/common/crash_keys.cc", "//components/flags_ui/flags_ui_switches.cc", "//content/public/common/content_switches.cc", ] @@ -343,7 +338,7 @@ if (is_win) { if (is_component_build) { # Avoid linker errors with content_switches.cc in component build by not # defining CONTENT_EXPORT. - defines = ["COMPILE_CONTENT_STATICALLY"] + defines = [ "COMPILE_CONTENT_STATICALLY" ] } deps = [ @@ -357,6 +352,9 @@ if (is_win) { # Required by content_switches.cc "//media:media_buildflags", + + # Required by crash_keys.cc (from base/stl_util.h) + "//third_party/abseil-cpp:absl", ] } } @@ -368,9 +366,7 @@ source_set("libcef_static_unittested") { "libcef/browser/devtools/devtools_util.h", ] - deps = [ - "//base", - ] + deps = [ "//base" ] configs += [ "libcef/features:config", @@ -380,9 +376,7 @@ source_set("libcef_static_unittested") { # Executable target for libcef_static unit tests. test("libcef_static_unittests") { - sources = [ - "libcef/browser/devtools/devtools_util_unittest.cc", - ] + sources = [ "libcef/browser/devtools/devtools_util_unittest.cc" ] deps = [ ":libcef_static_unittested", @@ -397,426 +391,410 @@ test("libcef_static_unittests") { } static_library("libcef_static") { - sources = includes_common + - gypi_paths.autogen_cpp_includes + [ - "libcef/browser/alloy/alloy_browser_context.cc", - "libcef/browser/alloy/alloy_browser_context.h", - "libcef/browser/alloy/alloy_browser_host_impl.cc", - "libcef/browser/alloy/alloy_browser_host_impl.h", - "libcef/browser/alloy/alloy_browser_main.cc", - "libcef/browser/alloy/alloy_browser_main.h", - "libcef/browser/alloy/browser_platform_delegate_alloy.cc", - "libcef/browser/alloy/browser_platform_delegate_alloy.h", - "libcef/browser/alloy/chrome_browser_process_alloy.cc", - "libcef/browser/alloy/chrome_browser_process_alloy.h", - "libcef/browser/alloy/chrome_profile_manager_alloy.cc", - "libcef/browser/alloy/chrome_profile_manager_alloy.h", - "libcef/browser/alloy/chrome_profile_alloy.cc", - "libcef/browser/alloy/chrome_profile_alloy.h", - "libcef/browser/alloy/alloy_content_browser_client.cc", - "libcef/browser/alloy/alloy_content_browser_client.h", - "libcef/browser/audio_capturer.cc", - "libcef/browser/audio_capturer.h", - "libcef/browser/audio_loopback_stream_creator.cc", - "libcef/browser/audio_loopback_stream_creator.h", - "libcef/browser/browser_contents_delegate.cc", - "libcef/browser/browser_contents_delegate.h", - "libcef/browser/browser_context.cc", - "libcef/browser/browser_context.h", - "libcef/browser/browser_context_keyed_service_factories.cc", - "libcef/browser/browser_context_keyed_service_factories.h", - "libcef/browser/browser_host_base.cc", - "libcef/browser/browser_host_base.h", - "libcef/browser/browser_host_create.cc", - "libcef/browser/browser_info.cc", - "libcef/browser/browser_info.h", - "libcef/browser/browser_info_manager.cc", - "libcef/browser/browser_info_manager.h", - "libcef/browser/browser_message_filter.cc", - "libcef/browser/browser_message_filter.h", - "libcef/browser/browser_message_loop.cc", - "libcef/browser/browser_message_loop.h", - "libcef/browser/browser_platform_delegate.cc", - "libcef/browser/browser_platform_delegate.h", - "libcef/browser/browser_platform_delegate_create.cc", - "libcef/browser/browser_util.cc", - "libcef/browser/browser_util.h", - "libcef/browser/chrome/browser_delegate.h", - "libcef/browser/chrome/browser_platform_delegate_chrome.cc", - "libcef/browser/chrome/browser_platform_delegate_chrome.h", - "libcef/browser/chrome/chrome_browser_context.cc", - "libcef/browser/chrome/chrome_browser_context.h", - "libcef/browser/chrome/chrome_browser_delegate.cc", - "libcef/browser/chrome/chrome_browser_delegate.h", - "libcef/browser/chrome/chrome_browser_host_impl.cc", - "libcef/browser/chrome/chrome_browser_host_impl.h", - "libcef/browser/chrome/chrome_browser_main_extra_parts_cef.cc", - "libcef/browser/chrome/chrome_browser_main_extra_parts_cef.h", - "libcef/browser/chrome/chrome_content_browser_client_cef.cc", - "libcef/browser/chrome/chrome_content_browser_client_cef.h", - "libcef/browser/chrome/chrome_context_menu_handler.cc", - "libcef/browser/chrome/chrome_context_menu_handler.h", - "libcef/browser/chrome_crash_reporter_client_stub.cc", - "libcef/browser/context.cc", - "libcef/browser/context.h", - "libcef/browser/context_menu_params_impl.cc", - "libcef/browser/context_menu_params_impl.h", - "libcef/browser/devtools/devtools_controller.cc", - "libcef/browser/devtools/devtools_controller.h", - "libcef/browser/devtools/devtools_file_manager.cc", - "libcef/browser/devtools/devtools_file_manager.h", - "libcef/browser/devtools/devtools_frontend.cc", - "libcef/browser/devtools/devtools_frontend.h", - "libcef/browser/devtools/devtools_manager.cc", - "libcef/browser/devtools/devtools_manager.h", - "libcef/browser/devtools/devtools_manager_delegate.cc", - "libcef/browser/devtools/devtools_manager_delegate.h", - "libcef/browser/download_item_impl.cc", - "libcef/browser/download_item_impl.h", - "libcef/browser/download_manager_delegate.cc", - "libcef/browser/download_manager_delegate.h", - "libcef/browser/extension_impl.cc", - "libcef/browser/extension_impl.h", - "libcef/browser/extensions/api/storage/sync_value_store_cache.cc", - "libcef/browser/extensions/api/storage/sync_value_store_cache.h", - "libcef/browser/extensions/api/tabs/tabs_api.cc", - "libcef/browser/extensions/api/tabs/tabs_api.h", - "libcef/browser/extensions/alloy_extensions_util.cc", - "libcef/browser/extensions/alloy_extensions_util.h", - "libcef/browser/extensions/browser_extensions_util.cc", - "libcef/browser/extensions/browser_extensions_util.h", - "libcef/browser/extensions/browser_platform_delegate_background.cc", - "libcef/browser/extensions/browser_platform_delegate_background.h", - "libcef/browser/extensions/chrome_api_registration.cc", - "libcef/browser/extensions/chrome_api_registration.h", - "libcef/browser/extensions/component_extension_resource_manager.cc", - "libcef/browser/extensions/component_extension_resource_manager.h", - "libcef/browser/extensions/extensions_api_client.cc", - "libcef/browser/extensions/extensions_api_client.h", - "libcef/browser/extensions/extensions_browser_api_provider.cc", - "libcef/browser/extensions/extensions_browser_api_provider.h", - "libcef/browser/extensions/extensions_browser_client.cc", - "libcef/browser/extensions/extensions_browser_client.h", - "libcef/browser/extensions/extension_background_host.cc", - "libcef/browser/extensions/extension_background_host.h", - "libcef/browser/extensions/extension_function_details.cc", - "libcef/browser/extensions/extension_function_details.h", - "libcef/browser/extensions/extension_host_delegate.cc", - "libcef/browser/extensions/extension_host_delegate.h", - "libcef/browser/extensions/extension_system.cc", - "libcef/browser/extensions/extension_system.h", - "libcef/browser/extensions/extension_system_factory.cc", - "libcef/browser/extensions/extension_system_factory.h", - "libcef/browser/extensions/extension_view_host.cc", - "libcef/browser/extensions/extension_view_host.h", - "libcef/browser/extensions/extension_web_contents_observer.cc", - "libcef/browser/extensions/extension_web_contents_observer.h", - "libcef/browser/extensions/mime_handler_view_guest_delegate.cc", - "libcef/browser/extensions/mime_handler_view_guest_delegate.h", - "libcef/browser/extensions/pdf_extension_util.cc", - "libcef/browser/extensions/pdf_extension_util.h", - "libcef/browser/extensions/pdf_web_contents_helper_client.cc", - "libcef/browser/extensions/pdf_web_contents_helper_client.h", - "libcef/browser/extensions/value_store/cef_value_store.cc", - "libcef/browser/extensions/value_store/cef_value_store.h", - "libcef/browser/extensions/value_store/cef_value_store_factory.cc", - "libcef/browser/extensions/value_store/cef_value_store_factory.h", - "libcef/browser/file_dialog_runner.h", - "libcef/browser/file_dialog_manager.cc", - "libcef/browser/file_dialog_manager.h", - "libcef/browser/frame_host_impl.cc", - "libcef/browser/frame_host_impl.h", - "libcef/browser/image_impl.cc", - "libcef/browser/image_impl.h", - "libcef/browser/iothread_state.cc", - "libcef/browser/iothread_state.h", - "libcef/browser/javascript_dialog_runner.h", - "libcef/browser/javascript_dialog_manager.cc", - "libcef/browser/javascript_dialog_manager.h", - "libcef/browser/main_runner.cc", - "libcef/browser/main_runner.h", - "libcef/browser/media_capture_devices_dispatcher.cc", - "libcef/browser/media_capture_devices_dispatcher.h", - "libcef/browser/media_router/media_route_impl.cc", - "libcef/browser/media_router/media_route_impl.h", - "libcef/browser/media_router/media_router_impl.cc", - "libcef/browser/media_router/media_router_impl.h", - "libcef/browser/media_router/media_router_manager.cc", - "libcef/browser/media_router/media_router_manager.h", - "libcef/browser/media_router/media_sink_impl.cc", - "libcef/browser/media_router/media_sink_impl.h", - "libcef/browser/media_router/media_source_impl.cc", - "libcef/browser/media_router/media_source_impl.h", - "libcef/browser/menu_manager.cc", - "libcef/browser/menu_manager.h", - "libcef/browser/menu_model_impl.cc", - "libcef/browser/menu_model_impl.h", - "libcef/browser/menu_runner.h", - "libcef/browser/native/browser_platform_delegate_native.cc", - "libcef/browser/native/browser_platform_delegate_native.h", - "libcef/browser/native/cursor_util.h", - "libcef/browser/native/cursor_util.cc", - "libcef/browser/navigate_params.cc", - "libcef/browser/navigate_params.h", - "libcef/browser/navigation_entry_impl.cc", - "libcef/browser/navigation_entry_impl.h", - "libcef/browser/net/chrome_scheme_handler.cc", - "libcef/browser/net/chrome_scheme_handler.h", - "libcef/browser/net/crlset_file_util_impl.cc", - "libcef/browser/net/devtools_scheme_handler.cc", - "libcef/browser/net/devtools_scheme_handler.h", - "libcef/browser/net/internal_scheme_handler.cc", - "libcef/browser/net/internal_scheme_handler.h", - "libcef/browser/net/scheme_handler.cc", - "libcef/browser/net/scheme_handler.h", - "libcef/browser/net/throttle_handler.cc", - "libcef/browser/net/throttle_handler.h", - "libcef/browser/net_service/browser_urlrequest_impl.cc", - "libcef/browser/net_service/browser_urlrequest_impl.h", - "libcef/browser/net_service/cookie_helper.cc", - "libcef/browser/net_service/cookie_helper.h", - "libcef/browser/net_service/cookie_manager_impl.cc", - "libcef/browser/net_service/cookie_manager_impl.h", - "libcef/browser/net_service/login_delegate.cc", - "libcef/browser/net_service/login_delegate.h", - "libcef/browser/net_service/proxy_url_loader_factory.cc", - "libcef/browser/net_service/proxy_url_loader_factory.h", - "libcef/browser/net_service/resource_handler_wrapper.cc", - "libcef/browser/net_service/resource_handler_wrapper.h", - "libcef/browser/net_service/resource_request_handler_wrapper.cc", - "libcef/browser/net_service/resource_request_handler_wrapper.h", - "libcef/browser/net_service/response_filter_wrapper.cc", - "libcef/browser/net_service/response_filter_wrapper.h", - "libcef/browser/net_service/stream_reader_url_loader.cc", - "libcef/browser/net_service/stream_reader_url_loader.h", - "libcef/browser/net_service/url_loader_factory_getter.cc", - "libcef/browser/net_service/url_loader_factory_getter.h", - "libcef/browser/origin_whitelist_impl.cc", - "libcef/browser/origin_whitelist_impl.h", - "libcef/browser/osr/browser_platform_delegate_osr.cc", - "libcef/browser/osr/browser_platform_delegate_osr.h", - "libcef/browser/osr/host_display_client_osr.cc", - "libcef/browser/osr/host_display_client_osr.h", - "libcef/browser/osr/motion_event_osr.cc", - "libcef/browser/osr/motion_event_osr.h", - "libcef/browser/osr/osr_accessibility_util.cc", - "libcef/browser/osr/osr_accessibility_util.h", - "libcef/browser/osr/osr_util.cc", - "libcef/browser/osr/osr_util.h", - "libcef/browser/osr/render_widget_host_view_osr.cc", - "libcef/browser/osr/render_widget_host_view_osr.h", - "libcef/browser/osr/synthetic_gesture_target_osr.cc", - "libcef/browser/osr/synthetic_gesture_target_osr.h", - "libcef/browser/osr/video_consumer_osr.cc", - "libcef/browser/osr/video_consumer_osr.h", - "libcef/browser/osr/web_contents_view_osr.cc", - "libcef/browser/osr/web_contents_view_osr.h", - "libcef/browser/path_util_impl.cc", - "libcef/browser/plugins/plugin_service_filter.cc", - "libcef/browser/plugins/plugin_service_filter.h", - "libcef/browser/prefs/browser_prefs.cc", - "libcef/browser/prefs/browser_prefs.h", - "libcef/browser/prefs/pref_store.cc", - "libcef/browser/prefs/pref_store.h", - "libcef/browser/prefs/renderer_prefs.cc", - "libcef/browser/prefs/renderer_prefs.h", - "libcef/browser/print_settings_impl.cc", - "libcef/browser/print_settings_impl.h", - "libcef/browser/printing/constrained_window_views_client.cc", - "libcef/browser/printing/constrained_window_views_client.h", - "libcef/browser/printing/print_view_manager.cc", - "libcef/browser/printing/print_view_manager.h", - "libcef/browser/process_util_impl.cc", - "libcef/browser/request_context_handler_map.cc", - "libcef/browser/request_context_handler_map.h", - "libcef/browser/request_context_impl.cc", - "libcef/browser/request_context_impl.h", - "libcef/browser/scheme_impl.cc", - "libcef/browser/server_impl.cc", - "libcef/browser/server_impl.h", - "libcef/browser/simple_menu_model_impl.cc", - "libcef/browser/simple_menu_model_impl.h", - "libcef/browser/speech_recognition_manager_delegate.cc", - "libcef/browser/speech_recognition_manager_delegate.h", - "libcef/browser/ssl_host_state_delegate.cc", - "libcef/browser/ssl_host_state_delegate.h", - "libcef/browser/ssl_info_impl.cc", - "libcef/browser/ssl_info_impl.h", - "libcef/browser/ssl_status_impl.cc", - "libcef/browser/ssl_status_impl.h", - "libcef/browser/stream_impl.cc", - "libcef/browser/stream_impl.h", - "libcef/browser/trace_impl.cc", - "libcef/browser/trace_subscriber.cc", - "libcef/browser/trace_subscriber.h", - "libcef/browser/thread_util.h", - "libcef/browser/web_contents_dialog_helper.cc", - "libcef/browser/web_contents_dialog_helper.h", - "libcef/browser/web_plugin_impl.cc", - "libcef/browser/web_plugin_impl.h", - "libcef/browser/x509_certificate_impl.cc", - "libcef/browser/x509_certificate_impl.h", - "libcef/browser/x509_cert_principal_impl.cc", - "libcef/browser/x509_cert_principal_impl.h", - "libcef/browser/xml_reader_impl.cc", - "libcef/browser/xml_reader_impl.h", - "libcef/browser/zip_reader_impl.cc", - "libcef/browser/zip_reader_impl.h", - "libcef/common/alloy/alloy_content_client.cc", - "libcef/common/alloy/alloy_content_client.h", - "libcef/common/alloy/alloy_main_delegate.cc", - "libcef/common/alloy/alloy_main_delegate.h", - "libcef/common/alloy/alloy_main_runner_delegate.cc", - "libcef/common/alloy/alloy_main_runner_delegate.h", - "libcef/common/app_manager.cc", - "libcef/common/app_manager.h", - "libcef/common/base_impl.cc", - "libcef/common/cef_message_generator.cc", - "libcef/common/cef_message_generator.h", - "libcef/common/cef_messages.cc", - "libcef/common/cef_messages.h", - "libcef/common/cef_switches.cc", - "libcef/common/cef_switches.h", - "libcef/common/chrome/chrome_content_client_cef.cc", - "libcef/common/chrome/chrome_content_client_cef.h", - "libcef/common/chrome/chrome_main_delegate_cef.cc", - "libcef/common/chrome/chrome_main_delegate_cef.h", - "libcef/common/chrome/chrome_main_runner_delegate.cc", - "libcef/common/chrome/chrome_main_runner_delegate.h", - "libcef/common/command_line_impl.cc", - "libcef/common/command_line_impl.h", - "libcef/common/crash_reporter_client.cc", - "libcef/common/crash_reporter_client.h", - "libcef/common/crash_reporting.cc", - "libcef/common/crash_reporting.h", - "libcef/common/drag_data_impl.cc", - "libcef/common/drag_data_impl.h", - "libcef/common/extensions/chrome_generated_schemas.cc", - "libcef/common/extensions/chrome_generated_schemas.h", - "libcef/common/extensions/extensions_api_provider.cc", - "libcef/common/extensions/extensions_api_provider.h", - "libcef/common/extensions/extensions_client.cc", - "libcef/common/extensions/extensions_client.h", - "libcef/common/extensions/extensions_util.cc", - "libcef/common/extensions/extensions_util.h", - "libcef/common/file_util_impl.cc", - "libcef/common/frame_util.cc", - "libcef/common/frame_util.h", - "libcef/common/json_impl.cc", - "libcef/common/main_runner_delegate.h", - "libcef/common/main_runner_handler.h", - "libcef/common/net/http_header_utils.cc", - "libcef/common/net/http_header_utils.h", - "libcef/common/net/net_resource_provider.cc", - "libcef/common/net/net_resource_provider.h", - "libcef/common/net/scheme_registration.cc", - "libcef/common/net/scheme_registration.h", - "libcef/common/net/upload_data.cc", - "libcef/common/net/upload_data.h", - "libcef/common/net/upload_element.cc", - "libcef/common/net/upload_element.h", - "libcef/common/net/url_util.cc", - "libcef/common/net/url_util.h", - "libcef/common/net_service/net_service_util.cc", - "libcef/common/net_service/net_service_util.h", - "libcef/common/parser_impl.cc", - "libcef/common/process_message_impl.cc", - "libcef/common/process_message_impl.h", - "libcef/common/request_impl.cc", - "libcef/common/request_impl.h", - "libcef/common/resource_bundle_delegate.cc", - "libcef/common/resource_bundle_delegate.h", - "libcef/common/resource_bundle_impl.cc", - "libcef/common/resource_bundle_impl.h", - "libcef/common/resource_util.cc", - "libcef/common/resource_util.h", - "libcef/common/response_impl.cc", - "libcef/common/response_impl.h", - "libcef/common/response_manager.cc", - "libcef/common/response_manager.h", - "libcef/common/scheme_registrar_impl.cc", - "libcef/common/scheme_registrar_impl.h", - "libcef/common/string_list_impl.cc", - "libcef/common/string_map_impl.cc", - "libcef/common/string_multimap_impl.cc", - "libcef/common/string_types_impl.cc", - "libcef/common/task_impl.cc", - "libcef/common/task_runner_impl.cc", - "libcef/common/task_runner_impl.h", - "libcef/common/task_runner_manager.cc", - "libcef/common/task_runner_manager.h", - "libcef/common/test/translator_test_impl.cc", - "libcef/common/thread_impl.cc", - "libcef/common/thread_impl.h", - "libcef/common/time_impl.cc", - "libcef/common/time_util.h", - "libcef/common/tracker.cc", - "libcef/common/tracker.h", - "libcef/common/urlrequest_impl.cc", - "libcef/common/value_base.cc", - "libcef/common/value_base.h", - "libcef/common/values_impl.cc", - "libcef/common/values_impl.h", - "libcef/common/waitable_event_impl.cc", - "libcef/common/waitable_event_impl.h", - "libcef/common/widevine_loader.cc", - "libcef/common/widevine_loader.h", - "libcef/features/runtime.h", - "libcef/features/runtime_checks.h", - "libcef/renderer/alloy/alloy_content_renderer_client.cc", - "libcef/renderer/alloy/alloy_content_renderer_client.h", - "libcef/renderer/alloy/alloy_render_frame_observer.cc", - "libcef/renderer/alloy/alloy_render_frame_observer.h", - "libcef/renderer/alloy/alloy_render_thread_observer.cc", - "libcef/renderer/alloy/alloy_render_thread_observer.h", - "libcef/renderer/alloy/url_loader_throttle_provider_impl.cc", - "libcef/renderer/alloy/url_loader_throttle_provider_impl.h", - "libcef/renderer/browser_impl.cc", - "libcef/renderer/browser_impl.h", - "libcef/renderer/browser_manager.cc", - "libcef/renderer/browser_manager.h", - "libcef/renderer/chrome/chrome_content_renderer_client_cef.cc", - "libcef/renderer/chrome/chrome_content_renderer_client_cef.h", - "libcef/renderer/dom_document_impl.cc", - "libcef/renderer/dom_document_impl.h", - "libcef/renderer/dom_node_impl.cc", - "libcef/renderer/dom_node_impl.h", - "libcef/renderer/extensions/extensions_dispatcher_delegate.cc", - "libcef/renderer/extensions/extensions_dispatcher_delegate.h", - "libcef/renderer/extensions/extensions_renderer_client.cc", - "libcef/renderer/extensions/extensions_renderer_client.h", - "libcef/renderer/extensions/print_render_frame_helper_delegate.cc", - "libcef/renderer/extensions/print_render_frame_helper_delegate.h", - "libcef/renderer/frame_impl.cc", - "libcef/renderer/frame_impl.h", - "libcef/renderer/render_frame_observer.cc", - "libcef/renderer/render_frame_observer.h", - "libcef/renderer/render_frame_util.cc", - "libcef/renderer/render_frame_util.h", - "libcef/renderer/render_thread_observer.cc", - "libcef/renderer/render_thread_observer.h", - "libcef/renderer/render_urlrequest_impl.cc", - "libcef/renderer/render_urlrequest_impl.h", - "libcef/renderer/thread_util.h", - "libcef/renderer/v8_impl.cc", - "libcef/renderer/v8_impl.h", + sources = includes_common + gypi_paths.autogen_cpp_includes + [ + "libcef/browser/alloy/alloy_browser_context.cc", + "libcef/browser/alloy/alloy_browser_context.h", + "libcef/browser/alloy/alloy_browser_host_impl.cc", + "libcef/browser/alloy/alloy_browser_host_impl.h", + "libcef/browser/alloy/alloy_browser_main.cc", + "libcef/browser/alloy/alloy_browser_main.h", + "libcef/browser/alloy/alloy_content_browser_client.cc", + "libcef/browser/alloy/alloy_content_browser_client.h", + "libcef/browser/alloy/alloy_dialog_util.cc", + "libcef/browser/alloy/alloy_dialog_util.h", + "libcef/browser/alloy/alloy_download_util.cc", + "libcef/browser/alloy/alloy_download_util.h", + "libcef/browser/alloy/browser_platform_delegate_alloy.cc", + "libcef/browser/alloy/browser_platform_delegate_alloy.h", + "libcef/browser/alloy/chrome_browser_process_alloy.cc", + "libcef/browser/alloy/chrome_browser_process_alloy.h", + "libcef/browser/alloy/chrome_profile_manager_alloy.cc", + "libcef/browser/alloy/chrome_profile_manager_alloy.h", + "libcef/browser/alloy/chrome_profile_alloy.cc", + "libcef/browser/alloy/chrome_profile_alloy.h", + "libcef/browser/audio_capturer.cc", + "libcef/browser/audio_capturer.h", + "libcef/browser/audio_loopback_stream_creator.cc", + "libcef/browser/audio_loopback_stream_creator.h", + "libcef/browser/browser_contents_delegate.cc", + "libcef/browser/browser_contents_delegate.h", + "libcef/browser/browser_context.cc", + "libcef/browser/browser_context.h", + "libcef/browser/browser_context_keyed_service_factories.cc", + "libcef/browser/browser_context_keyed_service_factories.h", + "libcef/browser/browser_frame.cc", + "libcef/browser/browser_frame.h", + "libcef/browser/browser_host_base.cc", + "libcef/browser/browser_host_base.h", + "libcef/browser/browser_host_create.cc", + "libcef/browser/browser_info.cc", + "libcef/browser/browser_info.h", + "libcef/browser/browser_info_manager.cc", + "libcef/browser/browser_info_manager.h", + "libcef/browser/browser_manager.cc", + "libcef/browser/browser_manager.h", + "libcef/browser/browser_message_loop.cc", + "libcef/browser/browser_message_loop.h", + "libcef/browser/browser_platform_delegate.cc", + "libcef/browser/browser_platform_delegate.h", + "libcef/browser/browser_platform_delegate_create.cc", + "libcef/browser/browser_util.cc", + "libcef/browser/browser_util.h", + "libcef/browser/chrome/browser_delegate.h", + "libcef/browser/chrome/browser_platform_delegate_chrome.cc", + "libcef/browser/chrome/browser_platform_delegate_chrome.h", + "libcef/browser/chrome/chrome_browser_context.cc", + "libcef/browser/chrome/chrome_browser_context.h", + "libcef/browser/chrome/chrome_browser_delegate.cc", + "libcef/browser/chrome/chrome_browser_delegate.h", + "libcef/browser/chrome/chrome_browser_host_impl.cc", + "libcef/browser/chrome/chrome_browser_host_impl.h", + "libcef/browser/chrome/chrome_browser_main_extra_parts_cef.cc", + "libcef/browser/chrome/chrome_browser_main_extra_parts_cef.h", + "libcef/browser/chrome/chrome_content_browser_client_cef.cc", + "libcef/browser/chrome/chrome_content_browser_client_cef.h", + "libcef/browser/chrome/chrome_context_menu_handler.cc", + "libcef/browser/chrome/chrome_context_menu_handler.h", + "libcef/browser/chrome_crash_reporter_client_stub.cc", + "libcef/browser/chrome/extensions/chrome_mime_handler_view_guest_delegate_cef.cc", + "libcef/browser/chrome/extensions/chrome_mime_handler_view_guest_delegate_cef.h", + "libcef/browser/context.cc", + "libcef/browser/context.h", + "libcef/browser/context_menu_params_impl.cc", + "libcef/browser/context_menu_params_impl.h", + "libcef/browser/devtools/devtools_controller.cc", + "libcef/browser/devtools/devtools_controller.h", + "libcef/browser/devtools/devtools_file_manager.cc", + "libcef/browser/devtools/devtools_file_manager.h", + "libcef/browser/devtools/devtools_frontend.cc", + "libcef/browser/devtools/devtools_frontend.h", + "libcef/browser/devtools/devtools_manager.cc", + "libcef/browser/devtools/devtools_manager.h", + "libcef/browser/devtools/devtools_manager_delegate.cc", + "libcef/browser/devtools/devtools_manager_delegate.h", + "libcef/browser/download_item_impl.cc", + "libcef/browser/download_item_impl.h", + "libcef/browser/download_manager_delegate.cc", + "libcef/browser/download_manager_delegate.h", + "libcef/browser/extension_impl.cc", + "libcef/browser/extension_impl.h", + "libcef/browser/extensions/api/file_system/cef_file_system_delegate.cc", + "libcef/browser/extensions/api/file_system/cef_file_system_delegate.h", + "libcef/browser/extensions/api/storage/sync_value_store_cache.cc", + "libcef/browser/extensions/api/storage/sync_value_store_cache.h", + "libcef/browser/extensions/api/tabs/tabs_api.cc", + "libcef/browser/extensions/api/tabs/tabs_api.h", + "libcef/browser/extensions/alloy_extensions_util.cc", + "libcef/browser/extensions/alloy_extensions_util.h", + "libcef/browser/extensions/browser_extensions_util.cc", + "libcef/browser/extensions/browser_extensions_util.h", + "libcef/browser/extensions/browser_platform_delegate_background.cc", + "libcef/browser/extensions/browser_platform_delegate_background.h", + "libcef/browser/extensions/chrome_api_registration.cc", + "libcef/browser/extensions/chrome_api_registration.h", + "libcef/browser/extensions/component_extension_resource_manager.cc", + "libcef/browser/extensions/component_extension_resource_manager.h", + "libcef/browser/extensions/extensions_api_client.cc", + "libcef/browser/extensions/extensions_api_client.h", + "libcef/browser/extensions/extensions_browser_api_provider.cc", + "libcef/browser/extensions/extensions_browser_api_provider.h", + "libcef/browser/extensions/extensions_browser_client.cc", + "libcef/browser/extensions/extensions_browser_client.h", + "libcef/browser/extensions/extension_background_host.cc", + "libcef/browser/extensions/extension_background_host.h", + "libcef/browser/extensions/extension_function_details.cc", + "libcef/browser/extensions/extension_function_details.h", + "libcef/browser/extensions/extension_host_delegate.cc", + "libcef/browser/extensions/extension_host_delegate.h", + "libcef/browser/extensions/extension_system.cc", + "libcef/browser/extensions/extension_system.h", + "libcef/browser/extensions/extension_system_factory.cc", + "libcef/browser/extensions/extension_system_factory.h", + "libcef/browser/extensions/extension_view_host.cc", + "libcef/browser/extensions/extension_view_host.h", + "libcef/browser/extensions/extension_web_contents_observer.cc", + "libcef/browser/extensions/extension_web_contents_observer.h", + "libcef/browser/extensions/mime_handler_view_guest_delegate.cc", + "libcef/browser/extensions/mime_handler_view_guest_delegate.h", + "libcef/browser/extensions/value_store/cef_value_store.cc", + "libcef/browser/extensions/value_store/cef_value_store.h", + "libcef/browser/extensions/value_store/cef_value_store_factory.cc", + "libcef/browser/extensions/value_store/cef_value_store_factory.h", + "libcef/browser/file_dialog_runner.h", + "libcef/browser/file_dialog_manager.cc", + "libcef/browser/file_dialog_manager.h", + "libcef/browser/frame_host_impl.cc", + "libcef/browser/frame_host_impl.h", + "libcef/browser/frame_service_base.h", + "libcef/browser/image_impl.cc", + "libcef/browser/image_impl.h", + "libcef/browser/iothread_state.cc", + "libcef/browser/iothread_state.h", + "libcef/browser/javascript_dialog_runner.h", + "libcef/browser/javascript_dialog_manager.cc", + "libcef/browser/javascript_dialog_manager.h", + "libcef/browser/main_runner.cc", + "libcef/browser/main_runner.h", + "libcef/browser/media_capture_devices_dispatcher.cc", + "libcef/browser/media_capture_devices_dispatcher.h", + "libcef/browser/media_router/media_route_impl.cc", + "libcef/browser/media_router/media_route_impl.h", + "libcef/browser/media_router/media_router_impl.cc", + "libcef/browser/media_router/media_router_impl.h", + "libcef/browser/media_router/media_router_manager.cc", + "libcef/browser/media_router/media_router_manager.h", + "libcef/browser/media_router/media_sink_impl.cc", + "libcef/browser/media_router/media_sink_impl.h", + "libcef/browser/media_router/media_source_impl.cc", + "libcef/browser/media_router/media_source_impl.h", + "libcef/browser/menu_manager.cc", + "libcef/browser/menu_manager.h", + "libcef/browser/menu_model_impl.cc", + "libcef/browser/menu_model_impl.h", + "libcef/browser/menu_runner.h", + "libcef/browser/native/browser_platform_delegate_native.cc", + "libcef/browser/native/browser_platform_delegate_native.h", + "libcef/browser/native/cursor_util.h", + "libcef/browser/native/cursor_util.cc", + "libcef/browser/navigation_entry_impl.cc", + "libcef/browser/navigation_entry_impl.h", + "libcef/browser/net/chrome_scheme_handler.cc", + "libcef/browser/net/chrome_scheme_handler.h", + "libcef/browser/net/crlset_file_util_impl.cc", + "libcef/browser/net/devtools_scheme_handler.cc", + "libcef/browser/net/devtools_scheme_handler.h", + "libcef/browser/net/internal_scheme_handler.cc", + "libcef/browser/net/internal_scheme_handler.h", + "libcef/browser/net/scheme_handler.cc", + "libcef/browser/net/scheme_handler.h", + "libcef/browser/net/throttle_handler.cc", + "libcef/browser/net/throttle_handler.h", + "libcef/browser/net_service/browser_urlrequest_impl.cc", + "libcef/browser/net_service/browser_urlrequest_impl.h", + "libcef/browser/net_service/cookie_helper.cc", + "libcef/browser/net_service/cookie_helper.h", + "libcef/browser/net_service/cookie_manager_impl.cc", + "libcef/browser/net_service/cookie_manager_impl.h", + "libcef/browser/net_service/login_delegate.cc", + "libcef/browser/net_service/login_delegate.h", + "libcef/browser/net_service/proxy_url_loader_factory.cc", + "libcef/browser/net_service/proxy_url_loader_factory.h", + "libcef/browser/net_service/resource_handler_wrapper.cc", + "libcef/browser/net_service/resource_handler_wrapper.h", + "libcef/browser/net_service/resource_request_handler_wrapper.cc", + "libcef/browser/net_service/resource_request_handler_wrapper.h", + "libcef/browser/net_service/response_filter_wrapper.cc", + "libcef/browser/net_service/response_filter_wrapper.h", + "libcef/browser/net_service/stream_reader_url_loader.cc", + "libcef/browser/net_service/stream_reader_url_loader.h", + "libcef/browser/net_service/url_loader_factory_getter.cc", + "libcef/browser/net_service/url_loader_factory_getter.h", + "libcef/browser/origin_whitelist_impl.cc", + "libcef/browser/origin_whitelist_impl.h", + "libcef/browser/osr/browser_platform_delegate_osr.cc", + "libcef/browser/osr/browser_platform_delegate_osr.h", + "libcef/browser/osr/host_display_client_osr.cc", + "libcef/browser/osr/host_display_client_osr.h", + "libcef/browser/osr/motion_event_osr.cc", + "libcef/browser/osr/motion_event_osr.h", + "libcef/browser/osr/osr_accessibility_util.cc", + "libcef/browser/osr/osr_accessibility_util.h", + "libcef/browser/osr/osr_util.cc", + "libcef/browser/osr/osr_util.h", + "libcef/browser/osr/render_widget_host_view_osr.cc", + "libcef/browser/osr/render_widget_host_view_osr.h", + "libcef/browser/osr/synthetic_gesture_target_osr.cc", + "libcef/browser/osr/synthetic_gesture_target_osr.h", + "libcef/browser/osr/video_consumer_osr.cc", + "libcef/browser/osr/video_consumer_osr.h", + "libcef/browser/osr/web_contents_view_osr.cc", + "libcef/browser/osr/web_contents_view_osr.h", + "libcef/browser/path_util_impl.cc", + "libcef/browser/prefs/browser_prefs.cc", + "libcef/browser/prefs/browser_prefs.h", + "libcef/browser/prefs/pref_store.cc", + "libcef/browser/prefs/pref_store.h", + "libcef/browser/prefs/renderer_prefs.cc", + "libcef/browser/prefs/renderer_prefs.h", + "libcef/browser/print_settings_impl.cc", + "libcef/browser/print_settings_impl.h", + "libcef/browser/printing/constrained_window_views_client.cc", + "libcef/browser/printing/constrained_window_views_client.h", + "libcef/browser/printing/print_view_manager.cc", + "libcef/browser/printing/print_view_manager.h", + "libcef/browser/process_util_impl.cc", + "libcef/browser/request_context_handler_map.cc", + "libcef/browser/request_context_handler_map.h", + "libcef/browser/request_context_impl.cc", + "libcef/browser/request_context_impl.h", + "libcef/browser/scheme_impl.cc", + "libcef/browser/server_impl.cc", + "libcef/browser/server_impl.h", + "libcef/browser/simple_menu_model_impl.cc", + "libcef/browser/simple_menu_model_impl.h", + "libcef/browser/speech_recognition_manager_delegate.cc", + "libcef/browser/speech_recognition_manager_delegate.h", + "libcef/browser/ssl_host_state_delegate.cc", + "libcef/browser/ssl_host_state_delegate.h", + "libcef/browser/ssl_info_impl.cc", + "libcef/browser/ssl_info_impl.h", + "libcef/browser/ssl_status_impl.cc", + "libcef/browser/ssl_status_impl.h", + "libcef/browser/stream_impl.cc", + "libcef/browser/stream_impl.h", + "libcef/browser/trace_impl.cc", + "libcef/browser/trace_subscriber.cc", + "libcef/browser/trace_subscriber.h", + "libcef/browser/thread_util.h", + "libcef/browser/web_contents_dialog_helper.cc", + "libcef/browser/web_contents_dialog_helper.h", + "libcef/browser/web_plugin_impl.cc", + "libcef/browser/web_plugin_impl.h", + "libcef/browser/x509_certificate_impl.cc", + "libcef/browser/x509_certificate_impl.h", + "libcef/browser/x509_cert_principal_impl.cc", + "libcef/browser/x509_cert_principal_impl.h", + "libcef/browser/xml_reader_impl.cc", + "libcef/browser/xml_reader_impl.h", + "libcef/browser/zip_reader_impl.cc", + "libcef/browser/zip_reader_impl.h", + "libcef/common/alloy/alloy_content_client.cc", + "libcef/common/alloy/alloy_content_client.h", + "libcef/common/alloy/alloy_main_delegate.cc", + "libcef/common/alloy/alloy_main_delegate.h", + "libcef/common/alloy/alloy_main_runner_delegate.cc", + "libcef/common/alloy/alloy_main_runner_delegate.h", + "libcef/common/app_manager.cc", + "libcef/common/app_manager.h", + "libcef/common/base_impl.cc", + "libcef/common/cef_switches.cc", + "libcef/common/cef_switches.h", + "libcef/common/chrome/chrome_content_client_cef.cc", + "libcef/common/chrome/chrome_content_client_cef.h", + "libcef/common/chrome/chrome_main_delegate_cef.cc", + "libcef/common/chrome/chrome_main_delegate_cef.h", + "libcef/common/chrome/chrome_main_runner_delegate.cc", + "libcef/common/chrome/chrome_main_runner_delegate.h", + "libcef/common/command_line_impl.cc", + "libcef/common/command_line_impl.h", + "libcef/common/crash_reporter_client.cc", + "libcef/common/crash_reporter_client.h", + "libcef/common/crash_reporting.cc", + "libcef/common/crash_reporting.h", + "libcef/common/drag_data_impl.cc", + "libcef/common/drag_data_impl.h", + "libcef/common/extensions/chrome_generated_schemas.cc", + "libcef/common/extensions/chrome_generated_schemas.h", + "libcef/common/extensions/extensions_api_provider.cc", + "libcef/common/extensions/extensions_api_provider.h", + "libcef/common/extensions/extensions_client.cc", + "libcef/common/extensions/extensions_client.h", + "libcef/common/extensions/extensions_util.cc", + "libcef/common/extensions/extensions_util.h", + "libcef/common/file_util_impl.cc", + "libcef/common/frame_util.cc", + "libcef/common/frame_util.h", + "libcef/common/i18n_util_impl.cc", + "libcef/common/json_impl.cc", + "libcef/common/main_runner_delegate.h", + "libcef/common/main_runner_handler.h", + "libcef/common/net/http_header_utils.cc", + "libcef/common/net/http_header_utils.h", + "libcef/common/net/net_resource_provider.cc", + "libcef/common/net/net_resource_provider.h", + "libcef/common/net/scheme_registration.cc", + "libcef/common/net/scheme_registration.h", + "libcef/common/net/url_util.cc", + "libcef/common/net/url_util.h", + "libcef/common/net_service/net_service_util.cc", + "libcef/common/net_service/net_service_util.h", + "libcef/common/parser_impl.cc", + "libcef/common/process_message_impl.cc", + "libcef/common/process_message_impl.h", + "libcef/common/request_impl.cc", + "libcef/common/request_impl.h", + "libcef/common/resource_bundle_delegate.cc", + "libcef/common/resource_bundle_delegate.h", + "libcef/common/resource_bundle_impl.cc", + "libcef/common/resource_bundle_impl.h", + "libcef/common/resource_util.cc", + "libcef/common/resource_util.h", + "libcef/common/response_impl.cc", + "libcef/common/response_impl.h", + "libcef/common/scheme_registrar_impl.cc", + "libcef/common/scheme_registrar_impl.h", + "libcef/common/string_list_impl.cc", + "libcef/common/string_map_impl.cc", + "libcef/common/string_multimap_impl.cc", + "libcef/common/string_types_impl.cc", + "libcef/common/string_util.cc", + "libcef/common/string_util.h", + "libcef/common/task_impl.cc", + "libcef/common/task_runner_impl.cc", + "libcef/common/task_runner_impl.h", + "libcef/common/task_runner_manager.cc", + "libcef/common/task_runner_manager.h", + "libcef/common/test/translator_test_impl.cc", + "libcef/common/thread_impl.cc", + "libcef/common/thread_impl.h", + "libcef/common/time_impl.cc", + "libcef/common/time_util.h", + "libcef/common/tracker.cc", + "libcef/common/tracker.h", + "libcef/common/urlrequest_impl.cc", + "libcef/common/value_base.cc", + "libcef/common/value_base.h", + "libcef/common/values_impl.cc", + "libcef/common/values_impl.h", + "libcef/common/waitable_event_impl.cc", + "libcef/common/waitable_event_impl.h", + "libcef/features/runtime.h", + "libcef/features/runtime_checks.h", + "libcef/renderer/alloy/alloy_content_renderer_client.cc", + "libcef/renderer/alloy/alloy_content_renderer_client.h", + "libcef/renderer/alloy/alloy_render_thread_observer.cc", + "libcef/renderer/alloy/alloy_render_thread_observer.h", + "libcef/renderer/alloy/url_loader_throttle_provider_impl.cc", + "libcef/renderer/alloy/url_loader_throttle_provider_impl.h", + "libcef/renderer/browser_impl.cc", + "libcef/renderer/browser_impl.h", + "libcef/renderer/chrome/chrome_content_renderer_client_cef.cc", + "libcef/renderer/chrome/chrome_content_renderer_client_cef.h", + "libcef/renderer/dom_document_impl.cc", + "libcef/renderer/dom_document_impl.h", + "libcef/renderer/dom_node_impl.cc", + "libcef/renderer/dom_node_impl.h", + "libcef/renderer/extensions/extensions_dispatcher_delegate.cc", + "libcef/renderer/extensions/extensions_dispatcher_delegate.h", + "libcef/renderer/extensions/extensions_renderer_client.cc", + "libcef/renderer/extensions/extensions_renderer_client.h", + "libcef/renderer/extensions/print_render_frame_helper_delegate.cc", + "libcef/renderer/extensions/print_render_frame_helper_delegate.h", + "libcef/renderer/frame_impl.cc", + "libcef/renderer/frame_impl.h", + "libcef/renderer/render_frame_observer.cc", + "libcef/renderer/render_frame_observer.h", + "libcef/renderer/render_frame_util.cc", + "libcef/renderer/render_frame_util.h", + "libcef/renderer/render_manager.cc", + "libcef/renderer/render_manager.h", + "libcef/renderer/render_urlrequest_impl.cc", + "libcef/renderer/render_urlrequest_impl.h", + "libcef/renderer/thread_util.h", + "libcef/renderer/v8_impl.cc", + "libcef/renderer/v8_impl.h", - # For Chrome runtime support. - "//chrome/app/chrome_main_delegate.cc", - "//chrome/app/chrome_main_delegate.h", - ] + # For Chrome runtime support. + "//chrome/app/chrome_main_delegate.cc", + "//chrome/app/chrome_main_delegate.h", + ] configs += [ "libcef/features:config", "//build/config:precompiled_headers", - - # TODO(jschuh): crbug.com/167187 fix size_t to int truncations. - "//build/config/compiler:no_size_t_to_int_warning", ] - public_configs = [ - "libcef/features:config", - ] + public_configs = [ "libcef/features:config" ] include_dirs = [ # Crashpad code uses paths relative to this directory. @@ -830,8 +808,8 @@ static_library("libcef_static") { deps = [ ":cef_make_headers", - ":libcef_static_unittested", + "libcef/common/mojom", # Generate API bindings for extensions. # TODO(cef): Enable if/when CEF exposes its own Mojo APIs. See @@ -854,6 +832,7 @@ static_library("libcef_static") { "//chrome/services/printing:lib", "//components/cdm/renderer", "//components/certificate_transparency", + "//components/component_updater", "//components/content_settings/core/browser", "//components/content_settings/core/common", "//components/crx_file", @@ -872,7 +851,6 @@ static_library("libcef_static") { "//components/printing/common", "//components/printing/renderer", "//components/proxy_config", - "//components/safe_browsing/core/db:test_database_manager", "//components/services/print_compositor/public/cpp", "//components/services/print_compositor/public/mojom", "//components/update_client", @@ -896,13 +874,12 @@ static_library("libcef_static") { "//extensions/browser", "//extensions/browser:core_api_provider", "//extensions/buildflags", - "//extensions/common/api", "//extensions/common:core_api_provider", + "//extensions/common/api", "//extensions/renderer", "//gpu", "//ipc", "//media", - "//media/blink", "//net", "//pdf", "//ppapi/buildflags", @@ -916,11 +893,11 @@ static_library("libcef_static") { "//third_party/brotli:dec", "//third_party/cld_3/src/src:cld_3", "//third_party/hunspell", + "//third_party/icu", "//third_party/leveldatabase", "//third_party/libxml:libxml", - "//third_party/widevine/cdm:headers", "//third_party/widevine/cdm", - "//third_party/icu", + "//third_party/widevine/cdm:headers", "//third_party/zlib:minizip", "//ui/base", "//ui/base/ime", @@ -936,33 +913,30 @@ static_library("libcef_static") { ] if (is_win) { - sources += includes_win + [ - "libcef/browser/alloy/alloy_browser_main_win.cc", - "libcef/browser/native/browser_platform_delegate_native_win.cc", - "libcef/browser/native/browser_platform_delegate_native_win.h", - "libcef/browser/native/cursor_util_win.cc", - "libcef/browser/native/file_dialog_runner_win.cc", - "libcef/browser/native/file_dialog_runner_win.h", - "libcef/browser/native/javascript_dialog_runner_win.cc", - "libcef/browser/native/javascript_dialog_runner_win.h", - "libcef/browser/native/menu_2.cc", - "libcef/browser/native/menu_2.h", - "libcef/browser/native/menu_runner_win.cc", - "libcef/browser/native/menu_runner_win.h", - "libcef/browser/native/menu_wrapper.h", - "libcef/browser/native/native_menu_win.cc", - "libcef/browser/native/native_menu_win.h", - "libcef/browser/osr/browser_platform_delegate_osr_win.cc", - "libcef/browser/osr/browser_platform_delegate_osr_win.h", - - # Part of //chrome/utility. - "//chrome/utility/printing_handler.cc", - "//chrome/utility/printing_handler.h", - ] + sources += + includes_win + [ + "libcef/browser/alloy/alloy_browser_main_win.cc", + "libcef/browser/native/browser_platform_delegate_native_win.cc", + "libcef/browser/native/browser_platform_delegate_native_win.h", + "libcef/browser/native/cursor_util_win.cc", + "libcef/browser/native/file_dialog_runner_win.cc", + "libcef/browser/native/file_dialog_runner_win.h", + "libcef/browser/native/javascript_dialog_runner_win.cc", + "libcef/browser/native/javascript_dialog_runner_win.h", + "libcef/browser/native/menu_2.cc", + "libcef/browser/native/menu_2.h", + "libcef/browser/native/menu_runner_win.cc", + "libcef/browser/native/menu_runner_win.h", + "libcef/browser/native/menu_wrapper.h", + "libcef/browser/native/native_menu_win.cc", + "libcef/browser/native/native_menu_win.h", + "libcef/browser/osr/browser_platform_delegate_osr_win.cc", + "libcef/browser/osr/browser_platform_delegate_osr_win.h", + ] deps += [ - "//chrome/install_static:secondary_module", "//chrome/chrome_elf", + "//chrome/install_static:secondary_module", ] if (is_component_build) { @@ -971,29 +945,29 @@ static_library("libcef_static") { libs = [ "comctl32.lib", + # For D3D11_DECODER_PROFILE_H264_VLD_NOFGT. "dxguid.lib", ] - data_deps = [ - "//chrome/elevation_service", - ] + data_deps = [ "//chrome/elevation_service" ] } if (is_linux) { - sources += includes_linux + [ - "libcef/browser/native/browser_platform_delegate_native_linux.cc", - "libcef/browser/native/browser_platform_delegate_native_linux.h", - "libcef/browser/native/cursor_util_linux.cc", - "libcef/browser/native/menu_runner_linux.cc", - "libcef/browser/native/menu_runner_linux.h", - "libcef/browser/osr/browser_platform_delegate_osr_linux.cc", - "libcef/browser/osr/browser_platform_delegate_osr_linux.h", - "libcef/browser/printing/print_dialog_linux.cc", - "libcef/browser/printing/print_dialog_linux.h", - ] + sources += + includes_linux + [ + "libcef/browser/native/browser_platform_delegate_native_linux.cc", + "libcef/browser/native/browser_platform_delegate_native_linux.h", + "libcef/browser/native/cursor_util_linux.cc", + "libcef/browser/native/menu_runner_linux.cc", + "libcef/browser/native/menu_runner_linux.h", + "libcef/browser/osr/browser_platform_delegate_osr_linux.cc", + "libcef/browser/osr/browser_platform_delegate_osr_linux.h", + "libcef/browser/printing/print_dialog_linux.cc", + "libcef/browser/printing/print_dialog_linux.h", + ] - if (use_x11) { + if (ozone_platform_x11) { sources += [ "libcef/browser/native/window_x11.cc", "libcef/browser/native/window_x11.h", @@ -1005,39 +979,38 @@ static_library("libcef_static") { "//third_party/fontconfig", ] - if (is_linux && !use_x11) { - deps += [ - "//third_party/angle:libEGL", - ] + if (is_linux && !ozone_platform_x11) { + deps += [ "//third_party/angle:libEGL" ] } } if (is_mac) { - sources += includes_mac + [ - "libcef/browser/native/browser_platform_delegate_native_mac.h", - "libcef/browser/native/browser_platform_delegate_native_mac.mm", - "libcef/browser/native/file_dialog_runner_mac.h", - "libcef/browser/native/file_dialog_runner_mac.mm", - "libcef/browser/native/javascript_dialog_runner_mac.h", - "libcef/browser/native/javascript_dialog_runner_mac.mm", - "libcef/browser/native/menu_runner_mac.h", - "libcef/browser/native/menu_runner_mac.mm", - "libcef/browser/osr/browser_platform_delegate_osr_mac.h", - "libcef/browser/osr/browser_platform_delegate_osr_mac.mm", - "libcef/common/util_mac.h", - "libcef/common/util_mac.mm", + sources += + includes_mac + [ + "libcef/browser/native/browser_platform_delegate_native_mac.h", + "libcef/browser/native/browser_platform_delegate_native_mac.mm", + "libcef/browser/native/file_dialog_runner_mac.h", + "libcef/browser/native/file_dialog_runner_mac.mm", + "libcef/browser/native/javascript_dialog_runner_mac.h", + "libcef/browser/native/javascript_dialog_runner_mac.mm", + "libcef/browser/native/menu_runner_mac.h", + "libcef/browser/native/menu_runner_mac.mm", + "libcef/browser/osr/browser_platform_delegate_osr_mac.h", + "libcef/browser/osr/browser_platform_delegate_osr_mac.mm", + "libcef/common/util_mac.h", + "libcef/common/util_mac.mm", - # For Chrome runtime support. - "//chrome/app/chrome_main_mac.h", - "//chrome/app/chrome_main_mac.mm", - ] + # For Chrome runtime support. + "//chrome/app/chrome_main_mac.h", + "//chrome/app/chrome_main_mac.mm", + ] } if (is_win || is_mac) { deps += [ "//third_party/crashpad/crashpad/handler" ] } - if (use_x11) { + if (ozone_platform_x11) { deps += [ "//ui/events/devices/x11" ] } @@ -1048,8 +1021,8 @@ static_library("libcef_static") { ] deps += [ - "//components/crash/core/app", "//components/crash/content/browser", + "//components/crash/core/app", ] } @@ -1065,6 +1038,8 @@ static_library("libcef_static") { "libcef/browser/chrome/views/chrome_browser_frame.h", "libcef/browser/chrome/views/chrome_browser_view.cc", "libcef/browser/chrome/views/chrome_browser_view.h", + "libcef/browser/chrome/views/chrome_views_util.cc", + "libcef/browser/chrome/views/chrome_views_util.h", "libcef/browser/chrome/views/toolbar_view_impl.cc", "libcef/browser/chrome/views/toolbar_view_impl.h", "libcef/browser/chrome/views/toolbar_view_view.cc", @@ -1095,9 +1070,9 @@ static_library("libcef_static") { "libcef/browser/views/fill_layout_impl.h", "libcef/browser/views/label_button_impl.h", "libcef/browser/views/label_button_view.h", - "libcef/browser/views/layout_impl.h", "libcef/browser/views/layout_adapter.cc", "libcef/browser/views/layout_adapter.h", + "libcef/browser/views/layout_impl.h", "libcef/browser/views/layout_util.cc", "libcef/browser/views/layout_util.h", "libcef/browser/views/menu_button_impl.cc", @@ -1106,6 +1081,8 @@ static_library("libcef_static") { "libcef/browser/views/menu_button_view.h", "libcef/browser/views/menu_runner_views.cc", "libcef/browser/views/menu_runner_views.h", + "libcef/browser/views/overlay_view_host.cc", + "libcef/browser/views/overlay_view_host.h", "libcef/browser/views/panel_impl.h", "libcef/browser/views/panel_view.h", "libcef/browser/views/scroll_view_impl.cc", @@ -1155,8 +1132,8 @@ static_library("libcef_static") { # Support for UI input events. # Part of //ui/base:test_support which is testingonly. - "//ui/base/test/ui_controls_aura.cc", "//ui/aura/test/ui_controls_factory_aura.h", + "//ui/base/test/ui_controls_aura.cc", ] deps += [ @@ -1173,8 +1150,10 @@ static_library("libcef_static") { "//base/test/test_switches.h", "//base/test/test_timeouts.cc", "//base/test/test_timeouts.h", + # Part of //ui/aura:test_support which is testingonly. "//ui/aura/test/ui_controls_factory_aurawin.cc", + # Part of //ui/base:test_support which is testingonly. "//ui/base/test/ui_controls_internal_win.cc", "//ui/base/test/ui_controls_internal_win.h", @@ -1185,32 +1164,50 @@ static_library("libcef_static") { sources += [ # Support for UI input events. # Part of //ui/aura:test_support which is testingonly. + "$root_gen_dir/ui/ozone/test_constructor_list.cc", "//ui/aura/test/aura_test_utils.cc", "//ui/aura/test/aura_test_utils.h", + # Part of //ui/events:test_support which is testingonly. "//ui/events/test/x11_event_waiter.cc", "//ui/events/test/x11_event_waiter.h", + + # Part of //ui/ozone::ui_test_support which is testingonly. + "//ui/ozone/common/test/stub_ozone_ui_controls_test_helper.cc", + "//ui/ozone/common/test/stub_ozone_ui_controls_test_helper.h", + "//ui/ozone/public/ozone_ui_controls_test_helper.cc", + "//ui/ozone/public/ozone_ui_controls_test_helper.h", + + # Part of //ui/views:test_support which is testingonly. + "//ui/views/test/test_desktop_screen_ozone.cc", + "//ui/views/test/test_desktop_screen_ozone.h", + "//ui/views/test/ui_controls_factory_desktop_aura_ozone.cc", + "//ui/views/test/ui_controls_factory_desktop_aura_ozone.h", ] - if (use_x11) { + deps += [ "//ui/ozone:generate_test_support_constructor_list" ] + + if (ozone_platform_x11) { sources += [ + # Part of //ui/aura:test_support which is testingonly. # Support for UI input events. # Part of //ui/base/x:test_support which is testingonly. + "//ui/aura/test/x11_event_sender.h", "//ui/base/x/test/x11_ui_controls_test_helper.cc", "//ui/base/x/test/x11_ui_controls_test_helper.h", - # Part of //ui/aura:test_support which is testingonly. - "//ui/aura/test/x11_event_sender.h", - # Part of //ui/views:test_support which is testingonly. - "//ui/views/test/ui_controls_factory_desktop_aurax11.cc", - "//ui/views/test/ui_controls_factory_desktop_aurax11.h", + + # Part of //ui/ozone/platform/x11:test_support which is testingonly. + "//ui/ozone/platform/x11/x11_ozone_ui_controls_test_helper.cc", + "//ui/ozone/platform/x11/x11_ozone_ui_controls_test_helper.h", ] } else { sources += [ # Support for UI input events. # Part of //ui/base:test_support which is testingonly. "//ui/aura/test/ui_controls_factory_ozone.cc", + # Part of //ui//events:test_support which is testingonly. - "//ui/events/test/events_test_utils.cc" + "//ui/events/test/events_test_utils.cc", ] } } @@ -1227,6 +1224,7 @@ static_library("libcef_static") { # Support for UI input events. # Part of //ui/base:test_support which is testingonly. "//ui/base/test/ui_controls_mac.mm", + # Part of //ui//events:test_support which is testingonly. "//ui/events/test/cocoa_test_event_utils.mm", ] @@ -1239,29 +1237,39 @@ static_library("libcef_static") { } } - # # libcef_dll_wrapper static targets. # +# Configuration that will be applied to all targets that build autogen files. +config("libcef_autogen_config") { + if (is_clang) { + cflags = [ + # Disable clang warnings related to CEF's translation layer templates. + "-Wno-undefined-var-template", + ] + } +} + # Configuration that will be applied to all targets that depend on # libcef_dll_wrapper. config("libcef_dll_wrapper_config") { include_dirs = [ # CEF sources use include paths relative to the CEF root directory. ".", + # CEF generates some header files that also need to be discoverable. # They will be copied to the include/ directory in the binary distribution. "$root_out_dir/includes", ] + + configs = [ ":libcef_autogen_config" ] } # libcef_dll_wrapper target. static_library("libcef_dll_wrapper") { - sources = includes_common + - gypi_paths.autogen_cpp_includes + - gypi_paths2.includes_capi + - gypi_paths.autogen_capi_includes + + sources = includes_common + gypi_paths.autogen_cpp_includes + + gypi_paths2.includes_capi + gypi_paths.autogen_capi_includes + gypi_paths2.includes_wrapper + gypi_paths2.libcef_dll_wrapper_sources_base + gypi_paths2.libcef_dll_wrapper_sources_common + @@ -1275,8 +1283,9 @@ static_library("libcef_dll_wrapper") { configs += [ ":libcef_dll_wrapper_config" ] public_configs = [ ":libcef_dll_wrapper_config" ] -} + deps = [ ":cef_make_headers" ] +} # # cef_sandbox target. @@ -1285,20 +1294,25 @@ static_library("libcef_dll_wrapper") { if (is_win) { static_library("cef_sandbox") { sources = [ "libcef_dll/sandbox/sandbox_win.cc" ] + # CEF sources use include paths relative to the CEF root directory. include_dirs = [ "." ] - deps = [ "libcef/features", "//sandbox" ] + deps = [ + "libcef/features", + "//sandbox", + ] } } if (is_mac) { static_library("cef_sandbox") { sources = [ "libcef_dll/sandbox/sandbox_mac.mm" ] + # CEF sources use include paths relative to the CEF root directory. include_dirs = [ "." ] deps = [ "//build/config:executable_deps", - "//sandbox/mac:seatbelt" + "//sandbox/mac:seatbelt", ] } } @@ -1310,9 +1324,7 @@ if (is_mac) { # Included in locales/*.pak via //chrome/chrome_repack_locales.gni. grit("cef_strings") { source = "libcef/resources/cef_strings.grd" - outputs = [ - "grit/cef_strings.h", - ] + outputs = [ "grit/cef_strings.h" ] all_locales = locales + [ "fake-bidi" ] foreach(locale, all_locales) { outputs += [ "cef_strings_${locale}.pak" ] @@ -1361,6 +1373,7 @@ make_pack_header("resources") { "$root_gen_dir/chrome/grit/common_resources.h", "$root_gen_dir/chrome/grit/component_extension_resources.h", "$root_gen_dir/chrome/grit/dev_ui_browser_resources.h", + "$root_gen_dir/chrome/grit/pdf_resources.h", "$root_gen_dir/chrome/grit/renderer_resources.h", "$root_gen_dir/components/grit/components_resources.h", "$root_gen_dir/components/grit/dev_ui_components_resources.h", @@ -1386,15 +1399,16 @@ make_pack_header("resources") { "//chrome/browser:dev_ui_browser_resources", "//chrome/browser:resources", "//chrome/browser/resources:component_extension_resources", + "//chrome/browser/resources/pdf:resources", "//chrome/common:resources", "//chrome/renderer:resources", "//components/resources:components_resources", "//components/resources:dev_ui_components_resources", + "//content:content_resources", + "//content:dev_ui_content_resources", "//content/browser/devtools:devtools_resources", "//content/browser/tracing:resources", "//content/browser/webrtc/resources", - "//content:content_resources", - "//content:dev_ui_content_resources", "//extensions:extensions_browser_resources", "//extensions:extensions_renderer_resources", "//extensions:extensions_resources_grd", @@ -1426,6 +1440,7 @@ make_pack_header("strings") { "$root_gen_dir/components/strings/grit/components_strings.h", "$root_gen_dir/extensions/strings/grit/extensions_strings.h", "$root_gen_dir/services/strings/grit/services_strings.h", + "$root_gen_dir/third_party/blink/public/strings/grit/blink_accessibility_strings.h", "$root_gen_dir/third_party/blink/public/strings/grit/blink_strings.h", "$root_gen_dir/ui/strings/grit/ui_strings.h", ] @@ -1443,6 +1458,7 @@ make_pack_header("strings") { "//extensions/strings", "//services/strings", "//third_party/blink/public/strings", + "//third_party/blink/public/strings:accessibility_strings", "//ui/strings:app_locale_settings", "//ui/strings:ui_strings", ] @@ -1453,28 +1469,34 @@ action("make_api_hash_header") { script = "tools/make_api_hash_header.py" # List of all C API files that will be checked for changes by cef_api_hash.py. - inputs = gypi_paths2.includes_common_capi + - gypi_paths2.includes_linux_capi + - gypi_paths2.includes_mac_capi + - gypi_paths2.includes_win_capi + - gypi_paths2.includes_capi + - gypi_paths.autogen_capi_includes + inputs = gypi_paths2.includes_common_capi + gypi_paths2.includes_linux_capi + + gypi_paths2.includes_mac_capi + gypi_paths2.includes_win_capi + + gypi_paths2.includes_capi + gypi_paths.autogen_capi_includes include_dir = [ "include" ] outputs = [ "$root_out_dir/includes/include/cef_api_hash.h" ] args = rebase_path(outputs + include_dir, root_build_dir) } +# Generate cef_config.h. +action("make_config_header") { + script = "tools/make_config_header.py" + + outputs = [ "$root_out_dir/includes/include/cef_config.h" ] + + args = rebase_path(outputs + [ "$root_out_dir/args.gn" ], root_build_dir) +} + # Generate pack files and associated CEF header files. group("cef_make_headers") { deps = [ + ":make_api_hash_header", + ":make_config_header", ":make_pack_header_resources", ":make_pack_header_strings", - ":make_api_hash_header", ] } - # # libcef dll/framework target. # @@ -1501,13 +1523,11 @@ if (is_mac) { if (icu_use_data_file) { sources += [ "$root_out_dir/icudtl.dat" ] - public_deps += [ "//third_party/icu:icudata", ] + public_deps += [ "//third_party/icu:icudata" ] } if (v8_use_external_startup_data) { - sources += [ - "$root_out_dir/snapshot_blob.bin", - ] + sources += [ "$root_out_dir/snapshot_blob.bin" ] public_deps += [ "//v8" ] if (use_v8_context_snapshot) { sources += [ "$root_out_dir/$v8_context_snapshot_filename" ] @@ -1515,9 +1535,7 @@ if (is_mac) { } } - outputs = [ - "{{bundle_resources_dir}}/{{source_file_part}}", - ] + outputs = [ "{{bundle_resources_dir}}/{{source_file_part}}" ] } if (use_egl) { @@ -1527,12 +1545,8 @@ if (is_mac) { "$root_out_dir/egl_intermediates/libEGL.dylib", "$root_out_dir/egl_intermediates/libGLESv2.dylib", ] - outputs = [ - "{{bundle_contents_dir}}/Libraries/{{source_file_part}}", - ] - public_deps = [ - "//ui/gl:angle_library_copy", - ] + outputs = [ "{{bundle_contents_dir}}/Libraries/{{source_file_part}}" ] + public_deps = [ "//ui/gl:angle_library_copy" ] } # Add the SwiftShader .dylibs in the MODULE_DIR of the Framework app bundle. @@ -1543,9 +1557,7 @@ if (is_mac) { "$root_out_dir/vk_intermediates/libvk_swiftshader.dylib", "$root_out_dir/vk_intermediates/vk_swiftshader_icd.json", ] - outputs = [ - "{{bundle_contents_dir}}/Libraries/{{source_file_part}}", - ] + outputs = [ "{{bundle_contents_dir}}/Libraries/{{source_file_part}}" ] public_deps = [ "//ui/gl:swiftshader_egl_library_copy", "//ui/gl:swiftshader_vk_library_copy", @@ -1555,17 +1567,13 @@ if (is_mac) { group("cef_framework_angle_library") { if (use_egl) { - deps = [ - ":cef_framework_angle_binaries", - ] + deps = [ ":cef_framework_angle_binaries" ] } } group("cef_framework_swiftshader_library") { if (use_egl) { - deps = [ - ":cef_framework_swiftshader_binaries", - ] + deps = [ ":cef_framework_swiftshader_binaries" ] } } @@ -1578,13 +1586,10 @@ if (is_mac) { "Resources", ] - sources = includes_common + - includes_mac + - gypi_paths.autogen_cpp_includes + - gypi_paths2.includes_capi + - gypi_paths.autogen_capi_includes + - gypi_paths2.libcef_sources_common + - gypi_paths.autogen_library_side + sources = + includes_common + includes_mac + gypi_paths.autogen_cpp_includes + + gypi_paths2.includes_capi + gypi_paths.autogen_capi_includes + + gypi_paths2.libcef_sources_common + gypi_paths.autogen_library_side deps = [ ":cef_framework_angle_library", @@ -1593,6 +1598,8 @@ if (is_mac) { ":libcef_static", ] + configs += [ ":libcef_autogen_config" ] + # We don't link the framework so just use the path from the main executable. ldflags = [ "-Wl,-install_name,@executable_path/../Frameworks/$output_name.framework/$output_name", @@ -1617,23 +1624,19 @@ if (is_mac) { } } else { shared_library("libcef") { - sources = includes_common + - gypi_paths.autogen_cpp_includes + - gypi_paths2.includes_capi + - gypi_paths.autogen_capi_includes + - gypi_paths2.libcef_sources_common + - gypi_paths.autogen_library_side + sources = + includes_common + gypi_paths.autogen_cpp_includes + + gypi_paths2.includes_capi + gypi_paths.autogen_capi_includes + + gypi_paths2.libcef_sources_common + gypi_paths.autogen_library_side - deps = [ - ":libcef_static", - ] + deps = [ ":libcef_static" ] + + configs += [ ":libcef_autogen_config" ] if (is_win) { - sources += includes_win + [ - "libcef_dll/libcef_dll.rc", - ] + sources += includes_win + [ "libcef_dll/libcef_dll.rc" ] - deps += [ + deps += [ # Bring in ui_unscaled_resources.rc which contains custom cursors. # TODO(cef): Remove this once custom cursors can be loaded via # ResourceBundle. See crbug.com/147663. @@ -1641,7 +1644,7 @@ if (is_mac) { ] } - if (is_linux && !is_debug && use_allocator=="none") { + if (is_linux && !is_debug && use_allocator == "none") { # Only export necessary symbols from libcef.so. # Don't do this in Debug builds because it causes the resulting # application to crash. @@ -1653,11 +1656,31 @@ if (is_mac) { } } - # # Executable/app targets. # +# Source files for TeamCity GTest integration. +# See tests/gtest/teamcity/README.cef for details. +source_set("gtest_teamcity") { + testonly = true + + sources = [ + "tests/gtest/teamcity/include/teamcity_gtest.h", + "tests/gtest/teamcity/src/teamcity_gtest.cpp", + "tests/gtest/teamcity/src/teamcity_gtest.h", + "tests/gtest/teamcity/src/teamcity_messages.cpp", + "tests/gtest/teamcity/src/teamcity_messages.h", + ] + + deps = [ "//testing/gtest" ] + + configs += [ + "libcef/features:config", + "//build/config:precompiled_headers", + ] +} + if (is_mac) { # Helper for generating the CEF app bundle. template("cef_app") { @@ -1693,9 +1716,8 @@ if (is_mac) { sources = invoker.helper_sources - extra_substitutions = [ - "BUNDLE_ID_SUFFIX=${invoker.helper_bundle_id_suffix}", - ] + extra_substitutions = + [ "BUNDLE_ID_SUFFIX=${invoker.helper_bundle_id_suffix}" ] deps = [ ":cef_make_headers", @@ -1710,11 +1732,15 @@ if (is_mac) { # The helper is in $app_name.app/Contents/Frameworks/$app_name Helper.app/Contents/MacOS/ # so set rpath up to the base. "-rpath", - "@executable_path/../../../../../..", + "@executable_path/../../../../../..", ] info_plist_target = ":${app_name}_helper_plist" + if (defined(invoker.helper_frameworks)) { + frameworks = invoker.helper_frameworks + } + if (defined(invoker.helper_defines)) { defines = invoker.helper_defines } @@ -1730,6 +1756,9 @@ if (is_mac) { if (defined(invoker.helper_deps)) { helper_deps = invoker.helper_deps } + if (defined(invoker.helper_frameworks)) { + helper_frameworks = invoker.helper_frameworks + } if (defined(invoker.helper_defines)) { helper_defines = invoker.helper_defines } @@ -1741,24 +1770,16 @@ if (is_mac) { bundle_data("${app_name}_framework_bundle_data") { testonly = app_testonly - sources = [ - "$root_out_dir/$cef_framework_name.framework", - ] + sources = [ "$root_out_dir/$cef_framework_name.framework" ] - public_deps = [ - ":cef_framework", - ] + public_deps = [ ":cef_framework" ] foreach(helper_params, content_mac_helpers) { - sources += [ - "$root_out_dir/${app_helper_name}${helper_params[2]}.app", - ] + sources += [ "$root_out_dir/${app_helper_name}${helper_params[2]}.app" ] public_deps += [ ":${app_name}_helper_app_${helper_params[0]}" ] } - outputs = [ - "{{bundle_contents_dir}}/Frameworks/{{source_file_part}}", - ] + outputs = [ "{{bundle_contents_dir}}/Frameworks/{{source_file_part}}" ] } tweak_info_plist("${app_name}_plist") { @@ -1779,9 +1800,9 @@ if (is_mac) { public_deps = [ ":libcef_dll_wrapper" ] deps = [ + ":${app_name}_framework_bundle_data", ":cef_make_headers", ":libcef_dll_wrapper", - ":${app_name}_framework_bundle_data", ] if (defined(invoker.deps)) { deps += invoker.deps @@ -1799,20 +1820,16 @@ if (is_mac) { } } - # # cefclient app targets. # bundle_data("cefclient_resources_bundle_data") { sources = gypi_paths2.shared_sources_resources + - gypi_paths2.cefclient_sources_resources + [ - "tests/cefclient/resources/mac/cefclient.icns", - ] + gypi_paths2.cefclient_sources_resources + + [ "tests/cefclient/resources/mac/cefclient.icns" ] - outputs = [ - "{{bundle_resources_dir}}/{{source_file_part}}", - ] + outputs = [ "{{bundle_resources_dir}}/{{source_file_part}}" ] } bundle_data("cefclient_resources_bundle_data_extensions_set_page_color") { @@ -1823,156 +1840,111 @@ if (is_mac) { } bundle_data("cefclient_resources_bundle_data_english") { - sources = [ - "tests/cefclient/resources/mac/English.lproj/InfoPlist.strings", - ] + sources = + [ "tests/cefclient/resources/mac/English.lproj/InfoPlist.strings" ] - outputs = [ - "{{bundle_resources_dir}}/English.lproj/{{source_file_part}}", - ] + outputs = [ "{{bundle_resources_dir}}/English.lproj/{{source_file_part}}" ] } mac_xib_bundle_data("cefclient_xibs") { - sources = [ - "tests/cefclient/resources/mac/English.lproj/MainMenu.xib", - ] + sources = [ "tests/cefclient/resources/mac/English.lproj/MainMenu.xib" ] output_path = "{{bundle_resources_dir}}/English.lproj" } cef_app("cefclient") { helper_info_plist = "tests/cefclient/resources/mac/helper-Info.plist" - helper_sources = includes_common + - includes_mac + - 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 + - gypi_paths2.cefclient_sources_common + - gypi_paths2.cefclient_sources_renderer - helper_defines = [ - "CEF_USE_SANDBOX", - ] + helper_sources = + includes_common + includes_mac + 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 + + gypi_paths2.cefclient_sources_common + + gypi_paths2.cefclient_sources_renderer + helper_defines = [ "CEF_USE_SANDBOX" ] info_plist = "tests/cefclient/resources/mac/Info.plist" - sources = includes_common + - includes_mac + - gypi_paths2.includes_wrapper + - gypi_paths2.includes_wrapper_mac + - gypi_paths2.shared_sources_browser + - gypi_paths2.shared_sources_common + - gypi_paths2.shared_sources_mac + - gypi_paths2.cefclient_sources_browser + - gypi_paths2.cefclient_sources_common + - gypi_paths2.cefclient_sources_mac + sources = + includes_common + includes_mac + gypi_paths2.includes_wrapper + + gypi_paths2.includes_wrapper_mac + gypi_paths2.shared_sources_browser + + gypi_paths2.shared_sources_common + gypi_paths2.shared_sources_mac + + gypi_paths2.cefclient_sources_browser + + gypi_paths2.cefclient_sources_common + gypi_paths2.cefclient_sources_mac deps = [ ":cefclient_resources_bundle_data", - ":cefclient_resources_bundle_data_extensions_set_page_color", ":cefclient_resources_bundle_data_english", + ":cefclient_resources_bundle_data_extensions_set_page_color", ":cefclient_xibs", ] frameworks = [ "AppKit.framework", "OpenGL.framework", ] - defines = [ - "CEF_USE_SANDBOX", - ] + defines = [ "CEF_USE_SANDBOX" ] } - # # cefsimple app targets. # bundle_data("cefsimple_resources_bundle_data") { - sources = [ - "tests/cefsimple/mac/cefsimple.icns", - ] + sources = [ "tests/cefsimple/mac/cefsimple.icns" ] - outputs = [ - "{{bundle_resources_dir}}/{{source_file_part}}", - ] + outputs = [ "{{bundle_resources_dir}}/{{source_file_part}}" ] } bundle_data("cefsimple_resources_bundle_data_english") { - sources = [ - "tests/cefsimple/mac/English.lproj/InfoPlist.strings", - ] + sources = [ "tests/cefsimple/mac/English.lproj/InfoPlist.strings" ] - outputs = [ - "{{bundle_resources_dir}}/English.lproj/{{source_file_part}}", - ] + outputs = [ "{{bundle_resources_dir}}/English.lproj/{{source_file_part}}" ] } mac_xib_bundle_data("cefsimple_xibs") { - sources = [ - "tests/cefsimple/mac/English.lproj/MainMenu.xib", - ] + sources = [ "tests/cefsimple/mac/English.lproj/MainMenu.xib" ] output_path = "{{bundle_resources_dir}}/English.lproj" } cef_app("cefsimple") { helper_info_plist = "tests/cefsimple/mac/helper-Info.plist" - helper_sources = includes_common + - includes_mac + - gypi_paths2.includes_wrapper + - gypi_paths2.includes_wrapper_mac + - gypi_paths2.cefsimple_sources_mac_helper - helper_defines = [ - "CEF_USE_SANDBOX", - ] + helper_sources = + includes_common + includes_mac + gypi_paths2.includes_wrapper + + gypi_paths2.includes_wrapper_mac + + gypi_paths2.cefsimple_sources_mac_helper + helper_defines = [ "CEF_USE_SANDBOX" ] info_plist = "tests/cefsimple/mac/Info.plist" - sources = includes_common + - includes_mac + - gypi_paths2.includes_wrapper + - gypi_paths2.includes_wrapper_mac + - gypi_paths2.cefsimple_sources_common + - gypi_paths2.cefsimple_sources_mac + sources = + includes_common + includes_mac + gypi_paths2.includes_wrapper + + gypi_paths2.includes_wrapper_mac + + gypi_paths2.cefsimple_sources_common + gypi_paths2.cefsimple_sources_mac deps = [ ":cefsimple_resources_bundle_data", ":cefsimple_resources_bundle_data_english", ":cefsimple_xibs", ] - frameworks = [ - "AppKit.framework", - ] - defines = [ - "CEF_USE_SANDBOX", - ] + frameworks = [ "AppKit.framework" ] + defines = [ "CEF_USE_SANDBOX" ] } - # # ceftests app targets. # bundle_data("ceftests_resources_bundle_data") { - sources = gypi_paths2.shared_sources_resources + [ - "tests/ceftests/resources/mac/ceftests.icns", - ] + sources = gypi_paths2.shared_sources_resources + + [ "tests/ceftests/resources/mac/ceftests.icns" ] - outputs = [ - "{{bundle_resources_dir}}/{{source_file_part}}", - ] + outputs = [ "{{bundle_resources_dir}}/{{source_file_part}}" ] } bundle_data("ceftests_resources_bundle_data_english") { - sources = [ - "tests/ceftests/resources/mac/English.lproj/InfoPlist.strings", - ] + sources = [ "tests/ceftests/resources/mac/English.lproj/InfoPlist.strings" ] - outputs = [ - "{{bundle_resources_dir}}/English.lproj/{{source_file_part}}", - ] + outputs = [ "{{bundle_resources_dir}}/English.lproj/{{source_file_part}}" ] } mac_xib_bundle_data("ceftests_xibs") { - sources = [ - "tests/ceftests/resources/mac/English.lproj/MainMenu.xib", - ] + sources = [ "tests/ceftests/resources/mac/English.lproj/MainMenu.xib" ] output_path = "{{bundle_resources_dir}}/English.lproj" } @@ -1985,34 +1957,27 @@ if (is_mac) { gypi_paths2.shared_sources_mac_helper + gypi_paths2.ceftests_sources_mac_helper helper_deps = [ + ":gtest_teamcity", "//testing/gtest", ] - helper_defines = [ - "CEF_USE_SANDBOX", - ] + helper_frameworks = [ "AppKit.framework" ] + helper_defines = [ "CEF_USE_SANDBOX" ] info_plist = "tests/ceftests/resources/mac/Info.plist" - sources = includes_common + - includes_mac + - gypi_paths2.includes_wrapper + - gypi_paths2.includes_wrapper_mac + - gypi_paths2.shared_sources_browser + - gypi_paths2.shared_sources_common + - gypi_paths2.shared_sources_mac + - gypi_paths2.ceftests_sources_common + - gypi_paths2.ceftests_sources_mac + sources = + includes_common + includes_mac + gypi_paths2.includes_wrapper + + gypi_paths2.includes_wrapper_mac + gypi_paths2.shared_sources_browser + + gypi_paths2.shared_sources_common + gypi_paths2.shared_sources_mac + + gypi_paths2.ceftests_sources_common + gypi_paths2.ceftests_sources_mac deps = [ ":ceftests_resources_bundle_data", ":ceftests_resources_bundle_data_english", ":ceftests_xibs", + ":gtest_teamcity", "//testing/gtest", ] - frameworks = [ - "AppKit.framework", - ] - defines = [ - "CEF_USE_SANDBOX", - ] + frameworks = [ "AppKit.framework" ] + defines = [ "CEF_USE_SANDBOX" ] } } else { # @@ -2023,9 +1988,7 @@ if (is_mac) { # default sysroot environment. if (is_linux && !use_sysroot) { pkg_config("glib") { - packages = [ - "glib-2.0", - ] + packages = [ "glib-2.0" ] } } @@ -2049,42 +2012,37 @@ if (is_mac) { } copy("copy_cefclient_files_extensions_set_page_color") { - sources = gypi_paths2.cefclient_sources_resources_extensions_set_page_color + sources = + gypi_paths2.cefclient_sources_resources_extensions_set_page_color outputs = [ "${root_out_dir}/cefclient_files/extensions/set_page_color/{{source_file_part}}" ] } } executable("cefclient") { - sources = includes_common + - gypi_paths2.includes_wrapper + - gypi_paths2.shared_sources_browser + - gypi_paths2.shared_sources_common + - gypi_paths2.shared_sources_renderer + - gypi_paths2.cefclient_sources_browser + - gypi_paths2.cefclient_sources_common + - gypi_paths2.cefclient_sources_renderer + sources = + includes_common + gypi_paths2.includes_wrapper + + gypi_paths2.shared_sources_browser + gypi_paths2.shared_sources_common + + gypi_paths2.shared_sources_renderer + + gypi_paths2.cefclient_sources_browser + + gypi_paths2.cefclient_sources_common + + gypi_paths2.cefclient_sources_renderer deps = [ ":libcef", ":libcef_dll_wrapper", ] - defines = [ - "CEF_USE_SANDBOX", - ] + defines = [ "CEF_USE_SANDBOX" ] if (is_win) { - sources += includes_win + - gypi_paths2.shared_sources_win + + sources += includes_win + gypi_paths2.shared_sources_win + gypi_paths2.cefclient_sources_win # Set /SUBSYSTEM:WINDOWS. configs -= [ "//build/config/win:console" ] configs += [ "//build/config/win:windowed" ] - defines += [ - "CEF_USE_ATL", - ] + defines += [ "CEF_USE_ATL" ] deps += [ ":cef_sandbox", @@ -2103,14 +2061,13 @@ if (is_mac) { if (target_cpu != "arm64") { libs += [ "opengl32.lib", - "glu32.lib" + "glu32.lib", ] } } if (is_linux) { - sources += includes_linux + - gypi_paths2.shared_sources_linux + + sources += includes_linux + gypi_paths2.shared_sources_linux + gypi_paths2.cefclient_sources_linux deps += [ @@ -2124,13 +2081,11 @@ if (is_mac) { ] if (cef_use_gtk) { - configs += [ - ":gtk", - ] + configs += [ ":gtk" ] } if (is_component_build) { - if (use_allocator=="tcmalloc") { + if (use_allocator == "tcmalloc") { # Link to base to initialize tcmalloc allocator shims, otherwise # base::allocator::IsAllocatorInitialized check fails deps += [ "//base" ] @@ -2142,14 +2097,12 @@ if (is_mac) { } } - # # cefsimple targets. # executable("cefsimple") { - sources = includes_common + - gypi_paths2.includes_wrapper + + sources = includes_common + gypi_paths2.includes_wrapper + gypi_paths2.cefsimple_sources_common deps = [ @@ -2157,13 +2110,10 @@ if (is_mac) { ":libcef_dll_wrapper", ] - defines = [ - "CEF_USE_SANDBOX", - ] + defines = [ "CEF_USE_SANDBOX" ] if (is_win) { - sources += includes_win + - gypi_paths2.cefsimple_sources_win + sources += includes_win + gypi_paths2.cefsimple_sources_win # Set /SUBSYSTEM:WINDOWS. configs -= [ "//build/config/win:console" ] @@ -2182,13 +2132,10 @@ if (is_mac) { } if (is_linux) { - sources += includes_linux + - gypi_paths2.cefsimple_sources_linux + sources += includes_linux + gypi_paths2.cefsimple_sources_linux - if (use_x11) { - libs = [ - "X11", - ] + if (ozone_platform_x11) { + libs = [ "X11" ] } if (!is_component_build) { @@ -2198,11 +2145,10 @@ if (is_mac) { } } - # # ceftests targets. # - + if (is_linux) { copy("copy_ceftests_files") { sources = gypi_paths2.shared_sources_resources @@ -2213,26 +2159,24 @@ if (is_mac) { executable("ceftests") { testonly = true - sources = includes_common + - gypi_paths2.includes_wrapper + - gypi_paths2.shared_sources_browser + - gypi_paths2.shared_sources_common + - gypi_paths2.shared_sources_renderer + - gypi_paths2.ceftests_sources_common + sources = + includes_common + gypi_paths2.includes_wrapper + + gypi_paths2.shared_sources_browser + gypi_paths2.shared_sources_common + + gypi_paths2.shared_sources_renderer + + gypi_paths2.ceftests_sources_common deps = [ + ":gtest_teamcity", ":libcef", ":libcef_dll_wrapper", "//testing/gtest", ] - defines = [ - "CEF_USE_SANDBOX", - ] + defines = [ "CEF_USE_SANDBOX" ] if (is_win) { - sources += gypi_paths2.shared_sources_win + - gypi_paths2.ceftests_sources_win + sources += + gypi_paths2.shared_sources_win + gypi_paths2.ceftests_sources_win deps += [ ":cef_sandbox", @@ -2241,22 +2185,18 @@ if (is_mac) { } if (is_linux) { - sources += gypi_paths2.shared_sources_linux + - gypi_paths2.ceftests_sources_linux + sources += + gypi_paths2.shared_sources_linux + gypi_paths2.ceftests_sources_linux - if (use_x11) { - libs = [ - "X11", - ] + if (ozone_platform_x11) { + libs = [ "X11" ] } else { if (!use_sysroot) { configs += [ ":glib" ] } } - deps += [ - ":copy_ceftests_files", - ] + deps += [ ":copy_ceftests_files" ] } if (is_linux && !is_component_build) { diff --git a/CHROMIUM_BUILD_COMPATIBILITY.txt b/CHROMIUM_BUILD_COMPATIBILITY.txt index 5dbbfb46..bcc28eea 100644 --- a/CHROMIUM_BUILD_COMPATIBILITY.txt +++ b/CHROMIUM_BUILD_COMPATIBILITY.txt @@ -7,6 +7,6 @@ # https://bitbucket.org/chromiumembedded/cef/wiki/BranchesAndBuilding { - 'chromium_checkout': 'refs/tags/91.0.4472.114', - 'depot_tools_checkout': '61bf6e8d69' + 'chromium_checkout': 'refs/tags/99.0.4844.84', + 'depot_tools_checkout': '289dedd36b' } diff --git a/CMakeLists.txt.in b/CMakeLists.txt.in index 5c7fd65e..1440f567 100644 --- a/CMakeLists.txt.in +++ b/CMakeLists.txt.in @@ -11,9 +11,9 @@ # CMake-generated project formats that have been tested with this CEF binary # distribution include: # -# Linux: Ninja, Unix Makefiles -# MacOS: Ninja, Xcode 8+ (x86_64) or Xcode 12.2+ (ARM64) -# Windows: Ninja, Visual Studio 2015+ +# Linux: Ninja, GCC 7.5.0+, Unix Makefiles +# MacOS: Ninja, Xcode 12.2 to 13.0 +# Windows: Ninja, Visual Studio 2019+ # # Ninja is a cross-platform open-source tool for running fast builds using # pre-installed platform toolchains (GNU, clang, Xcode or MSVC). It can be @@ -36,25 +36,27 @@ # # The below requirements must be met to build this CEF binary distribution. # -# - CMake version 2.8.12.1 or newer. +# - CMake version 3.19 or newer. # # - Linux requirements: -# Currently supported distributions include Debian Wheezy, Ubuntu Precise, and -# related. Ubuntu 18.04 64-bit is recommended. Newer versions will likely also -# work but may not have been tested. +# Currently supported distributions include Debian 10 (Buster), Ubuntu 18 +# (Bionic Beaver), and related. Ubuntu 18.04 64-bit with GCC 7.5.0+ is +# recommended. Newer versions will likely also work but may not have been +# tested. # Required packages include: # build-essential # libgtk3.0-dev (required by the cefclient target only) # # - MacOS requirements: -# Xcode 8 or newer building on MacOS 10.11 (El Capitan) or newer for x86_64. -# Xcode 12.2 or newer building on MacOS 10.15.4 (Catalina) or newer for ARM64. -# Only 64-bit builds are supported. The Xcode command-line tools must also be -# installed. +# Xcode 12.2 to 13.0 building on MacOS 10.15.4 (Catalina) or newer. Only +# 64-bit builds are supported. The Xcode command-line tools must also be +# installed. Newer Xcode versions may not have been been tested and are not +# recommended. # # - Windows requirements: -# Visual Studio 2015 Update 2 or newer building on Windows 7 or newer. Visual -# Studio 2019 and Windows 10 64-bit are recommended. +# Visual Studio 2019 or newer building on Windows 7 or newer. Windows 10 +# 64-bit is recommended. Newer versions will likely also work but may not have +# been tested. # # BUILD EXAMPLES # @@ -130,7 +132,8 @@ # Global setup. # -cmake_minimum_required(VERSION 2.8.12.1) +# For VS2019 and Xcode 12+ support. +cmake_minimum_required(VERSION 3.19) # Only generate Debug and Release configuration types. set(CMAKE_CONFIGURATION_TYPES Debug Release) diff --git a/README.OpenSource b/README.OpenSource index 7edb45a6..42ff7891 100755 --- a/README.OpenSource +++ b/README.OpenSource @@ -3,8 +3,8 @@ "Name": "cef", "License": "BSD 3-Clause License", "License File": "LICENSE", - "Version Number": "4472-9dd45fe15964fb136e60d16ad40d78023f486360", - "Upstream URL": "https://github.com/chromiumembedded/cef/tree/9dd45fe15964fb136e60d16ad40d78023f486360", + "Version Number": "99.2.15+g71e9523+chromium-99.0.4844.84", + "Upstream URL": "https://github.com/chromiumembedded/cef/tree/71e95237436e8fed71819f8c2f7881842f754f63", "Description": "CEF is a BSD-licensed open source project founded by Marshall Greenblatt in 2008 and based on the Google Chromium project." } ] diff --git a/README.md b/README.md index 4ab63093..f5d187ea 100644 --- a/README.md +++ b/README.md @@ -45,15 +45,11 @@ The base CEF framework includes support for the C and C++ programming languages. * .Net (CEF3) - https://github.com/cefsharp/CefSharp * .Net (CEF1) - https://bitbucket.org/fddima/cefglue -* .Net/Mono (CEF3) - https://bitbucket.org/xilium/xilium.cefglue -* .Net (CEF3) - https://bitbucket.org/chromiumfx/chromiumfx -* Delphi (CEF1) - http://code.google.com/p/delphichromiumembedded/ -* Delphi (CEF3) - https://github.com/hgourvest/dcef3 -* Delphi (CEF3) - https://github.com/salvadordf/CEF4Delphi -* Go - https://github.com/richardwilkes/cef +* .Net/Mono (CEF3) - https://gitlab.com/xiliumhq/chromiumembedded/cefglue +* Delphi - https://github.com/hgourvest/dcef3 +* Delphi - https://github.com/salvadordf/CEF4Delphi * Go - https://github.com/CzarekTomczak/cef2go * Java - https://bitbucket.org/chromiumembedded/java-cef -* Java - http://code.google.com/p/javacef/ * Python - http://code.google.com/p/cefpython/ If you're the maintainer of a project not listed above and would like your project listed here please either post to the [CEF Forum](http://www.magpcss.org/ceforum/) or contact Marshall directly. diff --git a/cef_paths.gypi b/cef_paths.gypi index b7980f95..3e41e2ae 100644 --- a/cef_paths.gypi +++ b/cef_paths.gypi @@ -1,4 +1,4 @@ -# Copyright (c) 2021 The Chromium Embedded Framework Authors. All rights +# Copyright (c) 2022 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. # @@ -8,7 +8,7 @@ # by hand. See the translator.README.txt file in the tools directory for # more information. # -# $hash=f1877c7a493342351e284cb6c14e6f223461facb$ +# $hash=872dedb7e5a2f36745446c3d0c9ad8bd5850adb7$ # { @@ -40,6 +40,8 @@ 'include/cef_find_handler.h', 'include/cef_focus_handler.h', 'include/cef_frame.h', + 'include/cef_frame_handler.h', + 'include/cef_i18n_util.h', 'include/cef_image.h', 'include/cef_jsdialog_handler.h', 'include/cef_keyboard_handler.h', @@ -60,7 +62,6 @@ 'include/cef_render_handler.h', 'include/cef_render_process_handler.h', 'include/cef_request.h', - 'include/cef_request_callback.h', 'include/cef_request_context.h', 'include/cef_request_context_handler.h', 'include/cef_request_handler.h', @@ -100,6 +101,7 @@ 'include/views/cef_layout.h', 'include/views/cef_menu_button.h', 'include/views/cef_menu_button_delegate.h', + 'include/views/cef_overlay_controller.h', 'include/views/cef_panel.h', 'include/views/cef_panel_delegate.h', 'include/views/cef_scroll_view.h', @@ -137,6 +139,8 @@ 'include/capi/cef_find_handler_capi.h', 'include/capi/cef_focus_handler_capi.h', 'include/capi/cef_frame_capi.h', + 'include/capi/cef_frame_handler_capi.h', + 'include/capi/cef_i18n_util_capi.h', 'include/capi/cef_image_capi.h', 'include/capi/cef_jsdialog_handler_capi.h', 'include/capi/cef_keyboard_handler_capi.h', @@ -157,7 +161,6 @@ 'include/capi/cef_render_handler_capi.h', 'include/capi/cef_render_process_handler_capi.h', 'include/capi/cef_request_capi.h', - 'include/capi/cef_request_callback_capi.h', 'include/capi/cef_request_context_capi.h', 'include/capi/cef_request_context_handler_capi.h', 'include/capi/cef_request_handler_capi.h', @@ -197,6 +200,7 @@ 'include/capi/views/cef_layout_capi.h', 'include/capi/views/cef_menu_button_capi.h', 'include/capi/views/cef_menu_button_delegate_capi.h', + 'include/capi/views/cef_overlay_controller_capi.h', 'include/capi/views/cef_panel_capi.h', 'include/capi/views/cef_panel_delegate_capi.h', 'include/capi/views/cef_scroll_view_capi.h', @@ -300,6 +304,8 @@ 'libcef_dll/ctocpp/focus_handler_ctocpp.h', 'libcef_dll/cpptoc/frame_cpptoc.cc', 'libcef_dll/cpptoc/frame_cpptoc.h', + 'libcef_dll/ctocpp/frame_handler_ctocpp.cc', + 'libcef_dll/ctocpp/frame_handler_ctocpp.h', 'libcef_dll/cpptoc/get_extension_resource_callback_cpptoc.cc', 'libcef_dll/cpptoc/get_extension_resource_callback_cpptoc.h', 'libcef_dll/cpptoc/image_cpptoc.cc', @@ -348,6 +354,8 @@ 'libcef_dll/cpptoc/navigation_entry_cpptoc.h', 'libcef_dll/ctocpp/navigation_entry_visitor_ctocpp.cc', 'libcef_dll/ctocpp/navigation_entry_visitor_ctocpp.h', + 'libcef_dll/cpptoc/views/overlay_controller_cpptoc.cc', + 'libcef_dll/cpptoc/views/overlay_controller_cpptoc.h', 'libcef_dll/cpptoc/views/panel_cpptoc.cc', 'libcef_dll/cpptoc/views/panel_cpptoc.h', 'libcef_dll/ctocpp/views/panel_delegate_ctocpp.cc', @@ -370,8 +378,6 @@ 'libcef_dll/cpptoc/process_message_cpptoc.h', 'libcef_dll/ctocpp/read_handler_ctocpp.cc', 'libcef_dll/ctocpp/read_handler_ctocpp.h', - 'libcef_dll/ctocpp/register_cdm_callback_ctocpp.cc', - 'libcef_dll/ctocpp/register_cdm_callback_ctocpp.h', 'libcef_dll/cpptoc/registration_cpptoc.cc', 'libcef_dll/cpptoc/registration_cpptoc.h', 'libcef_dll/ctocpp/render_handler_ctocpp.cc', @@ -380,8 +386,6 @@ 'libcef_dll/ctocpp/render_process_handler_ctocpp.h', 'libcef_dll/cpptoc/request_cpptoc.cc', 'libcef_dll/cpptoc/request_cpptoc.h', - 'libcef_dll/cpptoc/request_callback_cpptoc.cc', - 'libcef_dll/cpptoc/request_callback_cpptoc.h', 'libcef_dll/cpptoc/request_context_cpptoc.cc', 'libcef_dll/cpptoc/request_context_cpptoc.h', 'libcef_dll/ctocpp/request_context_handler_ctocpp.cc', @@ -610,6 +614,8 @@ 'libcef_dll/cpptoc/focus_handler_cpptoc.h', 'libcef_dll/ctocpp/frame_ctocpp.cc', 'libcef_dll/ctocpp/frame_ctocpp.h', + 'libcef_dll/cpptoc/frame_handler_cpptoc.cc', + 'libcef_dll/cpptoc/frame_handler_cpptoc.h', 'libcef_dll/ctocpp/get_extension_resource_callback_ctocpp.cc', 'libcef_dll/ctocpp/get_extension_resource_callback_ctocpp.h', 'libcef_dll/ctocpp/image_ctocpp.cc', @@ -658,6 +664,8 @@ 'libcef_dll/ctocpp/navigation_entry_ctocpp.h', 'libcef_dll/cpptoc/navigation_entry_visitor_cpptoc.cc', 'libcef_dll/cpptoc/navigation_entry_visitor_cpptoc.h', + 'libcef_dll/ctocpp/views/overlay_controller_ctocpp.cc', + 'libcef_dll/ctocpp/views/overlay_controller_ctocpp.h', 'libcef_dll/ctocpp/views/panel_ctocpp.cc', 'libcef_dll/ctocpp/views/panel_ctocpp.h', 'libcef_dll/cpptoc/views/panel_delegate_cpptoc.cc', @@ -680,8 +688,6 @@ 'libcef_dll/ctocpp/process_message_ctocpp.h', 'libcef_dll/cpptoc/read_handler_cpptoc.cc', 'libcef_dll/cpptoc/read_handler_cpptoc.h', - 'libcef_dll/cpptoc/register_cdm_callback_cpptoc.cc', - 'libcef_dll/cpptoc/register_cdm_callback_cpptoc.h', 'libcef_dll/ctocpp/registration_ctocpp.cc', 'libcef_dll/ctocpp/registration_ctocpp.h', 'libcef_dll/cpptoc/render_handler_cpptoc.cc', @@ -690,8 +696,6 @@ 'libcef_dll/cpptoc/render_process_handler_cpptoc.h', 'libcef_dll/ctocpp/request_ctocpp.cc', 'libcef_dll/ctocpp/request_ctocpp.h', - 'libcef_dll/ctocpp/request_callback_ctocpp.cc', - 'libcef_dll/ctocpp/request_callback_ctocpp.h', 'libcef_dll/ctocpp/request_context_ctocpp.cc', 'libcef_dll/ctocpp/request_context_ctocpp.h', 'libcef_dll/cpptoc/request_context_handler_cpptoc.cc', diff --git a/cef_paths2.gypi b/cef_paths2.gypi index 0ad653c0..d773a72b 100644 --- a/cef_paths2.gypi +++ b/cef_paths2.gypi @@ -5,23 +5,26 @@ { 'variables': { 'includes_common': [ + 'include/base/cef_atomic_flag.h', 'include/base/cef_atomic_ref_count.h', - 'include/base/cef_atomicops.h', + 'include/base/cef_auto_reset.h', 'include/base/cef_basictypes.h', 'include/base/cef_bind.h', - 'include/base/cef_bind_helpers.h', 'include/base/cef_build.h', 'include/base/cef_callback.h', 'include/base/cef_callback_forward.h', + 'include/base/cef_callback_helpers.h', 'include/base/cef_callback_list.h', 'include/base/cef_cancelable_callback.h', + 'include/base/cef_compiler_specific.h', + 'include/base/cef_cxx17_backports.h', 'include/base/cef_lock.h', 'include/base/cef_logging.h', 'include/base/cef_macros.h', - 'include/base/cef_move.h', 'include/base/cef_platform_thread.h', + 'include/base/cef_ptr_util.h', 'include/base/cef_ref_counted.h', - 'include/base/cef_scoped_ptr.h', + 'include/base/cef_scoped_refptr.h', 'include/base/cef_template_util.h', 'include/base/cef_thread_checker.h', 'include/base/cef_trace_event.h', @@ -31,10 +34,10 @@ 'include/base/internal/cef_callback_internal.h', 'include/base/internal/cef_lock_impl.h', 'include/base/internal/cef_raw_scoped_refptr_mismatch_checker.h', + 'include/base/internal/cef_scoped_policy.h', 'include/base/internal/cef_thread_checker_impl.h', 'include/cef_api_hash.h', 'include/cef_base.h', - 'include/cef_config.h', 'include/cef_version.h', 'include/internal/cef_export.h', 'include/internal/cef_ptr.h', @@ -52,6 +55,7 @@ 'include/internal/cef_time.h', 'include/internal/cef_trace_event_internal.h', 'include/internal/cef_types.h', + 'include/internal/cef_types_geometry.h', ], 'includes_capi': [ 'include/capi/cef_base_capi.h', @@ -71,9 +75,6 @@ 'include/wrapper/cef_library_loader.h', ], 'includes_win': [ - 'include/base/internal/cef_atomicops_arm64_msvc.h', - 'include/base/internal/cef_atomicops_x86_msvc.h', - 'include/base/internal/cef_bind_internal_win.h', 'include/cef_sandbox_win.h', 'include/internal/cef_win.h', ], @@ -81,8 +82,8 @@ 'include/internal/cef_types_win.h', ], 'includes_mac': [ - 'include/base/internal/cef_atomicops_atomicword_compat.h', - 'include/base/internal/cef_atomicops_mac.h', + 'include/base/cef_scoped_typeref_mac.h', + 'include/base/internal/cef_scoped_block_mac.h', 'include/cef_application_mac.h', 'include/cef_sandbox_mac.h', 'include/internal/cef_mac.h', @@ -91,10 +92,6 @@ 'include/internal/cef_types_mac.h', ], 'includes_linux': [ - 'include/base/internal/cef_atomicops_atomicword_compat.h', - 'include/base/internal/cef_atomicops_arm_gcc.h', - 'include/base/internal/cef_atomicops_arm64_gcc.h', - 'include/base/internal/cef_atomicops_x86_gcc.h', 'include/internal/cef_linux.h', ], 'includes_linux_capi': [ @@ -120,8 +117,8 @@ 'libcef_dll/wrapper_types.h', ], 'libcef_dll_wrapper_sources_base': [ - 'libcef_dll/base/cef_atomicops_x86_gcc.cc', - 'libcef_dll/base/cef_bind_helpers.cc', + 'libcef_dll/base/cef_atomic_flag.cc', + 'libcef_dll/base/cef_callback_helpers.cc', 'libcef_dll/base/cef_callback_internal.cc', 'libcef_dll/base/cef_lock.cc', 'libcef_dll/base/cef_lock_impl.cc', @@ -139,7 +136,6 @@ 'libcef_dll/cpptoc/cpptoc_scoped.h', 'libcef_dll/ctocpp/ctocpp_ref_counted.h', 'libcef_dll/ctocpp/ctocpp_scoped.h', - 'libcef_dll/ptr_util.h', 'libcef_dll/shutdown_checker.cc', 'libcef_dll/shutdown_checker.h', 'libcef_dll/transfer_util.cc', @@ -234,8 +230,6 @@ 'tests/cefclient/browser/client_types.h', 'tests/cefclient/browser/dialog_test.cc', 'tests/cefclient/browser/dialog_test.h', - 'tests/cefclient/browser/drm_test.cc', - 'tests/cefclient/browser/drm_test.h', 'tests/cefclient/browser/image_cache.cc', 'tests/cefclient/browser/image_cache.h', 'tests/cefclient/browser/main_context.cc', @@ -271,6 +265,8 @@ 'tests/cefclient/browser/urlrequest_test.h', 'tests/cefclient/browser/views_menu_bar.cc', 'tests/cefclient/browser/views_menu_bar.h', + 'tests/cefclient/browser/views_overlay_controls.cc', + 'tests/cefclient/browser/views_overlay_controls.h', 'tests/cefclient/browser/views_style.cc', 'tests/cefclient/browser/views_style.h', 'tests/cefclient/browser/views_window.cc', @@ -300,7 +296,6 @@ 'tests/cefclient/resources/binding.html', 'tests/cefclient/resources/dialogs.html', 'tests/cefclient/resources/draggable.html', - 'tests/cefclient/resources/drm.html', 'tests/cefclient/resources/localstorage.html', 'tests/cefclient/resources/logo.png', 'tests/cefclient/resources/media_router.html', @@ -471,6 +466,7 @@ 'tests/ceftests/extensions/extension_test_handler.h', 'tests/ceftests/extensions/view_unittest.cc', 'tests/ceftests/file_util_unittest.cc', + 'tests/ceftests/frame_handler_unittest.cc', 'tests/ceftests/frame_unittest.cc', 'tests/ceftests/image_unittest.cc', 'tests/ceftests/image_util.cc', @@ -483,7 +479,7 @@ 'tests/ceftests/osr_accessibility_unittest.cc', 'tests/ceftests/osr_display_unittest.cc', 'tests/ceftests/parser_unittest.cc', - 'tests/ceftests/plugin_unittest.cc', + 'tests/ceftests/pdf_viewer_unittest.cc', 'tests/ceftests/preference_unittest.cc', 'tests/ceftests/print_unittest.cc', 'tests/ceftests/process_message_unittest.cc', @@ -566,7 +562,7 @@ 'tests/ceftests/frame_unittest.cc', 'tests/ceftests/message_router_unittest.cc', 'tests/ceftests/navigation_unittest.cc', - 'tests/ceftests/plugin_unittest.cc', + 'tests/ceftests/pdf_viewer_unittest.cc', 'tests/ceftests/preference_unittest.cc', 'tests/ceftests/process_message_unittest.cc', 'tests/ceftests/request_handler_unittest.cc', diff --git a/cmake/cef_variables.cmake.in b/cmake/cef_variables.cmake.in index 2dced947..e1e4c9c3 100644 --- a/cmake/cef_variables.cmake.in +++ b/cmake/cef_variables.cmake.in @@ -105,7 +105,7 @@ if(OS_LINUX) -fno-rtti # Disable real-time type information -fno-threadsafe-statics # Don't generate thread-safe statics -fvisibility-inlines-hidden # Give hidden visibility to inlined class member functions - -std=gnu++11 # Use the C++11 language standard including GNU extensions + -std=c++14 # Use the C++14 language standard -Wsign-compare # Warn about mixed signed/unsigned type comparisons ) list(APPEND CEF_COMPILER_FLAGS_DEBUG @@ -222,8 +222,11 @@ if(OS_LINUX) libcef.so libEGL.so libGLESv2.so + libvk_swiftshader.so + libvulkan.so.1 snapshot_blob.bin v8_context_snapshot.bin + vk_swiftshader_icd.json swiftshader ) @@ -274,7 +277,7 @@ if(OS_MAC) -fno-threadsafe-statics # Don't generate thread-safe statics -fobjc-call-cxx-cdtors # Call the constructor/destructor of C++ instance variables in ObjC objects -fvisibility-inlines-hidden # Give hidden visibility to inlined class member functions - -std=gnu++11 # Use the C++11 language standard including GNU extensions + -std=c++14 # Use the C++14 language standard -Wno-narrowing # Don't warn about type narrowing -Wsign-compare # Warn about mixed signed/unsigned type comparisons ) @@ -407,6 +410,7 @@ if(OS_WINDOWS) /wd4100 # Ignore "unreferenced formal parameter" warning /wd4127 # Ignore "conditional expression is constant" warning /wd4244 # Ignore "conversion possible loss of data" warning + /wd4324 # Ignore "structure was padded due to alignment specifier" warning /wd4481 # Ignore "nonstandard extension used: override" warning /wd4512 # Ignore "assignment operator could not be generated" warning /wd4701 # Ignore "potentially uninitialized local variable" warning @@ -445,6 +449,7 @@ if(OS_WINDOWS) # Standard libraries. set(CEF_STANDARD_LIBS comctl32.lib + gdi32.lib rpcrt4.lib shlwapi.lib ws2_32.lib @@ -468,6 +473,9 @@ if(OS_WINDOWS) libGLESv2.dll snapshot_blob.bin v8_context_snapshot.bin + vk_swiftshader.dll + vk_swiftshader_icd.json + vulkan-1.dll swiftshader ) diff --git a/include/base/cef_atomic_flag.h b/include/base/cef_atomic_flag.h new file mode 100644 index 00000000..3730838e --- /dev/null +++ b/include/base/cef_atomic_flag.h @@ -0,0 +1,88 @@ +// Copyright (c) 2014 Marshall A. Greenblatt. Portions copyright (c) 2011 +// Google Inc. 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_BASE_CEF_ATOMIC_FLAG_H_ +#define CEF_INCLUDE_BASE_CEF_ATOMIC_FLAG_H_ +#pragma once + +#if defined(USING_CHROMIUM_INCLUDES) +// When building CEF include the Chromium header directly. +#include "base/synchronization/atomic_flag.h" + +#else // !USING_CHROMIUM_INCLUDES +// The following is substantially similar to the Chromium implementation. +// If the Chromium implementation diverges the below implementation should be +// updated to match. + +#include + +#include + +#include "include/base/cef_thread_checker.h" + +namespace base { + +// A flag that can safely be set from one thread and read from other threads. +// +// This class IS NOT intended for synchronization between threads. +class AtomicFlag { + public: + AtomicFlag(); + + AtomicFlag(const AtomicFlag&) = delete; + AtomicFlag& operator=(const AtomicFlag&) = delete; + + ~AtomicFlag(); + + // Set the flag. Must always be called from the same thread. + void Set(); + + // Returns true iff the flag was set. If this returns true, the current thread + // is guaranteed to be synchronized with all memory operations on the thread + // which invoked Set() up until at least the first call to Set() on it. + bool IsSet() const { + // Inline here: this has a measurable performance impact on base::WeakPtr. + return flag_.load(std::memory_order_acquire) != 0; + } + + // Resets the flag. Be careful when using this: callers might not expect + // IsSet() to return false after returning true once. + void UnsafeResetForTesting(); + + private: + std::atomic flag_{0}; + base::ThreadChecker set_thread_checker_; +}; + +} // namespace base + +#endif // !USING_CHROMIUM_INCLUDES + +#endif // CEF_INCLUDE_BASE_CEF_ATOMIC_FLAG_H_ diff --git a/include/base/cef_atomic_ref_count.h b/include/base/cef_atomic_ref_count.h index 4d677797..8fb0cc60 100644 --- a/include/base/cef_atomic_ref_count.h +++ b/include/base/cef_atomic_ref_count.h @@ -43,120 +43,66 @@ // When building CEF include the Chromium header directly. #include "base/atomic_ref_count.h" -// Used when declaring a base::AtomicRefCount value. This is an object type with -// Chromium headers. -#define ATOMIC_DECLARATION (0) - -// Maintaining compatibility with AtompicRefCount* functions that were removed -// from Chromium in http://crrev.com/ee96d561. -namespace base { - -// Increment a reference count by 1. -inline void AtomicRefCountInc(volatile AtomicRefCount* ptr) { - const_cast(ptr)->Increment(); -} - -// Decrement a reference count by 1 and return whether the result is non-zero. -// Insert barriers to ensure that state written before the reference count -// became zero will be visible to a thread that has just made the count zero. -inline bool AtomicRefCountDec(volatile AtomicRefCount* ptr) { - return const_cast(ptr)->Decrement(); -} - -// Return whether the reference count is one. If the reference count is used -// in the conventional way, a refrerence count of 1 implies that the current -// thread owns the reference and no other thread shares it. This call performs -// the test for a reference count of one, and performs the memory barrier -// needed for the owning thread to act on the object, knowing that it has -// exclusive access to the object. -inline bool AtomicRefCountIsOne(volatile AtomicRefCount* ptr) { - return const_cast(ptr)->IsOne(); -} - -// Return whether the reference count is zero. With conventional object -// referencing counting, the object will be destroyed, so the reference count -// should never be zero. Hence this is generally used for a debug check. -inline bool AtomicRefCountIsZero(volatile AtomicRefCount* ptr) { - return const_cast(ptr)->IsZero(); -} - -} // namespace base - #else // !USING_CHROMIUM_INCLUDES // The following is substantially similar to the Chromium implementation. // If the Chromium implementation diverges the below implementation should be // updated to match. -#include "include/base/cef_atomicops.h" - -// Annotations are not currently supported. -#define ANNOTATE_HAPPENS_BEFORE(obj) /* empty */ -#define ANNOTATE_HAPPENS_AFTER(obj) /* empty */ - -// Used when declaring a base::AtomicRefCount value. This is an integer/ptr type -// with CEF headers. -#define ATOMIC_DECLARATION = 0 +#include namespace base { -typedef subtle::Atomic32 AtomicRefCount; +class AtomicRefCount { + public: + constexpr AtomicRefCount() : ref_count_(0) {} + explicit constexpr AtomicRefCount(int initial_value) + : ref_count_(initial_value) {} -// Increment a reference count by "increment", which must exceed 0. -inline void AtomicRefCountIncN(volatile AtomicRefCount* ptr, - AtomicRefCount increment) { - subtle::NoBarrier_AtomicIncrement(ptr, increment); -} + // Increment a reference count. + // Returns the previous value of the count. + int Increment() { return Increment(1); } -// Decrement a reference count by "decrement", which must exceed 0, -// and return whether the result is non-zero. -// Insert barriers to ensure that state written before the reference count -// became zero will be visible to a thread that has just made the count zero. -inline bool AtomicRefCountDecN(volatile AtomicRefCount* ptr, - AtomicRefCount decrement) { - ANNOTATE_HAPPENS_BEFORE(ptr); - bool res = (subtle::Barrier_AtomicIncrement(ptr, -decrement) != 0); - if (!res) { - ANNOTATE_HAPPENS_AFTER(ptr); + // Increment a reference count by "increment", which must exceed 0. + // Returns the previous value of the count. + int Increment(int increment) { + return ref_count_.fetch_add(increment, std::memory_order_relaxed); } - return res; -} -// Increment a reference count by 1. -inline void AtomicRefCountInc(volatile AtomicRefCount* ptr) { - base::AtomicRefCountIncN(ptr, 1); -} - -// Decrement a reference count by 1 and return whether the result is non-zero. -// Insert barriers to ensure that state written before the reference count -// became zero will be visible to a thread that has just made the count zero. -inline bool AtomicRefCountDec(volatile AtomicRefCount* ptr) { - return base::AtomicRefCountDecN(ptr, 1); -} - -// Return whether the reference count is one. If the reference count is used -// in the conventional way, a refrerence count of 1 implies that the current -// thread owns the reference and no other thread shares it. This call performs -// the test for a reference count of one, and performs the memory barrier -// needed for the owning thread to act on the object, knowing that it has -// exclusive access to the object. -inline bool AtomicRefCountIsOne(volatile AtomicRefCount* ptr) { - bool res = (subtle::Acquire_Load(ptr) == 1); - if (res) { - ANNOTATE_HAPPENS_AFTER(ptr); + // Decrement a reference count, and return whether the result is non-zero. + // Insert barriers to ensure that state written before the reference count + // became zero will be visible to a thread that has just made the count zero. + bool Decrement() { + // TODO(jbroman): Technically this doesn't need to be an acquire operation + // unless the result is 1 (i.e., the ref count did indeed reach zero). + // However, there are toolchain issues that make that not work as well at + // present (notably TSAN doesn't like it). + return ref_count_.fetch_sub(1, std::memory_order_acq_rel) != 1; } - return res; -} -// Return whether the reference count is zero. With conventional object -// referencing counting, the object will be destroyed, so the reference count -// should never be zero. Hence this is generally used for a debug check. -inline bool AtomicRefCountIsZero(volatile AtomicRefCount* ptr) { - bool res = (subtle::Acquire_Load(ptr) == 0); - if (res) { - ANNOTATE_HAPPENS_AFTER(ptr); + // Return whether the reference count is one. If the reference count is used + // in the conventional way, a refrerence count of 1 implies that the current + // thread owns the reference and no other thread shares it. This call + // performs the test for a reference count of one, and performs the memory + // barrier needed for the owning thread to act on the object, knowing that it + // has exclusive access to the object. + bool IsOne() const { return ref_count_.load(std::memory_order_acquire) == 1; } + + // Return whether the reference count is zero. With conventional object + // referencing counting, the object will be destroyed, so the reference count + // should never be zero. Hence this is generally used for a debug check. + bool IsZero() const { + return ref_count_.load(std::memory_order_acquire) == 0; } - return res; -} + + // Returns the current reference count (with no barriers). This is subtle, and + // should be used only for debugging. + int SubtleRefCountForDebug() const { + return ref_count_.load(std::memory_order_relaxed); + } + + private: + std::atomic_int ref_count_; +}; } // namespace base diff --git a/include/base/cef_atomicops.h b/include/base/cef_atomicops.h deleted file mode 100644 index 93d135ff..00000000 --- a/include/base/cef_atomicops.h +++ /dev/null @@ -1,203 +0,0 @@ -// Copyright (c) 2014 Marshall A. Greenblatt. Portions copyright (c) 2012 -// Google Inc. 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. - -// For atomic operations on reference counts, see cef_atomic_ref_count.h. - -// The routines exported by this module are subtle. If you use them, even if -// you get the code right, it will depend on careful reasoning about atomicity -// and memory ordering; it will be less readable, and harder to maintain. If -// you plan to use these routines, you should have a good reason, such as solid -// evidence that performance would otherwise suffer, or there being no -// alternative. You should assume only properties explicitly guaranteed by the -// specifications in this file. You are almost certainly _not_ writing code -// just for the x86; if you assume x86 semantics, x86 hardware bugs and -// implementations on other archtectures will cause your code to break. If you -// do not know what you are doing, avoid these routines, and use a Mutex. -// -// It is incorrect to make direct assignments to/from an atomic variable. -// You should use one of the Load or Store routines. The NoBarrier -// versions are provided when no barriers are needed: -// NoBarrier_Store() -// NoBarrier_Load() -// Although there are currently no compiler enforcement, you are encouraged -// to use these. -// - -#ifndef CEF_INCLUDE_BASE_CEF_ATOMICOPS_H_ -#define CEF_INCLUDE_BASE_CEF_ATOMICOPS_H_ -#pragma once - -#if defined(BASE_ATOMICOPS_H_) -// Do nothing if the Chromium header has already been included. -// This can happen in cases where Chromium code is used directly by the -// client application. When using Chromium code directly always include -// the Chromium header first to avoid type conflicts. -#elif defined(USING_CHROMIUM_INCLUDES) -// When building CEF include the Chromium header directly. -#include "base/atomicops.h" -#else // !USING_CHROMIUM_INCLUDES -// The following is substantially similar to the Chromium implementation. -// If the Chromium implementation diverges the below implementation should be -// updated to match. - -#include - -#include "include/base/cef_build.h" - -#if defined(OS_WIN) && defined(ARCH_CPU_64_BITS) -// windows.h #defines this (only on x64). This causes problems because the -// public API also uses MemoryBarrier at the public name for this fence. So, on -// X64, undef it, and call its documented -// (http://msdn.microsoft.com/en-us/library/windows/desktop/ms684208.aspx) -// implementation directly. -#undef MemoryBarrier -#endif - -namespace base { -namespace subtle { - -typedef int32_t Atomic32; -#ifdef ARCH_CPU_64_BITS -// We need to be able to go between Atomic64 and AtomicWord implicitly. This -// means Atomic64 and AtomicWord should be the same type on 64-bit. -#if defined(__ILP32__) || defined(OS_NACL) -// NaCl's intptr_t is not actually 64-bits on 64-bit! -// http://code.google.com/p/nativeclient/issues/detail?id=1162 -typedef int64_t Atomic64; -#else -typedef intptr_t Atomic64; -#endif -#endif - -// Use AtomicWord for a machine-sized pointer. It will use the Atomic32 or -// Atomic64 routines below, depending on your architecture. -typedef intptr_t AtomicWord; - -// Atomically execute: -// result = *ptr; -// if (*ptr == old_value) -// *ptr = new_value; -// return result; -// -// I.e., replace "*ptr" with "new_value" if "*ptr" used to be "old_value". -// Always return the old value of "*ptr" -// -// This routine implies no memory barriers. -Atomic32 NoBarrier_CompareAndSwap(volatile Atomic32* ptr, - Atomic32 old_value, - Atomic32 new_value); - -// Atomically store new_value into *ptr, returning the previous value held in -// *ptr. This routine implies no memory barriers. -Atomic32 NoBarrier_AtomicExchange(volatile Atomic32* ptr, Atomic32 new_value); - -// Atomically increment *ptr by "increment". Returns the new value of -// *ptr with the increment applied. This routine implies no memory barriers. -Atomic32 NoBarrier_AtomicIncrement(volatile Atomic32* ptr, Atomic32 increment); - -Atomic32 Barrier_AtomicIncrement(volatile Atomic32* ptr, Atomic32 increment); - -// These following lower-level operations are typically useful only to people -// implementing higher-level synchronization operations like spinlocks, -// mutexes, and condition-variables. They combine CompareAndSwap(), a load, or -// a store with appropriate memory-ordering instructions. "Acquire" operations -// ensure that no later memory access can be reordered ahead of the operation. -// "Release" operations ensure that no previous memory access can be reordered -// after the operation. "Barrier" operations have both "Acquire" and "Release" -// semantics. A MemoryBarrier() has "Barrier" semantics, but does no memory -// access. -Atomic32 Acquire_CompareAndSwap(volatile Atomic32* ptr, - Atomic32 old_value, - Atomic32 new_value); -Atomic32 Release_CompareAndSwap(volatile Atomic32* ptr, - Atomic32 old_value, - Atomic32 new_value); - -void MemoryBarrier(); -void NoBarrier_Store(volatile Atomic32* ptr, Atomic32 value); -void Acquire_Store(volatile Atomic32* ptr, Atomic32 value); -void Release_Store(volatile Atomic32* ptr, Atomic32 value); - -Atomic32 NoBarrier_Load(volatile const Atomic32* ptr); -Atomic32 Acquire_Load(volatile const Atomic32* ptr); -Atomic32 Release_Load(volatile const Atomic32* ptr); - -// 64-bit atomic operations (only available on 64-bit processors). -#ifdef ARCH_CPU_64_BITS -Atomic64 NoBarrier_CompareAndSwap(volatile Atomic64* ptr, - Atomic64 old_value, - Atomic64 new_value); -Atomic64 NoBarrier_AtomicExchange(volatile Atomic64* ptr, Atomic64 new_value); -Atomic64 NoBarrier_AtomicIncrement(volatile Atomic64* ptr, Atomic64 increment); -Atomic64 Barrier_AtomicIncrement(volatile Atomic64* ptr, Atomic64 increment); - -Atomic64 Acquire_CompareAndSwap(volatile Atomic64* ptr, - Atomic64 old_value, - Atomic64 new_value); -Atomic64 Release_CompareAndSwap(volatile Atomic64* ptr, - Atomic64 old_value, - Atomic64 new_value); -void NoBarrier_Store(volatile Atomic64* ptr, Atomic64 value); -void Acquire_Store(volatile Atomic64* ptr, Atomic64 value); -void Release_Store(volatile Atomic64* ptr, Atomic64 value); -Atomic64 NoBarrier_Load(volatile const Atomic64* ptr); -Atomic64 Acquire_Load(volatile const Atomic64* ptr); -Atomic64 Release_Load(volatile const Atomic64* ptr); -#endif // ARCH_CPU_64_BITS - -} // namespace subtle -} // namespace base - -// Include our platform specific implementation. -#if defined(OS_WIN) && defined(COMPILER_MSVC) && defined(ARCH_CPU_X86_FAMILY) -#include "include/base/internal/cef_atomicops_x86_msvc.h" -#elif defined(OS_WIN) && (defined(__ARM_ARCH_ISA_A64) || defined(_M_ARM64)) -#include "include/base/internal/cef_atomicops_arm64_msvc.h" -#elif defined(OS_MAC) -#include "include/base/internal/cef_atomicops_mac.h" -#elif defined(COMPILER_GCC) && defined(ARCH_CPU_X86_FAMILY) -#include "include/base/internal/cef_atomicops_x86_gcc.h" -#elif defined(COMPILER_GCC) && defined(__ARM_ARCH_ISA_A64) -#include "include/base/internal/cef_atomicops_arm64_gcc.h" -#elif defined(COMPILER_GCC) && defined(__ARM_ARCH) -#include "include/base/internal/cef_atomicops_arm_gcc.h" -#else -#error "Atomic operations are not supported on your platform" -#endif - -// On some platforms we need additional declarations to make -// AtomicWord compatible with our other Atomic* types. -#if defined(OS_MAC) || defined(OS_OPENBSD) -#include "include/base/internal/cef_atomicops_atomicword_compat.h" -#endif - -#endif // !USING_CHROMIUM_INCLUDES - -#endif // CEF_INCLUDE_BASE_CEF_ATOMICOPS_H_ diff --git a/include/base/cef_auto_reset.h b/include/base/cef_auto_reset.h new file mode 100644 index 00000000..ba1f2485 --- /dev/null +++ b/include/base/cef_auto_reset.h @@ -0,0 +1,89 @@ +// Copyright (c) 2014 Marshall A. Greenblatt. Portions copyright (c) 2011 +// Google Inc. 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. + +// base::AutoReset<> is useful for setting a variable to a new value only within +// a particular scope. An base::AutoReset<> object resets a variable to its +// original value upon destruction, making it an alternative to writing +// "var = false;" or "var = old_val;" at all of a block's exit points. +// +// This should be obvious, but note that an base::AutoReset<> instance should +// have a shorter lifetime than its scoped_variable, to prevent invalid memory +// writes when the base::AutoReset<> object is destroyed. + +#ifndef CEF_INCLUDE_BASE_CEF_AUTO_RESET_H_ +#define CEF_INCLUDE_BASE_CEF_AUTO_RESET_H_ +#pragma once + +#if defined(USING_CHROMIUM_INCLUDES) +// When building CEF include the Chromium header directly. +#include "base/auto_reset.h" +#else // !USING_CHROMIUM_INCLUDES +// The following is substantially similar to the Chromium implementation. +// If the Chromium implementation diverges the below implementation should be +// updated to match. + +#include + +namespace base { + +template +class AutoReset { + public: + template + AutoReset(T* scoped_variable, U&& new_value) + : scoped_variable_(scoped_variable), + original_value_( + std::exchange(*scoped_variable_, std::forward(new_value))) {} + + AutoReset(AutoReset&& other) + : scoped_variable_(std::exchange(other.scoped_variable_, nullptr)), + original_value_(std::move(other.original_value_)) {} + + AutoReset& operator=(AutoReset&& rhs) { + scoped_variable_ = std::exchange(rhs.scoped_variable_, nullptr); + original_value_ = std::move(rhs.original_value_); + return *this; + } + + ~AutoReset() { + if (scoped_variable_) + *scoped_variable_ = std::move(original_value_); + } + + private: + T* scoped_variable_; + T original_value_; +}; + +} // namespace base + +#endif // !USING_CHROMIUM_INCLUDES + +#endif // CEF_INCLUDE_BASE_CEF_AUTO_RESET_H_ diff --git a/include/base/cef_bind.h b/include/base/cef_bind.h index 77c9c557..2e6a0716 100644 --- a/include/base/cef_bind.h +++ b/include/base/cef_bind.h @@ -28,16 +28,47 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// ----------------------------------------------------------------------------- +// Usage documentation +// ----------------------------------------------------------------------------- +// +// Overview: +// base::BindOnce() and base::BindRepeating() are helpers for creating +// base::OnceCallback and base::RepeatingCallback objects respectively. +// +// For a runnable object of n-arity, the base::Bind*() family allows partial +// application of the first m arguments. The remaining n - m arguments must be +// passed when invoking the callback with Run(). +// +// // The first argument is bound at callback creation; the remaining +// // two must be passed when calling Run() on the callback object. +// base::OnceCallback cb = base::BindOnce( +// [](short x, int y, long z) { return x * y * z; }, 42); +// +// When binding to a method, the receiver object must also be specified at +// callback creation time. When Run() is invoked, the method will be invoked on +// the specified receiver object. +// +// class C : public base::RefCounted { void F(); }; +// auto instance = base::MakeRefCounted(); +// auto cb = base::BindOnce(&C::F, instance); +// std::move(cb).Run(); // Identical to instance->F() +// +// See //docs/callback.md for the full documentation. +// +// ----------------------------------------------------------------------------- +// Implementation notes +// ----------------------------------------------------------------------------- +// +// If you're reading the implementation, before proceeding further, you should +// read the top comment of base/internal/cef_bind_internal.h for a definition of +// common terms and concepts. + #ifndef CEF_INCLUDE_BASE_CEF_BIND_H_ #define CEF_INCLUDE_BASE_CEF_BIND_H_ #pragma once -#if defined(BASE_BIND_H_) -// Do nothing if the Chromium header has already been included. -// This can happen in cases where Chromium code is used directly by the -// client application. When using Chromium code directly always include -// the Chromium header first to avoid type conflicts. -#elif defined(USING_CHROMIUM_INCLUDES) +#if defined(USING_CHROMIUM_INCLUDES) // When building CEF include the Chromium header directly. #include "base/bind.h" #else // !USING_CHROMIUM_INCLUDES @@ -45,529 +76,275 @@ // If the Chromium implementation diverges the below implementation should be // updated to match. -#include "include/base/internal/cef_bind_internal.h" -#include "include/base/internal/cef_callback_internal.h" +#include +#include +#include +#include -// ----------------------------------------------------------------------------- -// Usage documentation -// ----------------------------------------------------------------------------- -// -// See base/cef_callback.h for documentation. -// -// -// ----------------------------------------------------------------------------- -// Implementation notes -// ----------------------------------------------------------------------------- -// -// If you're reading the implementation, before proceeding further, you should -// read the top comment of base/bind_internal.h for a definition of common -// terms and concepts. -// -// RETURN TYPES -// -// Though Bind()'s result is meant to be stored in a Callback<> type, it -// cannot actually return the exact type without requiring a large amount -// of extra template specializations. The problem is that in order to -// discern the correct specialization of Callback<>, Bind would need to -// unwrap the function signature to determine the signature's arity, and -// whether or not it is a method. -// -// Each unique combination of (arity, function_type, num_prebound) where -// function_type is one of {function, method, const_method} would require -// one specialization. We eventually have to do a similar number of -// specializations anyways in the implementation (see the Invoker<>, -// classes). However, it is avoidable in Bind if we return the result -// via an indirection like we do below. -// -// TODO(ajwong): We might be able to avoid this now, but need to test. -// -// It is possible to move most of the COMPILE_ASSERT asserts into BindState<>, -// but it feels a little nicer to have the asserts here so people do not -// need to crack open bind_internal.h. On the other hand, it makes Bind() -// harder to read. +#include "include/base/cef_build.h" +#include "include/base/cef_compiler_specific.h" +#include "include/base/cef_template_util.h" +#include "include/base/internal/cef_bind_internal.h" + +#if defined(OS_APPLE) && !HAS_FEATURE(objc_arc) +#include "include/base/internal/cef_scoped_block_mac.h" +#endif namespace base { -template -base::Callback::RunnableType, - typename cef_internal::FunctorTraits::RunType, - void()>::UnboundRunType> -Bind(Functor functor) { - // Typedefs for how to store and run the functor. - typedef - typename cef_internal::FunctorTraits::RunnableType RunnableType; - typedef typename cef_internal::FunctorTraits::RunType RunType; +// Bind as OnceCallback. +template +inline OnceCallback> BindOnce( + Functor&& functor, + Args&&... args) { + static_assert(!internal::IsOnceCallback>() || + (std::is_rvalue_reference() && + !std::is_const>()), + "BindOnce requires non-const rvalue for OnceCallback binding." + " I.e.: base::BindOnce(std::move(callback))."); + static_assert( + conjunction< + internal::AssertBindArgIsNotBasePassed>...>::value, + "Use std::move() instead of base::Passed() with base::BindOnce()"); - typedef cef_internal::BindState BindState; - - return Callback( - new BindState(cef_internal::MakeRunnable(functor))); + return internal::BindImpl(std::forward(functor), + std::forward(args)...); } -template -base::Callback::RunnableType, - typename cef_internal::FunctorTraits::RunType, - void(typename cef_internal::CallbackParamTraits::StorageType)>:: - UnboundRunType> -Bind(Functor functor, const P1& p1) { - // Typedefs for how to store and run the functor. - typedef - typename cef_internal::FunctorTraits::RunnableType RunnableType; - typedef typename cef_internal::FunctorTraits::RunType RunType; +// Bind as RepeatingCallback. +template +inline RepeatingCallback> +BindRepeating(Functor&& functor, Args&&... args) { + static_assert( + !internal::IsOnceCallback>(), + "BindRepeating cannot bind OnceCallback. Use BindOnce with std::move()."); - // Use RunnableType::RunType instead of RunType above because our - // checks should below for bound references need to know what the actual - // functor is going to interpret the argument as. - typedef cef_internal::FunctionTraits - BoundFunctorTraits; - - // Do not allow binding a non-const reference parameter. Non-const reference - // parameters are disallowed by the Google style guide. Also, binding a - // non-const reference parameter can make for subtle bugs because the - // invoked function will receive a reference to the stored copy of the - // argument and not the original. - COMPILE_ASSERT( - !(is_non_const_reference::value), - do_not_bind_functions_with_nonconst_ref); - - // For methods, we need to be careful for parameter 1. We do not require - // a scoped_refptr because BindState<> itself takes care of AddRef() for - // methods. We also disallow binding of an array as the method's target - // object. - COMPILE_ASSERT(cef_internal::HasIsMethodTag::value || - !cef_internal::NeedsScopedRefptrButGetsRawPtr::value, - p1_is_refcounted_type_and_needs_scoped_refptr); - COMPILE_ASSERT(!cef_internal::HasIsMethodTag::value || - !is_array::value, - first_bound_argument_to_method_cannot_be_array); - typedef cef_internal::BindState< - RunnableType, RunType, - void(typename cef_internal::CallbackParamTraits::StorageType)> - BindState; - - return Callback( - new BindState(cef_internal::MakeRunnable(functor), p1)); + return internal::BindImpl(std::forward(functor), + std::forward(args)...); } -template -base::Callback::RunnableType, - typename cef_internal::FunctorTraits::RunType, - void(typename cef_internal::CallbackParamTraits::StorageType, - typename cef_internal::CallbackParamTraits::StorageType)>:: - UnboundRunType> -Bind(Functor functor, const P1& p1, const P2& p2) { - // Typedefs for how to store and run the functor. - typedef - typename cef_internal::FunctorTraits::RunnableType RunnableType; - typedef typename cef_internal::FunctorTraits::RunType RunType; - - // Use RunnableType::RunType instead of RunType above because our - // checks should below for bound references need to know what the actual - // functor is going to interpret the argument as. - typedef cef_internal::FunctionTraits - BoundFunctorTraits; - - // Do not allow binding a non-const reference parameter. Non-const reference - // parameters are disallowed by the Google style guide. Also, binding a - // non-const reference parameter can make for subtle bugs because the - // invoked function will receive a reference to the stored copy of the - // argument and not the original. - COMPILE_ASSERT( - !(is_non_const_reference::value || - is_non_const_reference::value), - do_not_bind_functions_with_nonconst_ref); - - // For methods, we need to be careful for parameter 1. We do not require - // a scoped_refptr because BindState<> itself takes care of AddRef() for - // methods. We also disallow binding of an array as the method's target - // object. - COMPILE_ASSERT(cef_internal::HasIsMethodTag::value || - !cef_internal::NeedsScopedRefptrButGetsRawPtr::value, - p1_is_refcounted_type_and_needs_scoped_refptr); - COMPILE_ASSERT(!cef_internal::HasIsMethodTag::value || - !is_array::value, - first_bound_argument_to_method_cannot_be_array); - COMPILE_ASSERT(!cef_internal::NeedsScopedRefptrButGetsRawPtr::value, - p2_is_refcounted_type_and_needs_scoped_refptr); - typedef cef_internal::BindState< - RunnableType, RunType, - void(typename cef_internal::CallbackParamTraits::StorageType, - typename cef_internal::CallbackParamTraits::StorageType)> - BindState; - - return Callback( - new BindState(cef_internal::MakeRunnable(functor), p1, p2)); +// Special cases for binding to a base::Callback without extra bound arguments. +// We CHECK() the validity of callback to guard against null pointers +// accidentally ending up in posted tasks, causing hard-to-debug crashes. +template +OnceCallback BindOnce(OnceCallback callback) { + CHECK(callback); + return callback; } -template -base::Callback::RunnableType, - typename cef_internal::FunctorTraits::RunType, - void(typename cef_internal::CallbackParamTraits::StorageType, - typename cef_internal::CallbackParamTraits::StorageType, - typename cef_internal::CallbackParamTraits::StorageType)>:: - UnboundRunType> -Bind(Functor functor, const P1& p1, const P2& p2, const P3& p3) { - // Typedefs for how to store and run the functor. - typedef - typename cef_internal::FunctorTraits::RunnableType RunnableType; - typedef typename cef_internal::FunctorTraits::RunType RunType; - - // Use RunnableType::RunType instead of RunType above because our - // checks should below for bound references need to know what the actual - // functor is going to interpret the argument as. - typedef cef_internal::FunctionTraits - BoundFunctorTraits; - - // Do not allow binding a non-const reference parameter. Non-const reference - // parameters are disallowed by the Google style guide. Also, binding a - // non-const reference parameter can make for subtle bugs because the - // invoked function will receive a reference to the stored copy of the - // argument and not the original. - COMPILE_ASSERT( - !(is_non_const_reference::value || - is_non_const_reference::value || - is_non_const_reference::value), - do_not_bind_functions_with_nonconst_ref); - - // For methods, we need to be careful for parameter 1. We do not require - // a scoped_refptr because BindState<> itself takes care of AddRef() for - // methods. We also disallow binding of an array as the method's target - // object. - COMPILE_ASSERT(cef_internal::HasIsMethodTag::value || - !cef_internal::NeedsScopedRefptrButGetsRawPtr::value, - p1_is_refcounted_type_and_needs_scoped_refptr); - COMPILE_ASSERT(!cef_internal::HasIsMethodTag::value || - !is_array::value, - first_bound_argument_to_method_cannot_be_array); - COMPILE_ASSERT(!cef_internal::NeedsScopedRefptrButGetsRawPtr::value, - p2_is_refcounted_type_and_needs_scoped_refptr); - COMPILE_ASSERT(!cef_internal::NeedsScopedRefptrButGetsRawPtr::value, - p3_is_refcounted_type_and_needs_scoped_refptr); - typedef cef_internal::BindState< - RunnableType, RunType, - void(typename cef_internal::CallbackParamTraits::StorageType, - typename cef_internal::CallbackParamTraits::StorageType, - typename cef_internal::CallbackParamTraits::StorageType)> - BindState; - - return Callback( - new BindState(cef_internal::MakeRunnable(functor), p1, p2, p3)); +template +OnceCallback BindOnce(RepeatingCallback callback) { + CHECK(callback); + return callback; } -template -base::Callback::RunnableType, - typename cef_internal::FunctorTraits::RunType, - void(typename cef_internal::CallbackParamTraits::StorageType, - typename cef_internal::CallbackParamTraits::StorageType, - typename cef_internal::CallbackParamTraits::StorageType, - typename cef_internal::CallbackParamTraits::StorageType)>:: - UnboundRunType> -Bind(Functor functor, const P1& p1, const P2& p2, const P3& p3, const P4& p4) { - // Typedefs for how to store and run the functor. - typedef - typename cef_internal::FunctorTraits::RunnableType RunnableType; - typedef typename cef_internal::FunctorTraits::RunType RunType; - - // Use RunnableType::RunType instead of RunType above because our - // checks should below for bound references need to know what the actual - // functor is going to interpret the argument as. - typedef cef_internal::FunctionTraits - BoundFunctorTraits; - - // Do not allow binding a non-const reference parameter. Non-const reference - // parameters are disallowed by the Google style guide. Also, binding a - // non-const reference parameter can make for subtle bugs because the - // invoked function will receive a reference to the stored copy of the - // argument and not the original. - COMPILE_ASSERT( - !(is_non_const_reference::value || - is_non_const_reference::value || - is_non_const_reference::value || - is_non_const_reference::value), - do_not_bind_functions_with_nonconst_ref); - - // For methods, we need to be careful for parameter 1. We do not require - // a scoped_refptr because BindState<> itself takes care of AddRef() for - // methods. We also disallow binding of an array as the method's target - // object. - COMPILE_ASSERT(cef_internal::HasIsMethodTag::value || - !cef_internal::NeedsScopedRefptrButGetsRawPtr::value, - p1_is_refcounted_type_and_needs_scoped_refptr); - COMPILE_ASSERT(!cef_internal::HasIsMethodTag::value || - !is_array::value, - first_bound_argument_to_method_cannot_be_array); - COMPILE_ASSERT(!cef_internal::NeedsScopedRefptrButGetsRawPtr::value, - p2_is_refcounted_type_and_needs_scoped_refptr); - COMPILE_ASSERT(!cef_internal::NeedsScopedRefptrButGetsRawPtr::value, - p3_is_refcounted_type_and_needs_scoped_refptr); - COMPILE_ASSERT(!cef_internal::NeedsScopedRefptrButGetsRawPtr::value, - p4_is_refcounted_type_and_needs_scoped_refptr); - typedef cef_internal::BindState< - RunnableType, RunType, - void(typename cef_internal::CallbackParamTraits::StorageType, - typename cef_internal::CallbackParamTraits::StorageType, - typename cef_internal::CallbackParamTraits::StorageType, - typename cef_internal::CallbackParamTraits::StorageType)> - BindState; - - return Callback( - new BindState(cef_internal::MakeRunnable(functor), p1, p2, p3, p4)); +template +RepeatingCallback BindRepeating( + RepeatingCallback callback) { + CHECK(callback); + return callback; } -template -base::Callback::RunnableType, - typename cef_internal::FunctorTraits::RunType, - void(typename cef_internal::CallbackParamTraits::StorageType, - typename cef_internal::CallbackParamTraits::StorageType, - typename cef_internal::CallbackParamTraits::StorageType, - typename cef_internal::CallbackParamTraits::StorageType, - typename cef_internal::CallbackParamTraits::StorageType)>:: - UnboundRunType> -Bind(Functor functor, - const P1& p1, - const P2& p2, - const P3& p3, - const P4& p4, - const P5& p5) { - // Typedefs for how to store and run the functor. - typedef - typename cef_internal::FunctorTraits::RunnableType RunnableType; - typedef typename cef_internal::FunctorTraits::RunType RunType; - - // Use RunnableType::RunType instead of RunType above because our - // checks should below for bound references need to know what the actual - // functor is going to interpret the argument as. - typedef cef_internal::FunctionTraits - BoundFunctorTraits; - - // Do not allow binding a non-const reference parameter. Non-const reference - // parameters are disallowed by the Google style guide. Also, binding a - // non-const reference parameter can make for subtle bugs because the - // invoked function will receive a reference to the stored copy of the - // argument and not the original. - COMPILE_ASSERT( - !(is_non_const_reference::value || - is_non_const_reference::value || - is_non_const_reference::value || - is_non_const_reference::value || - is_non_const_reference::value), - do_not_bind_functions_with_nonconst_ref); - - // For methods, we need to be careful for parameter 1. We do not require - // a scoped_refptr because BindState<> itself takes care of AddRef() for - // methods. We also disallow binding of an array as the method's target - // object. - COMPILE_ASSERT(cef_internal::HasIsMethodTag::value || - !cef_internal::NeedsScopedRefptrButGetsRawPtr::value, - p1_is_refcounted_type_and_needs_scoped_refptr); - COMPILE_ASSERT(!cef_internal::HasIsMethodTag::value || - !is_array::value, - first_bound_argument_to_method_cannot_be_array); - COMPILE_ASSERT(!cef_internal::NeedsScopedRefptrButGetsRawPtr::value, - p2_is_refcounted_type_and_needs_scoped_refptr); - COMPILE_ASSERT(!cef_internal::NeedsScopedRefptrButGetsRawPtr::value, - p3_is_refcounted_type_and_needs_scoped_refptr); - COMPILE_ASSERT(!cef_internal::NeedsScopedRefptrButGetsRawPtr::value, - p4_is_refcounted_type_and_needs_scoped_refptr); - COMPILE_ASSERT(!cef_internal::NeedsScopedRefptrButGetsRawPtr::value, - p5_is_refcounted_type_and_needs_scoped_refptr); - typedef cef_internal::BindState< - RunnableType, RunType, - void(typename cef_internal::CallbackParamTraits::StorageType, - typename cef_internal::CallbackParamTraits::StorageType, - typename cef_internal::CallbackParamTraits::StorageType, - typename cef_internal::CallbackParamTraits::StorageType, - typename cef_internal::CallbackParamTraits::StorageType)> - BindState; - - return Callback( - new BindState(cef_internal::MakeRunnable(functor), p1, p2, p3, p4, p5)); +// Unretained() allows binding a non-refcounted class, and to disable +// refcounting on arguments that are refcounted objects. +// +// EXAMPLE OF Unretained(): +// +// class Foo { +// public: +// void func() { cout << "Foo:f" << endl; } +// }; +// +// // In some function somewhere. +// Foo foo; +// OnceClosure foo_callback = +// BindOnce(&Foo::func, Unretained(&foo)); +// std::move(foo_callback).Run(); // Prints "Foo:f". +// +// Without the Unretained() wrapper on |&foo|, the above call would fail +// to compile because Foo does not support the AddRef() and Release() methods. +template +inline internal::UnretainedWrapper Unretained(T* o) { + return internal::UnretainedWrapper(o); } -template -base::Callback::RunnableType, - typename cef_internal::FunctorTraits::RunType, - void(typename cef_internal::CallbackParamTraits::StorageType, - typename cef_internal::CallbackParamTraits::StorageType, - typename cef_internal::CallbackParamTraits::StorageType, - typename cef_internal::CallbackParamTraits::StorageType, - typename cef_internal::CallbackParamTraits::StorageType, - typename cef_internal::CallbackParamTraits::StorageType)>:: - UnboundRunType> -Bind(Functor functor, - const P1& p1, - const P2& p2, - const P3& p3, - const P4& p4, - const P5& p5, - const P6& p6) { - // Typedefs for how to store and run the functor. - typedef - typename cef_internal::FunctorTraits::RunnableType RunnableType; - typedef typename cef_internal::FunctorTraits::RunType RunType; - - // Use RunnableType::RunType instead of RunType above because our - // checks should below for bound references need to know what the actual - // functor is going to interpret the argument as. - typedef cef_internal::FunctionTraits - BoundFunctorTraits; - - // Do not allow binding a non-const reference parameter. Non-const reference - // parameters are disallowed by the Google style guide. Also, binding a - // non-const reference parameter can make for subtle bugs because the - // invoked function will receive a reference to the stored copy of the - // argument and not the original. - COMPILE_ASSERT( - !(is_non_const_reference::value || - is_non_const_reference::value || - is_non_const_reference::value || - is_non_const_reference::value || - is_non_const_reference::value || - is_non_const_reference::value), - do_not_bind_functions_with_nonconst_ref); - - // For methods, we need to be careful for parameter 1. We do not require - // a scoped_refptr because BindState<> itself takes care of AddRef() for - // methods. We also disallow binding of an array as the method's target - // object. - COMPILE_ASSERT(cef_internal::HasIsMethodTag::value || - !cef_internal::NeedsScopedRefptrButGetsRawPtr::value, - p1_is_refcounted_type_and_needs_scoped_refptr); - COMPILE_ASSERT(!cef_internal::HasIsMethodTag::value || - !is_array::value, - first_bound_argument_to_method_cannot_be_array); - COMPILE_ASSERT(!cef_internal::NeedsScopedRefptrButGetsRawPtr::value, - p2_is_refcounted_type_and_needs_scoped_refptr); - COMPILE_ASSERT(!cef_internal::NeedsScopedRefptrButGetsRawPtr::value, - p3_is_refcounted_type_and_needs_scoped_refptr); - COMPILE_ASSERT(!cef_internal::NeedsScopedRefptrButGetsRawPtr::value, - p4_is_refcounted_type_and_needs_scoped_refptr); - COMPILE_ASSERT(!cef_internal::NeedsScopedRefptrButGetsRawPtr::value, - p5_is_refcounted_type_and_needs_scoped_refptr); - COMPILE_ASSERT(!cef_internal::NeedsScopedRefptrButGetsRawPtr::value, - p6_is_refcounted_type_and_needs_scoped_refptr); - typedef cef_internal::BindState< - RunnableType, RunType, - void(typename cef_internal::CallbackParamTraits::StorageType, - typename cef_internal::CallbackParamTraits::StorageType, - typename cef_internal::CallbackParamTraits::StorageType, - typename cef_internal::CallbackParamTraits::StorageType, - typename cef_internal::CallbackParamTraits::StorageType, - typename cef_internal::CallbackParamTraits::StorageType)> - BindState; - - return Callback(new BindState( - cef_internal::MakeRunnable(functor), p1, p2, p3, p4, p5, p6)); +// RetainedRef() accepts a ref counted object and retains a reference to it. +// When the callback is called, the object is passed as a raw pointer. +// +// EXAMPLE OF RetainedRef(): +// +// void foo(RefCountedBytes* bytes) {} +// +// scoped_refptr bytes = ...; +// OnceClosure callback = BindOnce(&foo, base::RetainedRef(bytes)); +// std::move(callback).Run(); +// +// Without RetainedRef, the scoped_refptr would try to implicitly convert to +// a raw pointer and fail compilation: +// +// OnceClosure callback = BindOnce(&foo, bytes); // ERROR! +template +inline internal::RetainedRefWrapper RetainedRef(T* o) { + return internal::RetainedRefWrapper(o); +} +template +inline internal::RetainedRefWrapper RetainedRef(scoped_refptr o) { + return internal::RetainedRefWrapper(std::move(o)); } -template -base::Callback::RunnableType, - typename cef_internal::FunctorTraits::RunType, - void(typename cef_internal::CallbackParamTraits::StorageType, - typename cef_internal::CallbackParamTraits::StorageType, - typename cef_internal::CallbackParamTraits::StorageType, - typename cef_internal::CallbackParamTraits::StorageType, - typename cef_internal::CallbackParamTraits::StorageType, - typename cef_internal::CallbackParamTraits::StorageType, - typename cef_internal::CallbackParamTraits::StorageType)>:: - UnboundRunType> -Bind(Functor functor, - const P1& p1, - const P2& p2, - const P3& p3, - const P4& p4, - const P5& p5, - const P6& p6, - const P7& p7) { - // Typedefs for how to store and run the functor. - typedef - typename cef_internal::FunctorTraits::RunnableType RunnableType; - typedef typename cef_internal::FunctorTraits::RunType RunType; - - // Use RunnableType::RunType instead of RunType above because our - // checks should below for bound references need to know what the actual - // functor is going to interpret the argument as. - typedef cef_internal::FunctionTraits - BoundFunctorTraits; - - // Do not allow binding a non-const reference parameter. Non-const reference - // parameters are disallowed by the Google style guide. Also, binding a - // non-const reference parameter can make for subtle bugs because the - // invoked function will receive a reference to the stored copy of the - // argument and not the original. - COMPILE_ASSERT( - !(is_non_const_reference::value || - is_non_const_reference::value || - is_non_const_reference::value || - is_non_const_reference::value || - is_non_const_reference::value || - is_non_const_reference::value || - is_non_const_reference::value), - do_not_bind_functions_with_nonconst_ref); - - // For methods, we need to be careful for parameter 1. We do not require - // a scoped_refptr because BindState<> itself takes care of AddRef() for - // methods. We also disallow binding of an array as the method's target - // object. - COMPILE_ASSERT(cef_internal::HasIsMethodTag::value || - !cef_internal::NeedsScopedRefptrButGetsRawPtr::value, - p1_is_refcounted_type_and_needs_scoped_refptr); - COMPILE_ASSERT(!cef_internal::HasIsMethodTag::value || - !is_array::value, - first_bound_argument_to_method_cannot_be_array); - COMPILE_ASSERT(!cef_internal::NeedsScopedRefptrButGetsRawPtr::value, - p2_is_refcounted_type_and_needs_scoped_refptr); - COMPILE_ASSERT(!cef_internal::NeedsScopedRefptrButGetsRawPtr::value, - p3_is_refcounted_type_and_needs_scoped_refptr); - COMPILE_ASSERT(!cef_internal::NeedsScopedRefptrButGetsRawPtr::value, - p4_is_refcounted_type_and_needs_scoped_refptr); - COMPILE_ASSERT(!cef_internal::NeedsScopedRefptrButGetsRawPtr::value, - p5_is_refcounted_type_and_needs_scoped_refptr); - COMPILE_ASSERT(!cef_internal::NeedsScopedRefptrButGetsRawPtr::value, - p6_is_refcounted_type_and_needs_scoped_refptr); - COMPILE_ASSERT(!cef_internal::NeedsScopedRefptrButGetsRawPtr::value, - p7_is_refcounted_type_and_needs_scoped_refptr); - typedef cef_internal::BindState< - RunnableType, RunType, - void(typename cef_internal::CallbackParamTraits::StorageType, - typename cef_internal::CallbackParamTraits::StorageType, - typename cef_internal::CallbackParamTraits::StorageType, - typename cef_internal::CallbackParamTraits::StorageType, - typename cef_internal::CallbackParamTraits::StorageType, - typename cef_internal::CallbackParamTraits::StorageType, - typename cef_internal::CallbackParamTraits::StorageType)> - BindState; - - return Callback(new BindState( - cef_internal::MakeRunnable(functor), p1, p2, p3, p4, p5, p6, p7)); +// Owned() transfers ownership of an object to the callback resulting from +// bind; the object will be deleted when the callback is deleted. +// +// EXAMPLE OF Owned(): +// +// void foo(int* arg) { cout << *arg << endl } +// +// int* pn = new int(1); +// RepeatingClosure foo_callback = BindRepeating(&foo, Owned(pn)); +// +// foo_callback.Run(); // Prints "1" +// foo_callback.Run(); // Prints "1" +// *pn = 2; +// foo_callback.Run(); // Prints "2" +// +// foo_callback.Reset(); // |pn| is deleted. Also will happen when +// // |foo_callback| goes out of scope. +// +// Without Owned(), someone would have to know to delete |pn| when the last +// reference to the callback is deleted. +template +inline internal::OwnedWrapper Owned(T* o) { + return internal::OwnedWrapper(o); } +template +inline internal::OwnedWrapper Owned( + std::unique_ptr&& ptr) { + return internal::OwnedWrapper(std::move(ptr)); +} + +// OwnedRef() stores an object in the callback resulting from +// bind and passes a reference to the object to the bound function. +// +// EXAMPLE OF OwnedRef(): +// +// void foo(int& arg) { cout << ++arg << endl } +// +// int counter = 0; +// RepeatingClosure foo_callback = BindRepeating(&foo, OwnedRef(counter)); +// +// foo_callback.Run(); // Prints "1" +// foo_callback.Run(); // Prints "2" +// foo_callback.Run(); // Prints "3" +// +// cout << counter; // Prints "0", OwnedRef creates a copy of counter. +// +// Supports OnceCallbacks as well, useful to pass placeholder arguments: +// +// void bar(int& ignore, const std::string& s) { cout << s << endl } +// +// OnceClosure bar_callback = BindOnce(&bar, OwnedRef(0), "Hello"); +// +// std::move(bar_callback).Run(); // Prints "Hello" +// +// Without OwnedRef() it would not be possible to pass a mutable reference to an +// object owned by the callback. +template +internal::OwnedRefWrapper> OwnedRef(T&& t) { + return internal::OwnedRefWrapper>(std::forward(t)); +} + +// Passed() is for transferring movable-but-not-copyable types (eg. unique_ptr) +// through a RepeatingCallback. Logically, this signifies a destructive transfer +// of the state of the argument into the target function. Invoking +// RepeatingCallback::Run() twice on a callback that was created with a Passed() +// argument will CHECK() because the first invocation would have already +// transferred ownership to the target function. +// +// Note that Passed() is not necessary with BindOnce(), as std::move() does the +// same thing. Avoid Passed() in favor of std::move() with BindOnce(). +// +// EXAMPLE OF Passed(): +// +// void TakesOwnership(std::unique_ptr arg) { } +// std::unique_ptr CreateFoo() { return std::make_unique(); +// } +// +// auto f = std::make_unique(); +// +// // |cb| is given ownership of Foo(). |f| is now NULL. +// // You can use std::move(f) in place of &f, but it's more verbose. +// RepeatingClosure cb = BindRepeating(&TakesOwnership, Passed(&f)); +// +// // Run was never called so |cb| still owns Foo() and deletes +// // it on Reset(). +// cb.Reset(); +// +// // |cb| is given a new Foo created by CreateFoo(). +// cb = BindRepeating(&TakesOwnership, Passed(CreateFoo())); +// +// // |arg| in TakesOwnership() is given ownership of Foo(). |cb| +// // no longer owns Foo() and, if reset, would not delete Foo(). +// cb.Run(); // Foo() is now transferred to |arg| and deleted. +// cb.Run(); // This CHECK()s since Foo() already been used once. +// +// We offer 2 syntaxes for calling Passed(). The first takes an rvalue and is +// best suited for use with the return value of a function or other temporary +// rvalues. The second takes a pointer to the scoper and is just syntactic sugar +// to avoid having to write Passed(std::move(scoper)). +// +// Both versions of Passed() prevent T from being an lvalue reference. The first +// via use of enable_if, and the second takes a T* which will not bind to T&. +template ::value>* = nullptr> +inline internal::PassedWrapper Passed(T&& scoper) { + return internal::PassedWrapper(std::move(scoper)); +} +template +inline internal::PassedWrapper Passed(T* scoper) { + return internal::PassedWrapper(std::move(*scoper)); +} + +// IgnoreResult() is used to adapt a function or callback with a return type to +// one with a void return. This is most useful if you have a function with, +// say, a pesky ignorable bool return that you want to use with PostTask or +// something else that expect a callback with a void return. +// +// EXAMPLE OF IgnoreResult(): +// +// int DoSomething(int arg) { cout << arg << endl; } +// +// // Assign to a callback with a void return type. +// OnceCallback cb = BindOnce(IgnoreResult(&DoSomething)); +// std::move(cb).Run(1); // Prints "1". +// +// // Prints "2" on |ml|. +// ml->PostTask(FROM_HERE, BindOnce(IgnoreResult(&DoSomething), 2); +template +inline internal::IgnoreResultHelper IgnoreResult(T data) { + return internal::IgnoreResultHelper(std::move(data)); +} + +#if defined(OS_APPLE) && !HAS_FEATURE(objc_arc) + +// RetainBlock() is used to adapt an Objective-C block when Automated Reference +// Counting (ARC) is disabled. This is unnecessary when ARC is enabled, as the +// BindOnce and BindRepeating already support blocks then. +// +// EXAMPLE OF RetainBlock(): +// +// // Wrap the block and bind it to a callback. +// OnceCallback cb = +// BindOnce(RetainBlock(^(int n) { NSLog(@"%d", n); })); +// std::move(cb).Run(1); // Logs "1". +template +base::mac::ScopedBlock RetainBlock(R (^block)(Args...)) { + return base::mac::ScopedBlock(block, + base::scoped_policy::RETAIN); +} + +#endif // defined(OS_APPLE) && !HAS_FEATURE(objc_arc) + } // namespace base #endif // !USING_CHROMIUM_INCLUDES diff --git a/include/base/cef_bind_helpers.h b/include/base/cef_bind_helpers.h deleted file mode 100644 index 2b4798b2..00000000 --- a/include/base/cef_bind_helpers.h +++ /dev/null @@ -1,579 +0,0 @@ -// Copyright (c) 2014 Marshall A. Greenblatt. Portions copyright (c) 2011 -// Google Inc. 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. - -// This defines a set of argument wrappers and related factory methods that -// can be used specify the refcounting and reference semantics of arguments -// that are bound by the Bind() function in base/bind.h. -// -// It also defines a set of simple functions and utilities that people want -// when using Callback<> and Bind(). -// -// -// ARGUMENT BINDING WRAPPERS -// -// The wrapper functions are base::Unretained(), base::Owned(), base::Passed(), -// base::ConstRef(), and base::IgnoreResult(). -// -// Unretained() allows Bind() to bind a non-refcounted class, and to disable -// refcounting on arguments that are refcounted objects. -// -// Owned() transfers ownership of an object to the Callback resulting from -// bind; the object will be deleted when the Callback is deleted. -// -// Passed() is for transferring movable-but-not-copyable types (eg. scoped_ptr) -// through a Callback. Logically, this signifies a destructive transfer of -// the state of the argument into the target function. Invoking -// Callback::Run() twice on a Callback that was created with a Passed() -// argument will CHECK() because the first invocation would have already -// transferred ownership to the target function. -// -// ConstRef() allows binding a constant reference to an argument rather -// than a copy. -// -// IgnoreResult() is used to adapt a function or Callback with a return type to -// one with a void return. This is most useful if you have a function with, -// say, a pesky ignorable bool return that you want to use with PostTask or -// something else that expect a Callback with a void return. -// -// EXAMPLE OF Unretained(): -// -// class Foo { -// public: -// void func() { cout << "Foo:f" << endl; } -// }; -// -// // In some function somewhere. -// Foo foo; -// Closure foo_callback = -// Bind(&Foo::func, Unretained(&foo)); -// foo_callback.Run(); // Prints "Foo:f". -// -// Without the Unretained() wrapper on |&foo|, the above call would fail -// to compile because Foo does not support the AddRef() and Release() methods. -// -// -// EXAMPLE OF Owned(): -// -// void foo(int* arg) { cout << *arg << endl } -// -// int* pn = new int(1); -// Closure foo_callback = Bind(&foo, Owned(pn)); -// -// foo_callback.Run(); // Prints "1" -// foo_callback.Run(); // Prints "1" -// *n = 2; -// foo_callback.Run(); // Prints "2" -// -// foo_callback.Reset(); // |pn| is deleted. Also will happen when -// // |foo_callback| goes out of scope. -// -// Without Owned(), someone would have to know to delete |pn| when the last -// reference to the Callback is deleted. -// -// -// EXAMPLE OF ConstRef(): -// -// void foo(int arg) { cout << arg << endl } -// -// int n = 1; -// Closure no_ref = Bind(&foo, n); -// Closure has_ref = Bind(&foo, ConstRef(n)); -// -// no_ref.Run(); // Prints "1" -// has_ref.Run(); // Prints "1" -// -// n = 2; -// no_ref.Run(); // Prints "1" -// has_ref.Run(); // Prints "2" -// -// Note that because ConstRef() takes a reference on |n|, |n| must outlive all -// its bound callbacks. -// -// -// EXAMPLE OF IgnoreResult(): -// -// int DoSomething(int arg) { cout << arg << endl; } -// -// // Assign to a Callback with a void return type. -// Callback cb = Bind(IgnoreResult(&DoSomething)); -// cb->Run(1); // Prints "1". -// -// // Prints "1" on |ml|. -// ml->PostTask(FROM_HERE, Bind(IgnoreResult(&DoSomething), 1); -// -// -// EXAMPLE OF Passed(): -// -// void TakesOwnership(scoped_ptr arg) { } -// scoped_ptr CreateFoo() { return scoped_ptr(new Foo()); } -// -// scoped_ptr f(new Foo()); -// -// // |cb| is given ownership of Foo(). |f| is now NULL. -// // You can use f.Pass() in place of &f, but it's more verbose. -// Closure cb = Bind(&TakesOwnership, Passed(&f)); -// -// // Run was never called so |cb| still owns Foo() and deletes -// // it on Reset(). -// cb.Reset(); -// -// // |cb| is given a new Foo created by CreateFoo(). -// cb = Bind(&TakesOwnership, Passed(CreateFoo())); -// -// // |arg| in TakesOwnership() is given ownership of Foo(). |cb| -// // no longer owns Foo() and, if reset, would not delete Foo(). -// cb.Run(); // Foo() is now transferred to |arg| and deleted. -// cb.Run(); // This CHECK()s since Foo() already been used once. -// -// Passed() is particularly useful with PostTask() when you are transferring -// ownership of an argument into a task, but don't necessarily know if the -// task will always be executed. This can happen if the task is cancellable -// or if it is posted to a MessageLoopProxy. -// -// -// SIMPLE FUNCTIONS AND UTILITIES. -// -// DoNothing() - Useful for creating a Closure that does nothing when called. -// DeletePointer() - Useful for creating a Closure that will delete a -// pointer when invoked. Only use this when necessary. -// In most cases MessageLoop::DeleteSoon() is a better -// fit. - -#ifndef CEF_INCLUDE_BASE_CEF_BIND_HELPERS_H_ -#define CEF_INCLUDE_BASE_CEF_BIND_HELPERS_H_ -#pragma once - -#if defined(BASE_BIND_HELPERS_H_) -// Do nothing if the Chromium header has already been included. -// This can happen in cases where Chromium code is used directly by the -// client application. When using Chromium code directly always include -// the Chromium header first to avoid type conflicts. -#elif defined(USING_CHROMIUM_INCLUDES) -// When building CEF include the Chromium header directly. -#include "base/bind_helpers.h" -#else // !USING_CHROMIUM_INCLUDES -// The following is substantially similar to the Chromium implementation. -// If the Chromium implementation diverges the below implementation should be -// updated to match. - -#include "include/base/cef_basictypes.h" -#include "include/base/cef_callback.h" -#include "include/base/cef_template_util.h" -#include "include/base/cef_weak_ptr.h" - -namespace base { -namespace cef_internal { - -// Use the Substitution Failure Is Not An Error (SFINAE) trick to inspect T -// for the existence of AddRef() and Release() functions of the correct -// signature. -// -// http://en.wikipedia.org/wiki/Substitution_failure_is_not_an_error -// http://stackoverflow.com/questions/257288/is-it-possible-to-write-a-c-template-to-check-for-a-functions-existence -// http://stackoverflow.com/questions/4358584/sfinae-approach-comparison -// http://stackoverflow.com/questions/1966362/sfinae-to-check-for-inherited-member-functions -// -// The last link in particular show the method used below. -// -// For SFINAE to work with inherited methods, we need to pull some extra tricks -// with multiple inheritance. In the more standard formulation, the overloads -// of Check would be: -// -// template -// Yes NotTheCheckWeWant(Helper<&C::TargetFunc>*); -// -// template -// No NotTheCheckWeWant(...); -// -// static const bool value = sizeof(NotTheCheckWeWant(0)) == sizeof(Yes); -// -// The problem here is that template resolution will not match -// C::TargetFunc if TargetFunc does not exist directly in C. That is, if -// TargetFunc in inherited from an ancestor, &C::TargetFunc will not match, -// |value| will be false. This formulation only checks for whether or -// not TargetFunc exist directly in the class being introspected. -// -// To get around this, we play a dirty trick with multiple inheritance. -// First, We create a class BaseMixin that declares each function that we -// want to probe for. Then we create a class Base that inherits from both T -// (the class we wish to probe) and BaseMixin. Note that the function -// signature in BaseMixin does not need to match the signature of the function -// we are probing for; thus it's easiest to just use void(void). -// -// Now, if TargetFunc exists somewhere in T, then &Base::TargetFunc has an -// ambiguous resolution between BaseMixin and T. This lets us write the -// following: -// -// template -// No GoodCheck(Helper<&C::TargetFunc>*); -// -// template -// Yes GoodCheck(...); -// -// static const bool value = sizeof(GoodCheck(0)) == sizeof(Yes); -// -// Notice here that the variadic version of GoodCheck() returns Yes here -// instead of No like the previous one. Also notice that we calculate |value| -// by specializing GoodCheck() on Base instead of T. -// -// We've reversed the roles of the variadic, and Helper overloads. -// GoodCheck(Helper<&C::TargetFunc>*), when C = Base, fails to be a valid -// substitution if T::TargetFunc exists. Thus GoodCheck(0) will resolve -// to the variadic version if T has TargetFunc. If T::TargetFunc does not -// exist, then &C::TargetFunc is not ambiguous, and the overload resolution -// will prefer GoodCheck(Helper<&C::TargetFunc>*). -// -// This method of SFINAE will correctly probe for inherited names, but it cannot -// typecheck those names. It's still a good enough sanity check though. -// -// Works on gcc-4.2, gcc-4.4, and Visual Studio 2008. -// -// TODO(ajwong): Move to ref_counted.h or template_util.h when we've vetted -// this works well. -// -// TODO(ajwong): Make this check for Release() as well. -// See http://crbug.com/82038. -template -class SupportsAddRefAndRelease { - typedef char Yes[1]; - typedef char No[2]; - - struct BaseMixin { - void AddRef(); - }; - -// MSVC warns when you try to use Base if T has a private destructor, the -// common pattern for refcounted types. It does this even though no attempt to -// instantiate Base is made. We disable the warning for this definition. -#if defined(OS_WIN) -#pragma warning(push) -#pragma warning(disable : 4624) -#endif - struct Base : public T, public BaseMixin {}; -#if defined(OS_WIN) -#pragma warning(pop) -#endif - - template - struct Helper {}; - - template - static No& Check(Helper<&C::AddRef>*); - - template - static Yes& Check(...); - - public: - static const bool value = sizeof(Check(0)) == sizeof(Yes); -}; - -// Helpers to assert that arguments of a recounted type are bound with a -// scoped_refptr. -template -struct UnsafeBindtoRefCountedArgHelper : false_type {}; - -template -struct UnsafeBindtoRefCountedArgHelper - : integral_constant::value> {}; - -template -struct UnsafeBindtoRefCountedArg : false_type {}; - -template -struct UnsafeBindtoRefCountedArg - : UnsafeBindtoRefCountedArgHelper::value, T> {}; - -template -class HasIsMethodTag { - typedef char Yes[1]; - typedef char No[2]; - - template - static Yes& Check(typename U::IsMethod*); - - template - static No& Check(...); - - public: - static const bool value = sizeof(Check(0)) == sizeof(Yes); -}; - -template -class UnretainedWrapper { - public: - explicit UnretainedWrapper(T* o) : ptr_(o) {} - T* get() const { return ptr_; } - - private: - T* ptr_; -}; - -template -class ConstRefWrapper { - public: - explicit ConstRefWrapper(const T& o) : ptr_(&o) {} - const T& get() const { return *ptr_; } - - private: - const T* ptr_; -}; - -template -struct IgnoreResultHelper { - explicit IgnoreResultHelper(T functor) : functor_(functor) {} - - T functor_; -}; - -template -struct IgnoreResultHelper> { - explicit IgnoreResultHelper(const Callback& functor) : functor_(functor) {} - - const Callback& functor_; -}; - -// An alternate implementation is to avoid the destructive copy, and instead -// specialize ParamTraits<> for OwnedWrapper<> to change the StorageType to -// a class that is essentially a scoped_ptr<>. -// -// The current implementation has the benefit though of leaving ParamTraits<> -// fully in callback_internal.h as well as avoiding type conversions during -// storage. -template -class OwnedWrapper { - public: - explicit OwnedWrapper(T* o) : ptr_(o) {} - ~OwnedWrapper() { delete ptr_; } - T* get() const { return ptr_; } - OwnedWrapper(const OwnedWrapper& other) { - ptr_ = other.ptr_; - other.ptr_ = NULL; - } - - private: - mutable T* ptr_; -}; - -// PassedWrapper is a copyable adapter for a scoper that ignores const. -// -// It is needed to get around the fact that Bind() takes a const reference to -// all its arguments. Because Bind() takes a const reference to avoid -// unnecessary copies, it is incompatible with movable-but-not-copyable -// types; doing a destructive "move" of the type into Bind() would violate -// the const correctness. -// -// This conundrum cannot be solved without either C++11 rvalue references or -// a O(2^n) blowup of Bind() templates to handle each combination of regular -// types and movable-but-not-copyable types. Thus we introduce a wrapper type -// that is copyable to transmit the correct type information down into -// BindState<>. Ignoring const in this type makes sense because it is only -// created when we are explicitly trying to do a destructive move. -// -// Two notes: -// 1) PassedWrapper supports any type that has a "Pass()" function. -// This is intentional. The whitelisting of which specific types we -// support is maintained by CallbackParamTraits<>. -// 2) is_valid_ is distinct from NULL because it is valid to bind a "NULL" -// scoper to a Callback and allow the Callback to execute once. -template -class PassedWrapper { - public: - explicit PassedWrapper(T scoper) : is_valid_(true), scoper_(scoper.Pass()) {} - PassedWrapper(const PassedWrapper& other) - : is_valid_(other.is_valid_), scoper_(other.scoper_.Pass()) {} - T Pass() const { - CHECK(is_valid_); - is_valid_ = false; - return scoper_.Pass(); - } - - private: - mutable bool is_valid_; - mutable T scoper_; -}; - -// Unwrap the stored parameters for the wrappers above. -template -struct UnwrapTraits { - typedef const T& ForwardType; - static ForwardType Unwrap(const T& o) { return o; } -}; - -template -struct UnwrapTraits> { - typedef T* ForwardType; - static ForwardType Unwrap(UnretainedWrapper unretained) { - return unretained.get(); - } -}; - -template -struct UnwrapTraits> { - typedef const T& ForwardType; - static ForwardType Unwrap(ConstRefWrapper const_ref) { - return const_ref.get(); - } -}; - -template -struct UnwrapTraits> { - typedef T* ForwardType; - static ForwardType Unwrap(const scoped_refptr& o) { return o.get(); } -}; - -template -struct UnwrapTraits> { - typedef const WeakPtr& ForwardType; - static ForwardType Unwrap(const WeakPtr& o) { return o; } -}; - -template -struct UnwrapTraits> { - typedef T* ForwardType; - static ForwardType Unwrap(const OwnedWrapper& o) { return o.get(); } -}; - -template -struct UnwrapTraits> { - typedef T ForwardType; - static T Unwrap(PassedWrapper& o) { return o.Pass(); } -}; - -// Utility for handling different refcounting semantics in the Bind() -// function. -template -struct MaybeRefcount; - -template -struct MaybeRefcount { - static void AddRef(const T&) {} - static void Release(const T&) {} -}; - -template -struct MaybeRefcount { - static void AddRef(const T*) {} - static void Release(const T*) {} -}; - -template -struct MaybeRefcount { - static void AddRef(const T&) {} - static void Release(const T&) {} -}; - -template -struct MaybeRefcount { - static void AddRef(T* o) { o->AddRef(); } - static void Release(T* o) { o->Release(); } -}; - -// No need to additionally AddRef() and Release() since we are storing a -// scoped_refptr<> inside the storage object already. -template -struct MaybeRefcount> { - static void AddRef(const scoped_refptr& o) {} - static void Release(const scoped_refptr& o) {} -}; - -template -struct MaybeRefcount { - static void AddRef(const T* o) { o->AddRef(); } - static void Release(const T* o) { o->Release(); } -}; - -// IsWeakMethod is a helper that determine if we are binding a WeakPtr<> to a -// method. It is used internally by Bind() to select the correct -// InvokeHelper that will no-op itself in the event the WeakPtr<> for -// the target object is invalidated. -// -// P1 should be the type of the object that will be received of the method. -template -struct IsWeakMethod : public false_type {}; - -template -struct IsWeakMethod> : public true_type {}; - -template -struct IsWeakMethod>> : public true_type {}; - -} // namespace cef_internal - -template -static inline cef_internal::UnretainedWrapper Unretained(T* o) { - return cef_internal::UnretainedWrapper(o); -} - -template -static inline cef_internal::ConstRefWrapper ConstRef(const T& o) { - return cef_internal::ConstRefWrapper(o); -} - -template -static inline cef_internal::OwnedWrapper Owned(T* o) { - return cef_internal::OwnedWrapper(o); -} - -// We offer 2 syntaxes for calling Passed(). The first takes a temporary and -// is best suited for use with the return value of a function. The second -// takes a pointer to the scoper and is just syntactic sugar to avoid having -// to write Passed(scoper.Pass()). -template -static inline cef_internal::PassedWrapper Passed(T scoper) { - return cef_internal::PassedWrapper(scoper.Pass()); -} -template -static inline cef_internal::PassedWrapper Passed(T* scoper) { - return cef_internal::PassedWrapper(scoper->Pass()); -} - -template -static inline cef_internal::IgnoreResultHelper IgnoreResult(T data) { - return cef_internal::IgnoreResultHelper(data); -} - -template -static inline cef_internal::IgnoreResultHelper> IgnoreResult( - const Callback& data) { - return cef_internal::IgnoreResultHelper>(data); -} - -void DoNothing(); - -template -void DeletePointer(T* obj) { - delete obj; -} - -} // namespace base - -#endif // !USING_CHROMIUM_INCLUDES - -#endif // CEF_INCLUDE_BASE_CEF_BIND_HELPERS_H_ diff --git a/include/base/cef_build.h b/include/base/cef_build.h index bb2e5458..576056c8 100644 --- a/include/base/cef_build.h +++ b/include/base/cef_build.h @@ -27,61 +27,128 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// This file adds defines about the platform we're currently building on. +// +// Operating System: +// OS_AIX / OS_ANDROID / OS_ASMJS / OS_FREEBSD / OS_FUCHSIA / OS_IOS / +// OS_LINUX / OS_MAC / OS_NACL (SFI or NONSFI) / OS_NETBSD / OS_OPENBSD / +// OS_QNX / OS_SOLARIS / OS_WIN +// Operating System family: +// OS_APPLE: IOS or MAC +// OS_BSD: FREEBSD or NETBSD or OPENBSD +// OS_POSIX: AIX or ANDROID or ASMJS or CHROMEOS or FREEBSD or IOS or LINUX +// or MAC or NACL or NETBSD or OPENBSD or QNX or SOLARIS +// +// /!\ Note: OS_CHROMEOS is set by the build system, not this file +// +// Compiler: +// COMPILER_MSVC / COMPILER_GCC +// +// Processor: +// ARCH_CPU_ARM64 / ARCH_CPU_ARMEL / ARCH_CPU_MIPS / ARCH_CPU_MIPS64 / +// ARCH_CPU_MIPS64EL / ARCH_CPU_MIPSEL / ARCH_CPU_PPC64 / ARCH_CPU_S390 / +// ARCH_CPU_S390X / ARCH_CPU_X86 / ARCH_CPU_X86_64 +// Processor family: +// ARCH_CPU_ARM_FAMILY: ARMEL or ARM64 +// ARCH_CPU_MIPS_FAMILY: MIPS64EL or MIPSEL or MIPS64 or MIPS +// ARCH_CPU_PPC64_FAMILY: PPC64 +// ARCH_CPU_S390_FAMILY: S390 or S390X +// ARCH_CPU_X86_FAMILY: X86 or X86_64 +// Processor features: +// ARCH_CPU_31_BITS / ARCH_CPU_32_BITS / ARCH_CPU_64_BITS +// ARCH_CPU_BIG_ENDIAN / ARCH_CPU_LITTLE_ENDIAN + #ifndef CEF_INCLUDE_BASE_CEF_BUILD_H_ #define CEF_INCLUDE_BASE_CEF_BUILD_H_ #pragma once #if defined(USING_CHROMIUM_INCLUDES) // When building CEF include the Chromium header directly. -#include "base/compiler_specific.h" +#include "build/build_config.h" #else // !USING_CHROMIUM_INCLUDES // The following is substantially similar to the Chromium implementation. // If the Chromium implementation diverges the below implementation should be // updated to match. -#if defined(_WIN32) -#ifndef OS_WIN -#define OS_WIN 1 -#endif +// A set of macros to use for platform detection. +#if defined(ANDROID) +#define OS_ANDROID 1 #elif defined(__APPLE__) -// New platform defines after https://crbug.com/1105907. -#ifndef OS_MAC +// Only include TargetConditionals after testing ANDROID as some Android builds +// on the Mac have this header available and it's not needed unless the target +// is really an Apple platform. +#include +#if defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE +#define OS_IOS 1 +#else #define OS_MAC 1 +// For backwards compatibility. +#define OS_MACOSX 1 +#endif // defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE +#elif defined(__linux__) +#if !defined(OS_CHROMEOS) +// Do not define OS_LINUX on Chrome OS build. +// The OS_CHROMEOS macro is defined in GN. +#define OS_LINUX 1 +#endif // !defined(OS_CHROMEOS) +// Include a system header to pull in features.h for glibc/uclibc macros. +#include +#if defined(__GLIBC__) && !defined(__UCLIBC__) +// We really are using glibc, not uClibc pretending to be glibc. +#define LIBC_GLIBC 1 #endif -#ifndef OS_APPLE +#elif defined(_WIN32) +#define OS_WIN 1 +#elif defined(__Fuchsia__) +#define OS_FUCHSIA 1 +#elif defined(__FreeBSD__) +#define OS_FREEBSD 1 +#elif defined(__NetBSD__) +#define OS_NETBSD 1 +#elif defined(__OpenBSD__) +#define OS_OPENBSD 1 +#elif defined(__sun) +#define OS_SOLARIS 1 +#elif defined(__QNXNTO__) +#define OS_QNX 1 +#elif defined(_AIX) +#define OS_AIX 1 +#elif defined(__asmjs__) || defined(__wasm__) +#define OS_ASMJS 1 +#else +#error Please add support for your platform in include/base/cef_build.h +#endif +// NOTE: Adding a new port? Please follow +// https://chromium.googlesource.com/chromium/src/+/master/docs/new_port_policy.md + +#if defined(OS_MAC) || defined(OS_IOS) #define OS_APPLE 1 #endif -// Old platform defines retained for backwards compatibility. -#ifndef OS_MACOSX -#define OS_MACOSX 1 -#endif -#elif defined(__linux__) -#ifndef OS_LINUX -#define OS_LINUX 1 -#endif -#else -#error Please add support for your platform in cef_build.h + +// For access to standard BSD features, use OS_BSD instead of a +// more specific macro. +#if defined(OS_FREEBSD) || defined(OS_NETBSD) || defined(OS_OPENBSD) +#define OS_BSD 1 #endif // For access to standard POSIXish features, use OS_POSIX instead of a // more specific macro. -#if defined(OS_MAC) || defined(OS_LINUX) -#ifndef OS_POSIX +#if defined(OS_AIX) || defined(OS_ANDROID) || defined(OS_ASMJS) || \ + defined(OS_FREEBSD) || defined(OS_IOS) || defined(OS_LINUX) || \ + defined(OS_CHROMEOS) || defined(OS_MAC) || defined(OS_NACL) || \ + defined(OS_NETBSD) || defined(OS_OPENBSD) || defined(OS_QNX) || \ + defined(OS_SOLARIS) #define OS_POSIX 1 #endif -#endif -// Compiler detection. +// Compiler detection. Note: clang masquerades as GCC on POSIX and as MSVC on +// Windows. #if defined(__GNUC__) -#ifndef COMPILER_GCC #define COMPILER_GCC 1 -#endif #elif defined(_MSC_VER) -#ifndef COMPILER_MSVC #define COMPILER_MSVC 1 -#endif #else -#error Please add support for your compiler in cef_build.h +#error Please add support for your compiler in build/build_config.h #endif // Processor architecture detection. For more info on what's defined, see: @@ -98,6 +165,26 @@ #define ARCH_CPU_X86 1 #define ARCH_CPU_32_BITS 1 #define ARCH_CPU_LITTLE_ENDIAN 1 +#elif defined(__s390x__) +#define ARCH_CPU_S390_FAMILY 1 +#define ARCH_CPU_S390X 1 +#define ARCH_CPU_64_BITS 1 +#define ARCH_CPU_BIG_ENDIAN 1 +#elif defined(__s390__) +#define ARCH_CPU_S390_FAMILY 1 +#define ARCH_CPU_S390 1 +#define ARCH_CPU_31_BITS 1 +#define ARCH_CPU_BIG_ENDIAN 1 +#elif (defined(__PPC64__) || defined(__PPC__)) && defined(__BIG_ENDIAN__) +#define ARCH_CPU_PPC64_FAMILY 1 +#define ARCH_CPU_PPC64 1 +#define ARCH_CPU_64_BITS 1 +#define ARCH_CPU_BIG_ENDIAN 1 +#elif defined(__PPC64__) +#define ARCH_CPU_PPC64_FAMILY 1 +#define ARCH_CPU_PPC64 1 +#define ARCH_CPU_64_BITS 1 +#define ARCH_CPU_LITTLE_ENDIAN 1 #elif defined(__ARMEL__) #define ARCH_CPU_ARM_FAMILY 1 #define ARCH_CPU_ARMEL 1 @@ -108,21 +195,42 @@ #define ARCH_CPU_ARM64 1 #define ARCH_CPU_64_BITS 1 #define ARCH_CPU_LITTLE_ENDIAN 1 -#elif defined(__pnacl__) +#elif defined(__pnacl__) || defined(__asmjs__) || defined(__wasm__) #define ARCH_CPU_32_BITS 1 #define ARCH_CPU_LITTLE_ENDIAN 1 #elif defined(__MIPSEL__) +#if defined(__LP64__) +#define ARCH_CPU_MIPS_FAMILY 1 +#define ARCH_CPU_MIPS64EL 1 +#define ARCH_CPU_64_BITS 1 +#define ARCH_CPU_LITTLE_ENDIAN 1 +#else #define ARCH_CPU_MIPS_FAMILY 1 #define ARCH_CPU_MIPSEL 1 #define ARCH_CPU_32_BITS 1 #define ARCH_CPU_LITTLE_ENDIAN 1 +#endif +#elif defined(__MIPSEB__) +#if defined(__LP64__) +#define ARCH_CPU_MIPS_FAMILY 1 +#define ARCH_CPU_MIPS64 1 +#define ARCH_CPU_64_BITS 1 +#define ARCH_CPU_BIG_ENDIAN 1 #else -#error Please add support for your architecture in cef_build.h +#define ARCH_CPU_MIPS_FAMILY 1 +#define ARCH_CPU_MIPS 1 +#define ARCH_CPU_32_BITS 1 +#define ARCH_CPU_BIG_ENDIAN 1 +#endif +#else +#error Please add support for your architecture in include/base/cef_build.h #endif // Type detection for wchar_t. #if defined(OS_WIN) #define WCHAR_T_IS_UTF16 +#elif defined(OS_FUCHSIA) +#define WCHAR_T_IS_UTF32 #elif defined(OS_POSIX) && defined(COMPILER_GCC) && defined(__WCHAR_MAX__) && \ (__WCHAR_MAX__ == 0x7fffffff || __WCHAR_MAX__ == 0xffffffff) #define WCHAR_T_IS_UTF32 @@ -134,82 +242,18 @@ // short wchar works for them. #define WCHAR_T_IS_UTF16 #else -#error Please add support for your compiler in cef_build.h +#error Please add support for your compiler in include/base/cef_build.h #endif -// Annotate a function indicating the caller must examine the return value. -// Use like: -// int foo() WARN_UNUSED_RESULT; -// To explicitly ignore a result, see |ignore_result()| in . -#ifndef WARN_UNUSED_RESULT -#if defined(COMPILER_GCC) -#define WARN_UNUSED_RESULT __attribute__((warn_unused_result)) -#else -#define WARN_UNUSED_RESULT -#endif -#endif // WARN_UNUSED_RESULT - -// Annotate a typedef or function indicating it's ok if it's not used. -// Use like: -// typedef Foo Bar ALLOW_UNUSED_TYPE; -#ifndef ALLOW_UNUSED_TYPE -#if defined(COMPILER_GCC) -#define ALLOW_UNUSED_TYPE __attribute__((unused)) -#else -#define ALLOW_UNUSED_TYPE -#endif -#endif // ALLOW_UNUSED_TYPE - -// Annotate a variable indicating it's ok if the variable is not used. -// (Typically used to silence a compiler warning when the assignment -// is important for some other reason.) -// Use like: -// int x = ...; -// ALLOW_UNUSED_LOCAL(x); -#ifndef ALLOW_UNUSED_LOCAL -#define ALLOW_UNUSED_LOCAL(x) false ? (void)x : (void)0 -#endif - -// Sanitizers annotations. -#if defined(__has_attribute) -#if __has_attribute(no_sanitize) -#define NO_SANITIZE(what) __attribute__((no_sanitize(what))) -#endif -#endif -#if !defined(NO_SANITIZE) -#define NO_SANITIZE(what) +#if defined(OS_ANDROID) +// The compiler thinks std::string::const_iterator and "const char*" are +// equivalent types. +#define STD_STRING_ITERATOR_IS_CHAR_POINTER +// The compiler thinks std::u16string::const_iterator and "char16*" are +// equivalent types. +#define BASE_STRING16_ITERATOR_IS_CHAR16_POINTER #endif #endif // !USING_CHROMIUM_INCLUDES -// Annotate a virtual method indicating it must be overriding a virtual method -// in the parent class. -// Use like: -// void foo() OVERRIDE; -// NOTE: This define should only be used in classes exposed to the client since -// C++11 support may not be enabled in client applications. CEF internal classes -// should use the `override` keyword directly. -#ifndef OVERRIDE -#if defined(__clang__) -#define OVERRIDE override -#elif defined(COMPILER_MSVC) && _MSC_VER >= 1600 -// Visual Studio 2010 and later support override. -#define OVERRIDE override -#elif defined(COMPILER_GCC) && __cplusplus >= 201103 && \ - (__GNUC__ * 10000 + __GNUC_MINOR__ * 100) >= 40700 -// GCC 4.7 supports explicit virtual overrides when C++11 support is enabled. -#define OVERRIDE override -#else -#define OVERRIDE -#endif -#endif // OVERRIDE - -// Check for C++11 template alias support which was added in VS2013 and GCC4.7. -// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2258.pdf -#if __cplusplus > 199711L || (defined(_MSC_VER) && _MSC_VER >= 1800) || \ - (defined(__GNUC__) && \ - (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__ >= 40700)) -#define HAS_CPP11_TEMPLATE_ALIAS_SUPPORT -#endif - #endif // CEF_INCLUDE_BASE_CEF_BUILD_H_ diff --git a/include/base/cef_callback.h b/include/base/cef_callback.h index 16e238a9..4df8562b 100644 --- a/include/base/cef_callback.h +++ b/include/base/cef_callback.h @@ -28,16 +28,46 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// ----------------------------------------------------------------------------- +// Usage documentation +// ----------------------------------------------------------------------------- +// +// Overview: +// A callback is similar in concept to a function pointer: it wraps a runnable +// object such as a function, method, lambda, or even another callback, allowing +// the runnable object to be invoked later via the callback object. +// +// Unlike function pointers, callbacks are created with base::BindOnce() or +// base::BindRepeating() and support partial function application. +// +// A base::OnceCallback may be Run() at most once; a base::RepeatingCallback may +// be Run() any number of times. |is_null()| is guaranteed to return true for a +// moved-from callback. +// +// // The lambda takes two arguments, but the first argument |x| is bound at +// // callback creation. +// base::OnceCallback cb = base::BindOnce([] (int x, int y) { +// return x + y; +// }, 1); +// // Run() only needs the remaining unbound argument |y|. +// printf("1 + 2 = %d\n", std::move(cb).Run(2)); // Prints 3 +// printf("cb is null? %s\n", +// cb.is_null() ? "true" : "false"); // Prints true +// std::move(cb).Run(2); // Crashes since |cb| has already run. +// +// Callbacks also support cancellation. A common use is binding the receiver +// object as a WeakPtr. If that weak pointer is invalidated, calling Run() +// will be a no-op. Note that |IsCancelled()| and |is_null()| are distinct: +// simply cancelling a callback will not also make it null. +// +// See https://chromium.googlesource.com/chromium/src/+/HEAD/docs/callback.md +// for the full documentation. + #ifndef CEF_INCLUDE_BASE_CEF_CALLBACK_H_ #define CEF_INCLUDE_BASE_CEF_CALLBACK_H_ #pragma once -#if defined(BASE_CALLBACK_H_) -// Do nothing if the Chromium header has already been included. -// This can happen in cases where Chromium code is used directly by the -// client application. When using Chromium code directly always include -// the Chromium header first to avoid type conflicts. -#elif defined(USING_CHROMIUM_INCLUDES) +#if defined(USING_CHROMIUM_INCLUDES) // When building CEF include the Chromium header directly. #include "base/callback.h" #else // !USING_CHROMIUM_INCLUDES @@ -45,755 +75,175 @@ // If the Chromium implementation diverges the below implementation should be // updated to match. +#include + +#include "include/base/cef_bind.h" #include "include/base/cef_callback_forward.h" -#include "include/base/cef_template_util.h" +#include "include/base/cef_logging.h" #include "include/base/internal/cef_callback_internal.h" -// NOTE: Header files that do not require the full definition of Callback or -// Closure should #include "base/cef_callback_forward.h" instead of this file. - -// ----------------------------------------------------------------------------- -// Introduction -// ----------------------------------------------------------------------------- -// -// The templated Callback class is a generalized function object. Together -// with the Bind() function in bind.h, they provide a type-safe method for -// performing partial application of functions. -// -// Partial application (or "currying") is the process of binding a subset of -// a function's arguments to produce another function that takes fewer -// arguments. This can be used to pass around a unit of delayed execution, -// much like lexical closures are used in other languages. For example, it -// is used in Chromium code to schedule tasks on different MessageLoops. -// -// A callback with no unbound input parameters (base::Callback) -// is called a base::Closure. Note that this is NOT the same as what other -// languages refer to as a closure -- it does not retain a reference to its -// enclosing environment. -// -// MEMORY MANAGEMENT AND PASSING -// -// The Callback objects themselves should be passed by const-reference, and -// stored by copy. They internally store their state via a refcounted class -// and thus do not need to be deleted. -// -// The reason to pass via a const-reference is to avoid unnecessary -// AddRef/Release pairs to the internal state. -// -// -// ----------------------------------------------------------------------------- -// Quick reference for basic stuff -// ----------------------------------------------------------------------------- -// -// BINDING A BARE FUNCTION -// -// int Return5() { return 5; } -// base::Callback func_cb = base::Bind(&Return5); -// LOG(INFO) << func_cb.Run(); // Prints 5. -// -// BINDING A CLASS METHOD -// -// The first argument to bind is the member function to call, the second is -// the object on which to call it. -// -// class Ref : public base::RefCountedThreadSafe { -// public: -// int Foo() { return 3; } -// void PrintBye() { LOG(INFO) << "bye."; } -// }; -// scoped_refptr ref = new Ref(); -// base::Callback ref_cb = base::Bind(&Ref::Foo, ref); -// LOG(INFO) << ref_cb.Run(); // Prints out 3. -// -// By default the object must support RefCounted or you will get a compiler -// error. If you're passing between threads, be sure it's -// RefCountedThreadSafe! See "Advanced binding of member functions" below if -// you don't want to use reference counting. -// -// RUNNING A CALLBACK -// -// Callbacks can be run with their "Run" method, which has the same -// signature as the template argument to the callback. -// -// void DoSomething(const base::Callback& callback) { -// callback.Run(5, "hello"); -// } -// -// Callbacks can be run more than once (they don't get deleted or marked when -// run). However, this precludes using base::Passed (see below). -// -// void DoSomething(const base::Callback& callback) { -// double myresult = callback.Run(3.14159); -// myresult += callback.Run(2.71828); -// } -// -// PASSING UNBOUND INPUT PARAMETERS -// -// Unbound parameters are specified at the time a callback is Run(). They are -// specified in the Callback template type: -// -// void MyFunc(int i, const std::string& str) {} -// base::Callback cb = base::Bind(&MyFunc); -// cb.Run(23, "hello, world"); -// -// PASSING BOUND INPUT PARAMETERS -// -// Bound parameters are specified when you create thee callback as arguments -// to Bind(). They will be passed to the function and the Run()ner of the -// callback doesn't see those values or even know that the function it's -// calling. -// -// void MyFunc(int i, const std::string& str) {} -// base::Callback cb = base::Bind(&MyFunc, 23, "hello world"); -// cb.Run(); -// -// A callback with no unbound input parameters (base::Callback) -// is called a base::Closure. So we could have also written: -// -// base::Closure cb = base::Bind(&MyFunc, 23, "hello world"); -// -// When calling member functions, bound parameters just go after the object -// pointer. -// -// base::Closure cb = base::Bind(&MyClass::MyFunc, this, 23, "hello world"); -// -// PARTIAL BINDING OF PARAMETERS -// -// You can specify some parameters when you create the callback, and specify -// the rest when you execute the callback. -// -// void MyFunc(int i, const std::string& str) {} -// base::Callback cb = base::Bind(&MyFunc, 23); -// cb.Run("hello world"); -// -// When calling a function bound parameters are first, followed by unbound -// parameters. -// -// -// ----------------------------------------------------------------------------- -// Quick reference for advanced binding -// ----------------------------------------------------------------------------- -// -// BINDING A CLASS METHOD WITH WEAK POINTERS -// -// base::Bind(&MyClass::Foo, GetWeakPtr()); -// -// The callback will not be run if the object has already been destroyed. -// DANGER: weak pointers are not threadsafe, so don't use this -// when passing between threads! -// -// BINDING A CLASS METHOD WITH MANUAL LIFETIME MANAGEMENT -// -// base::Bind(&MyClass::Foo, base::Unretained(this)); -// -// This disables all lifetime management on the object. You're responsible -// for making sure the object is alive at the time of the call. You break it, -// you own it! -// -// BINDING A CLASS METHOD AND HAVING THE CALLBACK OWN THE CLASS -// -// MyClass* myclass = new MyClass; -// base::Bind(&MyClass::Foo, base::Owned(myclass)); -// -// The object will be deleted when the callback is destroyed, even if it's -// not run (like if you post a task during shutdown). Potentially useful for -// "fire and forget" cases. -// -// IGNORING RETURN VALUES -// -// Sometimes you want to call a function that returns a value in a callback -// that doesn't expect a return value. -// -// int DoSomething(int arg) { cout << arg << endl; } -// base::Callback) cb = -// base::Bind(base::IgnoreResult(&DoSomething)); -// -// -// ----------------------------------------------------------------------------- -// Quick reference for binding parameters to Bind() -// ----------------------------------------------------------------------------- -// -// Bound parameters are specified as arguments to Bind() and are passed to the -// function. A callback with no parameters or no unbound parameters is called a -// Closure (base::Callback and base::Closure are the same thing). -// -// PASSING PARAMETERS OWNED BY THE CALLBACK -// -// void Foo(int* arg) { cout << *arg << endl; } -// int* pn = new int(1); -// base::Closure foo_callback = base::Bind(&foo, base::Owned(pn)); -// -// The parameter will be deleted when the callback is destroyed, even if it's -// not run (like if you post a task during shutdown). -// -// PASSING PARAMETERS AS A scoped_ptr -// -// void TakesOwnership(scoped_ptr arg) {} -// scoped_ptr f(new Foo); -// // f becomes null during the following call. -// base::Closure cb = base::Bind(&TakesOwnership, base::Passed(&f)); -// -// Ownership of the parameter will be with the callback until the it is run, -// when ownership is passed to the callback function. This means the callback -// can only be run once. If the callback is never run, it will delete the -// object when it's destroyed. -// -// PASSING PARAMETERS AS A scoped_refptr -// -// void TakesOneRef(scoped_refptr arg) {} -// scoped_refptr f(new Foo) -// base::Closure cb = base::Bind(&TakesOneRef, f); -// -// This should "just work." The closure will take a reference as long as it -// is alive, and another reference will be taken for the called function. -// -// PASSING PARAMETERS BY REFERENCE -// -// Const references are *copied* unless ConstRef is used. Example: -// -// void foo(const int& arg) { printf("%d %p\n", arg, &arg); } -// int n = 1; -// base::Closure has_copy = base::Bind(&foo, n); -// base::Closure has_ref = base::Bind(&foo, base::ConstRef(n)); -// n = 2; -// foo(n); // Prints "2 0xaaaaaaaaaaaa" -// has_copy.Run(); // Prints "1 0xbbbbbbbbbbbb" -// has_ref.Run(); // Prints "2 0xaaaaaaaaaaaa" -// -// Normally parameters are copied in the closure. DANGER: ConstRef stores a -// const reference instead, referencing the original parameter. This means -// that you must ensure the object outlives the callback! -// -// -// ----------------------------------------------------------------------------- -// Implementation notes -// ----------------------------------------------------------------------------- -// -// WHERE IS THIS DESIGN FROM: -// -// The design Callback and Bind is heavily influenced by C++'s -// tr1::function/tr1::bind, and by the "Google Callback" system used inside -// Google. -// -// -// HOW THE IMPLEMENTATION WORKS: -// -// There are three main components to the system: -// 1) The Callback classes. -// 2) The Bind() functions. -// 3) The arguments wrappers (e.g., Unretained() and ConstRef()). -// -// The Callback classes represent a generic function pointer. Internally, -// it stores a refcounted piece of state that represents the target function -// and all its bound parameters. Each Callback specialization has a templated -// constructor that takes an BindState<>*. In the context of the constructor, -// the static type of this BindState<> pointer uniquely identifies the -// function it is representing, all its bound parameters, and a Run() method -// that is capable of invoking the target. -// -// Callback's constructor takes the BindState<>* that has the full static type -// and erases the target function type as well as the types of the bound -// parameters. It does this by storing a pointer to the specific Run() -// function, and upcasting the state of BindState<>* to a -// BindStateBase*. This is safe as long as this BindStateBase pointer -// is only used with the stored Run() pointer. -// -// To BindState<> objects are created inside the Bind() functions. -// These functions, along with a set of internal templates, are responsible for -// -// - Unwrapping the function signature into return type, and parameters -// - Determining the number of parameters that are bound -// - Creating the BindState storing the bound parameters -// - Performing compile-time asserts to avoid error-prone behavior -// - Returning an Callback<> with an arity matching the number of unbound -// parameters and that knows the correct refcounting semantics for the -// target object if we are binding a method. -// -// The Bind functions do the above using type-inference, and template -// specializations. -// -// By default Bind() will store copies of all bound parameters, and attempt -// to refcount a target object if the function being bound is a class method. -// These copies are created even if the function takes parameters as const -// references. (Binding to non-const references is forbidden, see bind.h.) -// -// To change this behavior, we introduce a set of argument wrappers -// (e.g., Unretained(), and ConstRef()). These are simple container templates -// that are passed by value, and wrap a pointer to argument. See the -// file-level comment in base/bind_helpers.h for more info. -// -// These types are passed to the Unwrap() functions, and the MaybeRefcount() -// functions respectively to modify the behavior of Bind(). The Unwrap() -// and MaybeRefcount() functions change behavior by doing partial -// specialization based on whether or not a parameter is a wrapper type. -// -// ConstRef() is similar to tr1::cref. Unretained() is specific to Chromium. -// -// -// WHY NOT TR1 FUNCTION/BIND? -// -// Direct use of tr1::function and tr1::bind was considered, but ultimately -// rejected because of the number of copy constructors invocations involved -// in the binding of arguments during construction, and the forwarding of -// arguments during invocation. These copies will no longer be an issue in -// C++0x because C++0x will support rvalue reference allowing for the compiler -// to avoid these copies. However, waiting for C++0x is not an option. -// -// Measured with valgrind on gcc version 4.4.3 (Ubuntu 4.4.3-4ubuntu5), the -// tr1::bind call itself will invoke a non-trivial copy constructor three times -// for each bound parameter. Also, each when passing a tr1::function, each -// bound argument will be copied again. -// -// In addition to the copies taken at binding and invocation, copying a -// tr1::function causes a copy to be made of all the bound parameters and -// state. -// -// Furthermore, in Chromium, it is desirable for the Callback to take a -// reference on a target object when representing a class method call. This -// is not supported by tr1. -// -// Lastly, tr1::function and tr1::bind has a more general and flexible API. -// This includes things like argument reordering by use of -// tr1::bind::placeholder, support for non-const reference parameters, and some -// limited amount of subtyping of the tr1::function object (e.g., -// tr1::function is convertible to tr1::function). -// -// These are not features that are required in Chromium. Some of them, such as -// allowing for reference parameters, and subtyping of functions, may actually -// become a source of errors. Removing support for these features actually -// allows for a simpler implementation, and a terser Currying API. -// -// -// WHY NOT GOOGLE CALLBACKS? -// -// The Google callback system also does not support refcounting. Furthermore, -// its implementation has a number of strange edge cases with respect to type -// conversion of its arguments. In particular, the argument's constness must -// at times match exactly the function signature, or the type-inference might -// break. Given the above, writing a custom solution was easier. -// -// -// MISSING FUNCTIONALITY -// - Invoking the return of Bind. Bind(&foo).Run() does not work; -// - Binding arrays to functions that take a non-const pointer. -// Example: -// void Foo(const char* ptr); -// void Bar(char* ptr); -// Bind(&Foo, "test"); -// Bind(&Bar, "test"); // This fails because ptr is not const. - namespace base { -// First, we forward declare the Callback class template. This informs the -// compiler that the template only has 1 type parameter which is the function -// signature that the Callback is representing. -// -// After this, create template specializations for 0-7 parameters. Note that -// even though the template typelist grows, the specialization still -// only has one type: the function signature. -// -// If you are thinking of forward declaring Callback in your own header file, -// please include "base/callback_forward.h" instead. -template -class Callback; - -namespace cef_internal { -template -struct BindState; -} // namespace cef_internal - -template -class Callback : public cef_internal::CallbackBase { +template +class OnceCallback : public internal::CallbackBase { public: - typedef R(RunType)(); + using ResultType = R; + using RunType = R(Args...); + using PolymorphicInvoke = R (*)(internal::BindStateBase*, + internal::PassingType...); - Callback() : CallbackBase(NULL) {} + constexpr OnceCallback() = default; + OnceCallback(std::nullptr_t) = delete; - // Note that this constructor CANNOT be explicit, and that Bind() CANNOT - // return the exact Callback<> type. See base/bind.h for details. - template - Callback( - cef_internal::BindState* bind_state) - : CallbackBase(bind_state) { - // Force the assignment to a local variable of PolymorphicInvoke - // so the compiler will typecheck that the passed in Run() method has - // the correct type. - PolymorphicInvoke invoke_func = - &cef_internal::BindState::InvokerType::Run; - polymorphic_invoke_ = reinterpret_cast(invoke_func); + explicit OnceCallback(internal::BindStateBase* bind_state) + : internal::CallbackBase(bind_state) {} + + OnceCallback(const OnceCallback&) = delete; + OnceCallback& operator=(const OnceCallback&) = delete; + + OnceCallback(OnceCallback&&) noexcept = default; + OnceCallback& operator=(OnceCallback&&) noexcept = default; + + OnceCallback(RepeatingCallback other) + : internal::CallbackBase(std::move(other)) {} + + OnceCallback& operator=(RepeatingCallback other) { + static_cast(*this) = std::move(other); + return *this; } - bool Equals(const Callback& other) const { - return CallbackBase::Equals(other); + R Run(Args... args) const& { + static_assert(!sizeof(*this), + "OnceCallback::Run() may only be invoked on a non-const " + "rvalue, i.e. std::move(callback).Run()."); + NOTREACHED(); } - R Run() const { + R Run(Args... args) && { + // Move the callback instance into a local variable before the invocation, + // that ensures the internal state is cleared after the invocation. + // It's not safe to touch |this| after the invocation, since running the + // bound function may destroy |this|. + OnceCallback cb = std::move(*this); PolymorphicInvoke f = - reinterpret_cast(polymorphic_invoke_); - - return f(bind_state_.get()); + reinterpret_cast(cb.polymorphic_invoke()); + return f(cb.bind_state_.get(), std::forward(args)...); } - private: - typedef R (*PolymorphicInvoke)(cef_internal::BindStateBase*); + // Then() returns a new OnceCallback that receives the same arguments as + // |this|, and with the return type of |then|. The returned callback will: + // 1) Run the functor currently bound to |this| callback. + // 2) Run the |then| callback with the result from step 1 as its single + // argument. + // 3) Return the value from running the |then| callback. + // + // Since this method generates a callback that is a replacement for `this`, + // `this` will be consumed and reset to a null callback to ensure the + // originally-bound functor can be run at most once. + template + OnceCallback Then(OnceCallback then) && { + CHECK(then); + return BindOnce( + internal::ThenHelper< + OnceCallback, OnceCallback>::CreateTrampoline(), + std::move(*this), std::move(then)); + } + + // This overload is required; even though RepeatingCallback is implicitly + // convertible to OnceCallback, that conversion will not used when matching + // for template argument deduction. + template + OnceCallback Then( + RepeatingCallback then) && { + CHECK(then); + return BindOnce( + internal::ThenHelper< + OnceCallback, + RepeatingCallback>::CreateTrampoline(), + std::move(*this), std::move(then)); + } }; -template -class Callback : public cef_internal::CallbackBase { +template +class RepeatingCallback : public internal::CallbackBaseCopyable { public: - typedef R(RunType)(A1); + using ResultType = R; + using RunType = R(Args...); + using PolymorphicInvoke = R (*)(internal::BindStateBase*, + internal::PassingType...); - Callback() : CallbackBase(NULL) {} + constexpr RepeatingCallback() = default; + RepeatingCallback(std::nullptr_t) = delete; - // Note that this constructor CANNOT be explicit, and that Bind() CANNOT - // return the exact Callback<> type. See base/bind.h for details. - template - Callback( - cef_internal::BindState* bind_state) - : CallbackBase(bind_state) { - // Force the assignment to a local variable of PolymorphicInvoke - // so the compiler will typecheck that the passed in Run() method has - // the correct type. - PolymorphicInvoke invoke_func = - &cef_internal::BindState::InvokerType::Run; - polymorphic_invoke_ = reinterpret_cast(invoke_func); + explicit RepeatingCallback(internal::BindStateBase* bind_state) + : internal::CallbackBaseCopyable(bind_state) {} + + // Copyable and movable. + RepeatingCallback(const RepeatingCallback&) = default; + RepeatingCallback& operator=(const RepeatingCallback&) = default; + RepeatingCallback(RepeatingCallback&&) noexcept = default; + RepeatingCallback& operator=(RepeatingCallback&&) noexcept = default; + + bool operator==(const RepeatingCallback& other) const { + return EqualsInternal(other); } - bool Equals(const Callback& other) const { - return CallbackBase::Equals(other); + bool operator!=(const RepeatingCallback& other) const { + return !operator==(other); } - R Run(typename cef_internal::CallbackParamTraits::ForwardType a1) const { + R Run(Args... args) const& { PolymorphicInvoke f = - reinterpret_cast(polymorphic_invoke_); - - return f(bind_state_.get(), cef_internal::CallbackForward(a1)); + reinterpret_cast(this->polymorphic_invoke()); + return f(this->bind_state_.get(), std::forward(args)...); } - private: - typedef R (*PolymorphicInvoke)( - cef_internal::BindStateBase*, - typename cef_internal::CallbackParamTraits::ForwardType); -}; - -template -class Callback : public cef_internal::CallbackBase { - public: - typedef R(RunType)(A1, A2); - - Callback() : CallbackBase(NULL) {} - - // Note that this constructor CANNOT be explicit, and that Bind() CANNOT - // return the exact Callback<> type. See base/bind.h for details. - template - Callback( - cef_internal::BindState* bind_state) - : CallbackBase(bind_state) { - // Force the assignment to a local variable of PolymorphicInvoke - // so the compiler will typecheck that the passed in Run() method has - // the correct type. - PolymorphicInvoke invoke_func = - &cef_internal::BindState::InvokerType::Run; - polymorphic_invoke_ = reinterpret_cast(invoke_func); - } - - bool Equals(const Callback& other) const { - return CallbackBase::Equals(other); - } - - R Run(typename cef_internal::CallbackParamTraits::ForwardType a1, - typename cef_internal::CallbackParamTraits::ForwardType a2) const { + R Run(Args... args) && { + // Move the callback instance into a local variable before the invocation, + // that ensures the internal state is cleared after the invocation. + // It's not safe to touch |this| after the invocation, since running the + // bound function may destroy |this|. + RepeatingCallback cb = std::move(*this); PolymorphicInvoke f = - reinterpret_cast(polymorphic_invoke_); - - return f(bind_state_.get(), cef_internal::CallbackForward(a1), - cef_internal::CallbackForward(a2)); + reinterpret_cast(cb.polymorphic_invoke()); + return f(std::move(cb).bind_state_.get(), std::forward(args)...); } - private: - typedef R (*PolymorphicInvoke)( - cef_internal::BindStateBase*, - typename cef_internal::CallbackParamTraits::ForwardType, - typename cef_internal::CallbackParamTraits::ForwardType); + // Then() returns a new RepeatingCallback that receives the same arguments as + // |this|, and with the return type of |then|. The + // returned callback will: + // 1) Run the functor currently bound to |this| callback. + // 2) Run the |then| callback with the result from step 1 as its single + // argument. + // 3) Return the value from running the |then| callback. + // + // If called on an rvalue (e.g. std::move(cb).Then(...)), this method + // generates a callback that is a replacement for `this`. Therefore, `this` + // will be consumed and reset to a null callback to ensure the + // originally-bound functor will be run at most once. + template + RepeatingCallback Then( + RepeatingCallback then) const& { + CHECK(then); + return BindRepeating( + internal::ThenHelper< + RepeatingCallback, + RepeatingCallback>::CreateTrampoline(), + *this, std::move(then)); + } + + template + RepeatingCallback Then( + RepeatingCallback then) && { + CHECK(then); + return BindRepeating( + internal::ThenHelper< + RepeatingCallback, + RepeatingCallback>::CreateTrampoline(), + std::move(*this), std::move(then)); + } }; -template -class Callback : public cef_internal::CallbackBase { - public: - typedef R(RunType)(A1, A2, A3); - - Callback() : CallbackBase(NULL) {} - - // Note that this constructor CANNOT be explicit, and that Bind() CANNOT - // return the exact Callback<> type. See base/bind.h for details. - template - Callback( - cef_internal::BindState* bind_state) - : CallbackBase(bind_state) { - // Force the assignment to a local variable of PolymorphicInvoke - // so the compiler will typecheck that the passed in Run() method has - // the correct type. - PolymorphicInvoke invoke_func = - &cef_internal::BindState::InvokerType::Run; - polymorphic_invoke_ = reinterpret_cast(invoke_func); - } - - bool Equals(const Callback& other) const { - return CallbackBase::Equals(other); - } - - R Run(typename cef_internal::CallbackParamTraits::ForwardType a1, - typename cef_internal::CallbackParamTraits::ForwardType a2, - typename cef_internal::CallbackParamTraits::ForwardType a3) const { - PolymorphicInvoke f = - reinterpret_cast(polymorphic_invoke_); - - return f(bind_state_.get(), cef_internal::CallbackForward(a1), - cef_internal::CallbackForward(a2), - cef_internal::CallbackForward(a3)); - } - - private: - typedef R (*PolymorphicInvoke)( - cef_internal::BindStateBase*, - typename cef_internal::CallbackParamTraits::ForwardType, - typename cef_internal::CallbackParamTraits::ForwardType, - typename cef_internal::CallbackParamTraits::ForwardType); -}; - -template -class Callback : public cef_internal::CallbackBase { - public: - typedef R(RunType)(A1, A2, A3, A4); - - Callback() : CallbackBase(NULL) {} - - // Note that this constructor CANNOT be explicit, and that Bind() CANNOT - // return the exact Callback<> type. See base/bind.h for details. - template - Callback( - cef_internal::BindState* bind_state) - : CallbackBase(bind_state) { - // Force the assignment to a local variable of PolymorphicInvoke - // so the compiler will typecheck that the passed in Run() method has - // the correct type. - PolymorphicInvoke invoke_func = - &cef_internal::BindState::InvokerType::Run; - polymorphic_invoke_ = reinterpret_cast(invoke_func); - } - - bool Equals(const Callback& other) const { - return CallbackBase::Equals(other); - } - - R Run(typename cef_internal::CallbackParamTraits::ForwardType a1, - typename cef_internal::CallbackParamTraits::ForwardType a2, - typename cef_internal::CallbackParamTraits::ForwardType a3, - typename cef_internal::CallbackParamTraits::ForwardType a4) const { - PolymorphicInvoke f = - reinterpret_cast(polymorphic_invoke_); - - return f(bind_state_.get(), cef_internal::CallbackForward(a1), - cef_internal::CallbackForward(a2), - cef_internal::CallbackForward(a3), - cef_internal::CallbackForward(a4)); - } - - private: - typedef R (*PolymorphicInvoke)( - cef_internal::BindStateBase*, - typename cef_internal::CallbackParamTraits::ForwardType, - typename cef_internal::CallbackParamTraits::ForwardType, - typename cef_internal::CallbackParamTraits::ForwardType, - typename cef_internal::CallbackParamTraits::ForwardType); -}; - -template -class Callback : public cef_internal::CallbackBase { - public: - typedef R(RunType)(A1, A2, A3, A4, A5); - - Callback() : CallbackBase(NULL) {} - - // Note that this constructor CANNOT be explicit, and that Bind() CANNOT - // return the exact Callback<> type. See base/bind.h for details. - template - Callback( - cef_internal::BindState* bind_state) - : CallbackBase(bind_state) { - // Force the assignment to a local variable of PolymorphicInvoke - // so the compiler will typecheck that the passed in Run() method has - // the correct type. - PolymorphicInvoke invoke_func = - &cef_internal::BindState::InvokerType::Run; - polymorphic_invoke_ = reinterpret_cast(invoke_func); - } - - bool Equals(const Callback& other) const { - return CallbackBase::Equals(other); - } - - R Run(typename cef_internal::CallbackParamTraits::ForwardType a1, - typename cef_internal::CallbackParamTraits::ForwardType a2, - typename cef_internal::CallbackParamTraits::ForwardType a3, - typename cef_internal::CallbackParamTraits::ForwardType a4, - typename cef_internal::CallbackParamTraits::ForwardType a5) const { - PolymorphicInvoke f = - reinterpret_cast(polymorphic_invoke_); - - return f( - bind_state_.get(), cef_internal::CallbackForward(a1), - cef_internal::CallbackForward(a2), cef_internal::CallbackForward(a3), - cef_internal::CallbackForward(a4), cef_internal::CallbackForward(a5)); - } - - private: - typedef R (*PolymorphicInvoke)( - cef_internal::BindStateBase*, - typename cef_internal::CallbackParamTraits::ForwardType, - typename cef_internal::CallbackParamTraits::ForwardType, - typename cef_internal::CallbackParamTraits::ForwardType, - typename cef_internal::CallbackParamTraits::ForwardType, - typename cef_internal::CallbackParamTraits::ForwardType); -}; - -template -class Callback : public cef_internal::CallbackBase { - public: - typedef R(RunType)(A1, A2, A3, A4, A5, A6); - - Callback() : CallbackBase(NULL) {} - - // Note that this constructor CANNOT be explicit, and that Bind() CANNOT - // return the exact Callback<> type. See base/bind.h for details. - template - Callback( - cef_internal::BindState* bind_state) - : CallbackBase(bind_state) { - // Force the assignment to a local variable of PolymorphicInvoke - // so the compiler will typecheck that the passed in Run() method has - // the correct type. - PolymorphicInvoke invoke_func = - &cef_internal::BindState::InvokerType::Run; - polymorphic_invoke_ = reinterpret_cast(invoke_func); - } - - bool Equals(const Callback& other) const { - return CallbackBase::Equals(other); - } - - R Run(typename cef_internal::CallbackParamTraits::ForwardType a1, - typename cef_internal::CallbackParamTraits::ForwardType a2, - typename cef_internal::CallbackParamTraits::ForwardType a3, - typename cef_internal::CallbackParamTraits::ForwardType a4, - typename cef_internal::CallbackParamTraits::ForwardType a5, - typename cef_internal::CallbackParamTraits::ForwardType a6) const { - PolymorphicInvoke f = - reinterpret_cast(polymorphic_invoke_); - - return f( - bind_state_.get(), cef_internal::CallbackForward(a1), - cef_internal::CallbackForward(a2), cef_internal::CallbackForward(a3), - cef_internal::CallbackForward(a4), cef_internal::CallbackForward(a5), - cef_internal::CallbackForward(a6)); - } - - private: - typedef R (*PolymorphicInvoke)( - cef_internal::BindStateBase*, - typename cef_internal::CallbackParamTraits::ForwardType, - typename cef_internal::CallbackParamTraits::ForwardType, - typename cef_internal::CallbackParamTraits::ForwardType, - typename cef_internal::CallbackParamTraits::ForwardType, - typename cef_internal::CallbackParamTraits::ForwardType, - typename cef_internal::CallbackParamTraits::ForwardType); -}; - -template -class Callback - : public cef_internal::CallbackBase { - public: - typedef R(RunType)(A1, A2, A3, A4, A5, A6, A7); - - Callback() : CallbackBase(NULL) {} - - // Note that this constructor CANNOT be explicit, and that Bind() CANNOT - // return the exact Callback<> type. See base/bind.h for details. - template - Callback( - cef_internal::BindState* bind_state) - : CallbackBase(bind_state) { - // Force the assignment to a local variable of PolymorphicInvoke - // so the compiler will typecheck that the passed in Run() method has - // the correct type. - PolymorphicInvoke invoke_func = - &cef_internal::BindState::InvokerType::Run; - polymorphic_invoke_ = reinterpret_cast(invoke_func); - } - - bool Equals(const Callback& other) const { - return CallbackBase::Equals(other); - } - - R Run(typename cef_internal::CallbackParamTraits::ForwardType a1, - typename cef_internal::CallbackParamTraits::ForwardType a2, - typename cef_internal::CallbackParamTraits::ForwardType a3, - typename cef_internal::CallbackParamTraits::ForwardType a4, - typename cef_internal::CallbackParamTraits::ForwardType a5, - typename cef_internal::CallbackParamTraits::ForwardType a6, - typename cef_internal::CallbackParamTraits::ForwardType a7) const { - PolymorphicInvoke f = - reinterpret_cast(polymorphic_invoke_); - - return f( - bind_state_.get(), cef_internal::CallbackForward(a1), - cef_internal::CallbackForward(a2), cef_internal::CallbackForward(a3), - cef_internal::CallbackForward(a4), cef_internal::CallbackForward(a5), - cef_internal::CallbackForward(a6), cef_internal::CallbackForward(a7)); - } - - private: - typedef R (*PolymorphicInvoke)( - cef_internal::BindStateBase*, - typename cef_internal::CallbackParamTraits::ForwardType, - typename cef_internal::CallbackParamTraits::ForwardType, - typename cef_internal::CallbackParamTraits::ForwardType, - typename cef_internal::CallbackParamTraits::ForwardType, - typename cef_internal::CallbackParamTraits::ForwardType, - typename cef_internal::CallbackParamTraits::ForwardType, - typename cef_internal::CallbackParamTraits::ForwardType); -}; - -// Syntactic sugar to make Callbacks easier to declare since it -// will be used in a lot of APIs with delayed execution. -typedef Callback Closure; - } // namespace base #endif // !USING_CHROMIUM_INCLUDES diff --git a/include/base/cef_callback_forward.h b/include/base/cef_callback_forward.h index d604d7cf..3587fa46 100644 --- a/include/base/cef_callback_forward.h +++ b/include/base/cef_callback_forward.h @@ -32,12 +32,7 @@ #define INCLUDE_BASE_CEF_CALLBACK_FORWARD_H_ #pragma once -#if defined(BASE_CALLBACK_FORWARD_H_) -// Do nothing if the Chromium header has already been included. -// This can happen in cases where Chromium code is used directly by the -// client application. When using Chromium code directly always include -// the Chromium header first to avoid type conflicts. -#elif defined(USING_CHROMIUM_INCLUDES) +#if defined(USING_CHROMIUM_INCLUDES) // When building CEF include the Chromium header directly. #include "base/callback_forward.h" #else // !USING_CHROMIUM_INCLUDES @@ -47,10 +42,17 @@ namespace base { -template -class Callback; +template +class OnceCallback; -typedef Callback Closure; +template +class RepeatingCallback; + +// Syntactic sugar to make OnceClosure and RepeatingClosure +// easier to declare since they will be used in a lot of APIs with delayed +// execution. +using OnceClosure = OnceCallback; +using RepeatingClosure = RepeatingCallback; } // namespace base diff --git a/include/base/cef_callback_helpers.h b/include/base/cef_callback_helpers.h new file mode 100644 index 00000000..0d04e165 --- /dev/null +++ b/include/base/cef_callback_helpers.h @@ -0,0 +1,241 @@ +// Copyright (c) 2014 Marshall A. Greenblatt. Portions copyright (c) 2012 +// Google Inc. 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. + +// This defines helpful methods for dealing with Callbacks. Because Callbacks +// are implemented using templates, with a class per callback signature, adding +// methods to Callback<> itself is unattractive (lots of extra code gets +// generated). Instead, consider adding methods here. + +#ifndef CEF_INCLUDE_BASE_CEF_CALLBACK_HELPERS_H_ +#define CEF_INCLUDE_BASE_CEF_CALLBACK_HELPERS_H_ +#pragma once + +#if defined(USING_CHROMIUM_INCLUDES) +// When building CEF include the Chromium header directly. +#include "base/callback_helpers.h" +#else // !USING_CHROMIUM_INCLUDES +// The following is substantially similar to the Chromium implementation. +// If the Chromium implementation diverges the below implementation should be +// updated to match. + +#include +#include +#include +#include + +#include "include/base/cef_bind.h" +#include "include/base/cef_callback.h" +#include "include/base/cef_compiler_specific.h" +#include "include/base/cef_logging.h" + +namespace base { + +namespace internal { + +template +struct IsBaseCallbackImpl : std::false_type {}; + +template +struct IsBaseCallbackImpl> : std::true_type {}; + +template +struct IsBaseCallbackImpl> : std::true_type {}; + +template +struct IsOnceCallbackImpl : std::false_type {}; + +template +struct IsOnceCallbackImpl> : std::true_type {}; + +} // namespace internal + +// IsBaseCallback::value is true when T is any of the Closure or Callback +// family of types. +template +using IsBaseCallback = internal::IsBaseCallbackImpl>; + +// IsOnceCallback::value is true when T is a OnceClosure or OnceCallback +// type. +template +using IsOnceCallback = internal::IsOnceCallbackImpl>; + +// SFINAE friendly enabler allowing to overload methods for both Repeating and +// OnceCallbacks. +// +// Usage: +// template