| 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 "components/bitmap_uploader/bitmap_uploader.h" | 8 #include "components/bitmap_uploader/bitmap_uploader.h" |
| 9 #include "services/shell/public/cpp/connector.h" | 9 #include "services/shell/public/cpp/connector.h" |
| 10 #include "services/ui/common/gpu_service.h" | 10 #include "services/ui/common/gpu_service.h" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 } | 56 } |
| 57 | 57 |
| 58 } // namespace | 58 } // namespace |
| 59 | 59 |
| 60 MusDemo::MusDemo() {} | 60 MusDemo::MusDemo() {} |
| 61 | 61 |
| 62 MusDemo::~MusDemo() { | 62 MusDemo::~MusDemo() { |
| 63 delete window_tree_client_; | 63 delete window_tree_client_; |
| 64 } | 64 } |
| 65 | 65 |
| 66 void MusDemo::Initialize(shell::Connector* connector, | 66 void MusDemo::OnStart(shell::Connector* connector, |
| 67 const shell::Identity& identity, | 67 const shell::Identity& identity, |
| 68 uint32_t id) { | 68 uint32_t id) { |
| 69 connector_ = connector; | 69 connector_ = connector; |
| 70 ui::GpuService::Initialize(connector_); | 70 ui::GpuService::Initialize(connector_); |
| 71 window_tree_client_ = new ui::WindowTreeClient(this, this, nullptr); | 71 window_tree_client_ = new ui::WindowTreeClient(this, this, nullptr); |
| 72 window_tree_client_->ConnectAsWindowManager(connector); | 72 window_tree_client_->ConnectAsWindowManager(connector); |
| 73 } | 73 } |
| 74 | 74 |
| 75 bool MusDemo::AcceptConnection(shell::Connection* connection) { | 75 bool MusDemo::OnConnect(shell::Connection* connection) { |
| 76 return true; | 76 return true; |
| 77 } | 77 } |
| 78 | 78 |
| 79 void MusDemo::OnEmbed(ui::Window* window) { | 79 void MusDemo::OnEmbed(ui::Window* window) { |
| 80 // Not called for the WindowManager. | 80 // Not called for the WindowManager. |
| 81 NOTREACHED(); | 81 NOTREACHED(); |
| 82 } | 82 } |
| 83 | 83 |
| 84 void MusDemo::OnDidDestroyClient(ui::WindowTreeClient* client) { | 84 void MusDemo::OnDidDestroyClient(ui::WindowTreeClient* client) { |
| 85 window_tree_client_ = nullptr; | 85 window_tree_client_ = nullptr; |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 std::unique_ptr<std::vector<unsigned char>> data( | 170 std::unique_ptr<std::vector<unsigned char>> data( |
| 171 new std::vector<unsigned char>(addr, addr + bytes)); | 171 new std::vector<unsigned char>(addr, addr + bytes)); |
| 172 bitmap_.unlockPixels(); | 172 bitmap_.unlockPixels(); |
| 173 | 173 |
| 174 // Send frame to MUS via BitmapUploader. | 174 // Send frame to MUS via BitmapUploader. |
| 175 uploader_->SetBitmap(bounds.width(), bounds.height(), std::move(data), | 175 uploader_->SetBitmap(bounds.width(), bounds.height(), std::move(data), |
| 176 bitmap_uploader::BitmapUploader::BGRA); | 176 bitmap_uploader::BitmapUploader::BGRA); |
| 177 } | 177 } |
| 178 | 178 |
| 179 } // namespace ui_demo | 179 } // namespace ui_demo |
| OLD | NEW |