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

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

Issue 2500973002: Converts test_wm to use aura (Closed)
Patch Set: fix bad remove 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
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..a87aa654d126e857900ecab0a25bebebee91c475 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 =
msw 2016/11/17 21:26:15 nit: maybe comment here since this is slightly sub
sky 2016/11/17 22:25:54 I added a comment indicating why DESTROY means it
+ RemoveChangeByTypeAndData(ServerChangeType::DELETE, ServerChangeData())
+ ? 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::DELETE:
+ // 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::DELETE, ServerChangeData());
+ delete window_;
+}
+
void WindowPortMus::AddTransientChildFromServer(WindowMus* child) {
ServerChangeData data;
data.child_id = child->server_id();

Powered by Google App Engine
This is Rietveld 408576698