Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(197)

Side by Side Diff: services/ui/ws/display_client_compositor_frame_sink.cc

Issue 2888043004: [cc] Add and plumb CFS::DidNotProduceFrame. (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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(frame.metadata.begin_frame_ack.has_damage);
51 DCHECK_LE(cc::BeginFrameArgs::kStartingFrameNumber, 52 DCHECK_LE(cc::BeginFrameArgs::kStartingFrameNumber,
52 frame.metadata.begin_frame_ack.sequence_number); 53 frame.metadata.begin_frame_ack.sequence_number);
53 54
54 gfx::Size frame_size = frame.render_pass_list.back()->output_rect.size(); 55 gfx::Size frame_size = frame.render_pass_list.back()->output_rect.size();
55 56
56 if (!local_surface_id_.is_valid() || 57 if (!local_surface_id_.is_valid() ||
57 frame_size != last_submitted_frame_size_) { 58 frame_size != last_submitted_frame_size_) {
58 local_surface_id_ = id_allocator_.GenerateId(); 59 local_surface_id_ = id_allocator_.GenerateId();
59 display_private_->ResizeDisplay(frame_size); 60 display_private_->ResizeDisplay(frame_size);
60 } 61 }
61 display_private_->SetLocalSurfaceId(local_surface_id_, 62 display_private_->SetLocalSurfaceId(local_surface_id_,
62 frame.metadata.device_scale_factor); 63 frame.metadata.device_scale_factor);
63 compositor_frame_sink_->SubmitCompositorFrame(local_surface_id_, 64 compositor_frame_sink_->SubmitCompositorFrame(local_surface_id_,
64 std::move(frame)); 65 std::move(frame));
65 last_submitted_frame_size_ = frame_size; 66 last_submitted_frame_size_ = frame_size;
66 } 67 }
67 68
69 void DisplayClientCompositorFrameSink::BeginFrameDidNotProduceFrame(
70 const cc::BeginFrameAck& ack) {
71 DCHECK(!ack.has_damage);
72 DCHECK_LE(cc::BeginFrameArgs::kStartingFrameNumber, ack.sequence_number);
73 compositor_frame_sink_->BeginFrameDidNotProduceFrame(ack);
74 }
75
68 void DisplayClientCompositorFrameSink::DidReceiveCompositorFrameAck( 76 void DisplayClientCompositorFrameSink::DidReceiveCompositorFrameAck(
69 const cc::ReturnedResourceArray& resources) { 77 const cc::ReturnedResourceArray& resources) {
70 DCHECK(thread_checker_->CalledOnValidThread()); 78 DCHECK(thread_checker_->CalledOnValidThread());
71 if (!client_) 79 if (!client_)
72 return; 80 return;
73 client_->ReclaimResources(resources); 81 client_->ReclaimResources(resources);
74 client_->DidReceiveCompositorFrameAck(); 82 client_->DidReceiveCompositorFrameAck();
75 } 83 }
76 84
77 void DisplayClientCompositorFrameSink::OnBeginFrame( 85 void DisplayClientCompositorFrameSink::OnBeginFrame(
(...skipping 10 matching lines...) Expand all
88 client_->ReclaimResources(resources); 96 client_->ReclaimResources(resources);
89 } 97 }
90 98
91 void DisplayClientCompositorFrameSink::OnNeedsBeginFrames( 99 void DisplayClientCompositorFrameSink::OnNeedsBeginFrames(
92 bool needs_begin_frames) { 100 bool needs_begin_frames) {
93 DCHECK(thread_checker_->CalledOnValidThread()); 101 DCHECK(thread_checker_->CalledOnValidThread());
94 compositor_frame_sink_->SetNeedsBeginFrame(needs_begin_frames); 102 compositor_frame_sink_->SetNeedsBeginFrame(needs_begin_frames);
95 } 103 }
96 104
97 void DisplayClientCompositorFrameSink::OnDidFinishFrame( 105 void DisplayClientCompositorFrameSink::OnDidFinishFrame(
98 const cc::BeginFrameAck& ack) { 106 const cc::BeginFrameAck& ack) {}
99 // If there was damage, the submitted CompositorFrame includes the ack.
100 if (!ack.has_damage)
101 compositor_frame_sink_->BeginFrameDidNotSwap(ack);
102 }
103 107
104 } // namespace ws 108 } // namespace ws
105 } // namespace ui 109 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698