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

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

Issue 1192663005: cc: Measure compositor timing with finer granularity (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@modeTimingHistory3
Patch Set: fixes 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/surfaces/display.h" 7 #include "cc/surfaces/display.h"
8 8
9 namespace surfaces { 9 namespace surfaces {
10 10
11 SurfacesScheduler::SurfacesScheduler() { 11 SurfacesScheduler::SurfacesScheduler()
12 : rendering_stats_instrumentation_(
13 RenderingStatsInstrumentation::Create()) {
12 cc::SchedulerSettings settings; 14 cc::SchedulerSettings settings;
13 scheduler_ = cc::Scheduler::Create( 15 scheduler_ = cc::Scheduler::Create(
14 this, settings, 0, base::MessageLoop::current()->task_runner(), nullptr); 16 this, settings, 0, base::MessageLoop::current()->task_runner(), nullptr,
17 rendering_stats_instrumentation_.get());
15 scheduler_->SetCanStart(); 18 scheduler_->SetCanStart();
16 scheduler_->SetVisible(true); 19 scheduler_->SetVisible(true);
17 scheduler_->SetCanDraw(true); 20 scheduler_->SetCanDraw(true);
18 scheduler_->SetNeedsCommit(); 21 scheduler_->SetNeedsCommit();
19 } 22 }
20 23
21 SurfacesScheduler::~SurfacesScheduler() { 24 SurfacesScheduler::~SurfacesScheduler() {
22 } 25 }
23 26
24 void SurfacesScheduler::SetNeedsDraw() { 27 void SurfacesScheduler::SetNeedsDraw() {
(...skipping 29 matching lines...) Expand all
54 57
55 void SurfacesScheduler::DidFinishImplFrame() { 58 void SurfacesScheduler::DidFinishImplFrame() {
56 } 59 }
57 60
58 void SurfacesScheduler::ScheduledActionSendBeginMainFrame() { 61 void SurfacesScheduler::ScheduledActionSendBeginMainFrame() {
59 scheduler_->NotifyBeginMainFrameStarted(); 62 scheduler_->NotifyBeginMainFrameStarted();
60 scheduler_->NotifyReadyToCommit(); 63 scheduler_->NotifyReadyToCommit();
61 } 64 }
62 65
63 cc::DrawResult SurfacesScheduler::ScheduledActionDrawAndSwapIfPossible() { 66 cc::DrawResult SurfacesScheduler::ScheduledActionDrawAndSwapIfPossible() {
64 base::TimeTicks start = base::TimeTicks::Now();
65 for (const auto& it : displays_) { 67 for (const auto& it : displays_) {
66 it->DrawAndSwap(); 68 it->DrawAndSwap();
67 } 69 }
68 base::TimeDelta duration = base::TimeTicks::Now() - start;
69
70 draw_estimate_ = (duration + draw_estimate_) / 2;
71 return cc::DRAW_SUCCESS; 70 return cc::DRAW_SUCCESS;
72 } 71 }
73 72
74 cc::DrawResult SurfacesScheduler::ScheduledActionDrawAndSwapForced() { 73 cc::DrawResult SurfacesScheduler::ScheduledActionDrawAndSwapForced() {
75 NOTREACHED() << "ScheduledActionDrawAndSwapIfPossible always succeeds."; 74 NOTREACHED() << "ScheduledActionDrawAndSwapIfPossible always succeeds.";
76 return cc::DRAW_SUCCESS; 75 return cc::DRAW_SUCCESS;
77 } 76 }
78 77
79 void SurfacesScheduler::ScheduledActionAnimate() { 78 void SurfacesScheduler::ScheduledActionAnimate() {
80 } 79 }
(...skipping 10 matching lines...) Expand all
91 90
92 void SurfacesScheduler::ScheduledActionPrepareTiles() { 91 void SurfacesScheduler::ScheduledActionPrepareTiles() {
93 } 92 }
94 93
95 void SurfacesScheduler::ScheduledActionInvalidateOutputSurface() { 94 void SurfacesScheduler::ScheduledActionInvalidateOutputSurface() {
96 } 95 }
97 96
98 void SurfacesScheduler::DidAnticipatedDrawTimeChange(base::TimeTicks time) { 97 void SurfacesScheduler::DidAnticipatedDrawTimeChange(base::TimeTicks time) {
99 } 98 }
100 99
101 base::TimeDelta SurfacesScheduler::DrawDurationEstimate() {
102 return draw_estimate_;
103 }
104
105 base::TimeDelta SurfacesScheduler::BeginMainFrameToCommitDurationEstimate() {
106 return base::TimeDelta();
107 }
108
109 base::TimeDelta SurfacesScheduler::CommitToActivateDurationEstimate() {
110 return base::TimeDelta();
111 }
112
113 void SurfacesScheduler::SendBeginFramesToChildren( 100 void SurfacesScheduler::SendBeginFramesToChildren(
114 const cc::BeginFrameArgs& args) { 101 const cc::BeginFrameArgs& args) {
115 } 102 }
116 103
117 void SurfacesScheduler::SendBeginMainFrameNotExpectedSoon() { 104 void SurfacesScheduler::SendBeginMainFrameNotExpectedSoon() {
118 } 105 }
119 106
120 } // namespace mojo 107 } // namespace mojo
OLDNEW
« cc/scheduler/scheduler_unittest.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