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

Unified Diff: services/ui/demo/mus_demo.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.h ('k') | services/ui/demo/mus_demo_external.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 7afba5693af4cae100e7e13c0f09af916494b989..f24961583de4ac9f7e3e6153b46f9bd9e5f5a813 100644
--- a/services/ui/demo/mus_demo.cc
+++ b/services/ui/demo/mus_demo.cc
@@ -31,32 +31,26 @@ void MusDemo::AddPrimaryDisplay(const display::Display& display) {
display::DisplayList::Type::PRIMARY);
}
-bool MusDemo::HasPendingWindowTreeData() const {
- return !window_tree_data_list_.empty() &&
- !window_tree_data_list_.back()->IsInitialized();
-}
-
void MusDemo::AppendWindowTreeData(
std::unique_ptr<WindowTreeData> window_tree_data) {
- DCHECK(!HasPendingWindowTreeData());
window_tree_data_list_.push_back(std::move(window_tree_data));
}
-void MusDemo::InitWindowTreeData(
- std::unique_ptr<aura::WindowTreeHostMus> window_tree_host) {
- DCHECK(HasPendingWindowTreeData());
- window_tree_data_list_.back()->Init(std::move(window_tree_host));
-}
-
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() {
« no previous file with comments | « services/ui/demo/mus_demo.h ('k') | services/ui/demo/mus_demo_external.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698