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

Unified Diff: services/ui/demo/mus_demo.cc

Issue 2440453002: Splitting the Mus demo code out of a service. (Closed)
Patch Set: Addressed @sky comments and synced Created 4 years, 2 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/ui/demo/mus_demo.h ('k') | services/ui/demo/mus_demo_service.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/ui/demo/mus_demo.cc
diff --git a/services/ui/demo/mus_demo.cc b/services/ui/demo/mus_demo.cc
index 40ce7d89a081d997186336e12094b737addfc0a4..ccf221fae5c90d115ffd43ecdd9471c8c0a33ace 100644
--- a/services/ui/demo/mus_demo.cc
+++ b/services/ui/demo/mus_demo.cc
@@ -63,15 +63,10 @@ MusDemo::MusDemo() {}
MusDemo::~MusDemo() {}
-void MusDemo::OnStart(const service_manager::Identity& identity) {
- gpu_service_ = GpuService::Create(connector());
+void MusDemo::Start(service_manager::Connector* connector) {
+ gpu_service_ = GpuService::Create(connector);
window_tree_client_ = base::MakeUnique<WindowTreeClient>(this, this);
- window_tree_client_->ConnectAsWindowManager(connector());
-}
-
-bool MusDemo::OnConnect(const service_manager::Identity& remote_identity,
- service_manager::InterfaceRegistry* registry) {
- return true;
+ window_tree_client_->ConnectAsWindowManager(connector);
}
void MusDemo::OnEmbed(Window* window) {
@@ -156,6 +151,12 @@ void MusDemo::AllocBitmap() {
}
void MusDemo::DrawFrame() {
+ base::TimeTicks now = base::TimeTicks::Now();
+
+ VLOG(1) << (now - last_draw_frame_time_).InMilliseconds()
+ << "ms since the last frame was drawn.";
+ last_draw_frame_time_ = now;
+
angle_ += 2.0;
if (angle_ >= 360.0)
angle_ = 0.0;
@@ -186,9 +187,16 @@ void MusDemo::DrawFrame() {
new std::vector<unsigned char>(addr, addr + bytes));
bitmap_.unlockPixels();
+#if defined(OS_ANDROID)
+ // TODO(jcivelli): find a way to not have an ifdef here.
+ BitmapUploader::Format bitmap_format = BitmapUploader::RGBA;
+#else
+ BitmapUploader::Format bitmap_format = BitmapUploader::BGRA;
+#endif
+
// Send frame to MUS via BitmapUploader.
uploader_->SetBitmap(bounds.width(), bounds.height(), std::move(data),
- BitmapUploader::BGRA);
+ bitmap_format);
}
} // namespace demo
« no previous file with comments | « services/ui/demo/mus_demo.h ('k') | services/ui/demo/mus_demo_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698