| 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 28 matching lines...) Expand all Loading... |
| 39 #include "ui/compositor/dip_util.h" | 39 #include "ui/compositor/dip_util.h" |
| 40 #include "ui/compositor/layer.h" | 40 #include "ui/compositor/layer.h" |
| 41 #include "ui/compositor/layer_animator_collection.h" | 41 #include "ui/compositor/layer_animator_collection.h" |
| 42 #include "ui/gl/gl_switches.h" | 42 #include "ui/gl/gl_switches.h" |
| 43 | 43 |
| 44 namespace { | 44 namespace { |
| 45 | 45 |
| 46 const double kDefaultRefreshRate = 60.0; | 46 const double kDefaultRefreshRate = 60.0; |
| 47 const double kTestRefreshRate = 200.0; | 47 const double kTestRefreshRate = 200.0; |
| 48 | 48 |
| 49 // TODO(mfomitchev, fsamuel): Look at removing this when transition from |
| 50 // SurfaceSequence to SurfaceReference is fully complete. |
| 51 // Used when ui::Compositor is created with null ContextFactoryPrivate. |
| 52 // Compositor needs a valid FrameSinkId, so that cc::SurfaceLayer can create |
| 53 // valid SurfaceSequences. |
| 54 constexpr cc::FrameSinkId kDefaultFrameSinkId(1, 1); |
| 55 |
| 49 } // namespace | 56 } // namespace |
| 50 | 57 |
| 51 namespace ui { | 58 namespace ui { |
| 52 | 59 |
| 53 CompositorLock::CompositorLock(Compositor* compositor) | 60 CompositorLock::CompositorLock(Compositor* compositor) |
| 54 : compositor_(compositor) { | 61 : compositor_(compositor) { |
| 55 if (compositor_->locks_will_time_out_) { | 62 if (compositor_->locks_will_time_out_) { |
| 56 compositor_->task_runner_->PostDelayedTask( | 63 compositor_->task_runner_->PostDelayedTask( |
| 57 FROM_HERE, | 64 FROM_HERE, |
| 58 base::Bind(&CompositorLock::CancelLock, AsWeakPtr()), | 65 base::Bind(&CompositorLock::CancelLock, AsWeakPtr()), |
| (...skipping 19 matching lines...) Expand all Loading... |
| 78 context_factory_private_(context_factory_private), | 85 context_factory_private_(context_factory_private), |
| 79 root_layer_(NULL), | 86 root_layer_(NULL), |
| 80 widget_(gfx::kNullAcceleratedWidget), | 87 widget_(gfx::kNullAcceleratedWidget), |
| 81 #if defined(USE_AURA) | 88 #if defined(USE_AURA) |
| 82 window_(nullptr), | 89 window_(nullptr), |
| 83 #endif | 90 #endif |
| 84 widget_valid_(false), | 91 widget_valid_(false), |
| 85 compositor_frame_sink_requested_(false), | 92 compositor_frame_sink_requested_(false), |
| 86 frame_sink_id_(context_factory_private | 93 frame_sink_id_(context_factory_private |
| 87 ? context_factory_private->AllocateFrameSinkId() | 94 ? context_factory_private->AllocateFrameSinkId() |
| 88 : cc::FrameSinkId()), | 95 : kDefaultFrameSinkId), |
| 89 task_runner_(task_runner), | 96 task_runner_(task_runner), |
| 90 vsync_manager_(new CompositorVSyncManager()), | 97 vsync_manager_(new CompositorVSyncManager()), |
| 91 device_scale_factor_(0.0f), | 98 device_scale_factor_(0.0f), |
| 92 locks_will_time_out_(true), | 99 locks_will_time_out_(true), |
| 93 compositor_lock_(NULL), | 100 compositor_lock_(NULL), |
| 94 layer_animator_collection_(this), | 101 layer_animator_collection_(this), |
| 95 weak_ptr_factory_(this) { | 102 weak_ptr_factory_(this) { |
| 96 if (context_factory_private) { | 103 if (context_factory_private) { |
| 97 context_factory_private->GetSurfaceManager()->RegisterFrameSinkId( | 104 context_factory_private->GetSurfaceManager()->RegisterFrameSinkId( |
| 98 frame_sink_id_); | 105 frame_sink_id_); |
| (...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 558 for (auto& observer : observer_list_) | 565 for (auto& observer : observer_list_) |
| 559 observer.OnCompositingLockStateChanged(this); | 566 observer.OnCompositingLockStateChanged(this); |
| 560 } | 567 } |
| 561 | 568 |
| 562 void Compositor::CancelCompositorLock() { | 569 void Compositor::CancelCompositorLock() { |
| 563 if (compositor_lock_) | 570 if (compositor_lock_) |
| 564 compositor_lock_->CancelLock(); | 571 compositor_lock_->CancelLock(); |
| 565 } | 572 } |
| 566 | 573 |
| 567 } // namespace ui | 574 } // namespace ui |
| OLD | NEW |