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

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

Issue 2755673003: Allow parallel creation of windows
Patch Set: fix comment Created 3 years, 9 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
Index: services/ui/demo/mus_demo_internal.cc
diff --git a/services/ui/demo/mus_demo_internal.cc b/services/ui/demo/mus_demo_internal.cc
index 6c2125692fa142f61cc57ce1945e241549a8c72f..5deedba923fd97ae4d1c1c63902499c73704b85b 100644
--- a/services/ui/demo/mus_demo_internal.cc
+++ b/services/ui/demo/mus_demo_internal.cc
@@ -14,6 +14,22 @@ namespace demo {
namespace {
+class WindowTreeDataInternal : public WindowTreeData {
+ public:
+ // Creates a new window tree host associated to the WindowTreeData.
+ WindowTreeDataInternal(
+ std::unique_ptr<aura::WindowTreeHostMus> window_tree_host,
+ int square_size)
+ : WindowTreeData(square_size) {
+ DCHECK(window_tree_host);
+ window_tree_host->InitHost();
+ window_tree_host->Show();
+ SetWindowTreeHost(std::move(window_tree_host));
+ }
+
+ DISALLOW_COPY_AND_ASSIGN(WindowTreeDataInternal);
+};
+
// Size of square in pixels to draw.
const int kSquareSize = 300;
}
@@ -70,8 +86,11 @@ void MusDemoInternal::OnWmWillCreateDisplay(const display::Display& display) {
void MusDemoInternal::OnWmNewDisplay(
std::unique_ptr<aura::WindowTreeHostMus> window_tree_host,
const display::Display& display) {
- AppendWindowTreeData(base::MakeUnique<WindowTreeData>(kSquareSize));
- InitWindowTreeData(std::move(window_tree_host));
+ std::unique_ptr<WindowTreeDataInternal> window_tree_data =
+ base::MakeUnique<WindowTreeDataInternal>(std::move(window_tree_host),
+ kSquareSize);
+ window_tree_data->Init();
fwang 2017/03/16 10:54:55 Maybe this can be moved into the WindowTreeDataInt
msisov(use msisov igalia.com) 2017/03/16 11:06:33 I think it's better to leave it as it is in order
+ AppendWindowTreeData(std::move(window_tree_data));
}
void MusDemoInternal::OnWmDisplayRemoved(

Powered by Google App Engine
This is Rietveld 408576698