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

Side by Side Diff: services/ui/ws/server_window.cc

Issue 2400723003: Mus+Ash: Use standard cc mechanism for surface lifetime. (Closed)
Patch Set: Only add window observer if we're adding the dependency for the first time 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "services/ui/ws/server_window.h" 5 #include "services/ui/ws/server_window.h"
6 6
7 #include <inttypes.h> 7 #include <inttypes.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 bool ServerWindow::IsDrawn() const { 353 bool ServerWindow::IsDrawn() const {
354 const ServerWindow* root = delegate_->GetRootWindow(this); 354 const ServerWindow* root = delegate_->GetRootWindow(this);
355 if (!root || !root->visible()) 355 if (!root || !root->visible())
356 return false; 356 return false;
357 const ServerWindow* window = this; 357 const ServerWindow* window = this;
358 while (window && window != root && window->visible()) 358 while (window && window != root && window->visible())
359 window = window->parent(); 359 window = window->parent();
360 return root == window; 360 return root == window;
361 } 361 }
362 362
363 void ServerWindow::DestroySurfacesScheduledForDestruction() {
364 if (!surface_manager_)
365 return;
366 ServerWindowSurface* surface = surface_manager_->GetDefaultSurface();
367 if (surface)
368 surface->DestroySurfacesScheduledForDestruction();
369
370 surface = surface_manager_->GetUnderlaySurface();
371 if (surface)
372 surface->DestroySurfacesScheduledForDestruction();
373 }
374
375 ServerWindowSurfaceManager* ServerWindow::GetOrCreateSurfaceManager() { 363 ServerWindowSurfaceManager* ServerWindow::GetOrCreateSurfaceManager() {
376 if (!surface_manager_.get()) 364 if (!surface_manager_.get())
377 surface_manager_ = base::MakeUnique<ServerWindowSurfaceManager>(this); 365 surface_manager_ = base::MakeUnique<ServerWindowSurfaceManager>(this);
378 return surface_manager_.get(); 366 return surface_manager_.get();
379 } 367 }
380 368
381 void ServerWindow::SetUnderlayOffset(const gfx::Vector2d& offset) { 369 void ServerWindow::SetUnderlayOffset(const gfx::Vector2d& offset) {
382 if (offset == underlay_offset_) 370 if (offset == underlay_offset_)
383 return; 371 return;
384 372
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
463 } 451 }
464 452
465 // static 453 // static
466 ServerWindow** ServerWindow::GetStackingTarget(ServerWindow* window) { 454 ServerWindow** ServerWindow::GetStackingTarget(ServerWindow* window) {
467 return &window->stacking_target_; 455 return &window->stacking_target_;
468 } 456 }
469 457
470 } // namespace ws 458 } // namespace ws
471 459
472 } // namespace ui 460 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698