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 <set> | 7 #include <set> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 has_swap_buffers_complete_callback_(false), | 84 has_swap_buffers_complete_callback_(false), |
85 device_scale_factor_(-1), | 85 device_scale_factor_(-1), |
86 weak_ptr_factory_(this), | 86 weak_ptr_factory_(this), |
87 max_frames_pending_(0), | 87 max_frames_pending_(0), |
88 pending_swap_buffers_(0), | 88 pending_swap_buffers_(0), |
89 begin_frame_pending_(false), | 89 begin_frame_pending_(false), |
90 client_(NULL) { | 90 client_(NULL) { |
91 } | 91 } |
92 | 92 |
93 void OutputSurface::InitializeBeginFrameEmulation( | 93 void OutputSurface::InitializeBeginFrameEmulation( |
94 Thread* thread, | 94 base::SingleThreadTaskRunner* task_runner, |
95 bool throttle_frame_production, | 95 bool throttle_frame_production, |
96 base::TimeDelta interval) { | 96 base::TimeDelta interval) { |
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, task_runner))); |
101 } else { | 101 } else { |
102 frame_rate_controller_.reset(new FrameRateController(thread)); | 102 frame_rate_controller_.reset(new FrameRateController(task_runner)); |
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 | 107 |
108 // The new frame rate controller will consume the swap acks of the old | 108 // The new frame rate controller will consume the swap acks of the old |
109 // frame rate controller, so we set that expectation up here. | 109 // frame rate controller, so we set that expectation up here. |
110 for (int i = 0; i < pending_swap_buffers_; i++) | 110 for (int i = 0; i < pending_swap_buffers_; i++) |
111 frame_rate_controller_->DidSwapBuffers(); | 111 frame_rate_controller_->DidSwapBuffers(); |
112 } | 112 } |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
322 | 322 |
323 void OutputSurface::PostSwapBuffersComplete() { | 323 void OutputSurface::PostSwapBuffersComplete() { |
324 base::MessageLoop::current()->PostTask( | 324 base::MessageLoop::current()->PostTask( |
325 FROM_HERE, | 325 FROM_HERE, |
326 base::Bind(&OutputSurface::OnSwapBuffersComplete, | 326 base::Bind(&OutputSurface::OnSwapBuffersComplete, |
327 weak_ptr_factory_.GetWeakPtr(), | 327 weak_ptr_factory_.GetWeakPtr(), |
328 static_cast<CompositorFrameAck*>(NULL))); | 328 static_cast<CompositorFrameAck*>(NULL))); |
329 } | 329 } |
330 | 330 |
331 } // namespace cc | 331 } // namespace cc |
OLD | NEW |