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

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

Issue 1344573002: Mandoline: Rename components/view_manager to components/mus (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 5 years, 3 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 | « components/mus/surfaces/surfaces_scheduler.h ('k') | components/mus/surfaces/surfaces_state.h » ('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 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/mus/surfaces/surfaces_scheduler.h"
6 6
7 #include "cc/debug/rendering_stats_instrumentation.h" 7 #include "cc/debug/rendering_stats_instrumentation.h"
8 #include "cc/scheduler/compositor_timing_history.h" 8 #include "cc/scheduler/compositor_timing_history.h"
9 #include "cc/surfaces/display.h" 9 #include "cc/surfaces/display.h"
10 10
11 namespace surfaces { 11 namespace surfaces {
12 12
13 SurfacesScheduler::SurfacesScheduler() 13 SurfacesScheduler::SurfacesScheduler()
14 : rendering_stats_instrumentation_( 14 : rendering_stats_instrumentation_(
15 cc::RenderingStatsInstrumentation::Create()) { 15 cc::RenderingStatsInstrumentation::Create()) {
16 cc::SchedulerSettings settings; 16 cc::SchedulerSettings settings;
17 scoped_ptr<cc::CompositorTimingHistory> compositor_timing_history( 17 scoped_ptr<cc::CompositorTimingHistory> compositor_timing_history(
18 new cc::CompositorTimingHistory(cc::CompositorTimingHistory::NULL_UMA, 18 new cc::CompositorTimingHistory(cc::CompositorTimingHistory::NULL_UMA,
19 rendering_stats_instrumentation_.get())); 19 rendering_stats_instrumentation_.get()));
20 scheduler_ = cc::Scheduler::Create( 20 scheduler_ = cc::Scheduler::Create(
21 this, settings, 0, base::MessageLoop::current()->task_runner().get(), 21 this, settings, 0, base::MessageLoop::current()->task_runner().get(),
22 nullptr, compositor_timing_history.Pass()); 22 nullptr, compositor_timing_history.Pass());
23 scheduler_->SetCanStart(); 23 scheduler_->SetCanStart();
24 scheduler_->SetVisible(true); 24 scheduler_->SetVisible(true);
25 scheduler_->SetCanDraw(true); 25 scheduler_->SetCanDraw(true);
26 scheduler_->SetNeedsBeginMainFrame(); 26 scheduler_->SetNeedsBeginMainFrame();
27 } 27 }
28 28
29 SurfacesScheduler::~SurfacesScheduler() { 29 SurfacesScheduler::~SurfacesScheduler() {}
30 }
31 30
32 void SurfacesScheduler::SetNeedsDraw() { 31 void SurfacesScheduler::SetNeedsDraw() {
33 // Don't tell the scheduler we need to draw if we have no active displays 32 // Don't tell the scheduler we need to draw if we have no active displays
34 // which can happen if we haven't initialized displays yet or if all active 33 // which can happen if we haven't initialized displays yet or if all active
35 // displays have lost their context. 34 // displays have lost their context.
36 if (!displays_.empty()) 35 if (!displays_.empty())
37 scheduler_->SetNeedsRedraw(); 36 scheduler_->SetNeedsRedraw();
38 } 37 }
39 38
40 void SurfacesScheduler::OnVSyncParametersUpdated(base::TimeTicks timebase, 39 void SurfacesScheduler::OnVSyncParametersUpdated(base::TimeTicks timebase,
41 base::TimeDelta interval) { 40 base::TimeDelta interval) {
42 scheduler_->CommitVSyncParameters(timebase, interval); 41 scheduler_->CommitVSyncParameters(timebase, interval);
43 } 42 }
44 43
45 void SurfacesScheduler::AddDisplay(cc::Display* display) { 44 void SurfacesScheduler::AddDisplay(cc::Display* display) {
46 DCHECK(displays_.find(display) == displays_.end()); 45 DCHECK(displays_.find(display) == displays_.end());
47 displays_.insert(display); 46 displays_.insert(display);
48 47
49 // A draw might be necessary (e.g., this display might be getting added on 48 // A draw might be necessary (e.g., this display might be getting added on
50 // resumption from the app being in the background as happens on android). 49 // resumption from the app being in the background as happens on android).
51 SetNeedsDraw(); 50 SetNeedsDraw();
52 } 51 }
53 52
54 void SurfacesScheduler::RemoveDisplay(cc::Display* display) { 53 void SurfacesScheduler::RemoveDisplay(cc::Display* display) {
55 auto it = displays_.find(display); 54 auto it = displays_.find(display);
56 DCHECK(it != displays_.end()); 55 DCHECK(it != displays_.end());
57 displays_.erase(it); 56 displays_.erase(it);
58 } 57 }
59 58
60 void SurfacesScheduler::WillBeginImplFrame(const cc::BeginFrameArgs& args) { 59 void SurfacesScheduler::WillBeginImplFrame(const cc::BeginFrameArgs& args) {}
61 }
62 60
63 void SurfacesScheduler::DidFinishImplFrame() { 61 void SurfacesScheduler::DidFinishImplFrame() {}
64 }
65 62
66 void SurfacesScheduler::ScheduledActionSendBeginMainFrame() { 63 void SurfacesScheduler::ScheduledActionSendBeginMainFrame() {
67 scheduler_->NotifyBeginMainFrameStarted(); 64 scheduler_->NotifyBeginMainFrameStarted();
68 scheduler_->NotifyReadyToCommit(); 65 scheduler_->NotifyReadyToCommit();
69 } 66 }
70 67
71 cc::DrawResult SurfacesScheduler::ScheduledActionDrawAndSwapIfPossible() { 68 cc::DrawResult SurfacesScheduler::ScheduledActionDrawAndSwapIfPossible() {
72 for (const auto& it : displays_) { 69 for (const auto& it : displays_) {
73 it->DrawAndSwap(); 70 it->DrawAndSwap();
74 } 71 }
75 return cc::DRAW_SUCCESS; 72 return cc::DRAW_SUCCESS;
76 } 73 }
77 74
78 cc::DrawResult SurfacesScheduler::ScheduledActionDrawAndSwapForced() { 75 cc::DrawResult SurfacesScheduler::ScheduledActionDrawAndSwapForced() {
79 NOTREACHED() << "ScheduledActionDrawAndSwapIfPossible always succeeds."; 76 NOTREACHED() << "ScheduledActionDrawAndSwapIfPossible always succeeds.";
80 return cc::DRAW_SUCCESS; 77 return cc::DRAW_SUCCESS;
81 } 78 }
82 79
83 void SurfacesScheduler::ScheduledActionAnimate() { 80 void SurfacesScheduler::ScheduledActionAnimate() {}
84 }
85 81
86 void SurfacesScheduler::ScheduledActionCommit() { 82 void SurfacesScheduler::ScheduledActionCommit() {
87 scheduler_->NotifyReadyToActivate(); 83 scheduler_->NotifyReadyToActivate();
88 } 84 }
89 85
90 void SurfacesScheduler::ScheduledActionActivateSyncTree() { 86 void SurfacesScheduler::ScheduledActionActivateSyncTree() {}
91 }
92 87
93 void SurfacesScheduler::ScheduledActionBeginOutputSurfaceCreation() { 88 void SurfacesScheduler::ScheduledActionBeginOutputSurfaceCreation() {
94 scheduler_->DidCreateAndInitializeOutputSurface(); 89 scheduler_->DidCreateAndInitializeOutputSurface();
95 } 90 }
96 91
97 void SurfacesScheduler::ScheduledActionPrepareTiles() { 92 void SurfacesScheduler::ScheduledActionPrepareTiles() {}
98 }
99 93
100 void SurfacesScheduler::ScheduledActionInvalidateOutputSurface() { 94 void SurfacesScheduler::ScheduledActionInvalidateOutputSurface() {}
101 }
102 95
103 void SurfacesScheduler::SendBeginFramesToChildren( 96 void SurfacesScheduler::SendBeginFramesToChildren(
104 const cc::BeginFrameArgs& args) { 97 const cc::BeginFrameArgs& args) {}
105 }
106 98
107 void SurfacesScheduler::SendBeginMainFrameNotExpectedSoon() { 99 void SurfacesScheduler::SendBeginMainFrameNotExpectedSoon() {}
108 }
109 100
110 } // namespace mojo 101 } // namespace mojo
OLDNEW
« no previous file with comments | « components/mus/surfaces/surfaces_scheduler.h ('k') | components/mus/surfaces/surfaces_state.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698