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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <deque> | 10 #include <deque> |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 if (!compositor_) | 72 if (!compositor_) |
73 return; | 73 return; |
74 compositor_->UnlockCompositor(); | 74 compositor_->UnlockCompositor(); |
75 compositor_ = NULL; | 75 compositor_ = NULL; |
76 } | 76 } |
77 | 77 |
78 Compositor::Compositor(ui::ContextFactory* context_factory, | 78 Compositor::Compositor(ui::ContextFactory* context_factory, |
79 scoped_refptr<base::SingleThreadTaskRunner> task_runner) | 79 scoped_refptr<base::SingleThreadTaskRunner> task_runner) |
80 : context_factory_(context_factory), | 80 : context_factory_(context_factory), |
81 root_layer_(NULL), | 81 root_layer_(NULL), |
| 82 initialized_(false), |
82 widget_(gfx::kNullAcceleratedWidget), | 83 widget_(gfx::kNullAcceleratedWidget), |
83 widget_valid_(false), | 84 widget_valid_(false), |
84 output_surface_requested_(false), | 85 output_surface_requested_(false), |
85 surface_id_allocator_(context_factory->CreateSurfaceIdAllocator()), | 86 surface_id_allocator_(base::WrapUnique(new cc::SurfaceIdAllocator( |
| 87 context_factory->AllocateSurfaceClientId()))), |
86 task_runner_(task_runner), | 88 task_runner_(task_runner), |
87 vsync_manager_(new CompositorVSyncManager()), | 89 vsync_manager_(new CompositorVSyncManager()), |
88 device_scale_factor_(0.0f), | 90 device_scale_factor_(0.0f), |
89 locks_will_time_out_(true), | 91 locks_will_time_out_(true), |
90 compositor_lock_(NULL), | 92 compositor_lock_(NULL), |
91 layer_animator_collection_(this), | 93 layer_animator_collection_(this), |
92 weak_ptr_factory_(this) { | 94 weak_ptr_factory_(this) { |
93 root_web_layer_ = cc::Layer::Create(); | 95 root_web_layer_ = cc::Layer::Create(); |
94 | 96 |
95 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 97 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
422 } | 424 } |
423 | 425 |
424 void Compositor::RequestNewOutputSurface() { | 426 void Compositor::RequestNewOutputSurface() { |
425 DCHECK(!output_surface_requested_); | 427 DCHECK(!output_surface_requested_); |
426 output_surface_requested_ = true; | 428 output_surface_requested_ = true; |
427 if (widget_valid_) | 429 if (widget_valid_) |
428 context_factory_->CreateOutputSurface(weak_ptr_factory_.GetWeakPtr()); | 430 context_factory_->CreateOutputSurface(weak_ptr_factory_.GetWeakPtr()); |
429 } | 431 } |
430 | 432 |
431 void Compositor::DidInitializeOutputSurface() { | 433 void Compositor::DidInitializeOutputSurface() { |
| 434 initialized_ = true; |
| 435 FOR_EACH_OBSERVER(CompositorObserver, observer_list_, |
| 436 OnCompositingInitialized(this)); |
432 } | 437 } |
433 | 438 |
434 void Compositor::DidFailToInitializeOutputSurface() { | 439 void Compositor::DidFailToInitializeOutputSurface() { |
435 // The OutputSurface should already be bound/initialized before being given to | 440 // The OutputSurface should already be bound/initialized before being given to |
436 // the Compositor. | 441 // the Compositor. |
437 NOTREACHED(); | 442 NOTREACHED(); |
438 } | 443 } |
439 | 444 |
440 void Compositor::DidCommit() { | 445 void Compositor::DidCommit() { |
441 DCHECK(!IsLocked()); | 446 DCHECK(!IsLocked()); |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
500 observer_list_, | 505 observer_list_, |
501 OnCompositingLockStateChanged(this)); | 506 OnCompositingLockStateChanged(this)); |
502 } | 507 } |
503 | 508 |
504 void Compositor::CancelCompositorLock() { | 509 void Compositor::CancelCompositorLock() { |
505 if (compositor_lock_) | 510 if (compositor_lock_) |
506 compositor_lock_->CancelLock(); | 511 compositor_lock_->CancelLock(); |
507 } | 512 } |
508 | 513 |
509 } // namespace ui | 514 } // namespace ui |
OLD | NEW |