| 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 |
| 1882 bool LayerTreeHostImpl::SwapBuffers(const LayerTreeHostImpl::FrameData& frame) { | 1888 bool LayerTreeHostImpl::SwapBuffers(const LayerTreeHostImpl::FrameData& frame) { |
| 1883 ResetRequiresHighResToDraw(); | 1889 ResetRequiresHighResToDraw(); |
| 1884 if (frame.has_no_damage) { | 1890 if (frame.has_no_damage) { |
| 1885 active_tree()->BreakSwapPromises(SwapPromise::SWAP_FAILS); | 1891 active_tree()->BreakSwapPromises(SwapPromise::SWAP_FAILS); |
| 1886 return false; | 1892 return false; |
| 1887 } | 1893 } |
| 1888 CompositorFrameMetadata metadata = MakeCompositorFrameMetadata(); | 1894 CompositorFrameMetadata metadata = MakeCompositorFrameMetadata(); |
| 1889 metadata.may_contain_video = frame.may_contain_video; | 1895 metadata.may_contain_video = frame.may_contain_video; |
| 1890 active_tree()->FinishSwapPromises(&metadata); | 1896 active_tree()->FinishSwapPromises(&metadata); |
| 1891 for (auto& latency : metadata.latency_info) { | 1897 for (auto& latency : metadata.latency_info) { |
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2188 renderer_ = base::MakeUnique<DelegatingRenderer>(output_surface_, | 2194 renderer_ = base::MakeUnique<DelegatingRenderer>(output_surface_, |
| 2189 resource_provider_.get()); | 2195 resource_provider_.get()); |
| 2190 SetFullViewportDamage(); | 2196 SetFullViewportDamage(); |
| 2191 | 2197 |
| 2192 // See note in LayerTreeImpl::UpdateDrawProperties. Renderer needs to be | 2198 // See note in LayerTreeImpl::UpdateDrawProperties. Renderer needs to be |
| 2193 // initialized to get max texture size. Also, after releasing resources, | 2199 // initialized to get max texture size. Also, after releasing resources, |
| 2194 // trees need another update to generate new ones. | 2200 // trees need another update to generate new ones. |
| 2195 active_tree_->set_needs_update_draw_properties(); | 2201 active_tree_->set_needs_update_draw_properties(); |
| 2196 if (pending_tree_) | 2202 if (pending_tree_) |
| 2197 pending_tree_->set_needs_update_draw_properties(); | 2203 pending_tree_->set_needs_update_draw_properties(); |
| 2204 client_->UpdateRendererCapabilitiesOnImplThread(); |
| 2198 } | 2205 } |
| 2199 | 2206 |
| 2200 void LayerTreeHostImpl::CreateTileManagerResources() { | 2207 void LayerTreeHostImpl::CreateTileManagerResources() { |
| 2201 CreateResourceAndRasterBufferProvider(&raster_buffer_provider_, | 2208 CreateResourceAndRasterBufferProvider(&raster_buffer_provider_, |
| 2202 &resource_pool_); | 2209 &resource_pool_); |
| 2203 | 2210 |
| 2204 if (use_gpu_rasterization_) { | 2211 if (use_gpu_rasterization_) { |
| 2205 image_decode_controller_ = base::MakeUnique<GpuImageDecodeController>( | 2212 image_decode_controller_ = base::MakeUnique<GpuImageDecodeController>( |
| 2206 output_surface_->worker_context_provider(), | 2213 output_surface_->worker_context_provider(), |
| 2207 settings_.renderer_settings.preferred_tile_format, | 2214 settings_.renderer_settings.preferred_tile_format, |
| (...skipping 1944 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4152 return task_runner_provider_->HasImplThread(); | 4159 return task_runner_provider_->HasImplThread(); |
| 4153 } | 4160 } |
| 4154 | 4161 |
| 4155 bool LayerTreeHostImpl::CommitToActiveTree() const { | 4162 bool LayerTreeHostImpl::CommitToActiveTree() const { |
| 4156 // In single threaded mode we skip the pending tree and commit directly to the | 4163 // In single threaded mode we skip the pending tree and commit directly to the |
| 4157 // active tree. | 4164 // active tree. |
| 4158 return !task_runner_provider_->HasImplThread(); | 4165 return !task_runner_provider_->HasImplThread(); |
| 4159 } | 4166 } |
| 4160 | 4167 |
| 4161 } // namespace cc | 4168 } // namespace cc |
| OLD | NEW |