OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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 "cc/trees/layer_tree_host_impl.h" | 5 #include "cc/trees/layer_tree_host_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 #include <map> | 9 #include <map> |
10 #include <set> | 10 #include <set> |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 void DidVisibilityChange(LayerTreeHostImpl* id, bool visible) { | 122 void DidVisibilityChange(LayerTreeHostImpl* id, bool visible) { |
123 if (visible) { | 123 if (visible) { |
124 TRACE_EVENT_ASYNC_BEGIN1("cc", "LayerTreeHostImpl::SetVisible", id, | 124 TRACE_EVENT_ASYNC_BEGIN1("cc", "LayerTreeHostImpl::SetVisible", id, |
125 "LayerTreeHostImpl", id); | 125 "LayerTreeHostImpl", id); |
126 return; | 126 return; |
127 } | 127 } |
128 | 128 |
129 TRACE_EVENT_ASYNC_END0("cc", "LayerTreeHostImpl::SetVisible", id); | 129 TRACE_EVENT_ASYNC_END0("cc", "LayerTreeHostImpl::SetVisible", id); |
130 } | 130 } |
131 | 131 |
132 size_t GetDefaultMemoryAllocationLimit() { | |
133 // TODO(ccameron): (http://crbug.com/137094) This 64MB default is a straggler | |
134 // from the old texture manager and is just to give us a default memory | |
135 // allocation before we get a callback from the GPU memory manager. We | |
136 // should probaby either: | |
137 // - wait for the callback before rendering anything instead | |
138 // - push this into the GPU memory manager somehow. | |
139 return 64 * 1024 * 1024; | |
140 } | |
141 | |
142 } // namespace | 132 } // namespace |
143 | 133 |
144 LayerTreeHostImpl::FrameData::FrameData() | 134 LayerTreeHostImpl::FrameData::FrameData() |
145 : render_surface_layer_list(nullptr), has_no_damage(false) {} | 135 : render_surface_layer_list(nullptr), has_no_damage(false) {} |
146 | 136 |
147 LayerTreeHostImpl::FrameData::~FrameData() {} | 137 LayerTreeHostImpl::FrameData::~FrameData() {} |
148 | 138 |
149 scoped_ptr<LayerTreeHostImpl> LayerTreeHostImpl::Create( | 139 scoped_ptr<LayerTreeHostImpl> LayerTreeHostImpl::Create( |
150 const LayerTreeSettings& settings, | 140 const LayerTreeSettings& settings, |
151 LayerTreeHostImplClient* client, | 141 LayerTreeHostImplClient* client, |
(...skipping 28 matching lines...) Expand all Loading... |
180 gpu_rasterization_status_(GpuRasterizationStatus::OFF_DEVICE), | 170 gpu_rasterization_status_(GpuRasterizationStatus::OFF_DEVICE), |
181 tree_resources_for_gpu_rasterization_dirty_(false), | 171 tree_resources_for_gpu_rasterization_dirty_(false), |
182 input_handler_client_(NULL), | 172 input_handler_client_(NULL), |
183 did_lock_scrolling_layer_(false), | 173 did_lock_scrolling_layer_(false), |
184 wheel_scrolling_(false), | 174 wheel_scrolling_(false), |
185 scroll_affects_scroll_handler_(false), | 175 scroll_affects_scroll_handler_(false), |
186 scroll_layer_id_when_mouse_over_scrollbar_(0), | 176 scroll_layer_id_when_mouse_over_scrollbar_(0), |
187 tile_priorities_dirty_(false), | 177 tile_priorities_dirty_(false), |
188 settings_(settings), | 178 settings_(settings), |
189 visible_(true), | 179 visible_(true), |
190 cached_managed_memory_policy_( | 180 cached_managed_memory_policy_(settings.memory_policy_), |
191 GetDefaultMemoryAllocationLimit(), | |
192 gpu::MemoryAllocation::CUTOFF_ALLOW_EVERYTHING, | |
193 ManagedMemoryPolicy::kDefaultNumResourcesLimit), | |
194 is_synchronous_single_threaded_(!proxy->HasImplThread() && | 181 is_synchronous_single_threaded_(!proxy->HasImplThread() && |
195 !settings.single_thread_proxy_scheduler), | 182 !settings.single_thread_proxy_scheduler), |
196 // Must be initialized after is_synchronous_single_threaded_ and proxy_. | 183 // Must be initialized after is_synchronous_single_threaded_ and proxy_. |
197 tile_manager_( | 184 tile_manager_( |
198 TileManager::Create(this, | 185 TileManager::Create(this, |
199 GetTaskRunner(), | 186 GetTaskRunner(), |
200 is_synchronous_single_threaded_ | 187 is_synchronous_single_threaded_ |
201 ? std::numeric_limits<size_t>::max() | 188 ? std::numeric_limits<size_t>::max() |
202 : settings.scheduled_raster_task_limit)), | 189 : settings.scheduled_raster_task_limit)), |
203 pinch_gesture_active_(false), | 190 pinch_gesture_active_(false), |
(...skipping 3393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3597 if (active_tree()) { | 3584 if (active_tree()) { |
3598 LayerAnimationValueProvider* layer = active_tree()->LayerById(layer_id); | 3585 LayerAnimationValueProvider* layer = active_tree()->LayerById(layer_id); |
3599 if (layer) | 3586 if (layer) |
3600 return layer->ScrollOffsetForAnimation(); | 3587 return layer->ScrollOffsetForAnimation(); |
3601 } | 3588 } |
3602 | 3589 |
3603 return gfx::ScrollOffset(); | 3590 return gfx::ScrollOffset(); |
3604 } | 3591 } |
3605 | 3592 |
3606 } // namespace cc | 3593 } // namespace cc |
OLD | NEW |