| 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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 const std::set<Window*>& client_windows, | 109 const std::set<Window*>& client_windows, |
| 110 bool janky) { | 110 bool janky) { |
| 111 // Don't care | 111 // Don't care |
| 112 } | 112 } |
| 113 | 113 |
| 114 void MusDemo::OnWmNewDisplay(Window* window, const display::Display& display) { | 114 void MusDemo::OnWmNewDisplay(Window* window, const display::Display& display) { |
| 115 DCHECK(!window_); // Only support one display. | 115 DCHECK(!window_); // Only support one display. |
| 116 window_ = window; | 116 window_ = window; |
| 117 | 117 |
| 118 // Initialize bitmap uploader for sending frames to MUS. | 118 // Initialize bitmap uploader for sending frames to MUS. |
| 119 uploader_.reset(new ui::BitmapUploader(window_)); | 119 uploader_.reset(new ui::BitmapUploader(window_, gpu_service_.get())); |
| 120 uploader_->Init(); | 120 uploader_->Init(); |
| 121 | 121 |
| 122 // Draw initial frame and start the timer to regularly draw frames. | 122 // Draw initial frame and start the timer to regularly draw frames. |
| 123 DrawFrame(); | 123 DrawFrame(); |
| 124 timer_.Start(FROM_HERE, base::TimeDelta::FromMilliseconds(kFrameDelay), | 124 timer_.Start(FROM_HERE, base::TimeDelta::FromMilliseconds(kFrameDelay), |
| 125 base::Bind(&MusDemo::DrawFrame, base::Unretained(this))); | 125 base::Bind(&MusDemo::DrawFrame, base::Unretained(this))); |
| 126 } | 126 } |
| 127 | 127 |
| 128 void MusDemo::OnWmPerformMoveLoop(Window* window, | 128 void MusDemo::OnWmPerformMoveLoop(Window* window, |
| 129 mojom::MoveLoopSource source, | 129 mojom::MoveLoopSource source, |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 new std::vector<unsigned char>(addr, addr + bytes)); | 175 new std::vector<unsigned char>(addr, addr + bytes)); |
| 176 bitmap_.unlockPixels(); | 176 bitmap_.unlockPixels(); |
| 177 | 177 |
| 178 // Send frame to MUS via BitmapUploader. | 178 // Send frame to MUS via BitmapUploader. |
| 179 uploader_->SetBitmap(bounds.width(), bounds.height(), std::move(data), | 179 uploader_->SetBitmap(bounds.width(), bounds.height(), std::move(data), |
| 180 ui::BitmapUploader::BGRA); | 180 ui::BitmapUploader::BGRA); |
| 181 } | 181 } |
| 182 | 182 |
| 183 } // namespace demo | 183 } // namespace demo |
| 184 } // namespace ui | 184 } // namespace ui |
| OLD | NEW |