fix: offscreen rendering does not paint after gpu process crashed (#41904)
Co-authored-by: zhangqi.67 <zhangqi.67@bytedance.com>
This commit is contained in:
parent
a8db7fe2ef
commit
46adb0a3a9
2 changed files with 29 additions and 3 deletions
|
@ -230,6 +230,7 @@ OffScreenRenderWidgetHostView::OffScreenRenderWidgetHostView(
|
|||
|
||||
ResizeRootLayer(false);
|
||||
render_widget_host_->SetView(this);
|
||||
render_widget_host_->render_frame_metadata_provider()->AddObserver(this);
|
||||
|
||||
if (content::GpuDataManager::GetInstance()->HardwareAccelerationEnabled()) {
|
||||
video_consumer_ = std::make_unique<OffScreenVideoConsumer>(
|
||||
|
@ -240,7 +241,21 @@ OffScreenRenderWidgetHostView::OffScreenRenderWidgetHostView(
|
|||
}
|
||||
}
|
||||
|
||||
void OffScreenRenderWidgetHostView::OnLocalSurfaceIdChanged(
|
||||
const cc::RenderFrameMetadata& metadata) {
|
||||
if (metadata.local_surface_id) {
|
||||
bool changed = delegated_frame_host_allocator_.UpdateFromChild(
|
||||
*metadata.local_surface_id);
|
||||
|
||||
if (changed) {
|
||||
ResizeRootLayer(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
OffScreenRenderWidgetHostView::~OffScreenRenderWidgetHostView() {
|
||||
render_widget_host_->render_frame_metadata_provider()->RemoveObserver(this);
|
||||
|
||||
// Marking the DelegatedFrameHost as removed from the window hierarchy is
|
||||
// necessary to remove all connections to its old ui::Compositor.
|
||||
if (is_showing_)
|
||||
|
|
|
@ -59,9 +59,11 @@ typedef base::RepeatingCallback<void(const gfx::Rect&, const SkBitmap&)>
|
|||
OnPaintCallback;
|
||||
typedef base::RepeatingCallback<void(const gfx::Rect&)> OnPopupPaintCallback;
|
||||
|
||||
class OffScreenRenderWidgetHostView : public content::RenderWidgetHostViewBase,
|
||||
public ui::CompositorDelegate,
|
||||
public OffscreenViewProxyObserver {
|
||||
class OffScreenRenderWidgetHostView
|
||||
: public content::RenderWidgetHostViewBase,
|
||||
public content::RenderFrameMetadataProvider::Observer,
|
||||
public ui::CompositorDelegate,
|
||||
public OffscreenViewProxyObserver {
|
||||
public:
|
||||
OffScreenRenderWidgetHostView(bool transparent,
|
||||
bool painting,
|
||||
|
@ -175,6 +177,15 @@ class OffScreenRenderWidgetHostView : public content::RenderWidgetHostViewBase,
|
|||
RenderWidgetHostViewBase* target_view,
|
||||
gfx::PointF* transformed_point) override;
|
||||
|
||||
// RenderFrameMetadataProvider::Observer:
|
||||
void OnRenderFrameMetadataChangedBeforeActivation(
|
||||
const cc::RenderFrameMetadata& metadata) override {}
|
||||
void OnRenderFrameMetadataChangedAfterActivation(
|
||||
base::TimeTicks activation_time) override {}
|
||||
void OnRenderFrameSubmission() override {}
|
||||
void OnLocalSurfaceIdChanged(
|
||||
const cc::RenderFrameMetadata& metadata) override;
|
||||
|
||||
// ui::CompositorDelegate:
|
||||
bool IsOffscreen() const override;
|
||||
std::unique_ptr<viz::HostDisplayClient> CreateHostDisplayClient(
|
||||
|
|
Loading…
Reference in a new issue