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

Side by Side Diff: cc/surfaces/compositor_frame_sink_support.cc

Issue 2527283003: cc: Introduce BeginFrame sequence numbers and acknowledgements.
Patch Set: . Created 4 years 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 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 // TODO(piman, fsamuel): We will likely want to revisit this because some 60 // TODO(piman, fsamuel): We will likely want to revisit this because some
61 // clients may want finer control over the Display sizing - since it 61 // clients may want finer control over the Display sizing - since it
62 // really means the actual size of the native window (Linux/Win Aura) or 62 // really means the actual size of the native window (Linux/Win Aura) or
63 // display (Ozone). We may need to either prevent or gutter Display frames 63 // display (Ozone). We may need to either prevent or gutter Display frames
64 // until there is a correctly-sized top-level CompositorFrame available 64 // until there is a correctly-sized top-level CompositorFrame available
65 // (see ui::Compositor::DisableSwapUntilResize). We might want to resize 65 // (see ui::Compositor::DisableSwapUntilResize). We might want to resize
66 // Display earlier. 66 // Display earlier.
67 display_->Resize(frame_size); 67 display_->Resize(frame_size);
68 } 68 }
69 } 69 }
70
71 uint64_t begin_frame_source_id = frame.metadata.begin_frame_source_id;
72 uint64_t begin_frame_number = frame.metadata.begin_frame_number;
73 uint64_t oldest_incorporated_frame = frame.metadata.oldest_incorporated_frame;
70 ++ack_pending_count_; 74 ++ack_pending_count_;
75
71 surface_factory_.SubmitCompositorFrame( 76 surface_factory_.SubmitCompositorFrame(
72 local_frame_id_, std::move(frame), 77 local_frame_id_, std::move(frame),
73 base::Bind(&CompositorFrameSinkSupport::DidReceiveCompositorFrameAck, 78 base::Bind(&CompositorFrameSinkSupport::DidReceiveCompositorFrameAck,
74 weak_factory_.GetWeakPtr())); 79 weak_factory_.GetWeakPtr()));
75 if (display_) { 80 if (display_) {
76 display_->SetLocalFrameId(local_frame_id_, 81 display_->SetLocalFrameId(local_frame_id_,
77 frame.metadata.device_scale_factor); 82 frame.metadata.device_scale_factor);
78 } 83 }
84
85 BeginFrameAck ack(begin_frame_source_id, begin_frame_number, true,
86 oldest_incorporated_frame, 0);
87 if (begin_frame_source_)
88 begin_frame_source_->DidFinishFrame(this, ack);
89 }
90
91 void CompositorFrameSinkSupport::BeginFrameDidNotDraw(
92 const BeginFrameAck& ack) {
93 if (begin_frame_source_)
94 begin_frame_source_->DidFinishFrame(this, ack);
79 } 95 }
80 96
81 void CompositorFrameSinkSupport::DidReceiveCompositorFrameAck() { 97 void CompositorFrameSinkSupport::DidReceiveCompositorFrameAck() {
82 DCHECK_GT(ack_pending_count_, 0); 98 DCHECK_GT(ack_pending_count_, 0);
83 ack_pending_count_--; 99 ack_pending_count_--;
84 100
85 if (!client_) 101 if (!client_)
86 return; 102 return;
87 client_->DidReceiveCompositorFrameAck(); 103 client_->DidReceiveCompositorFrameAck();
88 if (!surface_returned_resources_.empty()) { 104 if (!surface_returned_resources_.empty()) {
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 return; 180 return;
165 181
166 added_frame_observer_ = needs_begin_frame_; 182 added_frame_observer_ = needs_begin_frame_;
167 if (needs_begin_frame_) 183 if (needs_begin_frame_)
168 begin_frame_source_->AddObserver(this); 184 begin_frame_source_->AddObserver(this);
169 else 185 else
170 begin_frame_source_->RemoveObserver(this); 186 begin_frame_source_->RemoveObserver(this);
171 } 187 }
172 188
173 } // namespace cc 189 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698