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 #include "base/auto_reset.h" | 8 #include "base/auto_reset.h" |
9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
365 case SchedulerStateMachine::ACTION_ACQUIRE_LAYER_TEXTURES_FOR_MAIN_THREAD: | 365 case SchedulerStateMachine::ACTION_ACQUIRE_LAYER_TEXTURES_FOR_MAIN_THREAD: |
366 client_->ScheduledActionAcquireLayerTexturesForMainThread(); | 366 client_->ScheduledActionAcquireLayerTexturesForMainThread(); |
367 break; | 367 break; |
368 case SchedulerStateMachine::ACTION_MANAGE_TILES: | 368 case SchedulerStateMachine::ACTION_MANAGE_TILES: |
369 client_->ScheduledActionManageTiles(); | 369 client_->ScheduledActionManageTiles(); |
370 break; | 370 break; |
371 } | 371 } |
372 } while (action != SchedulerStateMachine::ACTION_NONE); | 372 } while (action != SchedulerStateMachine::ACTION_NONE); |
373 | 373 |
374 SetupNextBeginImplFrameIfNeeded(); | 374 SetupNextBeginImplFrameIfNeeded(); |
375 client_->DidAnticipatedDrawTimeChange(AnticipatedDrawTime()); | 375 |
376 if (SchedulerStateMachine::COMMIT_STATE_FRAME_IN_PROGRESS == | |
enne (OOO)
2014/01/23 21:51:55
Why do you only update the anticipated draw time d
brianderson
2014/01/23 23:31:35
It avoided a PostTask storm of some sort. I'll see
| |
377 state_machine_.commit_state()) | |
378 client_->DidAnticipatedDrawTimeChange(AnticipatedDrawTime()); | |
376 | 379 |
377 if (state_machine_.ShouldTriggerBeginImplFrameDeadlineEarly()) | 380 if (state_machine_.ShouldTriggerBeginImplFrameDeadlineEarly()) |
378 PostBeginImplFrameDeadline(base::TimeTicks()); | 381 PostBeginImplFrameDeadline(base::TimeTicks()); |
379 } | 382 } |
380 | 383 |
381 bool Scheduler::WillDrawIfNeeded() const { | 384 bool Scheduler::WillDrawIfNeeded() const { |
382 return !state_machine_.PendingDrawsShouldBeAborted(); | 385 return !state_machine_.PendingDrawsShouldBeAborted(); |
383 } | 386 } |
384 | 387 |
385 bool Scheduler::CanCommitAndActivateBeforeDeadline() const { | 388 bool Scheduler::CanCommitAndActivateBeforeDeadline() const { |
386 // Check if the main thread computation and commit can be finished before the | 389 // Check if the main thread computation and commit can be finished before the |
387 // impl thread's deadline. | 390 // impl thread's deadline. |
388 base::TimeTicks estimated_draw_time = | 391 base::TimeTicks estimated_draw_time = |
389 last_begin_impl_frame_args_.frame_time + | 392 last_begin_impl_frame_args_.frame_time + |
390 client_->BeginMainFrameToCommitDurationEstimate() + | 393 client_->BeginMainFrameToCommitDurationEstimate() + |
391 client_->CommitToActivateDurationEstimate(); | 394 client_->CommitToActivateDurationEstimate(); |
392 | 395 |
393 return estimated_draw_time < last_begin_impl_frame_args_.deadline; | 396 return estimated_draw_time < last_begin_impl_frame_args_.deadline; |
394 } | 397 } |
395 | 398 |
396 } // namespace cc | 399 } // namespace cc |
OLD | NEW |