Add a shared memory variant of CefProcessMessage (fixes issue #3126)

CefSharedProcessMessageBuilder supports creation of a CefProcessMessage
backed by a CefSharedMemoryRegion.

Performance tests comparing the existing ArgumentList approach and the new
SharedMemoryRegion approach have been added to cefclient at
http://tests/ipc_performance.

CefMessageRouter has been updated to use SharedMemoryRegion as transport
for larger message payloads. The threshold is configurable via
|CefMessageRouterConfig.message_size_threshold|.

To test:
run `ceftests --gtest_filter=SendSharedProcessMessageTest.*:SharedProcessMessageTest.*:MessageRouterTest.Threshold*`
This commit is contained in:
Nik Pavlov
2022-07-04 09:49:15 +00:00
committed by Marshall Greenblatt
parent a931d49f3e
commit 81e892d19e
55 changed files with 4025 additions and 1132 deletions

View File

@@ -9,11 +9,12 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=7ab779c6c98a1bd2385f14d514304a28ef58717f$
// $hash=0f16a0f4711caf0b3761bf6480622de2e75b72ef$
//
#include "libcef_dll/ctocpp/process_message_ctocpp.h"
#include "libcef_dll/ctocpp/list_value_ctocpp.h"
#include "libcef_dll/ctocpp/shared_memory_region_ctocpp.h"
#include "libcef_dll/shutdown_checker.h"
// STATIC METHODS - Body may be edited by hand.
@@ -122,6 +123,25 @@ CefRefPtr<CefListValue> CefProcessMessageCToCpp::GetArgumentList() {
return CefListValueCToCpp::Wrap(_retval);
}
NO_SANITIZE("cfi-icall")
CefRefPtr<CefSharedMemoryRegion>
CefProcessMessageCToCpp::GetSharedMemoryRegion() {
shutdown_checker::AssertNotShutdown();
cef_process_message_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_shared_memory_region))
return nullptr;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_shared_memory_region_t* _retval =
_struct->get_shared_memory_region(_struct);
// Return type: refptr_same
return CefSharedMemoryRegionCToCpp::Wrap(_retval);
}
// CONSTRUCTOR - Do not edit by hand.
CefProcessMessageCToCpp::CefProcessMessageCToCpp() {}