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

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

Issue 1210073020: Reland (2): cc: Make tile manager object persist for the length of LTHI. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 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') | no next file » | 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 <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <map> 9 #include <map>
10 #include <set> 10 #include <set>
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 scroll_affects_scroll_handler_(false), 213 scroll_affects_scroll_handler_(false),
214 scroll_layer_id_when_mouse_over_scrollbar_(0), 214 scroll_layer_id_when_mouse_over_scrollbar_(0),
215 tile_priorities_dirty_(false), 215 tile_priorities_dirty_(false),
216 root_layer_scroll_offset_delegate_(NULL), 216 root_layer_scroll_offset_delegate_(NULL),
217 settings_(settings), 217 settings_(settings),
218 visible_(true), 218 visible_(true),
219 cached_managed_memory_policy_( 219 cached_managed_memory_policy_(
220 GetDefaultMemoryAllocationLimit(), 220 GetDefaultMemoryAllocationLimit(),
221 gpu::MemoryAllocation::CUTOFF_ALLOW_EVERYTHING, 221 gpu::MemoryAllocation::CUTOFF_ALLOW_EVERYTHING,
222 ManagedMemoryPolicy::kDefaultNumResourcesLimit), 222 ManagedMemoryPolicy::kDefaultNumResourcesLimit),
223 // Must be initialized after settings_ and proxy_.
224 tile_manager_(
225 TileManager::Create(this,
226 GetTaskRunner(),
227 IsSynchronousSingleThreaded()
228 ? std::numeric_limits<size_t>::max()
229 : settings.scheduled_raster_task_limit)),
223 pinch_gesture_active_(false), 230 pinch_gesture_active_(false),
224 pinch_gesture_end_should_clear_scrolling_layer_(false), 231 pinch_gesture_end_should_clear_scrolling_layer_(false),
225 fps_counter_(FrameRateCounter::Create(proxy_->HasImplThread())), 232 fps_counter_(FrameRateCounter::Create(proxy_->HasImplThread())),
226 paint_time_counter_(PaintTimeCounter::Create()), 233 paint_time_counter_(PaintTimeCounter::Create()),
227 memory_history_(MemoryHistory::Create()), 234 memory_history_(MemoryHistory::Create()),
228 debug_rect_history_(DebugRectHistory::Create()), 235 debug_rect_history_(DebugRectHistory::Create()),
229 texture_mailbox_deleter_(new TextureMailboxDeleter(GetTaskRunner())), 236 texture_mailbox_deleter_(new TextureMailboxDeleter(GetTaskRunner())),
230 max_memory_needed_bytes_(0), 237 max_memory_needed_bytes_(0),
231 device_scale_factor_(1.f), 238 device_scale_factor_(1.f),
232 resourceless_software_draw_(false), 239 resourceless_software_draw_(false),
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 active_tree_->Shutdown(); 306 active_tree_->Shutdown();
300 recycle_tree_ = nullptr; 307 recycle_tree_ = nullptr;
301 pending_tree_ = nullptr; 308 pending_tree_ = nullptr;
302 active_tree_ = nullptr; 309 active_tree_ = nullptr;
303 310
304 if (animation_host_) { 311 if (animation_host_) {
305 animation_host_->ClearTimelines(); 312 animation_host_->ClearTimelines();
306 animation_host_->SetMutatorHostClient(nullptr); 313 animation_host_->SetMutatorHostClient(nullptr);
307 } 314 }
308 315
309 DestroyTileManager(); 316 CleanUpTileManager();
310 } 317 }
311 318
312 void LayerTreeHostImpl::BeginMainFrameAborted(CommitEarlyOutReason reason) { 319 void LayerTreeHostImpl::BeginMainFrameAborted(CommitEarlyOutReason reason) {
313 // If the begin frame data was handled, then scroll and scale set was applied 320 // If the begin frame data was handled, then scroll and scale set was applied
314 // by the main thread, so the active tree needs to be updated as if these sent 321 // by the main thread, so the active tree needs to be updated as if these sent
315 // values were applied and committed. 322 // values were applied and committed.
316 if (CommitEarlyOutHandledCommit(reason)) 323 if (CommitEarlyOutHandledCommit(reason))
317 active_tree_->ApplySentScrollAndScaleDeltasFromAbortedCommit(); 324 active_tree_->ApplySentScrollAndScaleDeltasFromAbortedCommit();
318 } 325 }
319 326
(...skipping 21 matching lines...) Expand all
341 UpdateTreeResourcesForGpuRasterizationIfNeeded(); 348 UpdateTreeResourcesForGpuRasterizationIfNeeded();
342 sync_tree()->set_needs_update_draw_properties(); 349 sync_tree()->set_needs_update_draw_properties();
343 350
344 // We need an update immediately post-commit to have the opportunity to create 351 // We need an update immediately post-commit to have the opportunity to create
345 // tilings. Because invalidations may be coming from the main thread, it's 352 // tilings. Because invalidations may be coming from the main thread, it's
346 // safe to do an update for lcd text at this point and see if lcd text needs 353 // safe to do an update for lcd text at this point and see if lcd text needs
347 // to be disabled on any layers. 354 // to be disabled on any layers.
348 bool update_lcd_text = true; 355 bool update_lcd_text = true;
349 sync_tree()->UpdateDrawProperties(update_lcd_text); 356 sync_tree()->UpdateDrawProperties(update_lcd_text);
350 // Start working on newly created tiles immediately if needed. 357 // Start working on newly created tiles immediately if needed.
351 if (tile_manager_ && tile_priorities_dirty_) { 358 // TODO(vmpstr): Investigate always having PrepareTiles issue
352 PrepareTiles(); 359 // NotifyReadyToActivate, instead of handling it here.
353 } else { 360 bool did_prepare_tiles = PrepareTiles();
361 if (!did_prepare_tiles) {
354 NotifyReadyToActivate(); 362 NotifyReadyToActivate();
355 363
356 // Ensure we get ReadyToDraw signal even when PrepareTiles not run. This 364 // Ensure we get ReadyToDraw signal even when PrepareTiles not run. This
357 // is important for SingleThreadProxy and impl-side painting case. For 365 // is important for SingleThreadProxy and impl-side painting case. For
358 // STP, we commit to active tree and RequiresHighResToDraw, and set 366 // STP, we commit to active tree and RequiresHighResToDraw, and set
359 // Scheduler to wait for ReadyToDraw signal to avoid Checkerboard. 367 // Scheduler to wait for ReadyToDraw signal to avoid Checkerboard.
360 if (proxy_->CommitToActiveTree()) 368 if (proxy_->CommitToActiveTree())
361 NotifyReadyToDraw(); 369 NotifyReadyToDraw();
362 } 370 }
363 371
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
419 (CurrentlyScrollingLayer() != InnerViewportScrollLayer() && 427 (CurrentlyScrollingLayer() != InnerViewportScrollLayer() &&
420 CurrentlyScrollingLayer() != OuterViewportScrollLayer())) { 428 CurrentlyScrollingLayer() != OuterViewportScrollLayer())) {
421 AnimateInput(monotonic_time); 429 AnimateInput(monotonic_time);
422 } 430 }
423 AnimatePageScale(monotonic_time); 431 AnimatePageScale(monotonic_time);
424 AnimateLayers(monotonic_time); 432 AnimateLayers(monotonic_time);
425 AnimateScrollbars(monotonic_time); 433 AnimateScrollbars(monotonic_time);
426 AnimateTopControls(monotonic_time); 434 AnimateTopControls(monotonic_time);
427 } 435 }
428 436
429 void LayerTreeHostImpl::PrepareTiles() { 437 bool LayerTreeHostImpl::PrepareTiles() {
430 if (!tile_manager_)
431 return;
432 if (!tile_priorities_dirty_) 438 if (!tile_priorities_dirty_)
433 return; 439 return false;
434 440
435 client_->WillPrepareTiles(); 441 client_->WillPrepareTiles();
436 tile_priorities_dirty_ = false; 442 bool did_prepare_tiles = tile_manager_->PrepareTiles(global_tile_state_);
437 tile_manager_->PrepareTiles(global_tile_state_); 443 if (did_prepare_tiles)
444 tile_priorities_dirty_ = false;
438 client_->DidPrepareTiles(); 445 client_->DidPrepareTiles();
446 return did_prepare_tiles;
439 } 447 }
440 448
441 void LayerTreeHostImpl::StartPageScaleAnimation( 449 void LayerTreeHostImpl::StartPageScaleAnimation(
442 const gfx::Vector2d& target_offset, 450 const gfx::Vector2d& target_offset,
443 bool anchor_point, 451 bool anchor_point,
444 float page_scale, 452 float page_scale,
445 base::TimeDelta duration) { 453 base::TimeDelta duration) {
446 if (!InnerViewportScrollLayer()) 454 if (!InnerViewportScrollLayer())
447 return; 455 return;
448 456
(...skipping 729 matching lines...) Expand 10 before | Expand all | Expand 10 after
1178 recycle_tree_->DetachLayerTree(); 1186 recycle_tree_->DetachLayerTree();
1179 recycle_tree_ = nullptr; 1187 recycle_tree_ = nullptr;
1180 } 1188 }
1181 1189
1182 size_t LayerTreeHostImpl::SourceAnimationFrameNumberForTesting() const { 1190 size_t LayerTreeHostImpl::SourceAnimationFrameNumberForTesting() const {
1183 return fps_counter_->current_frame_number(); 1191 return fps_counter_->current_frame_number();
1184 } 1192 }
1185 1193
1186 void LayerTreeHostImpl::UpdateTileManagerMemoryPolicy( 1194 void LayerTreeHostImpl::UpdateTileManagerMemoryPolicy(
1187 const ManagedMemoryPolicy& policy) { 1195 const ManagedMemoryPolicy& policy) {
1188 if (!tile_manager_) 1196 if (!resource_pool_)
1189 return; 1197 return;
1190 1198
1191 global_tile_state_.hard_memory_limit_in_bytes = 0; 1199 global_tile_state_.hard_memory_limit_in_bytes = 0;
1192 global_tile_state_.soft_memory_limit_in_bytes = 0; 1200 global_tile_state_.soft_memory_limit_in_bytes = 0;
1193 if (visible_ && policy.bytes_limit_when_visible > 0) { 1201 if (visible_ && policy.bytes_limit_when_visible > 0) {
1194 global_tile_state_.hard_memory_limit_in_bytes = 1202 global_tile_state_.hard_memory_limit_in_bytes =
1195 policy.bytes_limit_when_visible; 1203 policy.bytes_limit_when_visible;
1196 global_tile_state_.soft_memory_limit_in_bytes = 1204 global_tile_state_.soft_memory_limit_in_bytes =
1197 (static_cast<int64>(global_tile_state_.hard_memory_limit_in_bytes) * 1205 (static_cast<int64>(global_tile_state_.hard_memory_limit_in_bytes) *
1198 settings_.max_memory_for_prepaint_percentage) / 1206 settings_.max_memory_for_prepaint_percentage) /
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
1330 SetNeedsRedraw(); 1338 SetNeedsRedraw();
1331 } 1339 }
1332 } 1340 }
1333 1341
1334 void LayerTreeHostImpl::SetMemoryPolicy(const ManagedMemoryPolicy& policy) { 1342 void LayerTreeHostImpl::SetMemoryPolicy(const ManagedMemoryPolicy& policy) {
1335 SetManagedMemoryPolicy(policy); 1343 SetManagedMemoryPolicy(policy);
1336 1344
1337 // This is short term solution to synchronously drop tile resources when 1345 // This is short term solution to synchronously drop tile resources when
1338 // using synchronous compositing to avoid memory usage regression. 1346 // using synchronous compositing to avoid memory usage regression.
1339 // TODO(boliu): crbug.com/499004 to track removing this. 1347 // TODO(boliu): crbug.com/499004 to track removing this.
1340 if (!policy.bytes_limit_when_visible && tile_manager_ && 1348 if (!policy.bytes_limit_when_visible && resource_pool_ &&
1341 settings_.using_synchronous_renderer_compositor) { 1349 settings_.using_synchronous_renderer_compositor) {
1342 ReleaseTreeResources(); 1350 ReleaseTreeResources();
1343 // TileManager destruction will synchronoulsy wait for all tile workers to 1351 CleanUpTileManager();
1344 // be cancelled or completed. This allows all resources to be freed 1352 CreateTileManagerResources();
1345 // synchronously.
1346 DestroyTileManager();
1347 CreateAndSetTileManager();
1348 RecreateTreeResources(); 1353 RecreateTreeResources();
1349 } 1354 }
1350 } 1355 }
1351 1356
1352 void LayerTreeHostImpl::SetTreeActivationCallback( 1357 void LayerTreeHostImpl::SetTreeActivationCallback(
1353 const base::Closure& callback) { 1358 const base::Closure& callback) {
1354 DCHECK(proxy_->IsImplThread()); 1359 DCHECK(proxy_->IsImplThread());
1355 tree_activation_callback_ = callback; 1360 tree_activation_callback_ = callback;
1356 } 1361 }
1357 1362
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
1444 } 1449 }
1445 1450
1446 void LayerTreeHostImpl::ReclaimResources(const CompositorFrameAck* ack) { 1451 void LayerTreeHostImpl::ReclaimResources(const CompositorFrameAck* ack) {
1447 // TODO(piman): We may need to do some validation on this ack before 1452 // TODO(piman): We may need to do some validation on this ack before
1448 // processing it. 1453 // processing it.
1449 if (renderer_) 1454 if (renderer_)
1450 renderer_->ReceiveSwapBuffersAck(*ack); 1455 renderer_->ReceiveSwapBuffersAck(*ack);
1451 1456
1452 // In OOM, we now might be able to release more resources that were held 1457 // In OOM, we now might be able to release more resources that were held
1453 // because they were exported. 1458 // because they were exported.
1454 if (tile_manager_) { 1459 if (resource_pool_) {
1455 DCHECK(resource_pool_);
1456
1457 resource_pool_->CheckBusyResources(false); 1460 resource_pool_->CheckBusyResources(false);
1458 resource_pool_->ReduceResourceUsage(); 1461 resource_pool_->ReduceResourceUsage();
1459 } 1462 }
1460 // If we're not visible, we likely released resources, so we want to 1463 // If we're not visible, we likely released resources, so we want to
1461 // aggressively flush here to make sure those DeleteTextures make it to the 1464 // aggressively flush here to make sure those DeleteTextures make it to the
1462 // GPU process to free up the memory. 1465 // GPU process to free up the memory.
1463 if (output_surface_->context_provider() && !visible_) { 1466 if (output_surface_->context_provider() && !visible_) {
1464 output_surface_->context_provider()->ContextGL()->ShallowFlushCHROMIUM(); 1467 output_surface_->context_provider()->ContextGL()->ShallowFlushCHROMIUM();
1465 } 1468 }
1466 } 1469 }
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
1691 use_msaa_ = use_msaa; 1694 use_msaa_ = use_msaa;
1692 1695
1693 tree_resources_for_gpu_rasterization_dirty_ = true; 1696 tree_resources_for_gpu_rasterization_dirty_ = true;
1694 } 1697 }
1695 1698
1696 void LayerTreeHostImpl::UpdateTreeResourcesForGpuRasterizationIfNeeded() { 1699 void LayerTreeHostImpl::UpdateTreeResourcesForGpuRasterizationIfNeeded() {
1697 if (!tree_resources_for_gpu_rasterization_dirty_) 1700 if (!tree_resources_for_gpu_rasterization_dirty_)
1698 return; 1701 return;
1699 1702
1700 // Clean up and replace existing tile manager with another one that uses 1703 // Clean up and replace existing tile manager with another one that uses
1701 // appropriate rasterizer. 1704 // appropriate rasterizer. Only do this however if we already have a
1705 // resource pool, since otherwise we might not be able to create a new
1706 // one.
1702 ReleaseTreeResources(); 1707 ReleaseTreeResources();
1703 if (tile_manager_) { 1708 if (resource_pool_) {
1704 DestroyTileManager(); 1709 CleanUpTileManager();
1705 CreateAndSetTileManager(); 1710 CreateTileManagerResources();
1706 } 1711 }
1707 RecreateTreeResources(); 1712 RecreateTreeResources();
1708 1713
1709 // We have released tilings for both active and pending tree. 1714 // We have released tilings for both active and pending tree.
1710 // We would not have any content to draw until the pending tree is activated. 1715 // We would not have any content to draw until the pending tree is activated.
1711 // Prevent the active tree from drawing until activation. 1716 // Prevent the active tree from drawing until activation.
1712 SetRequiresHighResToDraw(); 1717 SetRequiresHighResToDraw();
1713 1718
1714 tree_resources_for_gpu_rasterization_dirty_ = false; 1719 tree_resources_for_gpu_rasterization_dirty_ = false;
1715 } 1720 }
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
2059 2064
2060 // See note in LayerTreeImpl::UpdateDrawProperties. Renderer needs to be 2065 // See note in LayerTreeImpl::UpdateDrawProperties. Renderer needs to be
2061 // initialized to get max texture size. Also, after releasing resources, 2066 // initialized to get max texture size. Also, after releasing resources,
2062 // trees need another update to generate new ones. 2067 // trees need another update to generate new ones.
2063 active_tree_->set_needs_update_draw_properties(); 2068 active_tree_->set_needs_update_draw_properties();
2064 if (pending_tree_) 2069 if (pending_tree_)
2065 pending_tree_->set_needs_update_draw_properties(); 2070 pending_tree_->set_needs_update_draw_properties();
2066 client_->UpdateRendererCapabilitiesOnImplThread(); 2071 client_->UpdateRendererCapabilitiesOnImplThread();
2067 } 2072 }
2068 2073
2069 void LayerTreeHostImpl::CreateAndSetTileManager() { 2074 void LayerTreeHostImpl::CreateTileManagerResources() {
2070 DCHECK(!tile_manager_);
2071 DCHECK(output_surface_);
2072 DCHECK(resource_provider_);
2073
2074 CreateResourceAndTileTaskWorkerPool(&tile_task_worker_pool_, &resource_pool_, 2075 CreateResourceAndTileTaskWorkerPool(&tile_task_worker_pool_, &resource_pool_,
2075 &staging_resource_pool_); 2076 &staging_resource_pool_);
2076 DCHECK(tile_task_worker_pool_); 2077 tile_manager_->SetResources(
2077 DCHECK(resource_pool_); 2078 resource_pool_.get(), tile_task_worker_pool_->AsTileTaskRunner(),
2078
2079 DCHECK(GetTaskRunner());
2080 size_t scheduled_raster_task_limit =
2081 IsSynchronousSingleThreaded() ? std::numeric_limits<size_t>::max() 2079 IsSynchronousSingleThreaded() ? std::numeric_limits<size_t>::max()
2082 : settings_.scheduled_raster_task_limit; 2080 : settings_.scheduled_raster_task_limit);
2083 tile_manager_ = TileManager::Create(
2084 this, GetTaskRunner(), resource_pool_.get(),
2085 tile_task_worker_pool_->AsTileTaskRunner(), scheduled_raster_task_limit);
2086
2087 UpdateTileManagerMemoryPolicy(ActualManagedMemoryPolicy()); 2081 UpdateTileManagerMemoryPolicy(ActualManagedMemoryPolicy());
2088 } 2082 }
2089 2083
2090 void LayerTreeHostImpl::CreateResourceAndTileTaskWorkerPool( 2084 void LayerTreeHostImpl::CreateResourceAndTileTaskWorkerPool(
2091 scoped_ptr<TileTaskWorkerPool>* tile_task_worker_pool, 2085 scoped_ptr<TileTaskWorkerPool>* tile_task_worker_pool,
2092 scoped_ptr<ResourcePool>* resource_pool, 2086 scoped_ptr<ResourcePool>* resource_pool,
2093 scoped_ptr<ResourcePool>* staging_resource_pool) { 2087 scoped_ptr<ResourcePool>* staging_resource_pool) {
2094 DCHECK(GetTaskRunner()); 2088 DCHECK(GetTaskRunner());
2095 2089
2096 // Pass the single-threaded synchronous task graph runner to the worker pool 2090 // Pass the single-threaded synchronous task graph runner to the worker pool
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
2196 request_ids, start_time, end_time, active_tree_->source_frame_number()); 2190 request_ids, start_time, end_time, active_tree_->source_frame_number());
2197 } 2191 }
2198 2192
2199 void LayerTreeHostImpl::PostFrameTimingEvents( 2193 void LayerTreeHostImpl::PostFrameTimingEvents(
2200 scoped_ptr<FrameTimingTracker::CompositeTimingSet> composite_events, 2194 scoped_ptr<FrameTimingTracker::CompositeTimingSet> composite_events,
2201 scoped_ptr<FrameTimingTracker::MainFrameTimingSet> main_frame_events) { 2195 scoped_ptr<FrameTimingTracker::MainFrameTimingSet> main_frame_events) {
2202 client_->PostFrameTimingEventsOnImplThread(composite_events.Pass(), 2196 client_->PostFrameTimingEventsOnImplThread(composite_events.Pass(),
2203 main_frame_events.Pass()); 2197 main_frame_events.Pass());
2204 } 2198 }
2205 2199
2206 void LayerTreeHostImpl::DestroyTileManager() { 2200 void LayerTreeHostImpl::CleanUpTileManager() {
2207 tile_manager_ = nullptr; 2201 tile_manager_->FinishTasksAndCleanUp();
2208 resource_pool_ = nullptr; 2202 resource_pool_ = nullptr;
2209 staging_resource_pool_ = nullptr; 2203 staging_resource_pool_ = nullptr;
2210 tile_task_worker_pool_ = nullptr; 2204 tile_task_worker_pool_ = nullptr;
2211 single_thread_synchronous_task_graph_runner_ = nullptr; 2205 single_thread_synchronous_task_graph_runner_ = nullptr;
2212 } 2206 }
2213 2207
2214 bool LayerTreeHostImpl::IsSynchronousSingleThreaded() const { 2208 bool LayerTreeHostImpl::IsSynchronousSingleThreaded() const {
2215 return !proxy_->HasImplThread() && !settings_.single_thread_proxy_scheduler; 2209 return !proxy_->HasImplThread() && !settings_.single_thread_proxy_scheduler;
2216 } 2210 }
2217 2211
2218 bool LayerTreeHostImpl::InitializeRenderer( 2212 bool LayerTreeHostImpl::InitializeRenderer(
2219 scoped_ptr<OutputSurface> output_surface) { 2213 scoped_ptr<OutputSurface> output_surface) {
2220 TRACE_EVENT0("cc", "LayerTreeHostImpl::InitializeRenderer"); 2214 TRACE_EVENT0("cc", "LayerTreeHostImpl::InitializeRenderer");
2221 2215
2222 // Since we will create a new resource provider, we cannot continue to use 2216 // Since we will create a new resource provider, we cannot continue to use
2223 // the old resources (i.e. render_surfaces and texture IDs). Clear them 2217 // the old resources (i.e. render_surfaces and texture IDs). Clear them
2224 // before we destroy the old resource provider. 2218 // before we destroy the old resource provider.
2225 ReleaseTreeResources(); 2219 ReleaseTreeResources();
2226 2220
2227 // Note: order is important here. 2221 // Note: order is important here.
2228 renderer_ = nullptr; 2222 renderer_ = nullptr;
2229 DestroyTileManager(); 2223 CleanUpTileManager();
2230 resource_provider_ = nullptr; 2224 resource_provider_ = nullptr;
2231 output_surface_ = nullptr; 2225 output_surface_ = nullptr;
2232 2226
2233 if (!output_surface->BindToClient(this)) { 2227 if (!output_surface->BindToClient(this)) {
2234 // Avoid recreating tree resources because we might not have enough 2228 // Avoid recreating tree resources because we might not have enough
2235 // information to do this yet (eg. we don't have a TileManager at this 2229 // information to do this yet (eg. we don't have a TileManager at this
2236 // point). 2230 // point).
2237 return false; 2231 return false;
2238 } 2232 }
2239 2233
2240 output_surface_ = output_surface.Pass(); 2234 output_surface_ = output_surface.Pass();
2241 resource_provider_ = ResourceProvider::Create( 2235 resource_provider_ = ResourceProvider::Create(
2242 output_surface_.get(), shared_bitmap_manager_, gpu_memory_buffer_manager_, 2236 output_surface_.get(), shared_bitmap_manager_, gpu_memory_buffer_manager_,
2243 proxy_->blocking_main_thread_task_runner(), 2237 proxy_->blocking_main_thread_task_runner(),
2244 settings_.renderer_settings.highp_threshold_min, 2238 settings_.renderer_settings.highp_threshold_min,
2245 settings_.renderer_settings.use_rgba_4444_textures, 2239 settings_.renderer_settings.use_rgba_4444_textures,
2246 settings_.renderer_settings.texture_id_allocation_chunk_size, 2240 settings_.renderer_settings.texture_id_allocation_chunk_size,
2247 settings_.use_persistent_map_for_gpu_memory_buffers); 2241 settings_.use_persistent_map_for_gpu_memory_buffers);
2248 2242
2249 CreateAndSetRenderer(); 2243 CreateAndSetRenderer();
2250 2244
2251 // Since the new renderer may be capable of MSAA, update status here. 2245 // Since the new renderer may be capable of MSAA, update status here.
2252 UpdateGpuRasterizationStatus(); 2246 UpdateGpuRasterizationStatus();
2253 2247
2254 CreateAndSetTileManager(); 2248 CreateTileManagerResources();
2255 RecreateTreeResources(); 2249 RecreateTreeResources();
2256 2250
2257 // Initialize vsync parameters to sane values. 2251 // Initialize vsync parameters to sane values.
2258 const base::TimeDelta display_refresh_interval = 2252 const base::TimeDelta display_refresh_interval =
2259 base::TimeDelta::FromMicroseconds( 2253 base::TimeDelta::FromMicroseconds(
2260 base::Time::kMicrosecondsPerSecond / 2254 base::Time::kMicrosecondsPerSecond /
2261 settings_.renderer_settings.refresh_rate); 2255 settings_.renderer_settings.refresh_rate);
2262 CommitVSyncParameters(base::TimeTicks(), display_refresh_interval); 2256 CommitVSyncParameters(base::TimeTicks(), display_refresh_interval);
2263 2257
2264 // TODO(brianderson): Don't use a hard-coded parent draw time. 2258 // TODO(brianderson): Don't use a hard-coded parent draw time.
(...skipping 1348 matching lines...) Expand 10 before | Expand all | Expand 10 after
3613 if (active_tree()) { 3607 if (active_tree()) {
3614 LayerAnimationValueProvider* layer = active_tree()->LayerById(layer_id); 3608 LayerAnimationValueProvider* layer = active_tree()->LayerById(layer_id);
3615 if (layer) 3609 if (layer)
3616 return layer->ScrollOffsetForAnimation(); 3610 return layer->ScrollOffsetForAnimation();
3617 } 3611 }
3618 3612
3619 return gfx::ScrollOffset(); 3613 return gfx::ScrollOffset();
3620 } 3614 }
3621 3615
3622 } // namespace cc 3616 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698