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

Unified Diff: cc/trees/layer_tree_host_impl.cc

Issue 290573007: cc: Move gpu rasterization flag from tree-impl to tree-host-impl. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: updated unittests 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
Index: cc/trees/layer_tree_host_impl.cc
diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc
index f394d52494ea5750809c128277c1f25afb07d363..056472181cf49edaa967520be00680d5fb6fcdaa 100644
--- a/cc/trees/layer_tree_host_impl.cc
+++ b/cc/trees/layer_tree_host_impl.cc
@@ -215,6 +215,7 @@ LayerTreeHostImpl::LayerTreeHostImpl(
int id)
: client_(client),
proxy_(proxy),
+ use_gpu_rasterization_(false),
input_handler_client_(NULL),
did_lock_scrolling_layer_(false),
should_bubble_scrolls_(false),
@@ -1508,6 +1509,19 @@ bool LayerTreeHostImpl::IsContextLost() {
return renderer_ && renderer_->IsContextLost();
}
+void LayerTreeHostImpl::SetUseGpuRasterization(bool use_gpu) {
+ if (use_gpu == use_gpu_rasterization_)
+ return;
+
+ use_gpu_rasterization_ = use_gpu;
+ ReleaseTreeResources();
+
+ // We have released tilings for both active and pending tree.
+ // We would not have any content to draw until the pending tree is activated.
+ // Prevent the active tree from drawing until activation.
+ active_tree_->SetRequiresHighResToDraw();
+}
+
const RendererCapabilitiesImpl&
LayerTreeHostImpl::GetRendererCapabilities() const {
return renderer_->Capabilities();
@@ -1767,13 +1781,10 @@ void LayerTreeHostImpl::SetNeedsRedraw() {
ManagedMemoryPolicy LayerTreeHostImpl::ActualManagedMemoryPolicy() const {
ManagedMemoryPolicy actual = cached_managed_memory_policy_;
- bool any_tree_use_gpu_rasterization =
- (active_tree_ && active_tree_->use_gpu_rasterization()) ||
- (pending_tree_ && pending_tree_->use_gpu_rasterization());
if (debug_state_.rasterize_only_visible_content) {
actual.priority_cutoff_when_visible =
gpu::MemoryAllocation::CUTOFF_ALLOW_REQUIRED_ONLY;
- } else if (any_tree_use_gpu_rasterization) {
+ } else if (use_gpu_rasterization()) {
actual.priority_cutoff_when_visible =
gpu::MemoryAllocation::CUTOFF_ALLOW_NICE_TO_HAVE;
}

Powered by Google App Engine
This is Rietveld 408576698