| 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/buffer_manager.h" | 5 #include "gpu/command_buffer/service/buffer_manager.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <limits> | 9 #include <limits> |
| 10 | 10 |
| (...skipping 716 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 727 break; | 727 break; |
| 728 } | 728 } |
| 729 if (primitive_restart_fixed_index_ != index) { | 729 if (primitive_restart_fixed_index_ != index) { |
| 730 glPrimitiveRestartIndex(index); | 730 glPrimitiveRestartIndex(index); |
| 731 primitive_restart_fixed_index_ = index; | 731 primitive_restart_fixed_index_ = index; |
| 732 } | 732 } |
| 733 } | 733 } |
| 734 | 734 |
| 735 bool BufferManager::OnMemoryDump(const base::trace_event::MemoryDumpArgs& args, | 735 bool BufferManager::OnMemoryDump(const base::trace_event::MemoryDumpArgs& args, |
| 736 base::trace_event::ProcessMemoryDump* pmd) { | 736 base::trace_event::ProcessMemoryDump* pmd) { |
| 737 using base::trace_event::MemoryAllocatorDump; | |
| 738 using base::trace_event::MemoryDumpLevelOfDetail; | |
| 739 | |
| 740 if (args.level_of_detail == MemoryDumpLevelOfDetail::BACKGROUND) { | |
| 741 std::string dump_name = | |
| 742 base::StringPrintf("gpu/gl/buffers/share_group_%" PRIu64 "", | |
| 743 memory_tracker_->ShareGroupTracingGUID()); | |
| 744 MemoryAllocatorDump* dump = pmd->CreateAllocatorDump(dump_name); | |
| 745 dump->AddScalar(MemoryAllocatorDump::kNameSize, | |
| 746 MemoryAllocatorDump::kUnitsBytes, mem_represented()); | |
| 747 | |
| 748 // Early out, no need for more detail in a BACKGROUND dump. | |
| 749 return true; | |
| 750 } | |
| 751 | |
| 752 const uint64_t share_group_tracing_guid = | 737 const uint64_t share_group_tracing_guid = |
| 753 memory_tracker_->ShareGroupTracingGUID(); | 738 memory_tracker_->ShareGroupTracingGUID(); |
| 754 for (const auto& buffer_entry : buffers_) { | 739 for (const auto& buffer_entry : buffers_) { |
| 755 const auto& client_buffer_id = buffer_entry.first; | 740 const auto& client_buffer_id = buffer_entry.first; |
| 756 const auto& buffer = buffer_entry.second; | 741 const auto& buffer = buffer_entry.second; |
| 757 | 742 |
| 758 std::string dump_name = | 743 std::string dump_name = |
| 759 base::StringPrintf("gpu/gl/buffers/share_group_%" PRIu64 "/buffer_%d", | 744 base::StringPrintf("gpu/gl/buffers/share_group_%" PRIu64 "/buffer_%d", |
| 760 share_group_tracing_guid, client_buffer_id); | 745 share_group_tracing_guid, client_buffer_id); |
| 761 MemoryAllocatorDump* dump = pmd->CreateAllocatorDump(dump_name); | 746 base::trace_event::MemoryAllocatorDump* dump = |
| 762 dump->AddScalar(MemoryAllocatorDump::kNameSize, | 747 pmd->CreateAllocatorDump(dump_name); |
| 763 MemoryAllocatorDump::kUnitsBytes, | 748 dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize, |
| 749 base::trace_event::MemoryAllocatorDump::kUnitsBytes, |
| 764 static_cast<uint64_t>(buffer->size())); | 750 static_cast<uint64_t>(buffer->size())); |
| 765 | 751 |
| 766 auto guid = gl::GetGLBufferGUIDForTracing(share_group_tracing_guid, | 752 auto guid = gl::GetGLBufferGUIDForTracing(share_group_tracing_guid, |
| 767 client_buffer_id); | 753 client_buffer_id); |
| 768 pmd->CreateSharedGlobalAllocatorDump(guid); | 754 pmd->CreateSharedGlobalAllocatorDump(guid); |
| 769 pmd->AddOwnershipEdge(dump->guid(), guid); | 755 pmd->AddOwnershipEdge(dump->guid(), guid); |
| 770 } | 756 } |
| 771 | |
| 772 return true; | 757 return true; |
| 773 } | 758 } |
| 774 | 759 |
| 775 } // namespace gles2 | 760 } // namespace gles2 |
| 776 } // namespace gpu | 761 } // namespace gpu |
| OLD | NEW |