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

Side by Side Diff: cc/trees/layer_tree_host_impl.cc

Issue 1324413003: Move gpu memory calculations to Compositor. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove more memory alloc codes. Created 5 years, 2 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 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
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 29 matching lines...) Expand all
181 input_handler_client_(NULL), 171 input_handler_client_(NULL),
182 did_lock_scrolling_layer_(false), 172 did_lock_scrolling_layer_(false),
183 should_bubble_scrolls_(false), 173 should_bubble_scrolls_(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 root_layer_scroll_offset_delegate_(NULL), 178 root_layer_scroll_offset_delegate_(NULL),
189 settings_(settings), 179 settings_(settings),
190 visible_(true), 180 visible_(true),
191 cached_managed_memory_policy_( 181 cached_managed_memory_policy_(settings.memory_policy_),
192 GetDefaultMemoryAllocationLimit(),
193 gpu::MemoryAllocation::CUTOFF_ALLOW_EVERYTHING,
194 ManagedMemoryPolicy::kDefaultNumResourcesLimit),
195 is_synchronous_single_threaded_(!proxy->HasImplThread() && 182 is_synchronous_single_threaded_(!proxy->HasImplThread() &&
196 !settings.single_thread_proxy_scheduler), 183 !settings.single_thread_proxy_scheduler),
197 // Must be initialized after is_synchronous_single_threaded_ and proxy_. 184 // Must be initialized after is_synchronous_single_threaded_ and proxy_.
198 tile_manager_( 185 tile_manager_(
199 TileManager::Create(this, 186 TileManager::Create(this,
200 GetTaskRunner(), 187 GetTaskRunner(),
201 is_synchronous_single_threaded_ 188 is_synchronous_single_threaded_
202 ? std::numeric_limits<size_t>::max() 189 ? std::numeric_limits<size_t>::max()
203 : settings.scheduled_raster_task_limit)), 190 : settings.scheduled_raster_task_limit)),
204 pinch_gesture_active_(false), 191 pinch_gesture_active_(false),
(...skipping 3407 matching lines...) Expand 10 before | Expand all | Expand 10 after
3612 if (active_tree()) { 3599 if (active_tree()) {
3613 LayerAnimationValueProvider* layer = active_tree()->LayerById(layer_id); 3600 LayerAnimationValueProvider* layer = active_tree()->LayerById(layer_id);
3614 if (layer) 3601 if (layer)
3615 return layer->ScrollOffsetForAnimation(); 3602 return layer->ScrollOffsetForAnimation();
3616 } 3603 }
3617 3604
3618 return gfx::ScrollOffset(); 3605 return gfx::ScrollOffset();
3619 } 3606 }
3620 3607
3621 } // namespace cc 3608 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698