| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "services/ui/demo/mus_demo.h" | 5 #include "services/ui/demo/mus_demo.h" |
| 6 | 6 |
| 7 #include "base/time/time.h" | 7 #include "base/time/time.h" |
| 8 #include "services/shell/public/cpp/connector.h" | 8 #include "services/shell/public/cpp/connector.h" |
| 9 #include "services/ui/common/gpu_service.h" | 9 #include "services/ui/common/gpu_service.h" |
| 10 #include "services/ui/public/cpp/bitmap_uploader.h" | 10 #include "services/ui/public/cpp/bitmap_uploader.h" |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 bool janky) { | 108 bool janky) { |
| 109 // Don't care | 109 // Don't care |
| 110 } | 110 } |
| 111 | 111 |
| 112 void MusDemo::OnWmNewDisplay(Window* window, const display::Display& display) { | 112 void MusDemo::OnWmNewDisplay(Window* window, const display::Display& display) { |
| 113 DCHECK(!window_); // Only support one display. | 113 DCHECK(!window_); // Only support one display. |
| 114 window_ = window; | 114 window_ = window; |
| 115 | 115 |
| 116 // Initialize bitmap uploader for sending frames to MUS. | 116 // Initialize bitmap uploader for sending frames to MUS. |
| 117 uploader_.reset(new ui::BitmapUploader(window_)); | 117 uploader_.reset(new ui::BitmapUploader(window_)); |
| 118 uploader_->Init(connector()); | 118 uploader_->Init(); |
| 119 | 119 |
| 120 // Draw initial frame and start the timer to regularly draw frames. | 120 // Draw initial frame and start the timer to regularly draw frames. |
| 121 DrawFrame(); | 121 DrawFrame(); |
| 122 timer_.Start(FROM_HERE, base::TimeDelta::FromMilliseconds(kFrameDelay), | 122 timer_.Start(FROM_HERE, base::TimeDelta::FromMilliseconds(kFrameDelay), |
| 123 base::Bind(&MusDemo::DrawFrame, base::Unretained(this))); | 123 base::Bind(&MusDemo::DrawFrame, base::Unretained(this))); |
| 124 } | 124 } |
| 125 | 125 |
| 126 void MusDemo::OnWmPerformMoveLoop(Window* window, | 126 void MusDemo::OnWmPerformMoveLoop(Window* window, |
| 127 mojom::MoveLoopSource source, | 127 mojom::MoveLoopSource source, |
| 128 const gfx::Point& cursor_location, | 128 const gfx::Point& cursor_location, |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 new std::vector<unsigned char>(addr, addr + bytes)); | 173 new std::vector<unsigned char>(addr, addr + bytes)); |
| 174 bitmap_.unlockPixels(); | 174 bitmap_.unlockPixels(); |
| 175 | 175 |
| 176 // Send frame to MUS via BitmapUploader. | 176 // Send frame to MUS via BitmapUploader. |
| 177 uploader_->SetBitmap(bounds.width(), bounds.height(), std::move(data), | 177 uploader_->SetBitmap(bounds.width(), bounds.height(), std::move(data), |
| 178 ui::BitmapUploader::BGRA); | 178 ui::BitmapUploader::BGRA); |
| 179 } | 179 } |
| 180 | 180 |
| 181 } // namespace demo | 181 } // namespace demo |
| 182 } // namespace ui | 182 } // namespace ui |
| OLD | NEW |