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/atomic_sequence_num.h" | 10 #include "base/atomic_sequence_num.h" |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 } | 327 } |
328 | 328 |
329 ResourceProvider::Child::~Child() {} | 329 ResourceProvider::Child::~Child() {} |
330 | 330 |
331 scoped_ptr<ResourceProvider> ResourceProvider::Create( | 331 scoped_ptr<ResourceProvider> ResourceProvider::Create( |
332 OutputSurface* output_surface, | 332 OutputSurface* output_surface, |
333 SharedBitmapManager* shared_bitmap_manager, | 333 SharedBitmapManager* shared_bitmap_manager, |
334 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, | 334 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, |
335 BlockingTaskRunner* blocking_main_thread_task_runner, | 335 BlockingTaskRunner* blocking_main_thread_task_runner, |
336 int highp_threshold_min, | 336 int highp_threshold_min, |
337 bool use_rgba_4444_texture_format, | |
338 size_t id_allocation_chunk_size, | 337 size_t id_allocation_chunk_size, |
339 const std::vector<unsigned>& use_image_texture_targets) { | 338 const std::vector<unsigned>& use_image_texture_targets) { |
340 scoped_ptr<ResourceProvider> resource_provider(new ResourceProvider( | 339 scoped_ptr<ResourceProvider> resource_provider(new ResourceProvider( |
341 output_surface, shared_bitmap_manager, gpu_memory_buffer_manager, | 340 output_surface, shared_bitmap_manager, gpu_memory_buffer_manager, |
342 blocking_main_thread_task_runner, highp_threshold_min, | 341 blocking_main_thread_task_runner, highp_threshold_min, |
343 use_rgba_4444_texture_format, id_allocation_chunk_size, | 342 id_allocation_chunk_size, use_image_texture_targets)); |
344 use_image_texture_targets)); | |
345 resource_provider->Initialize(); | 343 resource_provider->Initialize(); |
346 return resource_provider; | 344 return resource_provider; |
347 } | 345 } |
348 | 346 |
349 ResourceProvider::~ResourceProvider() { | 347 ResourceProvider::~ResourceProvider() { |
350 base::trace_event::MemoryDumpManager::GetInstance()->UnregisterDumpProvider( | 348 base::trace_event::MemoryDumpManager::GetInstance()->UnregisterDumpProvider( |
351 this); | 349 this); |
352 | 350 |
353 while (!children_.empty()) | 351 while (!children_.empty()) |
354 DestroyChildInternal(children_.begin(), FOR_SHUTDOWN); | 352 DestroyChildInternal(children_.begin(), FOR_SHUTDOWN); |
(...skipping 659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1014 TRACE_EVENT0("cc", "ResourceProvider::SynchronousFence::Synchronize"); | 1012 TRACE_EVENT0("cc", "ResourceProvider::SynchronousFence::Synchronize"); |
1015 gl_->Finish(); | 1013 gl_->Finish(); |
1016 } | 1014 } |
1017 | 1015 |
1018 ResourceProvider::ResourceProvider( | 1016 ResourceProvider::ResourceProvider( |
1019 OutputSurface* output_surface, | 1017 OutputSurface* output_surface, |
1020 SharedBitmapManager* shared_bitmap_manager, | 1018 SharedBitmapManager* shared_bitmap_manager, |
1021 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, | 1019 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, |
1022 BlockingTaskRunner* blocking_main_thread_task_runner, | 1020 BlockingTaskRunner* blocking_main_thread_task_runner, |
1023 int highp_threshold_min, | 1021 int highp_threshold_min, |
1024 bool use_rgba_4444_texture_format, | |
1025 size_t id_allocation_chunk_size, | 1022 size_t id_allocation_chunk_size, |
1026 const std::vector<unsigned>& use_image_texture_targets) | 1023 const std::vector<unsigned>& use_image_texture_targets) |
1027 : output_surface_(output_surface), | 1024 : output_surface_(output_surface), |
1028 shared_bitmap_manager_(shared_bitmap_manager), | 1025 shared_bitmap_manager_(shared_bitmap_manager), |
1029 gpu_memory_buffer_manager_(gpu_memory_buffer_manager), | 1026 gpu_memory_buffer_manager_(gpu_memory_buffer_manager), |
1030 blocking_main_thread_task_runner_(blocking_main_thread_task_runner), | 1027 blocking_main_thread_task_runner_(blocking_main_thread_task_runner), |
1031 lost_output_surface_(false), | 1028 lost_output_surface_(false), |
1032 highp_threshold_min_(highp_threshold_min), | 1029 highp_threshold_min_(highp_threshold_min), |
1033 next_id_(1), | 1030 next_id_(1), |
1034 next_child_(1), | 1031 next_child_(1), |
1035 default_resource_type_(RESOURCE_TYPE_BITMAP), | 1032 default_resource_type_(RESOURCE_TYPE_BITMAP), |
1036 use_texture_storage_ext_(false), | 1033 use_texture_storage_ext_(false), |
1037 use_texture_format_bgra_(false), | 1034 use_texture_format_bgra_(false), |
1038 use_texture_usage_hint_(false), | 1035 use_texture_usage_hint_(false), |
1039 use_compressed_texture_etc1_(false), | 1036 use_compressed_texture_etc1_(false), |
1040 yuv_resource_format_(LUMINANCE_8), | 1037 yuv_resource_format_(LUMINANCE_8), |
1041 max_texture_size_(0), | 1038 max_texture_size_(0), |
1042 best_texture_format_(RGBA_8888), | 1039 best_texture_format_(RGBA_8888), |
1043 best_render_buffer_format_(RGBA_8888), | 1040 best_render_buffer_format_(RGBA_8888), |
1044 use_rgba_4444_texture_format_(use_rgba_4444_texture_format), | |
1045 id_allocation_chunk_size_(id_allocation_chunk_size), | 1041 id_allocation_chunk_size_(id_allocation_chunk_size), |
1046 use_sync_query_(false), | 1042 use_sync_query_(false), |
1047 use_image_texture_targets_(use_image_texture_targets), | 1043 use_image_texture_targets_(use_image_texture_targets), |
1048 tracing_id_(g_next_resource_provider_tracing_id.GetNext()) { | 1044 tracing_id_(g_next_resource_provider_tracing_id.GetNext()) { |
1049 DCHECK(output_surface_->HasClient()); | 1045 DCHECK(output_surface_->HasClient()); |
1050 DCHECK(id_allocation_chunk_size_); | 1046 DCHECK(id_allocation_chunk_size_); |
1051 } | 1047 } |
1052 | 1048 |
1053 void ResourceProvider::Initialize() { | 1049 void ResourceProvider::Initialize() { |
1054 DCHECK(thread_checker_.CalledOnValidThread()); | 1050 DCHECK(thread_checker_.CalledOnValidThread()); |
(...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1660 const int kImportance = 2; | 1656 const int kImportance = 2; |
1661 pmd->CreateSharedGlobalAllocatorDump(guid); | 1657 pmd->CreateSharedGlobalAllocatorDump(guid); |
1662 pmd->AddOwnershipEdge(dump->guid(), guid, kImportance); | 1658 pmd->AddOwnershipEdge(dump->guid(), guid, kImportance); |
1663 } | 1659 } |
1664 } | 1660 } |
1665 | 1661 |
1666 return true; | 1662 return true; |
1667 } | 1663 } |
1668 | 1664 |
1669 } // namespace cc | 1665 } // namespace cc |
OLD | NEW |