| 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..015852d5156a3174a3ef30da023e2e156b39c79b 100644
|
| --- a/services/ui/public/cpp/window.cc
|
| +++ b/services/ui/public/cpp/window.cc
|
| @@ -12,8 +12,11 @@
|
|
|
| #include "base/bind.h"
|
| #include "base/macros.h"
|
| +#include "cc/surfaces/surface_id.h"
|
| +#include "cc/surfaces/surface_sequence.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 +536,11 @@ Window::~Window() {
|
| if (transient_parent_)
|
| transient_parent_->LocalRemoveTransientWindow(this);
|
|
|
| + // Return the surface reference if there is one.
|
| + if (!surface_info_.surface_id.is_null())
|
| + LocalSetSurfaceId(cc::SurfaceId(), cc::SurfaceSequence(), gfx::Size(),
|
| + 1.0f);
|
| +
|
| // Remove transient children.
|
| while (!transient_children_.empty()) {
|
| Window* transient_child = transient_children_.front();
|
| @@ -582,6 +590,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 +799,32 @@ void Window::LocalSetSharedProperty(const std::string& name,
|
| OnWindowSharedPropertyChanged(this, name, old_value_ptr, value));
|
| }
|
|
|
| +void Window::LocalSetSurfaceId(const cc::SurfaceId& surface_id,
|
| + const cc::SurfaceSequence& surface_sequence,
|
| + const gfx::Size& frame_size,
|
| + float device_scale_factor) {
|
| + const cc::SurfaceId& existing_surface_id = surface_info_.surface_id;
|
| + if (!existing_surface_id.is_null() && existing_surface_id != surface_id) {
|
| + // Return the existing surface sequence.
|
| + if (client_) {
|
| + client_->ReturnSurfaceReference(server_id_,
|
| + surface_info_.surface_sequence);
|
| + }
|
| + }
|
| + if (parent_ && parent_->surface_id_handler_) {
|
| + if (parent_->surface_id_handler_->OnChildWindowSurfaceCreated(
|
| + this, surface_id, surface_sequence, frame_size,
|
| + device_scale_factor)) {
|
| + // Don't store it on the window if the SurfaceIdHandler has picked it up.
|
| + surface_info_ = {cc::SurfaceId(), cc::SurfaceSequence(), gfx::Size(),
|
| + 1.0f};
|
| + return;
|
| + }
|
| + }
|
| + surface_info_ = {surface_id, surface_sequence, frame_size,
|
| + device_scale_factor};
|
| +}
|
| +
|
| void Window::NotifyWindowStackingChanged() {
|
| if (stacking_target_) {
|
| Children::const_iterator window_i = std::find(
|
|
|