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

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

Issue 2301353003: Changes ownership of WindowTreeClient (Closed)
Patch Set: fix navigation Created 4 years, 3 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/public/cpp/tests/test_window_tree_client_setup.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 3d2dac1edf7b6363792eeadcf78d329fbb99edde..45ebcc1b5dc5d6ec6835ec281a920e046358b6c6 100644
--- a/services/ui/demo/mus_demo.cc
+++ b/services/ui/demo/mus_demo.cc
@@ -4,6 +4,7 @@
#include "services/ui/demo/mus_demo.h"
+#include "base/memory/ptr_util.h"
#include "base/time/time.h"
#include "services/shell/public/cpp/connector.h"
#include "services/ui/demo/bitmap_uploader.h"
@@ -60,13 +61,11 @@ void DrawSquare(const gfx::Rect& bounds, double angle, SkCanvas* canvas) {
MusDemo::MusDemo() {}
-MusDemo::~MusDemo() {
- delete window_tree_client_;
-}
+MusDemo::~MusDemo() {}
void MusDemo::OnStart(const shell::Identity& identity) {
gpu_service_ = GpuService::Create(connector());
- window_tree_client_ = new WindowTreeClient(this, this, nullptr);
+ window_tree_client_ = base::MakeUnique<WindowTreeClient>(this, this);
window_tree_client_->ConnectAsWindowManager(connector());
}
@@ -80,8 +79,14 @@ void MusDemo::OnEmbed(Window* window) {
NOTREACHED();
}
-void MusDemo::OnDidDestroyClient(WindowTreeClient* client) {
- window_tree_client_ = nullptr;
+void MusDemo::OnEmbedRootDestroyed(Window* root) {
+ // Not called for the WindowManager.
+ NOTREACHED();
+}
+
+void MusDemo::OnLostConnection(WindowTreeClient* client) {
+ window_ = nullptr;
+ window_tree_client_.reset();
timer_.Stop();
}
@@ -116,7 +121,7 @@ void MusDemo::OnWmNewDisplay(Window* window, const display::Display& display) {
window_ = window;
// Initialize bitmap uploader for sending frames to MUS.
- uploader_.reset(new ui::BitmapUploader(window_));
+ uploader_.reset(new BitmapUploader(window_));
uploader_->Init(gpu_service_.get());
// Draw initial frame and start the timer to regularly draw frames.
@@ -177,7 +182,7 @@ void MusDemo::DrawFrame() {
// Send frame to MUS via BitmapUploader.
uploader_->SetBitmap(bounds.width(), bounds.height(), std::move(data),
- ui::BitmapUploader::BGRA);
+ BitmapUploader::BGRA);
}
} // namespace demo
« no previous file with comments | « services/ui/demo/mus_demo.h ('k') | services/ui/public/cpp/tests/test_window_tree_client_setup.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698