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

Unified Diff: services/surfaces/surfaces_scheduler.cc

Issue 940293003: Add a Display and ContextProvider concept to mojom, use to recreate (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 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 | « services/surfaces/surfaces_scheduler.h ('k') | services/surfaces/surfaces_service_application.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/surfaces/surfaces_scheduler.cc
diff --git a/services/surfaces/surfaces_scheduler.cc b/services/surfaces/surfaces_scheduler.cc
index 0d042949feed5b0e6a40aaa1beeacc4c5ade2c7a..63942dbcee9e37b812dc07c887a5f3573568091d 100644
--- a/services/surfaces/surfaces_scheduler.cc
+++ b/services/surfaces/surfaces_scheduler.cc
@@ -4,12 +4,11 @@
#include "services/surfaces/surfaces_scheduler.h"
-namespace surfaces {
+#include "cc/surfaces/display.h"
-SurfacesScheduler::Client::~Client() {
-}
+namespace surfaces {
-SurfacesScheduler::SurfacesScheduler(Client* client) : client_(client) {
+SurfacesScheduler::SurfacesScheduler() {
cc::SchedulerSettings settings;
scheduler_ = cc::Scheduler::Create(
this, settings, 0, base::MessageLoop::current()->task_runner(), nullptr,
@@ -32,6 +31,17 @@ void SurfacesScheduler::OnVSyncParametersUpdated(base::TimeTicks timebase,
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) {
}
@@ -42,7 +52,9 @@ void SurfacesScheduler::ScheduledActionSendBeginMainFrame() {
cc::DrawResult SurfacesScheduler::ScheduledActionDrawAndSwapIfPossible() {
base::TimeTicks start = base::TimeTicks::Now();
- client_->Draw();
+ for (const auto& it : displays_) {
+ it->Draw();
+ }
base::TimeDelta duration = base::TimeTicks::Now() - start;
draw_estimate_ = (duration + draw_estimate_) / 2;
« no previous file with comments | « services/surfaces/surfaces_scheduler.h ('k') | services/surfaces/surfaces_service_application.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698