fix: update and re-enable OSR

This commit is contained in:
Heilig Benedek 2018-11-07 20:17:53 +01:00 committed by deepak1556
parent 00294a5b25
commit 8727636fcc
3 changed files with 10 additions and 19 deletions

View file

@ -275,7 +275,6 @@ OffScreenRenderWidgetHostView::OffScreenRenderWidgetHostView(
#if !defined(OS_MACOSX)
delegated_frame_host_ = std::make_unique<content::DelegatedFrameHost>(
AllocateFrameSinkId(is_guest_view_hack), this,
base::FeatureList::IsEnabled(features::kVizDisplayCompositor),
true /* should_register_frame_sink_id */);
root_layer_.reset(new ui::Layer(ui::LAYER_SOLID_COLOR));
@ -325,7 +324,7 @@ OffScreenRenderWidgetHostView::~OffScreenRenderWidgetHostView() {
// necessary to remove all connections to its old ui::Compositor.
if (is_showing_)
delegated_frame_host_->WasHidden();
delegated_frame_host_->ResetCompositor();
delegated_frame_host_->DetachFromCompositor();
#endif
if (copy_frame_generator_.get())
@ -431,7 +430,7 @@ void OffScreenRenderWidgetHostView::Show() {
#if defined(OS_MACOSX)
browser_compositor_->SetRenderWidgetHostIsHidden(false);
#else
delegated_frame_host_->SetCompositor(compositor_.get());
delegated_frame_host_->AttachToCompositor(compositor_.get());
delegated_frame_host_->WasShown(GetLocalSurfaceId(),
GetRootLayer()->bounds().size(), false);
#endif
@ -451,7 +450,7 @@ void OffScreenRenderWidgetHostView::Hide() {
browser_compositor_->SetRenderWidgetHostIsHidden(true);
#else
GetDelegatedFrameHost()->WasHidden();
GetDelegatedFrameHost()->ResetCompositor();
GetDelegatedFrameHost()->DetachFromCompositor();
#endif
is_showing_ = false;
@ -589,6 +588,10 @@ void OffScreenRenderWidgetHostView::ClearCompositorFrame() {
GetDelegatedFrameHost()->ClearDelegatedFrame();
}
void OffScreenRenderWidgetHostView::ResetFallbackToFirstNavigationSurface() {
GetDelegatedFrameHost()->ResetFallbackToFirstNavigationSurface();
}
void OffScreenRenderWidgetHostView::InitAsPopup(
content::RenderWidgetHostView* parent_host_view,
const gfx::Rect& pos) {
@ -746,7 +749,7 @@ ui::Layer* OffScreenRenderWidgetHostView::DelegatedFrameHostGetLayer() const {
}
bool OffScreenRenderWidgetHostView::DelegatedFrameHostIsVisible() const {
return !render_widget_host_->is_hidden();
return is_showing_;
}
SkColor OffScreenRenderWidgetHostView::DelegatedFrameHostGetGutterColor()
@ -767,10 +770,6 @@ void OffScreenRenderWidgetHostView::OnFrameTokenChanged(uint32_t frame_token) {
render_widget_host_->DidProcessFrame(frame_token);
}
void OffScreenRenderWidgetHostView::DidReceiveFirstFrameAfterNavigation() {
render_widget_host_->DidReceiveFirstFrameAfterNavigation();
}
const viz::LocalSurfaceId& OffScreenRenderWidgetHostView::GetLocalSurfaceId()
const {
return local_surface_id_;
@ -820,11 +819,7 @@ bool OffScreenRenderWidgetHostView::TransformPointToCoordSpaceForView(
return true;
}
// In TransformPointToLocalCoordSpace() there is a Point-to-Pixel conversion,
// but it is not necessary here because the final target view is responsible
// for converting before computing the final transform.
return GetDelegatedFrameHost()->TransformPointToCoordSpaceForView(
point, target_view, transformed_point, source);
return false;
}
void OffScreenRenderWidgetHostView::CancelWidget() {

View file

@ -132,6 +132,7 @@ class OffScreenRenderWidgetHostView : public content::RenderWidgetHostViewBase,
base::Optional<viz::HitTestRegionList> hit_test_region_list) override;
void ClearCompositorFrame(void) override;
void ResetFallbackToFirstNavigationSurface() override;
void InitAsPopup(content::RenderWidgetHostView* rwhv,
const gfx::Rect& rect) override;
void InitAsFullscreen(content::RenderWidgetHostView*) override;
@ -178,7 +179,6 @@ class OffScreenRenderWidgetHostView : public content::RenderWidgetHostViewBase,
void OnFirstSurfaceActivation(const viz::SurfaceInfo& surface_info) override;
void OnBeginFrame(base::TimeTicks frame_time) override;
void OnFrameTokenChanged(uint32_t frame_token) override;
void DidReceiveFirstFrameAfterNavigation() override;
#endif // !defined(OS_MACOSX)
const viz::LocalSurfaceId& GetLocalSurfaceId() const override;

View file

@ -42,10 +42,6 @@ class MacHelper : public content::BrowserCompositorMacClient,
void AcceleratedWidgetCALayerParamsUpdated() override {}
void DidReceiveFirstFrameAfterNavigation() override {
view_->render_widget_host()->DidReceiveFirstFrameAfterNavigation();
}
void DestroyCompositorForShutdown() override {}
bool SynchronizeVisualProperties(