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

Side by Side Diff: services/ui/demo/mus_demo_external.cc

Issue 2755673003: Allow parallel creation of windows
Patch Set: fix comments 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 unified diff | Download patch
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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_external.h" 5 #include "services/ui/demo/mus_demo_external.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/strings/string_number_conversions.h" 8 #include "base/strings/string_number_conversions.h"
9 #include "services/service_manager/public/cpp/service_context.h" 9 #include "services/service_manager/public/cpp/service_context.h"
10 #include "services/ui/demo/window_tree_data.h" 10 #include "services/ui/demo/window_tree_data.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 } 59 }
60 } 60 }
61 61
62 window_tree_client()->ConnectViaWindowTreeHostFactory(); 62 window_tree_client()->ConnectViaWindowTreeHostFactory();
63 63
64 // TODO(tonikitoo,fwang): Implement management of displays in external mode. 64 // TODO(tonikitoo,fwang): Implement management of displays in external mode.
65 // For now, a fake display is created in order to work around an assertion in 65 // For now, a fake display is created in order to work around an assertion in
66 // aura::GetDeviceScaleFactorFromDisplay(). 66 // aura::GetDeviceScaleFactorFromDisplay().
67 AddPrimaryDisplay(display::Display(0)); 67 AddPrimaryDisplay(display::Display(0));
68 68
69 // TODO(tonikitoo,fwang): New windows can be launched without need to wait 69 for (size_t i = 0; i < number_of_windows_; ++i)
70 // the respective ::OnEmbed call of the previous instance. 70 OpenNewWindow(i);
71 OpenNewWindow();
72 } 71 }
73 72
74 void MusDemoExternal::OpenNewWindow() { 73 void MusDemoExternal::OpenNewWindow(size_t window_count) {
fwang 2017/03/16 08:59:49 window_index
msisov(use msisov igalia.com) 2017/03/16 09:21:32 Done.
75 AppendWindowTreeData(base::MakeUnique<WindowTreeDataExternal>( 74 AppendWindowTreeData(base::MakeUnique<WindowTreeDataExternal>(
76 window_tree_client(), 75 window_tree_client(), GetSquareSizeForWindow(window_count)));
fwang 2017/03/16 08:59:49 window_index
msisov(use msisov igalia.com) 2017/03/16 09:21:32 Done.
77 GetSquareSizeForWindow(initialized_windows_count_)));
78 } 76 }
79 77
80 void MusDemoExternal::OnEmbed( 78 void MusDemoExternal::OnEmbedRootReady(
81 std::unique_ptr<aura::WindowTreeHostMus> window_tree_host) { 79 aura::WindowTreeHostMus* window_tree_host) {
82 DCHECK(!window_tree_host); 80 DCHECK(window_tree_host);
83 81 InitWindowTreeDataExternal(window_tree_host);
fwang 2017/03/16 08:59:48 I seems you can get rid of InitWindowTreeDataExter
msisov(use msisov igalia.com) 2017/03/16 09:21:32 Done.
84 // TODO: Clean up WindowTreeClientDelegate::OnEmbed API so that it passes
85 // no ownership of WindowTreeHostMus instance.
86 InitWindowTreeData(nullptr);
87 initialized_windows_count_++;
88
89 // Open the next window until the requested number of windows is reached.
90 if (initialized_windows_count_ < number_of_windows_)
91 OpenNewWindow();
92 } 82 }
93 83
94 void MusDemoExternal::OnEmbedRootDestroyed( 84 void MusDemoExternal::OnEmbedRootDestroyed(
95 aura::WindowTreeHostMus* window_tree_host) { 85 aura::WindowTreeHostMus* window_tree_host) {
96 RemoveWindowTreeData(window_tree_host); 86 RemoveWindowTreeData(window_tree_host);
97 } 87 }
98 88
99 } // namespace demo 89 } // namespace demo
100 } // namespace ui 90 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698