OLD | NEW |
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 #include <map> | 9 #include <map> |
10 #include <set> | 10 #include <set> |
(...skipping 2102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2113 // if we're in synchronous single-threaded mode. | 2113 // if we're in synchronous single-threaded mode. |
2114 TaskGraphRunner* task_graph_runner = task_graph_runner_; | 2114 TaskGraphRunner* task_graph_runner = task_graph_runner_; |
2115 if (is_synchronous_single_threaded_) { | 2115 if (is_synchronous_single_threaded_) { |
2116 DCHECK(!single_thread_synchronous_task_graph_runner_); | 2116 DCHECK(!single_thread_synchronous_task_graph_runner_); |
2117 single_thread_synchronous_task_graph_runner_.reset(new TaskGraphRunner); | 2117 single_thread_synchronous_task_graph_runner_.reset(new TaskGraphRunner); |
2118 task_graph_runner = single_thread_synchronous_task_graph_runner_.get(); | 2118 task_graph_runner = single_thread_synchronous_task_graph_runner_.get(); |
2119 } | 2119 } |
2120 | 2120 |
2121 ContextProvider* context_provider = output_surface_->context_provider(); | 2121 ContextProvider* context_provider = output_surface_->context_provider(); |
2122 if (!context_provider) { | 2122 if (!context_provider) { |
2123 *resource_pool = ResourcePool::Create(resource_provider_.get(), | 2123 *resource_pool = |
2124 GetTaskRunner(), GL_TEXTURE_2D); | 2124 ResourcePool::Create(resource_provider_.get(), GetTaskRunner()); |
2125 | 2125 |
2126 *tile_task_worker_pool = BitmapTileTaskWorkerPool::Create( | 2126 *tile_task_worker_pool = BitmapTileTaskWorkerPool::Create( |
2127 GetTaskRunner(), task_graph_runner, resource_provider_.get()); | 2127 GetTaskRunner(), task_graph_runner, resource_provider_.get()); |
2128 return; | 2128 return; |
2129 } | 2129 } |
2130 | 2130 |
2131 if (use_gpu_rasterization_) { | 2131 if (use_gpu_rasterization_) { |
2132 DCHECK(resource_provider_->output_surface()->worker_context_provider()); | 2132 DCHECK(resource_provider_->output_surface()->worker_context_provider()); |
2133 | 2133 |
2134 *resource_pool = ResourcePool::Create(resource_provider_.get(), | 2134 *resource_pool = |
2135 GetTaskRunner(), GL_TEXTURE_2D); | 2135 ResourcePool::Create(resource_provider_.get(), GetTaskRunner()); |
2136 | 2136 |
2137 int msaa_sample_count = use_msaa_ ? RequestedMSAASampleCount() : 0; | 2137 int msaa_sample_count = use_msaa_ ? RequestedMSAASampleCount() : 0; |
2138 | 2138 |
2139 *tile_task_worker_pool = GpuTileTaskWorkerPool::Create( | 2139 *tile_task_worker_pool = GpuTileTaskWorkerPool::Create( |
2140 GetTaskRunner(), task_graph_runner, context_provider, | 2140 GetTaskRunner(), task_graph_runner, context_provider, |
2141 resource_provider_.get(), settings_.use_distance_field_text, | 2141 resource_provider_.get(), settings_.use_distance_field_text, |
2142 msaa_sample_count); | 2142 msaa_sample_count); |
2143 return; | 2143 return; |
2144 } | 2144 } |
2145 | 2145 |
2146 DCHECK(GetRendererCapabilities().using_image); | 2146 DCHECK(GetRendererCapabilities().using_image); |
2147 | 2147 |
2148 bool use_zero_copy = settings_.use_zero_copy; | 2148 bool use_zero_copy = settings_.use_zero_copy; |
2149 // TODO(reveman): Remove this when mojo supports worker contexts. | 2149 // TODO(reveman): Remove this when mojo supports worker contexts. |
2150 // crbug.com/522440 | 2150 // crbug.com/522440 |
2151 if (!resource_provider_->output_surface()->worker_context_provider()) { | 2151 if (!resource_provider_->output_surface()->worker_context_provider()) { |
2152 LOG(ERROR) | 2152 LOG(ERROR) |
2153 << "Forcing zero-copy tile initialization as worker context is missing"; | 2153 << "Forcing zero-copy tile initialization as worker context is missing"; |
2154 use_zero_copy = true; | 2154 use_zero_copy = true; |
2155 } | 2155 } |
2156 | 2156 |
2157 if (use_zero_copy) { | 2157 if (use_zero_copy) { |
2158 *resource_pool = | 2158 *resource_pool = ResourcePool::CreateForImageTextureTarget( |
2159 ResourcePool::Create(resource_provider_.get(), GetTaskRunner()); | 2159 resource_provider_.get(), GetTaskRunner()); |
2160 | 2160 |
2161 *tile_task_worker_pool = ZeroCopyTileTaskWorkerPool::Create( | 2161 *tile_task_worker_pool = ZeroCopyTileTaskWorkerPool::Create( |
2162 GetTaskRunner(), task_graph_runner, resource_provider_.get(), | 2162 GetTaskRunner(), task_graph_runner, resource_provider_.get(), |
2163 settings_.renderer_settings.use_rgba_4444_textures); | 2163 settings_.renderer_settings.use_rgba_4444_textures); |
2164 return; | 2164 return; |
2165 } | 2165 } |
2166 | 2166 |
2167 *resource_pool = ResourcePool::Create(resource_provider_.get(), | 2167 *resource_pool = |
2168 GetTaskRunner(), GL_TEXTURE_2D); | 2168 ResourcePool::Create(resource_provider_.get(), GetTaskRunner()); |
2169 | 2169 |
2170 int max_copy_texture_chromium_size = context_provider->ContextCapabilities() | 2170 int max_copy_texture_chromium_size = context_provider->ContextCapabilities() |
2171 .gpu.max_copy_texture_chromium_size; | 2171 .gpu.max_copy_texture_chromium_size; |
2172 | 2172 |
2173 *tile_task_worker_pool = OneCopyTileTaskWorkerPool::Create( | 2173 *tile_task_worker_pool = OneCopyTileTaskWorkerPool::Create( |
2174 GetTaskRunner(), task_graph_runner, context_provider, | 2174 GetTaskRunner(), task_graph_runner, context_provider, |
2175 resource_provider_.get(), max_copy_texture_chromium_size, | 2175 resource_provider_.get(), max_copy_texture_chromium_size, |
2176 settings_.use_partial_raster, settings_.max_staging_buffer_usage_in_bytes, | 2176 settings_.use_partial_raster, settings_.max_staging_buffer_usage_in_bytes, |
2177 settings_.renderer_settings.use_rgba_4444_textures); | 2177 settings_.renderer_settings.use_rgba_4444_textures); |
2178 } | 2178 } |
(...skipping 1478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3657 return task_runner_provider_->HasImplThread(); | 3657 return task_runner_provider_->HasImplThread(); |
3658 } | 3658 } |
3659 | 3659 |
3660 bool LayerTreeHostImpl::CommitToActiveTree() const { | 3660 bool LayerTreeHostImpl::CommitToActiveTree() const { |
3661 // In single threaded mode we skip the pending tree and commit directly to the | 3661 // In single threaded mode we skip the pending tree and commit directly to the |
3662 // active tree. | 3662 // active tree. |
3663 return !task_runner_provider_->HasImplThread(); | 3663 return !task_runner_provider_->HasImplThread(); |
3664 } | 3664 } |
3665 | 3665 |
3666 } // namespace cc | 3666 } // namespace cc |
OLD | NEW |