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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 #include "cc/input/top_controls_manager.h" | 43 #include "cc/input/top_controls_manager.h" |
44 #include "cc/layers/append_quads_data.h" | 44 #include "cc/layers/append_quads_data.h" |
45 #include "cc/layers/heads_up_display_layer_impl.h" | 45 #include "cc/layers/heads_up_display_layer_impl.h" |
46 #include "cc/layers/layer_impl.h" | 46 #include "cc/layers/layer_impl.h" |
47 #include "cc/layers/layer_iterator.h" | 47 #include "cc/layers/layer_iterator.h" |
48 #include "cc/layers/painted_scrollbar_layer_impl.h" | 48 #include "cc/layers/painted_scrollbar_layer_impl.h" |
49 #include "cc/layers/render_surface_impl.h" | 49 #include "cc/layers/render_surface_impl.h" |
50 #include "cc/layers/scrollbar_layer_impl_base.h" | 50 #include "cc/layers/scrollbar_layer_impl_base.h" |
51 #include "cc/layers/surface_layer_impl.h" | 51 #include "cc/layers/surface_layer_impl.h" |
52 #include "cc/layers/viewport.h" | 52 #include "cc/layers/viewport.h" |
| 53 #include "cc/output/compositor_frame.h" |
53 #include "cc/output/compositor_frame_metadata.h" | 54 #include "cc/output/compositor_frame_metadata.h" |
54 #include "cc/output/copy_output_request.h" | 55 #include "cc/output/copy_output_request.h" |
55 #include "cc/output/delegating_renderer.h" | |
56 #include "cc/output/texture_mailbox_deleter.h" | 56 #include "cc/output/texture_mailbox_deleter.h" |
57 #include "cc/quads/render_pass_draw_quad.h" | 57 #include "cc/quads/render_pass_draw_quad.h" |
58 #include "cc/quads/shared_quad_state.h" | 58 #include "cc/quads/shared_quad_state.h" |
59 #include "cc/quads/solid_color_draw_quad.h" | 59 #include "cc/quads/solid_color_draw_quad.h" |
60 #include "cc/quads/texture_draw_quad.h" | 60 #include "cc/quads/texture_draw_quad.h" |
61 #include "cc/raster/bitmap_raster_buffer_provider.h" | 61 #include "cc/raster/bitmap_raster_buffer_provider.h" |
62 #include "cc/raster/gpu_raster_buffer_provider.h" | 62 #include "cc/raster/gpu_raster_buffer_provider.h" |
63 #include "cc/raster/one_copy_raster_buffer_provider.h" | 63 #include "cc/raster/one_copy_raster_buffer_provider.h" |
64 #include "cc/raster/raster_buffer_provider.h" | 64 #include "cc/raster/raster_buffer_provider.h" |
65 #include "cc/raster/synchronous_task_graph_runner.h" | 65 #include "cc/raster/synchronous_task_graph_runner.h" |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 | 270 |
271 LayerTreeHostImpl::~LayerTreeHostImpl() { | 271 LayerTreeHostImpl::~LayerTreeHostImpl() { |
272 DCHECK(task_runner_provider_->IsImplThread()); | 272 DCHECK(task_runner_provider_->IsImplThread()); |
273 TRACE_EVENT0("cc", "LayerTreeHostImpl::~LayerTreeHostImpl()"); | 273 TRACE_EVENT0("cc", "LayerTreeHostImpl::~LayerTreeHostImpl()"); |
274 TRACE_EVENT_OBJECT_DELETED_WITH_ID(TRACE_DISABLED_BY_DEFAULT("cc.debug"), | 274 TRACE_EVENT_OBJECT_DELETED_WITH_ID(TRACE_DISABLED_BY_DEFAULT("cc.debug"), |
275 "cc::LayerTreeHostImpl", id_); | 275 "cc::LayerTreeHostImpl", id_); |
276 | 276 |
277 // It is released before shutdown. | 277 // It is released before shutdown. |
278 DCHECK(!output_surface_); | 278 DCHECK(!output_surface_); |
279 | 279 |
280 DCHECK(!renderer_); | |
281 DCHECK(!resource_provider_); | 280 DCHECK(!resource_provider_); |
282 DCHECK(!resource_pool_); | 281 DCHECK(!resource_pool_); |
283 DCHECK(!tile_task_manager_); | 282 DCHECK(!tile_task_manager_); |
284 DCHECK(!single_thread_synchronous_task_graph_runner_); | 283 DCHECK(!single_thread_synchronous_task_graph_runner_); |
285 DCHECK(!image_decode_controller_); | 284 DCHECK(!image_decode_controller_); |
286 | 285 |
287 if (input_handler_client_) { | 286 if (input_handler_client_) { |
288 input_handler_client_->WillShutdown(); | 287 input_handler_client_->WillShutdown(); |
289 input_handler_client_ = NULL; | 288 input_handler_client_ = NULL; |
290 } | 289 } |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 | 386 |
388 micro_benchmark_controller_.DidCompleteCommit(); | 387 micro_benchmark_controller_.DidCompleteCommit(); |
389 } | 388 } |
390 | 389 |
391 bool LayerTreeHostImpl::CanDraw() const { | 390 bool LayerTreeHostImpl::CanDraw() const { |
392 // Note: If you are changing this function or any other function that might | 391 // Note: If you are changing this function or any other function that might |
393 // affect the result of CanDraw, make sure to call | 392 // affect the result of CanDraw, make sure to call |
394 // client_->OnCanDrawStateChanged in the proper places and update the | 393 // client_->OnCanDrawStateChanged in the proper places and update the |
395 // NotifyIfCanDrawChanged test. | 394 // NotifyIfCanDrawChanged test. |
396 | 395 |
397 if (!renderer_) { | 396 if (!output_surface_) { |
398 TRACE_EVENT_INSTANT0("cc", "LayerTreeHostImpl::CanDraw no renderer", | 397 TRACE_EVENT_INSTANT0("cc", "LayerTreeHostImpl::CanDraw no output surface", |
399 TRACE_EVENT_SCOPE_THREAD); | 398 TRACE_EVENT_SCOPE_THREAD); |
400 return false; | 399 return false; |
401 } | 400 } |
402 | 401 |
403 // Must have an OutputSurface if |renderer_| is not NULL. | |
404 DCHECK(output_surface_); | |
405 | |
406 // TODO(boliu): Make draws without layers work and move this below | 402 // TODO(boliu): Make draws without layers work and move this below |
407 // |resourceless_software_draw_| check. Tracked in crbug.com/264967. | 403 // |resourceless_software_draw_| check. Tracked in crbug.com/264967. |
408 if (active_tree_->LayerListIsEmpty()) { | 404 if (active_tree_->LayerListIsEmpty()) { |
409 TRACE_EVENT_INSTANT0("cc", "LayerTreeHostImpl::CanDraw no root layer", | 405 TRACE_EVENT_INSTANT0("cc", "LayerTreeHostImpl::CanDraw no root layer", |
410 TRACE_EVENT_SCOPE_THREAD); | 406 TRACE_EVENT_SCOPE_THREAD); |
411 return false; | 407 return false; |
412 } | 408 } |
413 | 409 |
414 if (resourceless_software_draw_) | 410 if (resourceless_software_draw_) |
415 return true; | 411 return true; |
(...skipping 960 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1376 | 1372 |
1377 // Check for a non-null active tree to avoid doing this during shutdown. | 1373 // Check for a non-null active tree to avoid doing this during shutdown. |
1378 if (active_tree_ && !client_->IsInsideDraw() && tile->required_for_draw()) { | 1374 if (active_tree_ && !client_->IsInsideDraw() && tile->required_for_draw()) { |
1379 // The LayerImpl::NotifyTileStateChanged() should damage the layer, so this | 1375 // The LayerImpl::NotifyTileStateChanged() should damage the layer, so this |
1380 // redraw will make those tiles be displayed. | 1376 // redraw will make those tiles be displayed. |
1381 SetNeedsRedraw(); | 1377 SetNeedsRedraw(); |
1382 } | 1378 } |
1383 } | 1379 } |
1384 | 1380 |
1385 void LayerTreeHostImpl::SetMemoryPolicy(const ManagedMemoryPolicy& policy) { | 1381 void LayerTreeHostImpl::SetMemoryPolicy(const ManagedMemoryPolicy& policy) { |
| 1382 DCHECK(task_runner_provider_->IsImplThread()); |
| 1383 |
1386 SetManagedMemoryPolicy(policy); | 1384 SetManagedMemoryPolicy(policy); |
1387 | 1385 |
1388 // This is short term solution to synchronously drop tile resources when | 1386 // This is short term solution to synchronously drop tile resources when |
1389 // using synchronous compositing to avoid memory usage regression. | 1387 // using synchronous compositing to avoid memory usage regression. |
1390 // TODO(boliu): crbug.com/499004 to track removing this. | 1388 // TODO(boliu): crbug.com/499004 to track removing this. |
1391 if (!policy.bytes_limit_when_visible && resource_pool_ && | 1389 if (!policy.bytes_limit_when_visible && resource_pool_ && |
1392 settings_.using_synchronous_renderer_compositor) { | 1390 settings_.using_synchronous_renderer_compositor) { |
1393 ReleaseTreeResources(); | 1391 ReleaseTreeResources(); |
1394 CleanUpTileManagerAndUIResources(); | 1392 CleanUpTileManagerAndUIResources(); |
1395 | 1393 |
(...skipping 12 matching lines...) Expand all Loading... |
1408 DCHECK(task_runner_provider_->IsImplThread()); | 1406 DCHECK(task_runner_provider_->IsImplThread()); |
1409 tree_activation_callback_ = callback; | 1407 tree_activation_callback_ = callback; |
1410 } | 1408 } |
1411 | 1409 |
1412 void LayerTreeHostImpl::SetManagedMemoryPolicy( | 1410 void LayerTreeHostImpl::SetManagedMemoryPolicy( |
1413 const ManagedMemoryPolicy& policy) { | 1411 const ManagedMemoryPolicy& policy) { |
1414 if (cached_managed_memory_policy_ == policy) | 1412 if (cached_managed_memory_policy_ == policy) |
1415 return; | 1413 return; |
1416 | 1414 |
1417 ManagedMemoryPolicy old_policy = ActualManagedMemoryPolicy(); | 1415 ManagedMemoryPolicy old_policy = ActualManagedMemoryPolicy(); |
1418 | |
1419 cached_managed_memory_policy_ = policy; | 1416 cached_managed_memory_policy_ = policy; |
1420 ManagedMemoryPolicy actual_policy = ActualManagedMemoryPolicy(); | 1417 ManagedMemoryPolicy actual_policy = ActualManagedMemoryPolicy(); |
1421 | 1418 |
1422 if (old_policy == actual_policy) | 1419 if (old_policy == actual_policy) |
1423 return; | 1420 return; |
1424 | 1421 |
1425 if (!task_runner_provider_->HasImplThread()) { | 1422 UpdateTileManagerMemoryPolicy(actual_policy); |
1426 // In single-thread mode, this can be called on the main thread by | |
1427 // GLRenderer::OnMemoryAllocationChanged. | |
1428 DebugScopedSetImplThread impl_thread(task_runner_provider_); | |
1429 UpdateTileManagerMemoryPolicy(actual_policy); | |
1430 } else { | |
1431 DCHECK(task_runner_provider_->IsImplThread()); | |
1432 UpdateTileManagerMemoryPolicy(actual_policy); | |
1433 } | |
1434 | 1423 |
1435 // If there is already enough memory to draw everything imaginable and the | 1424 // If there is already enough memory to draw everything imaginable and the |
1436 // new memory limit does not change this, then do not re-commit. Don't bother | 1425 // new memory limit does not change this, then do not re-commit. Don't bother |
1437 // skipping commits if this is not visible (commits don't happen when not | 1426 // skipping commits if this is not visible (commits don't happen when not |
1438 // visible, there will almost always be a commit when this becomes visible). | 1427 // visible, there will almost always be a commit when this becomes visible). |
1439 bool needs_commit = true; | 1428 bool needs_commit = true; |
1440 if (visible() && | 1429 if (visible() && |
1441 actual_policy.bytes_limit_when_visible >= max_memory_needed_bytes_ && | 1430 actual_policy.bytes_limit_when_visible >= max_memory_needed_bytes_ && |
1442 old_policy.bytes_limit_when_visible >= max_memory_needed_bytes_ && | 1431 old_policy.bytes_limit_when_visible >= max_memory_needed_bytes_ && |
1443 actual_policy.priority_cutoff_when_visible == | 1432 actual_policy.priority_cutoff_when_visible == |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1691 "step", "SwapBuffers"); | 1680 "step", "SwapBuffers"); |
1692 // Only add the latency component once for renderer swap, not the browser | 1681 // Only add the latency component once for renderer swap, not the browser |
1693 // swap. | 1682 // swap. |
1694 if (!latency.FindLatency(ui::INPUT_EVENT_LATENCY_RENDERER_SWAP_COMPONENT, 0, | 1683 if (!latency.FindLatency(ui::INPUT_EVENT_LATENCY_RENDERER_SWAP_COMPONENT, 0, |
1695 nullptr)) { | 1684 nullptr)) { |
1696 latency.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_RENDERER_SWAP_COMPONENT, | 1685 latency.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_RENDERER_SWAP_COMPONENT, |
1697 0, 0); | 1686 0, 0); |
1698 } | 1687 } |
1699 } | 1688 } |
1700 | 1689 |
1701 renderer_->DrawFrame(std::move(metadata), std::move(frame->render_passes)); | 1690 // Collect all resource ids in the render passes into a single array. |
| 1691 ResourceProvider::ResourceIdArray resources; |
| 1692 for (const auto& render_pass : frame->render_passes) { |
| 1693 for (auto* quad : render_pass->quad_list) { |
| 1694 for (ResourceId resource_id : quad->resources) |
| 1695 resources.push_back(resource_id); |
| 1696 } |
| 1697 } |
| 1698 |
| 1699 auto data = base::MakeUnique<DelegatedFrameData>(); |
| 1700 resource_provider_->PrepareSendToParent(resources, &data->resource_list); |
| 1701 data->render_pass_list = std::move(frame->render_passes); |
| 1702 |
| 1703 CompositorFrame compositor_frame; |
| 1704 compositor_frame.metadata = std::move(metadata); |
| 1705 compositor_frame.delegated_frame_data = std::move(data); |
| 1706 output_surface_->SwapBuffers(std::move(compositor_frame)); |
1702 | 1707 |
1703 // The next frame should start by assuming nothing has changed, and changes | 1708 // The next frame should start by assuming nothing has changed, and changes |
1704 // are noted as they occur. | 1709 // are noted as they occur. |
1705 // TODO(boliu): If we did a temporary software renderer frame, propogate the | 1710 // TODO(boliu): If we did a temporary software renderer frame, propogate the |
1706 // damage forward to the next frame. | 1711 // damage forward to the next frame. |
1707 for (size_t i = 0; i < frame->render_surface_layer_list->size(); i++) { | 1712 for (size_t i = 0; i < frame->render_surface_layer_list->size(); i++) { |
1708 auto* surface = (*frame->render_surface_layer_list)[i]->render_surface(); | 1713 auto* surface = (*frame->render_surface_layer_list)[i]->render_surface(); |
1709 surface->damage_tracker()->DidDrawDamagedArea(); | 1714 surface->damage_tracker()->DidDrawDamagedArea(); |
1710 } | 1715 } |
1711 active_tree_->ResetAllChangeTracking(); | 1716 active_tree_->ResetAllChangeTracking(); |
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2118 } | 2123 } |
2119 | 2124 |
2120 void LayerTreeHostImpl::RecreateTreeResources() { | 2125 void LayerTreeHostImpl::RecreateTreeResources() { |
2121 active_tree_->RecreateResources(); | 2126 active_tree_->RecreateResources(); |
2122 if (pending_tree_) | 2127 if (pending_tree_) |
2123 pending_tree_->RecreateResources(); | 2128 pending_tree_->RecreateResources(); |
2124 if (recycle_tree_) | 2129 if (recycle_tree_) |
2125 recycle_tree_->RecreateResources(); | 2130 recycle_tree_->RecreateResources(); |
2126 } | 2131 } |
2127 | 2132 |
2128 void LayerTreeHostImpl::CreateAndSetRenderer() { | |
2129 DCHECK(!renderer_); | |
2130 DCHECK(output_surface_); | |
2131 DCHECK(resource_provider_); | |
2132 | |
2133 DCHECK(output_surface_->capabilities().delegated_rendering); | |
2134 renderer_ = base::MakeUnique<DelegatingRenderer>(output_surface_, | |
2135 resource_provider_.get()); | |
2136 SetFullViewportDamage(); | |
2137 | |
2138 // See note in LayerTreeImpl::UpdateDrawProperties. Renderer needs to be | |
2139 // initialized to get max texture size. Also, after releasing resources, | |
2140 // trees need another update to generate new ones. | |
2141 active_tree_->set_needs_update_draw_properties(); | |
2142 if (pending_tree_) | |
2143 pending_tree_->set_needs_update_draw_properties(); | |
2144 } | |
2145 | |
2146 void LayerTreeHostImpl::CreateTileManagerResources() { | 2133 void LayerTreeHostImpl::CreateTileManagerResources() { |
2147 CreateResourceAndRasterBufferProvider(&raster_buffer_provider_, | 2134 CreateResourceAndRasterBufferProvider(&raster_buffer_provider_, |
2148 &resource_pool_); | 2135 &resource_pool_); |
2149 | 2136 |
2150 if (use_gpu_rasterization_) { | 2137 if (use_gpu_rasterization_) { |
2151 image_decode_controller_ = base::MakeUnique<GpuImageDecodeController>( | 2138 image_decode_controller_ = base::MakeUnique<GpuImageDecodeController>( |
2152 output_surface_->worker_context_provider(), | 2139 output_surface_->worker_context_provider(), |
2153 settings_.renderer_settings.preferred_tile_format, | 2140 settings_.renderer_settings.preferred_tile_format, |
2154 settings_.gpu_decoded_image_budget_bytes); | 2141 settings_.gpu_decoded_image_budget_bytes); |
2155 } else { | 2142 } else { |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2280 TRACE_EVENT0("cc", "LayerTreeHostImpl::ReleaseOutputSurface"); | 2267 TRACE_EVENT0("cc", "LayerTreeHostImpl::ReleaseOutputSurface"); |
2281 | 2268 |
2282 if (!output_surface_) | 2269 if (!output_surface_) |
2283 return; | 2270 return; |
2284 | 2271 |
2285 // Since we will create a new resource provider, we cannot continue to use | 2272 // Since we will create a new resource provider, we cannot continue to use |
2286 // the old resources (i.e. render_surfaces and texture IDs). Clear them | 2273 // the old resources (i.e. render_surfaces and texture IDs). Clear them |
2287 // before we destroy the old resource provider. | 2274 // before we destroy the old resource provider. |
2288 ReleaseTreeResources(); | 2275 ReleaseTreeResources(); |
2289 | 2276 |
2290 // Note: order is important here. | 2277 // Note: ui resource cleanup uses the |resource_provider_|. |
2291 renderer_ = nullptr; | |
2292 CleanUpTileManagerAndUIResources(); | 2278 CleanUpTileManagerAndUIResources(); |
2293 resource_provider_ = nullptr; | 2279 resource_provider_ = nullptr; |
2294 | 2280 |
2295 // Release any context visibility before we destroy the OutputSurface. | 2281 // Release any context visibility before we destroy the OutputSurface. |
2296 if (visible_) | 2282 if (visible_) |
2297 SetCompositorContextVisibility(false); | 2283 SetCompositorContextVisibility(false); |
2298 // Worker context visibility is based on both LTHI visibility as well as | 2284 // Worker context visibility is based on both LTHI visibility as well as |
2299 // memory policy, so we directly check |worker_context_visibility_| here, | 2285 // memory policy, so we directly check |worker_context_visibility_| here, |
2300 // rather than just relying on |visibility_|. | 2286 // rather than just relying on |visibility_|. |
2301 if (worker_context_visibility_) | 2287 if (worker_context_visibility_) |
2302 SetWorkerContextVisibility(false); | 2288 SetWorkerContextVisibility(false); |
2303 | 2289 |
2304 // Detach from the old output surface and reset |output_surface_| pointer | 2290 // Detach from the old output surface and reset |output_surface_| pointer |
2305 // as this surface is going to be destroyed independent of if binding the | 2291 // as this surface is going to be destroyed independent of if binding the |
2306 // new output surface succeeds or not. | 2292 // new output surface succeeds or not. |
2307 output_surface_->DetachFromClient(); | 2293 output_surface_->DetachFromClient(); |
2308 output_surface_ = nullptr; | 2294 output_surface_ = nullptr; |
2309 | 2295 |
2310 // We don't know if the next OutputSurface will support GPU rasterization. | 2296 // We don't know if the next OutputSurface will support GPU rasterization. |
2311 // Make sure to clear the flag so that we force a re-computation. | 2297 // Make sure to clear the flag so that we force a re-computation. |
2312 use_gpu_rasterization_ = false; | 2298 use_gpu_rasterization_ = false; |
2313 } | 2299 } |
2314 | 2300 |
2315 bool LayerTreeHostImpl::InitializeRenderer(OutputSurface* output_surface) { | 2301 bool LayerTreeHostImpl::InitializeRenderer(OutputSurface* output_surface) { |
| 2302 DCHECK(output_surface->capabilities().delegated_rendering); |
2316 TRACE_EVENT0("cc", "LayerTreeHostImpl::InitializeRenderer"); | 2303 TRACE_EVENT0("cc", "LayerTreeHostImpl::InitializeRenderer"); |
2317 | 2304 |
2318 ReleaseOutputSurface(); | 2305 ReleaseOutputSurface(); |
2319 if (!output_surface->BindToClient(this)) { | 2306 if (!output_surface->BindToClient(this)) { |
2320 // Avoid recreating tree resources because we might not have enough | 2307 // Avoid recreating tree resources because we might not have enough |
2321 // information to do this yet (eg. we don't have a TileManager at this | 2308 // information to do this yet (eg. we don't have a TileManager at this |
2322 // point). | 2309 // point). |
2323 return false; | 2310 return false; |
2324 } | 2311 } |
2325 | 2312 |
(...skipping 12 matching lines...) Expand all Loading... |
2338 // visibility will be set via the memory policy update in | 2325 // visibility will be set via the memory policy update in |
2339 // CreateTileManagerResources below. | 2326 // CreateTileManagerResources below. |
2340 if (visible_) | 2327 if (visible_) |
2341 SetCompositorContextVisibility(true); | 2328 SetCompositorContextVisibility(true); |
2342 | 2329 |
2343 // Since the new context may be capable of MSAA, update status here. We don't | 2330 // Since the new context may be capable of MSAA, update status here. We don't |
2344 // need to check the return value since we are recreating all resources | 2331 // need to check the return value since we are recreating all resources |
2345 // already. | 2332 // already. |
2346 UpdateGpuRasterizationStatus(); | 2333 UpdateGpuRasterizationStatus(); |
2347 | 2334 |
2348 CreateAndSetRenderer(); | 2335 // See note in LayerTreeImpl::UpdateDrawProperties, new OutputSurface means a |
| 2336 // new max texture size which affects draw properties. Also, if the draw |
| 2337 // properties were up to date, layers still lost resources and we need to |
| 2338 // UpdateDrawProperties() after calling RecreateTreeResources(). |
| 2339 active_tree_->set_needs_update_draw_properties(); |
| 2340 if (pending_tree_) |
| 2341 pending_tree_->set_needs_update_draw_properties(); |
2349 | 2342 |
2350 CreateTileManagerResources(); | 2343 CreateTileManagerResources(); |
2351 RecreateTreeResources(); | 2344 RecreateTreeResources(); |
2352 | 2345 |
2353 // TODO(brianderson): Don't use a hard-coded parent draw time. | 2346 // TODO(brianderson): Don't use a hard-coded parent draw time. |
2354 base::TimeDelta parent_draw_time = | 2347 base::TimeDelta parent_draw_time = |
2355 (!settings_.use_external_begin_frame_source && | 2348 (!settings_.use_external_begin_frame_source && |
2356 output_surface_->capabilities().adjust_deadline_for_parent) | 2349 output_surface_->capabilities().adjust_deadline_for_parent) |
2357 ? BeginFrameArgs::DefaultEstimatedParentDrawTime() | 2350 ? BeginFrameArgs::DefaultEstimatedParentDrawTime() |
2358 : base::TimeDelta(); | 2351 : base::TimeDelta(); |
2359 client_->SetEstimatedParentDrawTime(parent_draw_time); | 2352 client_->SetEstimatedParentDrawTime(parent_draw_time); |
2360 | 2353 |
2361 DCHECK_EQ(1, output_surface_->capabilities().max_frames_pending); | 2354 DCHECK_EQ(1, output_surface_->capabilities().max_frames_pending); |
2362 client_->OnCanDrawStateChanged(CanDraw()); | 2355 client_->OnCanDrawStateChanged(CanDraw()); |
2363 | 2356 |
| 2357 SetFullViewportDamage(); |
2364 // There will not be anything to draw here, so set high res | 2358 // There will not be anything to draw here, so set high res |
2365 // to avoid checkerboards, typically when we are recovering | 2359 // to avoid checkerboards, typically when we are recovering |
2366 // from lost context. | 2360 // from lost context. |
2367 // TODO(crbug.com/469175): Replace with RequiresHighResToDraw. | 2361 // TODO(crbug.com/469175): Replace with RequiresHighResToDraw. |
2368 SetRequiresHighResToDraw(); | 2362 SetRequiresHighResToDraw(); |
2369 | 2363 |
2370 return true; | 2364 return true; |
2371 } | 2365 } |
2372 | 2366 |
2373 void LayerTreeHostImpl::SetBeginFrameSource(BeginFrameSource* source) { | 2367 void LayerTreeHostImpl::SetBeginFrameSource(BeginFrameSource* source) { |
(...skipping 1812 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4186 if (is_visible) { | 4180 if (is_visible) { |
4187 worker_context_visibility_ = | 4181 worker_context_visibility_ = |
4188 worker_context->CacheController()->ClientBecameVisible(); | 4182 worker_context->CacheController()->ClientBecameVisible(); |
4189 } else { | 4183 } else { |
4190 worker_context->CacheController()->ClientBecameNotVisible( | 4184 worker_context->CacheController()->ClientBecameNotVisible( |
4191 std::move(worker_context_visibility_)); | 4185 std::move(worker_context_visibility_)); |
4192 } | 4186 } |
4193 } | 4187 } |
4194 | 4188 |
4195 } // namespace cc | 4189 } // namespace cc |
OLD | NEW |