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 "cc/surfaces/compositor_frame_sink_support.h" | 5 #include "cc/surfaces/compositor_frame_sink_support.h" |
6 | 6 |
7 #include "cc/output/compositor_frame.h" | 7 #include "cc/output/compositor_frame.h" |
8 #include "cc/scheduler/begin_frame_source.h" | 8 #include "cc/scheduler/begin_frame_source.h" |
9 #include "cc/surfaces/compositor_frame_sink_support_client.h" | 9 #include "cc/surfaces/compositor_frame_sink_support_client.h" |
10 #include "cc/surfaces/display.h" | 10 #include "cc/surfaces/display.h" |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 base::Bind(&CompositorFrameSinkSupport::DidReceiveCompositorFrameAck, | 81 base::Bind(&CompositorFrameSinkSupport::DidReceiveCompositorFrameAck, |
82 weak_factory_.GetWeakPtr())); | 82 weak_factory_.GetWeakPtr())); |
83 if (display_) { | 83 if (display_) { |
84 display_->SetLocalFrameId(local_frame_id_, | 84 display_->SetLocalFrameId(local_frame_id_, |
85 frame.metadata.device_scale_factor); | 85 frame.metadata.device_scale_factor); |
86 } | 86 } |
87 } | 87 } |
88 | 88 |
89 void CompositorFrameSinkSupport::Require(const LocalFrameId& local_frame_id, | 89 void CompositorFrameSinkSupport::Require(const LocalFrameId& local_frame_id, |
90 const SurfaceSequence& sequence) { | 90 const SurfaceSequence& sequence) { |
91 Surface* surface = surface_manager_->GetSurfaceForId( | 91 surface_manager_->RequireSequence(SurfaceId(frame_sink_id_, local_frame_id), |
92 SurfaceId(frame_sink_id_, local_frame_id)); | 92 sequence); |
93 if (!surface) { | |
94 DLOG(ERROR) << "Attempting to require callback on nonexistent surface"; | |
95 return; | |
96 } | |
97 surface->AddDestructionDependency(sequence); | |
98 } | 93 } |
99 | 94 |
100 void CompositorFrameSinkSupport::Satisfy(const SurfaceSequence& sequence) { | 95 void CompositorFrameSinkSupport::Satisfy(const SurfaceSequence& sequence) { |
101 std::vector<uint32_t> sequences = {sequence.sequence}; | 96 surface_manager_->SatisfySequence(sequence); |
102 surface_manager_->DidSatisfySequences(sequence.frame_sink_id, &sequences); | |
103 } | 97 } |
104 | 98 |
105 void CompositorFrameSinkSupport::DidReceiveCompositorFrameAck() { | 99 void CompositorFrameSinkSupport::DidReceiveCompositorFrameAck() { |
106 DCHECK_GT(ack_pending_count_, 0); | 100 DCHECK_GT(ack_pending_count_, 0); |
107 ack_pending_count_--; | 101 ack_pending_count_--; |
108 | 102 |
109 if (!client_) | 103 if (!client_) |
110 return; | 104 return; |
111 client_->DidReceiveCompositorFrameAck(); | 105 client_->DidReceiveCompositorFrameAck(); |
112 if (!surface_returned_resources_.empty()) { | 106 if (!surface_returned_resources_.empty()) { |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 return; | 187 return; |
194 | 188 |
195 added_frame_observer_ = needs_begin_frame_; | 189 added_frame_observer_ = needs_begin_frame_; |
196 if (needs_begin_frame_) | 190 if (needs_begin_frame_) |
197 begin_frame_source_->AddObserver(this); | 191 begin_frame_source_->AddObserver(this); |
198 else | 192 else |
199 begin_frame_source_->RemoveObserver(this); | 193 begin_frame_source_->RemoveObserver(this); |
200 } | 194 } |
201 | 195 |
202 } // namespace cc | 196 } // namespace cc |
OLD | NEW |