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

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

Issue 228173002: cc: Separate RasterWorkerPool interface from implementation details. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address review feedback Created 6 years, 8 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') | no next file » | 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 #include "cc/quads/render_pass_draw_quad.h" 42 #include "cc/quads/render_pass_draw_quad.h"
43 #include "cc/quads/shared_quad_state.h" 43 #include "cc/quads/shared_quad_state.h"
44 #include "cc/quads/solid_color_draw_quad.h" 44 #include "cc/quads/solid_color_draw_quad.h"
45 #include "cc/quads/texture_draw_quad.h" 45 #include "cc/quads/texture_draw_quad.h"
46 #include "cc/resources/direct_raster_worker_pool.h" 46 #include "cc/resources/direct_raster_worker_pool.h"
47 #include "cc/resources/image_raster_worker_pool.h" 47 #include "cc/resources/image_raster_worker_pool.h"
48 #include "cc/resources/memory_history.h" 48 #include "cc/resources/memory_history.h"
49 #include "cc/resources/picture_layer_tiling.h" 49 #include "cc/resources/picture_layer_tiling.h"
50 #include "cc/resources/pixel_buffer_raster_worker_pool.h" 50 #include "cc/resources/pixel_buffer_raster_worker_pool.h"
51 #include "cc/resources/prioritized_resource_manager.h" 51 #include "cc/resources/prioritized_resource_manager.h"
52 #include "cc/resources/raster_worker_pool.h"
52 #include "cc/resources/texture_mailbox_deleter.h" 53 #include "cc/resources/texture_mailbox_deleter.h"
53 #include "cc/resources/ui_resource_bitmap.h" 54 #include "cc/resources/ui_resource_bitmap.h"
54 #include "cc/scheduler/delay_based_time_source.h" 55 #include "cc/scheduler/delay_based_time_source.h"
55 #include "cc/trees/damage_tracker.h" 56 #include "cc/trees/damage_tracker.h"
56 #include "cc/trees/layer_tree_host.h" 57 #include "cc/trees/layer_tree_host.h"
57 #include "cc/trees/layer_tree_host_common.h" 58 #include "cc/trees/layer_tree_host_common.h"
58 #include "cc/trees/layer_tree_impl.h" 59 #include "cc/trees/layer_tree_impl.h"
59 #include "cc/trees/occlusion_tracker.h" 60 #include "cc/trees/occlusion_tracker.h"
60 #include "cc/trees/quad_culler.h" 61 #include "cc/trees/quad_culler.h"
61 #include "cc/trees/single_thread_proxy.h" 62 #include "cc/trees/single_thread_proxy.h"
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 // will outlive them, and we must make good. 300 // will outlive them, and we must make good.
300 if (recycle_tree_) 301 if (recycle_tree_)
301 recycle_tree_->Shutdown(); 302 recycle_tree_->Shutdown();
302 if (pending_tree_) 303 if (pending_tree_)
303 pending_tree_->Shutdown(); 304 pending_tree_->Shutdown();
304 active_tree_->Shutdown(); 305 active_tree_->Shutdown();
305 recycle_tree_.reset(); 306 recycle_tree_.reset();
306 pending_tree_.reset(); 307 pending_tree_.reset();
307 active_tree_.reset(); 308 active_tree_.reset();
308 tile_manager_.reset(); 309 tile_manager_.reset();
309 image_raster_worker_pool_.reset(); 310 raster_worker_pool_.reset();
310 pixel_buffer_raster_worker_pool_.reset();
311 direct_raster_worker_pool_.reset(); 311 direct_raster_worker_pool_.reset();
312 } 312 }
313 313
314 void LayerTreeHostImpl::BeginMainFrameAborted(bool did_handle) { 314 void LayerTreeHostImpl::BeginMainFrameAborted(bool did_handle) {
315 // If the begin frame data was handled, then scroll and scale set was applied 315 // If the begin frame data was handled, then scroll and scale set was applied
316 // by the main thread, so the active tree needs to be updated as if these sent 316 // by the main thread, so the active tree needs to be updated as if these sent
317 // values were applied and committed. 317 // values were applied and committed.
318 if (did_handle) { 318 if (did_handle) {
319 active_tree_->ApplySentScrollAndScaleDeltasFromAbortedCommit(); 319 active_tree_->ApplySentScrollAndScaleDeltasFromAbortedCommit();
320 active_tree_->ResetContentsTexturesPurged(); 320 active_tree_->ResetContentsTexturesPurged();
(...skipping 1468 matching lines...) Expand 10 before | Expand all | Expand 10 after
1789 1789
1790 void LayerTreeHostImpl::CreateAndSetTileManager( 1790 void LayerTreeHostImpl::CreateAndSetTileManager(
1791 ResourceProvider* resource_provider, 1791 ResourceProvider* resource_provider,
1792 ContextProvider* context_provider, 1792 ContextProvider* context_provider,
1793 bool using_map_image, 1793 bool using_map_image,
1794 bool allow_rasterize_on_demand) { 1794 bool allow_rasterize_on_demand) {
1795 DCHECK(settings_.impl_side_painting); 1795 DCHECK(settings_.impl_side_painting);
1796 DCHECK(resource_provider); 1796 DCHECK(resource_provider);
1797 DCHECK(proxy_->ImplThreadTaskRunner()); 1797 DCHECK(proxy_->ImplThreadTaskRunner());
1798 1798
1799 RasterWorkerPool* default_raster_worker_pool = NULL;
1800 if (using_map_image) { 1799 if (using_map_image) {
1801 image_raster_worker_pool_ = ImageRasterWorkerPool::Create( 1800 raster_worker_pool_ = ImageRasterWorkerPool::Create(
1802 proxy_->ImplThreadTaskRunner(), 1801 proxy_->ImplThreadTaskRunner(),
1802 RasterWorkerPool::GetTaskGraphRunner(),
1803 resource_provider, 1803 resource_provider,
1804 GetMapImageTextureTarget(context_provider)); 1804 GetMapImageTextureTarget(context_provider));
1805 default_raster_worker_pool = image_raster_worker_pool_.get();
1806 } else { 1805 } else {
1807 pixel_buffer_raster_worker_pool_ = PixelBufferRasterWorkerPool::Create( 1806 raster_worker_pool_ = PixelBufferRasterWorkerPool::Create(
1808 proxy_->ImplThreadTaskRunner(), 1807 proxy_->ImplThreadTaskRunner(),
1808 RasterWorkerPool::GetTaskGraphRunner(),
1809 resource_provider, 1809 resource_provider,
1810 GetMaxTransferBufferUsageBytes(context_provider)); 1810 GetMaxTransferBufferUsageBytes(context_provider));
1811 default_raster_worker_pool = pixel_buffer_raster_worker_pool_.get();
1812 } 1811 }
1813 direct_raster_worker_pool_ = DirectRasterWorkerPool::Create( 1812 direct_raster_worker_pool_ = DirectRasterWorkerPool::Create(
1814 proxy_->ImplThreadTaskRunner(), resource_provider, context_provider); 1813 proxy_->ImplThreadTaskRunner(), resource_provider, context_provider);
1815 tile_manager_ = 1814 tile_manager_ =
1816 TileManager::Create(this, 1815 TileManager::Create(this,
1817 resource_provider, 1816 resource_provider,
1818 default_raster_worker_pool, 1817 raster_worker_pool_->AsRasterizer(),
1819 direct_raster_worker_pool_.get(), 1818 direct_raster_worker_pool_->AsRasterizer(),
1820 GetMaxRasterTasksUsageBytes(context_provider), 1819 GetMaxRasterTasksUsageBytes(context_provider),
1821 allow_rasterize_on_demand, 1820 allow_rasterize_on_demand,
1822 rendering_stats_instrumentation_); 1821 rendering_stats_instrumentation_);
1823 1822
1824 UpdateTileManagerMemoryPolicy(ActualManagedMemoryPolicy()); 1823 UpdateTileManagerMemoryPolicy(ActualManagedMemoryPolicy());
1825 need_to_update_visible_tiles_before_draw_ = false; 1824 need_to_update_visible_tiles_before_draw_ = false;
1826 } 1825 }
1827 1826
1828 void LayerTreeHostImpl::EnforceZeroBudget(bool zero_budget) { 1827 void LayerTreeHostImpl::EnforceZeroBudget(bool zero_budget) {
1829 SetManagedMemoryPolicy(cached_managed_memory_policy_, zero_budget); 1828 SetManagedMemoryPolicy(cached_managed_memory_policy_, zero_budget);
1830 } 1829 }
1831 1830
1832 bool LayerTreeHostImpl::InitializeRenderer( 1831 bool LayerTreeHostImpl::InitializeRenderer(
1833 scoped_ptr<OutputSurface> output_surface) { 1832 scoped_ptr<OutputSurface> output_surface) {
1834 #if DCHECK_IS_ON 1833 #if DCHECK_IS_ON
1835 DCHECK(!renderer_ || did_lose_called_); 1834 DCHECK(!renderer_ || did_lose_called_);
1836 #endif 1835 #endif
1837 1836
1838 // Since we will create a new resource provider, we cannot continue to use 1837 // Since we will create a new resource provider, we cannot continue to use
1839 // the old resources (i.e. render_surfaces and texture IDs). Clear them 1838 // the old resources (i.e. render_surfaces and texture IDs). Clear them
1840 // before we destroy the old resource provider. 1839 // before we destroy the old resource provider.
1841 ReleaseTreeResources(); 1840 ReleaseTreeResources();
1842 1841
1843 // Note: order is important here. 1842 // Note: order is important here.
1844 renderer_.reset(); 1843 renderer_.reset();
1845 tile_manager_.reset(); 1844 tile_manager_.reset();
1846 image_raster_worker_pool_.reset(); 1845 raster_worker_pool_.reset();
1847 pixel_buffer_raster_worker_pool_.reset();
1848 direct_raster_worker_pool_.reset(); 1846 direct_raster_worker_pool_.reset();
1849 resource_provider_.reset(); 1847 resource_provider_.reset();
1850 output_surface_.reset(); 1848 output_surface_.reset();
1851 1849
1852 if (!output_surface->BindToClient(this)) 1850 if (!output_surface->BindToClient(this))
1853 return false; 1851 return false;
1854 1852
1855 scoped_ptr<ResourceProvider> resource_provider = 1853 scoped_ptr<ResourceProvider> resource_provider =
1856 ResourceProvider::Create(output_surface.get(), 1854 ResourceProvider::Create(output_surface.get(),
1857 shared_bitmap_manager_, 1855 shared_bitmap_manager_,
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
1964 } 1962 }
1965 1963
1966 void LayerTreeHostImpl::ReleaseGL() { 1964 void LayerTreeHostImpl::ReleaseGL() {
1967 DCHECK(output_surface_->capabilities().deferred_gl_initialization); 1965 DCHECK(output_surface_->capabilities().deferred_gl_initialization);
1968 DCHECK(settings_.impl_side_painting); 1966 DCHECK(settings_.impl_side_painting);
1969 DCHECK(output_surface_->context_provider()); 1967 DCHECK(output_surface_->context_provider());
1970 1968
1971 ReleaseTreeResources(); 1969 ReleaseTreeResources();
1972 renderer_.reset(); 1970 renderer_.reset();
1973 tile_manager_.reset(); 1971 tile_manager_.reset();
1974 image_raster_worker_pool_.reset(); 1972 raster_worker_pool_.reset();
1975 pixel_buffer_raster_worker_pool_.reset();
1976 direct_raster_worker_pool_.reset(); 1973 direct_raster_worker_pool_.reset();
1977 resource_provider_->InitializeSoftware(); 1974 resource_provider_->InitializeSoftware();
1978 1975
1979 bool skip_gl_renderer = true; 1976 bool skip_gl_renderer = true;
1980 CreateAndSetRenderer( 1977 CreateAndSetRenderer(
1981 output_surface_.get(), resource_provider_.get(), skip_gl_renderer); 1978 output_surface_.get(), resource_provider_.get(), skip_gl_renderer);
1982 DCHECK(renderer_); 1979 DCHECK(renderer_);
1983 1980
1984 EnforceZeroBudget(true); 1981 EnforceZeroBudget(true);
1985 CreateAndSetTileManager(resource_provider_.get(), 1982 CreateAndSetTileManager(resource_provider_.get(),
(...skipping 1086 matching lines...) Expand 10 before | Expand all | Expand 10 after
3072 swap_promise_monitor_.erase(monitor); 3069 swap_promise_monitor_.erase(monitor);
3073 } 3070 }
3074 3071
3075 void LayerTreeHostImpl::NotifySwapPromiseMonitorsOfSetNeedsRedraw() { 3072 void LayerTreeHostImpl::NotifySwapPromiseMonitorsOfSetNeedsRedraw() {
3076 std::set<SwapPromiseMonitor*>::iterator it = swap_promise_monitor_.begin(); 3073 std::set<SwapPromiseMonitor*>::iterator it = swap_promise_monitor_.begin();
3077 for (; it != swap_promise_monitor_.end(); it++) 3074 for (; it != swap_promise_monitor_.end(); it++)
3078 (*it)->OnSetNeedsRedrawOnImpl(); 3075 (*it)->OnSetNeedsRedrawOnImpl();
3079 } 3076 }
3080 3077
3081 } // namespace cc 3078 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698