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

Unified Diff: cc/trees/layer_tree_impl.cc

Issue 270823003: cc: Move gpu rasterization flag from LayerImpl to LayerTreeImpl. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/trees/layer_tree_impl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/layer_tree_impl.cc
diff --git a/cc/trees/layer_tree_impl.cc b/cc/trees/layer_tree_impl.cc
index 962ce7de13c18d3ffa4c573380fe097e628203fa..97e9c1754c9a18eb8f9740101b72ad3849675808 100644
--- a/cc/trees/layer_tree_impl.cc
+++ b/cc/trees/layer_tree_impl.cc
@@ -92,6 +92,7 @@ LayerTreeImpl::LayerTreeImpl(LayerTreeHostImpl* layer_tree_host_impl)
min_page_scale_factor_(0),
max_page_scale_factor_(0),
scrolling_layer_id_from_previous_tree_(0),
+ use_gpu_rasterization_(false),
contents_textures_purged_(false),
requires_high_res_to_draw_(false),
viewport_size_invalid_(false),
@@ -110,6 +111,11 @@ LayerTreeImpl::~LayerTreeImpl() {
void LayerTreeImpl::Shutdown() { root_layer_.reset(); }
+void LayerTreeImpl::ReleaseResources() {
+ if (root_layer_)
+ ReleaseResourcesRecursive(root_layer_.get());
+}
+
void LayerTreeImpl::SetRootLayer(scoped_ptr<LayerImpl> layer) {
if (inner_viewport_scroll_layer_)
inner_viewport_scroll_layer_->SetScrollOffsetDelegate(NULL);
@@ -220,6 +226,8 @@ void LayerTreeImpl::PushPropertiesTo(LayerTreeImpl* target_tree) {
target_tree->set_background_color(background_color());
target_tree->set_has_transparent_background(has_transparent_background());
+ target_tree->use_gpu_rasterization_ = use_gpu_rasterization();
+
if (ContentsTexturesPurged())
target_tree->SetContentsTexturesPurged();
else
@@ -437,6 +445,14 @@ void LayerTreeImpl::ClearViewportLayers() {
outer_viewport_scroll_layer_ = NULL;
}
+void LayerTreeImpl::SetUseGpuRasterization(bool use_gpu) {
+ if (use_gpu == use_gpu_rasterization_)
+ return;
+
+ use_gpu_rasterization_ = use_gpu;
+ ReleaseResources();
+}
+
void LayerTreeImpl::UpdateDrawProperties() {
needs_update_draw_properties_ = false;
render_surface_layer_list_.clear();
@@ -995,4 +1011,15 @@ const std::vector<LayerImpl*>& LayerTreeImpl::LayersWithCopyOutputRequest()
return layers_with_copy_output_request_;
}
+void LayerTreeImpl::ReleaseResourcesRecursive(LayerImpl* current) {
+ DCHECK(current);
+ current->ReleaseResources();
+ if (current->mask_layer())
+ ReleaseResourcesRecursive(current->mask_layer());
+ if (current->replica_layer())
+ ReleaseResourcesRecursive(current->replica_layer());
+ for (size_t i = 0; i < current->children().size(); ++i)
+ ReleaseResourcesRecursive(current->children()[i]);
+}
+
} // namespace cc
« no previous file with comments | « cc/trees/layer_tree_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698