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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 // TODO(piman, fsamuel): We will likely want to revisit this because some | 66 // TODO(piman, fsamuel): We will likely want to revisit this because some |
67 // clients may want finer control over the Display sizing - since it | 67 // clients may want finer control over the Display sizing - since it |
68 // really means the actual size of the native window (Linux/Win Aura) or | 68 // really means the actual size of the native window (Linux/Win Aura) or |
69 // display (Ozone). We may need to either prevent or gutter Display frames | 69 // display (Ozone). We may need to either prevent or gutter Display frames |
70 // until there is a correctly-sized top-level CompositorFrame available | 70 // until there is a correctly-sized top-level CompositorFrame available |
71 // (see ui::Compositor::DisableSwapUntilResize). We might want to resize | 71 // (see ui::Compositor::DisableSwapUntilResize). We might want to resize |
72 // Display earlier. | 72 // Display earlier. |
73 display_->Resize(frame_size); | 73 display_->Resize(frame_size); |
74 } | 74 } |
75 } | 75 } |
| 76 |
| 77 uint64_t begin_frame_source_id = frame.metadata.begin_frame_source_id; |
| 78 uint64_t begin_frame_number = frame.metadata.begin_frame_number; |
| 79 uint64_t oldest_incorporated_frame = frame.metadata.oldest_incorporated_frame; |
76 ++ack_pending_count_; | 80 ++ack_pending_count_; |
| 81 |
77 surface_factory_.SubmitCompositorFrame( | 82 surface_factory_.SubmitCompositorFrame( |
78 local_frame_id_, std::move(frame), | 83 local_frame_id_, std::move(frame), |
79 base::Bind(&CompositorFrameSinkSupport::DidReceiveCompositorFrameAck, | 84 base::Bind(&CompositorFrameSinkSupport::DidReceiveCompositorFrameAck, |
80 weak_factory_.GetWeakPtr())); | 85 weak_factory_.GetWeakPtr())); |
81 if (display_) { | 86 if (display_) { |
82 display_->SetLocalFrameId(local_frame_id_, | 87 display_->SetLocalFrameId(local_frame_id_, |
83 frame.metadata.device_scale_factor); | 88 frame.metadata.device_scale_factor); |
84 } | 89 } |
| 90 |
| 91 BeginFrameAck ack(begin_frame_source_id, begin_frame_number, |
| 92 oldest_incorporated_frame, 0, true); |
| 93 if (begin_frame_source_) |
| 94 begin_frame_source_->DidFinishFrame(this, ack); |
| 95 } |
| 96 |
| 97 void CompositorFrameSinkSupport::BeginFrameDidNotDraw( |
| 98 const BeginFrameAck& ack) { |
| 99 if (begin_frame_source_) |
| 100 begin_frame_source_->DidFinishFrame(this, ack); |
85 } | 101 } |
86 | 102 |
87 void CompositorFrameSinkSupport::Require(const LocalFrameId& local_frame_id, | 103 void CompositorFrameSinkSupport::Require(const LocalFrameId& local_frame_id, |
88 const SurfaceSequence& sequence) { | 104 const SurfaceSequence& sequence) { |
89 Surface* surface = surface_manager_->GetSurfaceForId( | 105 Surface* surface = surface_manager_->GetSurfaceForId( |
90 SurfaceId(frame_sink_id_, local_frame_id)); | 106 SurfaceId(frame_sink_id_, local_frame_id)); |
91 if (!surface) { | 107 if (!surface) { |
92 DLOG(ERROR) << "Attempting to require callback on nonexistent surface"; | 108 DLOG(ERROR) << "Attempting to require callback on nonexistent surface"; |
93 return; | 109 return; |
94 } | 110 } |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 return; | 207 return; |
192 | 208 |
193 added_frame_observer_ = needs_begin_frame_; | 209 added_frame_observer_ = needs_begin_frame_; |
194 if (needs_begin_frame_) | 210 if (needs_begin_frame_) |
195 begin_frame_source_->AddObserver(this); | 211 begin_frame_source_->AddObserver(this); |
196 else | 212 else |
197 begin_frame_source_->RemoveObserver(this); | 213 begin_frame_source_->RemoveObserver(this); |
198 } | 214 } |
199 | 215 |
200 } // namespace cc | 216 } // namespace cc |
OLD | NEW |