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

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

Issue 2321883002: cc: Remove SetMemoryPolicy from OutputSurface and Display. (Closed)
Patch Set: nits Created 4 years, 3 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
« no previous file with comments | « cc/trees/layer_tree_host_impl.h ('k') | cc/trees/layer_tree_host_impl_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 use_msaa_(false), 205 use_msaa_(false),
206 gpu_rasterization_status_(GpuRasterizationStatus::OFF_DEVICE), 206 gpu_rasterization_status_(GpuRasterizationStatus::OFF_DEVICE),
207 input_handler_client_(NULL), 207 input_handler_client_(NULL),
208 did_lock_scrolling_layer_(false), 208 did_lock_scrolling_layer_(false),
209 wheel_scrolling_(false), 209 wheel_scrolling_(false),
210 scroll_affects_scroll_handler_(false), 210 scroll_affects_scroll_handler_(false),
211 scroll_layer_id_when_mouse_over_scrollbar_(Layer::INVALID_ID), 211 scroll_layer_id_when_mouse_over_scrollbar_(Layer::INVALID_ID),
212 tile_priorities_dirty_(false), 212 tile_priorities_dirty_(false),
213 settings_(settings), 213 settings_(settings),
214 visible_(false), 214 visible_(false),
215 cached_managed_memory_policy_(settings.memory_policy_), 215 cached_managed_memory_policy_(settings.gpu_memory_policy),
216 is_synchronous_single_threaded_(!task_runner_provider->HasImplThread() && 216 is_synchronous_single_threaded_(!task_runner_provider->HasImplThread() &&
217 !settings.single_thread_proxy_scheduler), 217 !settings.single_thread_proxy_scheduler),
218 // Must be initialized after is_synchronous_single_threaded_ and 218 // Must be initialized after is_synchronous_single_threaded_ and
219 // task_runner_provider_. 219 // task_runner_provider_.
220 tile_manager_(this, 220 tile_manager_(this,
221 GetTaskRunner(), 221 GetTaskRunner(),
222 is_synchronous_single_threaded_ 222 is_synchronous_single_threaded_
223 ? std::numeric_limits<size_t>::max() 223 ? std::numeric_limits<size_t>::max()
224 : settings.scheduled_raster_task_limit, 224 : settings.scheduled_raster_task_limit,
225 settings.use_partial_raster), 225 settings.use_partial_raster),
(...skipping 1872 matching lines...) Expand 10 before | Expand all | Expand 10 after
2098 if (debug_state_.rasterize_only_visible_content) { 2098 if (debug_state_.rasterize_only_visible_content) {
2099 actual.priority_cutoff_when_visible = 2099 actual.priority_cutoff_when_visible =
2100 gpu::MemoryAllocation::CUTOFF_ALLOW_REQUIRED_ONLY; 2100 gpu::MemoryAllocation::CUTOFF_ALLOW_REQUIRED_ONLY;
2101 } else if (use_gpu_rasterization()) { 2101 } else if (use_gpu_rasterization()) {
2102 actual.priority_cutoff_when_visible = 2102 actual.priority_cutoff_when_visible =
2103 gpu::MemoryAllocation::CUTOFF_ALLOW_NICE_TO_HAVE; 2103 gpu::MemoryAllocation::CUTOFF_ALLOW_NICE_TO_HAVE;
2104 } 2104 }
2105 return actual; 2105 return actual;
2106 } 2106 }
2107 2107
2108 size_t LayerTreeHostImpl::memory_allocation_limit_bytes() const {
2109 return ActualManagedMemoryPolicy().bytes_limit_when_visible;
2110 }
2111
2112 void LayerTreeHostImpl::ReleaseTreeResources() { 2108 void LayerTreeHostImpl::ReleaseTreeResources() {
2113 active_tree_->ReleaseResources(); 2109 active_tree_->ReleaseResources();
2114 if (pending_tree_) 2110 if (pending_tree_)
2115 pending_tree_->ReleaseResources(); 2111 pending_tree_->ReleaseResources();
2116 if (recycle_tree_) 2112 if (recycle_tree_)
2117 recycle_tree_->ReleaseResources(); 2113 recycle_tree_->ReleaseResources();
2118 2114
2119 EvictAllUIResources(); 2115 EvictAllUIResources();
2120 } 2116 }
2121 2117
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
2300 TRACE_EVENT0("cc", "LayerTreeHostImpl::InitializeRenderer"); 2296 TRACE_EVENT0("cc", "LayerTreeHostImpl::InitializeRenderer");
2301 2297
2302 ReleaseOutputSurface(); 2298 ReleaseOutputSurface();
2303 if (!output_surface->BindToClient(this)) { 2299 if (!output_surface->BindToClient(this)) {
2304 // Avoid recreating tree resources because we might not have enough 2300 // Avoid recreating tree resources because we might not have enough
2305 // information to do this yet (eg. we don't have a TileManager at this 2301 // information to do this yet (eg. we don't have a TileManager at this
2306 // point). 2302 // point).
2307 return false; 2303 return false;
2308 } 2304 }
2309 2305
2306 // When using software compositing, change to the limits specified for it.
2307 // Since this is a one way trip, we don't need to worry about going back to
2308 // GPU compositing.
2309 if (!output_surface->context_provider())
2310 SetMemoryPolicy(settings_.software_memory_policy);
2311
2310 output_surface_ = output_surface; 2312 output_surface_ = output_surface;
2311 resource_provider_ = base::MakeUnique<ResourceProvider>( 2313 resource_provider_ = base::MakeUnique<ResourceProvider>(
2312 output_surface_->context_provider(), shared_bitmap_manager_, 2314 output_surface_->context_provider(), shared_bitmap_manager_,
2313 gpu_memory_buffer_manager_, 2315 gpu_memory_buffer_manager_,
2314 task_runner_provider_->blocking_main_thread_task_runner(), 2316 task_runner_provider_->blocking_main_thread_task_runner(),
2315 settings_.renderer_settings.highp_threshold_min, 2317 settings_.renderer_settings.highp_threshold_min,
2316 settings_.renderer_settings.texture_id_allocation_chunk_size, 2318 settings_.renderer_settings.texture_id_allocation_chunk_size,
2317 output_surface_->capabilities().delegated_sync_points_required, 2319 output_surface_->capabilities().delegated_sync_points_required,
2318 settings_.renderer_settings.use_gpu_memory_buffer_resources, 2320 settings_.renderer_settings.use_gpu_memory_buffer_resources,
2319 settings_.renderer_settings.buffer_to_texture_target_map); 2321 settings_.renderer_settings.buffer_to_texture_target_map);
(...skipping 1857 matching lines...) Expand 10 before | Expand all | Expand 10 after
4177 if (is_visible) { 4179 if (is_visible) {
4178 worker_context_visibility_ = 4180 worker_context_visibility_ =
4179 worker_context->CacheController()->ClientBecameVisible(); 4181 worker_context->CacheController()->ClientBecameVisible();
4180 } else { 4182 } else {
4181 worker_context->CacheController()->ClientBecameNotVisible( 4183 worker_context->CacheController()->ClientBecameNotVisible(
4182 std::move(worker_context_visibility_)); 4184 std::move(worker_context_visibility_));
4183 } 4185 }
4184 } 4186 }
4185 4187
4186 } // namespace cc 4188 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_impl.h ('k') | cc/trees/layer_tree_host_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698