| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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/resources/resource_provider.h" | 5 #include "cc/resources/resource_provider.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 | 9 |
| 10 #include "base/containers/hash_tables.h" | 10 #include "base/containers/hash_tables.h" |
| 11 #include "base/debug/trace_event.h" | 11 #include "base/debug/trace_event.h" |
| 12 #include "base/stl_util.h" | 12 #include "base/stl_util.h" |
| 13 #include "base/strings/string_split.h" | 13 #include "base/strings/string_split.h" |
| 14 #include "base/strings/string_util.h" | 14 #include "base/strings/string_util.h" |
| 15 #include "cc/base/util.h" | 15 #include "cc/base/util.h" |
| 16 #include "cc/output/gl_renderer.h" // For the GLC() macro. | 16 #include "cc/output/gl_renderer.h" // For the GLC() macro. |
| 17 #include "cc/resources/gpu_memory_buffer_manager.h" |
| 17 #include "cc/resources/platform_color.h" | 18 #include "cc/resources/platform_color.h" |
| 18 #include "cc/resources/returned_resource.h" | 19 #include "cc/resources/returned_resource.h" |
| 19 #include "cc/resources/shared_bitmap_manager.h" | 20 #include "cc/resources/shared_bitmap_manager.h" |
| 20 #include "cc/resources/texture_uploader.h" | 21 #include "cc/resources/texture_uploader.h" |
| 21 #include "cc/resources/transferable_resource.h" | 22 #include "cc/resources/transferable_resource.h" |
| 22 #include "gpu/GLES2/gl2extchromium.h" | 23 #include "gpu/GLES2/gl2extchromium.h" |
| 23 #include "gpu/command_buffer/client/gles2_interface.h" | 24 #include "gpu/command_buffer/client/gles2_interface.h" |
| 24 #include "third_party/khronos/GLES2/gl2.h" | 25 #include "third_party/khronos/GLES2/gl2.h" |
| 25 #include "third_party/khronos/GLES2/gl2ext.h" | 26 #include "third_party/khronos/GLES2/gl2ext.h" |
| 26 #include "third_party/skia/include/core/SkSurface.h" | 27 #include "third_party/skia/include/core/SkSurface.h" |
| 27 #include "third_party/skia/include/gpu/GrContext.h" | 28 #include "third_party/skia/include/gpu/GrContext.h" |
| 28 #include "ui/gfx/frame_time.h" | 29 #include "ui/gfx/frame_time.h" |
| 30 #include "ui/gfx/gpu_memory_buffer.h" |
| 29 #include "ui/gfx/rect.h" | 31 #include "ui/gfx/rect.h" |
| 30 #include "ui/gfx/vector2d.h" | 32 #include "ui/gfx/vector2d.h" |
| 31 | 33 |
| 32 using gpu::gles2::GLES2Interface; | 34 using gpu::gles2::GLES2Interface; |
| 33 | 35 |
| 34 namespace cc { | 36 namespace cc { |
| 35 | 37 |
| 36 class IdAllocator { | 38 class IdAllocator { |
| 37 public: | 39 public: |
| 38 virtual ~IdAllocator() {} | 40 virtual ~IdAllocator() {} |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 return kBGRA_8888_GrPixelConfig; | 106 return kBGRA_8888_GrPixelConfig; |
| 105 case RGBA_4444: | 107 case RGBA_4444: |
| 106 return kRGBA_4444_GrPixelConfig; | 108 return kRGBA_4444_GrPixelConfig; |
| 107 default: | 109 default: |
| 108 break; | 110 break; |
| 109 } | 111 } |
| 110 DCHECK(false) << "Unsupported resource format."; | 112 DCHECK(false) << "Unsupported resource format."; |
| 111 return kSkia8888_GrPixelConfig; | 113 return kSkia8888_GrPixelConfig; |
| 112 } | 114 } |
| 113 | 115 |
| 116 gfx::GpuMemoryBuffer::Format ToGpuMemoryBufferFormat(ResourceFormat format) { |
| 117 switch (format) { |
| 118 case RGBA_8888: |
| 119 return gfx::GpuMemoryBuffer::Format::RGBA_8888; |
| 120 case BGRA_8888: |
| 121 return gfx::GpuMemoryBuffer::Format::BGRA_8888; |
| 122 case RGBA_4444: |
| 123 case ALPHA_8: |
| 124 case LUMINANCE_8: |
| 125 case RGB_565: |
| 126 case ETC1: |
| 127 break; |
| 128 } |
| 129 NOTREACHED(); |
| 130 return gfx::GpuMemoryBuffer::Format::RGBA_8888; |
| 131 } |
| 132 |
| 114 class ScopedSetActiveTexture { | 133 class ScopedSetActiveTexture { |
| 115 public: | 134 public: |
| 116 ScopedSetActiveTexture(GLES2Interface* gl, GLenum unit) | 135 ScopedSetActiveTexture(GLES2Interface* gl, GLenum unit) |
| 117 : gl_(gl), unit_(unit) { | 136 : gl_(gl), unit_(unit) { |
| 118 DCHECK_EQ(GL_TEXTURE0, ResourceProvider::GetActiveTextureUnit(gl_)); | 137 DCHECK_EQ(GL_TEXTURE0, ResourceProvider::GetActiveTextureUnit(gl_)); |
| 119 | 138 |
| 120 if (unit_ != GL_TEXTURE0) | 139 if (unit_ != GL_TEXTURE0) |
| 121 GLC(gl_, gl_->ActiveTexture(unit_)); | 140 GLC(gl_, gl_->ActiveTexture(unit_)); |
| 122 } | 141 } |
| 123 | 142 |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 target(0), | 251 target(0), |
| 233 original_filter(0), | 252 original_filter(0), |
| 234 filter(0), | 253 filter(0), |
| 235 image_id(0), | 254 image_id(0), |
| 236 bound_image_id(0), | 255 bound_image_id(0), |
| 237 texture_pool(0), | 256 texture_pool(0), |
| 238 wrap_mode(0), | 257 wrap_mode(0), |
| 239 hint(TextureHintImmutable), | 258 hint(TextureHintImmutable), |
| 240 type(InvalidType), | 259 type(InvalidType), |
| 241 format(RGBA_8888), | 260 format(RGBA_8888), |
| 242 shared_bitmap(NULL) { | 261 shared_bitmap(NULL), |
| 262 gpu_memory_buffer(NULL) { |
| 243 } | 263 } |
| 244 | 264 |
| 245 ResourceProvider::Resource::~Resource() {} | 265 ResourceProvider::Resource::~Resource() {} |
| 246 | 266 |
| 247 ResourceProvider::Resource::Resource(GLuint texture_id, | 267 ResourceProvider::Resource::Resource(GLuint texture_id, |
| 248 const gfx::Size& size, | 268 const gfx::Size& size, |
| 249 Origin origin, | 269 Origin origin, |
| 250 GLenum target, | 270 GLenum target, |
| 251 GLenum filter, | 271 GLenum filter, |
| 252 GLenum texture_pool, | 272 GLenum texture_pool, |
| (...skipping 25 matching lines...) Expand all Loading... |
| 278 target(target), | 298 target(target), |
| 279 original_filter(filter), | 299 original_filter(filter), |
| 280 filter(filter), | 300 filter(filter), |
| 281 image_id(0), | 301 image_id(0), |
| 282 bound_image_id(0), | 302 bound_image_id(0), |
| 283 texture_pool(texture_pool), | 303 texture_pool(texture_pool), |
| 284 wrap_mode(wrap_mode), | 304 wrap_mode(wrap_mode), |
| 285 hint(hint), | 305 hint(hint), |
| 286 type(GLTexture), | 306 type(GLTexture), |
| 287 format(format), | 307 format(format), |
| 288 shared_bitmap(NULL) { | 308 shared_bitmap(NULL), |
| 309 gpu_memory_buffer(NULL) { |
| 289 DCHECK(wrap_mode == GL_CLAMP_TO_EDGE || wrap_mode == GL_REPEAT); | 310 DCHECK(wrap_mode == GL_CLAMP_TO_EDGE || wrap_mode == GL_REPEAT); |
| 290 DCHECK_EQ(origin == Internal, !!texture_pool); | 311 DCHECK_EQ(origin == Internal, !!texture_pool); |
| 291 } | 312 } |
| 292 | 313 |
| 293 ResourceProvider::Resource::Resource(uint8_t* pixels, | 314 ResourceProvider::Resource::Resource(uint8_t* pixels, |
| 294 SharedBitmap* bitmap, | 315 SharedBitmap* bitmap, |
| 295 const gfx::Size& size, | 316 const gfx::Size& size, |
| 296 Origin origin, | 317 Origin origin, |
| 297 GLenum filter, | 318 GLenum filter, |
| 298 GLint wrap_mode) | 319 GLint wrap_mode) |
| (...skipping 22 matching lines...) Expand all Loading... |
| 321 target(0), | 342 target(0), |
| 322 original_filter(filter), | 343 original_filter(filter), |
| 323 filter(filter), | 344 filter(filter), |
| 324 image_id(0), | 345 image_id(0), |
| 325 bound_image_id(0), | 346 bound_image_id(0), |
| 326 texture_pool(0), | 347 texture_pool(0), |
| 327 wrap_mode(wrap_mode), | 348 wrap_mode(wrap_mode), |
| 328 hint(TextureHintImmutable), | 349 hint(TextureHintImmutable), |
| 329 type(Bitmap), | 350 type(Bitmap), |
| 330 format(RGBA_8888), | 351 format(RGBA_8888), |
| 331 shared_bitmap(bitmap) { | 352 shared_bitmap(bitmap), |
| 353 gpu_memory_buffer(NULL) { |
| 332 DCHECK(wrap_mode == GL_CLAMP_TO_EDGE || wrap_mode == GL_REPEAT); | 354 DCHECK(wrap_mode == GL_CLAMP_TO_EDGE || wrap_mode == GL_REPEAT); |
| 333 DCHECK(origin == Delegated || pixels); | 355 DCHECK(origin == Delegated || pixels); |
| 334 if (bitmap) | 356 if (bitmap) |
| 335 shared_bitmap_id = bitmap->id(); | 357 shared_bitmap_id = bitmap->id(); |
| 336 } | 358 } |
| 337 | 359 |
| 338 ResourceProvider::Resource::Resource(const SharedBitmapId& bitmap_id, | 360 ResourceProvider::Resource::Resource(const SharedBitmapId& bitmap_id, |
| 339 const gfx::Size& size, | 361 const gfx::Size& size, |
| 340 Origin origin, | 362 Origin origin, |
| 341 GLenum filter, | 363 GLenum filter, |
| (...skipping 24 matching lines...) Expand all Loading... |
| 366 original_filter(filter), | 388 original_filter(filter), |
| 367 filter(filter), | 389 filter(filter), |
| 368 image_id(0), | 390 image_id(0), |
| 369 bound_image_id(0), | 391 bound_image_id(0), |
| 370 texture_pool(0), | 392 texture_pool(0), |
| 371 wrap_mode(wrap_mode), | 393 wrap_mode(wrap_mode), |
| 372 hint(TextureHintImmutable), | 394 hint(TextureHintImmutable), |
| 373 type(Bitmap), | 395 type(Bitmap), |
| 374 format(RGBA_8888), | 396 format(RGBA_8888), |
| 375 shared_bitmap_id(bitmap_id), | 397 shared_bitmap_id(bitmap_id), |
| 376 shared_bitmap(NULL) { | 398 shared_bitmap(NULL), |
| 399 gpu_memory_buffer(NULL) { |
| 377 DCHECK(wrap_mode == GL_CLAMP_TO_EDGE || wrap_mode == GL_REPEAT); | 400 DCHECK(wrap_mode == GL_CLAMP_TO_EDGE || wrap_mode == GL_REPEAT); |
| 378 } | 401 } |
| 379 | 402 |
| 380 ResourceProvider::Child::Child() : marked_for_deletion(false) {} | 403 ResourceProvider::Child::Child() : marked_for_deletion(false) {} |
| 381 | 404 |
| 382 ResourceProvider::Child::~Child() {} | 405 ResourceProvider::Child::~Child() {} |
| 383 | 406 |
| 384 scoped_ptr<ResourceProvider> ResourceProvider::Create( | 407 scoped_ptr<ResourceProvider> ResourceProvider::Create( |
| 385 OutputSurface* output_surface, | 408 OutputSurface* output_surface, |
| 386 SharedBitmapManager* shared_bitmap_manager, | 409 SharedBitmapManager* shared_bitmap_manager, |
| 410 GpuMemoryBufferManager* gpu_memory_buffer_manager, |
| 387 BlockingTaskRunner* blocking_main_thread_task_runner, | 411 BlockingTaskRunner* blocking_main_thread_task_runner, |
| 388 int highp_threshold_min, | 412 int highp_threshold_min, |
| 389 bool use_rgba_4444_texture_format, | 413 bool use_rgba_4444_texture_format, |
| 390 size_t id_allocation_chunk_size, | 414 size_t id_allocation_chunk_size, |
| 391 bool use_distance_field_text) { | 415 bool use_distance_field_text) { |
| 392 scoped_ptr<ResourceProvider> resource_provider( | 416 scoped_ptr<ResourceProvider> resource_provider( |
| 393 new ResourceProvider(output_surface, | 417 new ResourceProvider(output_surface, |
| 394 shared_bitmap_manager, | 418 shared_bitmap_manager, |
| 419 gpu_memory_buffer_manager, |
| 395 blocking_main_thread_task_runner, | 420 blocking_main_thread_task_runner, |
| 396 highp_threshold_min, | 421 highp_threshold_min, |
| 397 use_rgba_4444_texture_format, | 422 use_rgba_4444_texture_format, |
| 398 id_allocation_chunk_size, | 423 id_allocation_chunk_size, |
| 399 use_distance_field_text)); | 424 use_distance_field_text)); |
| 400 | 425 |
| 401 if (resource_provider->ContextGL()) | 426 if (resource_provider->ContextGL()) |
| 402 resource_provider->InitializeGL(); | 427 resource_provider->InitializeGL(); |
| 403 else | 428 else |
| 404 resource_provider->InitializeSoftware(); | 429 resource_provider->InitializeSoftware(); |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 692 if (resource->shared_bitmap) { | 717 if (resource->shared_bitmap) { |
| 693 DCHECK(resource->origin != Resource::External); | 718 DCHECK(resource->origin != Resource::External); |
| 694 DCHECK_EQ(Bitmap, resource->type); | 719 DCHECK_EQ(Bitmap, resource->type); |
| 695 delete resource->shared_bitmap; | 720 delete resource->shared_bitmap; |
| 696 resource->pixels = NULL; | 721 resource->pixels = NULL; |
| 697 } | 722 } |
| 698 if (resource->pixels) { | 723 if (resource->pixels) { |
| 699 DCHECK(resource->origin == Resource::Internal); | 724 DCHECK(resource->origin == Resource::Internal); |
| 700 delete[] resource->pixels; | 725 delete[] resource->pixels; |
| 701 } | 726 } |
| 727 if (resource->gpu_memory_buffer) { |
| 728 DCHECK(resource->origin != Resource::External); |
| 729 delete resource->gpu_memory_buffer; |
| 730 } |
| 702 resources_.erase(it); | 731 resources_.erase(it); |
| 703 } | 732 } |
| 704 | 733 |
| 705 ResourceProvider::ResourceType ResourceProvider::GetResourceType( | 734 ResourceProvider::ResourceType ResourceProvider::GetResourceType( |
| 706 ResourceId id) { | 735 ResourceId id) { |
| 707 return GetResource(id)->type; | 736 return GetResource(id)->type; |
| 708 } | 737 } |
| 709 | 738 |
| 710 void ResourceProvider::SetPixels(ResourceId id, | 739 void ResourceProvider::SetPixels(ResourceId id, |
| 711 const uint8_t* image, | 740 const uint8_t* image, |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 917 DCHECK(resource->origin == Resource::Internal); | 946 DCHECK(resource->origin == Resource::Internal); |
| 918 resource->locked_for_write = false; | 947 resource->locked_for_write = false; |
| 919 } | 948 } |
| 920 | 949 |
| 921 const ResourceProvider::Resource* | 950 const ResourceProvider::Resource* |
| 922 ResourceProvider::LockForWriteToGpuMemoryBuffer(ResourceId id) { | 951 ResourceProvider::LockForWriteToGpuMemoryBuffer(ResourceId id) { |
| 923 Resource* resource = GetResource(id); | 952 Resource* resource = GetResource(id); |
| 924 DCHECK_EQ(GLTexture, resource->type); | 953 DCHECK_EQ(GLTexture, resource->type); |
| 925 DCHECK(CanLockForWrite(id)); | 954 DCHECK(CanLockForWrite(id)); |
| 926 | 955 |
| 927 if (!resource->image_id) { | 956 if (!resource->gpu_memory_buffer) { |
| 957 scoped_ptr<gfx::GpuMemoryBuffer> gpu_memory_buffer = |
| 958 gpu_memory_buffer_manager_->AllocateGpuMemoryBuffer( |
| 959 resource->size, |
| 960 ToGpuMemoryBufferFormat(resource->format), |
| 961 gfx::GpuMemoryBuffer::MAP); |
| 962 resource->gpu_memory_buffer = gpu_memory_buffer.release(); |
| 928 resource->allocated = true; | 963 resource->allocated = true; |
| 929 GLES2Interface* gl = ContextGL(); | |
| 930 DCHECK(gl); | |
| 931 resource->image_id = | |
| 932 gl->CreateImageCHROMIUM(resource->size.width(), | |
| 933 resource->size.height(), | |
| 934 TextureToStorageFormat(resource->format), | |
| 935 GL_IMAGE_MAP_CHROMIUM); | |
| 936 DCHECK(resource->image_id); | |
| 937 } | 964 } |
| 938 | 965 |
| 939 resource->locked_for_write = true; | 966 resource->locked_for_write = true; |
| 940 return resource; | 967 return resource; |
| 941 } | 968 } |
| 942 | 969 |
| 943 void ResourceProvider::UnlockForWriteToGpuMemoryBuffer(ResourceId id) { | 970 void ResourceProvider::UnlockForWriteToGpuMemoryBuffer(ResourceId id) { |
| 944 Resource* resource = GetResource(id); | 971 Resource* resource = GetResource(id); |
| 945 DCHECK(resource->locked_for_write); | 972 DCHECK(resource->locked_for_write); |
| 946 DCHECK_EQ(resource->exported_count, 0); | 973 DCHECK_EQ(resource->exported_count, 0); |
| 947 DCHECK(resource->origin == Resource::Internal); | 974 DCHECK(resource->origin == Resource::Internal); |
| 948 DCHECK_EQ(GLTexture, resource->type); | 975 DCHECK_EQ(GLTexture, resource->type); |
| 949 | 976 |
| 977 if (!resource->image_id) { |
| 978 GLES2Interface* gl = ContextGL(); |
| 979 DCHECK(gl); |
| 980 resource->image_id = |
| 981 gl->CreateImageCHROMIUM(resource->gpu_memory_buffer->AsClientBuffer(), |
| 982 resource->size.width(), |
| 983 resource->size.height(), |
| 984 GL_RGBA); |
| 985 DCHECK(resource->image_id); |
| 986 } |
| 987 |
| 950 resource->locked_for_write = false; | 988 resource->locked_for_write = false; |
| 951 resource->dirty_image = true; | 989 resource->dirty_image = true; |
| 952 | 990 |
| 953 // GpuMemoryBuffer provides direct access to the memory used by the GPU. | 991 // GpuMemoryBuffer provides direct access to the memory used by the GPU. |
| 954 // Read lock fences are required to ensure that we're not trying to map a | 992 // Read lock fences are required to ensure that we're not trying to map a |
| 955 // buffer that is currently in-use by the GPU. | 993 // buffer that is currently in-use by the GPU. |
| 956 resource->read_lock_fences_enabled = true; | 994 resource->read_lock_fences_enabled = true; |
| 957 } | 995 } |
| 958 | 996 |
| 959 const ResourceProvider::Resource* ResourceProvider::LockForWriteToSkSurface( | 997 const ResourceProvider::Resource* ResourceProvider::LockForWriteToSkSurface( |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1082 | 1120 |
| 1083 ResourceProvider::ScopedWriteLockSoftware::~ScopedWriteLockSoftware() { | 1121 ResourceProvider::ScopedWriteLockSoftware::~ScopedWriteLockSoftware() { |
| 1084 resource_provider_->UnlockForWrite(resource_id_); | 1122 resource_provider_->UnlockForWrite(resource_id_); |
| 1085 } | 1123 } |
| 1086 | 1124 |
| 1087 ResourceProvider::ScopedWriteLockGpuMemoryBuffer:: | 1125 ResourceProvider::ScopedWriteLockGpuMemoryBuffer:: |
| 1088 ScopedWriteLockGpuMemoryBuffer(ResourceProvider* resource_provider, | 1126 ScopedWriteLockGpuMemoryBuffer(ResourceProvider* resource_provider, |
| 1089 ResourceProvider::ResourceId resource_id) | 1127 ResourceProvider::ResourceId resource_id) |
| 1090 : resource_provider_(resource_provider), | 1128 : resource_provider_(resource_provider), |
| 1091 resource_id_(resource_id), | 1129 resource_id_(resource_id), |
| 1092 image_id_(resource_provider->LockForWriteToGpuMemoryBuffer(resource_id) | |
| 1093 ->image_id), | |
| 1094 gpu_memory_buffer_( | 1130 gpu_memory_buffer_( |
| 1095 resource_provider->ContextGL()->MapImageCHROMIUM(image_id_)) { | 1131 resource_provider->LockForWriteToGpuMemoryBuffer(resource_id) |
| 1096 resource_provider->ContextGL()->GetImageParameterivCHROMIUM( | 1132 ->gpu_memory_buffer) { |
| 1097 image_id_, GL_IMAGE_ROWBYTES_CHROMIUM, &stride_); | |
| 1098 } | 1133 } |
| 1099 | 1134 |
| 1100 ResourceProvider::ScopedWriteLockGpuMemoryBuffer:: | 1135 ResourceProvider::ScopedWriteLockGpuMemoryBuffer:: |
| 1101 ~ScopedWriteLockGpuMemoryBuffer() { | 1136 ~ScopedWriteLockGpuMemoryBuffer() { |
| 1102 resource_provider_->ContextGL()->UnmapImageCHROMIUM(image_id_); | |
| 1103 resource_provider_->UnlockForWriteToGpuMemoryBuffer(resource_id_); | 1137 resource_provider_->UnlockForWriteToGpuMemoryBuffer(resource_id_); |
| 1104 } | 1138 } |
| 1105 | 1139 |
| 1106 ResourceProvider::ScopedWriteLockGr::ScopedWriteLockGr( | 1140 ResourceProvider::ScopedWriteLockGr::ScopedWriteLockGr( |
| 1107 ResourceProvider* resource_provider, | 1141 ResourceProvider* resource_provider, |
| 1108 ResourceProvider::ResourceId resource_id) | 1142 ResourceProvider::ResourceId resource_id) |
| 1109 : resource_provider_(resource_provider), | 1143 : resource_provider_(resource_provider), |
| 1110 resource_id_(resource_id), | 1144 resource_id_(resource_id), |
| 1111 sk_surface_(resource_provider->LockForWriteToSkSurface(resource_id) | 1145 sk_surface_(resource_provider->LockForWriteToSkSurface(resource_id) |
| 1112 ->sk_surface.get()) { | 1146 ->sk_surface.get()) { |
| 1113 } | 1147 } |
| 1114 | 1148 |
| 1115 ResourceProvider::ScopedWriteLockGr::~ScopedWriteLockGr() { | 1149 ResourceProvider::ScopedWriteLockGr::~ScopedWriteLockGr() { |
| 1116 resource_provider_->UnlockForWriteToSkSurface(resource_id_); | 1150 resource_provider_->UnlockForWriteToSkSurface(resource_id_); |
| 1117 } | 1151 } |
| 1118 | 1152 |
| 1119 ResourceProvider::ResourceProvider( | 1153 ResourceProvider::ResourceProvider( |
| 1120 OutputSurface* output_surface, | 1154 OutputSurface* output_surface, |
| 1121 SharedBitmapManager* shared_bitmap_manager, | 1155 SharedBitmapManager* shared_bitmap_manager, |
| 1156 GpuMemoryBufferManager* gpu_memory_buffer_manager, |
| 1122 BlockingTaskRunner* blocking_main_thread_task_runner, | 1157 BlockingTaskRunner* blocking_main_thread_task_runner, |
| 1123 int highp_threshold_min, | 1158 int highp_threshold_min, |
| 1124 bool use_rgba_4444_texture_format, | 1159 bool use_rgba_4444_texture_format, |
| 1125 size_t id_allocation_chunk_size, | 1160 size_t id_allocation_chunk_size, |
| 1126 bool use_distance_field_text) | 1161 bool use_distance_field_text) |
| 1127 : output_surface_(output_surface), | 1162 : output_surface_(output_surface), |
| 1128 shared_bitmap_manager_(shared_bitmap_manager), | 1163 shared_bitmap_manager_(shared_bitmap_manager), |
| 1164 gpu_memory_buffer_manager_(gpu_memory_buffer_manager), |
| 1129 blocking_main_thread_task_runner_(blocking_main_thread_task_runner), | 1165 blocking_main_thread_task_runner_(blocking_main_thread_task_runner), |
| 1130 lost_output_surface_(false), | 1166 lost_output_surface_(false), |
| 1131 highp_threshold_min_(highp_threshold_min), | 1167 highp_threshold_min_(highp_threshold_min), |
| 1132 next_id_(1), | 1168 next_id_(1), |
| 1133 next_child_(1), | 1169 next_child_(1), |
| 1134 default_resource_type_(InvalidType), | 1170 default_resource_type_(InvalidType), |
| 1135 use_texture_storage_ext_(false), | 1171 use_texture_storage_ext_(false), |
| 1136 use_texture_format_bgra_(false), | 1172 use_texture_format_bgra_(false), |
| 1137 use_texture_usage_hint_(false), | 1173 use_texture_usage_hint_(false), |
| 1138 use_compressed_texture_etc1_(false), | 1174 use_compressed_texture_etc1_(false), |
| (...skipping 915 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2054 ContextProvider* context_provider = output_surface_->context_provider(); | 2090 ContextProvider* context_provider = output_surface_->context_provider(); |
| 2055 return context_provider ? context_provider->ContextGL() : NULL; | 2091 return context_provider ? context_provider->ContextGL() : NULL; |
| 2056 } | 2092 } |
| 2057 | 2093 |
| 2058 class GrContext* ResourceProvider::GrContext() const { | 2094 class GrContext* ResourceProvider::GrContext() const { |
| 2059 ContextProvider* context_provider = output_surface_->context_provider(); | 2095 ContextProvider* context_provider = output_surface_->context_provider(); |
| 2060 return context_provider ? context_provider->GrContext() : NULL; | 2096 return context_provider ? context_provider->GrContext() : NULL; |
| 2061 } | 2097 } |
| 2062 | 2098 |
| 2063 } // namespace cc | 2099 } // namespace cc |
| OLD | NEW |