OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 "services/ui/ws/display_client_compositor_frame_sink.h" | 5 #include "services/ui/ws/display_client_compositor_frame_sink.h" |
6 | 6 |
7 #include "base/threading/thread_checker.h" | 7 #include "base/threading/thread_checker.h" |
8 #include "cc/output/compositor_frame_sink_client.h" | 8 #include "cc/output/compositor_frame_sink_client.h" |
9 | 9 |
10 namespace ui { | 10 namespace ui { |
(...skipping 30 matching lines...) Expand all Loading... |
41 begin_frame_source_.reset(); | 41 begin_frame_source_.reset(); |
42 cc::CompositorFrameSink::DetachFromClient(); | 42 cc::CompositorFrameSink::DetachFromClient(); |
43 } | 43 } |
44 | 44 |
45 void DisplayClientCompositorFrameSink::SubmitCompositorFrame( | 45 void DisplayClientCompositorFrameSink::SubmitCompositorFrame( |
46 cc::CompositorFrame frame) { | 46 cc::CompositorFrame frame) { |
47 DCHECK(thread_checker_->CalledOnValidThread()); | 47 DCHECK(thread_checker_->CalledOnValidThread()); |
48 if (!compositor_frame_sink_) | 48 if (!compositor_frame_sink_) |
49 return; | 49 return; |
50 | 50 |
| 51 DCHECK_LE(cc::BeginFrameArgs::kStartingFrameNumber, |
| 52 frame.metadata.begin_frame_ack.sequence_number); |
| 53 |
51 gfx::Size frame_size = last_submitted_frame_size_; | 54 gfx::Size frame_size = last_submitted_frame_size_; |
52 if (!frame.render_pass_list.empty()) | 55 if (!frame.render_pass_list.empty()) |
53 frame_size = frame.render_pass_list.back()->output_rect.size(); | 56 frame_size = frame.render_pass_list.back()->output_rect.size(); |
54 | 57 |
55 if (!local_surface_id_.is_valid() || | 58 if (!local_surface_id_.is_valid() || |
56 frame_size != last_submitted_frame_size_) { | 59 frame_size != last_submitted_frame_size_) { |
57 local_surface_id_ = id_allocator_.GenerateId(); | 60 local_surface_id_ = id_allocator_.GenerateId(); |
58 display_private_->ResizeDisplay(frame_size); | 61 display_private_->ResizeDisplay(frame_size); |
59 } | 62 } |
60 display_private_->SetLocalSurfaceId(local_surface_id_, | 63 display_private_->SetLocalSurfaceId(local_surface_id_, |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 } | 95 } |
93 | 96 |
94 void DisplayClientCompositorFrameSink::OnNeedsBeginFrames( | 97 void DisplayClientCompositorFrameSink::OnNeedsBeginFrames( |
95 bool needs_begin_frames) { | 98 bool needs_begin_frames) { |
96 DCHECK(thread_checker_->CalledOnValidThread()); | 99 DCHECK(thread_checker_->CalledOnValidThread()); |
97 compositor_frame_sink_->SetNeedsBeginFrame(needs_begin_frames); | 100 compositor_frame_sink_->SetNeedsBeginFrame(needs_begin_frames); |
98 } | 101 } |
99 | 102 |
100 void DisplayClientCompositorFrameSink::OnDidFinishFrame( | 103 void DisplayClientCompositorFrameSink::OnDidFinishFrame( |
101 const cc::BeginFrameAck& ack) { | 104 const cc::BeginFrameAck& ack) { |
102 // TODO(eseckler): Pass on the ack to compositor_frame_sink_. | 105 // If there was damage, the submitted CompositorFrame includes the ack. |
| 106 if (!ack.has_damage) |
| 107 compositor_frame_sink_->BeginFrameDidNotSwap(ack); |
103 } | 108 } |
104 | 109 |
105 } // namespace ws | 110 } // namespace ws |
106 } // namespace ui | 111 } // namespace ui |
OLD | NEW |