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

Side by Side Diff: ui/compositor/compositor.cc

Issue 1388543004: aura: Support releasing the OutputSurface() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@startcomp
Patch Set: Created 5 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 (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 "ui/compositor/compositor.h" 5 #include "ui/compositor/compositor.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <deque> 8 #include <deque>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 300
301 void Compositor::SetAcceleratedWidget(gfx::AcceleratedWidget widget) { 301 void Compositor::SetAcceleratedWidget(gfx::AcceleratedWidget widget) {
302 // This function should only get called once. 302 // This function should only get called once.
303 DCHECK(!widget_valid_); 303 DCHECK(!widget_valid_);
304 widget_ = widget; 304 widget_ = widget;
305 widget_valid_ = true; 305 widget_valid_ = true;
306 if (output_surface_requested_) 306 if (output_surface_requested_)
307 context_factory_->CreateOutputSurface(weak_ptr_factory_.GetWeakPtr()); 307 context_factory_->CreateOutputSurface(weak_ptr_factory_.GetWeakPtr());
308 } 308 }
309 309
310 gfx::AcceleratedWidget Compositor::ReleaseAcceleratedWidget() {
311 DCHECK(!IsVisible());
312 if (!host_->output_surface_lost())
313 host_->ReleaseOutputSurface();
314 context_factory_->RemoveCompositor(this);
315 widget_valid_ = false;
316 gfx::AcceleratedWidget widget = widget_;
317 widget_ = gfx::kNullAcceleratedWidget;
318 return widget;
319 }
320
310 gfx::AcceleratedWidget Compositor::widget() const { 321 gfx::AcceleratedWidget Compositor::widget() const {
311 DCHECK(widget_valid_); 322 DCHECK(widget_valid_);
312 return widget_; 323 return widget_;
313 } 324 }
314 325
315 scoped_refptr<CompositorVSyncManager> Compositor::vsync_manager() const { 326 scoped_refptr<CompositorVSyncManager> Compositor::vsync_manager() const {
316 return vsync_manager_; 327 return vsync_manager_;
317 } 328 }
318 329
319 void Compositor::AddObserver(CompositorObserver* observer) { 330 void Compositor::AddObserver(CompositorObserver* observer) {
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 observer_list_, 487 observer_list_,
477 OnCompositingLockStateChanged(this)); 488 OnCompositingLockStateChanged(this));
478 } 489 }
479 490
480 void Compositor::CancelCompositorLock() { 491 void Compositor::CancelCompositorLock() {
481 if (compositor_lock_) 492 if (compositor_lock_)
482 compositor_lock_->CancelLock(); 493 compositor_lock_->CancelLock();
483 } 494 }
484 495
485 } // namespace ui 496 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698