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

Unified Diff: mojo/services/surfaces/surfaces_scheduler.cc

Issue 1049993002: Get mojo_shell building inside chromium checkout. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix presubmit Created 5 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/services/surfaces/surfaces_scheduler.h ('k') | mojo/services/surfaces/surfaces_service_application.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/services/surfaces/surfaces_scheduler.cc
diff --git a/mojo/services/surfaces/surfaces_scheduler.cc b/mojo/services/surfaces/surfaces_scheduler.cc
new file mode 100644
index 0000000000000000000000000000000000000000..a86dd905b607ba8f5da50049962fb1791a3a363f
--- /dev/null
+++ b/mojo/services/surfaces/surfaces_scheduler.cc
@@ -0,0 +1,113 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "mojo/services/surfaces/surfaces_scheduler.h"
+
+#include "cc/surfaces/display.h"
+
+namespace surfaces {
+
+SurfacesScheduler::SurfacesScheduler() {
+ cc::SchedulerSettings settings;
+ scheduler_ = cc::Scheduler::Create(
+ this, settings, 0, base::MessageLoop::current()->task_runner(), nullptr);
+ scheduler_->SetCanStart();
+ scheduler_->SetVisible(true);
+ scheduler_->SetCanDraw(true);
+ scheduler_->SetNeedsCommit();
+}
+
+SurfacesScheduler::~SurfacesScheduler() {
+}
+
+void SurfacesScheduler::SetNeedsDraw() {
+ // Don't tell the scheduler we need to draw if we have no active displays
+ // which can happen if we haven't initialized displays yet or if all active
+ // displays have lost their context.
+ if (!displays_.empty())
+ scheduler_->SetNeedsRedraw();
+}
+
+void SurfacesScheduler::OnVSyncParametersUpdated(base::TimeTicks timebase,
+ base::TimeDelta interval) {
+ scheduler_->CommitVSyncParameters(timebase, interval);
+}
+
+void SurfacesScheduler::AddDisplay(cc::Display* display) {
+ DCHECK(displays_.find(display) == displays_.end());
+ displays_.insert(display);
+}
+
+void SurfacesScheduler::RemoveDisplay(cc::Display* display) {
+ auto it = displays_.find(display);
+ DCHECK(it != displays_.end());
+ displays_.erase(it);
+}
+
+void SurfacesScheduler::WillBeginImplFrame(const cc::BeginFrameArgs& args) {
+}
+
+void SurfacesScheduler::ScheduledActionSendBeginMainFrame() {
+ scheduler_->NotifyBeginMainFrameStarted();
+ scheduler_->NotifyReadyToCommit();
+}
+
+cc::DrawResult SurfacesScheduler::ScheduledActionDrawAndSwapIfPossible() {
+ base::TimeTicks start = base::TimeTicks::Now();
+ for (const auto& it : displays_) {
+ it->Draw();
+ }
+ base::TimeDelta duration = base::TimeTicks::Now() - start;
+
+ draw_estimate_ = (duration + draw_estimate_) / 2;
+ return cc::DRAW_SUCCESS;
+}
+
+cc::DrawResult SurfacesScheduler::ScheduledActionDrawAndSwapForced() {
+ NOTREACHED() << "ScheduledActionDrawAndSwapIfPossible always succeeds.";
+ return cc::DRAW_SUCCESS;
+}
+
+void SurfacesScheduler::ScheduledActionAnimate() {
+}
+
+void SurfacesScheduler::ScheduledActionCommit() {
+}
+
+void SurfacesScheduler::ScheduledActionActivateSyncTree() {
+}
+
+void SurfacesScheduler::ScheduledActionBeginOutputSurfaceCreation() {
+ scheduler_->DidCreateAndInitializeOutputSurface();
+}
+
+void SurfacesScheduler::ScheduledActionPrepareTiles() {
+}
+
+void SurfacesScheduler::DidAnticipatedDrawTimeChange(base::TimeTicks time) {
+}
+
+base::TimeDelta SurfacesScheduler::DrawDurationEstimate() {
+ return draw_estimate_;
+}
+
+base::TimeDelta SurfacesScheduler::BeginMainFrameToCommitDurationEstimate() {
+ return base::TimeDelta();
+}
+
+base::TimeDelta SurfacesScheduler::CommitToActivateDurationEstimate() {
+ return base::TimeDelta();
+}
+
+void SurfacesScheduler::DidBeginImplFrameDeadline() {
+}
+
+void SurfacesScheduler::SendBeginFramesToChildren(
+ const cc::BeginFrameArgs& args) {
+}
+
+void SurfacesScheduler::SendBeginMainFrameNotExpectedSoon() {
+}
+
+} // namespace mojo
« no previous file with comments | « mojo/services/surfaces/surfaces_scheduler.h ('k') | mojo/services/surfaces/surfaces_service_application.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698