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 1448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1459 if (pending_tree_) | 1459 if (pending_tree_) |
1460 pending_tree_->set_needs_update_draw_properties(); | 1460 pending_tree_->set_needs_update_draw_properties(); |
1461 | 1461 |
1462 // Compositor, not CompositorFrameSink, is responsible for setting damage | 1462 // Compositor, not CompositorFrameSink, is responsible for setting damage |
1463 // and triggering redraw for constraint changes. | 1463 // and triggering redraw for constraint changes. |
1464 SetFullViewportDamage(); | 1464 SetFullViewportDamage(); |
1465 SetNeedsRedraw(); | 1465 SetNeedsRedraw(); |
1466 } | 1466 } |
1467 } | 1467 } |
1468 | 1468 |
1469 void LayerTreeHostImpl::SetNeedsRedrawRect(const gfx::Rect& damage_rect) { | |
1470 if (damage_rect.IsEmpty()) | |
1471 return; | |
1472 NotifySwapPromiseMonitorsOfSetNeedsRedraw(); | |
1473 client_->SetNeedsRedrawRectOnImplThread(damage_rect); | |
1474 } | |
1475 | |
1476 void LayerTreeHostImpl::DidSwapBuffersComplete() { | 1469 void LayerTreeHostImpl::DidSwapBuffersComplete() { |
1477 client_->DidSwapBuffersCompleteOnImplThread(); | 1470 client_->DidSwapBuffersCompleteOnImplThread(); |
1478 } | 1471 } |
1479 | 1472 |
1480 void LayerTreeHostImpl::DidReceiveTextureInUseResponses( | |
1481 const gpu::TextureInUseResponses& responses) { | |
1482 NOTREACHED(); | |
1483 } | |
1484 | |
1485 void LayerTreeHostImpl::ReclaimResources( | 1473 void LayerTreeHostImpl::ReclaimResources( |
1486 const ReturnedResourceArray& resources) { | 1474 const ReturnedResourceArray& resources) { |
1487 // TODO(piman): We may need to do some validation on this ack before | 1475 // TODO(piman): We may need to do some validation on this ack before |
1488 // processing it. | 1476 // processing it. |
1489 if (resource_provider_) | 1477 if (resource_provider_) |
1490 resource_provider_->ReceiveReturnsFromParent(resources); | 1478 resource_provider_->ReceiveReturnsFromParent(resources); |
1491 | 1479 |
1492 // In OOM, we now might be able to release more resources that were held | 1480 // In OOM, we now might be able to release more resources that were held |
1493 // because they were exported. | 1481 // because they were exported. |
1494 if (resource_pool_) { | 1482 if (resource_pool_) { |
(...skipping 796 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2291 compositor_frame_sink_ = nullptr; | 2279 compositor_frame_sink_ = nullptr; |
2292 | 2280 |
2293 // We don't know if the next CompositorFrameSink will support GPU | 2281 // We don't know if the next CompositorFrameSink will support GPU |
2294 // rasterization. Make sure to clear the flag so that we force a | 2282 // rasterization. Make sure to clear the flag so that we force a |
2295 // re-computation. | 2283 // re-computation. |
2296 use_gpu_rasterization_ = false; | 2284 use_gpu_rasterization_ = false; |
2297 } | 2285 } |
2298 | 2286 |
2299 bool LayerTreeHostImpl::InitializeRenderer( | 2287 bool LayerTreeHostImpl::InitializeRenderer( |
2300 CompositorFrameSink* compositor_frame_sink) { | 2288 CompositorFrameSink* compositor_frame_sink) { |
2301 DCHECK(compositor_frame_sink->capabilities().delegated_rendering); | |
2302 TRACE_EVENT0("cc", "LayerTreeHostImpl::InitializeRenderer"); | 2289 TRACE_EVENT0("cc", "LayerTreeHostImpl::InitializeRenderer"); |
2303 | 2290 |
2304 ReleaseCompositorFrameSink(); | 2291 ReleaseCompositorFrameSink(); |
2305 if (!compositor_frame_sink->BindToClient(this)) { | 2292 if (!compositor_frame_sink->BindToClient(this)) { |
2306 // Avoid recreating tree resources because we might not have enough | 2293 // Avoid recreating tree resources because we might not have enough |
2307 // information to do this yet (eg. we don't have a TileManager at this | 2294 // information to do this yet (eg. we don't have a TileManager at this |
2308 // point). | 2295 // point). |
2309 return false; | 2296 return false; |
2310 } | 2297 } |
2311 | 2298 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2343 // UpdateDrawProperties() after calling RecreateTreeResources(). | 2330 // UpdateDrawProperties() after calling RecreateTreeResources(). |
2344 active_tree_->set_needs_update_draw_properties(); | 2331 active_tree_->set_needs_update_draw_properties(); |
2345 if (pending_tree_) | 2332 if (pending_tree_) |
2346 pending_tree_->set_needs_update_draw_properties(); | 2333 pending_tree_->set_needs_update_draw_properties(); |
2347 | 2334 |
2348 CreateTileManagerResources(); | 2335 CreateTileManagerResources(); |
2349 RecreateTreeResources(); | 2336 RecreateTreeResources(); |
2350 | 2337 |
2351 // TODO(brianderson): Don't use a hard-coded parent draw time. | 2338 // TODO(brianderson): Don't use a hard-coded parent draw time. |
2352 base::TimeDelta parent_draw_time = | 2339 base::TimeDelta parent_draw_time = |
2353 (!settings_.use_external_begin_frame_source && | 2340 compositor_frame_sink_->capabilities().adjust_deadline_for_parent |
2354 compositor_frame_sink_->capabilities().adjust_deadline_for_parent) | |
2355 ? BeginFrameArgs::DefaultEstimatedParentDrawTime() | 2341 ? BeginFrameArgs::DefaultEstimatedParentDrawTime() |
2356 : base::TimeDelta(); | 2342 : base::TimeDelta(); |
2357 client_->SetEstimatedParentDrawTime(parent_draw_time); | 2343 client_->SetEstimatedParentDrawTime(parent_draw_time); |
2358 | |
2359 DCHECK_EQ(1, compositor_frame_sink_->capabilities().max_frames_pending); | |
2360 client_->OnCanDrawStateChanged(CanDraw()); | 2344 client_->OnCanDrawStateChanged(CanDraw()); |
2361 | |
2362 SetFullViewportDamage(); | 2345 SetFullViewportDamage(); |
2363 // There will not be anything to draw here, so set high res | 2346 // There will not be anything to draw here, so set high res |
2364 // to avoid checkerboards, typically when we are recovering | 2347 // to avoid checkerboards, typically when we are recovering |
2365 // from lost context. | 2348 // from lost context. |
2366 // TODO(crbug.com/469175): Replace with RequiresHighResToDraw. | 2349 // TODO(crbug.com/469175): Replace with RequiresHighResToDraw. |
2367 SetRequiresHighResToDraw(); | 2350 SetRequiresHighResToDraw(); |
2368 | 2351 |
2369 return true; | 2352 return true; |
2370 } | 2353 } |
2371 | 2354 |
(...skipping 1829 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4201 if (is_visible) { | 4184 if (is_visible) { |
4202 worker_context_visibility_ = | 4185 worker_context_visibility_ = |
4203 worker_context->CacheController()->ClientBecameVisible(); | 4186 worker_context->CacheController()->ClientBecameVisible(); |
4204 } else { | 4187 } else { |
4205 worker_context->CacheController()->ClientBecameNotVisible( | 4188 worker_context->CacheController()->ClientBecameNotVisible( |
4206 std::move(worker_context_visibility_)); | 4189 std::move(worker_context_visibility_)); |
4207 } | 4190 } |
4208 } | 4191 } |
4209 | 4192 |
4210 } // namespace cc | 4193 } // namespace cc |
OLD | NEW |