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

Side by Side Diff: ui/aura/mus/window_port_mus.cc

Issue 2610723002: Unify SurfaceInfo (Closed)
Patch Set: Cleanup offscreen canvas Created 3 years, 11 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/aura/mus/window_port_mus.h" 5 #include "ui/aura/mus/window_port_mus.h"
6 6
7 #include "base/memory/ptr_util.h" 7 #include "base/memory/ptr_util.h"
8 #include "ui/aura/client/aura_constants.h" 8 #include "ui/aura/client/aura_constants.h"
9 #include "ui/aura/client/transient_window_client.h" 9 #include "ui/aura/client/transient_window_client.h"
10 #include "ui/aura/mus/property_converter.h" 10 #include "ui/aura/mus/property_converter.h"
(...skipping 14 matching lines...) Expand all
25 // static 25 // static
26 WindowMus* WindowMus::Get(Window* window) { 26 WindowMus* WindowMus::Get(Window* window) {
27 return WindowPortMus::Get(window); 27 return WindowPortMus::Get(window);
28 } 28 }
29 29
30 WindowPortMus::WindowPortMus(WindowTreeClient* client, 30 WindowPortMus::WindowPortMus(WindowTreeClient* client,
31 WindowMusType window_mus_type) 31 WindowMusType window_mus_type)
32 : WindowMus(window_mus_type), window_tree_client_(client) {} 32 : WindowMus(window_mus_type), window_tree_client_(client) {}
33 33
34 WindowPortMus::~WindowPortMus() { 34 WindowPortMus::~WindowPortMus() {
35 if (surface_info_) 35 if (surface_info_.id().is_valid())
36 SetSurfaceIdFromServer(nullptr); 36 SetSurfaceInfoFromServer(cc::SurfaceInfo());
37 37
38 // DESTROY is only scheduled from DestroyFromServer(), meaning if DESTROY is 38 // DESTROY is only scheduled from DestroyFromServer(), meaning if DESTROY is
39 // present then the server originated the change. 39 // present then the server originated the change.
40 const WindowTreeClient::Origin origin = 40 const WindowTreeClient::Origin origin =
41 RemoveChangeByTypeAndData(ServerChangeType::DESTROY, ServerChangeData()) 41 RemoveChangeByTypeAndData(ServerChangeType::DESTROY, ServerChangeData())
42 ? WindowTreeClient::Origin::SERVER 42 ? WindowTreeClient::Origin::SERVER
43 : WindowTreeClient::Origin::CLIENT; 43 : WindowTreeClient::Origin::CLIENT;
44 window_tree_client_->OnWindowMusDestroyed(this, origin); 44 window_tree_client_->OnWindowMusDestroyed(this, origin);
45 } 45 }
46 46
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 void WindowPortMus::SetPropertyFromServer( 237 void WindowPortMus::SetPropertyFromServer(
238 const std::string& property_name, 238 const std::string& property_name,
239 const std::vector<uint8_t>* property_data) { 239 const std::vector<uint8_t>* property_data) {
240 ServerChangeData data; 240 ServerChangeData data;
241 data.property_name = property_name; 241 data.property_name = property_name;
242 ScopedServerChange change(this, ServerChangeType::PROPERTY, data); 242 ScopedServerChange change(this, ServerChangeType::PROPERTY, data);
243 GetPropertyConverter()->SetPropertyFromTransportValue(window_, property_name, 243 GetPropertyConverter()->SetPropertyFromTransportValue(window_, property_name,
244 property_data); 244 property_data);
245 } 245 }
246 246
247 void WindowPortMus::SetSurfaceIdFromServer( 247 void WindowPortMus::SetSurfaceInfoFromServer(
248 std::unique_ptr<SurfaceInfo> surface_info) { 248 const cc::SurfaceInfo& surface_info) {
249 if (surface_info_) { 249 if (surface_info_.id().is_valid()) {
250 const cc::SurfaceId& existing_surface_id = surface_info_->surface_id; 250 const cc::SurfaceId& existing_surface_id = surface_info_.id();
251 cc::SurfaceId new_surface_id = 251 const cc::SurfaceId& new_surface_id = surface_info.id();
252 surface_info ? surface_info->surface_id : cc::SurfaceId();
253 if (existing_surface_id.is_valid() && 252 if (existing_surface_id.is_valid() &&
254 existing_surface_id != new_surface_id) { 253 existing_surface_id != new_surface_id) {
255 // TODO(kylechar): Start return reference here? 254 // TODO(kylechar): Start return reference here?
256 } 255 }
257 } 256 }
258 WindowPortMus* parent = Get(window_->parent()); 257 WindowPortMus* parent = Get(window_->parent());
259 if (parent && parent->surface_id_handler_) { 258 if (parent && parent->surface_id_handler_) {
260 parent->surface_id_handler_->OnChildWindowSurfaceChanged(window_, 259 parent->surface_id_handler_->OnChildWindowSurfaceChanged(window_,
261 &surface_info); 260 surface_info);
262 } 261 }
263 surface_info_ = std::move(surface_info); 262 surface_info_ = surface_info;
264 } 263 }
265 264
266 void WindowPortMus::DestroyFromServer() { 265 void WindowPortMus::DestroyFromServer() {
267 std::unique_ptr<ScopedServerChange> remove_from_parent_change; 266 std::unique_ptr<ScopedServerChange> remove_from_parent_change;
268 if (window_->parent()) { 267 if (window_->parent()) {
269 ServerChangeData data; 268 ServerChangeData data;
270 data.child_id = server_id(); 269 data.child_id = server_id();
271 WindowPortMus* parent = Get(window_->parent()); 270 WindowPortMus* parent = Get(window_->parent());
272 remove_from_parent_change = base::MakeUnique<ScopedServerChange>( 271 remove_from_parent_change = base::MakeUnique<ScopedServerChange>(
273 parent, ServerChangeType::REMOVE, data); 272 parent, ServerChangeType::REMOVE, data);
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 change_data.property_name = 425 change_data.property_name =
427 GetPropertyConverter()->GetTransportNameForPropertyKey(key); 426 GetPropertyConverter()->GetTransportNameForPropertyKey(key);
428 // TODO(sky): investigate to see if we need to compare data. In particular do 427 // TODO(sky): investigate to see if we need to compare data. In particular do
429 // we ever have a case where changing a property cascades into changing the 428 // we ever have a case where changing a property cascades into changing the
430 // same property? 429 // same property?
431 if (!RemoveChangeByTypeAndData(ServerChangeType::PROPERTY, change_data)) 430 if (!RemoveChangeByTypeAndData(ServerChangeType::PROPERTY, change_data))
432 window_tree_client_->OnWindowMusPropertyChanged(this, key, std::move(data)); 431 window_tree_client_->OnWindowMusPropertyChanged(this, key, std::move(data));
433 } 432 }
434 433
435 } // namespace aura 434 } // namespace aura
OLDNEW
« 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