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

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

Issue 1150093003: Move GLES2, GPU & Surfaces into the ViewManager directory. This does not merge the applications, th… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 5 years, 7 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "components/surfaces/surfaces_scheduler.h"
6
7 #include "cc/surfaces/display.h"
8
9 namespace surfaces {
10
11 SurfacesScheduler::SurfacesScheduler() {
12 cc::SchedulerSettings settings;
13 scheduler_ = cc::Scheduler::Create(
14 this, settings, 0, base::MessageLoop::current()->task_runner(), nullptr);
15 scheduler_->SetCanStart();
16 scheduler_->SetVisible(true);
17 scheduler_->SetCanDraw(true);
18 scheduler_->SetNeedsCommit();
19 }
20
21 SurfacesScheduler::~SurfacesScheduler() {
22 }
23
24 void SurfacesScheduler::SetNeedsDraw() {
25 // Don't tell the scheduler we need to draw if we have no active displays
26 // which can happen if we haven't initialized displays yet or if all active
27 // displays have lost their context.
28 if (!displays_.empty())
29 scheduler_->SetNeedsRedraw();
30 }
31
32 void SurfacesScheduler::OnVSyncParametersUpdated(base::TimeTicks timebase,
33 base::TimeDelta interval) {
34 scheduler_->CommitVSyncParameters(timebase, interval);
35 }
36
37 void SurfacesScheduler::AddDisplay(cc::Display* display) {
38 DCHECK(displays_.find(display) == displays_.end());
39 displays_.insert(display);
40
41 // A draw might be necessary (e.g., this display might be getting added on
42 // resumption from the app being in the background as happens on android).
43 SetNeedsDraw();
44 }
45
46 void SurfacesScheduler::RemoveDisplay(cc::Display* display) {
47 auto it = displays_.find(display);
48 DCHECK(it != displays_.end());
49 displays_.erase(it);
50 }
51
52 void SurfacesScheduler::WillBeginImplFrame(const cc::BeginFrameArgs& args) {
53 }
54
55 void SurfacesScheduler::DidFinishImplFrame() {
56 }
57
58 void SurfacesScheduler::ScheduledActionSendBeginMainFrame() {
59 scheduler_->NotifyBeginMainFrameStarted();
60 scheduler_->NotifyReadyToCommit();
61 }
62
63 cc::DrawResult SurfacesScheduler::ScheduledActionDrawAndSwapIfPossible() {
64 base::TimeTicks start = base::TimeTicks::Now();
65 for (const auto& it : displays_) {
66 it->Draw();
67 }
68 base::TimeDelta duration = base::TimeTicks::Now() - start;
69
70 draw_estimate_ = (duration + draw_estimate_) / 2;
71 return cc::DRAW_SUCCESS;
72 }
73
74 cc::DrawResult SurfacesScheduler::ScheduledActionDrawAndSwapForced() {
75 NOTREACHED() << "ScheduledActionDrawAndSwapIfPossible always succeeds.";
76 return cc::DRAW_SUCCESS;
77 }
78
79 void SurfacesScheduler::ScheduledActionAnimate() {
80 }
81
82 void SurfacesScheduler::ScheduledActionCommit() {
83 }
84
85 void SurfacesScheduler::ScheduledActionActivateSyncTree() {
86 }
87
88 void SurfacesScheduler::ScheduledActionBeginOutputSurfaceCreation() {
89 scheduler_->DidCreateAndInitializeOutputSurface();
90 }
91
92 void SurfacesScheduler::ScheduledActionPrepareTiles() {
93 }
94
95 void SurfacesScheduler::ScheduledActionInvalidateOutputSurface() {
96 }
97
98 void SurfacesScheduler::DidAnticipatedDrawTimeChange(base::TimeTicks time) {
99 }
100
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(
114 const cc::BeginFrameArgs& args) {
115 }
116
117 void SurfacesScheduler::SendBeginMainFrameNotExpectedSoon() {
118 }
119
120 } // namespace mojo
OLDNEW
« no previous file with comments | « components/surfaces/surfaces_scheduler.h ('k') | components/surfaces/surfaces_service_application.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698