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

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

Issue 2414683003: Mus+Ash: propagate Surface ID to parents (Closed)
Patch Set: Don't follow null surface_info Created 4 years, 2 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/public/cpp/window.h ('k') | services/ui/public/cpp/window_private.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/ui/public/cpp/window.cc
diff --git a/services/ui/public/cpp/window.cc b/services/ui/public/cpp/window.cc
index 966e51888c18a26e688a91a45c1a44010347b7a9..b7b699885bee2a82ea060236fe3aabeb36892cdc 100644
--- a/services/ui/public/cpp/window.cc
+++ b/services/ui/public/cpp/window.cc
@@ -14,6 +14,7 @@
#include "base/macros.h"
#include "services/ui/common/transient_window_utils.h"
#include "services/ui/public/cpp/property_type_converters.h"
+#include "services/ui/public/cpp/surface_id_handler.h"
#include "services/ui/public/cpp/window_observer.h"
#include "services/ui/public/cpp/window_private.h"
#include "services/ui/public/cpp/window_property.h"
@@ -533,6 +534,10 @@ Window::~Window() {
if (transient_parent_)
transient_parent_->LocalRemoveTransientWindow(this);
+ // Return the surface reference if there is one.
+ if (surface_info_)
+ LocalSetSurfaceId(nullptr);
+
// Remove transient children.
while (!transient_children_.empty()) {
Window* transient_child = transient_children_.front();
@@ -582,6 +587,7 @@ Window::Window(WindowTreeClient* client, Id id)
// Matches aura, see aura::Window for details.
observers_(base::ObserverList<WindowObserver>::NOTIFY_EXISTING_ONLY),
input_event_handler_(nullptr),
+ surface_id_handler_(nullptr),
visible_(false),
opacity_(1.0f),
display_id_(display::Display::kInvalidDisplayID),
@@ -790,6 +796,27 @@ void Window::LocalSetSharedProperty(const std::string& name,
OnWindowSharedPropertyChanged(this, name, old_value_ptr, value));
}
+void Window::LocalSetSurfaceId(std::unique_ptr<SurfaceInfo> surface_info) {
+ if (surface_info_) {
+ const cc::SurfaceId& existing_surface_id = surface_info_->surface_id;
+ cc::SurfaceId new_surface_id =
+ surface_info ? surface_info->surface_id : cc::SurfaceId();
+ if (!existing_surface_id.is_null() &&
+ existing_surface_id != new_surface_id) {
+ // Return the existing surface sequence.
+ if (client_) {
+ client_->OnWindowSurfaceDetached(server_id_,
+ surface_info_->surface_sequence);
+ }
+ }
+ }
+ if (parent_ && parent_->surface_id_handler_) {
+ parent_->surface_id_handler_->OnChildWindowSurfaceChanged(this,
+ &surface_info);
+ }
+ surface_info_ = std::move(surface_info);
+}
+
void Window::NotifyWindowStackingChanged() {
if (stacking_target_) {
Children::const_iterator window_i = std::find(
« no previous file with comments | « services/ui/public/cpp/window.h ('k') | services/ui/public/cpp/window_private.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698