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 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
407 } | 407 } |
408 } | 408 } |
409 | 409 |
410 bool Scheduler::WillDrawIfNeeded() const { | 410 bool Scheduler::WillDrawIfNeeded() const { |
411 return !state_machine_.PendingDrawsShouldBeAborted(); | 411 return !state_machine_.PendingDrawsShouldBeAborted(); |
412 } | 412 } |
413 | 413 |
414 scoped_ptr<base::Value> Scheduler::StateAsValue() const { | 414 scoped_ptr<base::Value> Scheduler::StateAsValue() const { |
415 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue); | 415 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue); |
416 state->Set("state_machine", state_machine_.AsValue().release()); | 416 state->Set("state_machine", state_machine_.AsValue().release()); |
417 state->SetDouble( | 417 |
| 418 scoped_ptr<base::DictionaryValue> scheduler_state(new base::DictionaryValue); |
| 419 scheduler_state->SetDouble( |
418 "time_until_anticipated_draw_time_ms", | 420 "time_until_anticipated_draw_time_ms", |
419 (AnticipatedDrawTime() - base::TimeTicks::Now()).InMillisecondsF()); | 421 (AnticipatedDrawTime() - base::TimeTicks::Now()).InMillisecondsF()); |
| 422 scheduler_state->SetBoolean("last_set_needs_begin_impl_frame_", |
| 423 last_set_needs_begin_impl_frame_); |
| 424 scheduler_state->SetBoolean( |
| 425 "begin_impl_frame_deadline_closure_", |
| 426 !begin_impl_frame_deadline_closure_.IsCancelled()); |
| 427 scheduler_state->SetBoolean("poll_for_draw_triggers_closure_", |
| 428 !poll_for_draw_triggers_closure_.IsCancelled()); |
| 429 scheduler_state->SetBoolean("advance_commit_state_timer_", |
| 430 advance_commit_state_timer_.IsRunning()); |
| 431 state->Set("scheduler_state", scheduler_state.release()); |
420 | 432 |
421 scoped_ptr<base::DictionaryValue> client_state(new base::DictionaryValue); | 433 scoped_ptr<base::DictionaryValue> client_state(new base::DictionaryValue); |
422 client_state->SetDouble("draw_duration_estimate_ms", | 434 client_state->SetDouble("draw_duration_estimate_ms", |
423 client_->DrawDurationEstimate().InMillisecondsF()); | 435 client_->DrawDurationEstimate().InMillisecondsF()); |
424 client_state->SetDouble( | 436 client_state->SetDouble( |
425 "begin_main_frame_to_commit_duration_estimate_ms", | 437 "begin_main_frame_to_commit_duration_estimate_ms", |
426 client_->BeginMainFrameToCommitDurationEstimate().InMillisecondsF()); | 438 client_->BeginMainFrameToCommitDurationEstimate().InMillisecondsF()); |
427 client_state->SetDouble( | 439 client_state->SetDouble( |
428 "commit_to_activate_duration_estimate_ms", | 440 "commit_to_activate_duration_estimate_ms", |
429 client_->CommitToActivateDurationEstimate().InMillisecondsF()); | 441 client_->CommitToActivateDurationEstimate().InMillisecondsF()); |
(...skipping 21 matching lines...) Expand all Loading... |
451 } | 463 } |
452 | 464 |
453 bool Scheduler::IsBeginMainFrameSentOrStarted() const { | 465 bool Scheduler::IsBeginMainFrameSentOrStarted() const { |
454 return (state_machine_.commit_state() == | 466 return (state_machine_.commit_state() == |
455 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_SENT || | 467 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_SENT || |
456 state_machine_.commit_state() == | 468 state_machine_.commit_state() == |
457 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_STARTED); | 469 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_STARTED); |
458 } | 470 } |
459 | 471 |
460 } // namespace cc | 472 } // namespace cc |
OLD | NEW |