| 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.h" | 33 #include "cc/trees/layer_tree_host_in_process.h" |
| 34 #include "cc/trees/layer_tree_settings.h" |
| 34 #include "third_party/skia/include/core/SkBitmap.h" | 35 #include "third_party/skia/include/core/SkBitmap.h" |
| 35 #include "ui/compositor/compositor_observer.h" | 36 #include "ui/compositor/compositor_observer.h" |
| 36 #include "ui/compositor/compositor_switches.h" | 37 #include "ui/compositor/compositor_switches.h" |
| 37 #include "ui/compositor/compositor_vsync_manager.h" | 38 #include "ui/compositor/compositor_vsync_manager.h" |
| 38 #include "ui/compositor/dip_util.h" | 39 #include "ui/compositor/dip_util.h" |
| 39 #include "ui/compositor/layer.h" | 40 #include "ui/compositor/layer.h" |
| 40 #include "ui/compositor/layer_animator_collection.h" | 41 #include "ui/compositor/layer_animator_collection.h" |
| 41 #include "ui/gl/gl_switches.h" | 42 #include "ui/gl/gl_switches.h" |
| 42 | 43 |
| 43 namespace { | 44 namespace { |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 settings.image_decode_tasks_enabled = false; | 186 settings.image_decode_tasks_enabled = false; |
| 186 | 187 |
| 187 settings.use_compositor_frame_sink_begin_frame_source = true; | 188 settings.use_compositor_frame_sink_begin_frame_source = true; |
| 188 | 189 |
| 189 settings.gpu_memory_policy.bytes_limit_when_visible = 512 * 1024 * 1024; | 190 settings.gpu_memory_policy.bytes_limit_when_visible = 512 * 1024 * 1024; |
| 190 settings.gpu_memory_policy.priority_cutoff_when_visible = | 191 settings.gpu_memory_policy.priority_cutoff_when_visible = |
| 191 gpu::MemoryAllocation::CUTOFF_ALLOW_NICE_TO_HAVE; | 192 gpu::MemoryAllocation::CUTOFF_ALLOW_NICE_TO_HAVE; |
| 192 | 193 |
| 193 base::TimeTicks before_create = base::TimeTicks::Now(); | 194 base::TimeTicks before_create = base::TimeTicks::Now(); |
| 194 | 195 |
| 195 cc::LayerTreeHost::InitParams params; | 196 cc::LayerTreeHostInProcess::InitParams params; |
| 196 params.client = this; | 197 params.client = this; |
| 197 params.shared_bitmap_manager = context_factory_->GetSharedBitmapManager(); | 198 params.shared_bitmap_manager = context_factory_->GetSharedBitmapManager(); |
| 198 params.gpu_memory_buffer_manager = | 199 params.gpu_memory_buffer_manager = |
| 199 context_factory_->GetGpuMemoryBufferManager(); | 200 context_factory_->GetGpuMemoryBufferManager(); |
| 200 params.task_graph_runner = context_factory_->GetTaskGraphRunner(); | 201 params.task_graph_runner = context_factory_->GetTaskGraphRunner(); |
| 201 params.settings = &settings; | 202 params.settings = &settings; |
| 202 params.main_task_runner = task_runner_; | 203 params.main_task_runner = task_runner_; |
| 203 params.animation_host = cc::AnimationHost::CreateMainInstance(); | 204 params.animation_host = cc::AnimationHost::CreateMainInstance(); |
| 204 host_ = cc::LayerTreeHost::CreateSingleThreaded(this, ¶ms); | 205 host_ = cc::LayerTreeHostInProcess::CreateSingleThreaded(this, ¶ms); |
| 205 UMA_HISTOGRAM_TIMES("GPU.CreateBrowserCompositor", | 206 UMA_HISTOGRAM_TIMES("GPU.CreateBrowserCompositor", |
| 206 base::TimeTicks::Now() - before_create); | 207 base::TimeTicks::Now() - before_create); |
| 207 | 208 |
| 208 animation_timeline_ = | 209 animation_timeline_ = |
| 209 cc::AnimationTimeline::Create(cc::AnimationIdProvider::NextTimelineId()); | 210 cc::AnimationTimeline::Create(cc::AnimationIdProvider::NextTimelineId()); |
| 210 host_->GetLayerTree()->animation_host()->AddAnimationTimeline( | 211 host_->GetLayerTree()->animation_host()->AddAnimationTimeline( |
| 211 animation_timeline_.get()); | 212 animation_timeline_.get()); |
| 212 | 213 |
| 213 host_->GetLayerTree()->SetRootLayer(root_web_layer_); | 214 host_->GetLayerTree()->SetRootLayer(root_web_layer_); |
| 214 host_->SetSurfaceClientId(surface_id_allocator_->client_id()); | 215 host_->SetSurfaceClientId(surface_id_allocator_->client_id()); |
| (...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 551 observer_list_, | 552 observer_list_, |
| 552 OnCompositingLockStateChanged(this)); | 553 OnCompositingLockStateChanged(this)); |
| 553 } | 554 } |
| 554 | 555 |
| 555 void Compositor::CancelCompositorLock() { | 556 void Compositor::CancelCompositorLock() { |
| 556 if (compositor_lock_) | 557 if (compositor_lock_) |
| 557 compositor_lock_->CancelLock(); | 558 compositor_lock_->CancelLock(); |
| 558 } | 559 } |
| 559 | 560 |
| 560 } // namespace ui | 561 } // namespace ui |
| OLD | NEW |