| 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 12 matching lines...) Expand all Loading... |
| 23 #include "cc/animation/animation_timeline.h" | 23 #include "cc/animation/animation_timeline.h" |
| 24 #include "cc/base/switches.h" | 24 #include "cc/base/switches.h" |
| 25 #include "cc/input/input_handler.h" | 25 #include "cc/input/input_handler.h" |
| 26 #include "cc/layers/layer.h" | 26 #include "cc/layers/layer.h" |
| 27 #include "cc/output/begin_frame_args.h" | 27 #include "cc/output/begin_frame_args.h" |
| 28 #include "cc/output/context_provider.h" | 28 #include "cc/output/context_provider.h" |
| 29 #include "cc/output/latency_info_swap_promise.h" | 29 #include "cc/output/latency_info_swap_promise.h" |
| 30 #include "cc/scheduler/begin_frame_source.h" | 30 #include "cc/scheduler/begin_frame_source.h" |
| 31 #include "cc/surfaces/surface_id_allocator.h" | 31 #include "cc/surfaces/surface_id_allocator.h" |
| 32 #include "cc/surfaces/surface_manager.h" | 32 #include "cc/surfaces/surface_manager.h" |
| 33 #include "cc/trees/layer_tree_host_in_process.h" | 33 #include "cc/trees/layer_tree_host.h" |
| 34 #include "cc/trees/layer_tree_settings.h" | 34 #include "cc/trees/layer_tree_settings.h" |
| 35 #include "third_party/skia/include/core/SkBitmap.h" | 35 #include "third_party/skia/include/core/SkBitmap.h" |
| 36 #include "ui/compositor/compositor_observer.h" | 36 #include "ui/compositor/compositor_observer.h" |
| 37 #include "ui/compositor/compositor_switches.h" | 37 #include "ui/compositor/compositor_switches.h" |
| 38 #include "ui/compositor/compositor_vsync_manager.h" | 38 #include "ui/compositor/compositor_vsync_manager.h" |
| 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/compositor/scoped_animation_duration_scale_mode.h" | 42 #include "ui/compositor/scoped_animation_duration_scale_mode.h" |
| 43 #include "ui/gl/gl_switches.h" | 43 #include "ui/gl/gl_switches.h" |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 settings.image_decode_tasks_enabled = false; | 186 settings.image_decode_tasks_enabled = false; |
| 187 | 187 |
| 188 settings.gpu_memory_policy.bytes_limit_when_visible = 512 * 1024 * 1024; | 188 settings.gpu_memory_policy.bytes_limit_when_visible = 512 * 1024 * 1024; |
| 189 settings.gpu_memory_policy.priority_cutoff_when_visible = | 189 settings.gpu_memory_policy.priority_cutoff_when_visible = |
| 190 gpu::MemoryAllocation::CUTOFF_ALLOW_NICE_TO_HAVE; | 190 gpu::MemoryAllocation::CUTOFF_ALLOW_NICE_TO_HAVE; |
| 191 | 191 |
| 192 base::TimeTicks before_create = base::TimeTicks::Now(); | 192 base::TimeTicks before_create = base::TimeTicks::Now(); |
| 193 | 193 |
| 194 animation_host_ = cc::AnimationHost::CreateMainInstance(); | 194 animation_host_ = cc::AnimationHost::CreateMainInstance(); |
| 195 | 195 |
| 196 cc::LayerTreeHostInProcess::InitParams params; | 196 cc::LayerTreeHost::InitParams params; |
| 197 params.client = this; | 197 params.client = this; |
| 198 params.task_graph_runner = context_factory_->GetTaskGraphRunner(); | 198 params.task_graph_runner = context_factory_->GetTaskGraphRunner(); |
| 199 params.settings = &settings; | 199 params.settings = &settings; |
| 200 params.main_task_runner = task_runner_; | 200 params.main_task_runner = task_runner_; |
| 201 params.mutator_host = animation_host_.get(); | 201 params.mutator_host = animation_host_.get(); |
| 202 host_ = cc::LayerTreeHostInProcess::CreateSingleThreaded(this, ¶ms); | 202 host_ = cc::LayerTreeHost::CreateSingleThreaded(this, ¶ms); |
| 203 UMA_HISTOGRAM_TIMES("GPU.CreateBrowserCompositor", | 203 UMA_HISTOGRAM_TIMES("GPU.CreateBrowserCompositor", |
| 204 base::TimeTicks::Now() - before_create); | 204 base::TimeTicks::Now() - before_create); |
| 205 | 205 |
| 206 animation_timeline_ = | 206 animation_timeline_ = |
| 207 cc::AnimationTimeline::Create(cc::AnimationIdProvider::NextTimelineId()); | 207 cc::AnimationTimeline::Create(cc::AnimationIdProvider::NextTimelineId()); |
| 208 animation_host_->AddAnimationTimeline(animation_timeline_.get()); | 208 animation_host_->AddAnimationTimeline(animation_timeline_.get()); |
| 209 | 209 |
| 210 host_->GetLayerTree()->SetRootLayer(root_web_layer_); | 210 host_->GetLayerTree()->SetRootLayer(root_web_layer_); |
| 211 host_->SetFrameSinkId(frame_sink_id_); | 211 host_->SetFrameSinkId(frame_sink_id_); |
| 212 host_->SetVisible(true); | 212 host_->SetVisible(true); |
| (...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 551 for (auto& observer : observer_list_) | 551 for (auto& observer : observer_list_) |
| 552 observer.OnCompositingLockStateChanged(this); | 552 observer.OnCompositingLockStateChanged(this); |
| 553 } | 553 } |
| 554 | 554 |
| 555 void Compositor::CancelCompositorLock() { | 555 void Compositor::CancelCompositorLock() { |
| 556 if (compositor_lock_) | 556 if (compositor_lock_) |
| 557 compositor_lock_->CancelLock(); | 557 compositor_lock_->CancelLock(); |
| 558 } | 558 } |
| 559 | 559 |
| 560 } // namespace ui | 560 } // namespace ui |
| OLD | NEW |