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 1724 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1735 | 1735 |
1736 void LayerTreeHostImpl::SetTopControlsLayoutHeight(float height) { | 1736 void LayerTreeHostImpl::SetTopControlsLayoutHeight(float height) { |
1737 if (active_tree_->top_controls_layout_height() == height) | 1737 if (active_tree_->top_controls_layout_height() == height) |
1738 return; | 1738 return; |
1739 | 1739 |
1740 active_tree_->set_top_controls_layout_height(height); | 1740 active_tree_->set_top_controls_layout_height(height); |
1741 UpdateViewportContainerSizes(); | 1741 UpdateViewportContainerSizes(); |
1742 SetFullRootLayerDamage(); | 1742 SetFullRootLayerDamage(); |
1743 } | 1743 } |
1744 | 1744 |
1745 void LayerTreeHostImpl::SynchronouslyInitializeAllTiles() { | |
1746 // Only valid for the single-threaded non-scheduled/synchronous case | |
1747 // using the zero copy raster worker pool. | |
1748 DCHECK(!proxy_->HasImplThread()); | |
1749 DCHECK(!settings_.single_thread_proxy_scheduler); | |
reveman
2014/10/28 03:46:33
nit: can we DCHECK to make sure that settings.sche
enne (OOO)
2014/10/28 16:49:56
We only need the zero copy DCHECK if I follow your
reveman
2014/10/28 18:08:24
hm, this will only initialize some tiles if settin
| |
1750 single_thread_synchronous_task_graph_runner_->RunUntilIdle(); | |
1751 } | |
1752 | |
1745 void LayerTreeHostImpl::DidLoseOutputSurface() { | 1753 void LayerTreeHostImpl::DidLoseOutputSurface() { |
1746 if (resource_provider_) | 1754 if (resource_provider_) |
1747 resource_provider_->DidLoseOutputSurface(); | 1755 resource_provider_->DidLoseOutputSurface(); |
1748 client_->DidLoseOutputSurfaceOnImplThread(); | 1756 client_->DidLoseOutputSurfaceOnImplThread(); |
1749 } | 1757 } |
1750 | 1758 |
1751 bool LayerTreeHostImpl::HaveRootScrollLayer() const { | 1759 bool LayerTreeHostImpl::HaveRootScrollLayer() const { |
1752 return !!InnerViewportScrollLayer(); | 1760 return !!InnerViewportScrollLayer(); |
1753 } | 1761 } |
1754 | 1762 |
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2012 DCHECK(task_runner); | 2020 DCHECK(task_runner); |
2013 | 2021 |
2014 ContextProvider* context_provider = output_surface_->context_provider(); | 2022 ContextProvider* context_provider = output_surface_->context_provider(); |
2015 if (!context_provider) { | 2023 if (!context_provider) { |
2016 resource_pool_ = | 2024 resource_pool_ = |
2017 ResourcePool::Create(resource_provider_.get(), | 2025 ResourcePool::Create(resource_provider_.get(), |
2018 GL_TEXTURE_2D, | 2026 GL_TEXTURE_2D, |
2019 resource_provider_->best_texture_format()); | 2027 resource_provider_->best_texture_format()); |
2020 | 2028 |
2021 raster_worker_pool_ = | 2029 raster_worker_pool_ = |
2022 BitmapRasterWorkerPool::Create(proxy_->ImplThreadTaskRunner(), | 2030 BitmapRasterWorkerPool::Create(task_runner, |
2023 RasterWorkerPool::GetTaskGraphRunner(), | 2031 RasterWorkerPool::GetTaskGraphRunner(), |
2024 resource_provider_.get()); | 2032 resource_provider_.get()); |
2025 } else if (use_gpu_rasterization_) { | 2033 } else if (use_gpu_rasterization_) { |
2026 resource_pool_ = | 2034 resource_pool_ = |
2027 ResourcePool::Create(resource_provider_.get(), | 2035 ResourcePool::Create(resource_provider_.get(), |
2028 GL_TEXTURE_2D, | 2036 GL_TEXTURE_2D, |
2029 resource_provider_->best_texture_format()); | 2037 resource_provider_->best_texture_format()); |
2030 | 2038 |
2031 raster_worker_pool_ = | 2039 raster_worker_pool_ = |
2032 GpuRasterWorkerPool::Create(task_runner, | 2040 GpuRasterWorkerPool::Create(task_runner, |
2033 context_provider, | 2041 context_provider, |
2034 resource_provider_.get(), | 2042 resource_provider_.get(), |
2035 settings_.use_distance_field_text); | 2043 settings_.use_distance_field_text); |
2036 } else if (UseZeroCopyRasterizer()) { | 2044 } else if (UseZeroCopyRasterizer()) { |
2037 resource_pool_ = ResourcePool::Create( | 2045 resource_pool_ = ResourcePool::Create( |
2038 resource_provider_.get(), | 2046 resource_provider_.get(), |
2039 GetMapImageTextureTarget(context_provider->ContextCapabilities()), | 2047 GetMapImageTextureTarget(context_provider->ContextCapabilities()), |
2040 resource_provider_->best_texture_format()); | 2048 resource_provider_->best_texture_format()); |
2041 | 2049 |
2042 raster_worker_pool_ = | 2050 bool synchronous_single_threaded = |
2043 ZeroCopyRasterWorkerPool::Create(proxy_->ImplThreadTaskRunner(), | 2051 !proxy_->HasImplThread() && !settings_.single_thread_proxy_scheduler; |
2044 RasterWorkerPool::GetTaskGraphRunner(), | 2052 |
2045 resource_provider_.get()); | 2053 TaskGraphRunner* task_graph_runner; |
2054 if (synchronous_single_threaded) { | |
2055 DCHECK(!single_thread_synchronous_task_graph_runner_); | |
2056 single_thread_synchronous_task_graph_runner_.reset(new TaskGraphRunner); | |
2057 task_graph_runner = single_thread_synchronous_task_graph_runner_.get(); | |
2058 } else { | |
2059 task_graph_runner = RasterWorkerPool::GetTaskGraphRunner(); | |
2060 } | |
reveman
2014/10/28 03:46:33
I think you can replace all this with:
synchronou
| |
2061 | |
2062 raster_worker_pool_ = ZeroCopyRasterWorkerPool::Create( | |
2063 task_runner, task_graph_runner, resource_provider_.get()); | |
2046 } else if (UseOneCopyRasterizer()) { | 2064 } else if (UseOneCopyRasterizer()) { |
2047 // We need to create a staging resource pool when using copy rasterizer. | 2065 // We need to create a staging resource pool when using copy rasterizer. |
2048 staging_resource_pool_ = ResourcePool::Create( | 2066 staging_resource_pool_ = ResourcePool::Create( |
2049 resource_provider_.get(), | 2067 resource_provider_.get(), |
2050 GetMapImageTextureTarget(context_provider->ContextCapabilities()), | 2068 GetMapImageTextureTarget(context_provider->ContextCapabilities()), |
2051 resource_provider_->best_texture_format()); | 2069 resource_provider_->best_texture_format()); |
2052 resource_pool_ = | 2070 resource_pool_ = |
2053 ResourcePool::Create(resource_provider_.get(), | 2071 ResourcePool::Create(resource_provider_.get(), |
2054 GL_TEXTURE_2D, | 2072 GL_TEXTURE_2D, |
2055 resource_provider_->best_texture_format()); | 2073 resource_provider_->best_texture_format()); |
(...skipping 28 matching lines...) Expand all Loading... | |
2084 | 2102 |
2085 UpdateTileManagerMemoryPolicy(ActualManagedMemoryPolicy()); | 2103 UpdateTileManagerMemoryPolicy(ActualManagedMemoryPolicy()); |
2086 need_to_update_visible_tiles_before_draw_ = false; | 2104 need_to_update_visible_tiles_before_draw_ = false; |
2087 } | 2105 } |
2088 | 2106 |
2089 void LayerTreeHostImpl::DestroyTileManager() { | 2107 void LayerTreeHostImpl::DestroyTileManager() { |
2090 tile_manager_ = nullptr; | 2108 tile_manager_ = nullptr; |
2091 resource_pool_ = nullptr; | 2109 resource_pool_ = nullptr; |
2092 staging_resource_pool_ = nullptr; | 2110 staging_resource_pool_ = nullptr; |
2093 raster_worker_pool_ = nullptr; | 2111 raster_worker_pool_ = nullptr; |
2112 single_thread_synchronous_task_graph_runner_ = nullptr; | |
2094 } | 2113 } |
2095 | 2114 |
2096 bool LayerTreeHostImpl::UsePendingTreeForSync() const { | 2115 bool LayerTreeHostImpl::UsePendingTreeForSync() const { |
2097 // In impl-side painting, synchronize to the pending tree so that it has | 2116 // In impl-side painting, synchronize to the pending tree so that it has |
2098 // time to raster before being displayed. | 2117 // time to raster before being displayed. |
2099 return settings_.impl_side_painting; | 2118 return settings_.impl_side_painting; |
2100 } | 2119 } |
2101 | 2120 |
2102 bool LayerTreeHostImpl::UseZeroCopyRasterizer() const { | 2121 bool LayerTreeHostImpl::UseZeroCopyRasterizer() const { |
2103 return settings_.use_zero_copy && GetRendererCapabilities().using_image; | 2122 return settings_.use_zero_copy && GetRendererCapabilities().using_image; |
(...skipping 1374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3478 } | 3497 } |
3479 | 3498 |
3480 void LayerTreeHostImpl::UnregisterPictureLayerImpl(PictureLayerImpl* layer) { | 3499 void LayerTreeHostImpl::UnregisterPictureLayerImpl(PictureLayerImpl* layer) { |
3481 std::vector<PictureLayerImpl*>::iterator it = | 3500 std::vector<PictureLayerImpl*>::iterator it = |
3482 std::find(picture_layers_.begin(), picture_layers_.end(), layer); | 3501 std::find(picture_layers_.begin(), picture_layers_.end(), layer); |
3483 DCHECK(it != picture_layers_.end()); | 3502 DCHECK(it != picture_layers_.end()); |
3484 picture_layers_.erase(it); | 3503 picture_layers_.erase(it); |
3485 } | 3504 } |
3486 | 3505 |
3487 } // namespace cc | 3506 } // namespace cc |
OLD | NEW |