Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(77)

Side by Side Diff: gpu/command_buffer/client/cmd_buffer_helper.cc

Issue 2694083005: memory-infra: Finish moving memory_infra from TracingController (Closed)
Patch Set: review Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 bool CommandBufferHelper::OnMemoryDump( 358 bool CommandBufferHelper::OnMemoryDump(
359 const base::trace_event::MemoryDumpArgs& args, 359 const base::trace_event::MemoryDumpArgs& args,
360 base::trace_event::ProcessMemoryDump* pmd) { 360 base::trace_event::ProcessMemoryDump* pmd) {
361 using base::trace_event::MemoryAllocatorDump; 361 using base::trace_event::MemoryAllocatorDump;
362 using base::trace_event::MemoryDumpLevelOfDetail; 362 using base::trace_event::MemoryDumpLevelOfDetail;
363 363
364 if (!HaveRingBuffer()) 364 if (!HaveRingBuffer())
365 return true; 365 return true;
366 366
367 const uint64_t tracing_process_id = 367 const uint64_t tracing_process_id =
368 base::trace_event::MemoryDumpManager::GetInstance() 368 base::trace_event::MemoryDumpManager::GetInstance()->tracing_process_id();
369 ->GetTracingProcessId();
370 369
371 MemoryAllocatorDump* dump = pmd->CreateAllocatorDump(base::StringPrintf( 370 MemoryAllocatorDump* dump = pmd->CreateAllocatorDump(base::StringPrintf(
372 "gpu/command_buffer_memory/buffer_%d", ring_buffer_id_)); 371 "gpu/command_buffer_memory/buffer_%d", ring_buffer_id_));
373 dump->AddScalar(MemoryAllocatorDump::kNameSize, 372 dump->AddScalar(MemoryAllocatorDump::kNameSize,
374 MemoryAllocatorDump::kUnitsBytes, ring_buffer_size_); 373 MemoryAllocatorDump::kUnitsBytes, ring_buffer_size_);
375 374
376 if (args.level_of_detail != MemoryDumpLevelOfDetail::BACKGROUND) { 375 if (args.level_of_detail != MemoryDumpLevelOfDetail::BACKGROUND) {
377 dump->AddScalar( 376 dump->AddScalar(
378 "free_size", MemoryAllocatorDump::kUnitsBytes, 377 "free_size", MemoryAllocatorDump::kUnitsBytes,
379 GetTotalFreeEntriesNoWaiting() * sizeof(CommandBufferEntry)); 378 GetTotalFreeEntriesNoWaiting() * sizeof(CommandBufferEntry));
380 auto guid = GetBufferGUIDForTracing(tracing_process_id, ring_buffer_id_); 379 auto guid = GetBufferGUIDForTracing(tracing_process_id, ring_buffer_id_);
381 const int kImportance = 2; 380 const int kImportance = 2;
382 pmd->CreateSharedGlobalAllocatorDump(guid); 381 pmd->CreateSharedGlobalAllocatorDump(guid);
383 pmd->AddOwnershipEdge(dump->guid(), guid, kImportance); 382 pmd->AddOwnershipEdge(dump->guid(), guid, kImportance);
384 } 383 }
385 384
386 return true; 385 return true;
387 } 386 }
388 387
389 } // namespace gpu 388 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698