Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(601)

Side by Side Diff: cc/scheduler/scheduler.cc

Issue 307773005: Adding AsValue and TypeString methods to DelayBasedTimeSource. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebasing onto master. Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 bool Scheduler::SyntheticBeginFrameSource::IsActive() const { 54 bool Scheduler::SyntheticBeginFrameSource::IsActive() const {
55 return time_source_->Active(); 55 return time_source_->Active();
56 } 56 }
57 57
58 void Scheduler::SyntheticBeginFrameSource::OnTimerTick() { 58 void Scheduler::SyntheticBeginFrameSource::OnTimerTick() {
59 BeginFrameArgs begin_frame_args( 59 BeginFrameArgs begin_frame_args(
60 CreateSyntheticBeginFrameArgs(time_source_->LastTickTime())); 60 CreateSyntheticBeginFrameArgs(time_source_->LastTickTime()));
61 scheduler_->BeginFrame(begin_frame_args); 61 scheduler_->BeginFrame(begin_frame_args);
62 } 62 }
63 63
64 scoped_ptr<base::Value> Scheduler::SyntheticBeginFrameSource::AsValue() const {
65 return time_source_->AsValue();
66 }
67
64 BeginFrameArgs 68 BeginFrameArgs
65 Scheduler::SyntheticBeginFrameSource::CreateSyntheticBeginFrameArgs( 69 Scheduler::SyntheticBeginFrameSource::CreateSyntheticBeginFrameArgs(
66 base::TimeTicks frame_time) { 70 base::TimeTicks frame_time) {
67 base::TimeTicks deadline = 71 base::TimeTicks deadline =
68 time_source_->NextTickTime() - scheduler_->EstimatedParentDrawTime(); 72 time_source_->NextTickTime() - scheduler_->EstimatedParentDrawTime();
69 return BeginFrameArgs::Create( 73 return BeginFrameArgs::Create(
70 frame_time, deadline, scheduler_->VSyncInterval()); 74 frame_time, deadline, scheduler_->VSyncInterval());
71 } 75 }
72 76
73 Scheduler::Scheduler( 77 Scheduler::Scheduler(
(...skipping 595 matching lines...) Expand 10 before | Expand all | Expand 10 after
669 } 673 }
670 } 674 }
671 675
672 bool Scheduler::WillDrawIfNeeded() const { 676 bool Scheduler::WillDrawIfNeeded() const {
673 return !state_machine_.PendingDrawsShouldBeAborted(); 677 return !state_machine_.PendingDrawsShouldBeAborted();
674 } 678 }
675 679
676 scoped_ptr<base::Value> Scheduler::AsValue() const { 680 scoped_ptr<base::Value> Scheduler::AsValue() const {
677 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue); 681 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue);
678 state->Set("state_machine", state_machine_.AsValue().release()); 682 state->Set("state_machine", state_machine_.AsValue().release());
683 if (synthetic_begin_frame_source_)
684 state->Set("synthetic_begin_frame_source_",
685 synthetic_begin_frame_source_->AsValue().release());
679 686
680 scoped_ptr<base::DictionaryValue> scheduler_state(new base::DictionaryValue); 687 scoped_ptr<base::DictionaryValue> scheduler_state(new base::DictionaryValue);
681 scheduler_state->SetDouble( 688 scheduler_state->SetDouble(
682 "time_until_anticipated_draw_time_ms", 689 "time_until_anticipated_draw_time_ms",
683 (AnticipatedDrawTime() - base::TimeTicks::Now()).InMillisecondsF()); 690 (AnticipatedDrawTime() - base::TimeTicks::Now()).InMillisecondsF());
684 scheduler_state->SetDouble("vsync_interval_ms", 691 scheduler_state->SetDouble("vsync_interval_ms",
685 vsync_interval_.InMillisecondsF()); 692 vsync_interval_.InMillisecondsF());
686 scheduler_state->SetDouble("estimated_parent_draw_time_ms", 693 scheduler_state->SetDouble("estimated_parent_draw_time_ms",
687 estimated_parent_draw_time_.InMillisecondsF()); 694 estimated_parent_draw_time_.InMillisecondsF());
688 scheduler_state->SetBoolean("last_set_needs_begin_frame_", 695 scheduler_state->SetBoolean("last_set_needs_begin_frame_",
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
737 } 744 }
738 745
739 bool Scheduler::IsBeginMainFrameSentOrStarted() const { 746 bool Scheduler::IsBeginMainFrameSentOrStarted() const {
740 return (state_machine_.commit_state() == 747 return (state_machine_.commit_state() ==
741 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_SENT || 748 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_SENT ||
742 state_machine_.commit_state() == 749 state_machine_.commit_state() ==
743 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_STARTED); 750 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_STARTED);
744 } 751 }
745 752
746 } // namespace cc 753 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698