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

Side by Side Diff: ash/wm/window_animations.cc

Issue 2444563002: cc: Remove "SwapBuffers" naming from LayerTreeHostSingleThreadClient (Closed)
Patch Set: swapsinglethread: fix-name-in-browsertest 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
« no previous file with comments | « no previous file | blimp/client/support/compositor/blimp_embedder_compositor.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "ash/wm/window_animations.h" 5 #include "ash/wm/window_animations.h"
6 6
7 #include <math.h> 7 #include <math.h>
8 #include <algorithm> 8 #include <algorithm>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 case wm::WINDOW_VISIBILITY_ANIMATION_TYPE_BRIGHTNESS_GRAYSCALE: 242 case wm::WINDOW_VISIBILITY_ANIMATION_TYPE_BRIGHTNESS_GRAYSCALE:
243 AnimateHideWindow_BrightnessGrayscale(window); 243 AnimateHideWindow_BrightnessGrayscale(window);
244 return true; 244 return true;
245 default: 245 default:
246 NOTREACHED(); 246 NOTREACHED();
247 return false; 247 return false;
248 } 248 }
249 } 249 }
250 250
251 // Observer for a window cross-fade animation. If either the window closes or 251 // Observer for a window cross-fade animation. If either the window closes or
252 // the layer's animation completes or compositing is aborted due to GPU crash, 252 // the layer's animation completes, it deletes the layer and removes itself as
253 // it deletes the layer and removes itself as an observer. 253 // an observer.
254 class CrossFadeObserver : public ui::CompositorObserver, 254 class CrossFadeObserver : public aura::WindowObserver,
255 public aura::WindowObserver,
256 public ui::ImplicitAnimationObserver { 255 public ui::ImplicitAnimationObserver {
257 public: 256 public:
258 // Observes |window| for destruction, but does not take ownership. 257 // Observes |window| for destruction, but does not take ownership.
259 // Takes ownership of |layer| and its child layers. 258 // Takes ownership of |layer| and its child layers.
260 CrossFadeObserver(aura::Window* window, 259 CrossFadeObserver(aura::Window* window,
261 std::unique_ptr<ui::LayerTreeOwner> layer_owner) 260 std::unique_ptr<ui::LayerTreeOwner> layer_owner)
262 : window_(window), layer_owner_(std::move(layer_owner)) { 261 : window_(window), layer_owner_(std::move(layer_owner)) {
263 window_->AddObserver(this); 262 window_->AddObserver(this);
264 layer_owner_->root()->GetCompositor()->AddObserver(this);
265 } 263 }
266 ~CrossFadeObserver() override { 264 ~CrossFadeObserver() override {
267 window_->RemoveObserver(this); 265 window_->RemoveObserver(this);
268 window_ = NULL; 266 window_ = NULL;
269 layer_owner_->root()->GetCompositor()->RemoveObserver(this);
270 } 267 }
271 268
272 // ui::CompositorObserver overrides:
273 void OnCompositingDidCommit(ui::Compositor* compositor) override {}
274 void OnCompositingStarted(ui::Compositor* compositor,
275 base::TimeTicks start_time) override {}
276 void OnCompositingEnded(ui::Compositor* compositor) override {}
277 void OnCompositingAborted(ui::Compositor* compositor) override {
278 // Triggers OnImplicitAnimationsCompleted() to be called and deletes us.
279 layer_owner_->root()->GetAnimator()->StopAnimating();
280 }
281 void OnCompositingLockStateChanged(ui::Compositor* compositor) override {}
282 void OnCompositingShuttingDown(ui::Compositor* compositor) override {}
283
284 // aura::WindowObserver overrides: 269 // aura::WindowObserver overrides:
285 void OnWindowDestroying(aura::Window* window) override { 270 void OnWindowDestroying(aura::Window* window) override {
286 // Triggers OnImplicitAnimationsCompleted() to be called and deletes us. 271 // Triggers OnImplicitAnimationsCompleted() to be called and deletes us.
287 layer_owner_->root()->GetAnimator()->StopAnimating(); 272 layer_owner_->root()->GetAnimator()->StopAnimating();
288 } 273 }
289 void OnWindowRemovingFromRootWindow(aura::Window* window, 274 void OnWindowRemovingFromRootWindow(aura::Window* window,
290 aura::Window* new_root) override { 275 aura::Window* new_root) override {
291 layer_owner_->root()->GetAnimator()->StopAnimating(); 276 layer_owner_->root()->GetAnimator()->StopAnimating();
292 } 277 }
293 278
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 case SHELF_ALIGNMENT_LEFT: 451 case SHELF_ALIGNMENT_LEFT:
467 return gfx::Rect(work_area.x(), work_area.y(), 0, 0); 452 return gfx::Rect(work_area.x(), work_area.y(), 0, 0);
468 case SHELF_ALIGNMENT_RIGHT: 453 case SHELF_ALIGNMENT_RIGHT:
469 return gfx::Rect(work_area.right(), work_area.y(), 0, 0); 454 return gfx::Rect(work_area.right(), work_area.y(), 0, 0);
470 } 455 }
471 NOTREACHED(); 456 NOTREACHED();
472 return gfx::Rect(); 457 return gfx::Rect();
473 } 458 }
474 459
475 } // namespace ash 460 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | blimp/client/support/compositor/blimp_embedder_compositor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698