| Index: cc/surfaces/direct_compositor_frame_sink.cc
|
| diff --git a/cc/surfaces/direct_compositor_frame_sink.cc b/cc/surfaces/direct_compositor_frame_sink.cc
|
| index 7d79f442a67e5ebb2d9eec74dc49a3fbc302824d..b96cbbc93a327958a5e5940e418868020db009aa 100644
|
| --- a/cc/surfaces/direct_compositor_frame_sink.cc
|
| +++ b/cc/surfaces/direct_compositor_frame_sink.cc
|
| @@ -21,17 +21,13 @@ DirectCompositorFrameSink::DirectCompositorFrameSink(
|
| scoped_refptr<ContextProvider> context_provider,
|
| scoped_refptr<ContextProvider> worker_context_provider)
|
| : CompositorFrameSink(std::move(context_provider),
|
| - std::move(worker_context_provider),
|
| - nullptr),
|
| + std::move(worker_context_provider)),
|
| surface_manager_(surface_manager),
|
| surface_id_allocator_(surface_id_allocator),
|
| display_(display),
|
| factory_(surface_manager, this) {
|
| DCHECK(thread_checker_.CalledOnValidThread());
|
| - capabilities_.delegated_rendering = true;
|
| - capabilities_.adjust_deadline_for_parent = true;
|
| capabilities_.can_force_reclaim_resources = true;
|
| -
|
| // Display and DirectCompositorFrameSink share a GL context, so sync
|
| // points aren't needed when passing resources between them.
|
| capabilities_.delegated_sync_points_required = false;
|
| @@ -49,8 +45,6 @@ DirectCompositorFrameSink::DirectCompositorFrameSink(
|
| display_(display),
|
| factory_(surface_manager, this) {
|
| DCHECK(thread_checker_.CalledOnValidThread());
|
| - capabilities_.delegated_rendering = true;
|
| - capabilities_.adjust_deadline_for_parent = true;
|
| capabilities_.can_force_reclaim_resources = true;
|
| }
|
|
|
| @@ -60,26 +54,6 @@ DirectCompositorFrameSink::~DirectCompositorFrameSink() {
|
| DetachFromClient();
|
| }
|
|
|
| -void DirectCompositorFrameSink::SwapBuffers(CompositorFrame frame) {
|
| - gfx::Size frame_size =
|
| - frame.delegated_frame_data->render_pass_list.back()->output_rect.size();
|
| - if (frame_size.IsEmpty() || frame_size != last_swap_frame_size_) {
|
| - if (!delegated_surface_id_.is_null()) {
|
| - factory_.Destroy(delegated_surface_id_);
|
| - }
|
| - delegated_surface_id_ = surface_id_allocator_->GenerateId();
|
| - factory_.Create(delegated_surface_id_);
|
| - last_swap_frame_size_ = frame_size;
|
| - }
|
| - display_->SetSurfaceId(delegated_surface_id_,
|
| - frame.metadata.device_scale_factor);
|
| -
|
| - factory_.SubmitCompositorFrame(
|
| - delegated_surface_id_, std::move(frame),
|
| - base::Bind(&DirectCompositorFrameSink::DidDrawCallback,
|
| - base::Unretained(this)));
|
| -}
|
| -
|
| bool DirectCompositorFrameSink::BindToClient(
|
| CompositorFrameSinkClient* client) {
|
| DCHECK(thread_checker_.CalledOnValidThread());
|
| @@ -103,13 +77,6 @@ bool DirectCompositorFrameSink::BindToClient(
|
| return true;
|
| }
|
|
|
| -void DirectCompositorFrameSink::ForceReclaimResources() {
|
| - if (!delegated_surface_id_.is_null()) {
|
| - factory_.SubmitCompositorFrame(delegated_surface_id_, CompositorFrame(),
|
| - SurfaceFactory::DrawCallback());
|
| - }
|
| -}
|
| -
|
| void DirectCompositorFrameSink::DetachFromClient() {
|
| DCHECK(HasClient());
|
| // Unregister the SurfaceFactoryClient here instead of the dtor so that only
|
| @@ -122,15 +89,31 @@ void DirectCompositorFrameSink::DetachFromClient() {
|
| CompositorFrameSink::DetachFromClient();
|
| }
|
|
|
| -void DirectCompositorFrameSink::BindFramebuffer() {
|
| - // This is a CompositorFrameSink, no framebuffer/direct drawing support.
|
| - NOTREACHED();
|
| +void DirectCompositorFrameSink::SwapBuffers(CompositorFrame frame) {
|
| + gfx::Size frame_size =
|
| + frame.delegated_frame_data->render_pass_list.back()->output_rect.size();
|
| + if (frame_size.IsEmpty() || frame_size != last_swap_frame_size_) {
|
| + if (!delegated_surface_id_.is_null()) {
|
| + factory_.Destroy(delegated_surface_id_);
|
| + }
|
| + delegated_surface_id_ = surface_id_allocator_->GenerateId();
|
| + factory_.Create(delegated_surface_id_);
|
| + last_swap_frame_size_ = frame_size;
|
| + }
|
| + display_->SetSurfaceId(delegated_surface_id_,
|
| + frame.metadata.device_scale_factor);
|
| +
|
| + factory_.SubmitCompositorFrame(
|
| + delegated_surface_id_, std::move(frame),
|
| + base::Bind(&DirectCompositorFrameSink::DidDrawCallback,
|
| + base::Unretained(this)));
|
| }
|
|
|
| -uint32_t DirectCompositorFrameSink::GetFramebufferCopyTextureFormat() {
|
| - // This is a CompositorFrameSink, no framebuffer/direct drawing support.
|
| - NOTREACHED();
|
| - return 0;
|
| +void DirectCompositorFrameSink::ForceReclaimResources() {
|
| + if (!delegated_surface_id_.is_null()) {
|
| + factory_.SubmitCompositorFrame(delegated_surface_id_, CompositorFrame(),
|
| + SurfaceFactory::DrawCallback());
|
| + }
|
| }
|
|
|
| void DirectCompositorFrameSink::ReturnResources(
|
|
|