| 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..15cdf0676e399bd73fe92183b3df2a78b2460bd2 100644
|
| --- a/services/ui/public/cpp/window.cc
|
| +++ b/services/ui/public/cpp/window.cc
|
| @@ -533,6 +533,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();
|
| @@ -790,6 +795,31 @@ 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);
|
| + }
|
| + }
|
| + surface_info_ = {surface_id, surface_sequence, frame_size,
|
| + device_scale_factor};
|
| + if (parent_) {
|
| + // TODO(fsamuel, sadrul): This assumes that observers just observe. If a
|
| + // ui::Layer is an observer here then it takes ownership of the
|
| + // SurfaceSequence and returning the refernece.
|
| + for (auto& observer : parent_->observers_) {
|
| + observer.OnChildWindowSurfaceCreated(this, surface_id, surface_sequence,
|
| + frame_size, device_scale_factor);
|
| + }
|
| + }
|
| +}
|
| +
|
| void Window::NotifyWindowStackingChanged() {
|
| if (stacking_target_) {
|
| Children::const_iterator window_i = std::find(
|
|
|