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

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

Issue 2755673003: Allow parallel creation of windows
Patch Set: nits 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
« no previous file with comments | « services/ui/demo/mus_demo_external.h ('k') | services/ui/demo/mus_demo_internal.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/ui/demo/mus_demo_external.cc
diff --git a/services/ui/demo/mus_demo_external.cc b/services/ui/demo/mus_demo_external.cc
index f76c0a8dedbb0952bb9b9b23f555755a2acbb644..d66bbc2e541a28783e57ae52a2e6772156c5ab28 100644
--- a/services/ui/demo/mus_demo_external.cc
+++ b/services/ui/demo/mus_demo_external.cc
@@ -66,29 +66,20 @@ void MusDemoExternal::OnStartImpl() {
// aura::GetDeviceScaleFactorFromDisplay().
AddPrimaryDisplay(display::Display(0));
- // TODO(tonikitoo,fwang): New windows can be launched without need to wait
- // the respective ::OnEmbed call of the previous instance.
- OpenNewWindow();
+ for (size_t i = 0; i < number_of_windows_; ++i)
+ OpenNewWindow(i);
}
-void MusDemoExternal::OpenNewWindow() {
+void MusDemoExternal::OpenNewWindow(size_t window_index) {
AppendWindowTreeData(base::MakeUnique<WindowTreeDataExternal>(
- window_tree_client(),
- GetSquareSizeForWindow(initialized_windows_count_)));
+ window_tree_client(), GetSquareSizeForWindow(window_index)));
}
-void MusDemoExternal::OnEmbed(
- std::unique_ptr<aura::WindowTreeHostMus> window_tree_host) {
- DCHECK(!window_tree_host);
-
- // TODO: Clean up WindowTreeClientDelegate::OnEmbed API so that it passes
- // no ownership of WindowTreeHostMus instance.
- InitWindowTreeData(nullptr);
- initialized_windows_count_++;
-
- // Open the next window until the requested number of windows is reached.
- if (initialized_windows_count_ < number_of_windows_)
- OpenNewWindow();
+void MusDemoExternal::OnEmbedRootReady(
+ aura::WindowTreeHostMus* window_tree_host) {
+ DCHECK(window_tree_host);
+ auto window_tree_data = FindWindowTreeData(window_tree_host);
+ (*window_tree_data)->Init();
}
void MusDemoExternal::OnEmbedRootDestroyed(
« no previous file with comments | « services/ui/demo/mus_demo_external.h ('k') | services/ui/demo/mus_demo_internal.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698