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

Side by Side 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: 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « cc/trees/layer_tree_host_impl.h ('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 <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 208
209 LayerTreeHostImpl::LayerTreeHostImpl( 209 LayerTreeHostImpl::LayerTreeHostImpl(
210 const LayerTreeSettings& settings, 210 const LayerTreeSettings& settings,
211 LayerTreeHostImplClient* client, 211 LayerTreeHostImplClient* client,
212 Proxy* proxy, 212 Proxy* proxy,
213 RenderingStatsInstrumentation* rendering_stats_instrumentation, 213 RenderingStatsInstrumentation* rendering_stats_instrumentation,
214 SharedBitmapManager* manager, 214 SharedBitmapManager* manager,
215 int id) 215 int id)
216 : client_(client), 216 : client_(client),
217 proxy_(proxy), 217 proxy_(proxy),
218 use_gpu_rasterization_(false),
218 input_handler_client_(NULL), 219 input_handler_client_(NULL),
219 did_lock_scrolling_layer_(false), 220 did_lock_scrolling_layer_(false),
220 should_bubble_scrolls_(false), 221 should_bubble_scrolls_(false),
221 wheel_scrolling_(false), 222 wheel_scrolling_(false),
222 scroll_affects_scroll_handler_(false), 223 scroll_affects_scroll_handler_(false),
223 scroll_layer_id_when_mouse_over_scrollbar_(0), 224 scroll_layer_id_when_mouse_over_scrollbar_(0),
224 tile_priorities_dirty_(false), 225 tile_priorities_dirty_(false),
225 root_layer_scroll_offset_delegate_(NULL), 226 root_layer_scroll_offset_delegate_(NULL),
226 settings_(settings), 227 settings_(settings),
227 visible_(true), 228 visible_(true),
(...skipping 1285 matching lines...) Expand 10 before | Expand all | Expand 10 after
1513 void LayerTreeHostImpl::FinishAllRendering() { 1514 void LayerTreeHostImpl::FinishAllRendering() {
1514 if (renderer_) 1515 if (renderer_)
1515 renderer_->Finish(); 1516 renderer_->Finish();
1516 } 1517 }
1517 1518
1518 bool LayerTreeHostImpl::IsContextLost() { 1519 bool LayerTreeHostImpl::IsContextLost() {
1519 DCHECK(proxy_->IsImplThread()); 1520 DCHECK(proxy_->IsImplThread());
1520 return renderer_ && renderer_->IsContextLost(); 1521 return renderer_ && renderer_->IsContextLost();
1521 } 1522 }
1522 1523
1524 void LayerTreeHostImpl::SetUseGpuRasterization(bool use_gpu) {
1525 if (use_gpu == use_gpu_rasterization_)
1526 return;
1527
1528 use_gpu_rasterization_ = use_gpu;
1529 ReleaseTreeResources();
1530
1531 // We have released tilings for both active and pending tree.
1532 // We would not have any content to draw until the pending tree is activated.
1533 // Prevent the active tree from drawing until activation.
1534 active_tree_->SetRequiresHighResToDraw();
1535 }
1536
1523 const RendererCapabilitiesImpl& 1537 const RendererCapabilitiesImpl&
1524 LayerTreeHostImpl::GetRendererCapabilities() const { 1538 LayerTreeHostImpl::GetRendererCapabilities() const {
1525 return renderer_->Capabilities(); 1539 return renderer_->Capabilities();
1526 } 1540 }
1527 1541
1528 bool LayerTreeHostImpl::SwapBuffers(const LayerTreeHostImpl::FrameData& frame) { 1542 bool LayerTreeHostImpl::SwapBuffers(const LayerTreeHostImpl::FrameData& frame) {
1529 active_tree()->ResetRequiresHighResToDraw(); 1543 active_tree()->ResetRequiresHighResToDraw();
1530 if (frame.has_no_damage) { 1544 if (frame.has_no_damage) {
1531 active_tree()->BreakSwapPromises(SwapPromise::SWAP_FAILS); 1545 active_tree()->BreakSwapPromises(SwapPromise::SWAP_FAILS);
1532 return false; 1546 return false;
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
1766 client_->SetNeedsAnimateOnImplThread(); 1780 client_->SetNeedsAnimateOnImplThread();
1767 } 1781 }
1768 1782
1769 void LayerTreeHostImpl::SetNeedsRedraw() { 1783 void LayerTreeHostImpl::SetNeedsRedraw() {
1770 NotifySwapPromiseMonitorsOfSetNeedsRedraw(); 1784 NotifySwapPromiseMonitorsOfSetNeedsRedraw();
1771 client_->SetNeedsRedrawOnImplThread(); 1785 client_->SetNeedsRedrawOnImplThread();
1772 } 1786 }
1773 1787
1774 ManagedMemoryPolicy LayerTreeHostImpl::ActualManagedMemoryPolicy() const { 1788 ManagedMemoryPolicy LayerTreeHostImpl::ActualManagedMemoryPolicy() const {
1775 ManagedMemoryPolicy actual = cached_managed_memory_policy_; 1789 ManagedMemoryPolicy actual = cached_managed_memory_policy_;
1776 bool any_tree_use_gpu_rasterization =
1777 (active_tree_ && active_tree_->use_gpu_rasterization()) ||
1778 (pending_tree_ && pending_tree_->use_gpu_rasterization());
1779 if (debug_state_.rasterize_only_visible_content) { 1790 if (debug_state_.rasterize_only_visible_content) {
1780 actual.priority_cutoff_when_visible = 1791 actual.priority_cutoff_when_visible =
1781 gpu::MemoryAllocation::CUTOFF_ALLOW_REQUIRED_ONLY; 1792 gpu::MemoryAllocation::CUTOFF_ALLOW_REQUIRED_ONLY;
1782 } else if (any_tree_use_gpu_rasterization) { 1793 } else if (use_gpu_rasterization()) {
1783 actual.priority_cutoff_when_visible = 1794 actual.priority_cutoff_when_visible =
1784 gpu::MemoryAllocation::CUTOFF_ALLOW_NICE_TO_HAVE; 1795 gpu::MemoryAllocation::CUTOFF_ALLOW_NICE_TO_HAVE;
1785 } 1796 }
1786 1797
1787 if (zero_budget_) { 1798 if (zero_budget_) {
1788 actual.bytes_limit_when_visible = 0; 1799 actual.bytes_limit_when_visible = 0;
1789 } 1800 }
1790 1801
1791 return actual; 1802 return actual;
1792 } 1803 }
(...skipping 1330 matching lines...) Expand 10 before | Expand all | Expand 10 after
3123 swap_promise_monitor_.erase(monitor); 3134 swap_promise_monitor_.erase(monitor);
3124 } 3135 }
3125 3136
3126 void LayerTreeHostImpl::NotifySwapPromiseMonitorsOfSetNeedsRedraw() { 3137 void LayerTreeHostImpl::NotifySwapPromiseMonitorsOfSetNeedsRedraw() {
3127 std::set<SwapPromiseMonitor*>::iterator it = swap_promise_monitor_.begin(); 3138 std::set<SwapPromiseMonitor*>::iterator it = swap_promise_monitor_.begin();
3128 for (; it != swap_promise_monitor_.end(); it++) 3139 for (; it != swap_promise_monitor_.end(); it++)
3129 (*it)->OnSetNeedsRedrawOnImpl(); 3140 (*it)->OnSetNeedsRedrawOnImpl();
3130 } 3141 }
3131 3142
3132 } // namespace cc 3143 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_impl.h ('k') | cc/trees/layer_tree_host_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698