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 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 1571 matching lines...) Loading... |
1582 | 1582 |
1583 void LayerTreeHostImpl::FinishAllRendering() { | 1583 void LayerTreeHostImpl::FinishAllRendering() { |
1584 if (renderer_) | 1584 if (renderer_) |
1585 renderer_->Finish(); | 1585 renderer_->Finish(); |
1586 } | 1586 } |
1587 | 1587 |
1588 void LayerTreeHostImpl::SetUseGpuRasterization(bool use_gpu) { | 1588 void LayerTreeHostImpl::SetUseGpuRasterization(bool use_gpu) { |
1589 if (use_gpu == use_gpu_rasterization_) | 1589 if (use_gpu == use_gpu_rasterization_) |
1590 return; | 1590 return; |
1591 | 1591 |
| 1592 // Note that this must happen first, in case the rest of the calls want to |
| 1593 // query the new state of |use_gpu_rasterization_|. |
1592 use_gpu_rasterization_ = use_gpu; | 1594 use_gpu_rasterization_ = use_gpu; |
| 1595 |
| 1596 // Clean up and replace existing tile manager with another one that uses |
| 1597 // appropriate rasterizer. |
1593 ReleaseTreeResources(); | 1598 ReleaseTreeResources(); |
1594 | |
1595 // Replace existing tile manager with another one that uses appropriate | |
1596 // rasterizer. | |
1597 if (tile_manager_) { | 1599 if (tile_manager_) { |
1598 DestroyTileManager(); | 1600 DestroyTileManager(); |
1599 CreateAndSetTileManager(); | 1601 CreateAndSetTileManager(); |
1600 } | 1602 } |
1601 | 1603 |
1602 // We have released tilings for both active and pending tree. | 1604 // We have released tilings for both active and pending tree. |
1603 // We would not have any content to draw until the pending tree is activated. | 1605 // We would not have any content to draw until the pending tree is activated. |
1604 // Prevent the active tree from drawing until activation. | 1606 // Prevent the active tree from drawing until activation. |
1605 SetRequiresHighResToDraw(); | 1607 SetRequiresHighResToDraw(); |
1606 } | 1608 } |
(...skipping 350 matching lines...) Loading... |
1957 | 1959 |
1958 base::SingleThreadTaskRunner* task_runner = | 1960 base::SingleThreadTaskRunner* task_runner = |
1959 proxy_->HasImplThread() ? proxy_->ImplThreadTaskRunner() | 1961 proxy_->HasImplThread() ? proxy_->ImplThreadTaskRunner() |
1960 : proxy_->MainThreadTaskRunner(); | 1962 : proxy_->MainThreadTaskRunner(); |
1961 DCHECK(task_runner); | 1963 DCHECK(task_runner); |
1962 size_t scheduled_raster_task_limit = | 1964 size_t scheduled_raster_task_limit = |
1963 IsSynchronousSingleThreaded() ? std::numeric_limits<size_t>::max() | 1965 IsSynchronousSingleThreaded() ? std::numeric_limits<size_t>::max() |
1964 : settings_.scheduled_raster_task_limit; | 1966 : settings_.scheduled_raster_task_limit; |
1965 tile_manager_ = TileManager::Create( | 1967 tile_manager_ = TileManager::Create( |
1966 this, task_runner, resource_pool_.get(), | 1968 this, task_runner, resource_pool_.get(), |
1967 tile_task_worker_pool_->AsTileTaskRunner(), | 1969 tile_task_worker_pool_->AsTileTaskRunner(), scheduled_raster_task_limit); |
1968 rendering_stats_instrumentation_, scheduled_raster_task_limit); | |
1969 | 1970 |
1970 UpdateTileManagerMemoryPolicy(ActualManagedMemoryPolicy()); | 1971 UpdateTileManagerMemoryPolicy(ActualManagedMemoryPolicy()); |
1971 } | 1972 } |
1972 | 1973 |
1973 void LayerTreeHostImpl::CreateResourceAndTileTaskWorkerPool( | 1974 void LayerTreeHostImpl::CreateResourceAndTileTaskWorkerPool( |
1974 scoped_ptr<TileTaskWorkerPool>* tile_task_worker_pool, | 1975 scoped_ptr<TileTaskWorkerPool>* tile_task_worker_pool, |
1975 scoped_ptr<ResourcePool>* resource_pool, | 1976 scoped_ptr<ResourcePool>* resource_pool, |
1976 scoped_ptr<ResourcePool>* staging_resource_pool) { | 1977 scoped_ptr<ResourcePool>* staging_resource_pool) { |
1977 base::SingleThreadTaskRunner* task_runner = | 1978 base::SingleThreadTaskRunner* task_runner = |
1978 proxy_->HasImplThread() ? proxy_->ImplThreadTaskRunner() | 1979 proxy_->HasImplThread() ? proxy_->ImplThreadTaskRunner() |
(...skipping 1501 matching lines...) Loading... |
3480 } | 3481 } |
3481 | 3482 |
3482 void LayerTreeHostImpl::UnregisterPictureLayerImpl(PictureLayerImpl* layer) { | 3483 void LayerTreeHostImpl::UnregisterPictureLayerImpl(PictureLayerImpl* layer) { |
3483 std::vector<PictureLayerImpl*>::iterator it = | 3484 std::vector<PictureLayerImpl*>::iterator it = |
3484 std::find(picture_layers_.begin(), picture_layers_.end(), layer); | 3485 std::find(picture_layers_.begin(), picture_layers_.end(), layer); |
3485 DCHECK(it != picture_layers_.end()); | 3486 DCHECK(it != picture_layers_.end()); |
3486 picture_layers_.erase(it); | 3487 picture_layers_.erase(it); |
3487 } | 3488 } |
3488 | 3489 |
3489 } // namespace cc | 3490 } // namespace cc |
OLD | NEW |