| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "gpu/command_buffer/service/texture_manager.h" | 5 #include "gpu/command_buffer/service/texture_manager.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> |
| 11 #include <set> | 11 #include <set> |
| 12 #include <utility> | 12 #include <utility> |
| 13 | 13 |
| 14 #include "base/bits.h" | 14 #include "base/bits.h" |
| 15 #include "base/format_macros.h" |
| 15 #include "base/lazy_instance.h" | 16 #include "base/lazy_instance.h" |
| 16 #include "base/metrics/histogram_macros.h" | 17 #include "base/metrics/histogram_macros.h" |
| 17 #include "base/strings/stringprintf.h" | 18 #include "base/strings/stringprintf.h" |
| 18 #include "base/threading/thread_task_runner_handle.h" | 19 #include "base/threading/thread_task_runner_handle.h" |
| 19 #include "base/trace_event/memory_dump_manager.h" | 20 #include "base/trace_event/memory_dump_manager.h" |
| 20 #include "gpu/command_buffer/common/gles2_cmd_utils.h" | 21 #include "gpu/command_buffer/common/gles2_cmd_utils.h" |
| 21 #include "gpu/command_buffer/service/context_state.h" | 22 #include "gpu/command_buffer/service/context_state.h" |
| 22 #include "gpu/command_buffer/service/error_state.h" | 23 #include "gpu/command_buffer/service/error_state.h" |
| 23 #include "gpu/command_buffer/service/feature_info.h" | 24 #include "gpu/command_buffer/service/feature_info.h" |
| 24 #include "gpu/command_buffer/service/framebuffer_manager.h" | 25 #include "gpu/command_buffer/service/framebuffer_manager.h" |
| (...skipping 3036 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3061 } | 3062 } |
| 3062 | 3063 |
| 3063 void TextureManager::DumpTextureRef(base::trace_event::ProcessMemoryDump* pmd, | 3064 void TextureManager::DumpTextureRef(base::trace_event::ProcessMemoryDump* pmd, |
| 3064 TextureRef* ref) { | 3065 TextureRef* ref) { |
| 3065 uint32_t size = ref->texture()->estimated_size(); | 3066 uint32_t size = ref->texture()->estimated_size(); |
| 3066 | 3067 |
| 3067 // Ignore unallocated texture IDs. | 3068 // Ignore unallocated texture IDs. |
| 3068 if (size == 0) | 3069 if (size == 0) |
| 3069 return; | 3070 return; |
| 3070 | 3071 |
| 3071 std::string dump_name = | 3072 std::string dump_name = base::StringPrintf( |
| 3072 base::StringPrintf("gpu/gl/textures/client_%d/texture_%d", | 3073 "gpu/gl/textures/share_group_%" PRIu64 "/texture_%d", |
| 3073 memory_tracker_->ClientId(), ref->client_id()); | 3074 memory_tracker_->ShareGroupTracingGUID(), ref->client_id()); |
| 3074 | 3075 |
| 3075 base::trace_event::MemoryAllocatorDump* dump = | 3076 base::trace_event::MemoryAllocatorDump* dump = |
| 3076 pmd->CreateAllocatorDump(dump_name); | 3077 pmd->CreateAllocatorDump(dump_name); |
| 3077 dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize, | 3078 dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize, |
| 3078 base::trace_event::MemoryAllocatorDump::kUnitsBytes, | 3079 base::trace_event::MemoryAllocatorDump::kUnitsBytes, |
| 3079 static_cast<uint64_t>(size)); | 3080 static_cast<uint64_t>(size)); |
| 3080 | 3081 |
| 3081 // Add the |client_guid| which expresses shared ownership with the client | 3082 // Add the |client_guid| which expresses shared ownership with the client |
| 3082 // process. | 3083 // process. |
| 3083 auto client_guid = gl::GetGLTextureClientGUIDForTracing( | 3084 auto client_guid = gl::GetGLTextureClientGUIDForTracing( |
| (...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3364 uint32_t TextureManager::GetServiceIdGeneration() const { | 3365 uint32_t TextureManager::GetServiceIdGeneration() const { |
| 3365 return current_service_id_generation_; | 3366 return current_service_id_generation_; |
| 3366 } | 3367 } |
| 3367 | 3368 |
| 3368 void TextureManager::IncrementServiceIdGeneration() { | 3369 void TextureManager::IncrementServiceIdGeneration() { |
| 3369 current_service_id_generation_++; | 3370 current_service_id_generation_++; |
| 3370 } | 3371 } |
| 3371 | 3372 |
| 3372 } // namespace gles2 | 3373 } // namespace gles2 |
| 3373 } // namespace gpu | 3374 } // namespace gpu |
| OLD | NEW |