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 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 pending_tree_ = nullptr; | 299 pending_tree_ = nullptr; |
300 active_tree_ = nullptr; | 300 active_tree_ = nullptr; |
301 | 301 |
302 mutator_host_->ClearMutators(); | 302 mutator_host_->ClearMutators(); |
303 mutator_host_->SetMutatorHostClient(nullptr); | 303 mutator_host_->SetMutatorHostClient(nullptr); |
304 } | 304 } |
305 | 305 |
306 void LayerTreeHostImpl::BeginMainFrameAborted( | 306 void LayerTreeHostImpl::BeginMainFrameAborted( |
307 CommitEarlyOutReason reason, | 307 CommitEarlyOutReason reason, |
308 std::vector<std::unique_ptr<SwapPromise>> swap_promises) { | 308 std::vector<std::unique_ptr<SwapPromise>> swap_promises) { |
| 309 is_main_thread_frame_ = true; |
309 // If the begin frame data was handled, then scroll and scale set was applied | 310 // If the begin frame data was handled, then scroll and scale set was applied |
310 // by the main thread, so the active tree needs to be updated as if these sent | 311 // by the main thread, so the active tree needs to be updated as if these sent |
311 // values were applied and committed. | 312 // values were applied and committed. |
312 if (CommitEarlyOutHandledCommit(reason)) { | 313 if (CommitEarlyOutHandledCommit(reason)) { |
313 active_tree_->ApplySentScrollAndScaleDeltasFromAbortedCommit(); | 314 active_tree_->ApplySentScrollAndScaleDeltasFromAbortedCommit(); |
314 if (pending_tree_) { | 315 if (pending_tree_) { |
315 pending_tree_->AppendSwapPromises(std::move(swap_promises)); | 316 pending_tree_->AppendSwapPromises(std::move(swap_promises)); |
316 } else { | 317 } else { |
317 for (const auto& swap_promise : swap_promises) | 318 for (const auto& swap_promise : swap_promises) |
318 swap_promise->DidNotSwap(SwapPromise::COMMIT_NO_UPDATE); | 319 swap_promise->DidNotSwap(SwapPromise::COMMIT_NO_UPDATE); |
(...skipping 12 matching lines...) Expand all Loading... |
331 // between BeginCommit / Swap. See crbug.com/489515. | 332 // between BeginCommit / Swap. See crbug.com/489515. |
332 if (compositor_frame_sink_) | 333 if (compositor_frame_sink_) |
333 compositor_frame_sink_->ForceReclaimResources(); | 334 compositor_frame_sink_->ForceReclaimResources(); |
334 | 335 |
335 if (!CommitToActiveTree()) | 336 if (!CommitToActiveTree()) |
336 CreatePendingTree(); | 337 CreatePendingTree(); |
337 } | 338 } |
338 | 339 |
339 void LayerTreeHostImpl::CommitComplete() { | 340 void LayerTreeHostImpl::CommitComplete() { |
340 TRACE_EVENT0("cc", "LayerTreeHostImpl::CommitComplete"); | 341 TRACE_EVENT0("cc", "LayerTreeHostImpl::CommitComplete"); |
| 342 is_main_thread_frame_ = true; |
341 | 343 |
342 UpdateSyncTreeAfterCommitOrImplSideInvalidation(); | 344 UpdateSyncTreeAfterCommitOrImplSideInvalidation(); |
343 micro_benchmark_controller_.DidCompleteCommit(); | 345 micro_benchmark_controller_.DidCompleteCommit(); |
344 } | 346 } |
345 | 347 |
346 void LayerTreeHostImpl::UpdateSyncTreeAfterCommitOrImplSideInvalidation() { | 348 void LayerTreeHostImpl::UpdateSyncTreeAfterCommitOrImplSideInvalidation() { |
347 sync_tree()->InvalidateRegionForImages( | 349 sync_tree()->InvalidateRegionForImages( |
348 tile_manager_.TakeImagesToInvalidateOnSyncTree()); | 350 tile_manager_.TakeImagesToInvalidateOnSyncTree()); |
349 | 351 |
350 if (CommitToActiveTree()) { | 352 if (CommitToActiveTree()) { |
(...skipping 1223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1574 SetFullViewportDamage(); | 1576 SetFullViewportDamage(); |
1575 } | 1577 } |
1576 } | 1578 } |
1577 | 1579 |
1578 void LayerTreeHostImpl::OnCanDrawStateChangedForTree() { | 1580 void LayerTreeHostImpl::OnCanDrawStateChangedForTree() { |
1579 client_->OnCanDrawStateChanged(CanDraw()); | 1581 client_->OnCanDrawStateChanged(CanDraw()); |
1580 } | 1582 } |
1581 | 1583 |
1582 CompositorFrameMetadata LayerTreeHostImpl::MakeCompositorFrameMetadata() const { | 1584 CompositorFrameMetadata LayerTreeHostImpl::MakeCompositorFrameMetadata() const { |
1583 CompositorFrameMetadata metadata; | 1585 CompositorFrameMetadata metadata; |
| 1586 metadata.is_main_thread_frame = is_main_thread_frame_; |
1584 metadata.device_scale_factor = active_tree_->painted_device_scale_factor() * | 1587 metadata.device_scale_factor = active_tree_->painted_device_scale_factor() * |
1585 active_tree_->device_scale_factor(); | 1588 active_tree_->device_scale_factor(); |
1586 | 1589 |
1587 metadata.page_scale_factor = active_tree_->current_page_scale_factor(); | 1590 metadata.page_scale_factor = active_tree_->current_page_scale_factor(); |
1588 metadata.scrollable_viewport_size = active_tree_->ScrollableViewportSize(); | 1591 metadata.scrollable_viewport_size = active_tree_->ScrollableViewportSize(); |
1589 metadata.root_layer_size = active_tree_->ScrollableSize(); | 1592 metadata.root_layer_size = active_tree_->ScrollableSize(); |
1590 metadata.min_page_scale_factor = active_tree_->min_page_scale_factor(); | 1593 metadata.min_page_scale_factor = active_tree_->min_page_scale_factor(); |
1591 metadata.max_page_scale_factor = active_tree_->max_page_scale_factor(); | 1594 metadata.max_page_scale_factor = active_tree_->max_page_scale_factor(); |
1592 metadata.top_controls_height = | 1595 metadata.top_controls_height = |
1593 browser_controls_offset_manager_->TopControlsHeight(); | 1596 browser_controls_offset_manager_->TopControlsHeight(); |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1753 auto* surface = (*frame->render_surface_layer_list)[i]->GetRenderSurface(); | 1756 auto* surface = (*frame->render_surface_layer_list)[i]->GetRenderSurface(); |
1754 surface->damage_tracker()->DidDrawDamagedArea(); | 1757 surface->damage_tracker()->DidDrawDamagedArea(); |
1755 } | 1758 } |
1756 active_tree_->ResetAllChangeTracking(); | 1759 active_tree_->ResetAllChangeTracking(); |
1757 | 1760 |
1758 active_tree_->set_has_ever_been_drawn(true); | 1761 active_tree_->set_has_ever_been_drawn(true); |
1759 devtools_instrumentation::DidDrawFrame(id_); | 1762 devtools_instrumentation::DidDrawFrame(id_); |
1760 benchmark_instrumentation::IssueImplThreadRenderingStatsEvent( | 1763 benchmark_instrumentation::IssueImplThreadRenderingStatsEvent( |
1761 rendering_stats_instrumentation_->impl_thread_rendering_stats()); | 1764 rendering_stats_instrumentation_->impl_thread_rendering_stats()); |
1762 rendering_stats_instrumentation_->AccumulateAndClearImplThreadStats(); | 1765 rendering_stats_instrumentation_->AccumulateAndClearImplThreadStats(); |
| 1766 |
| 1767 is_main_thread_frame_ = false; |
1763 return true; | 1768 return true; |
1764 } | 1769 } |
1765 | 1770 |
1766 void LayerTreeHostImpl::DidDrawAllLayers(const FrameData& frame) { | 1771 void LayerTreeHostImpl::DidDrawAllLayers(const FrameData& frame) { |
1767 for (size_t i = 0; i < frame.will_draw_layers.size(); ++i) | 1772 for (size_t i = 0; i < frame.will_draw_layers.size(); ++i) |
1768 frame.will_draw_layers[i]->DidDraw(resource_provider_.get()); | 1773 frame.will_draw_layers[i]->DidDraw(resource_provider_.get()); |
1769 | 1774 |
1770 for (auto* it : video_frame_controllers_) | 1775 for (auto* it : video_frame_controllers_) |
1771 it->DidDrawFrame(); | 1776 it->DidDrawFrame(); |
1772 } | 1777 } |
(...skipping 2504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4277 } | 4282 } |
4278 | 4283 |
4279 void LayerTreeHostImpl::UpdateScrollSourceInfo(bool is_wheel_scroll) { | 4284 void LayerTreeHostImpl::UpdateScrollSourceInfo(bool is_wheel_scroll) { |
4280 if (is_wheel_scroll) | 4285 if (is_wheel_scroll) |
4281 has_scrolled_by_wheel_ = true; | 4286 has_scrolled_by_wheel_ = true; |
4282 else | 4287 else |
4283 has_scrolled_by_touch_ = true; | 4288 has_scrolled_by_touch_ = true; |
4284 } | 4289 } |
4285 | 4290 |
4286 } // namespace cc | 4291 } // namespace cc |
OLD | NEW |