| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/display_compositor/gpu_compositor_frame_sink.h" | 5 #include "components/display_compositor/gpu_compositor_frame_sink.h" |
| 6 | 6 |
| 7 #include "cc/surfaces/surface_reference.h" | 7 #include "cc/surfaces/surface_reference.h" |
| 8 | 8 |
| 9 namespace display_compositor { | 9 namespace display_compositor { |
| 10 | 10 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 | 48 |
| 49 void GpuCompositorFrameSink::EvictFrame() { | 49 void GpuCompositorFrameSink::EvictFrame() { |
| 50 support_.EvictFrame(); | 50 support_.EvictFrame(); |
| 51 } | 51 } |
| 52 | 52 |
| 53 void GpuCompositorFrameSink::SetNeedsBeginFrame(bool needs_begin_frame) { | 53 void GpuCompositorFrameSink::SetNeedsBeginFrame(bool needs_begin_frame) { |
| 54 support_.SetNeedsBeginFrame(needs_begin_frame); | 54 support_.SetNeedsBeginFrame(needs_begin_frame); |
| 55 } | 55 } |
| 56 | 56 |
| 57 void GpuCompositorFrameSink::SubmitCompositorFrame( | 57 void GpuCompositorFrameSink::SubmitCompositorFrame( |
| 58 const cc::LocalFrameId& local_frame_id, | 58 const cc::LocalSurfaceId& local_surface_id, |
| 59 cc::CompositorFrame frame) { | 59 cc::CompositorFrame frame) { |
| 60 cc::SurfaceId start_surface_id = surface_tracker_.current_surface_id(); | 60 cc::SurfaceId start_surface_id = surface_tracker_.current_surface_id(); |
| 61 surface_tracker_.UpdateReferences(local_frame_id, | 61 surface_tracker_.UpdateReferences(local_surface_id, |
| 62 frame.metadata.referenced_surfaces); | 62 frame.metadata.referenced_surfaces); |
| 63 // TODO(kylechar): Move adding top-level root references to | 63 // TODO(kylechar): Move adding top-level root references to |
| 64 // GpuDisplayCompositorFrameSink. | 64 // GpuDisplayCompositorFrameSink. |
| 65 | 65 |
| 66 support_.SubmitCompositorFrame(local_frame_id, std::move(frame)); | 66 support_.SubmitCompositorFrame(local_surface_id, std::move(frame)); |
| 67 | 67 |
| 68 // Get the list of surfaces to add/remove from |surface_tracker_| so we can | 68 // Get the list of surfaces to add/remove from |surface_tracker_| so we can |
| 69 // append to them before adding/removing. | 69 // append to them before adding/removing. |
| 70 std::vector<cc::SurfaceReference>& references_to_add = | 70 std::vector<cc::SurfaceReference>& references_to_add = |
| 71 surface_tracker_.references_to_add(); | 71 surface_tracker_.references_to_add(); |
| 72 std::vector<cc::SurfaceReference>& references_to_remove = | 72 std::vector<cc::SurfaceReference>& references_to_remove = |
| 73 surface_tracker_.references_to_remove(); | 73 surface_tracker_.references_to_remove(); |
| 74 | 74 |
| 75 // Append TLR references for the display root surfaces when display root | 75 // Append TLR references for the display root surfaces when display root |
| 76 // surface changes. | 76 // surface changes. |
| 77 if (support_.display() && | 77 if (support_.display() && |
| 78 start_surface_id != surface_tracker_.current_surface_id()) { | 78 start_surface_id != surface_tracker_.current_surface_id()) { |
| 79 const cc::SurfaceId top_level_root_surface_id = | 79 const cc::SurfaceId top_level_root_surface_id = |
| 80 surface_manager_->GetRootSurfaceId(); | 80 surface_manager_->GetRootSurfaceId(); |
| 81 | 81 |
| 82 // The first frame will not have a valid |start_surface_id| and there will | 82 // The first frame will not have a valid |start_surface_id| and there will |
| 83 // be no surface to remove. | 83 // be no surface to remove. |
| 84 if (start_surface_id.local_frame_id().is_valid()) { | 84 if (start_surface_id.local_surface_id().is_valid()) { |
| 85 references_to_remove.push_back( | 85 references_to_remove.push_back( |
| 86 cc::SurfaceReference(top_level_root_surface_id, start_surface_id)); | 86 cc::SurfaceReference(top_level_root_surface_id, start_surface_id)); |
| 87 } | 87 } |
| 88 | 88 |
| 89 references_to_add.push_back(cc::SurfaceReference( | 89 references_to_add.push_back(cc::SurfaceReference( |
| 90 top_level_root_surface_id, surface_tracker_.current_surface_id())); | 90 top_level_root_surface_id, surface_tracker_.current_surface_id())); |
| 91 } | 91 } |
| 92 | 92 |
| 93 if (!references_to_add.empty()) | 93 if (!references_to_add.empty()) |
| 94 surface_manager_->AddSurfaceReferences(references_to_add); | 94 surface_manager_->AddSurfaceReferences(references_to_add); |
| 95 if (!references_to_remove.empty()) | 95 if (!references_to_remove.empty()) |
| 96 surface_manager_->RemoveSurfaceReferences(references_to_remove); | 96 surface_manager_->RemoveSurfaceReferences(references_to_remove); |
| 97 } | 97 } |
| 98 | 98 |
| 99 void GpuCompositorFrameSink::Require(const cc::LocalFrameId& local_frame_id, | 99 void GpuCompositorFrameSink::Require(const cc::LocalSurfaceId& local_surface_id, |
| 100 const cc::SurfaceSequence& sequence) { | 100 const cc::SurfaceSequence& sequence) { |
| 101 support_.Require(local_frame_id, sequence); | 101 support_.Require(local_surface_id, sequence); |
| 102 } | 102 } |
| 103 | 103 |
| 104 void GpuCompositorFrameSink::Satisfy(const cc::SurfaceSequence& sequence) { | 104 void GpuCompositorFrameSink::Satisfy(const cc::SurfaceSequence& sequence) { |
| 105 support_.Satisfy(sequence); | 105 support_.Satisfy(sequence); |
| 106 } | 106 } |
| 107 | 107 |
| 108 void GpuCompositorFrameSink::DidReceiveCompositorFrameAck() { | 108 void GpuCompositorFrameSink::DidReceiveCompositorFrameAck() { |
| 109 if (client_) | 109 if (client_) |
| 110 client_->DidReceiveCompositorFrameAck(); | 110 client_->DidReceiveCompositorFrameAck(); |
| 111 } | 111 } |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 } | 144 } |
| 145 | 145 |
| 146 void GpuCompositorFrameSink::OnPrivateConnectionLost() { | 146 void GpuCompositorFrameSink::OnPrivateConnectionLost() { |
| 147 private_connection_lost_ = true; | 147 private_connection_lost_ = true; |
| 148 // Request destruction of |this| only if both connections are lost. | 148 // Request destruction of |this| only if both connections are lost. |
| 149 delegate_->OnPrivateConnectionLost(support_.frame_sink_id(), | 149 delegate_->OnPrivateConnectionLost(support_.frame_sink_id(), |
| 150 client_connection_lost_); | 150 client_connection_lost_); |
| 151 } | 151 } |
| 152 | 152 |
| 153 } // namespace display_compositor | 153 } // namespace display_compositor |
| OLD | NEW |