| 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/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #include "base/time/time.h" | 8 #include "base/time/time.h" |
| 9 #include "services/shell/public/cpp/connector.h" | 9 #include "services/shell/public/cpp/connector.h" |
| 10 #include "services/ui/demo/bitmap_uploader.h" | 10 #include "services/ui/demo/bitmap_uploader.h" |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 // Initialize bitmap uploader for sending frames to MUS. | 123 // Initialize bitmap uploader for sending frames to MUS. |
| 124 uploader_.reset(new BitmapUploader(window_)); | 124 uploader_.reset(new BitmapUploader(window_)); |
| 125 uploader_->Init(gpu_service_.get()); | 125 uploader_->Init(gpu_service_.get()); |
| 126 | 126 |
| 127 // Draw initial frame and start the timer to regularly draw frames. | 127 // Draw initial frame and start the timer to regularly draw frames. |
| 128 DrawFrame(); | 128 DrawFrame(); |
| 129 timer_.Start(FROM_HERE, base::TimeDelta::FromMilliseconds(kFrameDelay), | 129 timer_.Start(FROM_HERE, base::TimeDelta::FromMilliseconds(kFrameDelay), |
| 130 base::Bind(&MusDemo::DrawFrame, base::Unretained(this))); | 130 base::Bind(&MusDemo::DrawFrame, base::Unretained(this))); |
| 131 } | 131 } |
| 132 | 132 |
| 133 void MusDemo::OnWmDisplayRemoved(ui::Window* window) { |
| 134 window->Destroy(); |
| 135 } |
| 136 |
| 133 void MusDemo::OnWmPerformMoveLoop(Window* window, | 137 void MusDemo::OnWmPerformMoveLoop(Window* window, |
| 134 mojom::MoveLoopSource source, | 138 mojom::MoveLoopSource source, |
| 135 const gfx::Point& cursor_location, | 139 const gfx::Point& cursor_location, |
| 136 const base::Callback<void(bool)>& on_done) { | 140 const base::Callback<void(bool)>& on_done) { |
| 137 // Don't care | 141 // Don't care |
| 138 } | 142 } |
| 139 | 143 |
| 140 void MusDemo::OnWmCancelMoveLoop(Window* window) {} | 144 void MusDemo::OnWmCancelMoveLoop(Window* window) {} |
| 141 | 145 |
| 142 void MusDemo::AllocBitmap() { | 146 void MusDemo::AllocBitmap() { |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 new std::vector<unsigned char>(addr, addr + bytes)); | 184 new std::vector<unsigned char>(addr, addr + bytes)); |
| 181 bitmap_.unlockPixels(); | 185 bitmap_.unlockPixels(); |
| 182 | 186 |
| 183 // Send frame to MUS via BitmapUploader. | 187 // Send frame to MUS via BitmapUploader. |
| 184 uploader_->SetBitmap(bounds.width(), bounds.height(), std::move(data), | 188 uploader_->SetBitmap(bounds.width(), bounds.height(), std::move(data), |
| 185 BitmapUploader::BGRA); | 189 BitmapUploader::BGRA); |
| 186 } | 190 } |
| 187 | 191 |
| 188 } // namespace demo | 192 } // namespace demo |
| 189 } // namespace ui | 193 } // namespace ui |
| OLD | NEW |