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

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

Issue 502203003: Remove implicit conversions from scoped_refptr to T* in cc/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Change to use .get() instead of rewriting local variable Created 6 years, 4 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
« no previous file with comments | « cc/resources/tile_manager_unittest.cc ('k') | cc/scheduler/scheduler_state_machine.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/debug/trace_event_argument.h" 10 #include "base/debug/trace_event_argument.h"
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 begin_impl_frame_args_.deadline); 267 begin_impl_frame_args_.deadline);
268 int64 intervals = 1 + ((now - timebase) / begin_impl_frame_args_.interval); 268 int64 intervals = 1 + ((now - timebase) / begin_impl_frame_args_.interval);
269 return timebase + (begin_impl_frame_args_.interval * intervals); 269 return timebase + (begin_impl_frame_args_.interval * intervals);
270 } 270 }
271 271
272 base::TimeTicks Scheduler::LastBeginImplFrameTime() { 272 base::TimeTicks Scheduler::LastBeginImplFrameTime() {
273 return begin_impl_frame_args_.frame_time; 273 return begin_impl_frame_args_.frame_time;
274 } 274 }
275 275
276 void Scheduler::SetupNextBeginFrameIfNeeded() { 276 void Scheduler::SetupNextBeginFrameIfNeeded() {
277 if (!task_runner_) 277 if (!task_runner_.get())
278 return; 278 return;
279 279
280 bool needs_begin_frame = state_machine_.BeginFrameNeeded(); 280 bool needs_begin_frame = state_machine_.BeginFrameNeeded();
281 281
282 if (settings_.throttle_frame_production) { 282 if (settings_.throttle_frame_production) {
283 SetupNextBeginFrameWhenVSyncThrottlingEnabled(needs_begin_frame); 283 SetupNextBeginFrameWhenVSyncThrottlingEnabled(needs_begin_frame);
284 } else { 284 } else {
285 SetupNextBeginFrameWhenVSyncThrottlingDisabled(needs_begin_frame); 285 SetupNextBeginFrameWhenVSyncThrottlingDisabled(needs_begin_frame);
286 } 286 }
287 SetupPollingMechanisms(needs_begin_frame); 287 SetupPollingMechanisms(needs_begin_frame);
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after
683 683
684 bool Scheduler::WillDrawIfNeeded() const { 684 bool Scheduler::WillDrawIfNeeded() const {
685 return !state_machine_.PendingDrawsShouldBeAborted(); 685 return !state_machine_.PendingDrawsShouldBeAborted();
686 } 686 }
687 687
688 scoped_refptr<base::debug::ConvertableToTraceFormat> Scheduler::AsValue() 688 scoped_refptr<base::debug::ConvertableToTraceFormat> Scheduler::AsValue()
689 const { 689 const {
690 scoped_refptr<base::debug::TracedValue> state = 690 scoped_refptr<base::debug::TracedValue> state =
691 new base::debug::TracedValue(); 691 new base::debug::TracedValue();
692 state->BeginDictionary("state_machine"); 692 state->BeginDictionary("state_machine");
693 state_machine_.AsValueInto(state); 693 state_machine_.AsValueInto(state.get());
694 state->EndDictionary(); 694 state->EndDictionary();
695 if (synthetic_begin_frame_source_) { 695 if (synthetic_begin_frame_source_) {
696 state->BeginDictionary("synthetic_begin_frame_source_"); 696 state->BeginDictionary("synthetic_begin_frame_source_");
697 synthetic_begin_frame_source_->AsValueInto(state); 697 synthetic_begin_frame_source_->AsValueInto(state.get());
698 state->EndDictionary(); 698 state->EndDictionary();
699 } 699 }
700 700
701 state->BeginDictionary("scheduler_state"); 701 state->BeginDictionary("scheduler_state");
702 state->SetDouble( 702 state->SetDouble(
703 "time_until_anticipated_draw_time_ms", 703 "time_until_anticipated_draw_time_ms",
704 (AnticipatedDrawTime() - base::TimeTicks::Now()).InMillisecondsF()); 704 (AnticipatedDrawTime() - base::TimeTicks::Now()).InMillisecondsF());
705 state->SetDouble("vsync_interval_ms", vsync_interval_.InMillisecondsF()); 705 state->SetDouble("vsync_interval_ms", vsync_interval_.InMillisecondsF());
706 state->SetDouble("estimated_parent_draw_time_ms", 706 state->SetDouble("estimated_parent_draw_time_ms",
707 estimated_parent_draw_time_.InMillisecondsF()); 707 estimated_parent_draw_time_.InMillisecondsF());
708 state->SetBoolean("last_set_needs_begin_frame_", last_set_needs_begin_frame_); 708 state->SetBoolean("last_set_needs_begin_frame_", last_set_needs_begin_frame_);
709 state->SetBoolean("begin_unthrottled_frame_posted_", 709 state->SetBoolean("begin_unthrottled_frame_posted_",
710 begin_unthrottled_frame_posted_); 710 begin_unthrottled_frame_posted_);
711 state->SetBoolean("begin_retro_frame_posted_", begin_retro_frame_posted_); 711 state->SetBoolean("begin_retro_frame_posted_", begin_retro_frame_posted_);
712 state->SetInteger("begin_retro_frame_args_", begin_retro_frame_args_.size()); 712 state->SetInteger("begin_retro_frame_args_", begin_retro_frame_args_.size());
713 state->SetBoolean("begin_impl_frame_deadline_task_", 713 state->SetBoolean("begin_impl_frame_deadline_task_",
714 !begin_impl_frame_deadline_task_.IsCancelled()); 714 !begin_impl_frame_deadline_task_.IsCancelled());
715 state->SetBoolean("poll_for_draw_triggers_task_", 715 state->SetBoolean("poll_for_draw_triggers_task_",
716 !poll_for_draw_triggers_task_.IsCancelled()); 716 !poll_for_draw_triggers_task_.IsCancelled());
717 state->SetBoolean("advance_commit_state_task_", 717 state->SetBoolean("advance_commit_state_task_",
718 !advance_commit_state_task_.IsCancelled()); 718 !advance_commit_state_task_.IsCancelled());
719 state->BeginDictionary("begin_impl_frame_args"); 719 state->BeginDictionary("begin_impl_frame_args");
720 begin_impl_frame_args_.AsValueInto(state); 720 begin_impl_frame_args_.AsValueInto(state.get());
721 state->EndDictionary(); 721 state->EndDictionary();
722 722
723 state->EndDictionary(); 723 state->EndDictionary();
724 724
725 state->BeginDictionary("client_state"); 725 state->BeginDictionary("client_state");
726 state->SetDouble("draw_duration_estimate_ms", 726 state->SetDouble("draw_duration_estimate_ms",
727 client_->DrawDurationEstimate().InMillisecondsF()); 727 client_->DrawDurationEstimate().InMillisecondsF());
728 state->SetDouble( 728 state->SetDouble(
729 "begin_main_frame_to_commit_duration_estimate_ms", 729 "begin_main_frame_to_commit_duration_estimate_ms",
730 client_->BeginMainFrameToCommitDurationEstimate().InMillisecondsF()); 730 client_->BeginMainFrameToCommitDurationEstimate().InMillisecondsF());
(...skipping 24 matching lines...) Expand all
755 } 755 }
756 756
757 bool Scheduler::IsBeginMainFrameSentOrStarted() const { 757 bool Scheduler::IsBeginMainFrameSentOrStarted() const {
758 return (state_machine_.commit_state() == 758 return (state_machine_.commit_state() ==
759 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_SENT || 759 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_SENT ||
760 state_machine_.commit_state() == 760 state_machine_.commit_state() ==
761 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_STARTED); 761 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_STARTED);
762 } 762 }
763 763
764 } // namespace cc 764 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/tile_manager_unittest.cc ('k') | cc/scheduler/scheduler_state_machine.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698