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

Side by Side Diff: services/surfaces/surfaces_scheduler.cc

Issue 827163002: Fix surfaces scheduler so apps can draw (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 11 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "services/surfaces/surfaces_scheduler.h" 5 #include "services/surfaces/surfaces_scheduler.h"
6 6
7 namespace surfaces { 7 namespace surfaces {
8 8
9 SurfacesScheduler::Client::~Client() { 9 SurfacesScheduler::Client::~Client() {
10 } 10 }
11 11
12 SurfacesScheduler::SurfacesScheduler(Client* client) : client_(client) { 12 SurfacesScheduler::SurfacesScheduler(Client* client) : client_(client) {
13 cc::SchedulerSettings settings; 13 cc::SchedulerSettings settings;
14 scheduler_ = cc::Scheduler::Create( 14 scheduler_ = cc::Scheduler::Create(
15 this, settings, 0, base::MessageLoop::current()->task_runner(), nullptr, 15 this, settings, 0, base::MessageLoop::current()->task_runner(), nullptr,
16 nullptr); 16 nullptr);
17 scheduler_->SetCanStart(); 17 scheduler_->SetCanStart();
18 scheduler_->SetVisible(true); 18 scheduler_->SetVisible(true);
19 scheduler_->SetCanDraw(true); 19 scheduler_->SetCanDraw(true);
20 scheduler_->SetNeedsCommit();
20 } 21 }
21 22
22 SurfacesScheduler::~SurfacesScheduler() { 23 SurfacesScheduler::~SurfacesScheduler() {
23 } 24 }
24 25
25 void SurfacesScheduler::SetNeedsDraw() { 26 void SurfacesScheduler::SetNeedsDraw() {
26 scheduler_->SetNeedsRedraw(); 27 scheduler_->SetNeedsRedraw();
27 } 28 }
28 29
29 void SurfacesScheduler::OnVSyncParametersUpdated(base::TimeTicks timebase, 30 void SurfacesScheduler::OnVSyncParametersUpdated(base::TimeTicks timebase,
30 base::TimeDelta interval) { 31 base::TimeDelta interval) {
31 scheduler_->CommitVSyncParameters(timebase, interval); 32 scheduler_->CommitVSyncParameters(timebase, interval);
32 } 33 }
33 34
34 void SurfacesScheduler::WillBeginImplFrame(const cc::BeginFrameArgs& args) { 35 void SurfacesScheduler::WillBeginImplFrame(const cc::BeginFrameArgs& args) {
35 } 36 }
36 37
37 void SurfacesScheduler::ScheduledActionSendBeginMainFrame() { 38 void SurfacesScheduler::ScheduledActionSendBeginMainFrame() {
39 scheduler_->NotifyBeginMainFrameStarted();
40 scheduler_->NotifyReadyToCommit();
38 } 41 }
39 42
40 cc::DrawResult SurfacesScheduler::ScheduledActionDrawAndSwapIfPossible() { 43 cc::DrawResult SurfacesScheduler::ScheduledActionDrawAndSwapIfPossible() {
41 base::TimeTicks start = base::TimeTicks::Now(); 44 base::TimeTicks start = base::TimeTicks::Now();
42 client_->Draw(); 45 client_->Draw();
43 base::TimeDelta duration = base::TimeTicks::Now() - start; 46 base::TimeDelta duration = base::TimeTicks::Now() - start;
44 47
45 draw_estimate_ = (duration + draw_estimate_) / 2; 48 draw_estimate_ = (duration + draw_estimate_) / 2;
46 return cc::DRAW_SUCCESS; 49 return cc::DRAW_SUCCESS;
47 } 50 }
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 } 86 }
84 87
85 void SurfacesScheduler::DidBeginImplFrameDeadline() { 88 void SurfacesScheduler::DidBeginImplFrameDeadline() {
86 } 89 }
87 90
88 void SurfacesScheduler::SendBeginFramesToChildren( 91 void SurfacesScheduler::SendBeginFramesToChildren(
89 const cc::BeginFrameArgs& args) { 92 const cc::BeginFrameArgs& args) {
90 } 93 }
91 94
92 } // namespace mojo 95 } // namespace mojo
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698