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

Unified Diff: ui/aura/mus/window_port_mus.cc

Issue 2500973002: Converts test_wm to use aura (Closed)
Patch Set: delete cant be used 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 | « ui/aura/mus/window_port_mus.h ('k') | ui/aura/mus/window_tree_client.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/aura/mus/window_port_mus.cc
diff --git a/ui/aura/mus/window_port_mus.cc b/ui/aura/mus/window_port_mus.cc
index f9be96b4993e306a1c3279e09516fa76bafe0070..f5c51db77e02ff8209e645795dfa303113a37f80 100644
--- a/ui/aura/mus/window_port_mus.cc
+++ b/ui/aura/mus/window_port_mus.cc
@@ -34,7 +34,11 @@ WindowPortMus::~WindowPortMus() {
if (surface_info_)
SetSurfaceIdFromServer(nullptr);
- window_tree_client_->OnWindowMusDestroyed(this);
+ const WindowTreeClient::Origin origin =
+ RemoveChangeByTypeAndData(ServerChangeType::DESTROY, ServerChangeData())
msw 2016/11/17 21:26:15 aside: too bad we have two change type enums with
+ ? WindowTreeClient::Origin::SERVER
+ : WindowTreeClient::Origin::CLIENT;
+ window_tree_client_->OnWindowMusDestroyed(this, origin);
}
// static
@@ -123,6 +127,9 @@ bool WindowPortMus::RemoveChangeByTypeAndData(const ServerChangeType type,
if (iter->data.bounds == data.bounds)
break;
continue;
+ case ServerChangeType::DESTROY:
+ // No extra data for delete.
+ break;
case ServerChangeType::PROPERTY:
if (iter->data.property_name == data.property_name)
break;
@@ -234,6 +241,22 @@ void WindowPortMus::SetSurfaceIdFromServer(
surface_info_ = std::move(surface_info);
}
+void WindowPortMus::DestroyFromServer() {
+ std::unique_ptr<ScopedServerChange> remove_from_parent_change;
+ if (window_->parent()) {
+ ServerChangeData data;
+ data.child_id = server_id();
+ WindowPortMus* parent = Get(window_->parent());
+ remove_from_parent_change = base::MakeUnique<ScopedServerChange>(
+ parent, ServerChangeType::REMOVE, data);
+ }
+ // NOTE: this can't use ScopedServerChange as |this| is destroyed before the
+ // function returns (ScopedServerChange would attempt to access |this| after
+ // destruction).
+ ScheduleChange(ServerChangeType::DESTROY, ServerChangeData());
+ delete window_;
+}
+
void WindowPortMus::AddTransientChildFromServer(WindowMus* child) {
ServerChangeData data;
data.child_id = child->server_id();
« no previous file with comments | « ui/aura/mus/window_port_mus.h ('k') | ui/aura/mus/window_tree_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698