OLD | NEW |
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 <algorithm> | 7 #include <algorithm> |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 external_stencil_test_enabled_(false), | 90 external_stencil_test_enabled_(false), |
91 weak_ptr_factory_(this), | 91 weak_ptr_factory_(this), |
92 gpu_latency_history_(kGpuLatencyHistorySize) {} | 92 gpu_latency_history_(kGpuLatencyHistorySize) {} |
93 | 93 |
94 void OutputSurface::InitializeBeginImplFrameEmulation( | 94 void OutputSurface::InitializeBeginImplFrameEmulation( |
95 base::SingleThreadTaskRunner* task_runner, | 95 base::SingleThreadTaskRunner* task_runner, |
96 bool throttle_frame_production, | 96 bool throttle_frame_production, |
97 base::TimeDelta interval) { | 97 base::TimeDelta interval) { |
98 if (throttle_frame_production) { | 98 if (throttle_frame_production) { |
99 scoped_refptr<DelayBasedTimeSource> time_source; | 99 scoped_refptr<DelayBasedTimeSource> time_source; |
100 if (gfx::FrameTime::TimestampsAreHighRes()) | 100 if (gfx::FrameTime::IsHighRes()) |
101 time_source = DelayBasedTimeSourceHighRes::Create(interval, task_runner); | 101 time_source = DelayBasedTimeSourceHighRes::Create(interval, task_runner); |
102 else | 102 else |
103 time_source = DelayBasedTimeSource::Create(interval, task_runner); | 103 time_source = DelayBasedTimeSource::Create(interval, task_runner); |
104 frame_rate_controller_.reset(new FrameRateController(time_source)); | 104 frame_rate_controller_.reset(new FrameRateController(time_source)); |
105 } else { | 105 } else { |
106 frame_rate_controller_.reset(new FrameRateController(task_runner)); | 106 frame_rate_controller_.reset(new FrameRateController(task_runner)); |
107 } | 107 } |
108 | 108 |
109 frame_rate_controller_->SetClient(this); | 109 frame_rate_controller_->SetClient(this); |
110 frame_rate_controller_->SetMaxSwapsPending(max_frames_pending_); | 110 frame_rate_controller_->SetMaxSwapsPending(max_frames_pending_); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 skipped_begin_impl_frame_args_ = args; | 172 skipped_begin_impl_frame_args_ = args; |
173 } else { | 173 } else { |
174 client_ready_for_begin_impl_frame_ = false; | 174 client_ready_for_begin_impl_frame_ = false; |
175 client_->BeginImplFrame(args); | 175 client_->BeginImplFrame(args); |
176 // args might be an alias for skipped_begin_impl_frame_args_. | 176 // args might be an alias for skipped_begin_impl_frame_args_. |
177 // Do not reset it before calling BeginImplFrame! | 177 // Do not reset it before calling BeginImplFrame! |
178 skipped_begin_impl_frame_args_ = BeginFrameArgs(); | 178 skipped_begin_impl_frame_args_ = BeginFrameArgs(); |
179 } | 179 } |
180 } | 180 } |
181 | 181 |
182 base::TimeTicks OutputSurface::RetroactiveBeginImplFrameDeadline() { | 182 gfx::FrameTime OutputSurface::RetroactiveBeginImplFrameDeadline() { |
183 // TODO(brianderson): Remove the alternative deadline once we have better | 183 // TODO(brianderson): Remove the alternative deadline once we have better |
184 // deadline estimations. | 184 // deadline estimations. |
185 base::TimeTicks alternative_deadline = | 185 gfx::FrameTime alternative_deadline = |
186 skipped_begin_impl_frame_args_.frame_time + | 186 skipped_begin_impl_frame_args_.frame_time + |
187 BeginFrameArgs::DefaultRetroactiveBeginFramePeriod(); | 187 BeginFrameArgs::DefaultRetroactiveBeginFramePeriod(); |
188 return std::max(skipped_begin_impl_frame_args_.deadline, | 188 return std::max(skipped_begin_impl_frame_args_.deadline, |
189 alternative_deadline); | 189 alternative_deadline); |
190 } | 190 } |
191 | 191 |
192 void OutputSurface::PostCheckForRetroactiveBeginImplFrame() { | 192 void OutputSurface::PostCheckForRetroactiveBeginImplFrame() { |
193 if (!skipped_begin_impl_frame_args_.IsValid() || | 193 if (!skipped_begin_impl_frame_args_.IsValid() || |
194 check_for_retroactive_begin_impl_frame_pending_) | 194 check_for_retroactive_begin_impl_frame_pending_) |
195 return; | 195 return; |
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
496 "discard_backbuffer", discard_backbuffer); | 496 "discard_backbuffer", discard_backbuffer); |
497 // Just ignore the memory manager when it says to set the limit to zero | 497 // Just ignore the memory manager when it says to set the limit to zero |
498 // bytes. This will happen when the memory manager thinks that the renderer | 498 // bytes. This will happen when the memory manager thinks that the renderer |
499 // is not visible (which the renderer knows better). | 499 // is not visible (which the renderer knows better). |
500 if (policy.bytes_limit_when_visible) | 500 if (policy.bytes_limit_when_visible) |
501 client_->SetMemoryPolicy(policy); | 501 client_->SetMemoryPolicy(policy); |
502 client_->SetDiscardBackBufferWhenNotVisible(discard_backbuffer); | 502 client_->SetDiscardBackBufferWhenNotVisible(discard_backbuffer); |
503 } | 503 } |
504 | 504 |
505 } // namespace cc | 505 } // namespace cc |
OLD | NEW |