Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(693)

Side by Side Diff: cc/trees/layer_tree_host_impl.cc

Issue 2128113002: Use a cc::Display for WebView resourceless software draws. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: displaywebview: mojom Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/test/pixel_test.cc ('k') | cc/trees/layer_tree_host_impl_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1577 matching lines...) Expand 10 before | Expand all | Expand 10 after
1588 1588
1589 active_tree_->GetViewportSelection(&metadata.selection); 1589 active_tree_->GetViewportSelection(&metadata.selection);
1590 1590
1591 if (OuterViewportScrollLayer()) { 1591 if (OuterViewportScrollLayer()) {
1592 metadata.root_overflow_x_hidden = 1592 metadata.root_overflow_x_hidden =
1593 !OuterViewportScrollLayer()->user_scrollable_horizontal(); 1593 !OuterViewportScrollLayer()->user_scrollable_horizontal();
1594 metadata.root_overflow_y_hidden = 1594 metadata.root_overflow_y_hidden =
1595 !OuterViewportScrollLayer()->user_scrollable_vertical(); 1595 !OuterViewportScrollLayer()->user_scrollable_vertical();
1596 } 1596 }
1597 1597
1598 if (GetDrawMode() == DRAW_MODE_RESOURCELESS_SOFTWARE) {
1599 metadata.is_resourceless_software_draw_with_scroll_or_animation =
1600 IsActivelyScrolling() || animation_host_->NeedsAnimateLayers();
1601 }
1602
1598 for (LayerImpl* surface_layer : active_tree_->SurfaceLayers()) { 1603 for (LayerImpl* surface_layer : active_tree_->SurfaceLayers()) {
1599 metadata.referenced_surfaces.push_back( 1604 metadata.referenced_surfaces.push_back(
1600 static_cast<SurfaceLayerImpl*>(surface_layer)->surface_id()); 1605 static_cast<SurfaceLayerImpl*>(surface_layer)->surface_id());
1601 } 1606 }
1602 if (!InnerViewportScrollLayer()) 1607 if (!InnerViewportScrollLayer())
1603 return metadata; 1608 return metadata;
1604 1609
1605 metadata.root_overflow_x_hidden |= 1610 metadata.root_overflow_x_hidden |=
1606 !InnerViewportScrollLayer()->user_scrollable_horizontal(); 1611 !InnerViewportScrollLayer()->user_scrollable_horizontal();
1607 metadata.root_overflow_y_hidden |= 1612 metadata.root_overflow_y_hidden |=
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
1662 1667
1663 // Because the contents of the HUD depend on everything else in the frame, the 1668 // Because the contents of the HUD depend on everything else in the frame, the
1664 // contents of its texture are updated as the last thing before the frame is 1669 // contents of its texture are updated as the last thing before the frame is
1665 // drawn. 1670 // drawn.
1666 if (active_tree_->hud_layer()) { 1671 if (active_tree_->hud_layer()) {
1667 TRACE_EVENT0("cc", "DrawLayers.UpdateHudTexture"); 1672 TRACE_EVENT0("cc", "DrawLayers.UpdateHudTexture");
1668 active_tree_->hud_layer()->UpdateHudTexture(draw_mode, 1673 active_tree_->hud_layer()->UpdateHudTexture(draw_mode,
1669 resource_provider_.get()); 1674 resource_provider_.get());
1670 } 1675 }
1671 1676
1672 if (draw_mode == DRAW_MODE_RESOURCELESS_SOFTWARE) { 1677 renderer_->DrawFrame(&frame->render_passes,
1673 bool disable_picture_quad_image_filtering = 1678 active_tree_->device_scale_factor(), gfx::ColorSpace(),
1674 IsActivelyScrolling() || animation_host_->NeedsAnimateLayers(); 1679 DeviceViewport(), DeviceClip());
1675
1676 // We must disable the image hijack canvas when using GPU rasterization but
1677 // performing a resourceless software draw. Otherwise, we will attempt to
1678 // use the GPU ImageDecodeController during software raster.
1679 bool use_image_hijack_canvas = !use_gpu_rasterization_;
1680
1681 std::unique_ptr<SoftwareRenderer> temp_software_renderer =
1682 SoftwareRenderer::Create(this, &settings_.renderer_settings,
1683 output_surface_, nullptr,
1684 use_image_hijack_canvas);
1685 temp_software_renderer->DrawFrame(
1686 &frame->render_passes, active_tree_->device_scale_factor(),
1687 gfx::ColorSpace(), DeviceViewport(), DeviceClip(),
1688 disable_picture_quad_image_filtering);
1689 } else {
1690 renderer_->DrawFrame(&frame->render_passes,
1691 active_tree_->device_scale_factor(), gfx::ColorSpace(),
1692 DeviceViewport(), DeviceClip(), false);
1693 }
1694 // The render passes should be consumed by the renderer. 1680 // The render passes should be consumed by the renderer.
1695 DCHECK(frame->render_passes.empty()); 1681 DCHECK(frame->render_passes.empty());
1696 1682
1697 // The next frame should start by assuming nothing has changed, and changes 1683 // The next frame should start by assuming nothing has changed, and changes
1698 // are noted as they occur. 1684 // are noted as they occur.
1699 // TODO(boliu): If we did a temporary software renderer frame, propogate the 1685 // TODO(boliu): If we did a temporary software renderer frame, propogate the
1700 // damage forward to the next frame. 1686 // damage forward to the next frame.
1701 for (size_t i = 0; i < frame->render_surface_layer_list->size(); i++) { 1687 for (size_t i = 0; i < frame->render_surface_layer_list->size(); i++) {
1702 (*frame->render_surface_layer_list)[i]->render_surface()->damage_tracker()-> 1688 (*frame->render_surface_layer_list)[i]->render_surface()->damage_tracker()->
1703 DidDrawDamagedArea(); 1689 DidDrawDamagedArea();
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after
2140 if (output_surface_->capabilities().delegated_rendering) { 2126 if (output_surface_->capabilities().delegated_rendering) {
2141 renderer_ = 2127 renderer_ =
2142 DelegatingRenderer::Create(this, &settings_.renderer_settings, 2128 DelegatingRenderer::Create(this, &settings_.renderer_settings,
2143 output_surface_, resource_provider_.get()); 2129 output_surface_, resource_provider_.get());
2144 } else if (output_surface_->context_provider()) { 2130 } else if (output_surface_->context_provider()) {
2145 renderer_ = GLRenderer::Create( 2131 renderer_ = GLRenderer::Create(
2146 this, &settings_.renderer_settings, output_surface_, 2132 this, &settings_.renderer_settings, output_surface_,
2147 resource_provider_.get(), texture_mailbox_deleter_.get(), 2133 resource_provider_.get(), texture_mailbox_deleter_.get(),
2148 settings_.renderer_settings.highp_threshold_min); 2134 settings_.renderer_settings.highp_threshold_min);
2149 } else if (output_surface_->software_device()) { 2135 } else if (output_surface_->software_device()) {
2150 renderer_ = SoftwareRenderer::Create( 2136 renderer_ =
2151 this, &settings_.renderer_settings, output_surface_, 2137 SoftwareRenderer::Create(this, &settings_.renderer_settings,
2152 resource_provider_.get(), true /* use_image_hijack_canvas */); 2138 output_surface_, resource_provider_.get());
2153 } 2139 }
2154 DCHECK(renderer_); 2140 DCHECK(renderer_);
2155 2141
2156 renderer_->SetVisible(visible_); 2142 renderer_->SetVisible(visible_);
2157 SetFullRootLayerDamage(); 2143 SetFullRootLayerDamage();
2158 2144
2159 // See note in LayerTreeImpl::UpdateDrawProperties. Renderer needs to be 2145 // See note in LayerTreeImpl::UpdateDrawProperties. Renderer needs to be
2160 // initialized to get max texture size. Also, after releasing resources, 2146 // initialized to get max texture size. Also, after releasing resources,
2161 // trees need another update to generate new ones. 2147 // trees need another update to generate new ones.
2162 active_tree_->set_needs_update_draw_properties(); 2148 active_tree_->set_needs_update_draw_properties();
(...skipping 1873 matching lines...) Expand 10 before | Expand all | Expand 10 after
4036 return task_runner_provider_->HasImplThread(); 4022 return task_runner_provider_->HasImplThread();
4037 } 4023 }
4038 4024
4039 bool LayerTreeHostImpl::CommitToActiveTree() const { 4025 bool LayerTreeHostImpl::CommitToActiveTree() const {
4040 // In single threaded mode we skip the pending tree and commit directly to the 4026 // In single threaded mode we skip the pending tree and commit directly to the
4041 // active tree. 4027 // active tree.
4042 return !task_runner_provider_->HasImplThread(); 4028 return !task_runner_provider_->HasImplThread();
4043 } 4029 }
4044 4030
4045 } // namespace cc 4031 } // namespace cc
OLDNEW
« no previous file with comments | « cc/test/pixel_test.cc ('k') | cc/trees/layer_tree_host_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698