Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(20)

Side by Side Diff: ui/compositor/compositor.cc

Issue 1749573002: CC Animation: Erase old animation system in UI Compositor. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@eraseblink
Patch Set: Exclude histograms.xml Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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>
11 #include <utility> 11 #include <utility>
12 12
13 #include "base/bind.h" 13 #include "base/bind.h"
14 #include "base/command_line.h" 14 #include "base/command_line.h"
15 #include "base/message_loop/message_loop.h" 15 #include "base/message_loop/message_loop.h"
16 #include "base/metrics/histogram.h" 16 #include "base/metrics/histogram.h"
17 #include "base/strings/string_util.h" 17 #include "base/strings/string_util.h"
18 #include "base/sys_info.h" 18 #include "base/sys_info.h"
19 #include "base/trace_event/trace_event.h" 19 #include "base/trace_event/trace_event.h"
20 #include "build/build_config.h" 20 #include "build/build_config.h"
21 #include "cc/animation/animation_host.h" 21 #include "cc/animation/animation_host.h"
22 #include "cc/animation/animation_id_provider.h" 22 #include "cc/animation/animation_id_provider.h"
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/layers/layer_settings.h"
27 #include "cc/output/begin_frame_args.h" 28 #include "cc/output/begin_frame_args.h"
28 #include "cc/output/context_provider.h" 29 #include "cc/output/context_provider.h"
29 #include "cc/output/latency_info_swap_promise.h" 30 #include "cc/output/latency_info_swap_promise.h"
30 #include "cc/scheduler/begin_frame_source.h" 31 #include "cc/scheduler/begin_frame_source.h"
31 #include "cc/surfaces/surface_id_allocator.h" 32 #include "cc/surfaces/surface_id_allocator.h"
32 #include "cc/trees/layer_tree_host.h" 33 #include "cc/trees/layer_tree_host.h"
33 #include "third_party/skia/include/core/SkBitmap.h" 34 #include "third_party/skia/include/core/SkBitmap.h"
34 #include "ui/compositor/compositor_observer.h" 35 #include "ui/compositor/compositor_observer.h"
35 #include "ui/compositor/compositor_switches.h" 36 #include "ui/compositor/compositor_switches.h"
36 #include "ui/compositor/compositor_vsync_manager.h" 37 #include "ui/compositor/compositor_vsync_manager.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 surface_id_allocator_(context_factory->CreateSurfaceIdAllocator()), 81 surface_id_allocator_(context_factory->CreateSurfaceIdAllocator()),
81 task_runner_(task_runner), 82 task_runner_(task_runner),
82 vsync_manager_(new CompositorVSyncManager()), 83 vsync_manager_(new CompositorVSyncManager()),
83 device_scale_factor_(0.0f), 84 device_scale_factor_(0.0f),
84 last_started_frame_(0), 85 last_started_frame_(0),
85 last_ended_frame_(0), 86 last_ended_frame_(0),
86 locks_will_time_out_(true), 87 locks_will_time_out_(true),
87 compositor_lock_(NULL), 88 compositor_lock_(NULL),
88 layer_animator_collection_(this), 89 layer_animator_collection_(this),
89 weak_ptr_factory_(this) { 90 weak_ptr_factory_(this) {
90 root_web_layer_ = cc::Layer::Create(Layer::UILayerSettings()); 91 root_web_layer_ = cc::Layer::Create(cc::LayerSettings());
91 92
92 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); 93 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
93 94
94 cc::LayerTreeSettings settings; 95 cc::LayerTreeSettings settings;
95 96
96 // This will ensure PictureLayers always can have LCD text, to match the 97 // This will ensure PictureLayers always can have LCD text, to match the
97 // previous behaviour with ContentLayers, where LCD-not-allowed notifications 98 // previous behaviour with ContentLayers, where LCD-not-allowed notifications
98 // were ignored. 99 // were ignored.
99 settings.layers_always_allowed_lcd_text = true; 100 settings.layers_always_allowed_lcd_text = true;
100 // Use occlusion to allow more overlapping windows to take less memory. 101 // Use occlusion to allow more overlapping windows to take less memory.
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 DCHECK_GT(settings.use_image_texture_targets.size(), format); 166 DCHECK_GT(settings.use_image_texture_targets.size(), format);
166 settings.use_image_texture_targets[format] = 167 settings.use_image_texture_targets[format] =
167 context_factory_->GetImageTextureTarget( 168 context_factory_->GetImageTextureTarget(
168 static_cast<gfx::BufferFormat>(format), usage); 169 static_cast<gfx::BufferFormat>(format), usage);
169 } 170 }
170 171
171 // Note: Only enable image decode tasks if we have more than one worker 172 // Note: Only enable image decode tasks if we have more than one worker
172 // thread. 173 // thread.
173 settings.image_decode_tasks_enabled = false; 174 settings.image_decode_tasks_enabled = false;
174 175
175 settings.use_compositor_animation_timelines = !command_line->HasSwitch(
176 switches::kUIDisableCompositorAnimationTimelines);
177
178 #if !defined(OS_ANDROID) 176 #if !defined(OS_ANDROID)
179 // TODO(sohanjg): Revisit this memory usage in tile manager. 177 // TODO(sohanjg): Revisit this memory usage in tile manager.
180 cc::ManagedMemoryPolicy policy( 178 cc::ManagedMemoryPolicy policy(
181 512 * 1024 * 1024, gpu::MemoryAllocation::CUTOFF_ALLOW_NICE_TO_HAVE, 179 512 * 1024 * 1024, gpu::MemoryAllocation::CUTOFF_ALLOW_NICE_TO_HAVE,
182 settings.memory_policy_.num_resources_limit); 180 settings.memory_policy_.num_resources_limit);
183 settings.memory_policy_ = policy; 181 settings.memory_policy_ = policy;
184 #endif 182 #endif
185 183
186 base::TimeTicks before_create = base::TimeTicks::Now(); 184 base::TimeTicks before_create = base::TimeTicks::Now();
187 185
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
522 observer_list_, 520 observer_list_,
523 OnCompositingLockStateChanged(this)); 521 OnCompositingLockStateChanged(this));
524 } 522 }
525 523
526 void Compositor::CancelCompositorLock() { 524 void Compositor::CancelCompositorLock() {
527 if (compositor_lock_) 525 if (compositor_lock_)
528 compositor_lock_->CancelLock(); 526 compositor_lock_->CancelLock();
529 } 527 }
530 528
531 } // namespace ui 529 } // namespace ui
OLDNEW
« no previous file with comments | « content/browser/compositor/gpu_process_transport_factory.cc ('k') | ui/compositor/compositor_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698