fix: update and enable osr (#15046)

* fix: update and enable osr

* fix: update MacHelper view to call GetNativeView

* style: move stuff around to make more sense

* chore: move OSR related things in SetOwnerWindow to CommonWebContentsDelegate

* fix: avoid crashing when GetOffscreenRenderWidgetHostView is called

* fix: specify default for current_device_scale_factor_
This commit is contained in:
Shelley Vohr 2018-10-11 06:14:01 -07:00 committed by John Kleinschmidt
parent d46834265f
commit ba9a55c391
10 changed files with 176 additions and 58 deletions

View file

@ -30,6 +30,7 @@
#include "components/prefs/scoped_user_pref_update.h"
#include "components/security_state/content/content_utils.h"
#include "components/security_state/core/security_state.h"
#include "content/browser/renderer_host/render_widget_host_view_base.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/child_process_security_policy.h"
#include "content/public/browser/render_process_host.h"
@ -39,6 +40,10 @@
#include "content/public/browser/security_style_explanations.h"
#include "storage/browser/fileapi/isolated_context.h"
#if BUILDFLAG(ENABLE_OSR)
#include "atom/browser/osr/osr_render_widget_host_view.h"
#endif
using content::BrowserThread;
namespace atom {
@ -201,6 +206,11 @@ void CommonWebContentsDelegate::SetOwnerWindow(
web_contents->RemoveUserData(
NativeWindowRelay::kNativeWindowRelayUserDataKey);
}
#if BUILDFLAG(ENABLE_OSR)
auto* osr_rwhv = GetOffScreenRenderWidgetHostView();
if (osr_rwhv)
osr_rwhv->SetNativeWindow(owner_window);
#endif
}
void CommonWebContentsDelegate::ResetManagedWebContents(bool async) {
@ -236,6 +246,13 @@ content::WebContents* CommonWebContentsDelegate::GetDevToolsWebContents()
return web_contents_->GetDevToolsWebContents();
}
#if BUILDFLAG(ENABLE_OSR)
OffScreenRenderWidgetHostView*
CommonWebContentsDelegate::GetOffScreenRenderWidgetHostView() const {
return nullptr;
}
#endif
content::WebContents* CommonWebContentsDelegate::OpenURLFromTab(
content::WebContents* source,
const content::OpenURLParams& params) {