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

Unified Diff: services/ui/public/cpp/window_tree_client.cc

Issue 2480203002: ui: Cleanup class/struct forward declarations (Closed)
Patch Set: Sync CL to position 430550 Created 4 years, 1 month 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/public/cpp/window_tree_client.h ('k') | services/ui/public/interfaces/window_tree.mojom » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/ui/public/cpp/window_tree_client.cc
diff --git a/services/ui/public/cpp/window_tree_client.cc b/services/ui/public/cpp/window_tree_client.cc
index 11e73b05533d8f45fb7c94dd285dadeb1e01723d..84b2f203e95bd1985702a25a058729e2edaf76ad 100644
--- a/services/ui/public/cpp/window_tree_client.cc
+++ b/services/ui/public/cpp/window_tree_client.cc
@@ -473,28 +473,19 @@ bool WindowTreeClient::ApplyServerChangeToExistingInFlightChange(
return true;
}
-Window* WindowTreeClient::BuildWindowTree(
+void WindowTreeClient::BuildWindowTree(
const mojo::Array<mojom::WindowDataPtr>& windows,
Window* initial_parent) {
- std::vector<Window*> parents;
- Window* root = nullptr;
- Window* last_window = nullptr;
- if (initial_parent)
- parents.push_back(initial_parent);
- for (size_t i = 0; i < windows.size(); ++i) {
- if (last_window && windows[i]->parent_id == server_id(last_window)) {
- parents.push_back(last_window);
- } else if (!parents.empty()) {
- while (server_id(parents.back()) != windows[i]->parent_id)
- parents.pop_back();
- }
- Window* window = AddWindowToClient(
- this, !parents.empty() ? parents.back() : nullptr, windows[i]);
- if (!last_window)
- root = window;
- last_window = window;
+ for (const auto& window_data : windows) {
+ Window* parent = window_data->parent_id == 0
+ ? nullptr
+ : GetWindowByServerId(window_data->parent_id);
+ Window* existing_window = GetWindowByServerId(window_data->window_id);
+ if (!existing_window)
+ AddWindowToClient(this, parent, window_data);
+ else if (parent)
+ WindowPrivate(parent).LocalAddChild(existing_window);
}
- return root;
}
Window* WindowTreeClient::NewWindowImpl(
« no previous file with comments | « services/ui/public/cpp/window_tree_client.h ('k') | services/ui/public/interfaces/window_tree.mojom » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698