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

Side by Side Diff: components/view_manager/surfaces/surfaces_scheduler.cc

Issue 1184863004: cc: Move timing history to the Scheduler. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase, add include Created 5 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "components/view_manager/surfaces/surfaces_scheduler.h" 5 #include "components/view_manager/surfaces/surfaces_scheduler.h"
6 6
7 #include "cc/debug/rendering_stats_instrumentation.h"
7 #include "cc/surfaces/display.h" 8 #include "cc/surfaces/display.h"
8 9
10
9 namespace surfaces { 11 namespace surfaces {
10 12
11 SurfacesScheduler::SurfacesScheduler() { 13 SurfacesScheduler::SurfacesScheduler()
14 : rendering_stats_instrumentation_(
15 RenderingStatsInstrumentation::Create()) {
12 cc::SchedulerSettings settings; 16 cc::SchedulerSettings settings;
13 scheduler_ = cc::Scheduler::Create( 17 scheduler_ = cc::Scheduler::Create(
14 this, settings, 0, base::MessageLoop::current()->task_runner(), nullptr); 18 this, settings, 0, base::MessageLoop::current()->task_runner(), nullptr,
19 rendering_stats_instrumentation_.get());
15 scheduler_->SetCanStart(); 20 scheduler_->SetCanStart();
16 scheduler_->SetVisible(true); 21 scheduler_->SetVisible(true);
17 scheduler_->SetCanDraw(true); 22 scheduler_->SetCanDraw(true);
18 scheduler_->SetNeedsCommit(); 23 scheduler_->SetNeedsCommit();
19 } 24 }
20 25
21 SurfacesScheduler::~SurfacesScheduler() { 26 SurfacesScheduler::~SurfacesScheduler() {
22 } 27 }
23 28
24 void SurfacesScheduler::SetNeedsDraw() { 29 void SurfacesScheduler::SetNeedsDraw() {
(...skipping 29 matching lines...) Expand all
54 59
55 void SurfacesScheduler::DidFinishImplFrame() { 60 void SurfacesScheduler::DidFinishImplFrame() {
56 } 61 }
57 62
58 void SurfacesScheduler::ScheduledActionSendBeginMainFrame() { 63 void SurfacesScheduler::ScheduledActionSendBeginMainFrame() {
59 scheduler_->NotifyBeginMainFrameStarted(); 64 scheduler_->NotifyBeginMainFrameStarted();
60 scheduler_->NotifyReadyToCommit(); 65 scheduler_->NotifyReadyToCommit();
61 } 66 }
62 67
63 cc::DrawResult SurfacesScheduler::ScheduledActionDrawAndSwapIfPossible() { 68 cc::DrawResult SurfacesScheduler::ScheduledActionDrawAndSwapIfPossible() {
64 base::TimeTicks start = base::TimeTicks::Now();
65 for (const auto& it : displays_) { 69 for (const auto& it : displays_) {
66 it->DrawAndSwap(); 70 it->DrawAndSwap();
67 } 71 }
68 base::TimeDelta duration = base::TimeTicks::Now() - start;
69
70 draw_estimate_ = (duration + draw_estimate_) / 2;
71 return cc::DRAW_SUCCESS; 72 return cc::DRAW_SUCCESS;
72 } 73 }
73 74
74 cc::DrawResult SurfacesScheduler::ScheduledActionDrawAndSwapForced() { 75 cc::DrawResult SurfacesScheduler::ScheduledActionDrawAndSwapForced() {
75 NOTREACHED() << "ScheduledActionDrawAndSwapIfPossible always succeeds."; 76 NOTREACHED() << "ScheduledActionDrawAndSwapIfPossible always succeeds.";
76 return cc::DRAW_SUCCESS; 77 return cc::DRAW_SUCCESS;
77 } 78 }
78 79
79 void SurfacesScheduler::ScheduledActionAnimate() { 80 void SurfacesScheduler::ScheduledActionAnimate() {
80 } 81 }
81 82
82 void SurfacesScheduler::ScheduledActionCommit() { 83 void SurfacesScheduler::ScheduledActionCommit() {
83 scheduler_->NotifyReadyToActivate(); 84 scheduler_->NotifyReadyToActivate();
84 } 85 }
85 86
86 void SurfacesScheduler::ScheduledActionActivateSyncTree() { 87 void SurfacesScheduler::ScheduledActionActivateSyncTree() {
87 } 88 }
88 89
89 void SurfacesScheduler::ScheduledActionBeginOutputSurfaceCreation() { 90 void SurfacesScheduler::ScheduledActionBeginOutputSurfaceCreation() {
90 scheduler_->DidCreateAndInitializeOutputSurface(); 91 scheduler_->DidCreateAndInitializeOutputSurface();
91 } 92 }
92 93
93 void SurfacesScheduler::ScheduledActionPrepareTiles() { 94 void SurfacesScheduler::ScheduledActionPrepareTiles() {
94 } 95 }
95 96
96 void SurfacesScheduler::ScheduledActionInvalidateOutputSurface() { 97 void SurfacesScheduler::ScheduledActionInvalidateOutputSurface() {
97 } 98 }
98 99
99 base::TimeDelta SurfacesScheduler::DrawDurationEstimate() {
100 return draw_estimate_;
101 }
102
103 base::TimeDelta SurfacesScheduler::BeginMainFrameToCommitDurationEstimate() {
104 return base::TimeDelta();
105 }
106
107 base::TimeDelta SurfacesScheduler::CommitToActivateDurationEstimate() {
108 return base::TimeDelta();
109 }
110
111 void SurfacesScheduler::SendBeginFramesToChildren( 100 void SurfacesScheduler::SendBeginFramesToChildren(
112 const cc::BeginFrameArgs& args) { 101 const cc::BeginFrameArgs& args) {
113 } 102 }
114 103
115 void SurfacesScheduler::SendBeginMainFrameNotExpectedSoon() { 104 void SurfacesScheduler::SendBeginMainFrameNotExpectedSoon() {
116 } 105 }
117 106
118 } // namespace mojo 107 } // namespace mojo
OLDNEW
« cc/scheduler/scheduler.cc ('K') | « components/view_manager/surfaces/surfaces_scheduler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698