OLD | NEW |
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 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 | 302 |
303 void Compositor::SetAcceleratedWidget(gfx::AcceleratedWidget widget) { | 303 void Compositor::SetAcceleratedWidget(gfx::AcceleratedWidget widget) { |
304 // This function should only get called once. | 304 // This function should only get called once. |
305 DCHECK(!widget_valid_); | 305 DCHECK(!widget_valid_); |
306 widget_ = widget; | 306 widget_ = widget; |
307 widget_valid_ = true; | 307 widget_valid_ = true; |
308 if (output_surface_requested_) | 308 if (output_surface_requested_) |
309 context_factory_->CreateOutputSurface(weak_ptr_factory_.GetWeakPtr()); | 309 context_factory_->CreateOutputSurface(weak_ptr_factory_.GetWeakPtr()); |
310 } | 310 } |
311 | 311 |
| 312 gfx::AcceleratedWidget Compositor::ReleaseAcceleratedWidget() { |
| 313 DCHECK(!IsVisible()); |
| 314 if (!host_->output_surface_lost()) |
| 315 host_->ReleaseOutputSurface(); |
| 316 context_factory_->RemoveCompositor(this); |
| 317 widget_valid_ = false; |
| 318 return widget_; |
| 319 } |
| 320 |
312 gfx::AcceleratedWidget Compositor::widget() const { | 321 gfx::AcceleratedWidget Compositor::widget() const { |
313 DCHECK(widget_valid_); | 322 DCHECK(widget_valid_); |
314 return widget_; | 323 return widget_; |
315 } | 324 } |
316 | 325 |
317 scoped_refptr<CompositorVSyncManager> Compositor::vsync_manager() const { | 326 scoped_refptr<CompositorVSyncManager> Compositor::vsync_manager() const { |
318 return vsync_manager_; | 327 return vsync_manager_; |
319 } | 328 } |
320 | 329 |
321 void Compositor::AddObserver(CompositorObserver* observer) { | 330 void Compositor::AddObserver(CompositorObserver* observer) { |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
478 observer_list_, | 487 observer_list_, |
479 OnCompositingLockStateChanged(this)); | 488 OnCompositingLockStateChanged(this)); |
480 } | 489 } |
481 | 490 |
482 void Compositor::CancelCompositorLock() { | 491 void Compositor::CancelCompositorLock() { |
483 if (compositor_lock_) | 492 if (compositor_lock_) |
484 compositor_lock_->CancelLock(); | 493 compositor_lock_->CancelLock(); |
485 } | 494 } |
486 | 495 |
487 } // namespace ui | 496 } // namespace ui |
OLD | NEW |