void RenderWidgetHostImpl::SetView(RenderWidgetHostViewBase* view) {
if (view) {
view_ = view->GetWeakPtr();
+#if defined(USE_EFL)
+ if (renderer_compositor_frame_sink_.is_bound()) {
+ view->DidCreateNewRendererCompositorFrameSink(
+ renderer_compositor_frame_sink_.get());
+ }
+ // Views start out not needing begin frames, so only update its state
+ // if the value has changed.
+ if (needs_begin_frames_)
+ view_->SetNeedsBeginFrames(needs_begin_frames_);
+#else
if (!create_frame_sink_callback_.is_null())
std::move(create_frame_sink_callback_).Run(view_->GetFrameSinkId());
+#endif
} else {
view_.reset();
}
compositor_frame_sink_receiver,
mojo::PendingRemote<viz::mojom::CompositorFrameSinkClient>
compositor_frame_sink_client) {
+#if defined(USE_EFL)
+ compositor_frame_sink_receiver_.reset();
+ compositor_frame_sink_receiver_.Bind(
+ std::move(compositor_frame_sink_receiver),
+ BrowserMainLoop::GetInstance()->GetResizeTaskRunner());
+
+ renderer_compositor_frame_sink_.reset();
+ renderer_compositor_frame_sink_.Bind(std::move(compositor_frame_sink_client));
+ auto* compositor_frame_sink_client_ptr =
+ renderer_compositor_frame_sink_.get();
+
+ if (view_) {
+ view_->DidCreateNewRendererCompositorFrameSink(
+ compositor_frame_sink_client_ptr);
+ }
+#else
// Connects the viz process end of CompositorFrameSink message pipes. The
// renderer compositor may request a new CompositorFrameSink on context
// loss, which will destroy the existing CompositorFrameSink.
std::move(callback).Run(view_->GetFrameSinkId());
else
create_frame_sink_callback_ = std::move(callback);
+#endif
}
void RenderWidgetHostImpl::RegisterRenderFrameMetadataObserver(
return true;
}
+#if defined(USE_EFL)
+void RenderWidgetHostImpl::SetNeedsBeginFrame(bool needs_begin_frames) {
+ if (needs_begin_frames_ == needs_begin_frames)
+ return;
+
+ needs_begin_frames_ = needs_begin_frames;
+ if (view_)
+ view_->SetNeedsBeginFrames(needs_begin_frames_);
+}
+
+void RenderWidgetHostImpl::SetWantsAnimateOnlyBeginFrames() {}
+
+void RenderWidgetHostImpl::SubmitCompositorFrame(
+ const viz::LocalSurfaceId& local_surface_id,
+ viz::CompositorFrame frame,
+ base::Optional<viz::HitTestRegionList> hit_test_region_list,
+ uint64_t submit_time) {
+ if (view_) {
+ view_->SubmitCompositorFrame(local_surface_id, std::move(frame),
+ std::move(hit_test_region_list));
+ } else {
+ std::vector<viz::ReturnedResource> resources =
+ viz::TransferableResource::ReturnResources(frame.resource_list);
+ renderer_compositor_frame_sink_->DidReceiveCompositorFrameAck(resources);
+ }
+}
+
+void RenderWidgetHostImpl::SubmitCompositorFrameSync(
+ const viz::LocalSurfaceId& local_surface_id,
+ viz::CompositorFrame frame,
+ base::Optional<viz::HitTestRegionList> hit_test_region_list,
+ uint64_t submit_time,
+ const SubmitCompositorFrameSyncCallback callback) {}
+
+void RenderWidgetHostImpl::DidNotProduceFrame(const viz::BeginFrameAck& ack) {}
+
+void RenderWidgetHostImpl::DidAllocateSharedBitmap(
+ base::ReadOnlySharedMemoryRegion region,
+ const viz::SharedBitmapId& id) {}
+
+void RenderWidgetHostImpl::DidDeleteSharedBitmap(
+ const viz::SharedBitmapId& id) {}
+
+void RenderWidgetHostImpl::InitializeCompositorFrameSinkType(
+ viz::mojom::CompositorFrameSinkType type) {}
+#endif
+
void RenderWidgetHostImpl::DidProcessFrame(uint32_t frame_token) {
frame_token_message_queue_->DidProcessFrame(frame_token);
}
public RenderProcessHostImpl::PriorityClient,
public RenderProcessHostObserver,
public SyntheticGestureController::Delegate,
+#if defined(USE_EFL)
+ public viz::mojom::CompositorFrameSink,
+#endif
public IPC::Listener,
public RenderFrameMetadataProvider::Observer,
public blink::mojom::FrameWidgetHost,
bool HasGestureStopped() override;
+#if defined(USE_EFL)
+ // viz::mojom::CompositorFrameSink implementation.
+ void SetNeedsBeginFrame(bool needs_begin_frame) override;
+ void SetWantsAnimateOnlyBeginFrames() override;
+ void SubmitCompositorFrame(
+ const viz::LocalSurfaceId& local_surface_id,
+ viz::CompositorFrame frame,
+ base::Optional<viz::HitTestRegionList> hit_test_region_list,
+ uint64_t submit_time) override;
+ void SubmitCompositorFrameSync(
+ const viz::LocalSurfaceId& local_surface_id,
+ viz::CompositorFrame frame,
+ base::Optional<viz::HitTestRegionList> hit_test_region_list,
+ uint64_t submit_time,
+ const SubmitCompositorFrameSyncCallback callback) override;
+ void DidNotProduceFrame(const viz::BeginFrameAck& ack) override;
+ void DidAllocateSharedBitmap(base::ReadOnlySharedMemoryRegion region,
+ const viz::SharedBitmapId& id) override;
+ void DidDeleteSharedBitmap(const viz::SharedBitmapId& id) override;
+ void InitializeCompositorFrameSinkType(
+ viz::mojom::CompositorFrameSinkType type) override;
+#endif
+
// Signals that a frame with token |frame_token| was finished processing. If
// there are any queued messages belonging to it, they will be processed.
void DidProcessFrame(uint32_t frame_token);
mojo::Remote<device::mojom::WakeLock> wake_lock_;
#endif
+#if defined(USE_EFL)
+ bool needs_begin_frames_ = false;
+ mojo::Receiver<viz::mojom::CompositorFrameSink>
+ compositor_frame_sink_receiver_{this};
+ mojo::Remote<viz::mojom::CompositorFrameSinkClient>
+ renderer_compositor_frame_sink_;
+#else
// Stash a request to create a CompositorFrameSink if it arrives before we
// have a view.
base::OnceCallback<void(const viz::FrameSinkId&)> create_frame_sink_callback_;
+#endif
std::unique_ptr<FrameTokenMessageQueue> frame_token_message_queue_;
#include "ui/gfx/range/range.h"
#include "ui/surface/transport_dib.h"
+#if defined(USE_EFL)
+#include "components/viz/common/quads/compositor_frame.h"
+#include "services/viz/public/mojom/compositing/compositor_frame_sink.mojom.h"
+#endif
+
namespace blink {
class WebMouseEvent;
class WebMouseWheelEvent;
virtual void FocusedNodeChanged(bool is_editable_node,
const gfx::Rect& node_bounds_in_screen) {}
+#if defined(USE_EFL)
+ // This method is called by the RenderWidgetHostImpl when a new
+ // RendererCompositorFrameSink is created in the renderer. The view is
+ // expected not to return resources belonging to the old
+ // RendererCompositorFrameSink after this method finishes.
+ virtual void DidCreateNewRendererCompositorFrameSink(
+ viz::mojom::CompositorFrameSinkClient* renderer_compositor_frame_sink) {}
+
+ // This is called by the RenderWidgetHostImpl to provide a new compositor
+ // frame that was received from the renderer process. if Viz service hit
+ // testing is enabled then a HitTestRegionList provides hit test data
+ // that is used for routing input events.
+ // TODO(kenrb): When Viz service is enabled on all platforms,
+ // |hit_test_region_list| should stop being an optional argument.
+ virtual void SubmitCompositorFrame(
+ const viz::LocalSurfaceId& local_surface_id,
+ viz::CompositorFrame frame,
+ base::Optional<viz::HitTestRegionList> hit_test_region_list) {}
+
+ // Informs the view that its associated render widget has frames to draw and
+ // wants to have BeginFrame messages sent to it. This should only be called
+ // when the value has changed. Views must initially default to false.
+ virtual void SetNeedsBeginFrames(bool needs_begin_frames) {}
+#endif
+
// This method will reset the fallback to the first surface after navigation.
virtual void ResetFallbackToFirstNavigationSurface() = 0;
size_t,
const gfx::Range&) override;
void SetWantsAnimateOnlyBeginFrames();
- void SetNeedsBeginFrames(bool needs_begin_frames);
+ void SetNeedsBeginFrames(bool needs_begin_frames) override;
void DidOverscroll(const ui::DidOverscrollParams& params) override;
gfx::Rect GetBoundsInRootWindow() override;
void RenderProcessGone() override;
void HandleDisambiguationPopupMouseUpEvent(Evas_Event_Mouse_Up*);
void DidCreateNewRendererCompositorFrameSink(
- viz::mojom::CompositorFrameSinkClient* renderer_compositor_frame_sink);
+ viz::mojom::CompositorFrameSinkClient* renderer_compositor_frame_sink)
+ override;
void SubmitCompositorFrame(
const viz::LocalSurfaceId& local_surface_id,
viz::CompositorFrame frame,
- base::Optional<viz::HitTestRegionList> hit_test_region_list);
+ base::Optional<viz::HitTestRegionList> hit_test_region_list) override;
void ClearCompositorFrame();
void ResetFallbackToFirstNavigationSurface() override;