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

Side by Side Diff: cc/output/output_surface.cc

Issue 16863005: cc: Add BeginFrameArgs (Closed) Base URL: http://git.chromium.org/chromium/src.git@nofrc12
Patch Set: Fix android compile Created 7 years, 6 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 (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/output/output_surface.h" 5 #include "cc/output/output_surface.h"
6 6
7 #include <set> 7 #include <set>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 if (throttle_frame_production){ 97 if (throttle_frame_production){
98 frame_rate_controller_.reset( 98 frame_rate_controller_.reset(
99 new FrameRateController( 99 new FrameRateController(
100 DelayBasedTimeSource::Create(interval, thread))); 100 DelayBasedTimeSource::Create(interval, thread)));
101 } else { 101 } else {
102 frame_rate_controller_.reset(new FrameRateController(thread)); 102 frame_rate_controller_.reset(new FrameRateController(thread));
103 } 103 }
104 104
105 frame_rate_controller_->SetClient(this); 105 frame_rate_controller_->SetClient(this);
106 frame_rate_controller_->SetMaxSwapsPending(max_frames_pending_); 106 frame_rate_controller_->SetMaxSwapsPending(max_frames_pending_);
107 frame_rate_controller_->SetDeadlineAdjustment(
108 capabilities_.has_parent_compositor ?
piman 2013/06/14 22:53:46 What does has_parent_compositor really mean? Is th
brianderson 2013/06/14 23:32:12 On platforms that support BeginFrame natively, thi
109 BeginFrameArgs::DefaultDeadlineAdjustment() : base::TimeDelta());
107 110
108 // The new frame rate controller will consume the swap acks of the old 111 // The new frame rate controller will consume the swap acks of the old
109 // frame rate controller, so we set that expectation up here. 112 // frame rate controller, so we set that expectation up here.
110 for (int i = 0; i < pending_swap_buffers_; i++) 113 for (int i = 0; i < pending_swap_buffers_; i++)
111 frame_rate_controller_->DidSwapBuffers(); 114 frame_rate_controller_->DidSwapBuffers();
112 } 115 }
113 116
114 void OutputSurface::SetMaxFramesPending(int max_frames_pending) { 117 void OutputSurface::SetMaxFramesPending(int max_frames_pending) {
115 if (frame_rate_controller_) 118 if (frame_rate_controller_)
116 frame_rate_controller_->SetMaxSwapsPending(max_frames_pending); 119 frame_rate_controller_->SetMaxSwapsPending(max_frames_pending);
117 max_frames_pending_ = max_frames_pending; 120 max_frames_pending_ = max_frames_pending;
118 } 121 }
119 122
120 void OutputSurface::OnVSyncParametersChanged(base::TimeTicks timebase, 123 void OutputSurface::OnVSyncParametersChanged(base::TimeTicks timebase,
121 base::TimeDelta interval) { 124 base::TimeDelta interval) {
122 TRACE_EVENT2("cc", "OutputSurface::OnVSyncParametersChanged", 125 TRACE_EVENT2("cc", "OutputSurface::OnVSyncParametersChanged",
123 "timebase", (timebase - base::TimeTicks()).InSecondsF(), 126 "timebase", (timebase - base::TimeTicks()).InSecondsF(),
124 "interval", interval.InSecondsF()); 127 "interval", interval.InSecondsF());
125 if (frame_rate_controller_) 128 if (frame_rate_controller_)
126 frame_rate_controller_->SetTimebaseAndInterval(timebase, interval); 129 frame_rate_controller_->SetTimebaseAndInterval(timebase, interval);
127 } 130 }
128 131
129 void OutputSurface::FrameRateControllerTick(bool throttled) { 132 void OutputSurface::FrameRateControllerTick(bool throttled,
133 BeginFrameArgs args) {
130 DCHECK(frame_rate_controller_); 134 DCHECK(frame_rate_controller_);
131 if (!throttled) 135 if (!throttled)
132 BeginFrame(frame_rate_controller_->LastTickTime()); 136 BeginFrame(args);
133 } 137 }
134 138
135 // Forwarded to OutputSurfaceClient 139 // Forwarded to OutputSurfaceClient
136 void OutputSurface::SetNeedsRedrawRect(gfx::Rect damage_rect) { 140 void OutputSurface::SetNeedsRedrawRect(gfx::Rect damage_rect) {
137 TRACE_EVENT0("cc", "OutputSurface::SetNeedsRedrawRect"); 141 TRACE_EVENT0("cc", "OutputSurface::SetNeedsRedrawRect");
138 client_->SetNeedsRedrawRect(damage_rect); 142 client_->SetNeedsRedrawRect(damage_rect);
139 } 143 }
140 144
141 void OutputSurface::SetNeedsBeginFrame(bool enable) { 145 void OutputSurface::SetNeedsBeginFrame(bool enable) {
142 TRACE_EVENT1("cc", "OutputSurface::SetNeedsBeginFrame", "enable", enable); 146 TRACE_EVENT1("cc", "OutputSurface::SetNeedsBeginFrame", "enable", enable);
143 begin_frame_pending_ = false; 147 begin_frame_pending_ = false;
144 if (frame_rate_controller_) 148 if (frame_rate_controller_)
145 frame_rate_controller_->SetActive(enable); 149 frame_rate_controller_->SetActive(enable);
146 } 150 }
147 151
148 void OutputSurface::BeginFrame(base::TimeTicks frame_time) { 152 void OutputSurface::BeginFrame(BeginFrameArgs args) {
149 if (begin_frame_pending_ || 153 if (begin_frame_pending_ ||
150 (pending_swap_buffers_ >= max_frames_pending_ && max_frames_pending_ > 0)) 154 (pending_swap_buffers_ >= max_frames_pending_ && max_frames_pending_ > 0))
151 return; 155 return;
152 TRACE_EVENT1("cc", "OutputSurface::BeginFrame", 156 TRACE_EVENT1("cc", "OutputSurface::BeginFrame",
153 "pending_swap_buffers_", pending_swap_buffers_); 157 "pending_swap_buffers_", pending_swap_buffers_);
154 begin_frame_pending_ = true; 158 begin_frame_pending_ = true;
155 client_->BeginFrame(frame_time); 159 client_->BeginFrame(args);
156 } 160 }
157 161
158 void OutputSurface::DidSwapBuffers() { 162 void OutputSurface::DidSwapBuffers() {
159 begin_frame_pending_ = false; 163 begin_frame_pending_ = false;
160 pending_swap_buffers_++; 164 pending_swap_buffers_++;
161 TRACE_EVENT1("cc", "OutputSurface::DidSwapBuffers", 165 TRACE_EVENT1("cc", "OutputSurface::DidSwapBuffers",
162 "pending_swap_buffers_", pending_swap_buffers_); 166 "pending_swap_buffers_", pending_swap_buffers_);
163 if (frame_rate_controller_) 167 if (frame_rate_controller_)
164 frame_rate_controller_->DidSwapBuffers(); 168 frame_rate_controller_->DidSwapBuffers();
165 } 169 }
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 325
322 void OutputSurface::PostSwapBuffersComplete() { 326 void OutputSurface::PostSwapBuffersComplete() {
323 base::MessageLoop::current()->PostTask( 327 base::MessageLoop::current()->PostTask(
324 FROM_HERE, 328 FROM_HERE,
325 base::Bind(&OutputSurface::OnSwapBuffersComplete, 329 base::Bind(&OutputSurface::OnSwapBuffersComplete,
326 weak_ptr_factory_.GetWeakPtr(), 330 weak_ptr_factory_.GetWeakPtr(),
327 static_cast<CompositorFrameAck*>(NULL))); 331 static_cast<CompositorFrameAck*>(NULL)));
328 } 332 }
329 333
330 } // namespace cc 334 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698