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 <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 2225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2236 std::unique_ptr<RasterBufferProvider>* raster_buffer_provider, | 2236 std::unique_ptr<RasterBufferProvider>* raster_buffer_provider, |
2237 std::unique_ptr<ResourcePool>* resource_pool) { | 2237 std::unique_ptr<ResourcePool>* resource_pool) { |
2238 DCHECK(GetTaskRunner()); | 2238 DCHECK(GetTaskRunner()); |
2239 // TODO(vmpstr): Make this a DCHECK (or remove) when crbug.com/419086 is | 2239 // TODO(vmpstr): Make this a DCHECK (or remove) when crbug.com/419086 is |
2240 // resolved. | 2240 // resolved. |
2241 CHECK(resource_provider_); | 2241 CHECK(resource_provider_); |
2242 | 2242 |
2243 ContextProvider* compositor_context_provider = | 2243 ContextProvider* compositor_context_provider = |
2244 compositor_frame_sink_->context_provider(); | 2244 compositor_frame_sink_->context_provider(); |
2245 if (!compositor_context_provider) { | 2245 if (!compositor_context_provider) { |
2246 *resource_pool = | 2246 *resource_pool = ResourcePool::Create( |
2247 ResourcePool::Create(resource_provider_.get(), GetTaskRunner(), | 2247 resource_provider_.get(), GetTaskRunner(), |
2248 ResourceProvider::TEXTURE_HINT_IMMUTABLE, | 2248 ResourceProvider::TEXTURE_HINT_IMMUTABLE, |
2249 ResourcePool::kDefaultExpirationDelay); | 2249 ResourcePool::kDefaultExpirationDelay, |
2250 settings_.renderer_settings.disallow_non_exact_resource_reuse); | |
2250 | 2251 |
2251 *raster_buffer_provider = | 2252 *raster_buffer_provider = |
2252 BitmapRasterBufferProvider::Create(resource_provider_.get()); | 2253 BitmapRasterBufferProvider::Create(resource_provider_.get()); |
2253 return; | 2254 return; |
2254 } | 2255 } |
2255 | 2256 |
2256 ContextProvider* worker_context_provider = | 2257 ContextProvider* worker_context_provider = |
2257 compositor_frame_sink_->worker_context_provider(); | 2258 compositor_frame_sink_->worker_context_provider(); |
2258 if (use_gpu_rasterization_) { | 2259 if (use_gpu_rasterization_) { |
2259 DCHECK(worker_context_provider); | 2260 DCHECK(worker_context_provider); |
2260 | 2261 |
2261 *resource_pool = ResourcePool::Create( | 2262 *resource_pool = ResourcePool::Create( |
2262 resource_provider_.get(), GetTaskRunner(), | 2263 resource_provider_.get(), GetTaskRunner(), |
2263 ResourceProvider::TEXTURE_HINT_IMMUTABLE_FRAMEBUFFER, | 2264 ResourceProvider::TEXTURE_HINT_IMMUTABLE_FRAMEBUFFER, |
2264 ResourcePool::kDefaultExpirationDelay); | 2265 ResourcePool::kDefaultExpirationDelay, |
2266 settings_.renderer_settings.disallow_non_exact_resource_reuse); | |
2265 | 2267 |
2266 int msaa_sample_count = use_msaa_ ? RequestedMSAASampleCount() : 0; | 2268 int msaa_sample_count = use_msaa_ ? RequestedMSAASampleCount() : 0; |
2267 | 2269 |
2268 *raster_buffer_provider = base::MakeUnique<GpuRasterBufferProvider>( | 2270 *raster_buffer_provider = base::MakeUnique<GpuRasterBufferProvider>( |
2269 compositor_context_provider, worker_context_provider, | 2271 compositor_context_provider, worker_context_provider, |
2270 resource_provider_.get(), settings_.use_distance_field_text, | 2272 resource_provider_.get(), settings_.use_distance_field_text, |
2271 msaa_sample_count, settings_.renderer_settings.preferred_tile_format, | 2273 msaa_sample_count, settings_.renderer_settings.preferred_tile_format, |
2272 settings_.async_worker_context_enabled); | 2274 settings_.async_worker_context_enabled); |
2273 return; | 2275 return; |
2274 } | 2276 } |
2275 | 2277 |
2276 bool use_zero_copy = settings_.use_zero_copy; | 2278 bool use_zero_copy = settings_.use_zero_copy; |
2277 // TODO(reveman): Remove this when mojo supports worker contexts. | 2279 // TODO(reveman): Remove this when mojo supports worker contexts. |
2278 // crbug.com/522440 | 2280 // crbug.com/522440 |
2279 if (!use_zero_copy && !worker_context_provider) { | 2281 if (!use_zero_copy && !worker_context_provider) { |
2280 LOG(ERROR) | 2282 LOG(ERROR) |
2281 << "Forcing zero-copy tile initialization as worker context is missing"; | 2283 << "Forcing zero-copy tile initialization as worker context is missing"; |
2282 use_zero_copy = true; | 2284 use_zero_copy = true; |
2283 } | 2285 } |
2284 | 2286 |
2285 if (use_zero_copy) { | 2287 if (use_zero_copy) { |
2286 *resource_pool = ResourcePool::CreateForGpuMemoryBufferResources( | 2288 *resource_pool = ResourcePool::CreateForGpuMemoryBufferResources( |
2287 resource_provider_.get(), GetTaskRunner(), | 2289 resource_provider_.get(), GetTaskRunner(), |
2288 gfx::BufferUsage::GPU_READ_CPU_READ_WRITE, | 2290 gfx::BufferUsage::GPU_READ_CPU_READ_WRITE, |
2289 ResourcePool::kDefaultExpirationDelay); | 2291 ResourcePool::kDefaultExpirationDelay, |
2292 settings_.renderer_settings.disallow_non_exact_resource_reuse); | |
danakj
2017/05/04 21:48:37
Can you put it in LayerTreeSettings for here, and
ericrk
2017/05/05 23:18:38
Done.
| |
2290 | 2293 |
2291 *raster_buffer_provider = ZeroCopyRasterBufferProvider::Create( | 2294 *raster_buffer_provider = ZeroCopyRasterBufferProvider::Create( |
2292 resource_provider_.get(), | 2295 resource_provider_.get(), |
2293 settings_.renderer_settings.preferred_tile_format); | 2296 settings_.renderer_settings.preferred_tile_format); |
2294 return; | 2297 return; |
2295 } | 2298 } |
2296 | 2299 |
2297 *resource_pool = | 2300 *resource_pool = ResourcePool::Create( |
2298 ResourcePool::Create(resource_provider_.get(), GetTaskRunner(), | 2301 resource_provider_.get(), GetTaskRunner(), |
2299 ResourceProvider::TEXTURE_HINT_IMMUTABLE, | 2302 ResourceProvider::TEXTURE_HINT_IMMUTABLE, |
2300 ResourcePool::kDefaultExpirationDelay); | 2303 ResourcePool::kDefaultExpirationDelay, |
2304 settings_.renderer_settings.disallow_non_exact_resource_reuse); | |
2301 | 2305 |
2302 const int max_copy_texture_chromium_size = | 2306 const int max_copy_texture_chromium_size = |
2303 compositor_context_provider->ContextCapabilities() | 2307 compositor_context_provider->ContextCapabilities() |
2304 .max_copy_texture_chromium_size; | 2308 .max_copy_texture_chromium_size; |
2305 | 2309 |
2306 *raster_buffer_provider = base::MakeUnique<OneCopyRasterBufferProvider>( | 2310 *raster_buffer_provider = base::MakeUnique<OneCopyRasterBufferProvider>( |
2307 GetTaskRunner(), compositor_context_provider, worker_context_provider, | 2311 GetTaskRunner(), compositor_context_provider, worker_context_provider, |
2308 resource_provider_.get(), max_copy_texture_chromium_size, | 2312 resource_provider_.get(), max_copy_texture_chromium_size, |
2309 settings_.use_partial_raster, settings_.max_staging_buffer_usage_in_bytes, | 2313 settings_.use_partial_raster, settings_.max_staging_buffer_usage_in_bytes, |
2310 settings_.renderer_settings.preferred_tile_format, | 2314 settings_.renderer_settings.preferred_tile_format, |
(...skipping 1990 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4301 | 4305 |
4302 void LayerTreeHostImpl::ShowScrollbarsForImplScroll(ElementId element_id) { | 4306 void LayerTreeHostImpl::ShowScrollbarsForImplScroll(ElementId element_id) { |
4303 if (!element_id) | 4307 if (!element_id) |
4304 return; | 4308 return; |
4305 if (ScrollbarAnimationController* animation_controller = | 4309 if (ScrollbarAnimationController* animation_controller = |
4306 ScrollbarAnimationControllerForElementId(element_id)) | 4310 ScrollbarAnimationControllerForElementId(element_id)) |
4307 animation_controller->DidScrollUpdate(); | 4311 animation_controller->DidScrollUpdate(); |
4308 } | 4312 } |
4309 | 4313 |
4310 } // namespace cc | 4314 } // namespace cc |
OLD | NEW |