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

Unified Diff: services/ui/demo/mus_demo.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 side-by-side diff with in-line comments
Download patch
Index: services/ui/demo/mus_demo.cc
diff --git a/services/ui/demo/mus_demo.cc b/services/ui/demo/mus_demo.cc
index 7afba5693af4cae100e7e13c0f09af916494b989..0100f3f1a2d34c72af60fc87e62b78d3e6fc82bd 100644
--- a/services/ui/demo/mus_demo.cc
+++ b/services/ui/demo/mus_demo.cc
@@ -38,7 +38,6 @@ bool MusDemo::HasPendingWindowTreeData() const {
void MusDemo::AppendWindowTreeData(
std::unique_ptr<WindowTreeData> window_tree_data) {
- DCHECK(!HasPendingWindowTreeData());
window_tree_data_list_.push_back(std::move(window_tree_data));
}
@@ -48,15 +47,28 @@ void MusDemo::InitWindowTreeData(
window_tree_data_list_.back()->Init(std::move(window_tree_host));
}
+void MusDemo::InitWindowTreeDataExternal(
+ aura::WindowTreeHostMus* window_tree_host) {
+ DCHECK(HasPendingWindowTreeData());
+ auto window_tree_data = FindWindowTreeData(window_tree_host);
+ (*window_tree_data)->Init(nullptr);
+}
+
void MusDemo::RemoveWindowTreeData(aura::WindowTreeHostMus* window_tree_host) {
DCHECK(window_tree_host);
+ auto window_tree_data = FindWindowTreeData(window_tree_host);
+ window_tree_data_list_.erase(window_tree_data);
+}
+
+std::vector<std::unique_ptr<WindowTreeData>>::iterator
+MusDemo::FindWindowTreeData(aura::WindowTreeHostMus* window_tree_host) {
auto it =
std::find_if(window_tree_data_list_.begin(), window_tree_data_list_.end(),
[window_tree_host](std::unique_ptr<WindowTreeData>& data) {
return data->WindowTreeHost() == window_tree_host;
});
DCHECK(it != window_tree_data_list_.end());
- window_tree_data_list_.erase(it);
+ return it;
}
void MusDemo::OnStart() {

Powered by Google App Engine
This is Rietveld 408576698