OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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/scheduler/scheduler.h" | 5 #include "cc/scheduler/scheduler.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 | 282 |
283 // Trace this begin frame time through the Chrome stack | 283 // Trace this begin frame time through the Chrome stack |
284 TRACE_EVENT_FLOW_BEGIN0( | 284 TRACE_EVENT_FLOW_BEGIN0( |
285 TRACE_DISABLED_BY_DEFAULT("cc.debug.scheduler.frames"), "BeginFrameArgs", | 285 TRACE_DISABLED_BY_DEFAULT("cc.debug.scheduler.frames"), "BeginFrameArgs", |
286 args.frame_time.ToInternalValue()); | 286 args.frame_time.ToInternalValue()); |
287 | 287 |
288 // TODO(brianderson): Adjust deadline in the DisplayScheduler. | 288 // TODO(brianderson): Adjust deadline in the DisplayScheduler. |
289 BeginFrameArgs adjusted_args(args); | 289 BeginFrameArgs adjusted_args(args); |
290 adjusted_args.deadline -= EstimatedParentDrawTime(); | 290 adjusted_args.deadline -= EstimatedParentDrawTime(); |
291 | 291 |
292 // Deliver BeginFrames to children. | |
293 // TODO(brianderson): Move this responsibility to the DisplayScheduler. | |
294 if (state_machine_.children_need_begin_frames()) | |
295 client_->SendBeginFramesToChildren(adjusted_args); | |
296 | |
297 if (settings_.using_synchronous_renderer_compositor) { | 292 if (settings_.using_synchronous_renderer_compositor) { |
298 BeginImplFrameSynchronous(adjusted_args); | 293 BeginImplFrameSynchronous(adjusted_args); |
299 return true; | 294 return true; |
300 } | 295 } |
301 | 296 |
302 // We have just called SetNeedsBeginFrame(true) and the BeginFrameSource has | 297 // We have just called SetNeedsBeginFrame(true) and the BeginFrameSource has |
303 // sent us the last BeginFrame we have missed. As we might not be able to | 298 // sent us the last BeginFrame we have missed. As we might not be able to |
304 // actually make rendering for this call, handle it like a "retro frame". | 299 // actually make rendering for this call, handle it like a "retro frame". |
305 // TODO(brainderson): Add a test for this functionality ASAP! | 300 // TODO(brainderson): Add a test for this functionality ASAP! |
306 if (adjusted_args.type == BeginFrameArgs::MISSED) { | 301 if (adjusted_args.type == BeginFrameArgs::MISSED) { |
(...skipping 13 matching lines...) Expand all Loading... |
320 begin_retro_frame_args_.push_back(adjusted_args); | 315 begin_retro_frame_args_.push_back(adjusted_args); |
321 TRACE_EVENT_INSTANT0( | 316 TRACE_EVENT_INSTANT0( |
322 "cc", "Scheduler::BeginFrame deferred", TRACE_EVENT_SCOPE_THREAD); | 317 "cc", "Scheduler::BeginFrame deferred", TRACE_EVENT_SCOPE_THREAD); |
323 // Queuing the frame counts as "using it", so we need to return true. | 318 // Queuing the frame counts as "using it", so we need to return true. |
324 } else { | 319 } else { |
325 BeginImplFrameWithDeadline(adjusted_args); | 320 BeginImplFrameWithDeadline(adjusted_args); |
326 } | 321 } |
327 return true; | 322 return true; |
328 } | 323 } |
329 | 324 |
330 void Scheduler::SetChildrenNeedBeginFrames(bool children_need_begin_frames) { | |
331 state_machine_.SetChildrenNeedBeginFrames(children_need_begin_frames); | |
332 ProcessScheduledActions(); | |
333 } | |
334 | |
335 void Scheduler::SetVideoNeedsBeginFrames(bool video_needs_begin_frames) { | 325 void Scheduler::SetVideoNeedsBeginFrames(bool video_needs_begin_frames) { |
336 state_machine_.SetVideoNeedsBeginFrames(video_needs_begin_frames); | 326 state_machine_.SetVideoNeedsBeginFrames(video_needs_begin_frames); |
337 ProcessScheduledActions(); | 327 ProcessScheduledActions(); |
338 } | 328 } |
339 | 329 |
340 void Scheduler::OnDrawForOutputSurface(bool resourceless_software_draw) { | 330 void Scheduler::OnDrawForOutputSurface(bool resourceless_software_draw) { |
341 DCHECK(settings_.using_synchronous_renderer_compositor); | 331 DCHECK(settings_.using_synchronous_renderer_compositor); |
342 DCHECK_EQ(state_machine_.begin_impl_frame_state(), | 332 DCHECK_EQ(state_machine_.begin_impl_frame_state(), |
343 SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_IDLE); | 333 SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_IDLE); |
344 DCHECK(!BeginImplFrameDeadlinePending()); | 334 DCHECK(!BeginImplFrameDeadlinePending()); |
(...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
868 } | 858 } |
869 | 859 |
870 bool Scheduler::IsBeginMainFrameSentOrStarted() const { | 860 bool Scheduler::IsBeginMainFrameSentOrStarted() const { |
871 return (state_machine_.begin_main_frame_state() == | 861 return (state_machine_.begin_main_frame_state() == |
872 SchedulerStateMachine::BEGIN_MAIN_FRAME_STATE_SENT || | 862 SchedulerStateMachine::BEGIN_MAIN_FRAME_STATE_SENT || |
873 state_machine_.begin_main_frame_state() == | 863 state_machine_.begin_main_frame_state() == |
874 SchedulerStateMachine::BEGIN_MAIN_FRAME_STATE_STARTED); | 864 SchedulerStateMachine::BEGIN_MAIN_FRAME_STATE_STARTED); |
875 } | 865 } |
876 | 866 |
877 } // namespace cc | 867 } // namespace cc |
OLD | NEW |