| 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 |
| 11 #include "base/format_macros.h" |
| 11 #include "base/logging.h" | 12 #include "base/logging.h" |
| 12 #include "base/strings/stringprintf.h" | 13 #include "base/strings/stringprintf.h" |
| 13 #include "base/threading/thread_task_runner_handle.h" | 14 #include "base/threading/thread_task_runner_handle.h" |
| 14 #include "base/trace_event/memory_dump_manager.h" | 15 #include "base/trace_event/memory_dump_manager.h" |
| 15 #include "base/trace_event/trace_event.h" | 16 #include "base/trace_event/trace_event.h" |
| 16 #include "gpu/command_buffer/common/gles2_cmd_utils.h" | 17 #include "gpu/command_buffer/common/gles2_cmd_utils.h" |
| 17 #include "gpu/command_buffer/service/context_state.h" | 18 #include "gpu/command_buffer/service/context_state.h" |
| 18 #include "gpu/command_buffer/service/error_state.h" | 19 #include "gpu/command_buffer/service/error_state.h" |
| 19 #include "gpu/command_buffer/service/feature_info.h" | 20 #include "gpu/command_buffer/service/feature_info.h" |
| 20 #include "gpu/command_buffer/service/memory_tracking.h" | 21 #include "gpu/command_buffer/service/memory_tracking.h" |
| (...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 631 break; | 632 break; |
| 632 } | 633 } |
| 633 if (primitive_restart_fixed_index_ != index) { | 634 if (primitive_restart_fixed_index_ != index) { |
| 634 glPrimitiveRestartIndex(index); | 635 glPrimitiveRestartIndex(index); |
| 635 primitive_restart_fixed_index_ = index; | 636 primitive_restart_fixed_index_ = index; |
| 636 } | 637 } |
| 637 } | 638 } |
| 638 | 639 |
| 639 bool BufferManager::OnMemoryDump(const base::trace_event::MemoryDumpArgs& args, | 640 bool BufferManager::OnMemoryDump(const base::trace_event::MemoryDumpArgs& args, |
| 640 base::trace_event::ProcessMemoryDump* pmd) { | 641 base::trace_event::ProcessMemoryDump* pmd) { |
| 641 const int client_id = memory_tracker_->ClientId(); | 642 const uint64_t share_group_tracing_guid = |
| 643 memory_tracker_->ShareGroupTracingGUID(); |
| 642 for (const auto& buffer_entry : buffers_) { | 644 for (const auto& buffer_entry : buffers_) { |
| 643 const auto& client_buffer_id = buffer_entry.first; | 645 const auto& client_buffer_id = buffer_entry.first; |
| 644 const auto& buffer = buffer_entry.second; | 646 const auto& buffer = buffer_entry.second; |
| 645 | 647 |
| 646 std::string dump_name = base::StringPrintf( | 648 std::string dump_name = |
| 647 "gpu/gl/buffers/client_%d/buffer_%d", client_id, client_buffer_id); | 649 base::StringPrintf("gpu/gl/buffers/share_group_%" PRIu64 "/buffer_%d", |
| 650 share_group_tracing_guid, client_buffer_id); |
| 648 base::trace_event::MemoryAllocatorDump* dump = | 651 base::trace_event::MemoryAllocatorDump* dump = |
| 649 pmd->CreateAllocatorDump(dump_name); | 652 pmd->CreateAllocatorDump(dump_name); |
| 650 dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize, | 653 dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize, |
| 651 base::trace_event::MemoryAllocatorDump::kUnitsBytes, | 654 base::trace_event::MemoryAllocatorDump::kUnitsBytes, |
| 652 static_cast<uint64_t>(buffer->size())); | 655 static_cast<uint64_t>(buffer->size())); |
| 653 | 656 |
| 654 auto guid = gl::GetGLBufferGUIDForTracing( | 657 auto guid = gl::GetGLBufferGUIDForTracing(share_group_tracing_guid, |
| 655 memory_tracker_->ShareGroupTracingGUID(), client_buffer_id); | 658 client_buffer_id); |
| 656 pmd->CreateSharedGlobalAllocatorDump(guid); | 659 pmd->CreateSharedGlobalAllocatorDump(guid); |
| 657 pmd->AddOwnershipEdge(dump->guid(), guid); | 660 pmd->AddOwnershipEdge(dump->guid(), guid); |
| 658 } | 661 } |
| 659 return true; | 662 return true; |
| 660 } | 663 } |
| 661 | 664 |
| 662 } // namespace gles2 | 665 } // namespace gles2 |
| 663 } // namespace gpu | 666 } // namespace gpu |
| OLD | NEW |