Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "components/exo/compositor_frame_sink_holder.h" | 5 #include "components/exo/compositor_frame_sink_holder.h" |
| 6 | 6 |
| 7 #include "cc/resources/returned_resource.h" | 7 #include "cc/resources/returned_resource.h" |
| 8 #include "components/exo/surface.h" | 8 #include "components/exo/surface.h" |
| 9 | 9 |
| 10 namespace exo { | 10 namespace exo { |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 34 cc::ResourceId id, | 34 cc::ResourceId id, |
| 35 const cc::ReleaseCallback& callback) { | 35 const cc::ReleaseCallback& callback) { |
| 36 DCHECK(!callback.is_null()); | 36 DCHECK(!callback.is_null()); |
| 37 release_callbacks_[id] = callback; | 37 release_callbacks_[id] = callback; |
| 38 } | 38 } |
| 39 | 39 |
| 40 //////////////////////////////////////////////////////////////////////////////// | 40 //////////////////////////////////////////////////////////////////////////////// |
| 41 // cc::mojom::MojoCompositorFrameSinkClient overrides: | 41 // cc::mojom::MojoCompositorFrameSinkClient overrides: |
| 42 | 42 |
| 43 void CompositorFrameSinkHolder::DidReceiveCompositorFrameAck() { | 43 void CompositorFrameSinkHolder::DidReceiveCompositorFrameAck() { |
| 44 // TODO(staraz): Implement this | 44 // TODO(staraz): Implement this |
|
reveman
2017/04/06 20:42:04
nit: remove this now?
Alex Z.
2017/04/06 20:49:13
Done.
| |
| 45 if (surface_) | |
| 46 surface_->WillDraw(); | |
|
Fady Samuel
2017/04/06 20:52:33
Rename WillDraw to DidReceiveCompositorFrameAck?
reveman
2017/04/06 21:09:06
+1
Alex Z.
2017/04/06 21:11:12
Done.
| |
| 45 } | 47 } |
| 46 | 48 |
| 47 void CompositorFrameSinkHolder::OnBeginFrame(const cc::BeginFrameArgs& args) { | 49 void CompositorFrameSinkHolder::OnBeginFrame(const cc::BeginFrameArgs& args) { |
| 48 begin_frame_source_->OnBeginFrame(args); | 50 begin_frame_source_->OnBeginFrame(args); |
| 49 } | 51 } |
| 50 | 52 |
| 51 void CompositorFrameSinkHolder::ReclaimResources( | 53 void CompositorFrameSinkHolder::ReclaimResources( |
| 52 const cc::ReturnedResourceArray& resources) { | 54 const cc::ReturnedResourceArray& resources) { |
| 53 for (auto& resource : resources) { | 55 for (auto& resource : resources) { |
| 54 auto it = release_callbacks_.find(resource.id); | 56 auto it = release_callbacks_.find(resource.id); |
| 55 DCHECK(it != release_callbacks_.end()); | 57 DCHECK(it != release_callbacks_.end()); |
| 56 if (it != release_callbacks_.end()) { | 58 if (it != release_callbacks_.end()) { |
| 57 it->second.Run(resource.sync_token, resource.lost); | 59 it->second.Run(resource.sync_token, resource.lost); |
| 58 release_callbacks_.erase(it); | 60 release_callbacks_.erase(it); |
| 59 } | 61 } |
| 60 } | 62 } |
| 61 } | 63 } |
| 62 | 64 |
| 63 void CompositorFrameSinkHolder::WillDrawSurface( | 65 void CompositorFrameSinkHolder::WillDrawSurface( |
| 64 const cc::LocalSurfaceId& local_surface_id, | 66 const cc::LocalSurfaceId& local_surface_id, |
| 65 const gfx::Rect& damage_rect) { | 67 const gfx::Rect& damage_rect) {} |
| 66 if (surface_) | |
| 67 surface_->WillDraw(); | |
| 68 } | |
| 69 | 68 |
| 70 //////////////////////////////////////////////////////////////////////////////// | 69 //////////////////////////////////////////////////////////////////////////////// |
| 71 // cc::ExternalBeginFrameSourceClient overrides: | 70 // cc::ExternalBeginFrameSourceClient overrides: |
| 72 | 71 |
| 73 void CompositorFrameSinkHolder::OnNeedsBeginFrames(bool needs_begin_frames) { | 72 void CompositorFrameSinkHolder::OnNeedsBeginFrames(bool needs_begin_frames) { |
| 74 frame_sink_->SetNeedsBeginFrame(needs_begin_frames); | 73 frame_sink_->SetNeedsBeginFrame(needs_begin_frames); |
| 75 } | 74 } |
| 76 | 75 |
| 77 void CompositorFrameSinkHolder::OnDidFinishFrame(const cc::BeginFrameAck& ack) { | 76 void CompositorFrameSinkHolder::OnDidFinishFrame(const cc::BeginFrameAck& ack) { |
| 78 // If there was damage, the submitted CompositorFrame includes the ack. | 77 // If there was damage, the submitted CompositorFrame includes the ack. |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 90 | 89 |
| 91 //////////////////////////////////////////////////////////////////////////////// | 90 //////////////////////////////////////////////////////////////////////////////// |
| 92 // ExoComopositorFrameSink, private: | 91 // ExoComopositorFrameSink, private: |
| 93 | 92 |
| 94 CompositorFrameSinkHolder::~CompositorFrameSinkHolder() { | 93 CompositorFrameSinkHolder::~CompositorFrameSinkHolder() { |
| 95 if (surface_) | 94 if (surface_) |
| 96 surface_->RemoveSurfaceObserver(this); | 95 surface_->RemoveSurfaceObserver(this); |
| 97 } | 96 } |
| 98 | 97 |
| 99 } // namespace exo | 98 } // namespace exo |
| OLD | NEW |