| 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 2126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2137 DCHECK(GetTaskRunner()); | 2137 DCHECK(GetTaskRunner()); |
| 2138 // TODO(vmpstr): Make this a DCHECK (or remove) when crbug.com/419086 is | 2138 // TODO(vmpstr): Make this a DCHECK (or remove) when crbug.com/419086 is |
| 2139 // resolved. | 2139 // resolved. |
| 2140 CHECK(resource_provider_); | 2140 CHECK(resource_provider_); |
| 2141 | 2141 |
| 2142 ContextProvider* compositor_context_provider = | 2142 ContextProvider* compositor_context_provider = |
| 2143 compositor_frame_sink_->context_provider(); | 2143 compositor_frame_sink_->context_provider(); |
| 2144 if (!compositor_context_provider) { | 2144 if (!compositor_context_provider) { |
| 2145 *resource_pool = | 2145 *resource_pool = |
| 2146 ResourcePool::Create(resource_provider_.get(), GetTaskRunner(), | 2146 ResourcePool::Create(resource_provider_.get(), GetTaskRunner(), |
| 2147 ResourceProvider::TEXTURE_HINT_IMMUTABLE, |
| 2147 ResourcePool::kDefaultExpirationDelay); | 2148 ResourcePool::kDefaultExpirationDelay); |
| 2148 | 2149 |
| 2149 *raster_buffer_provider = | 2150 *raster_buffer_provider = |
| 2150 BitmapRasterBufferProvider::Create(resource_provider_.get()); | 2151 BitmapRasterBufferProvider::Create(resource_provider_.get()); |
| 2151 return; | 2152 return; |
| 2152 } | 2153 } |
| 2153 | 2154 |
| 2154 ContextProvider* worker_context_provider = | 2155 ContextProvider* worker_context_provider = |
| 2155 compositor_frame_sink_->worker_context_provider(); | 2156 compositor_frame_sink_->worker_context_provider(); |
| 2156 if (use_gpu_rasterization_) { | 2157 if (use_gpu_rasterization_) { |
| 2157 DCHECK(worker_context_provider); | 2158 DCHECK(worker_context_provider); |
| 2158 | 2159 |
| 2159 *resource_pool = | 2160 *resource_pool = ResourcePool::Create( |
| 2160 ResourcePool::Create(resource_provider_.get(), GetTaskRunner(), | 2161 resource_provider_.get(), GetTaskRunner(), |
| 2161 ResourcePool::kDefaultExpirationDelay); | 2162 ResourceProvider::TEXTURE_HINT_IMMUTABLE_FRAMEBUFFER, |
| 2163 ResourcePool::kDefaultExpirationDelay); |
| 2162 | 2164 |
| 2163 int msaa_sample_count = use_msaa_ ? RequestedMSAASampleCount() : 0; | 2165 int msaa_sample_count = use_msaa_ ? RequestedMSAASampleCount() : 0; |
| 2164 | 2166 |
| 2165 *raster_buffer_provider = base::MakeUnique<GpuRasterBufferProvider>( | 2167 *raster_buffer_provider = base::MakeUnique<GpuRasterBufferProvider>( |
| 2166 compositor_context_provider, worker_context_provider, | 2168 compositor_context_provider, worker_context_provider, |
| 2167 resource_provider_.get(), settings_.use_distance_field_text, | 2169 resource_provider_.get(), settings_.use_distance_field_text, |
| 2168 msaa_sample_count, settings_.async_worker_context_enabled); | 2170 msaa_sample_count, settings_.async_worker_context_enabled); |
| 2169 return; | 2171 return; |
| 2170 } | 2172 } |
| 2171 | 2173 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 2185 ResourcePool::kDefaultExpirationDelay); | 2187 ResourcePool::kDefaultExpirationDelay); |
| 2186 | 2188 |
| 2187 *raster_buffer_provider = ZeroCopyRasterBufferProvider::Create( | 2189 *raster_buffer_provider = ZeroCopyRasterBufferProvider::Create( |
| 2188 resource_provider_.get(), | 2190 resource_provider_.get(), |
| 2189 settings_.renderer_settings.preferred_tile_format); | 2191 settings_.renderer_settings.preferred_tile_format); |
| 2190 return; | 2192 return; |
| 2191 } | 2193 } |
| 2192 | 2194 |
| 2193 *resource_pool = | 2195 *resource_pool = |
| 2194 ResourcePool::Create(resource_provider_.get(), GetTaskRunner(), | 2196 ResourcePool::Create(resource_provider_.get(), GetTaskRunner(), |
| 2197 ResourceProvider::TEXTURE_HINT_IMMUTABLE, |
| 2195 ResourcePool::kDefaultExpirationDelay); | 2198 ResourcePool::kDefaultExpirationDelay); |
| 2196 | 2199 |
| 2197 const int max_copy_texture_chromium_size = | 2200 const int max_copy_texture_chromium_size = |
| 2198 compositor_context_provider->ContextCapabilities() | 2201 compositor_context_provider->ContextCapabilities() |
| 2199 .max_copy_texture_chromium_size; | 2202 .max_copy_texture_chromium_size; |
| 2200 | 2203 |
| 2201 *raster_buffer_provider = base::MakeUnique<OneCopyRasterBufferProvider>( | 2204 *raster_buffer_provider = base::MakeUnique<OneCopyRasterBufferProvider>( |
| 2202 GetTaskRunner(), compositor_context_provider, worker_context_provider, | 2205 GetTaskRunner(), compositor_context_provider, worker_context_provider, |
| 2203 resource_provider_.get(), max_copy_texture_chromium_size, | 2206 resource_provider_.get(), max_copy_texture_chromium_size, |
| 2204 settings_.use_partial_raster, settings_.max_staging_buffer_usage_in_bytes, | 2207 settings_.use_partial_raster, settings_.max_staging_buffer_usage_in_bytes, |
| (...skipping 1872 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4077 worker_context_visibility_ = | 4080 worker_context_visibility_ = |
| 4078 worker_context->CacheController()->ClientBecameVisible(); | 4081 worker_context->CacheController()->ClientBecameVisible(); |
| 4079 } else { | 4082 } else { |
| 4080 worker_context->CacheController()->ClientBecameNotVisible( | 4083 worker_context->CacheController()->ClientBecameNotVisible( |
| 4081 std::move(worker_context_visibility_)); | 4084 std::move(worker_context_visibility_)); |
| 4082 } | 4085 } |
| 4083 } | 4086 } |
| 4084 } | 4087 } |
| 4085 | 4088 |
| 4086 } // namespace cc | 4089 } // namespace cc |
| OLD | NEW |