| 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 // This file contains the implementation of the command buffer helper class. | 5 // This file contains the implementation of the command buffer helper class. |
| 6 | 6 |
| 7 #include "gpu/command_buffer/client/cmd_buffer_helper.h" | 7 #include "gpu/command_buffer/client/cmd_buffer_helper.h" |
| 8 | 8 |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| 11 #include <algorithm> | 11 #include <algorithm> |
| 12 #include "base/logging.h" | 12 #include "base/logging.h" |
| 13 #include "base/memory/shared_memory_tracker.h" |
| 13 #include "base/strings/stringprintf.h" | 14 #include "base/strings/stringprintf.h" |
| 14 #include "base/threading/thread_task_runner_handle.h" | 15 #include "base/threading/thread_task_runner_handle.h" |
| 15 #include "base/time/time.h" | 16 #include "base/time/time.h" |
| 16 #include "base/trace_event/memory_allocator_dump.h" | 17 #include "base/trace_event/memory_allocator_dump.h" |
| 17 #include "base/trace_event/memory_dump_manager.h" | 18 #include "base/trace_event/memory_dump_manager.h" |
| 18 #include "base/trace_event/process_memory_dump.h" | 19 #include "base/trace_event/process_memory_dump.h" |
| 19 #include "base/trace_event/trace_event.h" | 20 #include "base/trace_event/trace_event.h" |
| 20 #include "gpu/command_buffer/common/buffer.h" | 21 #include "gpu/command_buffer/common/buffer.h" |
| 21 #include "gpu/command_buffer/common/command_buffer.h" | 22 #include "gpu/command_buffer/common/command_buffer.h" |
| 22 #include "gpu/command_buffer/common/constants.h" | 23 #include "gpu/command_buffer/common/constants.h" |
| (...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 370 | 371 |
| 371 MemoryAllocatorDump* dump = pmd->CreateAllocatorDump(base::StringPrintf( | 372 MemoryAllocatorDump* dump = pmd->CreateAllocatorDump(base::StringPrintf( |
| 372 "gpu/command_buffer_memory/buffer_%d", ring_buffer_id_)); | 373 "gpu/command_buffer_memory/buffer_%d", ring_buffer_id_)); |
| 373 dump->AddScalar(MemoryAllocatorDump::kNameSize, | 374 dump->AddScalar(MemoryAllocatorDump::kNameSize, |
| 374 MemoryAllocatorDump::kUnitsBytes, ring_buffer_size_); | 375 MemoryAllocatorDump::kUnitsBytes, ring_buffer_size_); |
| 375 | 376 |
| 376 if (args.level_of_detail != MemoryDumpLevelOfDetail::BACKGROUND) { | 377 if (args.level_of_detail != MemoryDumpLevelOfDetail::BACKGROUND) { |
| 377 dump->AddScalar( | 378 dump->AddScalar( |
| 378 "free_size", MemoryAllocatorDump::kUnitsBytes, | 379 "free_size", MemoryAllocatorDump::kUnitsBytes, |
| 379 GetTotalFreeEntriesNoWaiting() * sizeof(CommandBufferEntry)); | 380 GetTotalFreeEntriesNoWaiting() * sizeof(CommandBufferEntry)); |
| 380 auto guid = GetBufferGUIDForTracing(tracing_process_id, ring_buffer_id_); | 381 auto shared_memory = ring_buffer_->backing()->shared_memory(); |
| 381 const int kImportance = 2; | 382 if (shared_memory) { |
| 382 pmd->CreateSharedGlobalAllocatorDump(guid); | 383 auto guid = GetBufferGUIDForTracing(tracing_process_id, ring_buffer_id_); |
| 383 pmd->AddOwnershipEdge(dump->guid(), guid, kImportance); | 384 const int kImportance = 2; |
| 385 pmd->CreateSharedGlobalAllocatorDump(guid); |
| 386 pmd->AddOwnershipEdge(dump->guid(), guid, kImportance); |
| 387 base::SharedMemoryTracker::AddOwnershipEdgeToSharedGlobalDump(pmd, guid, |
| 388 shared_memory->handle(), shared_memory->mapped_size()); |
| 389 } |
| 384 } | 390 } |
| 385 | 391 |
| 386 return true; | 392 return true; |
| 387 } | 393 } |
| 388 | 394 |
| 389 } // namespace gpu | 395 } // namespace gpu |
| OLD | NEW |