Add support for shared texture and external BeginFrame in OSR mode (issue #1006)

- Add CefWindowInfo::shared_texture_enabled and
  CefRenderHandler::OnAcceleratedPaint for shared texture support. Currently
  only supported on Windows (D3D11).
- Add CefWindowInfo::external_begin_frame_enabled and
  CefBrowserHost::SendExternalBeginFrame for external begin frame support.
This commit is contained in:
Greg Wessels
2018-07-02 19:46:03 -05:00
committed by Marshall Greenblatt
parent 09afa3a843
commit 713eebcafc
43 changed files with 2339 additions and 156 deletions

View File

@@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=099ec6c9deac65288a47cec317ab6b355e707179$
// $hash=2357c186875d3086fa4931a3ac8346d866cab1e3$
//
#include "libcef_dll/cpptoc/browser_host_cpptoc.h"
@@ -615,6 +615,18 @@ void CEF_CALLBACK browser_host_invalidate(struct _cef_browser_host_t* self,
CefBrowserHostCppToC::Get(self)->Invalidate(type);
}
void CEF_CALLBACK
browser_host_send_external_begin_frame(struct _cef_browser_host_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return;
// Execute
CefBrowserHostCppToC::Get(self)->SendExternalBeginFrame();
}
void CEF_CALLBACK
browser_host_send_key_event(struct _cef_browser_host_t* self,
const struct _cef_key_event_t* event) {
@@ -1111,6 +1123,8 @@ CefBrowserHostCppToC::CefBrowserHostCppToC() {
GetStruct()->notify_screen_info_changed =
browser_host_notify_screen_info_changed;
GetStruct()->invalidate = browser_host_invalidate;
GetStruct()->send_external_begin_frame =
browser_host_send_external_begin_frame;
GetStruct()->send_key_event = browser_host_send_key_event;
GetStruct()->send_mouse_click_event = browser_host_send_mouse_click_event;
GetStruct()->send_mouse_move_event = browser_host_send_mouse_move_event;

View File

@@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=6cf6466ab2a1b87a1b57b5994aab64992b9f12dd$
// $hash=8df4ed4bd6e80bd90fb9563a021a59848fc40ecc$
//
#include "libcef_dll/cpptoc/render_handler_cpptoc.h"
@@ -266,6 +266,45 @@ void CEF_CALLBACK render_handler_on_paint(struct _cef_render_handler_t* self,
width, height);
}
void CEF_CALLBACK
render_handler_on_accelerated_paint(struct _cef_render_handler_t* self,
cef_browser_t* browser,
cef_paint_element_type_t type,
size_t dirtyRectsCount,
cef_rect_t const* dirtyRects,
void* shared_handle) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return;
// Verify param: browser; type: refptr_diff
DCHECK(browser);
if (!browser)
return;
// Verify param: dirtyRects; type: simple_vec_byref_const
DCHECK(dirtyRectsCount == 0 || dirtyRects);
if (dirtyRectsCount > 0 && !dirtyRects)
return;
// Verify param: shared_handle; type: simple_byaddr
DCHECK(shared_handle);
if (!shared_handle)
return;
// Translate param: dirtyRects; type: simple_vec_byref_const
std::vector<CefRect> dirtyRectsList;
if (dirtyRectsCount > 0) {
for (size_t i = 0; i < dirtyRectsCount; ++i) {
CefRect dirtyRectsVal = dirtyRects[i];
dirtyRectsList.push_back(dirtyRectsVal);
}
}
// Execute
CefRenderHandlerCppToC::Get(self)->OnAcceleratedPaint(
CefBrowserCToCpp::Wrap(browser), type, dirtyRectsList, shared_handle);
}
void CEF_CALLBACK render_handler_on_cursor_change(
struct _cef_render_handler_t* self,
cef_browser_t* browser,
@@ -444,6 +483,7 @@ CefRenderHandlerCppToC::CefRenderHandlerCppToC() {
GetStruct()->on_popup_show = render_handler_on_popup_show;
GetStruct()->on_popup_size = render_handler_on_popup_size;
GetStruct()->on_paint = render_handler_on_paint;
GetStruct()->on_accelerated_paint = render_handler_on_accelerated_paint;
GetStruct()->on_cursor_change = render_handler_on_cursor_change;
GetStruct()->start_dragging = render_handler_start_dragging;
GetStruct()->update_drag_cursor = render_handler_update_drag_cursor;

View File

@@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=9a1691bbc0a509032dd60b463189dd1eb0f6cc4d$
// $hash=5d699bfd2e9f2d689a5bca3372563b1578fa1ba1$
//
#include "libcef_dll/ctocpp/browser_host_ctocpp.h"
@@ -557,6 +557,17 @@ void CefBrowserHostCToCpp::Invalidate(PaintElementType type) {
_struct->invalidate(_struct, type);
}
NO_SANITIZE("cfi-icall") void CefBrowserHostCToCpp::SendExternalBeginFrame() {
cef_browser_host_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, send_external_begin_frame))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
_struct->send_external_begin_frame(_struct);
}
NO_SANITIZE("cfi-icall")
void CefBrowserHostCToCpp::SendKeyEvent(const CefKeyEvent& event) {
cef_browser_host_t* _struct = GetStruct();

View File

@@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=39ab8db08e667fac8e6dccffaa99935d8aa7d4b5$
// $hash=0a61852aa1a8c8c808e9d2258e09a0fa341056e0$
//
#ifndef CEF_LIBCEF_DLL_CTOCPP_BROWSER_HOST_CTOCPP_H_
@@ -86,6 +86,7 @@ class CefBrowserHostCToCpp : public CefCToCppRefCounted<CefBrowserHostCToCpp,
void WasHidden(bool hidden) OVERRIDE;
void NotifyScreenInfoChanged() OVERRIDE;
void Invalidate(PaintElementType type) OVERRIDE;
void SendExternalBeginFrame() OVERRIDE;
void SendKeyEvent(const CefKeyEvent& event) OVERRIDE;
void SendMouseClickEvent(const CefMouseEvent& event,
MouseButtonType type,

View File

@@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=db89496c825cdc7fe1eaa4b7822d8492ae3a3f23$
// $hash=3c149c932cf4ebd4b2b8c81102851ebd1d6c1d63$
//
#include "libcef_dll/ctocpp/render_handler_ctocpp.h"
@@ -204,6 +204,48 @@ void CefRenderHandlerCToCpp::OnPaint(CefRefPtr<CefBrowser> browser,
delete[] dirtyRectsList;
}
NO_SANITIZE("cfi-icall")
void CefRenderHandlerCToCpp::OnAcceleratedPaint(CefRefPtr<CefBrowser> browser,
PaintElementType type,
const RectList& dirtyRects,
void* shared_handle) {
cef_render_handler_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, on_accelerated_paint))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Verify param: browser; type: refptr_diff
DCHECK(browser.get());
if (!browser.get())
return;
// Verify param: shared_handle; type: simple_byaddr
DCHECK(shared_handle);
if (!shared_handle)
return;
// Translate param: dirtyRects; type: simple_vec_byref_const
const size_t dirtyRectsCount = dirtyRects.size();
cef_rect_t* dirtyRectsList = NULL;
if (dirtyRectsCount > 0) {
dirtyRectsList = new cef_rect_t[dirtyRectsCount];
DCHECK(dirtyRectsList);
if (dirtyRectsList) {
for (size_t i = 0; i < dirtyRectsCount; ++i) {
dirtyRectsList[i] = dirtyRects[i];
}
}
}
// Execute
_struct->on_accelerated_paint(_struct, CefBrowserCppToC::Wrap(browser), type,
dirtyRectsCount, dirtyRectsList, shared_handle);
// Restore param:dirtyRects; type: simple_vec_byref_const
if (dirtyRectsList)
delete[] dirtyRectsList;
}
NO_SANITIZE("cfi-icall")
void CefRenderHandlerCToCpp::OnCursorChange(
CefRefPtr<CefBrowser> browser,

View File

@@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=46dd8560076264a776129a02ba11e2c2f56bf209$
// $hash=2f19b04733f565830f873853695e9163086a8ee0$
//
#ifndef CEF_LIBCEF_DLL_CTOCPP_RENDER_HANDLER_CTOCPP_H_
@@ -52,6 +52,10 @@ class CefRenderHandlerCToCpp
const void* buffer,
int width,
int height) override;
void OnAcceleratedPaint(CefRefPtr<CefBrowser> browser,
PaintElementType type,
const RectList& dirtyRects,
void* shared_handle) override;
void OnCursorChange(CefRefPtr<CefBrowser> browser,
CefCursorHandle cursor,
CursorType type,