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 <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 1861 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1872 } | 1872 } |
1873 RecreateTreeResources(); | 1873 RecreateTreeResources(); |
1874 | 1874 |
1875 // We have released tilings for both active and pending tree. | 1875 // We have released tilings for both active and pending tree. |
1876 // We would not have any content to draw until the pending tree is activated. | 1876 // We would not have any content to draw until the pending tree is activated. |
1877 // Prevent the active tree from drawing until activation. | 1877 // Prevent the active tree from drawing until activation. |
1878 // TODO(crbug.com/469175): Replace with RequiresHighResToDraw. | 1878 // TODO(crbug.com/469175): Replace with RequiresHighResToDraw. |
1879 SetRequiresHighResToDraw(); | 1879 SetRequiresHighResToDraw(); |
1880 } | 1880 } |
1881 | 1881 |
1882 const RendererCapabilitiesImpl& LayerTreeHostImpl::GetRendererCapabilities() | |
1883 const { | |
1884 CHECK(renderer_); | |
1885 return renderer_->Capabilities(); | |
1886 } | |
1887 | |
1888 bool LayerTreeHostImpl::SwapBuffers(const LayerTreeHostImpl::FrameData& frame) { | 1882 bool LayerTreeHostImpl::SwapBuffers(const LayerTreeHostImpl::FrameData& frame) { |
1889 ResetRequiresHighResToDraw(); | 1883 ResetRequiresHighResToDraw(); |
1890 if (frame.has_no_damage) { | 1884 if (frame.has_no_damage) { |
1891 active_tree()->BreakSwapPromises(SwapPromise::SWAP_FAILS); | 1885 active_tree()->BreakSwapPromises(SwapPromise::SWAP_FAILS); |
1892 return false; | 1886 return false; |
1893 } | 1887 } |
1894 CompositorFrameMetadata metadata = MakeCompositorFrameMetadata(); | 1888 CompositorFrameMetadata metadata = MakeCompositorFrameMetadata(); |
1895 metadata.may_contain_video = frame.may_contain_video; | 1889 metadata.may_contain_video = frame.may_contain_video; |
1896 active_tree()->FinishSwapPromises(&metadata); | 1890 active_tree()->FinishSwapPromises(&metadata); |
1897 for (auto& latency : metadata.latency_info) { | 1891 for (auto& latency : metadata.latency_info) { |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2194 renderer_ = base::MakeUnique<DelegatingRenderer>(output_surface_, | 2188 renderer_ = base::MakeUnique<DelegatingRenderer>(output_surface_, |
2195 resource_provider_.get()); | 2189 resource_provider_.get()); |
2196 SetFullViewportDamage(); | 2190 SetFullViewportDamage(); |
2197 | 2191 |
2198 // See note in LayerTreeImpl::UpdateDrawProperties. Renderer needs to be | 2192 // See note in LayerTreeImpl::UpdateDrawProperties. Renderer needs to be |
2199 // initialized to get max texture size. Also, after releasing resources, | 2193 // initialized to get max texture size. Also, after releasing resources, |
2200 // trees need another update to generate new ones. | 2194 // trees need another update to generate new ones. |
2201 active_tree_->set_needs_update_draw_properties(); | 2195 active_tree_->set_needs_update_draw_properties(); |
2202 if (pending_tree_) | 2196 if (pending_tree_) |
2203 pending_tree_->set_needs_update_draw_properties(); | 2197 pending_tree_->set_needs_update_draw_properties(); |
2204 client_->UpdateRendererCapabilitiesOnImplThread(); | |
2205 } | 2198 } |
2206 | 2199 |
2207 void LayerTreeHostImpl::CreateTileManagerResources() { | 2200 void LayerTreeHostImpl::CreateTileManagerResources() { |
2208 CreateResourceAndRasterBufferProvider(&raster_buffer_provider_, | 2201 CreateResourceAndRasterBufferProvider(&raster_buffer_provider_, |
2209 &resource_pool_); | 2202 &resource_pool_); |
2210 | 2203 |
2211 if (use_gpu_rasterization_) { | 2204 if (use_gpu_rasterization_) { |
2212 image_decode_controller_ = base::MakeUnique<GpuImageDecodeController>( | 2205 image_decode_controller_ = base::MakeUnique<GpuImageDecodeController>( |
2213 output_surface_->worker_context_provider(), | 2206 output_surface_->worker_context_provider(), |
2214 settings_.renderer_settings.preferred_tile_format, | 2207 settings_.renderer_settings.preferred_tile_format, |
(...skipping 1955 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4170 return task_runner_provider_->HasImplThread(); | 4163 return task_runner_provider_->HasImplThread(); |
4171 } | 4164 } |
4172 | 4165 |
4173 bool LayerTreeHostImpl::CommitToActiveTree() const { | 4166 bool LayerTreeHostImpl::CommitToActiveTree() const { |
4174 // In single threaded mode we skip the pending tree and commit directly to the | 4167 // In single threaded mode we skip the pending tree and commit directly to the |
4175 // active tree. | 4168 // active tree. |
4176 return !task_runner_provider_->HasImplThread(); | 4169 return !task_runner_provider_->HasImplThread(); |
4177 } | 4170 } |
4178 | 4171 |
4179 } // namespace cc | 4172 } // namespace cc |
OLD | NEW |