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

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

Issue 860813002: Remove the default format from ResourcePool. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix compile error in perftest. Created 5 years, 11 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
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 1969 matching lines...) Expand 10 before | Expand all | Expand 10 after
1980 1980
1981 base::SingleThreadTaskRunner* task_runner = 1981 base::SingleThreadTaskRunner* task_runner =
1982 proxy_->HasImplThread() ? proxy_->ImplThreadTaskRunner() 1982 proxy_->HasImplThread() ? proxy_->ImplThreadTaskRunner()
1983 : proxy_->MainThreadTaskRunner(); 1983 : proxy_->MainThreadTaskRunner();
1984 DCHECK(task_runner); 1984 DCHECK(task_runner);
1985 size_t scheduled_raster_task_limit = 1985 size_t scheduled_raster_task_limit =
1986 IsSynchronousSingleThreaded() ? std::numeric_limits<size_t>::max() 1986 IsSynchronousSingleThreaded() ? std::numeric_limits<size_t>::max()
1987 : settings_.scheduled_raster_task_limit; 1987 : settings_.scheduled_raster_task_limit;
1988 tile_manager_ = 1988 tile_manager_ =
1989 TileManager::Create(this, task_runner, resource_pool_.get(), 1989 TileManager::Create(this, task_runner, resource_pool_.get(),
1990 tile_task_worker_pool_->GetResourceFormat(),
1990 tile_task_worker_pool_->AsTileTaskRunner(), 1991 tile_task_worker_pool_->AsTileTaskRunner(),
1991 rasterizer_.get(), scheduled_raster_task_limit); 1992 rasterizer_.get(), scheduled_raster_task_limit);
1992 1993
1993 UpdateTileManagerMemoryPolicy(ActualManagedMemoryPolicy()); 1994 UpdateTileManagerMemoryPolicy(ActualManagedMemoryPolicy());
1994 } 1995 }
1995 1996
1996 scoped_ptr<Rasterizer> LayerTreeHostImpl::CreateRasterizer() { 1997 scoped_ptr<Rasterizer> LayerTreeHostImpl::CreateRasterizer() {
1997 ContextProvider* context_provider = output_surface_->context_provider(); 1998 ContextProvider* context_provider = output_surface_->context_provider();
1998 if (use_gpu_rasterization_ && context_provider) { 1999 if (use_gpu_rasterization_ && context_provider) {
1999 return GpuRasterizer::Create(context_provider, resource_provider_.get(), 2000 return GpuRasterizer::Create(context_provider, resource_provider_.get(),
2000 settings_.use_distance_field_text, false); 2001 settings_.use_distance_field_text, false);
2001 } 2002 }
2002 return SoftwareRasterizer::Create(); 2003 return SoftwareRasterizer::Create();
2003 } 2004 }
2004 2005
2005 void LayerTreeHostImpl::CreateResourceAndTileTaskWorkerPool( 2006 void LayerTreeHostImpl::CreateResourceAndTileTaskWorkerPool(
2006 scoped_ptr<TileTaskWorkerPool>* tile_task_worker_pool, 2007 scoped_ptr<TileTaskWorkerPool>* tile_task_worker_pool,
2007 scoped_ptr<ResourcePool>* resource_pool, 2008 scoped_ptr<ResourcePool>* resource_pool,
2008 scoped_ptr<ResourcePool>* staging_resource_pool) { 2009 scoped_ptr<ResourcePool>* staging_resource_pool) {
2009 base::SingleThreadTaskRunner* task_runner = 2010 base::SingleThreadTaskRunner* task_runner =
2010 proxy_->HasImplThread() ? proxy_->ImplThreadTaskRunner() 2011 proxy_->HasImplThread() ? proxy_->ImplThreadTaskRunner()
2011 : proxy_->MainThreadTaskRunner(); 2012 : proxy_->MainThreadTaskRunner();
2012 DCHECK(task_runner); 2013 DCHECK(task_runner);
2013 2014
2014 ContextProvider* context_provider = output_surface_->context_provider(); 2015 ContextProvider* context_provider = output_surface_->context_provider();
2015 if (!context_provider) { 2016 if (!context_provider) {
2016 *resource_pool = 2017 *resource_pool =
2017 ResourcePool::Create(resource_provider_.get(), 2018 ResourcePool::Create(resource_provider_.get(), GL_TEXTURE_2D);
2018 GL_TEXTURE_2D,
2019 resource_provider_->best_texture_format());
2020 2019
2021 *tile_task_worker_pool = BitmapTileTaskWorkerPool::Create( 2020 *tile_task_worker_pool = BitmapTileTaskWorkerPool::Create(
2022 task_runner, TileTaskWorkerPool::GetTaskGraphRunner(), 2021 task_runner, TileTaskWorkerPool::GetTaskGraphRunner(),
2023 resource_provider_.get()); 2022 resource_provider_.get());
2024 return; 2023 return;
2025 } 2024 }
2026 2025
2027 if (use_gpu_rasterization_) { 2026 if (use_gpu_rasterization_) {
2028 *resource_pool = 2027 *resource_pool =
2029 ResourcePool::Create(resource_provider_.get(), 2028 ResourcePool::Create(resource_provider_.get(), GL_TEXTURE_2D);
2030 GL_TEXTURE_2D,
2031 resource_provider_->best_texture_format());
2032 2029
2033 *tile_task_worker_pool = GpuTileTaskWorkerPool::Create( 2030 *tile_task_worker_pool = GpuTileTaskWorkerPool::Create(
2034 task_runner, TileTaskWorkerPool::GetTaskGraphRunner()); 2031 task_runner, TileTaskWorkerPool::GetTaskGraphRunner(),
2032 resource_provider_->best_texture_format());
2035 return; 2033 return;
2036 } 2034 }
2037 2035
2038 if (GetRendererCapabilities().using_image) { 2036 if (GetRendererCapabilities().using_image) {
2039 unsigned image_target = settings_.use_image_texture_target; 2037 unsigned image_target = settings_.use_image_texture_target;
2040 DCHECK_IMPLIES( 2038 DCHECK_IMPLIES(
2041 image_target == GL_TEXTURE_RECTANGLE_ARB, 2039 image_target == GL_TEXTURE_RECTANGLE_ARB,
2042 context_provider->ContextCapabilities().gpu.texture_rectangle); 2040 context_provider->ContextCapabilities().gpu.texture_rectangle);
2043 DCHECK_IMPLIES( 2041 DCHECK_IMPLIES(
2044 image_target == GL_TEXTURE_EXTERNAL_OES, 2042 image_target == GL_TEXTURE_EXTERNAL_OES,
2045 context_provider->ContextCapabilities().gpu.egl_image_external); 2043 context_provider->ContextCapabilities().gpu.egl_image_external);
2046 2044
2047 if (settings_.use_zero_copy || IsSynchronousSingleThreaded()) { 2045 if (settings_.use_zero_copy || IsSynchronousSingleThreaded()) {
2048 *resource_pool = 2046 *resource_pool =
2049 ResourcePool::Create(resource_provider_.get(), image_target, 2047 ResourcePool::Create(resource_provider_.get(), image_target);
2050 resource_provider_->best_texture_format());
2051 2048
2052 TaskGraphRunner* task_graph_runner; 2049 TaskGraphRunner* task_graph_runner;
2053 if (IsSynchronousSingleThreaded()) { 2050 if (IsSynchronousSingleThreaded()) {
2054 DCHECK(!single_thread_synchronous_task_graph_runner_); 2051 DCHECK(!single_thread_synchronous_task_graph_runner_);
2055 single_thread_synchronous_task_graph_runner_.reset(new TaskGraphRunner); 2052 single_thread_synchronous_task_graph_runner_.reset(new TaskGraphRunner);
2056 task_graph_runner = single_thread_synchronous_task_graph_runner_.get(); 2053 task_graph_runner = single_thread_synchronous_task_graph_runner_.get();
2057 } else { 2054 } else {
2058 task_graph_runner = TileTaskWorkerPool::GetTaskGraphRunner(); 2055 task_graph_runner = TileTaskWorkerPool::GetTaskGraphRunner();
2059 } 2056 }
2060 2057
2061 *tile_task_worker_pool = ZeroCopyTileTaskWorkerPool::Create( 2058 *tile_task_worker_pool = ZeroCopyTileTaskWorkerPool::Create(
2062 task_runner, task_graph_runner, resource_provider_.get()); 2059 task_runner, task_graph_runner, resource_provider_.get());
2063 return; 2060 return;
2064 } 2061 }
2065 2062
2066 if (settings_.use_one_copy) { 2063 if (settings_.use_one_copy) {
2067 // We need to create a staging resource pool when using copy rasterizer. 2064 // We need to create a staging resource pool when using copy rasterizer.
2068 *staging_resource_pool = 2065 *staging_resource_pool =
2069 ResourcePool::Create(resource_provider_.get(), image_target, 2066 ResourcePool::Create(resource_provider_.get(), image_target);
2070 resource_provider_->best_texture_format());
2071 *resource_pool = 2067 *resource_pool =
2072 ResourcePool::Create(resource_provider_.get(), GL_TEXTURE_2D, 2068 ResourcePool::Create(resource_provider_.get(), GL_TEXTURE_2D);
2073 resource_provider_->best_texture_format());
2074 2069
2075 *tile_task_worker_pool = OneCopyTileTaskWorkerPool::Create( 2070 *tile_task_worker_pool = OneCopyTileTaskWorkerPool::Create(
2076 task_runner, TileTaskWorkerPool::GetTaskGraphRunner(), 2071 task_runner, TileTaskWorkerPool::GetTaskGraphRunner(),
2077 context_provider, resource_provider_.get(), 2072 context_provider, resource_provider_.get(),
2078 staging_resource_pool_.get()); 2073 staging_resource_pool_.get());
2079 return; 2074 return;
2080 } 2075 }
2081 } 2076 }
2082 2077
2083 *resource_pool = ResourcePool::Create( 2078 *resource_pool = ResourcePool::Create(
2084 resource_provider_.get(), GL_TEXTURE_2D, 2079 resource_provider_.get(), GL_TEXTURE_2D);
2085 resource_provider_->memory_efficient_texture_format());
2086 2080
2087 *tile_task_worker_pool = PixelBufferTileTaskWorkerPool::Create( 2081 *tile_task_worker_pool = PixelBufferTileTaskWorkerPool::Create(
2088 task_runner, TileTaskWorkerPool::GetTaskGraphRunner(), context_provider, 2082 task_runner, TileTaskWorkerPool::GetTaskGraphRunner(), context_provider,
2089 resource_provider_.get(), 2083 resource_provider_.get(),
2090 GetMaxTransferBufferUsageBytes(context_provider->ContextCapabilities(), 2084 GetMaxTransferBufferUsageBytes(context_provider->ContextCapabilities(),
2091 settings_.renderer_settings.refresh_rate)); 2085 settings_.renderer_settings.refresh_rate));
2092 } 2086 }
2093 2087
2094 void LayerTreeHostImpl::DestroyTileManager() { 2088 void LayerTreeHostImpl::DestroyTileManager() {
2095 tile_manager_ = nullptr; 2089 tile_manager_ = nullptr;
(...skipping 1412 matching lines...) Expand 10 before | Expand all | Expand 10 after
3508 } 3502 }
3509 3503
3510 void LayerTreeHostImpl::UnregisterPictureLayerImpl(PictureLayerImpl* layer) { 3504 void LayerTreeHostImpl::UnregisterPictureLayerImpl(PictureLayerImpl* layer) {
3511 std::vector<PictureLayerImpl*>::iterator it = 3505 std::vector<PictureLayerImpl*>::iterator it =
3512 std::find(picture_layers_.begin(), picture_layers_.end(), layer); 3506 std::find(picture_layers_.begin(), picture_layers_.end(), layer);
3513 DCHECK(it != picture_layers_.end()); 3507 DCHECK(it != picture_layers_.end());
3514 picture_layers_.erase(it); 3508 picture_layers_.erase(it);
3515 } 3509 }
3516 3510
3517 } // namespace cc 3511 } // namespace cc
OLDNEW
« cc/resources/tile_task_worker_pool.h ('K') | « cc/test/layer_tree_pixel_resource_test.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698