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

@@ -11,15 +11,27 @@
CefBrowserPlatformDelegateNative::CefBrowserPlatformDelegateNative(
const CefWindowInfo& window_info,
SkColor background_color)
SkColor background_color,
bool use_shared_texture,
bool use_external_begin_frame)
: window_info_(window_info),
background_color_(background_color),
use_shared_texture_(use_shared_texture),
use_external_begin_frame_(use_external_begin_frame),
windowless_handler_(nullptr) {}
SkColor CefBrowserPlatformDelegateNative::GetBackgroundColor() const {
return background_color_;
}
bool CefBrowserPlatformDelegateNative::CanUseSharedTexture() const {
return use_shared_texture_;
}
bool CefBrowserPlatformDelegateNative::CanUseExternalBeginFrame() const {
return use_external_begin_frame_;
}
void CefBrowserPlatformDelegateNative::SynchronizeVisualProperties() {
content::RenderViewHost* host = browser_->web_contents()->GetRenderViewHost();
if (host)

View File

@@ -25,6 +25,8 @@ class CefBrowserPlatformDelegateNative : public CefBrowserPlatformDelegate {
};
// CefBrowserPlatformDelegate methods:
bool CanUseSharedTexture() const override;
bool CanUseExternalBeginFrame() const override;
SkColor GetBackgroundColor() const override;
void SynchronizeVisualProperties() override;
void SendKeyEvent(const content::NativeWebKeyboardEvent& event) override;
@@ -41,10 +43,14 @@ class CefBrowserPlatformDelegateNative : public CefBrowserPlatformDelegate {
protected:
CefBrowserPlatformDelegateNative(const CefWindowInfo& window_info,
SkColor background_color);
SkColor background_color,
bool use_shared_texture,
bool use_external_begin_frame);
CefWindowInfo window_info_;
const SkColor background_color_;
const bool use_shared_texture_;
const bool use_external_begin_frame_;
WindowlessHandler* windowless_handler_; // Not owned by this object.
};

View File

@@ -41,7 +41,10 @@ long GetSystemUptime() {
CefBrowserPlatformDelegateNativeLinux::CefBrowserPlatformDelegateNativeLinux(
const CefWindowInfo& window_info,
SkColor background_color)
: CefBrowserPlatformDelegateNative(window_info, background_color),
: CefBrowserPlatformDelegateNative(window_info,
background_color,
false,
false),
host_window_created_(false),
window_widget_(nullptr),
window_x11_(nullptr) {}

View File

@@ -144,7 +144,10 @@ NSUInteger NativeModifiers(int cef_modifiers) {
CefBrowserPlatformDelegateNativeMac::CefBrowserPlatformDelegateNativeMac(
const CefWindowInfo& window_info,
SkColor background_color)
: CefBrowserPlatformDelegateNative(window_info, background_color),
: CefBrowserPlatformDelegateNative(window_info,
background_color,
false,
false),
host_window_created_(false) {}
void CefBrowserPlatformDelegateNativeMac::BrowserDestroyed(

View File

@@ -125,8 +125,13 @@ float GetWindowScaleFactor(HWND hwnd) {
CefBrowserPlatformDelegateNativeWin::CefBrowserPlatformDelegateNativeWin(
const CefWindowInfo& window_info,
SkColor background_color)
: CefBrowserPlatformDelegateNative(window_info, background_color),
SkColor background_color,
bool use_shared_texture,
bool use_external_begin_frame)
: CefBrowserPlatformDelegateNative(window_info,
background_color,
use_shared_texture,
use_external_begin_frame),
host_window_created_(false),
window_widget_(nullptr) {}

View File

@@ -14,7 +14,9 @@ class CefBrowserPlatformDelegateNativeWin
: public CefBrowserPlatformDelegateNative {
public:
CefBrowserPlatformDelegateNativeWin(const CefWindowInfo& window_info,
SkColor background_color);
SkColor background_color,
bool use_shared_texture,
bool use_external_begin_frame);
// CefBrowserPlatformDelegate methods:
void BrowserDestroyed(CefBrowserHostImpl* browser) override;